'use strict'; var chokidar_1 = require('chokidar'); var fs$2 = require('fs'); var path = require('path'); var os = require('os'); var util_1 = require('util'); var stream_1 = require('stream'); var events_1 = require('events'); var crypto_1 = require('crypto'); var net_1 = require('net'); var url = require('url'); var child_process_1 = require('child_process'); var trace_mapping_1 = require('@jridgewell/trace-mapping'); var ts__default = require('typescript'); var compiler_1 = require('svelte/compiler'); var sade = require('sade'); var pc = require('picocolors'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n['default'] = e; return Object.freeze(n); } var chokidar_1__default = /*#__PURE__*/_interopDefaultLegacy(chokidar_1); var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$2); var fs__namespace = /*#__PURE__*/_interopNamespace(fs$2); var path__default = /*#__PURE__*/_interopDefaultLegacy(path); var path__namespace = /*#__PURE__*/_interopNamespace(path); var os__default = /*#__PURE__*/_interopDefaultLegacy(os); var util_1__default = /*#__PURE__*/_interopDefaultLegacy(util_1); var stream_1__default = /*#__PURE__*/_interopDefaultLegacy(stream_1); var events_1__default = /*#__PURE__*/_interopDefaultLegacy(events_1); var crypto_1__default = /*#__PURE__*/_interopDefaultLegacy(crypto_1); var net_1__default = /*#__PURE__*/_interopDefaultLegacy(net_1); var url__default = /*#__PURE__*/_interopDefaultLegacy(url); var child_process_1__default = /*#__PURE__*/_interopDefaultLegacy(child_process_1); var trace_mapping_1__default = /*#__PURE__*/_interopDefaultLegacy(trace_mapping_1); var ts__default__default = /*#__PURE__*/_interopDefaultLegacy(ts__default); var ts__default__namespace = /*#__PURE__*/_interopNamespace(ts__default); var compiler_1__default = /*#__PURE__*/_interopDefaultLegacy(compiler_1); var sade__default = /*#__PURE__*/_interopDefaultLegacy(sade); var pc__default = /*#__PURE__*/_interopDefaultLegacy(pc); var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } function createCommonjsModule(fn, basedir, module) { return module = { path: basedir, exports: {}, require: function (path, base) { return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); } }, fn(module, module.exports), module.exports; } function getAugmentedNamespace(n) { if (n.__esModule) return n; var a = Object.defineProperty({}, '__esModule', {value: true}); Object.keys(n).forEach(function (k) { var d = Object.getOwnPropertyDescriptor(n, k); Object.defineProperty(a, k, d.get ? d : { enumerable: true, get: function () { return n[k]; } }); }); return a; } function commonjsRequire () { throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); } var array = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.splitWhen = exports.flatten = void 0; function flatten(items) { return items.reduce((collection, item) => [].concat(collection, item), []); } exports.flatten = flatten; function splitWhen(items, predicate) { const result = [[]]; let groupIndex = 0; for (const item of items) { if (predicate(item)) { groupIndex++; result[groupIndex] = []; } else { result[groupIndex].push(item); } } return result; } exports.splitWhen = splitWhen; }); getDefaultExportFromCjs(array); var errno = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isEnoentCodeError = void 0; function isEnoentCodeError(error) { return error.code === 'ENOENT'; } exports.isEnoentCodeError = isEnoentCodeError; }); getDefaultExportFromCjs(errno); var fs$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createDirentFromStats = void 0; class DirentFromStats { constructor(name, stats) { this.name = name; this.isBlockDevice = stats.isBlockDevice.bind(stats); this.isCharacterDevice = stats.isCharacterDevice.bind(stats); this.isDirectory = stats.isDirectory.bind(stats); this.isFIFO = stats.isFIFO.bind(stats); this.isFile = stats.isFile.bind(stats); this.isSocket = stats.isSocket.bind(stats); this.isSymbolicLink = stats.isSymbolicLink.bind(stats); } } function createDirentFromStats(name, stats) { return new DirentFromStats(name, stats); } exports.createDirentFromStats = createDirentFromStats; }); getDefaultExportFromCjs(fs$1); var path_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.removeLeadingDotSegment = exports.escape = exports.makeAbsolute = exports.unixify = void 0; const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g; function unixify(filepath) { return filepath.replace(/\\/g, '/'); } exports.unixify = unixify; function makeAbsolute(cwd, filepath) { return path__default['default'].resolve(cwd, filepath); } exports.makeAbsolute = makeAbsolute; function escape(pattern) { return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); } exports.escape = escape; function removeLeadingDotSegment(entry) { if (entry.charAt(0) === '.') { const secondCharactery = entry.charAt(1); if (secondCharactery === '/' || secondCharactery === '\\') { return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); } } return entry; } exports.removeLeadingDotSegment = removeLeadingDotSegment; }); getDefaultExportFromCjs(path_1); /*! * is-extglob * * Copyright (c) 2014-2016, Jon Schlinkert. * Licensed under the MIT License. */ var isExtglob = function isExtglob(str) { if (typeof str !== 'string' || str === '') { return false; } var match; while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { if (match[2]) return true; str = str.slice(match.index + match[0].length); } return false; }; /*! * is-glob * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ var chars$1 = { '{': '}', '(': ')', '[': ']'}; var strictCheck = function(str) { if (str[0] === '!') { return true; } var index = 0; var pipeIndex = -2; var closeSquareIndex = -2; var closeCurlyIndex = -2; var closeParenIndex = -2; var backSlashIndex = -2; while (index < str.length) { if (str[index] === '*') { return true; } if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) { return true; } if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') { if (closeSquareIndex < index) { closeSquareIndex = str.indexOf(']', index); } if (closeSquareIndex > index) { if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { return true; } backSlashIndex = str.indexOf('\\', index); if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { return true; } } } if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') { closeCurlyIndex = str.indexOf('}', index); if (closeCurlyIndex > index) { backSlashIndex = str.indexOf('\\', index); if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { return true; } } } if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') { closeParenIndex = str.indexOf(')', index); if (closeParenIndex > index) { backSlashIndex = str.indexOf('\\', index); if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { return true; } } } if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') { if (pipeIndex < index) { pipeIndex = str.indexOf('|', index); } if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') { closeParenIndex = str.indexOf(')', pipeIndex); if (closeParenIndex > pipeIndex) { backSlashIndex = str.indexOf('\\', pipeIndex); if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { return true; } } } } if (str[index] === '\\') { var open = str[index + 1]; index += 2; var close = chars$1[open]; if (close) { var n = str.indexOf(close, index); if (n !== -1) { index = n + 1; } } if (str[index] === '!') { return true; } } else { index++; } } return false; }; var relaxedCheck = function(str) { if (str[0] === '!') { return true; } var index = 0; while (index < str.length) { if (/[*?{}()[\]]/.test(str[index])) { return true; } if (str[index] === '\\') { var open = str[index + 1]; index += 2; var close = chars$1[open]; if (close) { var n = str.indexOf(close, index); if (n !== -1) { index = n + 1; } } if (str[index] === '!') { return true; } } else { index++; } } return false; }; var isGlob = function isGlob(str, options) { if (typeof str !== 'string' || str === '') { return false; } if (isExtglob(str)) { return true; } var check = strictCheck; if (options && options.strict === false) { check = relaxedCheck; } return check(str); }; var pathPosixDirname = path__default['default'].posix.dirname; var isWin32 = os__default['default'].platform() === 'win32'; var slash = '/'; var backslash = /\\/g; var enclosure = /[\{\[].*[\}\]]$/; var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; var escaped$1 = /\\([\!\*\?\|\[\]\(\)\{\}])/g; var globParent = function globParent(str, opts) { var options = Object.assign({ flipBackslashes: true }, opts); if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { str = str.replace(backslash, slash); } if (enclosure.test(str)) { str += slash; } str += 'a'; do { str = pathPosixDirname(str); } while (isGlob(str) || globby.test(str)); return str.replace(escaped$1, '$1'); }; var utils$8 = createCommonjsModule(function (module, exports) { exports.isInteger = num => { if (typeof num === 'number') { return Number.isInteger(num); } if (typeof num === 'string' && num.trim() !== '') { return Number.isInteger(Number(num)); } return false; }; exports.find = (node, type) => node.nodes.find(node => node.type === type); exports.exceedsLimit = (min, max, step = 1, limit) => { if (limit === false) return false; if (!exports.isInteger(min) || !exports.isInteger(max)) return false; return ((Number(max) - Number(min)) / Number(step)) >= limit; }; exports.escapeNode = (block, n = 0, type) => { let node = block.nodes[n]; if (!node) return; if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { if (node.escaped !== true) { node.value = '\\' + node.value; node.escaped = true; } } }; exports.encloseBrace = node => { if (node.type !== 'brace') return false; if ((node.commas >> 0 + node.ranges >> 0) === 0) { node.invalid = true; return true; } return false; }; exports.isInvalidBrace = block => { if (block.type !== 'brace') return false; if (block.invalid === true || block.dollar) return true; if ((block.commas >> 0 + block.ranges >> 0) === 0) { block.invalid = true; return true; } if (block.open !== true || block.close !== true) { block.invalid = true; return true; } return false; }; exports.isOpenOrClose = node => { if (node.type === 'open' || node.type === 'close') { return true; } return node.open === true || node.close === true; }; exports.reduce = nodes => nodes.reduce((acc, node) => { if (node.type === 'text') acc.push(node.value); if (node.type === 'range') node.type = 'text'; return acc; }, []); exports.flatten = (...args) => { const result = []; const flat = arr => { for (let i = 0; i < arr.length; i++) { let ele = arr[i]; Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele); } return result; }; flat(args); return result; }; }); var stringify$3 = (ast, options = {}) => { let stringify = (node, parent = {}) => { let invalidBlock = options.escapeInvalid && utils$8.isInvalidBrace(parent); let invalidNode = node.invalid === true && options.escapeInvalid === true; let output = ''; if (node.value) { if ((invalidBlock || invalidNode) && utils$8.isOpenOrClose(node)) { return '\\' + node.value; } return node.value; } if (node.value) { return node.value; } if (node.nodes) { for (let child of node.nodes) { output += stringify(child); } } return output; }; return stringify(ast); }; /*! * is-number * * Copyright (c) 2014-present, Jon Schlinkert. * Released under the MIT License. */ var isNumber$3 = function(num) { if (typeof num === 'number') { return num - num === 0; } if (typeof num === 'string' && num.trim() !== '') { return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); } return false; }; const toRegexRange = (min, max, options) => { if (isNumber$3(min) === false) { throw new TypeError('toRegexRange: expected the first argument to be a number'); } if (max === void 0 || min === max) { return String(min); } if (isNumber$3(max) === false) { throw new TypeError('toRegexRange: expected the second argument to be a number.'); } let opts = { relaxZeros: true, ...options }; if (typeof opts.strictZeros === 'boolean') { opts.relaxZeros = opts.strictZeros === false; } let relax = String(opts.relaxZeros); let shorthand = String(opts.shorthand); let capture = String(opts.capture); let wrap = String(opts.wrap); let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap; if (toRegexRange.cache.hasOwnProperty(cacheKey)) { return toRegexRange.cache[cacheKey].result; } let a = Math.min(min, max); let b = Math.max(min, max); if (Math.abs(a - b) === 1) { let result = min + '|' + max; if (opts.capture) { return `(${result})`; } if (opts.wrap === false) { return result; } return `(?:${result})`; } let isPadded = hasPadding(min) || hasPadding(max); let state = { min, max, a, b }; let positives = []; let negatives = []; if (isPadded) { state.isPadded = isPadded; state.maxLen = String(state.max).length; } if (a < 0) { let newMin = b < 0 ? Math.abs(b) : 1; negatives = splitToPatterns(newMin, Math.abs(a), state, opts); a = state.a = 0; } if (b >= 0) { positives = splitToPatterns(a, b, state, opts); } state.negatives = negatives; state.positives = positives; state.result = collatePatterns(negatives, positives); if (opts.capture === true) { state.result = `(${state.result})`; } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) { state.result = `(?:${state.result})`; } toRegexRange.cache[cacheKey] = state; return state.result; }; function collatePatterns(neg, pos, options) { let onlyNegative = filterPatterns(neg, pos, '-', false) || []; let onlyPositive = filterPatterns(pos, neg, '', false) || []; let intersected = filterPatterns(neg, pos, '-?', true) || []; let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); return subpatterns.join('|'); } function splitToRanges(min, max) { let nines = 1; let zeros = 1; let stop = countNines(min, nines); let stops = new Set([max]); while (min <= stop && stop <= max) { stops.add(stop); nines += 1; stop = countNines(min, nines); } stop = countZeros(max + 1, zeros) - 1; while (min < stop && stop <= max) { stops.add(stop); zeros += 1; stop = countZeros(max + 1, zeros) - 1; } stops = [...stops]; stops.sort(compare); return stops; } function rangeToPattern(start, stop, options) { if (start === stop) { return { pattern: start, count: [], digits: 0 }; } let zipped = zip(start, stop); let digits = zipped.length; let pattern = ''; let count = 0; for (let i = 0; i < digits; i++) { let [startDigit, stopDigit] = zipped[i]; if (startDigit === stopDigit) { pattern += startDigit; } else if (startDigit !== '0' || stopDigit !== '9') { pattern += toCharacterClass(startDigit, stopDigit); } else { count++; } } if (count) { pattern += options.shorthand === true ? '\\d' : '[0-9]'; } return { pattern, count: [count], digits }; } function splitToPatterns(min, max, tok, options) { let ranges = splitToRanges(min, max); let tokens = []; let start = min; let prev; for (let i = 0; i < ranges.length; i++) { let max = ranges[i]; let obj = rangeToPattern(String(start), String(max), options); let zeros = ''; if (!tok.isPadded && prev && prev.pattern === obj.pattern) { if (prev.count.length > 1) { prev.count.pop(); } prev.count.push(obj.count[0]); prev.string = prev.pattern + toQuantifier(prev.count); start = max + 1; continue; } if (tok.isPadded) { zeros = padZeros(max, tok, options); } obj.string = zeros + obj.pattern + toQuantifier(obj.count); tokens.push(obj); start = max + 1; prev = obj; } return tokens; } function filterPatterns(arr, comparison, prefix, intersection, options) { let result = []; for (let ele of arr) { let { string } = ele; if (!intersection && !contains(comparison, 'string', string)) { result.push(prefix + string); } if (intersection && contains(comparison, 'string', string)) { result.push(prefix + string); } } return result; } function zip(a, b) { let arr = []; for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]); return arr; } function compare(a, b) { return a > b ? 1 : b > a ? -1 : 0; } function contains(arr, key, val) { return arr.some(ele => ele[key] === val); } function countNines(min, len) { return Number(String(min).slice(0, -len) + '9'.repeat(len)); } function countZeros(integer, zeros) { return integer - (integer % Math.pow(10, zeros)); } function toQuantifier(digits) { let [start = 0, stop = ''] = digits; if (stop || start > 1) { return `{${start + (stop ? ',' + stop : '')}}`; } return ''; } function toCharacterClass(a, b, options) { return `[${a}${(b - a === 1) ? '' : '-'}${b}]`; } function hasPadding(str) { return /^-?(0+)\d/.test(str); } function padZeros(value, tok, options) { if (!tok.isPadded) { return value; } let diff = Math.abs(tok.maxLen - String(value).length); let relax = options.relaxZeros !== false; switch (diff) { case 0: return ''; case 1: return relax ? '0?' : '0'; case 2: return relax ? '0{0,2}' : '00'; default: { return relax ? `0{0,${diff}}` : `0{${diff}}`; } } } toRegexRange.cache = {}; toRegexRange.clearCache = () => (toRegexRange.cache = {}); var toRegexRange_1 = toRegexRange; const isObject$2 = val => val !== null && typeof val === 'object' && !Array.isArray(val); const transform$2 = toNumber => { return value => toNumber === true ? Number(value) : String(value); }; const isValidValue = value => { return typeof value === 'number' || (typeof value === 'string' && value !== ''); }; const isNumber$2 = num => Number.isInteger(+num); const zeros = input => { let value = `${input}`; let index = -1; if (value[0] === '-') value = value.slice(1); if (value === '0') return false; while (value[++index] === '0'); return index > 0; }; const stringify$2 = (start, end, options) => { if (typeof start === 'string' || typeof end === 'string') { return true; } return options.stringify === true; }; const pad$1 = (input, maxLength, toNumber) => { if (maxLength > 0) { let dash = input[0] === '-' ? '-' : ''; if (dash) input = input.slice(1); input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0')); } if (toNumber === false) { return String(input); } return input; }; const toMaxLen = (input, maxLength) => { let negative = input[0] === '-' ? '-' : ''; if (negative) { input = input.slice(1); maxLength--; } while (input.length < maxLength) input = '0' + input; return negative ? ('-' + input) : input; }; const toSequence = (parts, options) => { parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); let prefix = options.capture ? '' : '?:'; let positives = ''; let negatives = ''; let result; if (parts.positives.length) { positives = parts.positives.join('|'); } if (parts.negatives.length) { negatives = `-(${prefix}${parts.negatives.join('|')})`; } if (positives && negatives) { result = `${positives}|${negatives}`; } else { result = positives || negatives; } if (options.wrap) { return `(${prefix}${result})`; } return result; }; const toRange = (a, b, isNumbers, options) => { if (isNumbers) { return toRegexRange_1(a, b, { wrap: false, ...options }); } let start = String.fromCharCode(a); if (a === b) return start; let stop = String.fromCharCode(b); return `[${start}-${stop}]`; }; const toRegex = (start, end, options) => { if (Array.isArray(start)) { let wrap = options.wrap === true; let prefix = options.capture ? '' : '?:'; return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); } return toRegexRange_1(start, end, options); }; const rangeError = (...args) => { return new RangeError('Invalid range arguments: ' + util_1__default['default'].inspect(...args)); }; const invalidRange = (start, end, options) => { if (options.strictRanges === true) throw rangeError([start, end]); return []; }; const invalidStep = (step, options) => { if (options.strictRanges === true) { throw new TypeError(`Expected step "${step}" to be a number`); } return []; }; const fillNumbers = (start, end, step = 1, options = {}) => { let a = Number(start); let b = Number(end); if (!Number.isInteger(a) || !Number.isInteger(b)) { if (options.strictRanges === true) throw rangeError([start, end]); return []; } if (a === 0) a = 0; if (b === 0) b = 0; let descending = a > b; let startString = String(start); let endString = String(end); let stepString = String(step); step = Math.max(Math.abs(step), 1); let padded = zeros(startString) || zeros(endString) || zeros(stepString); let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; let toNumber = padded === false && stringify$2(start, end, options) === false; let format = options.transform || transform$2(toNumber); if (options.toRegex && step === 1) { return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); } let parts = { negatives: [], positives: [] }; let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); let range = []; let index = 0; while (descending ? a >= b : a <= b) { if (options.toRegex === true && step > 1) { push(a); } else { range.push(pad$1(format(a, index), maxLen, toNumber)); } a = descending ? a - step : a + step; index++; } if (options.toRegex === true) { return step > 1 ? toSequence(parts, options) : toRegex(range, null, { wrap: false, ...options }); } return range; }; const fillLetters = (start, end, step = 1, options = {}) => { if ((!isNumber$2(start) && start.length > 1) || (!isNumber$2(end) && end.length > 1)) { return invalidRange(start, end, options); } let format = options.transform || (val => String.fromCharCode(val)); let a = `${start}`.charCodeAt(0); let b = `${end}`.charCodeAt(0); let descending = a > b; let min = Math.min(a, b); let max = Math.max(a, b); if (options.toRegex && step === 1) { return toRange(min, max, false, options); } let range = []; let index = 0; while (descending ? a >= b : a <= b) { range.push(format(a, index)); a = descending ? a - step : a + step; index++; } if (options.toRegex === true) { return toRegex(range, null, { wrap: false, options }); } return range; }; const fill = (start, end, step, options = {}) => { if (end == null && isValidValue(start)) { return [start]; } if (!isValidValue(start) || !isValidValue(end)) { return invalidRange(start, end, options); } if (typeof step === 'function') { return fill(start, end, 1, { transform: step }); } if (isObject$2(step)) { return fill(start, end, 0, step); } let opts = { ...options }; if (opts.capture === true) opts.wrap = true; step = step || opts.step || 1; if (!isNumber$2(step)) { if (step != null && !isObject$2(step)) return invalidStep(step, opts); return fill(start, end, 1, step); } if (isNumber$2(start) && isNumber$2(end)) { return fillNumbers(start, end, step, opts); } return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); }; var fillRange = fill; const compile = (ast, options = {}) => { let walk = (node, parent = {}) => { let invalidBlock = utils$8.isInvalidBrace(parent); let invalidNode = node.invalid === true && options.escapeInvalid === true; let invalid = invalidBlock === true || invalidNode === true; let prefix = options.escapeInvalid === true ? '\\' : ''; let output = ''; if (node.isOpen === true) { return prefix + node.value; } if (node.isClose === true) { return prefix + node.value; } if (node.type === 'open') { return invalid ? (prefix + node.value) : '('; } if (node.type === 'close') { return invalid ? (prefix + node.value) : ')'; } if (node.type === 'comma') { return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); } if (node.value) { return node.value; } if (node.nodes && node.ranges > 0) { let args = utils$8.reduce(node.nodes); let range = fillRange(...args, { ...options, wrap: false, toRegex: true }); if (range.length !== 0) { return args.length > 1 && range.length > 1 ? `(${range})` : range; } } if (node.nodes) { for (let child of node.nodes) { output += walk(child, node); } } return output; }; return walk(ast); }; var compile_1 = compile; const append$1 = (queue = '', stash = '', enclose = false) => { let result = []; queue = [].concat(queue); stash = [].concat(stash); if (!stash.length) return queue; if (!queue.length) { return enclose ? utils$8.flatten(stash).map(ele => `{${ele}}`) : stash; } for (let item of queue) { if (Array.isArray(item)) { for (let value of item) { result.push(append$1(value, stash, enclose)); } } else { for (let ele of stash) { if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; result.push(Array.isArray(ele) ? append$1(item, ele, enclose) : (item + ele)); } } } return utils$8.flatten(result); }; const expand = (ast, options = {}) => { let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; let walk = (node, parent = {}) => { node.queue = []; let p = parent; let q = parent.queue; while (p.type !== 'brace' && p.type !== 'root' && p.parent) { p = p.parent; q = p.queue; } if (node.invalid || node.dollar) { q.push(append$1(q.pop(), stringify$3(node, options))); return; } if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { q.push(append$1(q.pop(), ['{}'])); return; } if (node.nodes && node.ranges > 0) { let args = utils$8.reduce(node.nodes); if (utils$8.exceedsLimit(...args, options.step, rangeLimit)) { throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); } let range = fillRange(...args, options); if (range.length === 0) { range = stringify$3(node, options); } q.push(append$1(q.pop(), range)); node.nodes = []; return; } let enclose = utils$8.encloseBrace(node); let queue = node.queue; let block = node; while (block.type !== 'brace' && block.type !== 'root' && block.parent) { block = block.parent; queue = block.queue; } for (let i = 0; i < node.nodes.length; i++) { let child = node.nodes[i]; if (child.type === 'comma' && node.type === 'brace') { if (i === 1) queue.push(''); queue.push(''); continue; } if (child.type === 'close') { q.push(append$1(q.pop(), queue, enclose)); continue; } if (child.value && child.type !== 'open') { queue.push(append$1(queue.pop(), child.value)); continue; } if (child.nodes) { walk(child, node); } } return queue; }; return utils$8.flatten(walk(ast)); }; var expand_1 = expand; var constants$2 = { MAX_LENGTH: 1024 * 64, CHAR_0: '0', CHAR_9: '9', CHAR_UPPERCASE_A: 'A', CHAR_LOWERCASE_A: 'a', CHAR_UPPERCASE_Z: 'Z', CHAR_LOWERCASE_Z: 'z', CHAR_LEFT_PARENTHESES: '(', CHAR_RIGHT_PARENTHESES: ')', CHAR_ASTERISK: '*', CHAR_AMPERSAND: '&', CHAR_AT: '@', CHAR_BACKSLASH: '\\', CHAR_BACKTICK: '`', CHAR_CARRIAGE_RETURN: '\r', CHAR_CIRCUMFLEX_ACCENT: '^', CHAR_COLON: ':', CHAR_COMMA: ',', CHAR_DOLLAR: '$', CHAR_DOT: '.', CHAR_DOUBLE_QUOTE: '"', CHAR_EQUAL: '=', CHAR_EXCLAMATION_MARK: '!', CHAR_FORM_FEED: '\f', CHAR_FORWARD_SLASH: '/', CHAR_HASH: '#', CHAR_HYPHEN_MINUS: '-', CHAR_LEFT_ANGLE_BRACKET: '<', CHAR_LEFT_CURLY_BRACE: '{', CHAR_LEFT_SQUARE_BRACKET: '[', CHAR_LINE_FEED: '\n', CHAR_NO_BREAK_SPACE: '\u00A0', CHAR_PERCENT: '%', CHAR_PLUS: '+', CHAR_QUESTION_MARK: '?', CHAR_RIGHT_ANGLE_BRACKET: '>', CHAR_RIGHT_CURLY_BRACE: '}', CHAR_RIGHT_SQUARE_BRACKET: ']', CHAR_SEMICOLON: ';', CHAR_SINGLE_QUOTE: '\'', CHAR_SPACE: ' ', CHAR_TAB: '\t', CHAR_UNDERSCORE: '_', CHAR_VERTICAL_LINE: '|', CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' }; const { MAX_LENGTH: MAX_LENGTH$1, CHAR_BACKSLASH, CHAR_BACKTICK, CHAR_COMMA: CHAR_COMMA$1, CHAR_DOT: CHAR_DOT$1, CHAR_LEFT_PARENTHESES: CHAR_LEFT_PARENTHESES$1, CHAR_RIGHT_PARENTHESES: CHAR_RIGHT_PARENTHESES$1, CHAR_LEFT_CURLY_BRACE: CHAR_LEFT_CURLY_BRACE$1, CHAR_RIGHT_CURLY_BRACE: CHAR_RIGHT_CURLY_BRACE$1, CHAR_LEFT_SQUARE_BRACKET: CHAR_LEFT_SQUARE_BRACKET$1, CHAR_RIGHT_SQUARE_BRACKET: CHAR_RIGHT_SQUARE_BRACKET$1, CHAR_DOUBLE_QUOTE, CHAR_SINGLE_QUOTE, CHAR_NO_BREAK_SPACE, CHAR_ZERO_WIDTH_NOBREAK_SPACE } = constants$2; const parse$7 = (input, options = {}) => { if (typeof input !== 'string') { throw new TypeError('Expected a string'); } let opts = options || {}; let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1; if (input.length > max) { throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); } let ast = { type: 'root', input, nodes: [] }; let stack = [ast]; let block = ast; let prev = ast; let brackets = 0; let length = input.length; let index = 0; let depth = 0; let value; const advance = () => input[index++]; const push = node => { if (node.type === 'text' && prev.type === 'dot') { prev.type = 'text'; } if (prev && prev.type === 'text' && node.type === 'text') { prev.value += node.value; return; } block.nodes.push(node); node.parent = block; node.prev = prev; prev = node; return node; }; push({ type: 'bos' }); while (index < length) { block = stack[stack.length - 1]; value = advance(); if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { continue; } if (value === CHAR_BACKSLASH) { push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); continue; } if (value === CHAR_RIGHT_SQUARE_BRACKET$1) { push({ type: 'text', value: '\\' + value }); continue; } if (value === CHAR_LEFT_SQUARE_BRACKET$1) { brackets++; let next; while (index < length && (next = advance())) { value += next; if (next === CHAR_LEFT_SQUARE_BRACKET$1) { brackets++; continue; } if (next === CHAR_BACKSLASH) { value += advance(); continue; } if (next === CHAR_RIGHT_SQUARE_BRACKET$1) { brackets--; if (brackets === 0) { break; } } } push({ type: 'text', value }); continue; } if (value === CHAR_LEFT_PARENTHESES$1) { block = push({ type: 'paren', nodes: [] }); stack.push(block); push({ type: 'text', value }); continue; } if (value === CHAR_RIGHT_PARENTHESES$1) { if (block.type !== 'paren') { push({ type: 'text', value }); continue; } block = stack.pop(); push({ type: 'text', value }); block = stack[stack.length - 1]; continue; } if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { let open = value; let next; if (options.keepQuotes !== true) { value = ''; } while (index < length && (next = advance())) { if (next === CHAR_BACKSLASH) { value += next + advance(); continue; } if (next === open) { if (options.keepQuotes === true) value += next; break; } value += next; } push({ type: 'text', value }); continue; } if (value === CHAR_LEFT_CURLY_BRACE$1) { depth++; let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; let brace = { type: 'brace', open: true, close: false, dollar, depth, commas: 0, ranges: 0, nodes: [] }; block = push(brace); stack.push(block); push({ type: 'open', value }); continue; } if (value === CHAR_RIGHT_CURLY_BRACE$1) { if (block.type !== 'brace') { push({ type: 'text', value }); continue; } let type = 'close'; block = stack.pop(); block.close = true; push({ type, value }); depth--; block = stack[stack.length - 1]; continue; } if (value === CHAR_COMMA$1 && depth > 0) { if (block.ranges > 0) { block.ranges = 0; let open = block.nodes.shift(); block.nodes = [open, { type: 'text', value: stringify$3(block) }]; } push({ type: 'comma', value }); block.commas++; continue; } if (value === CHAR_DOT$1 && depth > 0 && block.commas === 0) { let siblings = block.nodes; if (depth === 0 || siblings.length === 0) { push({ type: 'text', value }); continue; } if (prev.type === 'dot') { block.range = []; prev.value += value; prev.type = 'range'; if (block.nodes.length !== 3 && block.nodes.length !== 5) { block.invalid = true; block.ranges = 0; prev.type = 'text'; continue; } block.ranges++; block.args = []; continue; } if (prev.type === 'range') { siblings.pop(); let before = siblings[siblings.length - 1]; before.value += prev.value + value; prev = before; block.ranges--; continue; } push({ type: 'dot', value }); continue; } push({ type: 'text', value }); } do { block = stack.pop(); if (block.type !== 'root') { block.nodes.forEach(node => { if (!node.nodes) { if (node.type === 'open') node.isOpen = true; if (node.type === 'close') node.isClose = true; if (!node.nodes) node.type = 'text'; node.invalid = true; } }); let parent = stack[stack.length - 1]; let index = parent.nodes.indexOf(block); parent.nodes.splice(index, 1, ...block.nodes); } } while (stack.length > 0); push({ type: 'eos' }); return ast; }; var parse_1$1 = parse$7; const braces = (input, options = {}) => { let output = []; if (Array.isArray(input)) { for (let pattern of input) { let result = braces.create(pattern, options); if (Array.isArray(result)) { output.push(...result); } else { output.push(result); } } } else { output = [].concat(braces.create(input, options)); } if (options && options.expand === true && options.nodupes === true) { output = [...new Set(output)]; } return output; }; braces.parse = (input, options = {}) => parse_1$1(input, options); braces.stringify = (input, options = {}) => { if (typeof input === 'string') { return stringify$3(braces.parse(input, options), options); } return stringify$3(input, options); }; braces.compile = (input, options = {}) => { if (typeof input === 'string') { input = braces.parse(input, options); } return compile_1(input, options); }; braces.expand = (input, options = {}) => { if (typeof input === 'string') { input = braces.parse(input, options); } let result = expand_1(input, options); if (options.noempty === true) { result = result.filter(Boolean); } if (options.nodupes === true) { result = [...new Set(result)]; } return result; }; braces.create = (input, options = {}) => { if (input === '' || input.length < 3) { return [input]; } return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options); }; var braces_1 = braces; const WIN_SLASH = '\\\\/'; const WIN_NO_SLASH = `[^${WIN_SLASH}]`; const DOT_LITERAL = '\\.'; const PLUS_LITERAL = '\\+'; const QMARK_LITERAL = '\\?'; const SLASH_LITERAL = '\\/'; const ONE_CHAR = '(?=.)'; const QMARK = '[^/]'; const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; const NO_DOT = `(?!${DOT_LITERAL})`; const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; const STAR = `${QMARK}*?`; const POSIX_CHARS = { DOT_LITERAL, PLUS_LITERAL, QMARK_LITERAL, SLASH_LITERAL, ONE_CHAR, QMARK, END_ANCHOR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK_NO_DOT, STAR, START_ANCHOR }; const WINDOWS_CHARS = { ...POSIX_CHARS, SLASH_LITERAL: `[${WIN_SLASH}]`, QMARK: WIN_NO_SLASH, STAR: `${WIN_NO_SLASH}*?`, DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, NO_DOT: `(?!${DOT_LITERAL})`, NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, QMARK_NO_DOT: `[^.${WIN_SLASH}]`, START_ANCHOR: `(?:^|[${WIN_SLASH}])`, END_ANCHOR: `(?:[${WIN_SLASH}]|$)` }; const POSIX_REGEX_SOURCE$1 = { alnum: 'a-zA-Z0-9', alpha: 'a-zA-Z', ascii: '\\x00-\\x7F', blank: ' \\t', cntrl: '\\x00-\\x1F\\x7F', digit: '0-9', graph: '\\x21-\\x7E', lower: 'a-z', print: '\\x20-\\x7E ', punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', space: ' \\t\\r\\n\\v\\f', upper: 'A-Z', word: 'A-Za-z0-9_', xdigit: 'A-Fa-f0-9' }; var constants$1 = { MAX_LENGTH: 1024 * 64, POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1, REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, REPLACEMENTS: { '***': '*', '**/**': '**', '**/**/**': '**' }, CHAR_0: 48, CHAR_9: 57, CHAR_UPPERCASE_A: 65, CHAR_LOWERCASE_A: 97, CHAR_UPPERCASE_Z: 90, CHAR_LOWERCASE_Z: 122, CHAR_LEFT_PARENTHESES: 40, CHAR_RIGHT_PARENTHESES: 41, CHAR_ASTERISK: 42, CHAR_AMPERSAND: 38, CHAR_AT: 64, CHAR_BACKWARD_SLASH: 92, CHAR_CARRIAGE_RETURN: 13, CHAR_CIRCUMFLEX_ACCENT: 94, CHAR_COLON: 58, CHAR_COMMA: 44, CHAR_DOT: 46, CHAR_DOUBLE_QUOTE: 34, CHAR_EQUAL: 61, CHAR_EXCLAMATION_MARK: 33, CHAR_FORM_FEED: 12, CHAR_FORWARD_SLASH: 47, CHAR_GRAVE_ACCENT: 96, CHAR_HASH: 35, CHAR_HYPHEN_MINUS: 45, CHAR_LEFT_ANGLE_BRACKET: 60, CHAR_LEFT_CURLY_BRACE: 123, CHAR_LEFT_SQUARE_BRACKET: 91, CHAR_LINE_FEED: 10, CHAR_NO_BREAK_SPACE: 160, CHAR_PERCENT: 37, CHAR_PLUS: 43, CHAR_QUESTION_MARK: 63, CHAR_RIGHT_ANGLE_BRACKET: 62, CHAR_RIGHT_CURLY_BRACE: 125, CHAR_RIGHT_SQUARE_BRACKET: 93, CHAR_SEMICOLON: 59, CHAR_SINGLE_QUOTE: 39, CHAR_SPACE: 32, CHAR_TAB: 9, CHAR_UNDERSCORE: 95, CHAR_VERTICAL_LINE: 124, CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, SEP: path__default['default'].sep, extglobChars(chars) { return { '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, '?': { type: 'qmark', open: '(?:', close: ')?' }, '+': { type: 'plus', open: '(?:', close: ')+' }, '*': { type: 'star', open: '(?:', close: ')*' }, '@': { type: 'at', open: '(?:', close: ')' } }; }, globChars(win32) { return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; } }; var utils$7 = createCommonjsModule(function (module, exports) { const win32 = process.platform === 'win32'; const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = constants$1; exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); exports.removeBackslashes = str => { return str.replace(REGEX_REMOVE_BACKSLASH, match => { return match === '\\' ? '' : match; }); }; exports.supportsLookbehinds = () => { const segs = process.version.slice(1).split('.').map(Number); if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { return true; } return false; }; exports.isWindows = options => { if (options && typeof options.windows === 'boolean') { return options.windows; } return win32 === true || path__default['default'].sep === '\\'; }; exports.escapeLast = (input, char, lastIdx) => { const idx = input.lastIndexOf(char, lastIdx); if (idx === -1) return input; if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); return `${input.slice(0, idx)}\\${input.slice(idx)}`; }; exports.removePrefix = (input, state = {}) => { let output = input; if (output.startsWith('./')) { output = output.slice(2); state.prefix = './'; } return output; }; exports.wrapOutput = (input, state = {}, options = {}) => { const prepend = options.contains ? '' : '^'; const append = options.contains ? '' : '$'; let output = `${prepend}(?:${input})${append}`; if (state.negated === true) { output = `(?:^(?!${output}).*$)`; } return output; }; }); const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = constants$1; const isPathSeparator = code => { return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; }; const depth = token => { if (token.isPrefix !== true) { token.depth = token.isGlobstar ? Infinity : 1; } }; const scan = (input, options) => { const opts = options || {}; const length = input.length - 1; const scanToEnd = opts.parts === true || opts.scanToEnd === true; const slashes = []; const tokens = []; const parts = []; let str = input; let index = -1; let start = 0; let lastIndex = 0; let isBrace = false; let isBracket = false; let isGlob = false; let isExtglob = false; let isGlobstar = false; let braceEscaped = false; let backslashes = false; let negated = false; let negatedExtglob = false; let finished = false; let braces = 0; let prev; let code; let token = { value: '', depth: 0, isGlob: false }; const eos = () => index >= length; const peek = () => str.charCodeAt(index + 1); const advance = () => { prev = code; return str.charCodeAt(++index); }; while (index < length) { code = advance(); let next; if (code === CHAR_BACKWARD_SLASH) { backslashes = token.backslashes = true; code = advance(); if (code === CHAR_LEFT_CURLY_BRACE) { braceEscaped = true; } continue; } if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { braces++; while (eos() !== true && (code = advance())) { if (code === CHAR_BACKWARD_SLASH) { backslashes = token.backslashes = true; advance(); continue; } if (code === CHAR_LEFT_CURLY_BRACE) { braces++; continue; } if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { isBrace = token.isBrace = true; isGlob = token.isGlob = true; finished = true; if (scanToEnd === true) { continue; } break; } if (braceEscaped !== true && code === CHAR_COMMA) { isBrace = token.isBrace = true; isGlob = token.isGlob = true; finished = true; if (scanToEnd === true) { continue; } break; } if (code === CHAR_RIGHT_CURLY_BRACE) { braces--; if (braces === 0) { braceEscaped = false; isBrace = token.isBrace = true; finished = true; break; } } } if (scanToEnd === true) { continue; } break; } if (code === CHAR_FORWARD_SLASH) { slashes.push(index); tokens.push(token); token = { value: '', depth: 0, isGlob: false }; if (finished === true) continue; if (prev === CHAR_DOT && index === (start + 1)) { start += 2; continue; } lastIndex = index + 1; continue; } if (opts.noext !== true) { const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK; if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { isGlob = token.isGlob = true; isExtglob = token.isExtglob = true; finished = true; if (code === CHAR_EXCLAMATION_MARK && index === start) { negatedExtglob = true; } if (scanToEnd === true) { while (eos() !== true && (code = advance())) { if (code === CHAR_BACKWARD_SLASH) { backslashes = token.backslashes = true; code = advance(); continue; } if (code === CHAR_RIGHT_PARENTHESES) { isGlob = token.isGlob = true; finished = true; break; } } continue; } break; } } if (code === CHAR_ASTERISK) { if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; isGlob = token.isGlob = true; finished = true; if (scanToEnd === true) { continue; } break; } if (code === CHAR_QUESTION_MARK) { isGlob = token.isGlob = true; finished = true; if (scanToEnd === true) { continue; } break; } if (code === CHAR_LEFT_SQUARE_BRACKET) { while (eos() !== true && (next = advance())) { if (next === CHAR_BACKWARD_SLASH) { backslashes = token.backslashes = true; advance(); continue; } if (next === CHAR_RIGHT_SQUARE_BRACKET) { isBracket = token.isBracket = true; isGlob = token.isGlob = true; finished = true; break; } } if (scanToEnd === true) { continue; } break; } if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { negated = token.negated = true; start++; continue; } if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { isGlob = token.isGlob = true; if (scanToEnd === true) { while (eos() !== true && (code = advance())) { if (code === CHAR_LEFT_PARENTHESES) { backslashes = token.backslashes = true; code = advance(); continue; } if (code === CHAR_RIGHT_PARENTHESES) { finished = true; break; } } continue; } break; } if (isGlob === true) { finished = true; if (scanToEnd === true) { continue; } break; } } if (opts.noext === true) { isExtglob = false; isGlob = false; } let base = str; let prefix = ''; let glob = ''; if (start > 0) { prefix = str.slice(0, start); str = str.slice(start); lastIndex -= start; } if (base && isGlob === true && lastIndex > 0) { base = str.slice(0, lastIndex); glob = str.slice(lastIndex); } else if (isGlob === true) { base = ''; glob = str; } else { base = str; } if (base && base !== '' && base !== '/' && base !== str) { if (isPathSeparator(base.charCodeAt(base.length - 1))) { base = base.slice(0, -1); } } if (opts.unescape === true) { if (glob) glob = utils$7.removeBackslashes(glob); if (base && backslashes === true) { base = utils$7.removeBackslashes(base); } } const state = { prefix, input, start, base, glob, isBrace, isBracket, isGlob, isExtglob, isGlobstar, negated, negatedExtglob }; if (opts.tokens === true) { state.maxDepth = 0; if (!isPathSeparator(code)) { tokens.push(token); } state.tokens = tokens; } if (opts.parts === true || opts.tokens === true) { let prevIndex; for (let idx = 0; idx < slashes.length; idx++) { const n = prevIndex ? prevIndex + 1 : start; const i = slashes[idx]; const value = input.slice(n, i); if (opts.tokens) { if (idx === 0 && start !== 0) { tokens[idx].isPrefix = true; tokens[idx].value = prefix; } else { tokens[idx].value = value; } depth(tokens[idx]); state.maxDepth += tokens[idx].depth; } if (idx !== 0 || value !== '') { parts.push(value); } prevIndex = i; } if (prevIndex && prevIndex + 1 < input.length) { const value = input.slice(prevIndex + 1); parts.push(value); if (opts.tokens) { tokens[tokens.length - 1].value = value; depth(tokens[tokens.length - 1]); state.maxDepth += tokens[tokens.length - 1].depth; } } state.slashes = slashes; state.parts = parts; } return state; }; var scan_1 = scan; const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1; const expandRange = (args, options) => { if (typeof options.expandRange === 'function') { return options.expandRange(...args, options); } args.sort(); const value = `[${args.join('-')}]`; try { new RegExp(value); } catch (ex) { return args.map(v => utils$7.escapeRegex(v)).join('..'); } return value; }; const syntaxError = (type, char) => { return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; }; const parse$6 = (input, options) => { if (typeof input !== 'string') { throw new TypeError('Expected a string'); } input = REPLACEMENTS[input] || input; const opts = { ...options }; const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; let len = input.length; if (len > max) { throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); } const bos = { type: 'bos', value: '', output: opts.prepend || '' }; const tokens = [bos]; const capture = opts.capture ? '' : '?:'; const win32 = utils$7.isWindows(options); const PLATFORM_CHARS = constants$1.globChars(win32); const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS); const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS; const globstar = opts => { return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; }; const nodot = opts.dot ? '' : NO_DOT; const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; let star = opts.bash === true ? globstar(opts) : STAR; if (opts.capture) { star = `(${star})`; } if (typeof opts.noext === 'boolean') { opts.noextglob = opts.noext; } const state = { input, index: -1, start: 0, dot: opts.dot === true, consumed: '', output: '', prefix: '', backtrack: false, negated: false, brackets: 0, braces: 0, parens: 0, quotes: 0, globstar: false, tokens }; input = utils$7.removePrefix(input, state); len = input.length; const extglobs = []; const braces = []; const stack = []; let prev = bos; let value; const eos = () => state.index === len - 1; const peek = state.peek = (n = 1) => input[state.index + n]; const advance = state.advance = () => input[++state.index] || ''; const remaining = () => input.slice(state.index + 1); const consume = (value = '', num = 0) => { state.consumed += value; state.index += num; }; const append = token => { state.output += token.output != null ? token.output : token.value; consume(token.value); }; const negate = () => { let count = 1; while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { advance(); state.start++; count++; } if (count % 2 === 0) { return false; } state.negated = true; state.start++; return true; }; const increment = type => { state[type]++; stack.push(type); }; const decrement = type => { state[type]--; stack.pop(); }; const push = tok => { if (prev.type === 'globstar') { const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { state.output = state.output.slice(0, -prev.output.length); prev.type = 'star'; prev.value = '*'; prev.output = star; state.output += prev.output; } } if (extglobs.length && tok.type !== 'paren') { extglobs[extglobs.length - 1].inner += tok.value; } if (tok.value || tok.output) append(tok); if (prev && prev.type === 'text' && tok.type === 'text') { prev.value += tok.value; prev.output = (prev.output || '') + tok.value; return; } tok.prev = prev; tokens.push(tok); prev = tok; }; const extglobOpen = (type, value) => { const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; token.prev = prev; token.parens = state.parens; token.output = state.output; const output = (opts.capture ? '(' : '') + token.open; increment('parens'); push({ type, value, output: state.output ? '' : ONE_CHAR }); push({ type: 'paren', extglob: true, value: advance(), output }); extglobs.push(token); }; const extglobClose = token => { let output = token.close + (opts.capture ? ')' : ''); let rest; if (token.type === 'negate') { let extglobStar = star; if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { extglobStar = globstar(opts); } if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { output = token.close = `)$))${extglobStar}`; } if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { const expression = parse$6(rest, { ...options, fastpaths: false }).output; output = token.close = `)${expression})${extglobStar})`; } if (token.prev.type === 'bos') { state.negatedExtglob = true; } } push({ type: 'paren', extglob: true, value, output }); decrement('parens'); }; if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { let backslashes = false; let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { if (first === '\\') { backslashes = true; return m; } if (first === '?') { if (esc) { return esc + first + (rest ? QMARK.repeat(rest.length) : ''); } if (index === 0) { return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); } return QMARK.repeat(chars.length); } if (first === '.') { return DOT_LITERAL.repeat(chars.length); } if (first === '*') { if (esc) { return esc + first + (rest ? star : ''); } return star; } return esc ? m : `\\${m}`; }); if (backslashes === true) { if (opts.unescape === true) { output = output.replace(/\\/g, ''); } else { output = output.replace(/\\+/g, m => { return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); }); } } if (output === input && opts.contains === true) { state.output = input; return state; } state.output = utils$7.wrapOutput(output, state, options); return state; } while (!eos()) { value = advance(); if (value === '\u0000') { continue; } if (value === '\\') { const next = peek(); if (next === '/' && opts.bash !== true) { continue; } if (next === '.' || next === ';') { continue; } if (!next) { value += '\\'; push({ type: 'text', value }); continue; } const match = /^\\+/.exec(remaining()); let slashes = 0; if (match && match[0].length > 2) { slashes = match[0].length; state.index += slashes; if (slashes % 2 !== 0) { value += '\\'; } } if (opts.unescape === true) { value = advance(); } else { value += advance(); } if (state.brackets === 0) { push({ type: 'text', value }); continue; } } if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { if (opts.posix !== false && value === ':') { const inner = prev.value.slice(1); if (inner.includes('[')) { prev.posix = true; if (inner.includes(':')) { const idx = prev.value.lastIndexOf('['); const pre = prev.value.slice(0, idx); const rest = prev.value.slice(idx + 2); const posix = POSIX_REGEX_SOURCE[rest]; if (posix) { prev.value = pre + posix; state.backtrack = true; advance(); if (!bos.output && tokens.indexOf(prev) === 1) { bos.output = ONE_CHAR; } continue; } } } } if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { value = `\\${value}`; } if (value === ']' && (prev.value === '[' || prev.value === '[^')) { value = `\\${value}`; } if (opts.posix === true && value === '!' && prev.value === '[') { value = '^'; } prev.value += value; append({ value }); continue; } if (state.quotes === 1 && value !== '"') { value = utils$7.escapeRegex(value); prev.value += value; append({ value }); continue; } if (value === '"') { state.quotes = state.quotes === 1 ? 0 : 1; if (opts.keepQuotes === true) { push({ type: 'text', value }); } continue; } if (value === '(') { increment('parens'); push({ type: 'paren', value }); continue; } if (value === ')') { if (state.parens === 0 && opts.strictBrackets === true) { throw new SyntaxError(syntaxError('opening', '(')); } const extglob = extglobs[extglobs.length - 1]; if (extglob && state.parens === extglob.parens + 1) { extglobClose(extglobs.pop()); continue; } push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); decrement('parens'); continue; } if (value === '[') { if (opts.nobracket === true || !remaining().includes(']')) { if (opts.nobracket !== true && opts.strictBrackets === true) { throw new SyntaxError(syntaxError('closing', ']')); } value = `\\${value}`; } else { increment('brackets'); } push({ type: 'bracket', value }); continue; } if (value === ']') { if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { push({ type: 'text', value, output: `\\${value}` }); continue; } if (state.brackets === 0) { if (opts.strictBrackets === true) { throw new SyntaxError(syntaxError('opening', '[')); } push({ type: 'text', value, output: `\\${value}` }); continue; } decrement('brackets'); const prevValue = prev.value.slice(1); if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { value = `/${value}`; } prev.value += value; append({ value }); if (opts.literalBrackets === false || utils$7.hasRegexChars(prevValue)) { continue; } const escaped = utils$7.escapeRegex(prev.value); state.output = state.output.slice(0, -prev.value.length); if (opts.literalBrackets === true) { state.output += escaped; prev.value = escaped; continue; } prev.value = `(${capture}${escaped}|${prev.value})`; state.output += prev.value; continue; } if (value === '{' && opts.nobrace !== true) { increment('braces'); const open = { type: 'brace', value, output: '(', outputIndex: state.output.length, tokensIndex: state.tokens.length }; braces.push(open); push(open); continue; } if (value === '}') { const brace = braces[braces.length - 1]; if (opts.nobrace === true || !brace) { push({ type: 'text', value, output: value }); continue; } let output = ')'; if (brace.dots === true) { const arr = tokens.slice(); const range = []; for (let i = arr.length - 1; i >= 0; i--) { tokens.pop(); if (arr[i].type === 'brace') { break; } if (arr[i].type !== 'dots') { range.unshift(arr[i].value); } } output = expandRange(range, opts); state.backtrack = true; } if (brace.comma !== true && brace.dots !== true) { const out = state.output.slice(0, brace.outputIndex); const toks = state.tokens.slice(brace.tokensIndex); brace.value = brace.output = '\\{'; value = output = '\\}'; state.output = out; for (const t of toks) { state.output += (t.output || t.value); } } push({ type: 'brace', value, output }); decrement('braces'); braces.pop(); continue; } if (value === '|') { if (extglobs.length > 0) { extglobs[extglobs.length - 1].conditions++; } push({ type: 'text', value }); continue; } if (value === ',') { let output = value; const brace = braces[braces.length - 1]; if (brace && stack[stack.length - 1] === 'braces') { brace.comma = true; output = '|'; } push({ type: 'comma', value, output }); continue; } if (value === '/') { if (prev.type === 'dot' && state.index === state.start + 1) { state.start = state.index + 1; state.consumed = ''; state.output = ''; tokens.pop(); prev = bos; continue; } push({ type: 'slash', value, output: SLASH_LITERAL }); continue; } if (value === '.') { if (state.braces > 0 && prev.type === 'dot') { if (prev.value === '.') prev.output = DOT_LITERAL; const brace = braces[braces.length - 1]; prev.type = 'dots'; prev.output += value; prev.value += value; brace.dots = true; continue; } if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { push({ type: 'text', value, output: DOT_LITERAL }); continue; } push({ type: 'dot', value, output: DOT_LITERAL }); continue; } if (value === '?') { const isGroup = prev && prev.value === '('; if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { extglobOpen('qmark', value); continue; } if (prev && prev.type === 'paren') { const next = peek(); let output = value; if (next === '<' && !utils$7.supportsLookbehinds()) { throw new Error('Node.js v10 or higher is required for regex lookbehinds'); } if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { output = `\\${value}`; } push({ type: 'text', value, output }); continue; } if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { push({ type: 'qmark', value, output: QMARK_NO_DOT }); continue; } push({ type: 'qmark', value, output: QMARK }); continue; } if (value === '!') { if (opts.noextglob !== true && peek() === '(') { if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { extglobOpen('negate', value); continue; } } if (opts.nonegate !== true && state.index === 0) { negate(); continue; } } if (value === '+') { if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { extglobOpen('plus', value); continue; } if ((prev && prev.value === '(') || opts.regex === false) { push({ type: 'plus', value, output: PLUS_LITERAL }); continue; } if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { push({ type: 'plus', value }); continue; } push({ type: 'plus', value: PLUS_LITERAL }); continue; } if (value === '@') { if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { push({ type: 'at', extglob: true, value, output: '' }); continue; } push({ type: 'text', value }); continue; } if (value !== '*') { if (value === '$' || value === '^') { value = `\\${value}`; } const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); if (match) { value += match[0]; state.index += match[0].length; } push({ type: 'text', value }); continue; } if (prev && (prev.type === 'globstar' || prev.star === true)) { prev.type = 'star'; prev.star = true; prev.value += value; prev.output = star; state.backtrack = true; state.globstar = true; consume(value); continue; } let rest = remaining(); if (opts.noextglob !== true && /^\([^?]/.test(rest)) { extglobOpen('star', value); continue; } if (prev.type === 'star') { if (opts.noglobstar === true) { consume(value); continue; } const prior = prev.prev; const before = prior.prev; const isStart = prior.type === 'slash' || prior.type === 'bos'; const afterStar = before && (before.type === 'star' || before.type === 'globstar'); if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { push({ type: 'star', value, output: '' }); continue; } const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { push({ type: 'star', value, output: '' }); continue; } while (rest.slice(0, 3) === '/**') { const after = input[state.index + 4]; if (after && after !== '/') { break; } rest = rest.slice(3); consume('/**', 3); } if (prior.type === 'bos' && eos()) { prev.type = 'globstar'; prev.value += value; prev.output = globstar(opts); state.output = prev.output; state.globstar = true; consume(value); continue; } if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { state.output = state.output.slice(0, -(prior.output + prev.output).length); prior.output = `(?:${prior.output}`; prev.type = 'globstar'; prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); prev.value += value; state.globstar = true; state.output += prior.output + prev.output; consume(value); continue; } if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { const end = rest[1] !== void 0 ? '|$' : ''; state.output = state.output.slice(0, -(prior.output + prev.output).length); prior.output = `(?:${prior.output}`; prev.type = 'globstar'; prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; prev.value += value; state.output += prior.output + prev.output; state.globstar = true; consume(value + advance()); push({ type: 'slash', value: '/', output: '' }); continue; } if (prior.type === 'bos' && rest[0] === '/') { prev.type = 'globstar'; prev.value += value; prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; state.output = prev.output; state.globstar = true; consume(value + advance()); push({ type: 'slash', value: '/', output: '' }); continue; } state.output = state.output.slice(0, -prev.output.length); prev.type = 'globstar'; prev.output = globstar(opts); prev.value += value; state.output += prev.output; state.globstar = true; consume(value); continue; } const token = { type: 'star', value, output: star }; if (opts.bash === true) { token.output = '.*?'; if (prev.type === 'bos' || prev.type === 'slash') { token.output = nodot + token.output; } push(token); continue; } if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { token.output = value; push(token); continue; } if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { if (prev.type === 'dot') { state.output += NO_DOT_SLASH; prev.output += NO_DOT_SLASH; } else if (opts.dot === true) { state.output += NO_DOTS_SLASH; prev.output += NO_DOTS_SLASH; } else { state.output += nodot; prev.output += nodot; } if (peek() !== '*') { state.output += ONE_CHAR; prev.output += ONE_CHAR; } } push(token); } while (state.brackets > 0) { if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); state.output = utils$7.escapeLast(state.output, '['); decrement('brackets'); } while (state.parens > 0) { if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); state.output = utils$7.escapeLast(state.output, '('); decrement('parens'); } while (state.braces > 0) { if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); state.output = utils$7.escapeLast(state.output, '{'); decrement('braces'); } if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); } if (state.backtrack === true) { state.output = ''; for (const token of state.tokens) { state.output += token.output != null ? token.output : token.value; if (token.suffix) { state.output += token.suffix; } } } return state; }; parse$6.fastpaths = (input, options) => { const opts = { ...options }; const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; const len = input.length; if (len > max) { throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); } input = REPLACEMENTS[input] || input; const win32 = utils$7.isWindows(options); const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants$1.globChars(win32); const nodot = opts.dot ? NO_DOTS : NO_DOT; const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; const capture = opts.capture ? '' : '?:'; const state = { negated: false, prefix: '' }; let star = opts.bash === true ? '.*?' : STAR; if (opts.capture) { star = `(${star})`; } const globstar = opts => { if (opts.noglobstar === true) return star; return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; }; const create = str => { switch (str) { case '*': return `${nodot}${ONE_CHAR}${star}`; case '.*': return `${DOT_LITERAL}${ONE_CHAR}${star}`; case '*.*': return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; case '*/*': return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; case '**': return nodot + globstar(opts); case '**/*': return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; case '**/*.*': return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; case '**/.*': return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; default: { const match = /^(.*?)\.(\w+)$/.exec(str); if (!match) return; const source = create(match[1]); if (!source) return; return source + DOT_LITERAL + match[2]; } } }; const output = utils$7.removePrefix(input, state); let source = create(output); if (source && opts.strictSlashes !== true) { source += `${SLASH_LITERAL}?`; } return source; }; var parse_1 = parse$6; const isObject$1 = val => val && typeof val === 'object' && !Array.isArray(val); const picomatch$1 = (glob, options, returnState = false) => { if (Array.isArray(glob)) { const fns = glob.map(input => picomatch$1(input, options, returnState)); const arrayMatcher = str => { for (const isMatch of fns) { const state = isMatch(str); if (state) return state; } return false; }; return arrayMatcher; } const isState = isObject$1(glob) && glob.tokens && glob.input; if (glob === '' || (typeof glob !== 'string' && !isState)) { throw new TypeError('Expected pattern to be a non-empty string'); } const opts = options || {}; const posix = utils$7.isWindows(options); const regex = isState ? picomatch$1.compileRe(glob, options) : picomatch$1.makeRe(glob, options, false, true); const state = regex.state; delete regex.state; let isIgnored = () => false; if (opts.ignore) { const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState); } const matcher = (input, returnObject = false) => { const { isMatch, match, output } = picomatch$1.test(input, regex, options, { glob, posix }); const result = { glob, state, regex, posix, input, output, match, isMatch }; if (typeof opts.onResult === 'function') { opts.onResult(result); } if (isMatch === false) { result.isMatch = false; return returnObject ? result : false; } if (isIgnored(input)) { if (typeof opts.onIgnore === 'function') { opts.onIgnore(result); } result.isMatch = false; return returnObject ? result : false; } if (typeof opts.onMatch === 'function') { opts.onMatch(result); } return returnObject ? result : true; }; if (returnState) { matcher.state = state; } return matcher; }; picomatch$1.test = (input, regex, options, { glob, posix } = {}) => { if (typeof input !== 'string') { throw new TypeError('Expected input to be a string'); } if (input === '') { return { isMatch: false, output: '' }; } const opts = options || {}; const format = opts.format || (posix ? utils$7.toPosixSlashes : null); let match = input === glob; let output = (match && format) ? format(input) : input; if (match === false) { output = format ? format(input) : input; match = output === glob; } if (match === false || opts.capture === true) { if (opts.matchBase === true || opts.basename === true) { match = picomatch$1.matchBase(input, regex, options, posix); } else { match = regex.exec(output); } } return { isMatch: Boolean(match), match, output }; }; picomatch$1.matchBase = (input, glob, options, posix = utils$7.isWindows(options)) => { const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options); return regex.test(path__default['default'].basename(input)); }; picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str); picomatch$1.parse = (pattern, options) => { if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options)); return parse_1(pattern, { ...options, fastpaths: false }); }; picomatch$1.scan = (input, options) => scan_1(input, options); picomatch$1.compileRe = (state, options, returnOutput = false, returnState = false) => { if (returnOutput === true) { return state.output; } const opts = options || {}; const prepend = opts.contains ? '' : '^'; const append = opts.contains ? '' : '$'; let source = `${prepend}(?:${state.output})${append}`; if (state && state.negated === true) { source = `^(?!${source}).*$`; } const regex = picomatch$1.toRegex(source, options); if (returnState === true) { regex.state = state; } return regex; }; picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { if (!input || typeof input !== 'string') { throw new TypeError('Expected a non-empty string'); } let parsed = { negated: false, fastpaths: true }; if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { parsed.output = parse_1.fastpaths(input, options); } if (!parsed.output) { parsed = parse_1(input, options); } return picomatch$1.compileRe(parsed, options, returnOutput, returnState); }; picomatch$1.toRegex = (source, options) => { try { const opts = options || {}; return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); } catch (err) { if (options && options.debug === true) throw err; return /$^/; } }; picomatch$1.constants = constants$1; var picomatch_1 = picomatch$1; var picomatch = picomatch_1; const isEmptyString = val => val === '' || val === './'; const micromatch = (list, patterns, options) => { patterns = [].concat(patterns); list = [].concat(list); let omit = new Set(); let keep = new Set(); let items = new Set(); let negatives = 0; let onResult = state => { items.add(state.output); if (options && options.onResult) { options.onResult(state); } }; for (let i = 0; i < patterns.length; i++) { let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true); let negated = isMatch.state.negated || isMatch.state.negatedExtglob; if (negated) negatives++; for (let item of list) { let matched = isMatch(item, true); let match = negated ? !matched.isMatch : matched.isMatch; if (!match) continue; if (negated) { omit.add(matched.output); } else { omit.delete(matched.output); keep.add(matched.output); } } } let result = negatives === patterns.length ? [...items] : [...keep]; let matches = result.filter(item => !omit.has(item)); if (options && matches.length === 0) { if (options.failglob === true) { throw new Error(`No matches found for "${patterns.join(', ')}"`); } if (options.nonull === true || options.nullglob === true) { return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns; } } return matches; }; micromatch.match = micromatch; micromatch.matcher = (pattern, options) => picomatch(pattern, options); micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); micromatch.any = micromatch.isMatch; micromatch.not = (list, patterns, options = {}) => { patterns = [].concat(patterns).map(String); let result = new Set(); let items = []; let onResult = state => { if (options.onResult) options.onResult(state); items.push(state.output); }; let matches = new Set(micromatch(list, patterns, { ...options, onResult })); for (let item of items) { if (!matches.has(item)) { result.add(item); } } return [...result]; }; micromatch.contains = (str, pattern, options) => { if (typeof str !== 'string') { throw new TypeError(`Expected a string: "${util_1__default['default'].inspect(str)}"`); } if (Array.isArray(pattern)) { return pattern.some(p => micromatch.contains(str, p, options)); } if (typeof pattern === 'string') { if (isEmptyString(str) || isEmptyString(pattern)) { return false; } if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) { return true; } } return micromatch.isMatch(str, pattern, { ...options, contains: true }); }; micromatch.matchKeys = (obj, patterns, options) => { if (!utils$7.isObject(obj)) { throw new TypeError('Expected the first argument to be an object'); } let keys = micromatch(Object.keys(obj), patterns, options); let res = {}; for (let key of keys) res[key] = obj[key]; return res; }; micromatch.some = (list, patterns, options) => { let items = [].concat(list); for (let pattern of [].concat(patterns)) { let isMatch = picomatch(String(pattern), options); if (items.some(item => isMatch(item))) { return true; } } return false; }; micromatch.every = (list, patterns, options) => { let items = [].concat(list); for (let pattern of [].concat(patterns)) { let isMatch = picomatch(String(pattern), options); if (!items.every(item => isMatch(item))) { return false; } } return true; }; micromatch.all = (str, patterns, options) => { if (typeof str !== 'string') { throw new TypeError(`Expected a string: "${util_1__default['default'].inspect(str)}"`); } return [].concat(patterns).every(p => picomatch(p, options)(str)); }; micromatch.capture = (glob, input, options) => { let posix = utils$7.isWindows(options); let regex = picomatch.makeRe(String(glob), { ...options, capture: true }); let match = regex.exec(posix ? utils$7.toPosixSlashes(input) : input); if (match) { return match.slice(1).map(v => v === void 0 ? '' : v); } }; micromatch.makeRe = (...args) => picomatch.makeRe(...args); micromatch.scan = (...args) => picomatch.scan(...args); micromatch.parse = (patterns, options) => { let res = []; for (let pattern of [].concat(patterns || [])) { for (let str of braces_1(String(pattern), options)) { res.push(picomatch.parse(str, options)); } } return res; }; micromatch.braces = (pattern, options) => { if (typeof pattern !== 'string') throw new TypeError('Expected a string'); if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) { return [pattern]; } return braces_1(pattern, options); }; micromatch.braceExpand = (pattern, options) => { if (typeof pattern !== 'string') throw new TypeError('Expected a string'); return micromatch.braces(pattern, { ...options, expand: true }); }; var micromatch_1 = micromatch; var pattern = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; const GLOBSTAR = '**'; const ESCAPE_SYMBOL = '\\'; const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/; const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/; const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/; const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/; function isStaticPattern(pattern, options = {}) { return !isDynamicPattern(pattern, options); } exports.isStaticPattern = isStaticPattern; function isDynamicPattern(pattern, options = {}) { if (pattern === '') { return false; } if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { return true; } if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { return true; } if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { return true; } if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) { return true; } return false; } exports.isDynamicPattern = isDynamicPattern; function convertToPositivePattern(pattern) { return isNegativePattern(pattern) ? pattern.slice(1) : pattern; } exports.convertToPositivePattern = convertToPositivePattern; function convertToNegativePattern(pattern) { return '!' + pattern; } exports.convertToNegativePattern = convertToNegativePattern; function isNegativePattern(pattern) { return pattern.startsWith('!') && pattern[1] !== '('; } exports.isNegativePattern = isNegativePattern; function isPositivePattern(pattern) { return !isNegativePattern(pattern); } exports.isPositivePattern = isPositivePattern; function getNegativePatterns(patterns) { return patterns.filter(isNegativePattern); } exports.getNegativePatterns = getNegativePatterns; function getPositivePatterns(patterns) { return patterns.filter(isPositivePattern); } exports.getPositivePatterns = getPositivePatterns; function getPatternsInsideCurrentDirectory(patterns) { return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern)); } exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory; function getPatternsOutsideCurrentDirectory(patterns) { return patterns.filter(isPatternRelatedToParentDirectory); } exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory; function isPatternRelatedToParentDirectory(pattern) { return pattern.startsWith('..') || pattern.startsWith('./..'); } exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory; function getBaseDirectory(pattern) { return globParent(pattern, { flipBackslashes: false }); } exports.getBaseDirectory = getBaseDirectory; function hasGlobStar(pattern) { return pattern.includes(GLOBSTAR); } exports.hasGlobStar = hasGlobStar; function endsWithSlashGlobStar(pattern) { return pattern.endsWith('/' + GLOBSTAR); } exports.endsWithSlashGlobStar = endsWithSlashGlobStar; function isAffectDepthOfReadingPattern(pattern) { const basename = path__default['default'].basename(pattern); return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); } exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; function expandPatternsWithBraceExpansion(patterns) { return patterns.reduce((collection, pattern) => { return collection.concat(expandBraceExpansion(pattern)); }, []); } exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; function expandBraceExpansion(pattern) { return micromatch_1.braces(pattern, { expand: true, nodupes: true }); } exports.expandBraceExpansion = expandBraceExpansion; function getPatternParts(pattern, options) { let { parts } = micromatch_1.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); if (parts.length === 0) { parts = [pattern]; } if (parts[0].startsWith('/')) { parts[0] = parts[0].slice(1); parts.unshift(''); } return parts; } exports.getPatternParts = getPatternParts; function makeRe(pattern, options) { return micromatch_1.makeRe(pattern, options); } exports.makeRe = makeRe; function convertPatternsToRe(patterns, options) { return patterns.map((pattern) => makeRe(pattern, options)); } exports.convertPatternsToRe = convertPatternsToRe; function matchAny(entry, patternsRe) { return patternsRe.some((patternRe) => patternRe.test(entry)); } exports.matchAny = matchAny; }); getDefaultExportFromCjs(pattern); const PassThrough = stream_1__default['default'].PassThrough; const slice$1 = Array.prototype.slice; var merge2_1 = merge2; function merge2 () { const streamsQueue = []; const args = slice$1.call(arguments); let merging = false; let options = args[args.length - 1]; if (options && !Array.isArray(options) && options.pipe == null) { args.pop(); } else { options = {}; } const doEnd = options.end !== false; const doPipeError = options.pipeError === true; if (options.objectMode == null) { options.objectMode = true; } if (options.highWaterMark == null) { options.highWaterMark = 64 * 1024; } const mergedStream = PassThrough(options); function addStream () { for (let i = 0, len = arguments.length; i < len; i++) { streamsQueue.push(pauseStreams(arguments[i], options)); } mergeStream(); return this } function mergeStream () { if (merging) { return } merging = true; let streams = streamsQueue.shift(); if (!streams) { process.nextTick(endStream); return } if (!Array.isArray(streams)) { streams = [streams]; } let pipesCount = streams.length + 1; function next () { if (--pipesCount > 0) { return } merging = false; mergeStream(); } function pipe (stream) { function onend () { stream.removeListener('merge2UnpipeEnd', onend); stream.removeListener('end', onend); if (doPipeError) { stream.removeListener('error', onerror); } next(); } function onerror (err) { mergedStream.emit('error', err); } if (stream._readableState.endEmitted) { return next() } stream.on('merge2UnpipeEnd', onend); stream.on('end', onend); if (doPipeError) { stream.on('error', onerror); } stream.pipe(mergedStream, { end: false }); stream.resume(); } for (let i = 0; i < streams.length; i++) { pipe(streams[i]); } next(); } function endStream () { merging = false; mergedStream.emit('queueDrain'); if (doEnd) { mergedStream.end(); } } mergedStream.setMaxListeners(0); mergedStream.add = addStream; mergedStream.on('unpipe', function (stream) { stream.emit('merge2UnpipeEnd'); }); if (args.length) { addStream.apply(null, args); } return mergedStream } function pauseStreams (streams, options) { if (!Array.isArray(streams)) { if (!streams._readableState && streams.pipe) { streams = streams.pipe(PassThrough(options)); } if (!streams._readableState || !streams.pause || !streams.pipe) { throw new Error('Only readable stream can be merged.') } streams.pause(); } else { for (let i = 0, len = streams.length; i < len; i++) { streams[i] = pauseStreams(streams[i], options); } } return streams } var stream$3 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.merge = void 0; function merge(streams) { const mergedStream = merge2_1(streams); streams.forEach((stream) => { stream.once('error', (error) => mergedStream.emit('error', error)); }); mergedStream.once('close', () => propagateCloseEventToSources(streams)); mergedStream.once('end', () => propagateCloseEventToSources(streams)); return mergedStream; } exports.merge = merge; function propagateCloseEventToSources(streams) { streams.forEach((stream) => stream.emit('close')); } }); getDefaultExportFromCjs(stream$3); var string = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isEmpty = exports.isString = void 0; function isString(input) { return typeof input === 'string'; } exports.isString = isString; function isEmpty(input) { return input === ''; } exports.isEmpty = isEmpty; }); getDefaultExportFromCjs(string); var utils$6 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; exports.array = array; exports.errno = errno; exports.fs = fs$1; exports.path = path_1; exports.pattern = pattern; exports.stream = stream$3; exports.string = string; }); getDefaultExportFromCjs(utils$6); var tasks = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; function generate(patterns, settings) { const positivePatterns = getPositivePatterns(patterns); const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); const staticPatterns = positivePatterns.filter((pattern) => utils$6.pattern.isStaticPattern(pattern, settings)); const dynamicPatterns = positivePatterns.filter((pattern) => utils$6.pattern.isDynamicPattern(pattern, settings)); const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, false); const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, true); return staticTasks.concat(dynamicTasks); } exports.generate = generate; function convertPatternsToTasks(positive, negative, dynamic) { const tasks = []; const patternsOutsideCurrentDirectory = utils$6.pattern.getPatternsOutsideCurrentDirectory(positive); const patternsInsideCurrentDirectory = utils$6.pattern.getPatternsInsideCurrentDirectory(positive); const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory); const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory); tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic)); if ('.' in insideCurrentDirectoryGroup) { tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic)); } else { tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic)); } return tasks; } exports.convertPatternsToTasks = convertPatternsToTasks; function getPositivePatterns(patterns) { return utils$6.pattern.getPositivePatterns(patterns); } exports.getPositivePatterns = getPositivePatterns; function getNegativePatternsAsPositive(patterns, ignore) { const negative = utils$6.pattern.getNegativePatterns(patterns).concat(ignore); const positive = negative.map(utils$6.pattern.convertToPositivePattern); return positive; } exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; function groupPatternsByBaseDirectory(patterns) { const group = {}; return patterns.reduce((collection, pattern) => { const base = utils$6.pattern.getBaseDirectory(pattern); if (base in collection) { collection[base].push(pattern); } else { collection[base] = [pattern]; } return collection; }, group); } exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; function convertPatternGroupsToTasks(positive, negative, dynamic) { return Object.keys(positive).map((base) => { return convertPatternGroupToTask(base, positive[base], negative, dynamic); }); } exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; function convertPatternGroupToTask(base, positive, negative, dynamic) { return { dynamic, positive, negative, base, patterns: [].concat(positive, negative.map(utils$6.pattern.convertToNegativePattern)) }; } exports.convertPatternGroupToTask = convertPatternGroupToTask; }); getDefaultExportFromCjs(tasks); var async$4 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.read = void 0; function read(path, settings, callback) { settings.fs.lstat(path, (lstatError, lstat) => { if (lstatError !== null) { callFailureCallback(callback, lstatError); return; } if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { callSuccessCallback(callback, lstat); return; } settings.fs.stat(path, (statError, stat) => { if (statError !== null) { if (settings.throwErrorOnBrokenSymbolicLink) { callFailureCallback(callback, statError); return; } callSuccessCallback(callback, lstat); return; } if (settings.markSymbolicLink) { stat.isSymbolicLink = () => true; } callSuccessCallback(callback, stat); }); }); } exports.read = read; function callFailureCallback(callback, error) { callback(error); } function callSuccessCallback(callback, result) { callback(null, result); } }); getDefaultExportFromCjs(async$4); var sync$5 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.read = void 0; function read(path, settings) { const lstat = settings.fs.lstatSync(path); if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { return lstat; } try { const stat = settings.fs.statSync(path); if (settings.markSymbolicLink) { stat.isSymbolicLink = () => true; } return stat; } catch (error) { if (!settings.throwErrorOnBrokenSymbolicLink) { return lstat; } throw error; } } exports.read = read; }); getDefaultExportFromCjs(sync$5); var fs_1$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; exports.FILE_SYSTEM_ADAPTER = { lstat: fs__default['default'].lstat, stat: fs__default['default'].stat, lstatSync: fs__default['default'].lstatSync, statSync: fs__default['default'].statSync }; function createFileSystemAdapter(fsMethods) { if (fsMethods === undefined) { return exports.FILE_SYSTEM_ADAPTER; } return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); } exports.createFileSystemAdapter = createFileSystemAdapter; }); getDefaultExportFromCjs(fs_1$1); var settings$3 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class Settings { constructor(_options = {}) { this._options = _options; this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true); this.fs = fs_1$1.createFileSystemAdapter(this._options.fs); this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false); this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); } _getValue(option, value) { return option !== null && option !== void 0 ? option : value; } } exports.default = Settings; }); getDefaultExportFromCjs(settings$3); var out$3 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.statSync = exports.stat = exports.Settings = void 0; exports.Settings = settings$3.default; function stat(path, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { async$4.read(path, getSettings(), optionsOrSettingsOrCallback); return; } async$4.read(path, getSettings(optionsOrSettingsOrCallback), callback); } exports.stat = stat; function statSync(path, optionsOrSettings) { const settings = getSettings(optionsOrSettings); return sync$5.read(path, settings); } exports.statSync = statSync; function getSettings(settingsOrOptions = {}) { if (settingsOrOptions instanceof settings$3.default) { return settingsOrOptions; } return new settings$3.default(settingsOrOptions); } }); getDefaultExportFromCjs(out$3); /*! queue-microtask. MIT License. Feross Aboukhadijeh */ let promise$1; var queueMicrotask_1 = typeof queueMicrotask === 'function' ? queueMicrotask.bind(typeof window !== 'undefined' ? window : commonjsGlobal) : cb => (promise$1 || (promise$1 = Promise.resolve())) .then(cb) .catch(err => setTimeout(() => { throw err }, 0)); /*! run-parallel. MIT License. Feross Aboukhadijeh */ var runParallel_1 = runParallel; function runParallel (tasks, cb) { let results, pending, keys; let isSync = true; if (Array.isArray(tasks)) { results = []; pending = tasks.length; } else { keys = Object.keys(tasks); results = {}; pending = keys.length; } function done (err) { function end () { if (cb) cb(err, results); cb = null; } if (isSync) queueMicrotask_1(end); else end(); } function each (i, err, result) { results[i] = result; if (--pending === 0 || err) { done(err); } } if (!pending) { done(null); } else if (keys) { keys.forEach(function (key) { tasks[key](function (err, result) { each(key, err, result); }); }); } else { tasks.forEach(function (task, i) { task(function (err, result) { each(i, err, result); }); }); } isSync = false; } var constants = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) { throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`); } const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); const SUPPORTED_MAJOR_VERSION = 10; const SUPPORTED_MINOR_VERSION = 10; const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; }); getDefaultExportFromCjs(constants); var fs = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createDirentFromStats = void 0; class DirentFromStats { constructor(name, stats) { this.name = name; this.isBlockDevice = stats.isBlockDevice.bind(stats); this.isCharacterDevice = stats.isCharacterDevice.bind(stats); this.isDirectory = stats.isDirectory.bind(stats); this.isFIFO = stats.isFIFO.bind(stats); this.isFile = stats.isFile.bind(stats); this.isSocket = stats.isSocket.bind(stats); this.isSymbolicLink = stats.isSymbolicLink.bind(stats); } } function createDirentFromStats(name, stats) { return new DirentFromStats(name, stats); } exports.createDirentFromStats = createDirentFromStats; }); getDefaultExportFromCjs(fs); var utils$5 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.fs = void 0; exports.fs = fs; }); getDefaultExportFromCjs(utils$5); var common$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.joinPathSegments = void 0; function joinPathSegments(a, b, separator) { if (a.endsWith(separator)) { return a + b; } return a + separator + b; } exports.joinPathSegments = joinPathSegments; }); getDefaultExportFromCjs(common$2); var async$3 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; function read(directory, settings, callback) { if (!settings.stats && constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { readdirWithFileTypes(directory, settings, callback); return; } readdir(directory, settings, callback); } exports.read = read; function readdirWithFileTypes(directory, settings, callback) { settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { if (readdirError !== null) { callFailureCallback(callback, readdirError); return; } const entries = dirents.map((dirent) => ({ dirent, name: dirent.name, path: common$2.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) })); if (!settings.followSymbolicLinks) { callSuccessCallback(callback, entries); return; } const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); runParallel_1(tasks, (rplError, rplEntries) => { if (rplError !== null) { callFailureCallback(callback, rplError); return; } callSuccessCallback(callback, rplEntries); }); }); } exports.readdirWithFileTypes = readdirWithFileTypes; function makeRplTaskEntry(entry, settings) { return (done) => { if (!entry.dirent.isSymbolicLink()) { done(null, entry); return; } settings.fs.stat(entry.path, (statError, stats) => { if (statError !== null) { if (settings.throwErrorOnBrokenSymbolicLink) { done(statError); return; } done(null, entry); return; } entry.dirent = utils$5.fs.createDirentFromStats(entry.name, stats); done(null, entry); }); }; } function readdir(directory, settings, callback) { settings.fs.readdir(directory, (readdirError, names) => { if (readdirError !== null) { callFailureCallback(callback, readdirError); return; } const tasks = names.map((name) => { const path = common$2.joinPathSegments(directory, name, settings.pathSegmentSeparator); return (done) => { out$3.stat(path, settings.fsStatSettings, (error, stats) => { if (error !== null) { done(error); return; } const entry = { name, path, dirent: utils$5.fs.createDirentFromStats(name, stats) }; if (settings.stats) { entry.stats = stats; } done(null, entry); }); }; }); runParallel_1(tasks, (rplError, entries) => { if (rplError !== null) { callFailureCallback(callback, rplError); return; } callSuccessCallback(callback, entries); }); }); } exports.readdir = readdir; function callFailureCallback(callback, error) { callback(error); } function callSuccessCallback(callback, result) { callback(null, result); } }); getDefaultExportFromCjs(async$3); var sync$4 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; function read(directory, settings) { if (!settings.stats && constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { return readdirWithFileTypes(directory, settings); } return readdir(directory, settings); } exports.read = read; function readdirWithFileTypes(directory, settings) { const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); return dirents.map((dirent) => { const entry = { dirent, name: dirent.name, path: common$2.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) }; if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { try { const stats = settings.fs.statSync(entry.path); entry.dirent = utils$5.fs.createDirentFromStats(entry.name, stats); } catch (error) { if (settings.throwErrorOnBrokenSymbolicLink) { throw error; } } } return entry; }); } exports.readdirWithFileTypes = readdirWithFileTypes; function readdir(directory, settings) { const names = settings.fs.readdirSync(directory); return names.map((name) => { const entryPath = common$2.joinPathSegments(directory, name, settings.pathSegmentSeparator); const stats = out$3.statSync(entryPath, settings.fsStatSettings); const entry = { name, path: entryPath, dirent: utils$5.fs.createDirentFromStats(name, stats) }; if (settings.stats) { entry.stats = stats; } return entry; }); } exports.readdir = readdir; }); getDefaultExportFromCjs(sync$4); var fs_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; exports.FILE_SYSTEM_ADAPTER = { lstat: fs__default['default'].lstat, stat: fs__default['default'].stat, lstatSync: fs__default['default'].lstatSync, statSync: fs__default['default'].statSync, readdir: fs__default['default'].readdir, readdirSync: fs__default['default'].readdirSync }; function createFileSystemAdapter(fsMethods) { if (fsMethods === undefined) { return exports.FILE_SYSTEM_ADAPTER; } return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); } exports.createFileSystemAdapter = createFileSystemAdapter; }); getDefaultExportFromCjs(fs_1); var settings$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class Settings { constructor(_options = {}) { this._options = _options; this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); this.fs = fs_1.createFileSystemAdapter(this._options.fs); this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path__default['default'].sep); this.stats = this._getValue(this._options.stats, false); this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); this.fsStatSettings = new out$3.Settings({ followSymbolicLink: this.followSymbolicLinks, fs: this.fs, throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink }); } _getValue(option, value) { return option !== null && option !== void 0 ? option : value; } } exports.default = Settings; }); getDefaultExportFromCjs(settings$2); var out$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Settings = exports.scandirSync = exports.scandir = void 0; exports.Settings = settings$2.default; function scandir(path, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { async$3.read(path, getSettings(), optionsOrSettingsOrCallback); return; } async$3.read(path, getSettings(optionsOrSettingsOrCallback), callback); } exports.scandir = scandir; function scandirSync(path, optionsOrSettings) { const settings = getSettings(optionsOrSettings); return sync$4.read(path, settings); } exports.scandirSync = scandirSync; function getSettings(settingsOrOptions = {}) { if (settingsOrOptions instanceof settings$2.default) { return settingsOrOptions; } return new settings$2.default(settingsOrOptions); } }); getDefaultExportFromCjs(out$2); function reusify (Constructor) { var head = new Constructor(); var tail = head; function get () { var current = head; if (current.next) { head = current.next; } else { head = new Constructor(); tail = head; } current.next = null; return current } function release (obj) { tail.next = obj; tail = obj; } return { get: get, release: release } } var reusify_1 = reusify; function fastqueue (context, worker, concurrency) { if (typeof context === 'function') { concurrency = worker; worker = context; context = null; } if (concurrency < 1) { throw new Error('fastqueue concurrency must be greater than 1') } var cache = reusify_1(Task); var queueHead = null; var queueTail = null; var _running = 0; var errorHandler = null; var self = { push: push, drain: noop, saturated: noop, pause: pause, paused: false, concurrency: concurrency, running: running, resume: resume, idle: idle, length: length, getQueue: getQueue, unshift: unshift, empty: noop, kill: kill, killAndDrain: killAndDrain, error: error }; return self function running () { return _running } function pause () { self.paused = true; } function length () { var current = queueHead; var counter = 0; while (current) { current = current.next; counter++; } return counter } function getQueue () { var current = queueHead; var tasks = []; while (current) { tasks.push(current.value); current = current.next; } return tasks } function resume () { if (!self.paused) return self.paused = false; for (var i = 0; i < self.concurrency; i++) { _running++; release(); } } function idle () { return _running === 0 && self.length() === 0 } function push (value, done) { var current = cache.get(); current.context = context; current.release = release; current.value = value; current.callback = done || noop; current.errorHandler = errorHandler; if (_running === self.concurrency || self.paused) { if (queueTail) { queueTail.next = current; queueTail = current; } else { queueHead = current; queueTail = current; self.saturated(); } } else { _running++; worker.call(context, current.value, current.worked); } } function unshift (value, done) { var current = cache.get(); current.context = context; current.release = release; current.value = value; current.callback = done || noop; if (_running === self.concurrency || self.paused) { if (queueHead) { current.next = queueHead; queueHead = current; } else { queueHead = current; queueTail = current; self.saturated(); } } else { _running++; worker.call(context, current.value, current.worked); } } function release (holder) { if (holder) { cache.release(holder); } var next = queueHead; if (next) { if (!self.paused) { if (queueTail === queueHead) { queueTail = null; } queueHead = next.next; next.next = null; worker.call(context, next.value, next.worked); if (queueTail === null) { self.empty(); } } else { _running--; } } else if (--_running === 0) { self.drain(); } } function kill () { queueHead = null; queueTail = null; self.drain = noop; } function killAndDrain () { queueHead = null; queueTail = null; self.drain(); self.drain = noop; } function error (handler) { errorHandler = handler; } } function noop () {} function Task () { this.value = null; this.callback = noop; this.next = null; this.release = noop; this.context = null; this.errorHandler = null; var self = this; this.worked = function worked (err, result) { var callback = self.callback; var errorHandler = self.errorHandler; var val = self.value; self.value = null; self.callback = noop; if (self.errorHandler) { errorHandler(err, val); } callback.call(self.context, err, result); self.release(self); }; } function queueAsPromised (context, worker, concurrency) { if (typeof context === 'function') { concurrency = worker; worker = context; context = null; } function asyncWrapper (arg, cb) { worker.call(this, arg) .then(function (res) { cb(null, res); }, cb); } var queue = fastqueue(context, asyncWrapper, concurrency); var pushCb = queue.push; var unshiftCb = queue.unshift; queue.push = push; queue.unshift = unshift; queue.drained = drained; return queue function push (value) { var p = new Promise(function (resolve, reject) { pushCb(value, function (err, result) { if (err) { reject(err); return } resolve(result); }); }); p.catch(noop); return p } function unshift (value) { var p = new Promise(function (resolve, reject) { unshiftCb(value, function (err, result) { if (err) { reject(err); return } resolve(result); }); }); p.catch(noop); return p } function drained () { var previousDrain = queue.drain; var p = new Promise(function (resolve) { queue.drain = function () { previousDrain(); resolve(); }; }); return p } } var queue = fastqueue; var promise = queueAsPromised; queue.promise = promise; var common$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; function isFatalError(settings, error) { if (settings.errorFilter === null) { return true; } return !settings.errorFilter(error); } exports.isFatalError = isFatalError; function isAppliedFilter(filter, value) { return filter === null || filter(value); } exports.isAppliedFilter = isAppliedFilter; function replacePathSegmentSeparator(filepath, separator) { return filepath.split(/[/\\]/).join(separator); } exports.replacePathSegmentSeparator = replacePathSegmentSeparator; function joinPathSegments(a, b, separator) { if (a === '') { return b; } if (a.endsWith(separator)) { return a + b; } return a + separator + b; } exports.joinPathSegments = joinPathSegments; }); getDefaultExportFromCjs(common$1); var reader$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class Reader { constructor(_root, _settings) { this._root = _root; this._settings = _settings; this._root = common$1.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); } } exports.default = Reader; }); getDefaultExportFromCjs(reader$1); var async$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class AsyncReader extends reader$1.default { constructor(_root, _settings) { super(_root, _settings); this._settings = _settings; this._scandir = out$2.scandir; this._emitter = new events_1__default['default'].EventEmitter(); this._queue = queue(this._worker.bind(this), this._settings.concurrency); this._isFatalError = false; this._isDestroyed = false; this._queue.drain = () => { if (!this._isFatalError) { this._emitter.emit('end'); } }; } read() { this._isFatalError = false; this._isDestroyed = false; setImmediate(() => { this._pushToQueue(this._root, this._settings.basePath); }); return this._emitter; } get isDestroyed() { return this._isDestroyed; } destroy() { if (this._isDestroyed) { throw new Error('The reader is already destroyed'); } this._isDestroyed = true; this._queue.killAndDrain(); } onEntry(callback) { this._emitter.on('entry', callback); } onError(callback) { this._emitter.once('error', callback); } onEnd(callback) { this._emitter.once('end', callback); } _pushToQueue(directory, base) { const queueItem = { directory, base }; this._queue.push(queueItem, (error) => { if (error !== null) { this._handleError(error); } }); } _worker(item, done) { this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { if (error !== null) { done(error, undefined); return; } for (const entry of entries) { this._handleEntry(entry, item.base); } done(null, undefined); }); } _handleError(error) { if (this._isDestroyed || !common$1.isFatalError(this._settings, error)) { return; } this._isFatalError = true; this._isDestroyed = true; this._emitter.emit('error', error); } _handleEntry(entry, base) { if (this._isDestroyed || this._isFatalError) { return; } const fullpath = entry.path; if (base !== undefined) { entry.path = common$1.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); } if (common$1.isAppliedFilter(this._settings.entryFilter, entry)) { this._emitEntry(entry); } if (entry.dirent.isDirectory() && common$1.isAppliedFilter(this._settings.deepFilter, entry)) { this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); } } _emitEntry(entry) { this._emitter.emit('entry', entry); } } exports.default = AsyncReader; }); getDefaultExportFromCjs(async$2); var async$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class AsyncProvider { constructor(_root, _settings) { this._root = _root; this._settings = _settings; this._reader = new async$2.default(this._root, this._settings); this._storage = []; } read(callback) { this._reader.onError((error) => { callFailureCallback(callback, error); }); this._reader.onEntry((entry) => { this._storage.push(entry); }); this._reader.onEnd(() => { callSuccessCallback(callback, this._storage); }); this._reader.read(); } } exports.default = AsyncProvider; function callFailureCallback(callback, error) { callback(error); } function callSuccessCallback(callback, entries) { callback(null, entries); } }); getDefaultExportFromCjs(async$1); var stream$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class StreamProvider { constructor(_root, _settings) { this._root = _root; this._settings = _settings; this._reader = new async$2.default(this._root, this._settings); this._stream = new stream_1__default['default'].Readable({ objectMode: true, read: () => { }, destroy: () => { if (!this._reader.isDestroyed) { this._reader.destroy(); } } }); } read() { this._reader.onError((error) => { this._stream.emit('error', error); }); this._reader.onEntry((entry) => { this._stream.push(entry); }); this._reader.onEnd(() => { this._stream.push(null); }); this._reader.read(); return this._stream; } } exports.default = StreamProvider; }); getDefaultExportFromCjs(stream$2); var sync$3 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class SyncReader extends reader$1.default { constructor() { super(...arguments); this._scandir = out$2.scandirSync; this._storage = []; this._queue = new Set(); } read() { this._pushToQueue(this._root, this._settings.basePath); this._handleQueue(); return this._storage; } _pushToQueue(directory, base) { this._queue.add({ directory, base }); } _handleQueue() { for (const item of this._queue.values()) { this._handleDirectory(item.directory, item.base); } } _handleDirectory(directory, base) { try { const entries = this._scandir(directory, this._settings.fsScandirSettings); for (const entry of entries) { this._handleEntry(entry, base); } } catch (error) { this._handleError(error); } } _handleError(error) { if (!common$1.isFatalError(this._settings, error)) { return; } throw error; } _handleEntry(entry, base) { const fullpath = entry.path; if (base !== undefined) { entry.path = common$1.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); } if (common$1.isAppliedFilter(this._settings.entryFilter, entry)) { this._pushToStorage(entry); } if (entry.dirent.isDirectory() && common$1.isAppliedFilter(this._settings.deepFilter, entry)) { this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); } } _pushToStorage(entry) { this._storage.push(entry); } } exports.default = SyncReader; }); getDefaultExportFromCjs(sync$3); var sync$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class SyncProvider { constructor(_root, _settings) { this._root = _root; this._settings = _settings; this._reader = new sync$3.default(this._root, this._settings); } read() { return this._reader.read(); } } exports.default = SyncProvider; }); getDefaultExportFromCjs(sync$2); var settings$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class Settings { constructor(_options = {}) { this._options = _options; this.basePath = this._getValue(this._options.basePath, undefined); this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY); this.deepFilter = this._getValue(this._options.deepFilter, null); this.entryFilter = this._getValue(this._options.entryFilter, null); this.errorFilter = this._getValue(this._options.errorFilter, null); this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path__default['default'].sep); this.fsScandirSettings = new out$2.Settings({ followSymbolicLinks: this._options.followSymbolicLinks, fs: this._options.fs, pathSegmentSeparator: this._options.pathSegmentSeparator, stats: this._options.stats, throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink }); } _getValue(option, value) { return option !== null && option !== void 0 ? option : value; } } exports.default = Settings; }); getDefaultExportFromCjs(settings$1); var out$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0; exports.Settings = settings$1.default; function walk(directory, optionsOrSettingsOrCallback, callback) { if (typeof optionsOrSettingsOrCallback === 'function') { new async$1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); return; } new async$1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); } exports.walk = walk; function walkSync(directory, optionsOrSettings) { const settings = getSettings(optionsOrSettings); const provider = new sync$2.default(directory, settings); return provider.read(); } exports.walkSync = walkSync; function walkStream(directory, optionsOrSettings) { const settings = getSettings(optionsOrSettings); const provider = new stream$2.default(directory, settings); return provider.read(); } exports.walkStream = walkStream; function getSettings(settingsOrOptions = {}) { if (settingsOrOptions instanceof settings$1.default) { return settingsOrOptions; } return new settings$1.default(settingsOrOptions); } }); getDefaultExportFromCjs(out$1); var reader = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class Reader { constructor(_settings) { this._settings = _settings; this._fsStatSettings = new out$3.Settings({ followSymbolicLink: this._settings.followSymbolicLinks, fs: this._settings.fs, throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks }); } _getFullEntryPath(filepath) { return path__default['default'].resolve(this._settings.cwd, filepath); } _makeEntry(stats, pattern) { const entry = { name: pattern, path: pattern, dirent: utils$6.fs.createDirentFromStats(pattern, stats) }; if (this._settings.stats) { entry.stats = stats; } return entry; } _isFatalError(error) { return !utils$6.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; } } exports.default = Reader; }); getDefaultExportFromCjs(reader); var stream$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class ReaderStream extends reader.default { constructor() { super(...arguments); this._walkStream = out$1.walkStream; this._stat = out$3.stat; } dynamic(root, options) { return this._walkStream(root, options); } static(patterns, options) { const filepaths = patterns.map(this._getFullEntryPath, this); const stream = new stream_1__default['default'].PassThrough({ objectMode: true }); stream._write = (index, _enc, done) => { return this._getEntry(filepaths[index], patterns[index], options) .then((entry) => { if (entry !== null && options.entryFilter(entry)) { stream.push(entry); } if (index === filepaths.length - 1) { stream.end(); } done(); }) .catch(done); }; for (let i = 0; i < filepaths.length; i++) { stream.write(i); } return stream; } _getEntry(filepath, pattern, options) { return this._getStat(filepath) .then((stats) => this._makeEntry(stats, pattern)) .catch((error) => { if (options.errorFilter(error)) { return null; } throw error; }); } _getStat(filepath) { return new Promise((resolve, reject) => { this._stat(filepath, this._fsStatSettings, (error, stats) => { return error === null ? resolve(stats) : reject(error); }); }); } } exports.default = ReaderStream; }); getDefaultExportFromCjs(stream$1); var matcher = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class Matcher { constructor(_patterns, _settings, _micromatchOptions) { this._patterns = _patterns; this._settings = _settings; this._micromatchOptions = _micromatchOptions; this._storage = []; this._fillStorage(); } _fillStorage() { const patterns = utils$6.pattern.expandPatternsWithBraceExpansion(this._patterns); for (const pattern of patterns) { const segments = this._getPatternSegments(pattern); const sections = this._splitSegmentsIntoSections(segments); this._storage.push({ complete: sections.length <= 1, pattern, segments, sections }); } } _getPatternSegments(pattern) { const parts = utils$6.pattern.getPatternParts(pattern, this._micromatchOptions); return parts.map((part) => { const dynamic = utils$6.pattern.isDynamicPattern(part, this._settings); if (!dynamic) { return { dynamic: false, pattern: part }; } return { dynamic: true, pattern: part, patternRe: utils$6.pattern.makeRe(part, this._micromatchOptions) }; }); } _splitSegmentsIntoSections(segments) { return utils$6.array.splitWhen(segments, (segment) => segment.dynamic && utils$6.pattern.hasGlobStar(segment.pattern)); } } exports.default = Matcher; }); getDefaultExportFromCjs(matcher); var partial = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class PartialMatcher extends matcher.default { match(filepath) { const parts = filepath.split('/'); const levels = parts.length; const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels); for (const pattern of patterns) { const section = pattern.sections[0]; if (!pattern.complete && levels > section.length) { return true; } const match = parts.every((part, index) => { const segment = pattern.segments[index]; if (segment.dynamic && segment.patternRe.test(part)) { return true; } if (!segment.dynamic && segment.pattern === part) { return true; } return false; }); if (match) { return true; } } return false; } } exports.default = PartialMatcher; }); getDefaultExportFromCjs(partial); var deep = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class DeepFilter { constructor(_settings, _micromatchOptions) { this._settings = _settings; this._micromatchOptions = _micromatchOptions; } getFilter(basePath, positive, negative) { const matcher = this._getMatcher(positive); const negativeRe = this._getNegativePatternsRe(negative); return (entry) => this._filter(basePath, entry, matcher, negativeRe); } _getMatcher(patterns) { return new partial.default(patterns, this._settings, this._micromatchOptions); } _getNegativePatternsRe(patterns) { const affectDepthOfReadingPatterns = patterns.filter(utils$6.pattern.isAffectDepthOfReadingPattern); return utils$6.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); } _filter(basePath, entry, matcher, negativeRe) { if (this._isSkippedByDeep(basePath, entry.path)) { return false; } if (this._isSkippedSymbolicLink(entry)) { return false; } const filepath = utils$6.path.removeLeadingDotSegment(entry.path); if (this._isSkippedByPositivePatterns(filepath, matcher)) { return false; } return this._isSkippedByNegativePatterns(filepath, negativeRe); } _isSkippedByDeep(basePath, entryPath) { if (this._settings.deep === Infinity) { return false; } return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; } _getEntryLevel(basePath, entryPath) { const entryPathDepth = entryPath.split('/').length; if (basePath === '') { return entryPathDepth; } const basePathDepth = basePath.split('/').length; return entryPathDepth - basePathDepth; } _isSkippedSymbolicLink(entry) { return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); } _isSkippedByPositivePatterns(entryPath, matcher) { return !this._settings.baseNameMatch && !matcher.match(entryPath); } _isSkippedByNegativePatterns(entryPath, patternsRe) { return !utils$6.pattern.matchAny(entryPath, patternsRe); } } exports.default = DeepFilter; }); getDefaultExportFromCjs(deep); var entry$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class EntryFilter { constructor(_settings, _micromatchOptions) { this._settings = _settings; this._micromatchOptions = _micromatchOptions; this.index = new Map(); } getFilter(positive, negative) { const positiveRe = utils$6.pattern.convertPatternsToRe(positive, this._micromatchOptions); const negativeRe = utils$6.pattern.convertPatternsToRe(negative, this._micromatchOptions); return (entry) => this._filter(entry, positiveRe, negativeRe); } _filter(entry, positiveRe, negativeRe) { if (this._settings.unique && this._isDuplicateEntry(entry)) { return false; } if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { return false; } if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) { return false; } const filepath = this._settings.baseNameMatch ? entry.name : entry.path; const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe); if (this._settings.unique && isMatched) { this._createIndexRecord(entry); } return isMatched; } _isDuplicateEntry(entry) { return this.index.has(entry.path); } _createIndexRecord(entry) { this.index.set(entry.path, undefined); } _onlyFileFilter(entry) { return this._settings.onlyFiles && !entry.dirent.isFile(); } _onlyDirectoryFilter(entry) { return this._settings.onlyDirectories && !entry.dirent.isDirectory(); } _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) { if (!this._settings.absolute) { return false; } const fullpath = utils$6.path.makeAbsolute(this._settings.cwd, entryPath); return utils$6.pattern.matchAny(fullpath, patternsRe); } _isMatchToPatterns(entryPath, patternsRe) { const filepath = utils$6.path.removeLeadingDotSegment(entryPath); return utils$6.pattern.matchAny(filepath, patternsRe); } } exports.default = EntryFilter; }); getDefaultExportFromCjs(entry$1); var error$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class ErrorFilter { constructor(_settings) { this._settings = _settings; } getFilter() { return (error) => this._isNonFatalError(error); } _isNonFatalError(error) { return utils$6.errno.isEnoentCodeError(error) || this._settings.suppressErrors; } } exports.default = ErrorFilter; }); getDefaultExportFromCjs(error$2); var entry = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class EntryTransformer { constructor(_settings) { this._settings = _settings; } getTransformer() { return (entry) => this._transform(entry); } _transform(entry) { let filepath = entry.path; if (this._settings.absolute) { filepath = utils$6.path.makeAbsolute(this._settings.cwd, filepath); filepath = utils$6.path.unixify(filepath); } if (this._settings.markDirectories && entry.dirent.isDirectory()) { filepath += '/'; } if (!this._settings.objectMode) { return filepath; } return Object.assign(Object.assign({}, entry), { path: filepath }); } } exports.default = EntryTransformer; }); getDefaultExportFromCjs(entry); var provider = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class Provider { constructor(_settings) { this._settings = _settings; this.errorFilter = new error$2.default(this._settings); this.entryFilter = new entry$1.default(this._settings, this._getMicromatchOptions()); this.deepFilter = new deep.default(this._settings, this._getMicromatchOptions()); this.entryTransformer = new entry.default(this._settings); } _getRootDirectory(task) { return path__default['default'].resolve(this._settings.cwd, task.base); } _getReaderOptions(task) { const basePath = task.base === '.' ? '' : task.base; return { basePath, pathSegmentSeparator: '/', concurrency: this._settings.concurrency, deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), entryFilter: this.entryFilter.getFilter(task.positive, task.negative), errorFilter: this.errorFilter.getFilter(), followSymbolicLinks: this._settings.followSymbolicLinks, fs: this._settings.fs, stats: this._settings.stats, throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, transform: this.entryTransformer.getTransformer() }; } _getMicromatchOptions() { return { dot: this._settings.dot, matchBase: this._settings.baseNameMatch, nobrace: !this._settings.braceExpansion, nocase: !this._settings.caseSensitiveMatch, noext: !this._settings.extglob, noglobstar: !this._settings.globstar, posix: true, strictSlashes: false }; } } exports.default = Provider; }); getDefaultExportFromCjs(provider); var async = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class ProviderAsync extends provider.default { constructor() { super(...arguments); this._reader = new stream$1.default(this._settings); } read(task) { const root = this._getRootDirectory(task); const options = this._getReaderOptions(task); const entries = []; return new Promise((resolve, reject) => { const stream = this.api(root, task, options); stream.once('error', reject); stream.on('data', (entry) => entries.push(options.transform(entry))); stream.once('end', () => resolve(entries)); }); } api(root, task, options) { if (task.dynamic) { return this._reader.dynamic(root, options); } return this._reader.static(task.patterns, options); } } exports.default = ProviderAsync; }); getDefaultExportFromCjs(async); var stream = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class ProviderStream extends provider.default { constructor() { super(...arguments); this._reader = new stream$1.default(this._settings); } read(task) { const root = this._getRootDirectory(task); const options = this._getReaderOptions(task); const source = this.api(root, task, options); const destination = new stream_1__default['default'].Readable({ objectMode: true, read: () => { } }); source .once('error', (error) => destination.emit('error', error)) .on('data', (entry) => destination.emit('data', options.transform(entry))) .once('end', () => destination.emit('end')); destination .once('close', () => source.destroy()); return destination; } api(root, task, options) { if (task.dynamic) { return this._reader.dynamic(root, options); } return this._reader.static(task.patterns, options); } } exports.default = ProviderStream; }); getDefaultExportFromCjs(stream); var sync$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class ReaderSync extends reader.default { constructor() { super(...arguments); this._walkSync = out$1.walkSync; this._statSync = out$3.statSync; } dynamic(root, options) { return this._walkSync(root, options); } static(patterns, options) { const entries = []; for (const pattern of patterns) { const filepath = this._getFullEntryPath(pattern); const entry = this._getEntry(filepath, pattern, options); if (entry === null || !options.entryFilter(entry)) { continue; } entries.push(entry); } return entries; } _getEntry(filepath, pattern, options) { try { const stats = this._getStat(filepath); return this._makeEntry(stats, pattern); } catch (error) { if (options.errorFilter(error)) { return null; } throw error; } } _getStat(filepath) { return this._statSync(filepath, this._fsStatSettings); } } exports.default = ReaderSync; }); getDefaultExportFromCjs(sync$1); var sync = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class ProviderSync extends provider.default { constructor() { super(...arguments); this._reader = new sync$1.default(this._settings); } read(task) { const root = this._getRootDirectory(task); const options = this._getReaderOptions(task); const entries = this.api(root, task, options); return entries.map(options.transform); } api(root, task, options) { if (task.dynamic) { return this._reader.dynamic(root, options); } return this._reader.static(task.patterns, options); } } exports.default = ProviderSync; }); getDefaultExportFromCjs(sync); var settings = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; const CPU_COUNT = Math.max(os__default['default'].cpus().length, 1); exports.DEFAULT_FILE_SYSTEM_ADAPTER = { lstat: fs__default['default'].lstat, lstatSync: fs__default['default'].lstatSync, stat: fs__default['default'].stat, statSync: fs__default['default'].statSync, readdir: fs__default['default'].readdir, readdirSync: fs__default['default'].readdirSync }; class Settings { constructor(_options = {}) { this._options = _options; this.absolute = this._getValue(this._options.absolute, false); this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); this.braceExpansion = this._getValue(this._options.braceExpansion, true); this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); this.cwd = this._getValue(this._options.cwd, process.cwd()); this.deep = this._getValue(this._options.deep, Infinity); this.dot = this._getValue(this._options.dot, false); this.extglob = this._getValue(this._options.extglob, true); this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); this.fs = this._getFileSystemMethods(this._options.fs); this.globstar = this._getValue(this._options.globstar, true); this.ignore = this._getValue(this._options.ignore, []); this.markDirectories = this._getValue(this._options.markDirectories, false); this.objectMode = this._getValue(this._options.objectMode, false); this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); this.onlyFiles = this._getValue(this._options.onlyFiles, true); this.stats = this._getValue(this._options.stats, false); this.suppressErrors = this._getValue(this._options.suppressErrors, false); this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); this.unique = this._getValue(this._options.unique, true); if (this.onlyDirectories) { this.onlyFiles = false; } if (this.stats) { this.objectMode = true; } } _getValue(option, value) { return option === undefined ? value : option; } _getFileSystemMethods(methods = {}) { return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); } } exports.default = Settings; }); getDefaultExportFromCjs(settings); async function FastGlob(source, options) { assertPatternsInput(source); const works = getWorks(source, async.default, options); const result = await Promise.all(works); return utils$6.array.flatten(result); } (function (FastGlob) { function sync$1(source, options) { assertPatternsInput(source); const works = getWorks(source, sync.default, options); return utils$6.array.flatten(works); } FastGlob.sync = sync$1; function stream$1(source, options) { assertPatternsInput(source); const works = getWorks(source, stream.default, options); return utils$6.stream.merge(works); } FastGlob.stream = stream$1; function generateTasks(source, options) { assertPatternsInput(source); const patterns = [].concat(source); const settings$1 = new settings.default(options); return tasks.generate(patterns, settings$1); } FastGlob.generateTasks = generateTasks; function isDynamicPattern(source, options) { assertPatternsInput(source); const settings$1 = new settings.default(options); return utils$6.pattern.isDynamicPattern(source, settings$1); } FastGlob.isDynamicPattern = isDynamicPattern; function escapePath(source) { assertPatternsInput(source); return utils$6.path.escape(source); } FastGlob.escapePath = escapePath; })(FastGlob || (FastGlob = {})); function getWorks(source, _Provider, options) { const patterns = [].concat(source); const settings$1 = new settings.default(options); const tasks$1 = tasks.generate(patterns, settings$1); const provider = new _Provider(settings$1); return tasks$1.map(provider.read, provider); } function assertPatternsInput(input) { const source = [].concat(input); const isValidSource = source.every((item) => utils$6.string.isString(item) && !utils$6.string.isEmpty(item)); if (!isValidSource) { throw new TypeError('Patterns must be a string (non empty) or an array of strings'); } } var out = FastGlob; var is$4 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.thenable = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; function boolean(value) { return value === true || value === false; } exports.boolean = boolean; function string(value) { return typeof value === 'string' || value instanceof String; } exports.string = string; function number(value) { return typeof value === 'number' || value instanceof Number; } exports.number = number; function error(value) { return value instanceof Error; } exports.error = error; function func(value) { return typeof value === 'function'; } exports.func = func; function array(value) { return Array.isArray(value); } exports.array = array; function stringArray(value) { return array(value) && value.every(elem => string(elem)); } exports.stringArray = stringArray; function typedArray(value, check) { return Array.isArray(value) && value.every(check); } exports.typedArray = typedArray; function thenable(value) { return value && func(value.then); } exports.thenable = thenable; }); getDefaultExportFromCjs(is$4); var ral$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); let _ral; function RAL() { if (_ral === undefined) { throw new Error(`No runtime abstraction layer installed`); } return _ral; } (function (RAL) { function install(ral) { if (ral === undefined) { throw new Error(`No runtime abstraction layer provided`); } _ral = ral; } RAL.install = install; })(RAL || (RAL = {})); exports.default = RAL; }); getDefaultExportFromCjs(ral$2); var disposable$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Disposable = void 0; (function (Disposable) { function create(func) { return { dispose: func }; } Disposable.create = create; })(exports.Disposable || (exports.Disposable = {})); }); getDefaultExportFromCjs(disposable$1); var messageBuffer$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.AbstractMessageBuffer = void 0; const CR = 13; const LF = 10; const CRLF = '\r\n'; class AbstractMessageBuffer { constructor(encoding = 'utf-8') { this._encoding = encoding; this._chunks = []; this._totalLength = 0; } get encoding() { return this._encoding; } append(chunk) { const toAppend = typeof chunk === 'string' ? this.fromString(chunk, this._encoding) : chunk; this._chunks.push(toAppend); this._totalLength += toAppend.byteLength; } tryReadHeaders() { if (this._chunks.length === 0) { return undefined; } let state = 0; let chunkIndex = 0; let offset = 0; let chunkBytesRead = 0; row: while (chunkIndex < this._chunks.length) { const chunk = this._chunks[chunkIndex]; offset = 0; while (offset < chunk.length) { const value = chunk[offset]; switch (value) { case CR: switch (state) { case 0: state = 1; break; case 2: state = 3; break; default: state = 0; } break; case LF: switch (state) { case 1: state = 2; break; case 3: state = 4; offset++; break row; default: state = 0; } break; default: state = 0; } offset++; } chunkBytesRead += chunk.byteLength; chunkIndex++; } if (state !== 4) { return undefined; } const buffer = this._read(chunkBytesRead + offset); const result = new Map(); const headers = this.toString(buffer, 'ascii').split(CRLF); if (headers.length < 2) { return result; } for (let i = 0; i < headers.length - 2; i++) { const header = headers[i]; const index = header.indexOf(':'); if (index === -1) { throw new Error('Message header must separate key and value using :'); } const key = header.substr(0, index); const value = header.substr(index + 1).trim(); result.set(key, value); } return result; } tryReadBody(length) { if (this._totalLength < length) { return undefined; } return this._read(length); } get numberOfBytes() { return this._totalLength; } _read(byteCount) { if (byteCount === 0) { return this.emptyBuffer(); } if (byteCount > this._totalLength) { throw new Error(`Cannot read so many bytes!`); } if (this._chunks[0].byteLength === byteCount) { const chunk = this._chunks[0]; this._chunks.shift(); this._totalLength -= byteCount; return this.asNative(chunk); } if (this._chunks[0].byteLength > byteCount) { const chunk = this._chunks[0]; const result = this.asNative(chunk, byteCount); this._chunks[0] = chunk.slice(byteCount); this._totalLength -= byteCount; return result; } const result = this.allocNative(byteCount); let resultOffset = 0; let chunkIndex = 0; while (byteCount > 0) { const chunk = this._chunks[chunkIndex]; if (chunk.byteLength > byteCount) { const chunkPart = chunk.slice(0, byteCount); result.set(chunkPart, resultOffset); resultOffset += byteCount; this._chunks[chunkIndex] = chunk.slice(byteCount); this._totalLength -= byteCount; byteCount -= byteCount; } else { result.set(chunk, resultOffset); resultOffset += chunk.byteLength; this._chunks.shift(); this._totalLength -= chunk.byteLength; byteCount -= chunk.byteLength; } } return result; } } exports.AbstractMessageBuffer = AbstractMessageBuffer; }); getDefaultExportFromCjs(messageBuffer$1); var ril$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class MessageBuffer extends messageBuffer$1.AbstractMessageBuffer { constructor(encoding = 'utf-8') { super(encoding); } emptyBuffer() { return MessageBuffer.emptyBuffer; } fromString(value, encoding) { return Buffer.from(value, encoding); } toString(value, encoding) { if (value instanceof Buffer) { return value.toString(encoding); } else { return new util_1__default['default'].TextDecoder(encoding).decode(value); } } asNative(buffer, length) { if (length === undefined) { return buffer instanceof Buffer ? buffer : Buffer.from(buffer); } else { return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length); } } allocNative(length) { return Buffer.allocUnsafe(length); } } MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0); class ReadableStreamWrapper { constructor(stream) { this.stream = stream; } onClose(listener) { this.stream.on('close', listener); return disposable$1.Disposable.create(() => this.stream.off('close', listener)); } onError(listener) { this.stream.on('error', listener); return disposable$1.Disposable.create(() => this.stream.off('error', listener)); } onEnd(listener) { this.stream.on('end', listener); return disposable$1.Disposable.create(() => this.stream.off('end', listener)); } onData(listener) { this.stream.on('data', listener); return disposable$1.Disposable.create(() => this.stream.off('data', listener)); } } class WritableStreamWrapper { constructor(stream) { this.stream = stream; } onClose(listener) { this.stream.on('close', listener); return disposable$1.Disposable.create(() => this.stream.off('close', listener)); } onError(listener) { this.stream.on('error', listener); return disposable$1.Disposable.create(() => this.stream.off('error', listener)); } onEnd(listener) { this.stream.on('end', listener); return disposable$1.Disposable.create(() => this.stream.off('end', listener)); } write(data, encoding) { return new Promise((resolve, reject) => { const callback = (error) => { if (error === undefined || error === null) { resolve(); } else { reject(error); } }; if (typeof data === 'string') { this.stream.write(data, encoding, callback); } else { this.stream.write(data, callback); } }); } end() { this.stream.end(); } } const _ril = Object.freeze({ messageBuffer: Object.freeze({ create: (encoding) => new MessageBuffer(encoding) }), applicationJson: Object.freeze({ encoder: Object.freeze({ name: 'application/json', encode: (msg, options) => { try { return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset)); } catch (err) { return Promise.reject(err); } } }), decoder: Object.freeze({ name: 'application/json', decode: (buffer, options) => { try { if (buffer instanceof Buffer) { return Promise.resolve(JSON.parse(buffer.toString(options.charset))); } else { return Promise.resolve(JSON.parse(new util_1__default['default'].TextDecoder(options.charset).decode(buffer))); } } catch (err) { return Promise.reject(err); } } }) }), stream: Object.freeze({ asReadableStream: (stream) => new ReadableStreamWrapper(stream), asWritableStream: (stream) => new WritableStreamWrapper(stream) }), console: console, timer: Object.freeze({ setTimeout(callback, ms, ...args) { return setTimeout(callback, ms, ...args); }, clearTimeout(handle) { clearTimeout(handle); }, setImmediate(callback, ...args) { return setImmediate(callback, ...args); }, clearImmediate(handle) { clearImmediate(handle); } }) }); function RIL() { return _ril; } (function (RIL) { function install() { ral$2.default.install(_ril); } RIL.install = install; })(RIL || (RIL = {})); exports.default = RIL; }); getDefaultExportFromCjs(ril$1); var is$3 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; function boolean(value) { return value === true || value === false; } exports.boolean = boolean; function string(value) { return typeof value === 'string' || value instanceof String; } exports.string = string; function number(value) { return typeof value === 'number' || value instanceof Number; } exports.number = number; function error(value) { return value instanceof Error; } exports.error = error; function func(value) { return typeof value === 'function'; } exports.func = func; function array(value) { return Array.isArray(value); } exports.array = array; function stringArray(value) { return array(value) && value.every(elem => string(elem)); } exports.stringArray = stringArray; }); getDefaultExportFromCjs(is$3); var messages$3 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isResponseMessage = exports.isNotificationMessage = exports.isRequestMessage = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0; var ErrorCodes; (function (ErrorCodes) { ErrorCodes.ParseError = -32700; ErrorCodes.InvalidRequest = -32600; ErrorCodes.MethodNotFound = -32601; ErrorCodes.InvalidParams = -32602; ErrorCodes.InternalError = -32603; ErrorCodes.jsonrpcReservedErrorRangeStart = -32099; ErrorCodes.serverErrorStart = ErrorCodes.jsonrpcReservedErrorRangeStart; ErrorCodes.MessageWriteError = -32099; ErrorCodes.MessageReadError = -32098; ErrorCodes.ServerNotInitialized = -32002; ErrorCodes.UnknownErrorCode = -32001; ErrorCodes.jsonrpcReservedErrorRangeEnd = -32000; ErrorCodes.serverErrorEnd = ErrorCodes.jsonrpcReservedErrorRangeEnd; })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {})); class ResponseError extends Error { constructor(code, message, data) { super(message); this.code = is$3.number(code) ? code : ErrorCodes.UnknownErrorCode; this.data = data; Object.setPrototypeOf(this, ResponseError.prototype); } toJson() { const result = { code: this.code, message: this.message }; if (this.data !== undefined) { result.data = this.data; } return result; } } exports.ResponseError = ResponseError; class ParameterStructures { constructor(kind) { this.kind = kind; } static is(value) { return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition; } toString() { return this.kind; } } exports.ParameterStructures = ParameterStructures; ParameterStructures.auto = new ParameterStructures('auto'); ParameterStructures.byPosition = new ParameterStructures('byPosition'); ParameterStructures.byName = new ParameterStructures('byName'); class AbstractMessageSignature { constructor(method, numberOfParams) { this.method = method; this.numberOfParams = numberOfParams; } get parameterStructures() { return ParameterStructures.auto; } } exports.AbstractMessageSignature = AbstractMessageSignature; class RequestType0 extends AbstractMessageSignature { constructor(method) { super(method, 0); } } exports.RequestType0 = RequestType0; class RequestType extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } } exports.RequestType = RequestType; class RequestType1 extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } } exports.RequestType1 = RequestType1; class RequestType2 extends AbstractMessageSignature { constructor(method) { super(method, 2); } } exports.RequestType2 = RequestType2; class RequestType3 extends AbstractMessageSignature { constructor(method) { super(method, 3); } } exports.RequestType3 = RequestType3; class RequestType4 extends AbstractMessageSignature { constructor(method) { super(method, 4); } } exports.RequestType4 = RequestType4; class RequestType5 extends AbstractMessageSignature { constructor(method) { super(method, 5); } } exports.RequestType5 = RequestType5; class RequestType6 extends AbstractMessageSignature { constructor(method) { super(method, 6); } } exports.RequestType6 = RequestType6; class RequestType7 extends AbstractMessageSignature { constructor(method) { super(method, 7); } } exports.RequestType7 = RequestType7; class RequestType8 extends AbstractMessageSignature { constructor(method) { super(method, 8); } } exports.RequestType8 = RequestType8; class RequestType9 extends AbstractMessageSignature { constructor(method) { super(method, 9); } } exports.RequestType9 = RequestType9; class NotificationType extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } } exports.NotificationType = NotificationType; class NotificationType0 extends AbstractMessageSignature { constructor(method) { super(method, 0); } } exports.NotificationType0 = NotificationType0; class NotificationType1 extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } } exports.NotificationType1 = NotificationType1; class NotificationType2 extends AbstractMessageSignature { constructor(method) { super(method, 2); } } exports.NotificationType2 = NotificationType2; class NotificationType3 extends AbstractMessageSignature { constructor(method) { super(method, 3); } } exports.NotificationType3 = NotificationType3; class NotificationType4 extends AbstractMessageSignature { constructor(method) { super(method, 4); } } exports.NotificationType4 = NotificationType4; class NotificationType5 extends AbstractMessageSignature { constructor(method) { super(method, 5); } } exports.NotificationType5 = NotificationType5; class NotificationType6 extends AbstractMessageSignature { constructor(method) { super(method, 6); } } exports.NotificationType6 = NotificationType6; class NotificationType7 extends AbstractMessageSignature { constructor(method) { super(method, 7); } } exports.NotificationType7 = NotificationType7; class NotificationType8 extends AbstractMessageSignature { constructor(method) { super(method, 8); } } exports.NotificationType8 = NotificationType8; class NotificationType9 extends AbstractMessageSignature { constructor(method) { super(method, 9); } } exports.NotificationType9 = NotificationType9; function isRequestMessage(message) { const candidate = message; return candidate && is$3.string(candidate.method) && (is$3.string(candidate.id) || is$3.number(candidate.id)); } exports.isRequestMessage = isRequestMessage; function isNotificationMessage(message) { const candidate = message; return candidate && is$3.string(candidate.method) && message.id === void 0; } exports.isNotificationMessage = isNotificationMessage; function isResponseMessage(message) { const candidate = message; return candidate && (candidate.result !== void 0 || !!candidate.error) && (is$3.string(candidate.id) || is$3.number(candidate.id) || candidate.id === null); } exports.isResponseMessage = isResponseMessage; }); getDefaultExportFromCjs(messages$3); var events$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Emitter = exports.Event = void 0; (function (Event) { const _disposable = { dispose() { } }; Event.None = function () { return _disposable; }; })(exports.Event || (exports.Event = {})); class CallbackList { add(callback, context = null, bucket) { if (!this._callbacks) { this._callbacks = []; this._contexts = []; } this._callbacks.push(callback); this._contexts.push(context); if (Array.isArray(bucket)) { bucket.push({ dispose: () => this.remove(callback, context) }); } } remove(callback, context = null) { if (!this._callbacks) { return; } let foundCallbackWithDifferentContext = false; for (let i = 0, len = this._callbacks.length; i < len; i++) { if (this._callbacks[i] === callback) { if (this._contexts[i] === context) { this._callbacks.splice(i, 1); this._contexts.splice(i, 1); return; } else { foundCallbackWithDifferentContext = true; } } } if (foundCallbackWithDifferentContext) { throw new Error('When adding a listener with a context, you should remove it with the same context'); } } invoke(...args) { if (!this._callbacks) { return []; } const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); for (let i = 0, len = callbacks.length; i < len; i++) { try { ret.push(callbacks[i].apply(contexts[i], args)); } catch (e) { ral$2.default().console.error(e); } } return ret; } isEmpty() { return !this._callbacks || this._callbacks.length === 0; } dispose() { this._callbacks = undefined; this._contexts = undefined; } } class Emitter { constructor(_options) { this._options = _options; } get event() { if (!this._event) { this._event = (listener, thisArgs, disposables) => { if (!this._callbacks) { this._callbacks = new CallbackList(); } if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { this._options.onFirstListenerAdd(this); } this._callbacks.add(listener, thisArgs); const result = { dispose: () => { if (!this._callbacks) { return; } this._callbacks.remove(listener, thisArgs); result.dispose = Emitter._noop; if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) { this._options.onLastListenerRemove(this); } } }; if (Array.isArray(disposables)) { disposables.push(result); } return result; }; } return this._event; } fire(event) { if (this._callbacks) { this._callbacks.invoke.call(this._callbacks, event); } } dispose() { if (this._callbacks) { this._callbacks.dispose(); this._callbacks = undefined; } } } exports.Emitter = Emitter; Emitter._noop = function () { }; }); getDefaultExportFromCjs(events$2); var cancellation$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.CancellationTokenSource = exports.CancellationToken = void 0; var CancellationToken; (function (CancellationToken) { CancellationToken.None = Object.freeze({ isCancellationRequested: false, onCancellationRequested: events$2.Event.None }); CancellationToken.Cancelled = Object.freeze({ isCancellationRequested: true, onCancellationRequested: events$2.Event.None }); function is(value) { const candidate = value; return candidate && (candidate === CancellationToken.None || candidate === CancellationToken.Cancelled || (is$3.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested)); } CancellationToken.is = is; })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {})); const shortcutEvent = Object.freeze(function (callback, context) { const handle = ral$2.default().timer.setTimeout(callback.bind(context), 0); return { dispose() { ral$2.default().timer.clearTimeout(handle); } }; }); class MutableToken { constructor() { this._isCancelled = false; } cancel() { if (!this._isCancelled) { this._isCancelled = true; if (this._emitter) { this._emitter.fire(undefined); this.dispose(); } } } get isCancellationRequested() { return this._isCancelled; } get onCancellationRequested() { if (this._isCancelled) { return shortcutEvent; } if (!this._emitter) { this._emitter = new events$2.Emitter(); } return this._emitter.event; } dispose() { if (this._emitter) { this._emitter.dispose(); this._emitter = undefined; } } } class CancellationTokenSource { get token() { if (!this._token) { this._token = new MutableToken(); } return this._token; } cancel() { if (!this._token) { this._token = CancellationToken.Cancelled; } else { this._token.cancel(); } } dispose() { if (!this._token) { this._token = CancellationToken.None; } else if (this._token instanceof MutableToken) { this._token.dispose(); } } } exports.CancellationTokenSource = CancellationTokenSource; }); getDefaultExportFromCjs(cancellation$1); var messageReader$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0; (function (MessageReader) { function is(value) { let candidate = value; return candidate && is$3.func(candidate.listen) && is$3.func(candidate.dispose) && is$3.func(candidate.onError) && is$3.func(candidate.onClose) && is$3.func(candidate.onPartialMessage); } MessageReader.is = is; })(exports.MessageReader || (exports.MessageReader = {})); class AbstractMessageReader { constructor() { this.errorEmitter = new events$2.Emitter(); this.closeEmitter = new events$2.Emitter(); this.partialMessageEmitter = new events$2.Emitter(); } dispose() { this.errorEmitter.dispose(); this.closeEmitter.dispose(); } get onError() { return this.errorEmitter.event; } fireError(error) { this.errorEmitter.fire(this.asError(error)); } get onClose() { return this.closeEmitter.event; } fireClose() { this.closeEmitter.fire(undefined); } get onPartialMessage() { return this.partialMessageEmitter.event; } firePartialMessage(info) { this.partialMessageEmitter.fire(info); } asError(error) { if (error instanceof Error) { return error; } else { return new Error(`Reader received error. Reason: ${is$3.string(error.message) ? error.message : 'unknown'}`); } } } exports.AbstractMessageReader = AbstractMessageReader; var ResolvedMessageReaderOptions; (function (ResolvedMessageReaderOptions) { function fromOptions(options) { var _a; let charset; let contentDecoder; const contentDecoders = new Map(); let contentTypeDecoder; const contentTypeDecoders = new Map(); if (options === undefined || typeof options === 'string') { charset = options !== null && options !== void 0 ? options : 'utf-8'; } else { charset = (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8'; if (options.contentDecoder !== undefined) { contentDecoder = options.contentDecoder; contentDecoders.set(contentDecoder.name, contentDecoder); } if (options.contentDecoders !== undefined) { for (const decoder of options.contentDecoders) { contentDecoders.set(decoder.name, decoder); } } if (options.contentTypeDecoder !== undefined) { contentTypeDecoder = options.contentTypeDecoder; contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); } if (options.contentTypeDecoders !== undefined) { for (const decoder of options.contentTypeDecoders) { contentTypeDecoders.set(decoder.name, decoder); } } } if (contentTypeDecoder === undefined) { contentTypeDecoder = ral$2.default().applicationJson.decoder; contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); } return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders }; } ResolvedMessageReaderOptions.fromOptions = fromOptions; })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {})); class ReadableStreamMessageReader extends AbstractMessageReader { constructor(readable, options) { super(); this.readable = readable; this.options = ResolvedMessageReaderOptions.fromOptions(options); this.buffer = ral$2.default().messageBuffer.create(this.options.charset); this._partialMessageTimeout = 10000; this.nextMessageLength = -1; this.messageToken = 0; } set partialMessageTimeout(timeout) { this._partialMessageTimeout = timeout; } get partialMessageTimeout() { return this._partialMessageTimeout; } listen(callback) { this.nextMessageLength = -1; this.messageToken = 0; this.partialMessageTimer = undefined; this.callback = callback; const result = this.readable.onData((data) => { this.onData(data); }); this.readable.onError((error) => this.fireError(error)); this.readable.onClose(() => this.fireClose()); return result; } onData(data) { this.buffer.append(data); while (true) { if (this.nextMessageLength === -1) { const headers = this.buffer.tryReadHeaders(); if (!headers) { return; } const contentLength = headers.get('Content-Length'); if (!contentLength) { throw new Error('Header must provide a Content-Length property.'); } const length = parseInt(contentLength); if (isNaN(length)) { throw new Error('Content-Length value must be a number.'); } this.nextMessageLength = length; } const body = this.buffer.tryReadBody(this.nextMessageLength); if (body === undefined) { this.setPartialMessageTimer(); return; } this.clearPartialMessageTimer(); this.nextMessageLength = -1; let p; if (this.options.contentDecoder !== undefined) { p = this.options.contentDecoder.decode(body); } else { p = Promise.resolve(body); } p.then((value) => { this.options.contentTypeDecoder.decode(value, this.options).then((msg) => { this.callback(msg); }, (error) => { this.fireError(error); }); }, (error) => { this.fireError(error); }); } } clearPartialMessageTimer() { if (this.partialMessageTimer) { ral$2.default().timer.clearTimeout(this.partialMessageTimer); this.partialMessageTimer = undefined; } } setPartialMessageTimer() { this.clearPartialMessageTimer(); if (this._partialMessageTimeout <= 0) { return; } this.partialMessageTimer = ral$2.default().timer.setTimeout((token, timeout) => { this.partialMessageTimer = undefined; if (token === this.messageToken) { this.firePartialMessage({ messageToken: token, waitingTime: timeout }); this.setPartialMessageTimer(); } }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); } } exports.ReadableStreamMessageReader = ReadableStreamMessageReader; }); getDefaultExportFromCjs(messageReader$1); var semaphore$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Semaphore = void 0; class Semaphore { constructor(capacity = 1) { if (capacity <= 0) { throw new Error('Capacity must be greater than 0'); } this._capacity = capacity; this._active = 0; this._waiting = []; } lock(thunk) { return new Promise((resolve, reject) => { this._waiting.push({ thunk, resolve, reject }); this.runNext(); }); } get active() { return this._active; } runNext() { if (this._waiting.length === 0 || this._active === this._capacity) { return; } ral$2.default().timer.setImmediate(() => this.doRunNext()); } doRunNext() { if (this._waiting.length === 0 || this._active === this._capacity) { return; } const next = this._waiting.shift(); this._active++; if (this._active > this._capacity) { throw new Error(`To many thunks active`); } try { const result = next.thunk(); if (result instanceof Promise) { result.then((value) => { this._active--; next.resolve(value); this.runNext(); }, (err) => { this._active--; next.reject(err); this.runNext(); }); } else { this._active--; next.resolve(result); this.runNext(); } } catch (err) { this._active--; next.reject(err); this.runNext(); } } } exports.Semaphore = Semaphore; }); getDefaultExportFromCjs(semaphore$1); var messageWriter$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0; const ContentLength = 'Content-Length: '; const CRLF = '\r\n'; (function (MessageWriter) { function is(value) { let candidate = value; return candidate && is$3.func(candidate.dispose) && is$3.func(candidate.onClose) && is$3.func(candidate.onError) && is$3.func(candidate.write); } MessageWriter.is = is; })(exports.MessageWriter || (exports.MessageWriter = {})); class AbstractMessageWriter { constructor() { this.errorEmitter = new events$2.Emitter(); this.closeEmitter = new events$2.Emitter(); } dispose() { this.errorEmitter.dispose(); this.closeEmitter.dispose(); } get onError() { return this.errorEmitter.event; } fireError(error, message, count) { this.errorEmitter.fire([this.asError(error), message, count]); } get onClose() { return this.closeEmitter.event; } fireClose() { this.closeEmitter.fire(undefined); } asError(error) { if (error instanceof Error) { return error; } else { return new Error(`Writer received error. Reason: ${is$3.string(error.message) ? error.message : 'unknown'}`); } } } exports.AbstractMessageWriter = AbstractMessageWriter; var ResolvedMessageWriterOptions; (function (ResolvedMessageWriterOptions) { function fromOptions(options) { var _a, _b; if (options === undefined || typeof options === 'string') { return { charset: options !== null && options !== void 0 ? options : 'utf-8', contentTypeEncoder: ral$2.default().applicationJson.encoder }; } else { return { charset: (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8', contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) !== null && _b !== void 0 ? _b : ral$2.default().applicationJson.encoder }; } } ResolvedMessageWriterOptions.fromOptions = fromOptions; })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {})); class WriteableStreamMessageWriter extends AbstractMessageWriter { constructor(writable, options) { super(); this.writable = writable; this.options = ResolvedMessageWriterOptions.fromOptions(options); this.errorCount = 0; this.writeSemaphore = new semaphore$1.Semaphore(1); this.writable.onError((error) => this.fireError(error)); this.writable.onClose(() => this.fireClose()); } async write(msg) { return this.writeSemaphore.lock(async () => { const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => { if (this.options.contentEncoder !== undefined) { return this.options.contentEncoder.encode(buffer); } else { return buffer; } }); return payload.then((buffer) => { const headers = []; headers.push(ContentLength, buffer.byteLength.toString(), CRLF); headers.push(CRLF); return this.doWrite(msg, headers, buffer); }, (error) => { this.fireError(error); throw error; }); }); } async doWrite(msg, headers, data) { try { await this.writable.write(headers.join(''), 'ascii'); return this.writable.write(data); } catch (error) { this.handleError(error, msg); return Promise.reject(error); } } handleError(error, msg) { this.errorCount++; this.fireError(error, msg, this.errorCount); } end() { this.writable.end(); } } exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter; }); getDefaultExportFromCjs(messageWriter$1); var linkedMap$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.LRUCache = exports.LinkedMap = exports.Touch = void 0; var Touch; (function (Touch) { Touch.None = 0; Touch.First = 1; Touch.AsOld = Touch.First; Touch.Last = 2; Touch.AsNew = Touch.Last; })(Touch = exports.Touch || (exports.Touch = {})); class LinkedMap { constructor() { this[Symbol.toStringTag] = 'LinkedMap'; this._map = new Map(); this._head = undefined; this._tail = undefined; this._size = 0; this._state = 0; } clear() { this._map.clear(); this._head = undefined; this._tail = undefined; this._size = 0; this._state++; } isEmpty() { return !this._head && !this._tail; } get size() { return this._size; } get first() { var _a; return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value; } get last() { var _a; return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value; } has(key) { return this._map.has(key); } get(key, touch = Touch.None) { const item = this._map.get(key); if (!item) { return undefined; } if (touch !== Touch.None) { this.touch(item, touch); } return item.value; } set(key, value, touch = Touch.None) { let item = this._map.get(key); if (item) { item.value = value; if (touch !== Touch.None) { this.touch(item, touch); } } else { item = { key, value, next: undefined, previous: undefined }; switch (touch) { case Touch.None: this.addItemLast(item); break; case Touch.First: this.addItemFirst(item); break; case Touch.Last: this.addItemLast(item); break; default: this.addItemLast(item); break; } this._map.set(key, item); this._size++; } return this; } delete(key) { return !!this.remove(key); } remove(key) { const item = this._map.get(key); if (!item) { return undefined; } this._map.delete(key); this.removeItem(item); this._size--; return item.value; } shift() { if (!this._head && !this._tail) { return undefined; } if (!this._head || !this._tail) { throw new Error('Invalid list'); } const item = this._head; this._map.delete(item.key); this.removeItem(item); this._size--; return item.value; } forEach(callbackfn, thisArg) { const state = this._state; let current = this._head; while (current) { if (thisArg) { callbackfn.bind(thisArg)(current.value, current.key, this); } else { callbackfn(current.value, current.key, this); } if (this._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } current = current.next; } } keys() { const map = this; const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]() { return iterator; }, next() { if (map._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: current.key, done: false }; current = current.next; return result; } else { return { value: undefined, done: true }; } } }; return iterator; } values() { const map = this; const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]() { return iterator; }, next() { if (map._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: current.value, done: false }; current = current.next; return result; } else { return { value: undefined, done: true }; } } }; return iterator; } entries() { const map = this; const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]() { return iterator; }, next() { if (map._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: [current.key, current.value], done: false }; current = current.next; return result; } else { return { value: undefined, done: true }; } } }; return iterator; } [Symbol.iterator]() { return this.entries(); } trimOld(newSize) { if (newSize >= this.size) { return; } if (newSize === 0) { this.clear(); return; } let current = this._head; let currentSize = this.size; while (current && currentSize > newSize) { this._map.delete(current.key); current = current.next; currentSize--; } this._head = current; this._size = currentSize; if (current) { current.previous = undefined; } this._state++; } addItemFirst(item) { if (!this._head && !this._tail) { this._tail = item; } else if (!this._head) { throw new Error('Invalid list'); } else { item.next = this._head; this._head.previous = item; } this._head = item; this._state++; } addItemLast(item) { if (!this._head && !this._tail) { this._head = item; } else if (!this._tail) { throw new Error('Invalid list'); } else { item.previous = this._tail; this._tail.next = item; } this._tail = item; this._state++; } removeItem(item) { if (item === this._head && item === this._tail) { this._head = undefined; this._tail = undefined; } else if (item === this._head) { if (!item.next) { throw new Error('Invalid list'); } item.next.previous = undefined; this._head = item.next; } else if (item === this._tail) { if (!item.previous) { throw new Error('Invalid list'); } item.previous.next = undefined; this._tail = item.previous; } else { const next = item.next; const previous = item.previous; if (!next || !previous) { throw new Error('Invalid list'); } next.previous = previous; previous.next = next; } item.next = undefined; item.previous = undefined; this._state++; } touch(item, touch) { if (!this._head || !this._tail) { throw new Error('Invalid list'); } if ((touch !== Touch.First && touch !== Touch.Last)) { return; } if (touch === Touch.First) { if (item === this._head) { return; } const next = item.next; const previous = item.previous; if (item === this._tail) { previous.next = undefined; this._tail = previous; } else { next.previous = previous; previous.next = next; } item.previous = undefined; item.next = this._head; this._head.previous = item; this._head = item; this._state++; } else if (touch === Touch.Last) { if (item === this._tail) { return; } const next = item.next; const previous = item.previous; if (item === this._head) { next.previous = undefined; this._head = next; } else { next.previous = previous; previous.next = next; } item.next = undefined; item.previous = this._tail; this._tail.next = item; this._tail = item; this._state++; } } toJSON() { const data = []; this.forEach((value, key) => { data.push([key, value]); }); return data; } fromJSON(data) { this.clear(); for (const [key, value] of data) { this.set(key, value); } } } exports.LinkedMap = LinkedMap; class LRUCache extends LinkedMap { constructor(limit, ratio = 1) { super(); this._limit = limit; this._ratio = Math.min(Math.max(0, ratio), 1); } get limit() { return this._limit; } set limit(limit) { this._limit = limit; this.checkTrim(); } get ratio() { return this._ratio; } set ratio(ratio) { this._ratio = Math.min(Math.max(0, ratio), 1); this.checkTrim(); } get(key, touch = Touch.AsNew) { return super.get(key, touch); } peek(key) { return super.get(key, Touch.None); } set(key, value) { super.set(key, value, Touch.Last); this.checkTrim(); return this; } checkTrim() { if (this.size > this._limit) { this.trimOld(Math.round(this._limit * this._ratio)); } } } exports.LRUCache = LRUCache; }); getDefaultExportFromCjs(linkedMap$1); var connection$3 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createMessageConnection = exports.ConnectionOptions = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.NullLogger = exports.ProgressType = void 0; var CancelNotification; (function (CancelNotification) { CancelNotification.type = new messages$3.NotificationType('$/cancelRequest'); })(CancelNotification || (CancelNotification = {})); var ProgressNotification; (function (ProgressNotification) { ProgressNotification.type = new messages$3.NotificationType('$/progress'); })(ProgressNotification || (ProgressNotification = {})); class ProgressType { constructor() { } } exports.ProgressType = ProgressType; var StarRequestHandler; (function (StarRequestHandler) { function is(value) { return is$3.func(value); } StarRequestHandler.is = is; })(StarRequestHandler || (StarRequestHandler = {})); exports.NullLogger = Object.freeze({ error: () => { }, warn: () => { }, info: () => { }, log: () => { } }); var Trace; (function (Trace) { Trace[Trace["Off"] = 0] = "Off"; Trace[Trace["Messages"] = 1] = "Messages"; Trace[Trace["Verbose"] = 2] = "Verbose"; })(Trace = exports.Trace || (exports.Trace = {})); (function (Trace) { function fromString(value) { if (!is$3.string(value)) { return Trace.Off; } value = value.toLowerCase(); switch (value) { case 'off': return Trace.Off; case 'messages': return Trace.Messages; case 'verbose': return Trace.Verbose; default: return Trace.Off; } } Trace.fromString = fromString; function toString(value) { switch (value) { case Trace.Off: return 'off'; case Trace.Messages: return 'messages'; case Trace.Verbose: return 'verbose'; default: return 'off'; } } Trace.toString = toString; })(Trace = exports.Trace || (exports.Trace = {})); var TraceFormat; (function (TraceFormat) { TraceFormat["Text"] = "text"; TraceFormat["JSON"] = "json"; })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); (function (TraceFormat) { function fromString(value) { if (!is$3.string(value)) { return TraceFormat.Text; } value = value.toLowerCase(); if (value === 'json') { return TraceFormat.JSON; } else { return TraceFormat.Text; } } TraceFormat.fromString = fromString; })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); var SetTraceNotification; (function (SetTraceNotification) { SetTraceNotification.type = new messages$3.NotificationType('$/setTrace'); })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {})); var LogTraceNotification; (function (LogTraceNotification) { LogTraceNotification.type = new messages$3.NotificationType('$/logTrace'); })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {})); var ConnectionErrors; (function (ConnectionErrors) { ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed"; ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed"; ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening"; })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {})); class ConnectionError extends Error { constructor(code, message) { super(message); this.code = code; Object.setPrototypeOf(this, ConnectionError.prototype); } } exports.ConnectionError = ConnectionError; var ConnectionStrategy; (function (ConnectionStrategy) { function is(value) { const candidate = value; return candidate && is$3.func(candidate.cancelUndispatched); } ConnectionStrategy.is = is; })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {})); var CancellationReceiverStrategy; (function (CancellationReceiverStrategy) { CancellationReceiverStrategy.Message = Object.freeze({ createCancellationTokenSource(_) { return new cancellation$1.CancellationTokenSource(); } }); function is(value) { const candidate = value; return candidate && is$3.func(candidate.createCancellationTokenSource); } CancellationReceiverStrategy.is = is; })(CancellationReceiverStrategy = exports.CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = {})); var CancellationSenderStrategy; (function (CancellationSenderStrategy) { CancellationSenderStrategy.Message = Object.freeze({ sendCancellation(conn, id) { conn.sendNotification(CancelNotification.type, { id }); }, cleanup(_) { } }); function is(value) { const candidate = value; return candidate && is$3.func(candidate.sendCancellation) && is$3.func(candidate.cleanup); } CancellationSenderStrategy.is = is; })(CancellationSenderStrategy = exports.CancellationSenderStrategy || (exports.CancellationSenderStrategy = {})); var CancellationStrategy; (function (CancellationStrategy) { CancellationStrategy.Message = Object.freeze({ receiver: CancellationReceiverStrategy.Message, sender: CancellationSenderStrategy.Message }); function is(value) { const candidate = value; return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender); } CancellationStrategy.is = is; })(CancellationStrategy = exports.CancellationStrategy || (exports.CancellationStrategy = {})); (function (ConnectionOptions) { function is(value) { const candidate = value; return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy)); } ConnectionOptions.is = is; })(exports.ConnectionOptions || (exports.ConnectionOptions = {})); var ConnectionState; (function (ConnectionState) { ConnectionState[ConnectionState["New"] = 1] = "New"; ConnectionState[ConnectionState["Listening"] = 2] = "Listening"; ConnectionState[ConnectionState["Closed"] = 3] = "Closed"; ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed"; })(ConnectionState || (ConnectionState = {})); function createMessageConnection(messageReader, messageWriter, _logger, options) { const logger = _logger !== undefined ? _logger : exports.NullLogger; let sequenceNumber = 0; let notificationSequenceNumber = 0; let unknownResponseSequenceNumber = 0; const version = '2.0'; let starRequestHandler = undefined; const requestHandlers = Object.create(null); let starNotificationHandler = undefined; const notificationHandlers = Object.create(null); const progressHandlers = new Map(); let timer; let messageQueue = new linkedMap$1.LinkedMap(); let responsePromises = Object.create(null); let knownCanceledRequests = new Set(); let requestTokens = Object.create(null); let trace = Trace.Off; let traceFormat = TraceFormat.Text; let tracer; let state = ConnectionState.New; const errorEmitter = new events$2.Emitter(); const closeEmitter = new events$2.Emitter(); const unhandledNotificationEmitter = new events$2.Emitter(); const unhandledProgressEmitter = new events$2.Emitter(); const disposeEmitter = new events$2.Emitter(); const cancellationStrategy = (options && options.cancellationStrategy) ? options.cancellationStrategy : CancellationStrategy.Message; function createRequestQueueKey(id) { if (id === null) { throw new Error(`Can't send requests with id null since the response can't be correlated.`); } return 'req-' + id.toString(); } function createResponseQueueKey(id) { if (id === null) { return 'res-unknown-' + (++unknownResponseSequenceNumber).toString(); } else { return 'res-' + id.toString(); } } function createNotificationQueueKey() { return 'not-' + (++notificationSequenceNumber).toString(); } function addMessageToQueue(queue, message) { if (messages$3.isRequestMessage(message)) { queue.set(createRequestQueueKey(message.id), message); } else if (messages$3.isResponseMessage(message)) { queue.set(createResponseQueueKey(message.id), message); } else { queue.set(createNotificationQueueKey(), message); } } function cancelUndispatched(_message) { return undefined; } function isListening() { return state === ConnectionState.Listening; } function isClosed() { return state === ConnectionState.Closed; } function isDisposed() { return state === ConnectionState.Disposed; } function closeHandler() { if (state === ConnectionState.New || state === ConnectionState.Listening) { state = ConnectionState.Closed; closeEmitter.fire(undefined); } } function readErrorHandler(error) { errorEmitter.fire([error, undefined, undefined]); } function writeErrorHandler(data) { errorEmitter.fire(data); } messageReader.onClose(closeHandler); messageReader.onError(readErrorHandler); messageWriter.onClose(closeHandler); messageWriter.onError(writeErrorHandler); function triggerMessageQueue() { if (timer || messageQueue.size === 0) { return; } timer = ral$2.default().timer.setImmediate(() => { timer = undefined; processMessageQueue(); }); } function processMessageQueue() { if (messageQueue.size === 0) { return; } const message = messageQueue.shift(); try { if (messages$3.isRequestMessage(message)) { handleRequest(message); } else if (messages$3.isNotificationMessage(message)) { handleNotification(message); } else if (messages$3.isResponseMessage(message)) { handleResponse(message); } else { handleInvalidMessage(message); } } finally { triggerMessageQueue(); } } const callback = (message) => { try { if (messages$3.isNotificationMessage(message) && message.method === CancelNotification.type.method) { const cancelId = message.params.id; const key = createRequestQueueKey(cancelId); const toCancel = messageQueue.get(key); if (messages$3.isRequestMessage(toCancel)) { const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy; const response = (strategy && strategy.cancelUndispatched) ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); if (response && (response.error !== undefined || response.result !== undefined)) { messageQueue.delete(key); response.id = toCancel.id; traceSendingResponse(response, message.method, Date.now()); messageWriter.write(response); return; } } const tokenKey = String(cancelId); const cancellationToken = requestTokens[tokenKey]; if (cancellationToken !== undefined) { cancellationToken.cancel(); traceReceivedNotification(message); return; } else { knownCanceledRequests.add(cancelId); } } addMessageToQueue(messageQueue, message); } finally { triggerMessageQueue(); } }; function handleRequest(requestMessage) { if (isDisposed()) { return; } function reply(resultOrError, method, startTime) { const message = { jsonrpc: version, id: requestMessage.id }; if (resultOrError instanceof messages$3.ResponseError) { message.error = resultOrError.toJson(); } else { message.result = resultOrError === undefined ? null : resultOrError; } traceSendingResponse(message, method, startTime); messageWriter.write(message); } function replyError(error, method, startTime) { const message = { jsonrpc: version, id: requestMessage.id, error: error.toJson() }; traceSendingResponse(message, method, startTime); messageWriter.write(message); } function replySuccess(result, method, startTime) { if (result === undefined) { result = null; } const message = { jsonrpc: version, id: requestMessage.id, result: result }; traceSendingResponse(message, method, startTime); messageWriter.write(message); } traceReceivedRequest(requestMessage); const element = requestHandlers[requestMessage.method]; let type; let requestHandler; if (element) { type = element.type; requestHandler = element.handler; } const startTime = Date.now(); if (requestHandler || starRequestHandler) { const tokenKey = String(requestMessage.id); const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey); if (requestMessage.id !== null && knownCanceledRequests.has(requestMessage.id)) { cancellationSource.cancel(); } requestTokens[tokenKey] = cancellationSource; try { let handlerResult; if (requestHandler) { if (requestMessage.params === undefined) { if (type !== undefined && type.numberOfParams !== 0) { replyError(new messages$3.ResponseError(messages$3.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`), requestMessage.method, startTime); return; } handlerResult = requestHandler(cancellationSource.token); } else if (Array.isArray(requestMessage.params)) { if (type !== undefined && type.parameterStructures === messages$3.ParameterStructures.byName) { replyError(new messages$3.ResponseError(messages$3.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime); return; } handlerResult = requestHandler(...requestMessage.params, cancellationSource.token); } else { if (type !== undefined && type.parameterStructures === messages$3.ParameterStructures.byPosition) { replyError(new messages$3.ResponseError(messages$3.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime); return; } handlerResult = requestHandler(requestMessage.params, cancellationSource.token); } } else if (starRequestHandler) { handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); } const promise = handlerResult; if (!handlerResult) { delete requestTokens[tokenKey]; replySuccess(handlerResult, requestMessage.method, startTime); } else if (promise.then) { promise.then((resultOrError) => { delete requestTokens[tokenKey]; reply(resultOrError, requestMessage.method, startTime); }, error => { delete requestTokens[tokenKey]; if (error instanceof messages$3.ResponseError) { replyError(error, requestMessage.method, startTime); } else if (error && is$3.string(error.message)) { replyError(new messages$3.ResponseError(messages$3.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); } else { replyError(new messages$3.ResponseError(messages$3.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); } }); } else { delete requestTokens[tokenKey]; reply(handlerResult, requestMessage.method, startTime); } } catch (error) { delete requestTokens[tokenKey]; if (error instanceof messages$3.ResponseError) { reply(error, requestMessage.method, startTime); } else if (error && is$3.string(error.message)) { replyError(new messages$3.ResponseError(messages$3.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); } else { replyError(new messages$3.ResponseError(messages$3.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); } } } else { replyError(new messages$3.ResponseError(messages$3.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); } } function handleResponse(responseMessage) { if (isDisposed()) { return; } if (responseMessage.id === null) { if (responseMessage.error) { logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`); } else { logger.error(`Received response message without id. No further error information provided.`); } } else { const key = String(responseMessage.id); const responsePromise = responsePromises[key]; traceReceivedResponse(responseMessage, responsePromise); if (responsePromise) { delete responsePromises[key]; try { if (responseMessage.error) { const error = responseMessage.error; responsePromise.reject(new messages$3.ResponseError(error.code, error.message, error.data)); } else if (responseMessage.result !== undefined) { responsePromise.resolve(responseMessage.result); } else { throw new Error('Should never happen.'); } } catch (error) { if (error.message) { logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`); } else { logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); } } } } } function handleNotification(message) { if (isDisposed()) { return; } let type = undefined; let notificationHandler; if (message.method === CancelNotification.type.method) { const cancelId = message.params.id; knownCanceledRequests.delete(cancelId); traceReceivedNotification(message); return; } else { const element = notificationHandlers[message.method]; if (element) { notificationHandler = element.handler; type = element.type; } } if (notificationHandler || starNotificationHandler) { try { traceReceivedNotification(message); if (notificationHandler) { if (message.params === undefined) { if (type !== undefined) { if (type.numberOfParams !== 0 && type.parameterStructures !== messages$3.ParameterStructures.byName) { logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received none.`); } } notificationHandler(); } else if (Array.isArray(message.params)) { if (type !== undefined) { if (type.parameterStructures === messages$3.ParameterStructures.byName) { logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`); } if (type.numberOfParams !== message.params.length) { logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${message.params.length} arguments`); } } notificationHandler(...message.params); } else { if (type !== undefined && type.parameterStructures === messages$3.ParameterStructures.byPosition) { logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`); } notificationHandler(message.params); } } else if (starNotificationHandler) { starNotificationHandler(message.method, message.params); } } catch (error) { if (error.message) { logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`); } else { logger.error(`Notification handler '${message.method}' failed unexpectedly.`); } } } else { unhandledNotificationEmitter.fire(message); } } function handleInvalidMessage(message) { if (!message) { logger.error('Received empty message.'); return; } logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`); const responseMessage = message; if (is$3.string(responseMessage.id) || is$3.number(responseMessage.id)) { const key = String(responseMessage.id); const responseHandler = responsePromises[key]; if (responseHandler) { responseHandler.reject(new Error('The received response has neither a result nor an error property.')); } } } function traceSendingRequest(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose && message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } tracer.log(`Sending request '${message.method} - (${message.id})'.`, data); } else { logLSPMessage('send-request', message); } } function traceSendingNotification(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } else { data = 'No parameters provided.\n\n'; } } tracer.log(`Sending notification '${message.method}'.`, data); } else { logLSPMessage('send-notification', message); } } function traceSendingResponse(message, method, startTime) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.error && message.error.data) { data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`; } else { if (message.result) { data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`; } else if (message.error === undefined) { data = 'No result returned.\n\n'; } } } tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data); } else { logLSPMessage('send-response', message); } } function traceReceivedRequest(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose && message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } tracer.log(`Received request '${message.method} - (${message.id})'.`, data); } else { logLSPMessage('receive-request', message); } } function traceReceivedNotification(message) { if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } else { data = 'No parameters provided.\n\n'; } } tracer.log(`Received notification '${message.method}'.`, data); } else { logLSPMessage('receive-notification', message); } } function traceReceivedResponse(message, responsePromise) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.error && message.error.data) { data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`; } else { if (message.result) { data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`; } else if (message.error === undefined) { data = 'No result returned.\n\n'; } } } if (responsePromise) { const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ''; tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data); } else { tracer.log(`Received response ${message.id} without active response promise.`, data); } } else { logLSPMessage('receive-response', message); } } function logLSPMessage(type, message) { if (!tracer || trace === Trace.Off) { return; } const lspMessage = { isLSPMessage: true, type, message, timestamp: Date.now() }; tracer.log(lspMessage); } function throwIfClosedOrDisposed() { if (isClosed()) { throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.'); } if (isDisposed()) { throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.'); } } function throwIfListening() { if (isListening()) { throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening'); } } function throwIfNotListening() { if (!isListening()) { throw new Error('Call listen() first.'); } } function undefinedToNull(param) { if (param === undefined) { return null; } else { return param; } } function nullToUndefined(param) { if (param === null) { return undefined; } else { return param; } } function isNamedParam(param) { return param !== undefined && param !== null && !Array.isArray(param) && typeof param === 'object'; } function computeSingleParam(parameterStructures, param) { switch (parameterStructures) { case messages$3.ParameterStructures.auto: if (isNamedParam(param)) { return nullToUndefined(param); } else { return [undefinedToNull(param)]; } case messages$3.ParameterStructures.byName: if (!isNamedParam(param)) { throw new Error(`Received parameters by name but param is not an object literal.`); } return nullToUndefined(param); case messages$3.ParameterStructures.byPosition: return [undefinedToNull(param)]; default: throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`); } } function computeMessageParams(type, params) { let result; const numberOfParams = type.numberOfParams; switch (numberOfParams) { case 0: result = undefined; break; case 1: result = computeSingleParam(type.parameterStructures, params[0]); break; default: result = []; for (let i = 0; i < params.length && i < numberOfParams; i++) { result.push(undefinedToNull(params[i])); } if (params.length < numberOfParams) { for (let i = params.length; i < numberOfParams; i++) { result.push(null); } } break; } return result; } const connection = { sendNotification: (type, ...args) => { throwIfClosedOrDisposed(); let method; let messageParams; if (is$3.string(type)) { method = type; const first = args[0]; let paramStart = 0; let parameterStructures = messages$3.ParameterStructures.auto; if (messages$3.ParameterStructures.is(first)) { paramStart = 1; parameterStructures = first; } let paramEnd = args.length; const numberOfParams = paramEnd - paramStart; switch (numberOfParams) { case 0: messageParams = undefined; break; case 1: messageParams = computeSingleParam(parameterStructures, args[paramStart]); break; default: if (parameterStructures === messages$3.ParameterStructures.byName) { throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`); } messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value)); break; } } else { const params = args; method = type.method; messageParams = computeMessageParams(type, params); } const notificationMessage = { jsonrpc: version, method: method, params: messageParams }; traceSendingNotification(notificationMessage); messageWriter.write(notificationMessage); }, onNotification: (type, handler) => { throwIfClosedOrDisposed(); let method; if (is$3.func(type)) { starNotificationHandler = type; } else if (handler) { if (is$3.string(type)) { method = type; notificationHandlers[type] = { type: undefined, handler }; } else { method = type.method; notificationHandlers[type.method] = { type, handler }; } } return { dispose: () => { if (method !== undefined) { delete notificationHandlers[method]; } else { starNotificationHandler = undefined; } } }; }, onProgress: (_type, token, handler) => { if (progressHandlers.has(token)) { throw new Error(`Progress handler for token ${token} already registered`); } progressHandlers.set(token, handler); return { dispose: () => { progressHandlers.delete(token); } }; }, sendProgress: (_type, token, value) => { connection.sendNotification(ProgressNotification.type, { token, value }); }, onUnhandledProgress: unhandledProgressEmitter.event, sendRequest: (type, ...args) => { throwIfClosedOrDisposed(); throwIfNotListening(); let method; let messageParams; let token = undefined; if (is$3.string(type)) { method = type; const first = args[0]; const last = args[args.length - 1]; let paramStart = 0; let parameterStructures = messages$3.ParameterStructures.auto; if (messages$3.ParameterStructures.is(first)) { paramStart = 1; parameterStructures = first; } let paramEnd = args.length; if (cancellation$1.CancellationToken.is(last)) { paramEnd = paramEnd - 1; token = last; } const numberOfParams = paramEnd - paramStart; switch (numberOfParams) { case 0: messageParams = undefined; break; case 1: messageParams = computeSingleParam(parameterStructures, args[paramStart]); break; default: if (parameterStructures === messages$3.ParameterStructures.byName) { throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`); } messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value)); break; } } else { const params = args; method = type.method; messageParams = computeMessageParams(type, params); const numberOfParams = type.numberOfParams; token = cancellation$1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined; } const id = sequenceNumber++; let disposable; if (token) { disposable = token.onCancellationRequested(() => { cancellationStrategy.sender.sendCancellation(connection, id); }); } const result = new Promise((resolve, reject) => { const requestMessage = { jsonrpc: version, id: id, method: method, params: messageParams }; const resolveWithCleanup = (r) => { resolve(r); cancellationStrategy.sender.cleanup(id); disposable === null || disposable === void 0 ? void 0 : disposable.dispose(); }; const rejectWithCleanup = (r) => { reject(r); cancellationStrategy.sender.cleanup(id); disposable === null || disposable === void 0 ? void 0 : disposable.dispose(); }; let responsePromise = { method: method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup }; traceSendingRequest(requestMessage); try { messageWriter.write(requestMessage); } catch (e) { responsePromise.reject(new messages$3.ResponseError(messages$3.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason')); responsePromise = null; } if (responsePromise) { responsePromises[String(id)] = responsePromise; } }); return result; }, onRequest: (type, handler) => { throwIfClosedOrDisposed(); let method = null; if (StarRequestHandler.is(type)) { method = undefined; starRequestHandler = type; } else if (is$3.string(type)) { method = null; if (handler !== undefined) { method = type; requestHandlers[type] = { handler: handler, type: undefined }; } } else { if (handler !== undefined) { method = type.method; requestHandlers[type.method] = { type, handler }; } } return { dispose: () => { if (method === null) { return; } if (method !== undefined) { delete requestHandlers[method]; } else { starRequestHandler = undefined; } } }; }, trace: (_value, _tracer, sendNotificationOrTraceOptions) => { let _sendNotification = false; let _traceFormat = TraceFormat.Text; if (sendNotificationOrTraceOptions !== undefined) { if (is$3.boolean(sendNotificationOrTraceOptions)) { _sendNotification = sendNotificationOrTraceOptions; } else { _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; } } trace = _value; traceFormat = _traceFormat; if (trace === Trace.Off) { tracer = undefined; } else { tracer = _tracer; } if (_sendNotification && !isClosed() && !isDisposed()) { connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); } }, onError: errorEmitter.event, onClose: closeEmitter.event, onUnhandledNotification: unhandledNotificationEmitter.event, onDispose: disposeEmitter.event, end: () => { messageWriter.end(); }, dispose: () => { if (isDisposed()) { return; } state = ConnectionState.Disposed; disposeEmitter.fire(undefined); const error = new Error('Connection got disposed.'); Object.keys(responsePromises).forEach((key) => { responsePromises[key].reject(error); }); responsePromises = Object.create(null); requestTokens = Object.create(null); knownCanceledRequests = new Set(); messageQueue = new linkedMap$1.LinkedMap(); if (is$3.func(messageWriter.dispose)) { messageWriter.dispose(); } if (is$3.func(messageReader.dispose)) { messageReader.dispose(); } }, listen: () => { throwIfClosedOrDisposed(); throwIfListening(); state = ConnectionState.Listening; messageReader.listen(callback); }, inspect: () => { ral$2.default().console.log('inspect'); } }; connection.onNotification(LogTraceNotification.type, (params) => { if (trace === Trace.Off || !tracer) { return; } tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined); }); connection.onNotification(ProgressNotification.type, (params) => { const handler = progressHandlers.get(params.token); if (handler) { handler(params.value); } else { unhandledProgressEmitter.fire(params); } }); return connection; } exports.createMessageConnection = createMessageConnection; }); getDefaultExportFromCjs(connection$3); var api$4 = createCommonjsModule(function (module, exports) { /// Object.defineProperty(exports, "__esModule", { value: true }); exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.ProgressType = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.RAL = void 0; exports.CancellationStrategy = void 0; Object.defineProperty(exports, "RequestType", { enumerable: true, get: function () { return messages$3.RequestType; } }); Object.defineProperty(exports, "RequestType0", { enumerable: true, get: function () { return messages$3.RequestType0; } }); Object.defineProperty(exports, "RequestType1", { enumerable: true, get: function () { return messages$3.RequestType1; } }); Object.defineProperty(exports, "RequestType2", { enumerable: true, get: function () { return messages$3.RequestType2; } }); Object.defineProperty(exports, "RequestType3", { enumerable: true, get: function () { return messages$3.RequestType3; } }); Object.defineProperty(exports, "RequestType4", { enumerable: true, get: function () { return messages$3.RequestType4; } }); Object.defineProperty(exports, "RequestType5", { enumerable: true, get: function () { return messages$3.RequestType5; } }); Object.defineProperty(exports, "RequestType6", { enumerable: true, get: function () { return messages$3.RequestType6; } }); Object.defineProperty(exports, "RequestType7", { enumerable: true, get: function () { return messages$3.RequestType7; } }); Object.defineProperty(exports, "RequestType8", { enumerable: true, get: function () { return messages$3.RequestType8; } }); Object.defineProperty(exports, "RequestType9", { enumerable: true, get: function () { return messages$3.RequestType9; } }); Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function () { return messages$3.ResponseError; } }); Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function () { return messages$3.ErrorCodes; } }); Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function () { return messages$3.NotificationType; } }); Object.defineProperty(exports, "NotificationType0", { enumerable: true, get: function () { return messages$3.NotificationType0; } }); Object.defineProperty(exports, "NotificationType1", { enumerable: true, get: function () { return messages$3.NotificationType1; } }); Object.defineProperty(exports, "NotificationType2", { enumerable: true, get: function () { return messages$3.NotificationType2; } }); Object.defineProperty(exports, "NotificationType3", { enumerable: true, get: function () { return messages$3.NotificationType3; } }); Object.defineProperty(exports, "NotificationType4", { enumerable: true, get: function () { return messages$3.NotificationType4; } }); Object.defineProperty(exports, "NotificationType5", { enumerable: true, get: function () { return messages$3.NotificationType5; } }); Object.defineProperty(exports, "NotificationType6", { enumerable: true, get: function () { return messages$3.NotificationType6; } }); Object.defineProperty(exports, "NotificationType7", { enumerable: true, get: function () { return messages$3.NotificationType7; } }); Object.defineProperty(exports, "NotificationType8", { enumerable: true, get: function () { return messages$3.NotificationType8; } }); Object.defineProperty(exports, "NotificationType9", { enumerable: true, get: function () { return messages$3.NotificationType9; } }); Object.defineProperty(exports, "ParameterStructures", { enumerable: true, get: function () { return messages$3.ParameterStructures; } }); Object.defineProperty(exports, "Disposable", { enumerable: true, get: function () { return disposable$1.Disposable; } }); Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return events$2.Event; } }); Object.defineProperty(exports, "Emitter", { enumerable: true, get: function () { return events$2.Emitter; } }); Object.defineProperty(exports, "CancellationTokenSource", { enumerable: true, get: function () { return cancellation$1.CancellationTokenSource; } }); Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function () { return cancellation$1.CancellationToken; } }); Object.defineProperty(exports, "MessageReader", { enumerable: true, get: function () { return messageReader$1.MessageReader; } }); Object.defineProperty(exports, "AbstractMessageReader", { enumerable: true, get: function () { return messageReader$1.AbstractMessageReader; } }); Object.defineProperty(exports, "ReadableStreamMessageReader", { enumerable: true, get: function () { return messageReader$1.ReadableStreamMessageReader; } }); Object.defineProperty(exports, "MessageWriter", { enumerable: true, get: function () { return messageWriter$1.MessageWriter; } }); Object.defineProperty(exports, "AbstractMessageWriter", { enumerable: true, get: function () { return messageWriter$1.AbstractMessageWriter; } }); Object.defineProperty(exports, "WriteableStreamMessageWriter", { enumerable: true, get: function () { return messageWriter$1.WriteableStreamMessageWriter; } }); Object.defineProperty(exports, "ConnectionStrategy", { enumerable: true, get: function () { return connection$3.ConnectionStrategy; } }); Object.defineProperty(exports, "ConnectionOptions", { enumerable: true, get: function () { return connection$3.ConnectionOptions; } }); Object.defineProperty(exports, "NullLogger", { enumerable: true, get: function () { return connection$3.NullLogger; } }); Object.defineProperty(exports, "createMessageConnection", { enumerable: true, get: function () { return connection$3.createMessageConnection; } }); Object.defineProperty(exports, "ProgressType", { enumerable: true, get: function () { return connection$3.ProgressType; } }); Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return connection$3.Trace; } }); Object.defineProperty(exports, "TraceFormat", { enumerable: true, get: function () { return connection$3.TraceFormat; } }); Object.defineProperty(exports, "SetTraceNotification", { enumerable: true, get: function () { return connection$3.SetTraceNotification; } }); Object.defineProperty(exports, "LogTraceNotification", { enumerable: true, get: function () { return connection$3.LogTraceNotification; } }); Object.defineProperty(exports, "ConnectionErrors", { enumerable: true, get: function () { return connection$3.ConnectionErrors; } }); Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return connection$3.ConnectionError; } }); Object.defineProperty(exports, "CancellationReceiverStrategy", { enumerable: true, get: function () { return connection$3.CancellationReceiverStrategy; } }); Object.defineProperty(exports, "CancellationSenderStrategy", { enumerable: true, get: function () { return connection$3.CancellationSenderStrategy; } }); Object.defineProperty(exports, "CancellationStrategy", { enumerable: true, get: function () { return connection$3.CancellationStrategy; } }); exports.RAL = ral$2.default; }); getDefaultExportFromCjs(api$4); var main$7 = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createMessageConnection = exports.createServerSocketTransport = exports.createClientSocketTransport = exports.createServerPipeTransport = exports.createClientPipeTransport = exports.generateRandomPipeName = exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = void 0; ril$1.default.install(); __exportStar(api$4, exports); class IPCMessageReader extends api$4.AbstractMessageReader { constructor(process) { super(); this.process = process; let eventEmitter = this.process; eventEmitter.on('error', (error) => this.fireError(error)); eventEmitter.on('close', () => this.fireClose()); } listen(callback) { this.process.on('message', callback); return api$4.Disposable.create(() => this.process.off('message', callback)); } } exports.IPCMessageReader = IPCMessageReader; class IPCMessageWriter extends api$4.AbstractMessageWriter { constructor(process) { super(); this.process = process; this.errorCount = 0; let eventEmitter = this.process; eventEmitter.on('error', (error) => this.fireError(error)); eventEmitter.on('close', () => this.fireClose); } write(msg) { try { if (typeof this.process.send === 'function') { this.process.send(msg, undefined, undefined, (error) => { if (error) { this.errorCount++; this.handleError(error, msg); } else { this.errorCount = 0; } }); } return Promise.resolve(); } catch (error) { this.handleError(error, msg); return Promise.reject(error); } } handleError(error, msg) { this.errorCount++; this.fireError(error, msg, this.errorCount); } end() { } } exports.IPCMessageWriter = IPCMessageWriter; class SocketMessageReader extends api$4.ReadableStreamMessageReader { constructor(socket, encoding = 'utf-8') { super(ril$1.default().stream.asReadableStream(socket), encoding); } } exports.SocketMessageReader = SocketMessageReader; class SocketMessageWriter extends api$4.WriteableStreamMessageWriter { constructor(socket, options) { super(ril$1.default().stream.asWritableStream(socket), options); this.socket = socket; } dispose() { super.dispose(); this.socket.destroy(); } } exports.SocketMessageWriter = SocketMessageWriter; class StreamMessageReader extends api$4.ReadableStreamMessageReader { constructor(readble, encoding) { super(ril$1.default().stream.asReadableStream(readble), encoding); } } exports.StreamMessageReader = StreamMessageReader; class StreamMessageWriter extends api$4.WriteableStreamMessageWriter { constructor(writable, options) { super(ril$1.default().stream.asWritableStream(writable), options); } } exports.StreamMessageWriter = StreamMessageWriter; const XDG_RUNTIME_DIR = process.env['XDG_RUNTIME_DIR']; const safeIpcPathLengths = new Map([ ['linux', 107], ['darwin', 103] ]); function generateRandomPipeName() { const randomSuffix = crypto_1__default['default'].randomBytes(21).toString('hex'); if (process.platform === 'win32') { return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`; } let result; if (XDG_RUNTIME_DIR) { result = path__default['default'].join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`); } else { result = path__default['default'].join(os__default['default'].tmpdir(), `vscode-${randomSuffix}.sock`); } const limit = safeIpcPathLengths.get(process.platform); if (limit !== undefined && result.length >= limit) { ril$1.default().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`); } return result; } exports.generateRandomPipeName = generateRandomPipeName; function createClientPipeTransport(pipeName, encoding = 'utf-8') { let connectResolve; const connected = new Promise((resolve, _reject) => { connectResolve = resolve; }); return new Promise((resolve, reject) => { let server = net_1__default['default'].createServer((socket) => { server.close(); connectResolve([ new SocketMessageReader(socket, encoding), new SocketMessageWriter(socket, encoding) ]); }); server.on('error', reject); server.listen(pipeName, () => { server.removeListener('error', reject); resolve({ onConnected: () => { return connected; } }); }); }); } exports.createClientPipeTransport = createClientPipeTransport; function createServerPipeTransport(pipeName, encoding = 'utf-8') { const socket = net_1__default['default'].createConnection(pipeName); return [ new SocketMessageReader(socket, encoding), new SocketMessageWriter(socket, encoding) ]; } exports.createServerPipeTransport = createServerPipeTransport; function createClientSocketTransport(port, encoding = 'utf-8') { let connectResolve; const connected = new Promise((resolve, _reject) => { connectResolve = resolve; }); return new Promise((resolve, reject) => { const server = net_1__default['default'].createServer((socket) => { server.close(); connectResolve([ new SocketMessageReader(socket, encoding), new SocketMessageWriter(socket, encoding) ]); }); server.on('error', reject); server.listen(port, '127.0.0.1', () => { server.removeListener('error', reject); resolve({ onConnected: () => { return connected; } }); }); }); } exports.createClientSocketTransport = createClientSocketTransport; function createServerSocketTransport(port, encoding = 'utf-8') { const socket = net_1__default['default'].createConnection(port, '127.0.0.1'); return [ new SocketMessageReader(socket, encoding), new SocketMessageWriter(socket, encoding) ]; } exports.createServerSocketTransport = createServerSocketTransport; function isReadableStream(value) { const candidate = value; return candidate.read !== undefined && candidate.addListener !== undefined; } function isWritableStream(value) { const candidate = value; return candidate.write !== undefined && candidate.addListener !== undefined; } function createMessageConnection(input, output, logger, options) { if (!logger) { logger = api$4.NullLogger; } const reader = isReadableStream(input) ? new StreamMessageReader(input) : input; const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output; if (api$4.ConnectionStrategy.is(options)) { options = { connectionStrategy: options }; } return api$4.createMessageConnection(reader, writer, logger, options); } exports.createMessageConnection = createMessageConnection; }); getDefaultExportFromCjs(main$7); var node$3 = main$7; var integer$1; (function (integer) { integer.MIN_VALUE = -2147483648; integer.MAX_VALUE = 2147483647; })(integer$1 || (integer$1 = {})); var uinteger$1; (function (uinteger) { uinteger.MIN_VALUE = 0; uinteger.MAX_VALUE = 2147483647; })(uinteger$1 || (uinteger$1 = {})); var Position$1; (function (Position) { function create(line, character) { if (line === Number.MAX_VALUE) { line = uinteger$1.MAX_VALUE; } if (character === Number.MAX_VALUE) { character = uinteger$1.MAX_VALUE; } return { line: line, character: character }; } Position.create = create; function is(value) { var candidate = value; return Is$1.objectLiteral(candidate) && Is$1.uinteger(candidate.line) && Is$1.uinteger(candidate.character); } Position.is = is; })(Position$1 || (Position$1 = {})); var Range$1; (function (Range) { function create(one, two, three, four) { if (Is$1.uinteger(one) && Is$1.uinteger(two) && Is$1.uinteger(three) && Is$1.uinteger(four)) { return { start: Position$1.create(one, two), end: Position$1.create(three, four) }; } else if (Position$1.is(one) && Position$1.is(two)) { return { start: one, end: two }; } else { throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]"); } } Range.create = create; function is(value) { var candidate = value; return Is$1.objectLiteral(candidate) && Position$1.is(candidate.start) && Position$1.is(candidate.end); } Range.is = is; })(Range$1 || (Range$1 = {})); var Location$1; (function (Location) { function create(uri, range) { return { uri: uri, range: range }; } Location.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Range$1.is(candidate.range) && (Is$1.string(candidate.uri) || Is$1.undefined(candidate.uri)); } Location.is = is; })(Location$1 || (Location$1 = {})); var LocationLink$1; (function (LocationLink) { function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange }; } LocationLink.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Range$1.is(candidate.targetRange) && Is$1.string(candidate.targetUri) && (Range$1.is(candidate.targetSelectionRange) || Is$1.undefined(candidate.targetSelectionRange)) && (Range$1.is(candidate.originSelectionRange) || Is$1.undefined(candidate.originSelectionRange)); } LocationLink.is = is; })(LocationLink$1 || (LocationLink$1 = {})); var Color$1; (function (Color) { function create(red, green, blue, alpha) { return { red: red, green: green, blue: blue, alpha: alpha, }; } Color.create = create; function is(value) { var candidate = value; return Is$1.numberRange(candidate.red, 0, 1) && Is$1.numberRange(candidate.green, 0, 1) && Is$1.numberRange(candidate.blue, 0, 1) && Is$1.numberRange(candidate.alpha, 0, 1); } Color.is = is; })(Color$1 || (Color$1 = {})); var ColorInformation$1; (function (ColorInformation) { function create(range, color) { return { range: range, color: color, }; } ColorInformation.create = create; function is(value) { var candidate = value; return Range$1.is(candidate.range) && Color$1.is(candidate.color); } ColorInformation.is = is; })(ColorInformation$1 || (ColorInformation$1 = {})); var ColorPresentation$1; (function (ColorPresentation) { function create(label, textEdit, additionalTextEdits) { return { label: label, textEdit: textEdit, additionalTextEdits: additionalTextEdits, }; } ColorPresentation.create = create; function is(value) { var candidate = value; return Is$1.string(candidate.label) && (Is$1.undefined(candidate.textEdit) || TextEdit$1.is(candidate)) && (Is$1.undefined(candidate.additionalTextEdits) || Is$1.typedArray(candidate.additionalTextEdits, TextEdit$1.is)); } ColorPresentation.is = is; })(ColorPresentation$1 || (ColorPresentation$1 = {})); var FoldingRangeKind$1; (function (FoldingRangeKind) { FoldingRangeKind["Comment"] = "comment"; FoldingRangeKind["Imports"] = "imports"; FoldingRangeKind["Region"] = "region"; })(FoldingRangeKind$1 || (FoldingRangeKind$1 = {})); var FoldingRange$1; (function (FoldingRange) { function create(startLine, endLine, startCharacter, endCharacter, kind) { var result = { startLine: startLine, endLine: endLine }; if (Is$1.defined(startCharacter)) { result.startCharacter = startCharacter; } if (Is$1.defined(endCharacter)) { result.endCharacter = endCharacter; } if (Is$1.defined(kind)) { result.kind = kind; } return result; } FoldingRange.create = create; function is(value) { var candidate = value; return Is$1.uinteger(candidate.startLine) && Is$1.uinteger(candidate.startLine) && (Is$1.undefined(candidate.startCharacter) || Is$1.uinteger(candidate.startCharacter)) && (Is$1.undefined(candidate.endCharacter) || Is$1.uinteger(candidate.endCharacter)) && (Is$1.undefined(candidate.kind) || Is$1.string(candidate.kind)); } FoldingRange.is = is; })(FoldingRange$1 || (FoldingRange$1 = {})); var DiagnosticRelatedInformation$1; (function (DiagnosticRelatedInformation) { function create(location, message) { return { location: location, message: message }; } DiagnosticRelatedInformation.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Location$1.is(candidate.location) && Is$1.string(candidate.message); } DiagnosticRelatedInformation.is = is; })(DiagnosticRelatedInformation$1 || (DiagnosticRelatedInformation$1 = {})); var DiagnosticSeverity$1; (function (DiagnosticSeverity) { DiagnosticSeverity.Error = 1; DiagnosticSeverity.Warning = 2; DiagnosticSeverity.Information = 3; DiagnosticSeverity.Hint = 4; })(DiagnosticSeverity$1 || (DiagnosticSeverity$1 = {})); var DiagnosticTag$1; (function (DiagnosticTag) { DiagnosticTag.Unnecessary = 1; DiagnosticTag.Deprecated = 2; })(DiagnosticTag$1 || (DiagnosticTag$1 = {})); var CodeDescription$1; (function (CodeDescription) { function is(value) { var candidate = value; return candidate !== undefined && candidate !== null && Is$1.string(candidate.href); } CodeDescription.is = is; })(CodeDescription$1 || (CodeDescription$1 = {})); var Diagnostic$1; (function (Diagnostic) { function create(range, message, severity, code, source, relatedInformation) { var result = { range: range, message: message }; if (Is$1.defined(severity)) { result.severity = severity; } if (Is$1.defined(code)) { result.code = code; } if (Is$1.defined(source)) { result.source = source; } if (Is$1.defined(relatedInformation)) { result.relatedInformation = relatedInformation; } return result; } Diagnostic.create = create; function is(value) { var _a; var candidate = value; return Is$1.defined(candidate) && Range$1.is(candidate.range) && Is$1.string(candidate.message) && (Is$1.number(candidate.severity) || Is$1.undefined(candidate.severity)) && (Is$1.integer(candidate.code) || Is$1.string(candidate.code) || Is$1.undefined(candidate.code)) && (Is$1.undefined(candidate.codeDescription) || (Is$1.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href))) && (Is$1.string(candidate.source) || Is$1.undefined(candidate.source)) && (Is$1.undefined(candidate.relatedInformation) || Is$1.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation$1.is)); } Diagnostic.is = is; })(Diagnostic$1 || (Diagnostic$1 = {})); var Command$1; (function (Command) { function create(title, command) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } var result = { title: title, command: command }; if (Is$1.defined(args) && args.length > 0) { result.arguments = args; } return result; } Command.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Is$1.string(candidate.title) && Is$1.string(candidate.command); } Command.is = is; })(Command$1 || (Command$1 = {})); var TextEdit$1; (function (TextEdit) { function replace(range, newText) { return { range: range, newText: newText }; } TextEdit.replace = replace; function insert(position, newText) { return { range: { start: position, end: position }, newText: newText }; } TextEdit.insert = insert; function del(range) { return { range: range, newText: '' }; } TextEdit.del = del; function is(value) { var candidate = value; return Is$1.objectLiteral(candidate) && Is$1.string(candidate.newText) && Range$1.is(candidate.range); } TextEdit.is = is; })(TextEdit$1 || (TextEdit$1 = {})); var ChangeAnnotation$1; (function (ChangeAnnotation) { function create(label, needsConfirmation, description) { var result = { label: label }; if (needsConfirmation !== undefined) { result.needsConfirmation = needsConfirmation; } if (description !== undefined) { result.description = description; } return result; } ChangeAnnotation.create = create; function is(value) { var candidate = value; return candidate !== undefined && Is$1.objectLiteral(candidate) && Is$1.string(candidate.label) && (Is$1.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) && (Is$1.string(candidate.description) || candidate.description === undefined); } ChangeAnnotation.is = is; })(ChangeAnnotation$1 || (ChangeAnnotation$1 = {})); var ChangeAnnotationIdentifier$1; (function (ChangeAnnotationIdentifier) { function is(value) { var candidate = value; return typeof candidate === 'string'; } ChangeAnnotationIdentifier.is = is; })(ChangeAnnotationIdentifier$1 || (ChangeAnnotationIdentifier$1 = {})); var AnnotatedTextEdit$1; (function (AnnotatedTextEdit) { function replace(range, newText, annotation) { return { range: range, newText: newText, annotationId: annotation }; } AnnotatedTextEdit.replace = replace; function insert(position, newText, annotation) { return { range: { start: position, end: position }, newText: newText, annotationId: annotation }; } AnnotatedTextEdit.insert = insert; function del(range, annotation) { return { range: range, newText: '', annotationId: annotation }; } AnnotatedTextEdit.del = del; function is(value) { var candidate = value; return TextEdit$1.is(candidate) && (ChangeAnnotation$1.is(candidate.annotationId) || ChangeAnnotationIdentifier$1.is(candidate.annotationId)); } AnnotatedTextEdit.is = is; })(AnnotatedTextEdit$1 || (AnnotatedTextEdit$1 = {})); var TextDocumentEdit$1; (function (TextDocumentEdit) { function create(textDocument, edits) { return { textDocument: textDocument, edits: edits }; } TextDocumentEdit.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && OptionalVersionedTextDocumentIdentifier$1.is(candidate.textDocument) && Array.isArray(candidate.edits); } TextDocumentEdit.is = is; })(TextDocumentEdit$1 || (TextDocumentEdit$1 = {})); var CreateFile$1; (function (CreateFile) { function create(uri, options, annotation) { var result = { kind: 'create', uri: uri }; if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) { result.options = options; } if (annotation !== undefined) { result.annotationId = annotation; } return result; } CreateFile.create = create; function is(value) { var candidate = value; return candidate && candidate.kind === 'create' && Is$1.string(candidate.uri) && (candidate.options === undefined || ((candidate.options.overwrite === undefined || Is$1.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is$1.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier$1.is(candidate.annotationId)); } CreateFile.is = is; })(CreateFile$1 || (CreateFile$1 = {})); var RenameFile$1; (function (RenameFile) { function create(oldUri, newUri, options, annotation) { var result = { kind: 'rename', oldUri: oldUri, newUri: newUri }; if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) { result.options = options; } if (annotation !== undefined) { result.annotationId = annotation; } return result; } RenameFile.create = create; function is(value) { var candidate = value; return candidate && candidate.kind === 'rename' && Is$1.string(candidate.oldUri) && Is$1.string(candidate.newUri) && (candidate.options === undefined || ((candidate.options.overwrite === undefined || Is$1.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is$1.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier$1.is(candidate.annotationId)); } RenameFile.is = is; })(RenameFile$1 || (RenameFile$1 = {})); var DeleteFile$1; (function (DeleteFile) { function create(uri, options, annotation) { var result = { kind: 'delete', uri: uri }; if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) { result.options = options; } if (annotation !== undefined) { result.annotationId = annotation; } return result; } DeleteFile.create = create; function is(value) { var candidate = value; return candidate && candidate.kind === 'delete' && Is$1.string(candidate.uri) && (candidate.options === undefined || ((candidate.options.recursive === undefined || Is$1.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is$1.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier$1.is(candidate.annotationId)); } DeleteFile.is = is; })(DeleteFile$1 || (DeleteFile$1 = {})); var WorkspaceEdit$1; (function (WorkspaceEdit) { function is(value) { var candidate = value; return candidate && (candidate.changes !== undefined || candidate.documentChanges !== undefined) && (candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) { if (Is$1.string(change.kind)) { return CreateFile$1.is(change) || RenameFile$1.is(change) || DeleteFile$1.is(change); } else { return TextDocumentEdit$1.is(change); } })); } WorkspaceEdit.is = is; })(WorkspaceEdit$1 || (WorkspaceEdit$1 = {})); var TextEditChangeImpl$1 = (function () { function TextEditChangeImpl(edits, changeAnnotations) { this.edits = edits; this.changeAnnotations = changeAnnotations; } TextEditChangeImpl.prototype.insert = function (position, newText, annotation) { var edit; var id; if (annotation === undefined) { edit = TextEdit$1.insert(position, newText); } else if (ChangeAnnotationIdentifier$1.is(annotation)) { id = annotation; edit = AnnotatedTextEdit$1.insert(position, newText, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit$1.insert(position, newText, id); } this.edits.push(edit); if (id !== undefined) { return id; } }; TextEditChangeImpl.prototype.replace = function (range, newText, annotation) { var edit; var id; if (annotation === undefined) { edit = TextEdit$1.replace(range, newText); } else if (ChangeAnnotationIdentifier$1.is(annotation)) { id = annotation; edit = AnnotatedTextEdit$1.replace(range, newText, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit$1.replace(range, newText, id); } this.edits.push(edit); if (id !== undefined) { return id; } }; TextEditChangeImpl.prototype.delete = function (range, annotation) { var edit; var id; if (annotation === undefined) { edit = TextEdit$1.del(range); } else if (ChangeAnnotationIdentifier$1.is(annotation)) { id = annotation; edit = AnnotatedTextEdit$1.del(range, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit$1.del(range, id); } this.edits.push(edit); if (id !== undefined) { return id; } }; TextEditChangeImpl.prototype.add = function (edit) { this.edits.push(edit); }; TextEditChangeImpl.prototype.all = function () { return this.edits; }; TextEditChangeImpl.prototype.clear = function () { this.edits.splice(0, this.edits.length); }; TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) { if (value === undefined) { throw new Error("Text edit change is not configured to manage change annotations."); } }; return TextEditChangeImpl; }()); var ChangeAnnotations$1 = (function () { function ChangeAnnotations(annotations) { this._annotations = annotations === undefined ? Object.create(null) : annotations; this._counter = 0; this._size = 0; } ChangeAnnotations.prototype.all = function () { return this._annotations; }; Object.defineProperty(ChangeAnnotations.prototype, "size", { get: function () { return this._size; }, enumerable: false, configurable: true }); ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) { var id; if (ChangeAnnotationIdentifier$1.is(idOrAnnotation)) { id = idOrAnnotation; } else { id = this.nextId(); annotation = idOrAnnotation; } if (this._annotations[id] !== undefined) { throw new Error("Id " + id + " is already in use."); } if (annotation === undefined) { throw new Error("No annotation provided for id " + id); } this._annotations[id] = annotation; this._size++; return id; }; ChangeAnnotations.prototype.nextId = function () { this._counter++; return this._counter.toString(); }; return ChangeAnnotations; }()); var WorkspaceChange$1 = (function () { function WorkspaceChange(workspaceEdit) { var _this = this; this._textEditChanges = Object.create(null); if (workspaceEdit !== undefined) { this._workspaceEdit = workspaceEdit; if (workspaceEdit.documentChanges) { this._changeAnnotations = new ChangeAnnotations$1(workspaceEdit.changeAnnotations); workspaceEdit.changeAnnotations = this._changeAnnotations.all(); workspaceEdit.documentChanges.forEach(function (change) { if (TextDocumentEdit$1.is(change)) { var textEditChange = new TextEditChangeImpl$1(change.edits, _this._changeAnnotations); _this._textEditChanges[change.textDocument.uri] = textEditChange; } }); } else if (workspaceEdit.changes) { Object.keys(workspaceEdit.changes).forEach(function (key) { var textEditChange = new TextEditChangeImpl$1(workspaceEdit.changes[key]); _this._textEditChanges[key] = textEditChange; }); } } else { this._workspaceEdit = {}; } } Object.defineProperty(WorkspaceChange.prototype, "edit", { get: function () { this.initDocumentChanges(); if (this._changeAnnotations !== undefined) { if (this._changeAnnotations.size === 0) { this._workspaceEdit.changeAnnotations = undefined; } else { this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); } } return this._workspaceEdit; }, enumerable: false, configurable: true }); WorkspaceChange.prototype.getTextEditChange = function (key) { if (OptionalVersionedTextDocumentIdentifier$1.is(key)) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === undefined) { throw new Error('Workspace edit is not configured for document changes.'); } var textDocument = { uri: key.uri, version: key.version }; var result = this._textEditChanges[textDocument.uri]; if (!result) { var edits = []; var textDocumentEdit = { textDocument: textDocument, edits: edits }; this._workspaceEdit.documentChanges.push(textDocumentEdit); result = new TextEditChangeImpl$1(edits, this._changeAnnotations); this._textEditChanges[textDocument.uri] = result; } return result; } else { this.initChanges(); if (this._workspaceEdit.changes === undefined) { throw new Error('Workspace edit is not configured for normal text edit changes.'); } var result = this._textEditChanges[key]; if (!result) { var edits = []; this._workspaceEdit.changes[key] = edits; result = new TextEditChangeImpl$1(edits); this._textEditChanges[key] = result; } return result; } }; WorkspaceChange.prototype.initDocumentChanges = function () { if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) { this._changeAnnotations = new ChangeAnnotations$1(); this._workspaceEdit.documentChanges = []; this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); } }; WorkspaceChange.prototype.initChanges = function () { if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) { this._workspaceEdit.changes = Object.create(null); } }; WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === undefined) { throw new Error('Workspace edit is not configured for document changes.'); } var annotation; if (ChangeAnnotation$1.is(optionsOrAnnotation) || ChangeAnnotationIdentifier$1.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === undefined) { operation = CreateFile$1.create(uri, options); } else { id = ChangeAnnotationIdentifier$1.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = CreateFile$1.create(uri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== undefined) { return id; } }; WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === undefined) { throw new Error('Workspace edit is not configured for document changes.'); } var annotation; if (ChangeAnnotation$1.is(optionsOrAnnotation) || ChangeAnnotationIdentifier$1.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === undefined) { operation = RenameFile$1.create(oldUri, newUri, options); } else { id = ChangeAnnotationIdentifier$1.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = RenameFile$1.create(oldUri, newUri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== undefined) { return id; } }; WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === undefined) { throw new Error('Workspace edit is not configured for document changes.'); } var annotation; if (ChangeAnnotation$1.is(optionsOrAnnotation) || ChangeAnnotationIdentifier$1.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === undefined) { operation = DeleteFile$1.create(uri, options); } else { id = ChangeAnnotationIdentifier$1.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = DeleteFile$1.create(uri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== undefined) { return id; } }; return WorkspaceChange; }()); var TextDocumentIdentifier$1; (function (TextDocumentIdentifier) { function create(uri) { return { uri: uri }; } TextDocumentIdentifier.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Is$1.string(candidate.uri); } TextDocumentIdentifier.is = is; })(TextDocumentIdentifier$1 || (TextDocumentIdentifier$1 = {})); var VersionedTextDocumentIdentifier$1; (function (VersionedTextDocumentIdentifier) { function create(uri, version) { return { uri: uri, version: version }; } VersionedTextDocumentIdentifier.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Is$1.string(candidate.uri) && Is$1.integer(candidate.version); } VersionedTextDocumentIdentifier.is = is; })(VersionedTextDocumentIdentifier$1 || (VersionedTextDocumentIdentifier$1 = {})); var OptionalVersionedTextDocumentIdentifier$1; (function (OptionalVersionedTextDocumentIdentifier) { function create(uri, version) { return { uri: uri, version: version }; } OptionalVersionedTextDocumentIdentifier.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Is$1.string(candidate.uri) && (candidate.version === null || Is$1.integer(candidate.version)); } OptionalVersionedTextDocumentIdentifier.is = is; })(OptionalVersionedTextDocumentIdentifier$1 || (OptionalVersionedTextDocumentIdentifier$1 = {})); var TextDocumentItem$1; (function (TextDocumentItem) { function create(uri, languageId, version, text) { return { uri: uri, languageId: languageId, version: version, text: text }; } TextDocumentItem.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Is$1.string(candidate.uri) && Is$1.string(candidate.languageId) && Is$1.integer(candidate.version) && Is$1.string(candidate.text); } TextDocumentItem.is = is; })(TextDocumentItem$1 || (TextDocumentItem$1 = {})); var MarkupKind$1; (function (MarkupKind) { MarkupKind.PlainText = 'plaintext'; MarkupKind.Markdown = 'markdown'; })(MarkupKind$1 || (MarkupKind$1 = {})); (function (MarkupKind) { function is(value) { var candidate = value; return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown; } MarkupKind.is = is; })(MarkupKind$1 || (MarkupKind$1 = {})); var MarkupContent$1; (function (MarkupContent) { function is(value) { var candidate = value; return Is$1.objectLiteral(value) && MarkupKind$1.is(candidate.kind) && Is$1.string(candidate.value); } MarkupContent.is = is; })(MarkupContent$1 || (MarkupContent$1 = {})); var CompletionItemKind$1; (function (CompletionItemKind) { CompletionItemKind.Text = 1; CompletionItemKind.Method = 2; CompletionItemKind.Function = 3; CompletionItemKind.Constructor = 4; CompletionItemKind.Field = 5; CompletionItemKind.Variable = 6; CompletionItemKind.Class = 7; CompletionItemKind.Interface = 8; CompletionItemKind.Module = 9; CompletionItemKind.Property = 10; CompletionItemKind.Unit = 11; CompletionItemKind.Value = 12; CompletionItemKind.Enum = 13; CompletionItemKind.Keyword = 14; CompletionItemKind.Snippet = 15; CompletionItemKind.Color = 16; CompletionItemKind.File = 17; CompletionItemKind.Reference = 18; CompletionItemKind.Folder = 19; CompletionItemKind.EnumMember = 20; CompletionItemKind.Constant = 21; CompletionItemKind.Struct = 22; CompletionItemKind.Event = 23; CompletionItemKind.Operator = 24; CompletionItemKind.TypeParameter = 25; })(CompletionItemKind$1 || (CompletionItemKind$1 = {})); var InsertTextFormat$1; (function (InsertTextFormat) { InsertTextFormat.PlainText = 1; InsertTextFormat.Snippet = 2; })(InsertTextFormat$1 || (InsertTextFormat$1 = {})); var CompletionItemTag$1; (function (CompletionItemTag) { CompletionItemTag.Deprecated = 1; })(CompletionItemTag$1 || (CompletionItemTag$1 = {})); var InsertReplaceEdit$1; (function (InsertReplaceEdit) { function create(newText, insert, replace) { return { newText: newText, insert: insert, replace: replace }; } InsertReplaceEdit.create = create; function is(value) { var candidate = value; return candidate && Is$1.string(candidate.newText) && Range$1.is(candidate.insert) && Range$1.is(candidate.replace); } InsertReplaceEdit.is = is; })(InsertReplaceEdit$1 || (InsertReplaceEdit$1 = {})); var InsertTextMode$1; (function (InsertTextMode) { InsertTextMode.asIs = 1; InsertTextMode.adjustIndentation = 2; })(InsertTextMode$1 || (InsertTextMode$1 = {})); var CompletionItemLabelDetails; (function (CompletionItemLabelDetails) { function is(value) { var candidate = value; return candidate && (Is$1.string(candidate.parameters) || candidate.parameters === undefined) && (Is$1.string(candidate.qualifier) || candidate.qualifier === undefined) && (Is$1.string(candidate.type) || candidate.type === undefined); } CompletionItemLabelDetails.is = is; })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {})); var CompletionItem$1; (function (CompletionItem) { function create(label) { return { label: label }; } CompletionItem.create = create; })(CompletionItem$1 || (CompletionItem$1 = {})); var CompletionList$1; (function (CompletionList) { function create(items, isIncomplete) { return { items: items ? items : [], isIncomplete: !!isIncomplete }; } CompletionList.create = create; })(CompletionList$1 || (CompletionList$1 = {})); var MarkedString$1; (function (MarkedString) { function fromPlainText(plainText) { return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); } MarkedString.fromPlainText = fromPlainText; function is(value) { var candidate = value; return Is$1.string(candidate) || (Is$1.objectLiteral(candidate) && Is$1.string(candidate.language) && Is$1.string(candidate.value)); } MarkedString.is = is; })(MarkedString$1 || (MarkedString$1 = {})); var Hover$1; (function (Hover) { function is(value) { var candidate = value; return !!candidate && Is$1.objectLiteral(candidate) && (MarkupContent$1.is(candidate.contents) || MarkedString$1.is(candidate.contents) || Is$1.typedArray(candidate.contents, MarkedString$1.is)) && (value.range === undefined || Range$1.is(value.range)); } Hover.is = is; })(Hover$1 || (Hover$1 = {})); var ParameterInformation$1; (function (ParameterInformation) { function create(label, documentation) { return documentation ? { label: label, documentation: documentation } : { label: label }; } ParameterInformation.create = create; })(ParameterInformation$1 || (ParameterInformation$1 = {})); var SignatureInformation$1; (function (SignatureInformation) { function create(label, documentation) { var parameters = []; for (var _i = 2; _i < arguments.length; _i++) { parameters[_i - 2] = arguments[_i]; } var result = { label: label }; if (Is$1.defined(documentation)) { result.documentation = documentation; } if (Is$1.defined(parameters)) { result.parameters = parameters; } else { result.parameters = []; } return result; } SignatureInformation.create = create; })(SignatureInformation$1 || (SignatureInformation$1 = {})); var DocumentHighlightKind$1; (function (DocumentHighlightKind) { DocumentHighlightKind.Text = 1; DocumentHighlightKind.Read = 2; DocumentHighlightKind.Write = 3; })(DocumentHighlightKind$1 || (DocumentHighlightKind$1 = {})); var DocumentHighlight$1; (function (DocumentHighlight) { function create(range, kind) { var result = { range: range }; if (Is$1.number(kind)) { result.kind = kind; } return result; } DocumentHighlight.create = create; })(DocumentHighlight$1 || (DocumentHighlight$1 = {})); var SymbolKind$1; (function (SymbolKind) { SymbolKind.File = 1; SymbolKind.Module = 2; SymbolKind.Namespace = 3; SymbolKind.Package = 4; SymbolKind.Class = 5; SymbolKind.Method = 6; SymbolKind.Property = 7; SymbolKind.Field = 8; SymbolKind.Constructor = 9; SymbolKind.Enum = 10; SymbolKind.Interface = 11; SymbolKind.Function = 12; SymbolKind.Variable = 13; SymbolKind.Constant = 14; SymbolKind.String = 15; SymbolKind.Number = 16; SymbolKind.Boolean = 17; SymbolKind.Array = 18; SymbolKind.Object = 19; SymbolKind.Key = 20; SymbolKind.Null = 21; SymbolKind.EnumMember = 22; SymbolKind.Struct = 23; SymbolKind.Event = 24; SymbolKind.Operator = 25; SymbolKind.TypeParameter = 26; })(SymbolKind$1 || (SymbolKind$1 = {})); var SymbolTag$1; (function (SymbolTag) { SymbolTag.Deprecated = 1; })(SymbolTag$1 || (SymbolTag$1 = {})); var SymbolInformation$1; (function (SymbolInformation) { function create(name, kind, range, uri, containerName) { var result = { name: name, kind: kind, location: { uri: uri, range: range } }; if (containerName) { result.containerName = containerName; } return result; } SymbolInformation.create = create; })(SymbolInformation$1 || (SymbolInformation$1 = {})); var DocumentSymbol$1; (function (DocumentSymbol) { function create(name, detail, kind, range, selectionRange, children) { var result = { name: name, detail: detail, kind: kind, range: range, selectionRange: selectionRange }; if (children !== undefined) { result.children = children; } return result; } DocumentSymbol.create = create; function is(value) { var candidate = value; return candidate && Is$1.string(candidate.name) && Is$1.number(candidate.kind) && Range$1.is(candidate.range) && Range$1.is(candidate.selectionRange) && (candidate.detail === undefined || Is$1.string(candidate.detail)) && (candidate.deprecated === undefined || Is$1.boolean(candidate.deprecated)) && (candidate.children === undefined || Array.isArray(candidate.children)) && (candidate.tags === undefined || Array.isArray(candidate.tags)); } DocumentSymbol.is = is; })(DocumentSymbol$1 || (DocumentSymbol$1 = {})); var CodeActionKind$1; (function (CodeActionKind) { CodeActionKind.Empty = ''; CodeActionKind.QuickFix = 'quickfix'; CodeActionKind.Refactor = 'refactor'; CodeActionKind.RefactorExtract = 'refactor.extract'; CodeActionKind.RefactorInline = 'refactor.inline'; CodeActionKind.RefactorRewrite = 'refactor.rewrite'; CodeActionKind.Source = 'source'; CodeActionKind.SourceOrganizeImports = 'source.organizeImports'; CodeActionKind.SourceFixAll = 'source.fixAll'; })(CodeActionKind$1 || (CodeActionKind$1 = {})); var CodeActionContext$1; (function (CodeActionContext) { function create(diagnostics, only) { var result = { diagnostics: diagnostics }; if (only !== undefined && only !== null) { result.only = only; } return result; } CodeActionContext.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Is$1.typedArray(candidate.diagnostics, Diagnostic$1.is) && (candidate.only === undefined || Is$1.typedArray(candidate.only, Is$1.string)); } CodeActionContext.is = is; })(CodeActionContext$1 || (CodeActionContext$1 = {})); var CodeAction$1; (function (CodeAction) { function create(title, kindOrCommandOrEdit, kind) { var result = { title: title }; var checkKind = true; if (typeof kindOrCommandOrEdit === 'string') { checkKind = false; result.kind = kindOrCommandOrEdit; } else if (Command$1.is(kindOrCommandOrEdit)) { result.command = kindOrCommandOrEdit; } else { result.edit = kindOrCommandOrEdit; } if (checkKind && kind !== undefined) { result.kind = kind; } return result; } CodeAction.create = create; function is(value) { var candidate = value; return candidate && Is$1.string(candidate.title) && (candidate.diagnostics === undefined || Is$1.typedArray(candidate.diagnostics, Diagnostic$1.is)) && (candidate.kind === undefined || Is$1.string(candidate.kind)) && (candidate.edit !== undefined || candidate.command !== undefined) && (candidate.command === undefined || Command$1.is(candidate.command)) && (candidate.isPreferred === undefined || Is$1.boolean(candidate.isPreferred)) && (candidate.edit === undefined || WorkspaceEdit$1.is(candidate.edit)); } CodeAction.is = is; })(CodeAction$1 || (CodeAction$1 = {})); var CodeLens$1; (function (CodeLens) { function create(range, data) { var result = { range: range }; if (Is$1.defined(data)) { result.data = data; } return result; } CodeLens.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Range$1.is(candidate.range) && (Is$1.undefined(candidate.command) || Command$1.is(candidate.command)); } CodeLens.is = is; })(CodeLens$1 || (CodeLens$1 = {})); var FormattingOptions$1; (function (FormattingOptions) { function create(tabSize, insertSpaces) { return { tabSize: tabSize, insertSpaces: insertSpaces }; } FormattingOptions.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Is$1.uinteger(candidate.tabSize) && Is$1.boolean(candidate.insertSpaces); } FormattingOptions.is = is; })(FormattingOptions$1 || (FormattingOptions$1 = {})); var DocumentLink$1; (function (DocumentLink) { function create(range, target, data) { return { range: range, target: target, data: data }; } DocumentLink.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Range$1.is(candidate.range) && (Is$1.undefined(candidate.target) || Is$1.string(candidate.target)); } DocumentLink.is = is; })(DocumentLink$1 || (DocumentLink$1 = {})); var SelectionRange$1; (function (SelectionRange) { function create(range, parent) { return { range: range, parent: parent }; } SelectionRange.create = create; function is(value) { var candidate = value; return candidate !== undefined && Range$1.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent)); } SelectionRange.is = is; })(SelectionRange$1 || (SelectionRange$1 = {})); var SemanticTokenTypes; (function (SemanticTokenTypes) { SemanticTokenTypes["namespace"] = "namespace"; SemanticTokenTypes["type"] = "type"; SemanticTokenTypes["class"] = "class"; SemanticTokenTypes["enum"] = "enum"; SemanticTokenTypes["interface"] = "interface"; SemanticTokenTypes["struct"] = "struct"; SemanticTokenTypes["typeParameter"] = "typeParameter"; SemanticTokenTypes["parameter"] = "parameter"; SemanticTokenTypes["variable"] = "variable"; SemanticTokenTypes["property"] = "property"; SemanticTokenTypes["enumMember"] = "enumMember"; SemanticTokenTypes["event"] = "event"; SemanticTokenTypes["function"] = "function"; SemanticTokenTypes["method"] = "method"; SemanticTokenTypes["macro"] = "macro"; SemanticTokenTypes["keyword"] = "keyword"; SemanticTokenTypes["modifier"] = "modifier"; SemanticTokenTypes["comment"] = "comment"; SemanticTokenTypes["string"] = "string"; SemanticTokenTypes["number"] = "number"; SemanticTokenTypes["regexp"] = "regexp"; SemanticTokenTypes["operator"] = "operator"; })(SemanticTokenTypes || (SemanticTokenTypes = {})); var SemanticTokenModifiers; (function (SemanticTokenModifiers) { SemanticTokenModifiers["declaration"] = "declaration"; SemanticTokenModifiers["definition"] = "definition"; SemanticTokenModifiers["readonly"] = "readonly"; SemanticTokenModifiers["static"] = "static"; SemanticTokenModifiers["deprecated"] = "deprecated"; SemanticTokenModifiers["abstract"] = "abstract"; SemanticTokenModifiers["async"] = "async"; SemanticTokenModifiers["modification"] = "modification"; SemanticTokenModifiers["documentation"] = "documentation"; SemanticTokenModifiers["defaultLibrary"] = "defaultLibrary"; })(SemanticTokenModifiers || (SemanticTokenModifiers = {})); var SemanticTokens; (function (SemanticTokens) { function is(value) { var candidate = value; return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number'); } SemanticTokens.is = is; })(SemanticTokens || (SemanticTokens = {})); var EOL$1 = ['\n', '\r\n', '\r']; var TextDocument$2; (function (TextDocument) { function create(uri, languageId, version, content) { return new FullTextDocument$2(uri, languageId, version, content); } TextDocument.create = create; function is(value) { var candidate = value; return Is$1.defined(candidate) && Is$1.string(candidate.uri) && (Is$1.undefined(candidate.languageId) || Is$1.string(candidate.languageId)) && Is$1.uinteger(candidate.lineCount) && Is$1.func(candidate.getText) && Is$1.func(candidate.positionAt) && Is$1.func(candidate.offsetAt) ? true : false; } TextDocument.is = is; function applyEdits(document, edits) { var text = document.getText(); var sortedEdits = mergeSort(edits, function (a, b) { var diff = a.range.start.line - b.range.start.line; if (diff === 0) { return a.range.start.character - b.range.start.character; } return diff; }); var lastModifiedOffset = text.length; for (var i = sortedEdits.length - 1; i >= 0; i--) { var e = sortedEdits[i]; var startOffset = document.offsetAt(e.range.start); var endOffset = document.offsetAt(e.range.end); if (endOffset <= lastModifiedOffset) { text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length); } else { throw new Error('Overlapping edit'); } lastModifiedOffset = startOffset; } return text; } TextDocument.applyEdits = applyEdits; function mergeSort(data, compare) { if (data.length <= 1) { return data; } var p = (data.length / 2) | 0; var left = data.slice(0, p); var right = data.slice(p); mergeSort(left, compare); mergeSort(right, compare); var leftIdx = 0; var rightIdx = 0; var i = 0; while (leftIdx < left.length && rightIdx < right.length) { var ret = compare(left[leftIdx], right[rightIdx]); if (ret <= 0) { data[i++] = left[leftIdx++]; } else { data[i++] = right[rightIdx++]; } } while (leftIdx < left.length) { data[i++] = left[leftIdx++]; } while (rightIdx < right.length) { data[i++] = right[rightIdx++]; } return data; } })(TextDocument$2 || (TextDocument$2 = {})); var FullTextDocument$2 = (function () { function FullTextDocument(uri, languageId, version, content) { this._uri = uri; this._languageId = languageId; this._version = version; this._content = content; this._lineOffsets = undefined; } Object.defineProperty(FullTextDocument.prototype, "uri", { get: function () { return this._uri; }, enumerable: false, configurable: true }); Object.defineProperty(FullTextDocument.prototype, "languageId", { get: function () { return this._languageId; }, enumerable: false, configurable: true }); Object.defineProperty(FullTextDocument.prototype, "version", { get: function () { return this._version; }, enumerable: false, configurable: true }); FullTextDocument.prototype.getText = function (range) { if (range) { var start = this.offsetAt(range.start); var end = this.offsetAt(range.end); return this._content.substring(start, end); } return this._content; }; FullTextDocument.prototype.update = function (event, version) { this._content = event.text; this._version = version; this._lineOffsets = undefined; }; FullTextDocument.prototype.getLineOffsets = function () { if (this._lineOffsets === undefined) { var lineOffsets = []; var text = this._content; var isLineStart = true; for (var i = 0; i < text.length; i++) { if (isLineStart) { lineOffsets.push(i); isLineStart = false; } var ch = text.charAt(i); isLineStart = (ch === '\r' || ch === '\n'); if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') { i++; } } if (isLineStart && text.length > 0) { lineOffsets.push(text.length); } this._lineOffsets = lineOffsets; } return this._lineOffsets; }; FullTextDocument.prototype.positionAt = function (offset) { offset = Math.max(Math.min(offset, this._content.length), 0); var lineOffsets = this.getLineOffsets(); var low = 0, high = lineOffsets.length; if (high === 0) { return Position$1.create(0, offset); } while (low < high) { var mid = Math.floor((low + high) / 2); if (lineOffsets[mid] > offset) { high = mid; } else { low = mid + 1; } } var line = low - 1; return Position$1.create(line, offset - lineOffsets[line]); }; FullTextDocument.prototype.offsetAt = function (position) { var lineOffsets = this.getLineOffsets(); if (position.line >= lineOffsets.length) { return this._content.length; } else if (position.line < 0) { return 0; } var lineOffset = lineOffsets[position.line]; var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length; return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); }; Object.defineProperty(FullTextDocument.prototype, "lineCount", { get: function () { return this.getLineOffsets().length; }, enumerable: false, configurable: true }); return FullTextDocument; }()); var Is$1; (function (Is) { var toString = Object.prototype.toString; function defined(value) { return typeof value !== 'undefined'; } Is.defined = defined; function undefined$1(value) { return typeof value === 'undefined'; } Is.undefined = undefined$1; function boolean(value) { return value === true || value === false; } Is.boolean = boolean; function string(value) { return toString.call(value) === '[object String]'; } Is.string = string; function number(value) { return toString.call(value) === '[object Number]'; } Is.number = number; function numberRange(value, min, max) { return toString.call(value) === '[object Number]' && min <= value && value <= max; } Is.numberRange = numberRange; function integer(value) { return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647; } Is.integer = integer; function uinteger(value) { return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647; } Is.uinteger = uinteger; function func(value) { return toString.call(value) === '[object Function]'; } Is.func = func; function objectLiteral(value) { return value !== null && typeof value === 'object'; } Is.objectLiteral = objectLiteral; function typedArray(value, check) { return Array.isArray(value) && value.every(check); } Is.typedArray = typedArray; })(Is$1 || (Is$1 = {})); var main$6 = /*#__PURE__*/Object.freeze({ __proto__: null, get integer () { return integer$1; }, get uinteger () { return uinteger$1; }, get Position () { return Position$1; }, get Range () { return Range$1; }, get Location () { return Location$1; }, get LocationLink () { return LocationLink$1; }, get Color () { return Color$1; }, get ColorInformation () { return ColorInformation$1; }, get ColorPresentation () { return ColorPresentation$1; }, get FoldingRangeKind () { return FoldingRangeKind$1; }, get FoldingRange () { return FoldingRange$1; }, get DiagnosticRelatedInformation () { return DiagnosticRelatedInformation$1; }, get DiagnosticSeverity () { return DiagnosticSeverity$1; }, get DiagnosticTag () { return DiagnosticTag$1; }, get CodeDescription () { return CodeDescription$1; }, get Diagnostic () { return Diagnostic$1; }, get Command () { return Command$1; }, get TextEdit () { return TextEdit$1; }, get ChangeAnnotation () { return ChangeAnnotation$1; }, get ChangeAnnotationIdentifier () { return ChangeAnnotationIdentifier$1; }, get AnnotatedTextEdit () { return AnnotatedTextEdit$1; }, get TextDocumentEdit () { return TextDocumentEdit$1; }, get CreateFile () { return CreateFile$1; }, get RenameFile () { return RenameFile$1; }, get DeleteFile () { return DeleteFile$1; }, get WorkspaceEdit () { return WorkspaceEdit$1; }, WorkspaceChange: WorkspaceChange$1, get TextDocumentIdentifier () { return TextDocumentIdentifier$1; }, get VersionedTextDocumentIdentifier () { return VersionedTextDocumentIdentifier$1; }, get OptionalVersionedTextDocumentIdentifier () { return OptionalVersionedTextDocumentIdentifier$1; }, get TextDocumentItem () { return TextDocumentItem$1; }, get MarkupKind () { return MarkupKind$1; }, get MarkupContent () { return MarkupContent$1; }, get CompletionItemKind () { return CompletionItemKind$1; }, get InsertTextFormat () { return InsertTextFormat$1; }, get CompletionItemTag () { return CompletionItemTag$1; }, get InsertReplaceEdit () { return InsertReplaceEdit$1; }, get InsertTextMode () { return InsertTextMode$1; }, get CompletionItemLabelDetails () { return CompletionItemLabelDetails; }, get CompletionItem () { return CompletionItem$1; }, get CompletionList () { return CompletionList$1; }, get MarkedString () { return MarkedString$1; }, get Hover () { return Hover$1; }, get ParameterInformation () { return ParameterInformation$1; }, get SignatureInformation () { return SignatureInformation$1; }, get DocumentHighlightKind () { return DocumentHighlightKind$1; }, get DocumentHighlight () { return DocumentHighlight$1; }, get SymbolKind () { return SymbolKind$1; }, get SymbolTag () { return SymbolTag$1; }, get SymbolInformation () { return SymbolInformation$1; }, get DocumentSymbol () { return DocumentSymbol$1; }, get CodeActionKind () { return CodeActionKind$1; }, get CodeActionContext () { return CodeActionContext$1; }, get CodeAction () { return CodeAction$1; }, get CodeLens () { return CodeLens$1; }, get FormattingOptions () { return FormattingOptions$1; }, get DocumentLink () { return DocumentLink$1; }, get SelectionRange () { return SelectionRange$1; }, get SemanticTokenTypes () { return SemanticTokenTypes; }, get SemanticTokenModifiers () { return SemanticTokenModifiers; }, get SemanticTokens () { return SemanticTokens; }, EOL: EOL$1, get TextDocument () { return TextDocument$2; } }); var messages$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ProtocolNotificationType = exports.ProtocolNotificationType0 = exports.ProtocolRequestType = exports.ProtocolRequestType0 = exports.RegistrationType = void 0; class RegistrationType { constructor(method) { this.method = method; } } exports.RegistrationType = RegistrationType; class ProtocolRequestType0 extends main$7.RequestType0 { constructor(method) { super(method); } } exports.ProtocolRequestType0 = ProtocolRequestType0; class ProtocolRequestType extends main$7.RequestType { constructor(method) { super(method, main$7.ParameterStructures.byName); } } exports.ProtocolRequestType = ProtocolRequestType; class ProtocolNotificationType0 extends main$7.NotificationType0 { constructor(method) { super(method); } } exports.ProtocolNotificationType0 = ProtocolNotificationType0; class ProtocolNotificationType extends main$7.NotificationType { constructor(method) { super(method, main$7.ParameterStructures.byName); } } exports.ProtocolNotificationType = ProtocolNotificationType; }); getDefaultExportFromCjs(messages$2); var is$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; function boolean(value) { return value === true || value === false; } exports.boolean = boolean; function string(value) { return typeof value === 'string' || value instanceof String; } exports.string = string; function number(value) { return typeof value === 'number' || value instanceof Number; } exports.number = number; function error(value) { return value instanceof Error; } exports.error = error; function func(value) { return typeof value === 'function'; } exports.func = func; function array(value) { return Array.isArray(value); } exports.array = array; function stringArray(value) { return array(value) && value.every(elem => string(elem)); } exports.stringArray = stringArray; function typedArray(value, check) { return Array.isArray(value) && value.every(check); } exports.typedArray = typedArray; function objectLiteral(value) { return value !== null && typeof value === 'object'; } exports.objectLiteral = objectLiteral; }); getDefaultExportFromCjs(is$2); var protocol_implementation$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ImplementationRequest = void 0; (function (ImplementationRequest) { ImplementationRequest.method = 'textDocument/implementation'; ImplementationRequest.type = new messages$2.ProtocolRequestType(ImplementationRequest.method); })(exports.ImplementationRequest || (exports.ImplementationRequest = {})); }); getDefaultExportFromCjs(protocol_implementation$1); var protocol_typeDefinition$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.TypeDefinitionRequest = void 0; (function (TypeDefinitionRequest) { TypeDefinitionRequest.method = 'textDocument/typeDefinition'; TypeDefinitionRequest.type = new messages$2.ProtocolRequestType(TypeDefinitionRequest.method); })(exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {})); }); getDefaultExportFromCjs(protocol_typeDefinition$1); var protocol_workspaceFolders$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = void 0; (function (WorkspaceFoldersRequest) { WorkspaceFoldersRequest.type = new messages$2.ProtocolRequestType0('workspace/workspaceFolders'); })(exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {})); (function (DidChangeWorkspaceFoldersNotification) { DidChangeWorkspaceFoldersNotification.type = new messages$2.ProtocolNotificationType('workspace/didChangeWorkspaceFolders'); })(exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {})); }); getDefaultExportFromCjs(protocol_workspaceFolders$1); var protocol_configuration$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigurationRequest = void 0; (function (ConfigurationRequest) { ConfigurationRequest.type = new messages$2.ProtocolRequestType('workspace/configuration'); })(exports.ConfigurationRequest || (exports.ConfigurationRequest = {})); }); getDefaultExportFromCjs(protocol_configuration$1); var protocol_colorProvider$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ColorPresentationRequest = exports.DocumentColorRequest = void 0; (function (DocumentColorRequest) { DocumentColorRequest.method = 'textDocument/documentColor'; DocumentColorRequest.type = new messages$2.ProtocolRequestType(DocumentColorRequest.method); })(exports.DocumentColorRequest || (exports.DocumentColorRequest = {})); (function (ColorPresentationRequest) { ColorPresentationRequest.type = new messages$2.ProtocolRequestType('textDocument/colorPresentation'); })(exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {})); }); getDefaultExportFromCjs(protocol_colorProvider$1); var protocol_foldingRange$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.FoldingRangeRequest = exports.FoldingRangeKind = void 0; (function (FoldingRangeKind) { FoldingRangeKind["Comment"] = "comment"; FoldingRangeKind["Imports"] = "imports"; FoldingRangeKind["Region"] = "region"; })(exports.FoldingRangeKind || (exports.FoldingRangeKind = {})); (function (FoldingRangeRequest) { FoldingRangeRequest.method = 'textDocument/foldingRange'; FoldingRangeRequest.type = new messages$2.ProtocolRequestType(FoldingRangeRequest.method); })(exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {})); }); getDefaultExportFromCjs(protocol_foldingRange$1); var protocol_declaration$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DeclarationRequest = void 0; (function (DeclarationRequest) { DeclarationRequest.method = 'textDocument/declaration'; DeclarationRequest.type = new messages$2.ProtocolRequestType(DeclarationRequest.method); })(exports.DeclarationRequest || (exports.DeclarationRequest = {})); }); getDefaultExportFromCjs(protocol_declaration$1); var protocol_selectionRange$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.SelectionRangeRequest = void 0; (function (SelectionRangeRequest) { SelectionRangeRequest.method = 'textDocument/selectionRange'; SelectionRangeRequest.type = new messages$2.ProtocolRequestType(SelectionRangeRequest.method); })(exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {})); }); getDefaultExportFromCjs(protocol_selectionRange$1); var protocol_progress$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = void 0; (function (WorkDoneProgress) { WorkDoneProgress.type = new main$7.ProgressType(); function is(value) { return value === WorkDoneProgress.type; } WorkDoneProgress.is = is; })(exports.WorkDoneProgress || (exports.WorkDoneProgress = {})); (function (WorkDoneProgressCreateRequest) { WorkDoneProgressCreateRequest.type = new messages$2.ProtocolRequestType('window/workDoneProgress/create'); })(exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {})); (function (WorkDoneProgressCancelNotification) { WorkDoneProgressCancelNotification.type = new messages$2.ProtocolNotificationType('window/workDoneProgress/cancel'); })(exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {})); }); getDefaultExportFromCjs(protocol_progress$1); var protocol_callHierarchy$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.CallHierarchyPrepareRequest = void 0; (function (CallHierarchyPrepareRequest) { CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy'; CallHierarchyPrepareRequest.type = new messages$2.ProtocolRequestType(CallHierarchyPrepareRequest.method); })(exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {})); (function (CallHierarchyIncomingCallsRequest) { CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls'; CallHierarchyIncomingCallsRequest.type = new messages$2.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method); })(exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {})); (function (CallHierarchyOutgoingCallsRequest) { CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls'; CallHierarchyOutgoingCallsRequest.type = new messages$2.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method); })(exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {})); }); getDefaultExportFromCjs(protocol_callHierarchy$1); var protocol_semanticTokens$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.SemanticTokensRegistrationType = exports.TokenFormat = void 0; (function (TokenFormat) { TokenFormat.Relative = 'relative'; })(exports.TokenFormat || (exports.TokenFormat = {})); (function (SemanticTokensRegistrationType) { SemanticTokensRegistrationType.method = 'textDocument/semanticTokens'; SemanticTokensRegistrationType.type = new messages$2.RegistrationType(SemanticTokensRegistrationType.method); })(exports.SemanticTokensRegistrationType || (exports.SemanticTokensRegistrationType = {})); (function (SemanticTokensRequest) { SemanticTokensRequest.method = 'textDocument/semanticTokens/full'; SemanticTokensRequest.type = new messages$2.ProtocolRequestType(SemanticTokensRequest.method); })(exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {})); (function (SemanticTokensDeltaRequest) { SemanticTokensDeltaRequest.method = 'textDocument/semanticTokens/full/delta'; SemanticTokensDeltaRequest.type = new messages$2.ProtocolRequestType(SemanticTokensDeltaRequest.method); })(exports.SemanticTokensDeltaRequest || (exports.SemanticTokensDeltaRequest = {})); (function (SemanticTokensRangeRequest) { SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range'; SemanticTokensRangeRequest.type = new messages$2.ProtocolRequestType(SemanticTokensRangeRequest.method); })(exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {})); (function (SemanticTokensRefreshRequest) { SemanticTokensRefreshRequest.method = `workspace/semanticTokens/refresh`; SemanticTokensRefreshRequest.type = new messages$2.ProtocolRequestType0(SemanticTokensRefreshRequest.method); })(exports.SemanticTokensRefreshRequest || (exports.SemanticTokensRefreshRequest = {})); }); getDefaultExportFromCjs(protocol_semanticTokens$1); var protocol_showDocument$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ShowDocumentRequest = void 0; (function (ShowDocumentRequest) { ShowDocumentRequest.method = 'window/showDocument'; ShowDocumentRequest.type = new messages$2.ProtocolRequestType(ShowDocumentRequest.method); })(exports.ShowDocumentRequest || (exports.ShowDocumentRequest = {})); }); getDefaultExportFromCjs(protocol_showDocument$1); var protocol_linkedEditingRange$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.LinkedEditingRangeRequest = void 0; (function (LinkedEditingRangeRequest) { LinkedEditingRangeRequest.method = 'textDocument/linkedEditingRange'; LinkedEditingRangeRequest.type = new messages$2.ProtocolRequestType(LinkedEditingRangeRequest.method); })(exports.LinkedEditingRangeRequest || (exports.LinkedEditingRangeRequest = {})); }); getDefaultExportFromCjs(protocol_linkedEditingRange$1); var protocol_fileOperations$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.DidRenameFilesNotification = exports.WillRenameFilesRequest = exports.DidCreateFilesNotification = exports.WillCreateFilesRequest = exports.FileOperationPatternKind = void 0; (function (FileOperationPatternKind) { FileOperationPatternKind.file = 'file'; FileOperationPatternKind.folder = 'folder'; })(exports.FileOperationPatternKind || (exports.FileOperationPatternKind = {})); (function (WillCreateFilesRequest) { WillCreateFilesRequest.method = 'workspace/willCreateFiles'; WillCreateFilesRequest.type = new messages$2.ProtocolRequestType(WillCreateFilesRequest.method); })(exports.WillCreateFilesRequest || (exports.WillCreateFilesRequest = {})); (function (DidCreateFilesNotification) { DidCreateFilesNotification.method = 'workspace/didCreateFiles'; DidCreateFilesNotification.type = new messages$2.ProtocolNotificationType(DidCreateFilesNotification.method); })(exports.DidCreateFilesNotification || (exports.DidCreateFilesNotification = {})); (function (WillRenameFilesRequest) { WillRenameFilesRequest.method = 'workspace/willRenameFiles'; WillRenameFilesRequest.type = new messages$2.ProtocolRequestType(WillRenameFilesRequest.method); })(exports.WillRenameFilesRequest || (exports.WillRenameFilesRequest = {})); (function (DidRenameFilesNotification) { DidRenameFilesNotification.method = 'workspace/didRenameFiles'; DidRenameFilesNotification.type = new messages$2.ProtocolNotificationType(DidRenameFilesNotification.method); })(exports.DidRenameFilesNotification || (exports.DidRenameFilesNotification = {})); (function (DidDeleteFilesNotification) { DidDeleteFilesNotification.method = 'workspace/didDeleteFiles'; DidDeleteFilesNotification.type = new messages$2.ProtocolNotificationType(DidDeleteFilesNotification.method); })(exports.DidDeleteFilesNotification || (exports.DidDeleteFilesNotification = {})); (function (WillDeleteFilesRequest) { WillDeleteFilesRequest.method = 'workspace/willDeleteFiles'; WillDeleteFilesRequest.type = new messages$2.ProtocolRequestType(WillDeleteFilesRequest.method); })(exports.WillDeleteFilesRequest || (exports.WillDeleteFilesRequest = {})); }); getDefaultExportFromCjs(protocol_fileOperations$1); var protocol_moniker$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = void 0; (function (UniquenessLevel) { UniquenessLevel["document"] = "document"; UniquenessLevel["project"] = "project"; UniquenessLevel["group"] = "group"; UniquenessLevel["scheme"] = "scheme"; UniquenessLevel["global"] = "global"; })(exports.UniquenessLevel || (exports.UniquenessLevel = {})); (function (MonikerKind) { MonikerKind["import"] = "import"; MonikerKind["export"] = "export"; MonikerKind["local"] = "local"; })(exports.MonikerKind || (exports.MonikerKind = {})); (function (MonikerRequest) { MonikerRequest.method = 'textDocument/moniker'; MonikerRequest.type = new messages$2.ProtocolRequestType(MonikerRequest.method); })(exports.MonikerRequest || (exports.MonikerRequest = {})); }); getDefaultExportFromCjs(protocol_moniker$1); var protocol$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DocumentLinkRequest = exports.CodeLensRefreshRequest = exports.CodeLensResolveRequest = exports.CodeLensRequest = exports.WorkspaceSymbolRequest = exports.CodeActionResolveRequest = exports.CodeActionRequest = exports.DocumentSymbolRequest = exports.DocumentHighlightRequest = exports.ReferencesRequest = exports.DefinitionRequest = exports.SignatureHelpRequest = exports.SignatureHelpTriggerKind = exports.HoverRequest = exports.CompletionResolveRequest = exports.CompletionRequest = exports.CompletionTriggerKind = exports.PublishDiagnosticsNotification = exports.WatchKind = exports.FileChangeType = exports.DidChangeWatchedFilesNotification = exports.WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentNotification = exports.TextDocumentSaveReason = exports.DidSaveTextDocumentNotification = exports.DidCloseTextDocumentNotification = exports.DidChangeTextDocumentNotification = exports.TextDocumentContentChangeEvent = exports.DidOpenTextDocumentNotification = exports.TextDocumentSyncKind = exports.TelemetryEventNotification = exports.LogMessageNotification = exports.ShowMessageRequest = exports.ShowMessageNotification = exports.MessageType = exports.DidChangeConfigurationNotification = exports.ExitNotification = exports.ShutdownRequest = exports.InitializedNotification = exports.InitializeError = exports.InitializeRequest = exports.WorkDoneProgressOptions = exports.TextDocumentRegistrationOptions = exports.StaticRegistrationOptions = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.UnregistrationRequest = exports.RegistrationRequest = exports.DocumentSelector = exports.DocumentFilter = void 0; exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.WillRenameFilesRequest = exports.DidRenameFilesNotification = exports.WillCreateFilesRequest = exports.DidCreateFilesNotification = exports.FileOperationPatternKind = exports.LinkedEditingRangeRequest = exports.ShowDocumentRequest = exports.SemanticTokensRegistrationType = exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.TokenFormat = exports.CallHierarchyPrepareRequest = exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = exports.SelectionRangeRequest = exports.DeclarationRequest = exports.FoldingRangeRequest = exports.ColorPresentationRequest = exports.DocumentColorRequest = exports.ConfigurationRequest = exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = exports.TypeDefinitionRequest = exports.ImplementationRequest = exports.ApplyWorkspaceEditRequest = exports.ExecuteCommandRequest = exports.PrepareRenameRequest = exports.RenameRequest = exports.PrepareSupportDefaultBehavior = exports.DocumentOnTypeFormattingRequest = exports.DocumentRangeFormattingRequest = exports.DocumentFormattingRequest = exports.DocumentLinkResolveRequest = void 0; Object.defineProperty(exports, "ImplementationRequest", { enumerable: true, get: function () { return protocol_implementation$1.ImplementationRequest; } }); Object.defineProperty(exports, "TypeDefinitionRequest", { enumerable: true, get: function () { return protocol_typeDefinition$1.TypeDefinitionRequest; } }); Object.defineProperty(exports, "WorkspaceFoldersRequest", { enumerable: true, get: function () { return protocol_workspaceFolders$1.WorkspaceFoldersRequest; } }); Object.defineProperty(exports, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: function () { return protocol_workspaceFolders$1.DidChangeWorkspaceFoldersNotification; } }); Object.defineProperty(exports, "ConfigurationRequest", { enumerable: true, get: function () { return protocol_configuration$1.ConfigurationRequest; } }); Object.defineProperty(exports, "DocumentColorRequest", { enumerable: true, get: function () { return protocol_colorProvider$1.DocumentColorRequest; } }); Object.defineProperty(exports, "ColorPresentationRequest", { enumerable: true, get: function () { return protocol_colorProvider$1.ColorPresentationRequest; } }); Object.defineProperty(exports, "FoldingRangeRequest", { enumerable: true, get: function () { return protocol_foldingRange$1.FoldingRangeRequest; } }); Object.defineProperty(exports, "DeclarationRequest", { enumerable: true, get: function () { return protocol_declaration$1.DeclarationRequest; } }); Object.defineProperty(exports, "SelectionRangeRequest", { enumerable: true, get: function () { return protocol_selectionRange$1.SelectionRangeRequest; } }); Object.defineProperty(exports, "WorkDoneProgress", { enumerable: true, get: function () { return protocol_progress$1.WorkDoneProgress; } }); Object.defineProperty(exports, "WorkDoneProgressCreateRequest", { enumerable: true, get: function () { return protocol_progress$1.WorkDoneProgressCreateRequest; } }); Object.defineProperty(exports, "WorkDoneProgressCancelNotification", { enumerable: true, get: function () { return protocol_progress$1.WorkDoneProgressCancelNotification; } }); Object.defineProperty(exports, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: function () { return protocol_callHierarchy$1.CallHierarchyIncomingCallsRequest; } }); Object.defineProperty(exports, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: function () { return protocol_callHierarchy$1.CallHierarchyOutgoingCallsRequest; } }); Object.defineProperty(exports, "CallHierarchyPrepareRequest", { enumerable: true, get: function () { return protocol_callHierarchy$1.CallHierarchyPrepareRequest; } }); Object.defineProperty(exports, "TokenFormat", { enumerable: true, get: function () { return protocol_semanticTokens$1.TokenFormat; } }); Object.defineProperty(exports, "SemanticTokensRequest", { enumerable: true, get: function () { return protocol_semanticTokens$1.SemanticTokensRequest; } }); Object.defineProperty(exports, "SemanticTokensDeltaRequest", { enumerable: true, get: function () { return protocol_semanticTokens$1.SemanticTokensDeltaRequest; } }); Object.defineProperty(exports, "SemanticTokensRangeRequest", { enumerable: true, get: function () { return protocol_semanticTokens$1.SemanticTokensRangeRequest; } }); Object.defineProperty(exports, "SemanticTokensRefreshRequest", { enumerable: true, get: function () { return protocol_semanticTokens$1.SemanticTokensRefreshRequest; } }); Object.defineProperty(exports, "SemanticTokensRegistrationType", { enumerable: true, get: function () { return protocol_semanticTokens$1.SemanticTokensRegistrationType; } }); Object.defineProperty(exports, "ShowDocumentRequest", { enumerable: true, get: function () { return protocol_showDocument$1.ShowDocumentRequest; } }); Object.defineProperty(exports, "LinkedEditingRangeRequest", { enumerable: true, get: function () { return protocol_linkedEditingRange$1.LinkedEditingRangeRequest; } }); Object.defineProperty(exports, "FileOperationPatternKind", { enumerable: true, get: function () { return protocol_fileOperations$1.FileOperationPatternKind; } }); Object.defineProperty(exports, "DidCreateFilesNotification", { enumerable: true, get: function () { return protocol_fileOperations$1.DidCreateFilesNotification; } }); Object.defineProperty(exports, "WillCreateFilesRequest", { enumerable: true, get: function () { return protocol_fileOperations$1.WillCreateFilesRequest; } }); Object.defineProperty(exports, "DidRenameFilesNotification", { enumerable: true, get: function () { return protocol_fileOperations$1.DidRenameFilesNotification; } }); Object.defineProperty(exports, "WillRenameFilesRequest", { enumerable: true, get: function () { return protocol_fileOperations$1.WillRenameFilesRequest; } }); Object.defineProperty(exports, "DidDeleteFilesNotification", { enumerable: true, get: function () { return protocol_fileOperations$1.DidDeleteFilesNotification; } }); Object.defineProperty(exports, "WillDeleteFilesRequest", { enumerable: true, get: function () { return protocol_fileOperations$1.WillDeleteFilesRequest; } }); Object.defineProperty(exports, "UniquenessLevel", { enumerable: true, get: function () { return protocol_moniker$1.UniquenessLevel; } }); Object.defineProperty(exports, "MonikerKind", { enumerable: true, get: function () { return protocol_moniker$1.MonikerKind; } }); Object.defineProperty(exports, "MonikerRequest", { enumerable: true, get: function () { return protocol_moniker$1.MonikerRequest; } }); var DocumentFilter; (function (DocumentFilter) { function is(value) { const candidate = value; return is$2.string(candidate.language) || is$2.string(candidate.scheme) || is$2.string(candidate.pattern); } DocumentFilter.is = is; })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {})); var DocumentSelector; (function (DocumentSelector) { function is(value) { if (!Array.isArray(value)) { return false; } for (let elem of value) { if (!is$2.string(elem) && !DocumentFilter.is(elem)) { return false; } } return true; } DocumentSelector.is = is; })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {})); (function (RegistrationRequest) { RegistrationRequest.type = new messages$2.ProtocolRequestType('client/registerCapability'); })(exports.RegistrationRequest || (exports.RegistrationRequest = {})); (function (UnregistrationRequest) { UnregistrationRequest.type = new messages$2.ProtocolRequestType('client/unregisterCapability'); })(exports.UnregistrationRequest || (exports.UnregistrationRequest = {})); (function (ResourceOperationKind) { ResourceOperationKind.Create = 'create'; ResourceOperationKind.Rename = 'rename'; ResourceOperationKind.Delete = 'delete'; })(exports.ResourceOperationKind || (exports.ResourceOperationKind = {})); (function (FailureHandlingKind) { FailureHandlingKind.Abort = 'abort'; FailureHandlingKind.Transactional = 'transactional'; FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional'; FailureHandlingKind.Undo = 'undo'; })(exports.FailureHandlingKind || (exports.FailureHandlingKind = {})); (function (StaticRegistrationOptions) { function hasId(value) { const candidate = value; return candidate && is$2.string(candidate.id) && candidate.id.length > 0; } StaticRegistrationOptions.hasId = hasId; })(exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {})); (function (TextDocumentRegistrationOptions) { function is(value) { const candidate = value; return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector)); } TextDocumentRegistrationOptions.is = is; })(exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {})); (function (WorkDoneProgressOptions) { function is(value) { const candidate = value; return is$2.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || is$2.boolean(candidate.workDoneProgress)); } WorkDoneProgressOptions.is = is; function hasWorkDoneProgress(value) { const candidate = value; return candidate && is$2.boolean(candidate.workDoneProgress); } WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress; })(exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {})); (function (InitializeRequest) { InitializeRequest.type = new messages$2.ProtocolRequestType('initialize'); })(exports.InitializeRequest || (exports.InitializeRequest = {})); (function (InitializeError) { InitializeError.unknownProtocolVersion = 1; })(exports.InitializeError || (exports.InitializeError = {})); (function (InitializedNotification) { InitializedNotification.type = new messages$2.ProtocolNotificationType('initialized'); })(exports.InitializedNotification || (exports.InitializedNotification = {})); (function (ShutdownRequest) { ShutdownRequest.type = new messages$2.ProtocolRequestType0('shutdown'); })(exports.ShutdownRequest || (exports.ShutdownRequest = {})); (function (ExitNotification) { ExitNotification.type = new messages$2.ProtocolNotificationType0('exit'); })(exports.ExitNotification || (exports.ExitNotification = {})); (function (DidChangeConfigurationNotification) { DidChangeConfigurationNotification.type = new messages$2.ProtocolNotificationType('workspace/didChangeConfiguration'); })(exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {})); (function (MessageType) { MessageType.Error = 1; MessageType.Warning = 2; MessageType.Info = 3; MessageType.Log = 4; })(exports.MessageType || (exports.MessageType = {})); (function (ShowMessageNotification) { ShowMessageNotification.type = new messages$2.ProtocolNotificationType('window/showMessage'); })(exports.ShowMessageNotification || (exports.ShowMessageNotification = {})); (function (ShowMessageRequest) { ShowMessageRequest.type = new messages$2.ProtocolRequestType('window/showMessageRequest'); })(exports.ShowMessageRequest || (exports.ShowMessageRequest = {})); (function (LogMessageNotification) { LogMessageNotification.type = new messages$2.ProtocolNotificationType('window/logMessage'); })(exports.LogMessageNotification || (exports.LogMessageNotification = {})); (function (TelemetryEventNotification) { TelemetryEventNotification.type = new messages$2.ProtocolNotificationType('telemetry/event'); })(exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {})); (function (TextDocumentSyncKind) { TextDocumentSyncKind.None = 0; TextDocumentSyncKind.Full = 1; TextDocumentSyncKind.Incremental = 2; })(exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {})); (function (DidOpenTextDocumentNotification) { DidOpenTextDocumentNotification.method = 'textDocument/didOpen'; DidOpenTextDocumentNotification.type = new messages$2.ProtocolNotificationType(DidOpenTextDocumentNotification.method); })(exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {})); (function (TextDocumentContentChangeEvent) { function isIncremental(event) { let candidate = event; return candidate !== undefined && candidate !== null && typeof candidate.text === 'string' && candidate.range !== undefined && (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number'); } TextDocumentContentChangeEvent.isIncremental = isIncremental; function isFull(event) { let candidate = event; return candidate !== undefined && candidate !== null && typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined; } TextDocumentContentChangeEvent.isFull = isFull; })(exports.TextDocumentContentChangeEvent || (exports.TextDocumentContentChangeEvent = {})); (function (DidChangeTextDocumentNotification) { DidChangeTextDocumentNotification.method = 'textDocument/didChange'; DidChangeTextDocumentNotification.type = new messages$2.ProtocolNotificationType(DidChangeTextDocumentNotification.method); })(exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {})); (function (DidCloseTextDocumentNotification) { DidCloseTextDocumentNotification.method = 'textDocument/didClose'; DidCloseTextDocumentNotification.type = new messages$2.ProtocolNotificationType(DidCloseTextDocumentNotification.method); })(exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {})); (function (DidSaveTextDocumentNotification) { DidSaveTextDocumentNotification.method = 'textDocument/didSave'; DidSaveTextDocumentNotification.type = new messages$2.ProtocolNotificationType(DidSaveTextDocumentNotification.method); })(exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {})); (function (TextDocumentSaveReason) { TextDocumentSaveReason.Manual = 1; TextDocumentSaveReason.AfterDelay = 2; TextDocumentSaveReason.FocusOut = 3; })(exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {})); (function (WillSaveTextDocumentNotification) { WillSaveTextDocumentNotification.method = 'textDocument/willSave'; WillSaveTextDocumentNotification.type = new messages$2.ProtocolNotificationType(WillSaveTextDocumentNotification.method); })(exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {})); (function (WillSaveTextDocumentWaitUntilRequest) { WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil'; WillSaveTextDocumentWaitUntilRequest.type = new messages$2.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method); })(exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {})); (function (DidChangeWatchedFilesNotification) { DidChangeWatchedFilesNotification.type = new messages$2.ProtocolNotificationType('workspace/didChangeWatchedFiles'); })(exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {})); (function (FileChangeType) { FileChangeType.Created = 1; FileChangeType.Changed = 2; FileChangeType.Deleted = 3; })(exports.FileChangeType || (exports.FileChangeType = {})); (function (WatchKind) { WatchKind.Create = 1; WatchKind.Change = 2; WatchKind.Delete = 4; })(exports.WatchKind || (exports.WatchKind = {})); (function (PublishDiagnosticsNotification) { PublishDiagnosticsNotification.type = new messages$2.ProtocolNotificationType('textDocument/publishDiagnostics'); })(exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {})); (function (CompletionTriggerKind) { CompletionTriggerKind.Invoked = 1; CompletionTriggerKind.TriggerCharacter = 2; CompletionTriggerKind.TriggerForIncompleteCompletions = 3; })(exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {})); (function (CompletionRequest) { CompletionRequest.method = 'textDocument/completion'; CompletionRequest.type = new messages$2.ProtocolRequestType(CompletionRequest.method); })(exports.CompletionRequest || (exports.CompletionRequest = {})); (function (CompletionResolveRequest) { CompletionResolveRequest.method = 'completionItem/resolve'; CompletionResolveRequest.type = new messages$2.ProtocolRequestType(CompletionResolveRequest.method); })(exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {})); (function (HoverRequest) { HoverRequest.method = 'textDocument/hover'; HoverRequest.type = new messages$2.ProtocolRequestType(HoverRequest.method); })(exports.HoverRequest || (exports.HoverRequest = {})); (function (SignatureHelpTriggerKind) { SignatureHelpTriggerKind.Invoked = 1; SignatureHelpTriggerKind.TriggerCharacter = 2; SignatureHelpTriggerKind.ContentChange = 3; })(exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {})); (function (SignatureHelpRequest) { SignatureHelpRequest.method = 'textDocument/signatureHelp'; SignatureHelpRequest.type = new messages$2.ProtocolRequestType(SignatureHelpRequest.method); })(exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {})); (function (DefinitionRequest) { DefinitionRequest.method = 'textDocument/definition'; DefinitionRequest.type = new messages$2.ProtocolRequestType(DefinitionRequest.method); })(exports.DefinitionRequest || (exports.DefinitionRequest = {})); (function (ReferencesRequest) { ReferencesRequest.method = 'textDocument/references'; ReferencesRequest.type = new messages$2.ProtocolRequestType(ReferencesRequest.method); })(exports.ReferencesRequest || (exports.ReferencesRequest = {})); (function (DocumentHighlightRequest) { DocumentHighlightRequest.method = 'textDocument/documentHighlight'; DocumentHighlightRequest.type = new messages$2.ProtocolRequestType(DocumentHighlightRequest.method); })(exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {})); (function (DocumentSymbolRequest) { DocumentSymbolRequest.method = 'textDocument/documentSymbol'; DocumentSymbolRequest.type = new messages$2.ProtocolRequestType(DocumentSymbolRequest.method); })(exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {})); (function (CodeActionRequest) { CodeActionRequest.method = 'textDocument/codeAction'; CodeActionRequest.type = new messages$2.ProtocolRequestType(CodeActionRequest.method); })(exports.CodeActionRequest || (exports.CodeActionRequest = {})); (function (CodeActionResolveRequest) { CodeActionResolveRequest.method = 'codeAction/resolve'; CodeActionResolveRequest.type = new messages$2.ProtocolRequestType(CodeActionResolveRequest.method); })(exports.CodeActionResolveRequest || (exports.CodeActionResolveRequest = {})); (function (WorkspaceSymbolRequest) { WorkspaceSymbolRequest.method = 'workspace/symbol'; WorkspaceSymbolRequest.type = new messages$2.ProtocolRequestType(WorkspaceSymbolRequest.method); })(exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {})); (function (CodeLensRequest) { CodeLensRequest.method = 'textDocument/codeLens'; CodeLensRequest.type = new messages$2.ProtocolRequestType(CodeLensRequest.method); })(exports.CodeLensRequest || (exports.CodeLensRequest = {})); (function (CodeLensResolveRequest) { CodeLensResolveRequest.method = 'codeLens/resolve'; CodeLensResolveRequest.type = new messages$2.ProtocolRequestType(CodeLensResolveRequest.method); })(exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {})); (function (CodeLensRefreshRequest) { CodeLensRefreshRequest.method = `workspace/codeLens/refresh`; CodeLensRefreshRequest.type = new messages$2.ProtocolRequestType0(CodeLensRefreshRequest.method); })(exports.CodeLensRefreshRequest || (exports.CodeLensRefreshRequest = {})); (function (DocumentLinkRequest) { DocumentLinkRequest.method = 'textDocument/documentLink'; DocumentLinkRequest.type = new messages$2.ProtocolRequestType(DocumentLinkRequest.method); })(exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {})); (function (DocumentLinkResolveRequest) { DocumentLinkResolveRequest.method = 'documentLink/resolve'; DocumentLinkResolveRequest.type = new messages$2.ProtocolRequestType(DocumentLinkResolveRequest.method); })(exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {})); (function (DocumentFormattingRequest) { DocumentFormattingRequest.method = 'textDocument/formatting'; DocumentFormattingRequest.type = new messages$2.ProtocolRequestType(DocumentFormattingRequest.method); })(exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {})); (function (DocumentRangeFormattingRequest) { DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting'; DocumentRangeFormattingRequest.type = new messages$2.ProtocolRequestType(DocumentRangeFormattingRequest.method); })(exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {})); (function (DocumentOnTypeFormattingRequest) { DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting'; DocumentOnTypeFormattingRequest.type = new messages$2.ProtocolRequestType(DocumentOnTypeFormattingRequest.method); })(exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {})); (function (PrepareSupportDefaultBehavior) { PrepareSupportDefaultBehavior.Identifier = 1; })(exports.PrepareSupportDefaultBehavior || (exports.PrepareSupportDefaultBehavior = {})); (function (RenameRequest) { RenameRequest.method = 'textDocument/rename'; RenameRequest.type = new messages$2.ProtocolRequestType(RenameRequest.method); })(exports.RenameRequest || (exports.RenameRequest = {})); (function (PrepareRenameRequest) { PrepareRenameRequest.method = 'textDocument/prepareRename'; PrepareRenameRequest.type = new messages$2.ProtocolRequestType(PrepareRenameRequest.method); })(exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {})); (function (ExecuteCommandRequest) { ExecuteCommandRequest.type = new messages$2.ProtocolRequestType('workspace/executeCommand'); })(exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {})); (function (ApplyWorkspaceEditRequest) { ApplyWorkspaceEditRequest.type = new messages$2.ProtocolRequestType('workspace/applyEdit'); })(exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {})); }); getDefaultExportFromCjs(protocol$1); var connection$2 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createProtocolConnection = void 0; function createProtocolConnection(input, output, logger, options) { if (main$7.ConnectionStrategy.is(options)) { options = { connectionStrategy: options }; } return main$7.createMessageConnection(input, output, logger, options); } exports.createProtocolConnection = createProtocolConnection; }); getDefaultExportFromCjs(connection$2); var proposed_diagnostic$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DiagnosticRefreshRequest = exports.DiagnosticRequest = exports.DiagnosticServerCancellationData = exports.DiagnosticTriggerKind = exports.DiagnosticPullModeFlags = void 0; (function (DiagnosticPullModeFlags) { DiagnosticPullModeFlags.onOpen = 1; DiagnosticPullModeFlags.onType = 2; DiagnosticPullModeFlags.onSave = 4; DiagnosticPullModeFlags.all = DiagnosticPullModeFlags.onOpen | DiagnosticPullModeFlags.onType | DiagnosticPullModeFlags.onSave; function is(value) { return DiagnosticPullModeFlags.onType <= value && value <= DiagnosticPullModeFlags.all; } DiagnosticPullModeFlags.is = is; function isOpen(value) { return (value & DiagnosticPullModeFlags.onOpen) !== 0; } DiagnosticPullModeFlags.isOpen = isOpen; function isType(value) { return (value & DiagnosticPullModeFlags.onType) !== 0; } DiagnosticPullModeFlags.isType = isType; function isSave(value) { return (value & DiagnosticPullModeFlags.onSave) !== 0; } DiagnosticPullModeFlags.isSave = isSave; })(exports.DiagnosticPullModeFlags || (exports.DiagnosticPullModeFlags = {})); (function (DiagnosticTriggerKind) { DiagnosticTriggerKind.Invoked = 1; DiagnosticTriggerKind.Opened = 2; DiagnosticTriggerKind.Typed = 3; DiagnosticTriggerKind.Saved = 4; function is(value) { return DiagnosticTriggerKind.Invoked <= value && value <= DiagnosticTriggerKind.Saved; } DiagnosticTriggerKind.is = is; })(exports.DiagnosticTriggerKind || (exports.DiagnosticTriggerKind = {})); (function (DiagnosticServerCancellationData) { function is(value) { const candidate = value; return candidate && is$2.boolean(candidate.retriggerRequest); } DiagnosticServerCancellationData.is = is; })(exports.DiagnosticServerCancellationData || (exports.DiagnosticServerCancellationData = {})); (function (DiagnosticRequest) { DiagnosticRequest.method = 'textDocument/diagnostic'; DiagnosticRequest.type = new messages$2.ProtocolRequestType(DiagnosticRequest.method); })(exports.DiagnosticRequest || (exports.DiagnosticRequest = {})); (function (DiagnosticRefreshRequest) { DiagnosticRefreshRequest.method = `workspace/diagnostic/refresh`; DiagnosticRefreshRequest.type = new messages$2.ProtocolRequestType0(DiagnosticRefreshRequest.method); })(exports.DiagnosticRefreshRequest || (exports.DiagnosticRefreshRequest = {})); }); getDefaultExportFromCjs(proposed_diagnostic$1); var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(main$6); var api$3 = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Proposed = exports.LSPErrorCodes = exports.createProtocolConnection = void 0; __exportStar(main$7, exports); __exportStar(require$$1$1, exports); __exportStar(messages$2, exports); __exportStar(protocol$1, exports); Object.defineProperty(exports, "createProtocolConnection", { enumerable: true, get: function () { return connection$2.createProtocolConnection; } }); (function (LSPErrorCodes) { LSPErrorCodes.lspReservedErrorRangeStart = -32899; LSPErrorCodes.ServerCancelled = -32802; LSPErrorCodes.ContentModified = -32801; LSPErrorCodes.RequestCancelled = -32800; LSPErrorCodes.lspReservedErrorRangeEnd = -32800; })(exports.LSPErrorCodes || (exports.LSPErrorCodes = {})); (function (Proposed) { Proposed.DiagnosticPullModeFlags = proposed_diagnostic$1.DiagnosticPullModeFlags; Proposed.DiagnosticTriggerKind = proposed_diagnostic$1.DiagnosticTriggerKind; Proposed.DiagnosticServerCancellationData = proposed_diagnostic$1.DiagnosticServerCancellationData; Proposed.DiagnosticRequest = proposed_diagnostic$1.DiagnosticRequest; Proposed.DiagnosticRefreshRequest = proposed_diagnostic$1.DiagnosticRefreshRequest; })(exports.Proposed || (exports.Proposed = {})); }); getDefaultExportFromCjs(api$3); var main$5 = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createProtocolConnection = void 0; __exportStar(node$3, exports); __exportStar(api$3, exports); function createProtocolConnection(input, output, logger, options) { return node$3.createMessageConnection(input, output, logger, options); } exports.createProtocolConnection = createProtocolConnection; }); getDefaultExportFromCjs(main$5); var uuid = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.generateUuid = exports.parse = exports.isUUID = exports.v4 = exports.empty = void 0; class ValueUUID { constructor(_value) { this._value = _value; } asHex() { return this._value; } equals(other) { return this.asHex() === other.asHex(); } } class V4UUID extends ValueUUID { constructor() { super([ V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), '-', V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), '-', '4', V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), '-', V4UUID._oneOf(V4UUID._timeHighBits), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), '-', V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), V4UUID._randomHex(), ].join('')); } static _oneOf(array) { return array[Math.floor(array.length * Math.random())]; } static _randomHex() { return V4UUID._oneOf(V4UUID._chars); } } V4UUID._chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; V4UUID._timeHighBits = ['8', '9', 'a', 'b']; exports.empty = new ValueUUID('00000000-0000-0000-0000-000000000000'); function v4() { return new V4UUID(); } exports.v4 = v4; const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; function isUUID(value) { return _UUIDPattern.test(value); } exports.isUUID = isUUID; function parse(value) { if (!isUUID(value)) { throw new Error('invalid uuid'); } return new ValueUUID(value); } exports.parse = parse; function generateUuid() { return v4().asHex(); } exports.generateUuid = generateUuid; }); getDefaultExportFromCjs(uuid); var progress = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.attachPartialResult = exports.ProgressFeature = exports.attachWorkDone = void 0; class WorkDoneProgressReporterImpl { constructor(_connection, _token) { this._connection = _connection; this._token = _token; WorkDoneProgressReporterImpl.Instances.set(this._token, this); } begin(title, percentage, message, cancellable) { let param = { kind: 'begin', title, percentage, message, cancellable }; this._connection.sendProgress(main$5.WorkDoneProgress.type, this._token, param); } report(arg0, arg1) { let param = { kind: 'report' }; if (typeof arg0 === 'number') { param.percentage = arg0; if (arg1 !== undefined) { param.message = arg1; } } else { param.message = arg0; } this._connection.sendProgress(main$5.WorkDoneProgress.type, this._token, param); } done() { WorkDoneProgressReporterImpl.Instances.delete(this._token); this._connection.sendProgress(main$5.WorkDoneProgress.type, this._token, { kind: 'end' }); } } WorkDoneProgressReporterImpl.Instances = new Map(); class WorkDoneProgressServerReporterImpl extends WorkDoneProgressReporterImpl { constructor(connection, token) { super(connection, token); this._source = new main$5.CancellationTokenSource(); } get token() { return this._source.token; } done() { this._source.dispose(); super.done(); } cancel() { this._source.cancel(); } } class NullProgressReporter { constructor() { } begin() { } report() { } done() { } } class NullProgressServerReporter extends NullProgressReporter { constructor() { super(); this._source = new main$5.CancellationTokenSource(); } get token() { return this._source.token; } done() { this._source.dispose(); } cancel() { this._source.cancel(); } } function attachWorkDone(connection, params) { if (params === undefined || params.workDoneToken === undefined) { return new NullProgressReporter(); } const token = params.workDoneToken; delete params.workDoneToken; return new WorkDoneProgressReporterImpl(connection, token); } exports.attachWorkDone = attachWorkDone; const ProgressFeature = (Base) => { return class extends Base { constructor() { super(); this._progressSupported = false; } initialize(capabilities) { var _a; super.initialize(capabilities); if (((_a = capabilities === null || capabilities === void 0 ? void 0 : capabilities.window) === null || _a === void 0 ? void 0 : _a.workDoneProgress) === true) { this._progressSupported = true; this.connection.onNotification(main$5.WorkDoneProgressCancelNotification.type, (params) => { let progress = WorkDoneProgressReporterImpl.Instances.get(params.token); if (progress instanceof WorkDoneProgressServerReporterImpl || progress instanceof NullProgressServerReporter) { progress.cancel(); } }); } } attachWorkDoneProgress(token) { if (token === undefined) { return new NullProgressReporter(); } else { return new WorkDoneProgressReporterImpl(this.connection, token); } } createWorkDoneProgress() { if (this._progressSupported) { const token = uuid.generateUuid(); return this.connection.sendRequest(main$5.WorkDoneProgressCreateRequest.type, { token }).then(() => { const result = new WorkDoneProgressServerReporterImpl(this.connection, token); return result; }); } else { return Promise.resolve(new NullProgressServerReporter()); } } }; }; exports.ProgressFeature = ProgressFeature; var ResultProgress; (function (ResultProgress) { ResultProgress.type = new main$5.ProgressType(); })(ResultProgress || (ResultProgress = {})); class ResultProgressReporterImpl { constructor(_connection, _token) { this._connection = _connection; this._token = _token; } report(data) { this._connection.sendProgress(ResultProgress.type, this._token, data); } } function attachPartialResult(connection, params) { if (params === undefined || params.partialResultToken === undefined) { return undefined; } const token = params.partialResultToken; delete params.partialResultToken; return new ResultProgressReporterImpl(connection, token); } exports.attachPartialResult = attachPartialResult; }); getDefaultExportFromCjs(progress); var configuration = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigurationFeature = void 0; const ConfigurationFeature = (Base) => { return class extends Base { getConfiguration(arg) { if (!arg) { return this._getConfiguration({}); } else if (is$4.string(arg)) { return this._getConfiguration({ section: arg }); } else { return this._getConfiguration(arg); } } _getConfiguration(arg) { let params = { items: Array.isArray(arg) ? arg : [arg] }; return this.connection.sendRequest(main$5.ConfigurationRequest.type, params).then((result) => { return Array.isArray(arg) ? result : result[0]; }); } }; }; exports.ConfigurationFeature = ConfigurationFeature; }); getDefaultExportFromCjs(configuration); var workspaceFolders = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.WorkspaceFoldersFeature = void 0; const WorkspaceFoldersFeature = (Base) => { return class extends Base { constructor() { super(); this._notificationIsAutoRegistered = false; } initialize(capabilities) { super.initialize(capabilities); let workspaceCapabilities = capabilities.workspace; if (workspaceCapabilities && workspaceCapabilities.workspaceFolders) { this._onDidChangeWorkspaceFolders = new main$5.Emitter(); this.connection.onNotification(main$5.DidChangeWorkspaceFoldersNotification.type, (params) => { this._onDidChangeWorkspaceFolders.fire(params.event); }); } } fillServerCapabilities(capabilities) { var _a, _b; super.fillServerCapabilities(capabilities); const changeNotifications = (_b = (_a = capabilities.workspace) === null || _a === void 0 ? void 0 : _a.workspaceFolders) === null || _b === void 0 ? void 0 : _b.changeNotifications; this._notificationIsAutoRegistered = changeNotifications === true || typeof changeNotifications === 'string'; } getWorkspaceFolders() { return this.connection.sendRequest(main$5.WorkspaceFoldersRequest.type); } get onDidChangeWorkspaceFolders() { if (!this._onDidChangeWorkspaceFolders) { throw new Error('Client doesn\'t support sending workspace folder change events.'); } if (!this._notificationIsAutoRegistered && !this._unregistration) { this._unregistration = this.connection.client.register(main$5.DidChangeWorkspaceFoldersNotification.type); } return this._onDidChangeWorkspaceFolders.event; } }; }; exports.WorkspaceFoldersFeature = WorkspaceFoldersFeature; }); getDefaultExportFromCjs(workspaceFolders); var callHierarchy = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.CallHierarchyFeature = void 0; const CallHierarchyFeature = (Base) => { return class extends Base { get callHierarchy() { return { onPrepare: (handler) => { this.connection.onRequest(main$5.CallHierarchyPrepareRequest.type, (params, cancel) => { return handler(params, cancel, this.attachWorkDoneProgress(params), undefined); }); }, onIncomingCalls: (handler) => { const type = main$5.CallHierarchyIncomingCallsRequest.type; this.connection.onRequest(type, (params, cancel) => { return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); }); }, onOutgoingCalls: (handler) => { const type = main$5.CallHierarchyOutgoingCallsRequest.type; this.connection.onRequest(type, (params, cancel) => { return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); }); } }; } }; }; exports.CallHierarchyFeature = CallHierarchyFeature; }); getDefaultExportFromCjs(callHierarchy); var semanticTokens = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.SemanticTokensBuilder = exports.SemanticTokensFeature = void 0; const SemanticTokensFeature = (Base) => { return class extends Base { get semanticTokens() { return { refresh: () => { return this.connection.sendRequest(main$5.SemanticTokensRefreshRequest.type); }, on: (handler) => { const type = main$5.SemanticTokensRequest.type; this.connection.onRequest(type, (params, cancel) => { return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); }); }, onDelta: (handler) => { const type = main$5.SemanticTokensDeltaRequest.type; this.connection.onRequest(type, (params, cancel) => { return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); }); }, onRange: (handler) => { const type = main$5.SemanticTokensRangeRequest.type; this.connection.onRequest(type, (params, cancel) => { return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); }); } }; } }; }; exports.SemanticTokensFeature = SemanticTokensFeature; class SemanticTokensBuilder { constructor() { this._prevData = undefined; this.initialize(); } initialize() { this._id = Date.now(); this._prevLine = 0; this._prevChar = 0; this._data = []; this._dataLen = 0; } push(line, char, length, tokenType, tokenModifiers) { let pushLine = line; let pushChar = char; if (this._dataLen > 0) { pushLine -= this._prevLine; if (pushLine === 0) { pushChar -= this._prevChar; } } this._data[this._dataLen++] = pushLine; this._data[this._dataLen++] = pushChar; this._data[this._dataLen++] = length; this._data[this._dataLen++] = tokenType; this._data[this._dataLen++] = tokenModifiers; this._prevLine = line; this._prevChar = char; } get id() { return this._id.toString(); } previousResult(id) { if (this.id === id) { this._prevData = this._data; } this.initialize(); } build() { this._prevData = undefined; return { resultId: this.id, data: this._data }; } canBuildEdits() { return this._prevData !== undefined; } buildEdits() { if (this._prevData !== undefined) { const prevDataLength = this._prevData.length; const dataLength = this._data.length; let startIndex = 0; while (startIndex < dataLength && startIndex < prevDataLength && this._prevData[startIndex] === this._data[startIndex]) { startIndex++; } if (startIndex < dataLength && startIndex < prevDataLength) { let endIndex = 0; while (endIndex < dataLength && endIndex < prevDataLength && this._prevData[prevDataLength - 1 - endIndex] === this._data[dataLength - 1 - endIndex]) { endIndex++; } const newData = this._data.slice(startIndex, dataLength - endIndex); const result = { resultId: this.id, edits: [ { start: startIndex, deleteCount: prevDataLength - endIndex - startIndex, data: newData } ] }; return result; } else if (startIndex < dataLength) { return { resultId: this.id, edits: [ { start: startIndex, deleteCount: 0, data: this._data.slice(startIndex) } ] }; } else if (startIndex < prevDataLength) { return { resultId: this.id, edits: [ { start: startIndex, deleteCount: prevDataLength - startIndex } ] }; } else { return { resultId: this.id, edits: [] }; } } else { return this.build(); } } } exports.SemanticTokensBuilder = SemanticTokensBuilder; }); getDefaultExportFromCjs(semanticTokens); var showDocument = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ShowDocumentFeature = void 0; const ShowDocumentFeature = (Base) => { return class extends Base { showDocument(params) { return this.connection.sendRequest(main$5.ShowDocumentRequest.type, params); } }; }; exports.ShowDocumentFeature = ShowDocumentFeature; }); getDefaultExportFromCjs(showDocument); var fileOperations = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.FileOperationsFeature = void 0; const FileOperationsFeature = (Base) => { return class extends Base { onDidCreateFiles(handler) { this.connection.onNotification(main$5.DidCreateFilesNotification.type, (params) => { handler(params); }); } onDidRenameFiles(handler) { this.connection.onNotification(main$5.DidRenameFilesNotification.type, (params) => { handler(params); }); } onDidDeleteFiles(handler) { this.connection.onNotification(main$5.DidDeleteFilesNotification.type, (params) => { handler(params); }); } onWillCreateFiles(handler) { return this.connection.onRequest(main$5.WillCreateFilesRequest.type, (params, cancel) => { return handler(params, cancel); }); } onWillRenameFiles(handler) { return this.connection.onRequest(main$5.WillRenameFilesRequest.type, (params, cancel) => { return handler(params, cancel); }); } onWillDeleteFiles(handler) { return this.connection.onRequest(main$5.WillDeleteFilesRequest.type, (params, cancel) => { return handler(params, cancel); }); } }; }; exports.FileOperationsFeature = FileOperationsFeature; }); getDefaultExportFromCjs(fileOperations); var linkedEditingRange = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.LinkedEditingRangeFeature = void 0; const LinkedEditingRangeFeature = (Base) => { return class extends Base { onLinkedEditingRange(handler) { this.connection.onRequest(main$5.LinkedEditingRangeRequest.type, (params, cancel) => { return handler(params, cancel, this.attachWorkDoneProgress(params), undefined); }); } }; }; exports.LinkedEditingRangeFeature = LinkedEditingRangeFeature; }); getDefaultExportFromCjs(linkedEditingRange); var moniker = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.MonikerFeature = void 0; const MonikerFeature = (Base) => { return class extends Base { get moniker() { return { on: (handler) => { const type = main$5.MonikerRequest.type; this.connection.onRequest(type, (params, cancel) => { return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); }); }, }; } }; }; exports.MonikerFeature = MonikerFeature; }); getDefaultExportFromCjs(moniker); var server$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createConnection = exports.combineFeatures = exports.combineLanguagesFeatures = exports.combineWorkspaceFeatures = exports.combineWindowFeatures = exports.combineClientFeatures = exports.combineTracerFeatures = exports.combineTelemetryFeatures = exports.combineConsoleFeatures = exports._LanguagesImpl = exports.BulkUnregistration = exports.BulkRegistration = exports.ErrorMessageTracker = exports.TextDocuments = void 0; function null2Undefined(value) { if (value === null) { return undefined; } return value; } class TextDocuments { constructor(configuration) { this._documents = Object.create(null); this._configuration = configuration; this._onDidChangeContent = new main$5.Emitter(); this._onDidOpen = new main$5.Emitter(); this._onDidClose = new main$5.Emitter(); this._onDidSave = new main$5.Emitter(); this._onWillSave = new main$5.Emitter(); } get onDidChangeContent() { return this._onDidChangeContent.event; } get onDidOpen() { return this._onDidOpen.event; } get onWillSave() { return this._onWillSave.event; } onWillSaveWaitUntil(handler) { this._willSaveWaitUntil = handler; } get onDidSave() { return this._onDidSave.event; } get onDidClose() { return this._onDidClose.event; } get(uri) { return this._documents[uri]; } all() { return Object.keys(this._documents).map(key => this._documents[key]); } keys() { return Object.keys(this._documents); } listen(connection) { connection.__textDocumentSync = main$5.TextDocumentSyncKind.Full; connection.onDidOpenTextDocument((event) => { let td = event.textDocument; let document = this._configuration.create(td.uri, td.languageId, td.version, td.text); this._documents[td.uri] = document; let toFire = Object.freeze({ document }); this._onDidOpen.fire(toFire); this._onDidChangeContent.fire(toFire); }); connection.onDidChangeTextDocument((event) => { let td = event.textDocument; let changes = event.contentChanges; if (changes.length === 0) { return; } let document = this._documents[td.uri]; const { version } = td; if (version === null || version === undefined) { throw new Error(`Received document change event for ${td.uri} without valid version identifier`); } document = this._configuration.update(document, changes, version); this._documents[td.uri] = document; this._onDidChangeContent.fire(Object.freeze({ document })); }); connection.onDidCloseTextDocument((event) => { let document = this._documents[event.textDocument.uri]; if (document) { delete this._documents[event.textDocument.uri]; this._onDidClose.fire(Object.freeze({ document })); } }); connection.onWillSaveTextDocument((event) => { let document = this._documents[event.textDocument.uri]; if (document) { this._onWillSave.fire(Object.freeze({ document, reason: event.reason })); } }); connection.onWillSaveTextDocumentWaitUntil((event, token) => { let document = this._documents[event.textDocument.uri]; if (document && this._willSaveWaitUntil) { return this._willSaveWaitUntil(Object.freeze({ document, reason: event.reason }), token); } else { return []; } }); connection.onDidSaveTextDocument((event) => { let document = this._documents[event.textDocument.uri]; if (document) { this._onDidSave.fire(Object.freeze({ document })); } }); } } exports.TextDocuments = TextDocuments; class ErrorMessageTracker { constructor() { this._messages = Object.create(null); } add(message) { let count = this._messages[message]; if (!count) { count = 0; } count++; this._messages[message] = count; } sendErrors(connection) { Object.keys(this._messages).forEach(message => { connection.window.showErrorMessage(message); }); } } exports.ErrorMessageTracker = ErrorMessageTracker; class RemoteConsoleImpl { constructor() { } rawAttach(connection) { this._rawConnection = connection; } attach(connection) { this._connection = connection; } get connection() { if (!this._connection) { throw new Error('Remote is not attached to a connection yet.'); } return this._connection; } fillServerCapabilities(_capabilities) { } initialize(_capabilities) { } error(message) { this.send(main$5.MessageType.Error, message); } warn(message) { this.send(main$5.MessageType.Warning, message); } info(message) { this.send(main$5.MessageType.Info, message); } log(message) { this.send(main$5.MessageType.Log, message); } send(type, message) { if (this._rawConnection) { this._rawConnection.sendNotification(main$5.LogMessageNotification.type, { type, message }); } } } class _RemoteWindowImpl { constructor() { } attach(connection) { this._connection = connection; } get connection() { if (!this._connection) { throw new Error('Remote is not attached to a connection yet.'); } return this._connection; } initialize(_capabilities) { } fillServerCapabilities(_capabilities) { } showErrorMessage(message, ...actions) { let params = { type: main$5.MessageType.Error, message, actions }; return this.connection.sendRequest(main$5.ShowMessageRequest.type, params).then(null2Undefined); } showWarningMessage(message, ...actions) { let params = { type: main$5.MessageType.Warning, message, actions }; return this.connection.sendRequest(main$5.ShowMessageRequest.type, params).then(null2Undefined); } showInformationMessage(message, ...actions) { let params = { type: main$5.MessageType.Info, message, actions }; return this.connection.sendRequest(main$5.ShowMessageRequest.type, params).then(null2Undefined); } } const RemoteWindowImpl = showDocument.ShowDocumentFeature(progress.ProgressFeature(_RemoteWindowImpl)); (function (BulkRegistration) { function create() { return new BulkRegistrationImpl(); } BulkRegistration.create = create; })(exports.BulkRegistration || (exports.BulkRegistration = {})); class BulkRegistrationImpl { constructor() { this._registrations = []; this._registered = new Set(); } add(type, registerOptions) { const method = is$4.string(type) ? type : type.method; if (this._registered.has(method)) { throw new Error(`${method} is already added to this registration`); } const id = uuid.generateUuid(); this._registrations.push({ id: id, method: method, registerOptions: registerOptions || {} }); this._registered.add(method); } asRegistrationParams() { return { registrations: this._registrations }; } } (function (BulkUnregistration) { function create() { return new BulkUnregistrationImpl(undefined, []); } BulkUnregistration.create = create; })(exports.BulkUnregistration || (exports.BulkUnregistration = {})); class BulkUnregistrationImpl { constructor(_connection, unregistrations) { this._connection = _connection; this._unregistrations = new Map(); unregistrations.forEach(unregistration => { this._unregistrations.set(unregistration.method, unregistration); }); } get isAttached() { return !!this._connection; } attach(connection) { this._connection = connection; } add(unregistration) { this._unregistrations.set(unregistration.method, unregistration); } dispose() { let unregistrations = []; for (let unregistration of this._unregistrations.values()) { unregistrations.push(unregistration); } let params = { unregisterations: unregistrations }; this._connection.sendRequest(main$5.UnregistrationRequest.type, params).then(undefined, (_error) => { this._connection.console.info(`Bulk unregistration failed.`); }); } disposeSingle(arg) { const method = is$4.string(arg) ? arg : arg.method; const unregistration = this._unregistrations.get(method); if (!unregistration) { return false; } let params = { unregisterations: [unregistration] }; this._connection.sendRequest(main$5.UnregistrationRequest.type, params).then(() => { this._unregistrations.delete(method); }, (_error) => { this._connection.console.info(`Un-registering request handler for ${unregistration.id} failed.`); }); return true; } } class RemoteClientImpl { attach(connection) { this._connection = connection; } get connection() { if (!this._connection) { throw new Error('Remote is not attached to a connection yet.'); } return this._connection; } initialize(_capabilities) { } fillServerCapabilities(_capabilities) { } register(typeOrRegistrations, registerOptionsOrType, registerOptions) { if (typeOrRegistrations instanceof BulkRegistrationImpl) { return this.registerMany(typeOrRegistrations); } else if (typeOrRegistrations instanceof BulkUnregistrationImpl) { return this.registerSingle1(typeOrRegistrations, registerOptionsOrType, registerOptions); } else { return this.registerSingle2(typeOrRegistrations, registerOptionsOrType); } } registerSingle1(unregistration, type, registerOptions) { const method = is$4.string(type) ? type : type.method; const id = uuid.generateUuid(); let params = { registrations: [{ id, method, registerOptions: registerOptions || {} }] }; if (!unregistration.isAttached) { unregistration.attach(this.connection); } return this.connection.sendRequest(main$5.RegistrationRequest.type, params).then((_result) => { unregistration.add({ id: id, method: method }); return unregistration; }, (_error) => { this.connection.console.info(`Registering request handler for ${method} failed.`); return Promise.reject(_error); }); } registerSingle2(type, registerOptions) { const method = is$4.string(type) ? type : type.method; const id = uuid.generateUuid(); let params = { registrations: [{ id, method, registerOptions: registerOptions || {} }] }; return this.connection.sendRequest(main$5.RegistrationRequest.type, params).then((_result) => { return main$5.Disposable.create(() => { this.unregisterSingle(id, method); }); }, (_error) => { this.connection.console.info(`Registering request handler for ${method} failed.`); return Promise.reject(_error); }); } unregisterSingle(id, method) { let params = { unregisterations: [{ id, method }] }; return this.connection.sendRequest(main$5.UnregistrationRequest.type, params).then(undefined, (_error) => { this.connection.console.info(`Un-registering request handler for ${id} failed.`); }); } registerMany(registrations) { let params = registrations.asRegistrationParams(); return this.connection.sendRequest(main$5.RegistrationRequest.type, params).then(() => { return new BulkUnregistrationImpl(this._connection, params.registrations.map(registration => { return { id: registration.id, method: registration.method }; })); }, (_error) => { this.connection.console.info(`Bulk registration failed.`); return Promise.reject(_error); }); } } class _RemoteWorkspaceImpl { constructor() { } attach(connection) { this._connection = connection; } get connection() { if (!this._connection) { throw new Error('Remote is not attached to a connection yet.'); } return this._connection; } initialize(_capabilities) { } fillServerCapabilities(_capabilities) { } applyEdit(paramOrEdit) { function isApplyWorkspaceEditParams(value) { return value && !!value.edit; } let params = isApplyWorkspaceEditParams(paramOrEdit) ? paramOrEdit : { edit: paramOrEdit }; return this.connection.sendRequest(main$5.ApplyWorkspaceEditRequest.type, params); } } const RemoteWorkspaceImpl = fileOperations.FileOperationsFeature(workspaceFolders.WorkspaceFoldersFeature(configuration.ConfigurationFeature(_RemoteWorkspaceImpl))); class TracerImpl { constructor() { this._trace = main$5.Trace.Off; } attach(connection) { this._connection = connection; } get connection() { if (!this._connection) { throw new Error('Remote is not attached to a connection yet.'); } return this._connection; } initialize(_capabilities) { } fillServerCapabilities(_capabilities) { } set trace(value) { this._trace = value; } log(message, verbose) { if (this._trace === main$5.Trace.Off) { return; } this.connection.sendNotification(main$5.LogTraceNotification.type, { message: message, verbose: this._trace === main$5.Trace.Verbose ? verbose : undefined }); } } class TelemetryImpl { constructor() { } attach(connection) { this._connection = connection; } get connection() { if (!this._connection) { throw new Error('Remote is not attached to a connection yet.'); } return this._connection; } initialize(_capabilities) { } fillServerCapabilities(_capabilities) { } logEvent(data) { this.connection.sendNotification(main$5.TelemetryEventNotification.type, data); } } class _LanguagesImpl { constructor() { } attach(connection) { this._connection = connection; } get connection() { if (!this._connection) { throw new Error('Remote is not attached to a connection yet.'); } return this._connection; } initialize(_capabilities) { } fillServerCapabilities(_capabilities) { } attachWorkDoneProgress(params) { return progress.attachWorkDone(this.connection, params); } attachPartialResultProgress(_type, params) { return progress.attachPartialResult(this.connection, params); } } exports._LanguagesImpl = _LanguagesImpl; const LanguagesImpl = moniker.MonikerFeature(linkedEditingRange.LinkedEditingRangeFeature(semanticTokens.SemanticTokensFeature(callHierarchy.CallHierarchyFeature(_LanguagesImpl)))); function combineConsoleFeatures(one, two) { return function (Base) { return two(one(Base)); }; } exports.combineConsoleFeatures = combineConsoleFeatures; function combineTelemetryFeatures(one, two) { return function (Base) { return two(one(Base)); }; } exports.combineTelemetryFeatures = combineTelemetryFeatures; function combineTracerFeatures(one, two) { return function (Base) { return two(one(Base)); }; } exports.combineTracerFeatures = combineTracerFeatures; function combineClientFeatures(one, two) { return function (Base) { return two(one(Base)); }; } exports.combineClientFeatures = combineClientFeatures; function combineWindowFeatures(one, two) { return function (Base) { return two(one(Base)); }; } exports.combineWindowFeatures = combineWindowFeatures; function combineWorkspaceFeatures(one, two) { return function (Base) { return two(one(Base)); }; } exports.combineWorkspaceFeatures = combineWorkspaceFeatures; function combineLanguagesFeatures(one, two) { return function (Base) { return two(one(Base)); }; } exports.combineLanguagesFeatures = combineLanguagesFeatures; function combineFeatures(one, two) { function combine(one, two, func) { if (one && two) { return func(one, two); } else if (one) { return one; } else { return two; } } let result = { __brand: 'features', console: combine(one.console, two.console, combineConsoleFeatures), tracer: combine(one.tracer, two.tracer, combineTracerFeatures), telemetry: combine(one.telemetry, two.telemetry, combineTelemetryFeatures), client: combine(one.client, two.client, combineClientFeatures), window: combine(one.window, two.window, combineWindowFeatures), workspace: combine(one.workspace, two.workspace, combineWorkspaceFeatures) }; return result; } exports.combineFeatures = combineFeatures; function createConnection(connectionFactory, watchDog, factories) { const logger = (factories && factories.console ? new (factories.console(RemoteConsoleImpl))() : new RemoteConsoleImpl()); const connection = connectionFactory(logger); logger.rawAttach(connection); const tracer = (factories && factories.tracer ? new (factories.tracer(TracerImpl))() : new TracerImpl()); const telemetry = (factories && factories.telemetry ? new (factories.telemetry(TelemetryImpl))() : new TelemetryImpl()); const client = (factories && factories.client ? new (factories.client(RemoteClientImpl))() : new RemoteClientImpl()); const remoteWindow = (factories && factories.window ? new (factories.window(RemoteWindowImpl))() : new RemoteWindowImpl()); const workspace = (factories && factories.workspace ? new (factories.workspace(RemoteWorkspaceImpl))() : new RemoteWorkspaceImpl()); const languages = (factories && factories.languages ? new (factories.languages(LanguagesImpl))() : new LanguagesImpl()); const allRemotes = [logger, tracer, telemetry, client, remoteWindow, workspace, languages]; function asPromise(value) { if (value instanceof Promise) { return value; } else if (is$4.thenable(value)) { return new Promise((resolve, reject) => { value.then((resolved) => resolve(resolved), (error) => reject(error)); }); } else { return Promise.resolve(value); } } let shutdownHandler = undefined; let initializeHandler = undefined; let exitHandler = undefined; let protocolConnection = { listen: () => connection.listen(), sendRequest: (type, ...params) => connection.sendRequest(is$4.string(type) ? type : type.method, ...params), onRequest: (type, handler) => connection.onRequest(type, handler), sendNotification: (type, param) => { const method = is$4.string(type) ? type : type.method; if (arguments.length === 1) { connection.sendNotification(method); } else { connection.sendNotification(method, param); } }, onNotification: (type, handler) => connection.onNotification(type, handler), onProgress: connection.onProgress, sendProgress: connection.sendProgress, onInitialize: (handler) => initializeHandler = handler, onInitialized: (handler) => connection.onNotification(main$5.InitializedNotification.type, handler), onShutdown: (handler) => shutdownHandler = handler, onExit: (handler) => exitHandler = handler, get console() { return logger; }, get telemetry() { return telemetry; }, get tracer() { return tracer; }, get client() { return client; }, get window() { return remoteWindow; }, get workspace() { return workspace; }, get languages() { return languages; }, onDidChangeConfiguration: (handler) => connection.onNotification(main$5.DidChangeConfigurationNotification.type, handler), onDidChangeWatchedFiles: (handler) => connection.onNotification(main$5.DidChangeWatchedFilesNotification.type, handler), __textDocumentSync: undefined, onDidOpenTextDocument: (handler) => connection.onNotification(main$5.DidOpenTextDocumentNotification.type, handler), onDidChangeTextDocument: (handler) => connection.onNotification(main$5.DidChangeTextDocumentNotification.type, handler), onDidCloseTextDocument: (handler) => connection.onNotification(main$5.DidCloseTextDocumentNotification.type, handler), onWillSaveTextDocument: (handler) => connection.onNotification(main$5.WillSaveTextDocumentNotification.type, handler), onWillSaveTextDocumentWaitUntil: (handler) => connection.onRequest(main$5.WillSaveTextDocumentWaitUntilRequest.type, handler), onDidSaveTextDocument: (handler) => connection.onNotification(main$5.DidSaveTextDocumentNotification.type, handler), sendDiagnostics: (params) => connection.sendNotification(main$5.PublishDiagnosticsNotification.type, params), onHover: (handler) => connection.onRequest(main$5.HoverRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), undefined); }), onCompletion: (handler) => connection.onRequest(main$5.CompletionRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onCompletionResolve: (handler) => connection.onRequest(main$5.CompletionResolveRequest.type, handler), onSignatureHelp: (handler) => connection.onRequest(main$5.SignatureHelpRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), undefined); }), onDeclaration: (handler) => connection.onRequest(main$5.DeclarationRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onDefinition: (handler) => connection.onRequest(main$5.DefinitionRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onTypeDefinition: (handler) => connection.onRequest(main$5.TypeDefinitionRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onImplementation: (handler) => connection.onRequest(main$5.ImplementationRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onReferences: (handler) => connection.onRequest(main$5.ReferencesRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onDocumentHighlight: (handler) => connection.onRequest(main$5.DocumentHighlightRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onDocumentSymbol: (handler) => connection.onRequest(main$5.DocumentSymbolRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onWorkspaceSymbol: (handler) => connection.onRequest(main$5.WorkspaceSymbolRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onCodeAction: (handler) => connection.onRequest(main$5.CodeActionRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onCodeActionResolve: (handler) => connection.onRequest(main$5.CodeActionResolveRequest.type, (params, cancel) => { return handler(params, cancel); }), onCodeLens: (handler) => connection.onRequest(main$5.CodeLensRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onCodeLensResolve: (handler) => connection.onRequest(main$5.CodeLensResolveRequest.type, (params, cancel) => { return handler(params, cancel); }), onDocumentFormatting: (handler) => connection.onRequest(main$5.DocumentFormattingRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), undefined); }), onDocumentRangeFormatting: (handler) => connection.onRequest(main$5.DocumentRangeFormattingRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), undefined); }), onDocumentOnTypeFormatting: (handler) => connection.onRequest(main$5.DocumentOnTypeFormattingRequest.type, (params, cancel) => { return handler(params, cancel); }), onRenameRequest: (handler) => connection.onRequest(main$5.RenameRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), undefined); }), onPrepareRename: (handler) => connection.onRequest(main$5.PrepareRenameRequest.type, (params, cancel) => { return handler(params, cancel); }), onDocumentLinks: (handler) => connection.onRequest(main$5.DocumentLinkRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onDocumentLinkResolve: (handler) => connection.onRequest(main$5.DocumentLinkResolveRequest.type, (params, cancel) => { return handler(params, cancel); }), onDocumentColor: (handler) => connection.onRequest(main$5.DocumentColorRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onColorPresentation: (handler) => connection.onRequest(main$5.ColorPresentationRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onFoldingRanges: (handler) => connection.onRequest(main$5.FoldingRangeRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onSelectionRanges: (handler) => connection.onRequest(main$5.SelectionRangeRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), progress.attachPartialResult(connection, params)); }), onExecuteCommand: (handler) => connection.onRequest(main$5.ExecuteCommandRequest.type, (params, cancel) => { return handler(params, cancel, progress.attachWorkDone(connection, params), undefined); }), dispose: () => connection.dispose() }; for (let remote of allRemotes) { remote.attach(protocolConnection); } connection.onRequest(main$5.InitializeRequest.type, (params) => { watchDog.initialize(params); if (is$4.string(params.trace)) { tracer.trace = main$5.Trace.fromString(params.trace); } for (let remote of allRemotes) { remote.initialize(params.capabilities); } if (initializeHandler) { let result = initializeHandler(params, new main$5.CancellationTokenSource().token, progress.attachWorkDone(connection, params), undefined); return asPromise(result).then((value) => { if (value instanceof main$5.ResponseError) { return value; } let result = value; if (!result) { result = { capabilities: {} }; } let capabilities = result.capabilities; if (!capabilities) { capabilities = {}; result.capabilities = capabilities; } if (capabilities.textDocumentSync === undefined || capabilities.textDocumentSync === null) { capabilities.textDocumentSync = is$4.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : main$5.TextDocumentSyncKind.None; } else if (!is$4.number(capabilities.textDocumentSync) && !is$4.number(capabilities.textDocumentSync.change)) { capabilities.textDocumentSync.change = is$4.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : main$5.TextDocumentSyncKind.None; } for (let remote of allRemotes) { remote.fillServerCapabilities(capabilities); } return result; }); } else { let result = { capabilities: { textDocumentSync: main$5.TextDocumentSyncKind.None } }; for (let remote of allRemotes) { remote.fillServerCapabilities(result.capabilities); } return result; } }); connection.onRequest(main$5.ShutdownRequest.type, () => { watchDog.shutdownReceived = true; if (shutdownHandler) { return shutdownHandler(new main$5.CancellationTokenSource().token); } else { return undefined; } }); connection.onNotification(main$5.ExitNotification.type, () => { try { if (exitHandler) { exitHandler(); } } finally { if (watchDog.shutdownReceived) { watchDog.exit(0); } else { watchDog.exit(1); } } }); connection.onNotification(main$5.SetTraceNotification.type, (params) => { tracer.trace = main$5.Trace.fromString(params.value); }); return protocolConnection; } exports.createConnection = createConnection; }); getDefaultExportFromCjs(server$1); var files = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveModulePath = exports.FileSystem = exports.resolveGlobalYarnPath = exports.resolveGlobalNodePath = exports.resolve = exports.uriToFilePath = void 0; function uriToFilePath(uri) { let parsed = url__default['default'].parse(uri); if (parsed.protocol !== 'file:' || !parsed.path) { return undefined; } let segments = parsed.path.split('/'); for (var i = 0, len = segments.length; i < len; i++) { segments[i] = decodeURIComponent(segments[i]); } if (process.platform === 'win32' && segments.length > 1) { let first = segments[0]; let second = segments[1]; if (first.length === 0 && second.length > 1 && second[1] === ':') { segments.shift(); } } return path__default['default'].normalize(segments.join('/')); } exports.uriToFilePath = uriToFilePath; function isWindows() { return process.platform === 'win32'; } function resolve(moduleName, nodePath, cwd, tracer) { const nodePathKey = 'NODE_PATH'; const app = [ 'var p = process;', 'p.on(\'message\',function(m){', 'if(m.c===\'e\'){', 'p.exit(0);', '}', 'else if(m.c===\'rs\'){', 'try{', 'var r=require.resolve(m.a);', 'p.send({c:\'r\',s:true,r:r});', '}', 'catch(err){', 'p.send({c:\'r\',s:false});', '}', '}', '});' ].join(''); return new Promise((resolve, reject) => { let env = process.env; let newEnv = Object.create(null); Object.keys(env).forEach(key => newEnv[key] = env[key]); if (nodePath && fs__default['default'].existsSync(nodePath) ) { if (newEnv[nodePathKey]) { newEnv[nodePathKey] = nodePath + path__default['default'].delimiter + newEnv[nodePathKey]; } else { newEnv[nodePathKey] = nodePath; } if (tracer) { tracer(`NODE_PATH value is: ${newEnv[nodePathKey]}`); } } newEnv['ELECTRON_RUN_AS_NODE'] = '1'; try { let cp = child_process_1__default['default'].fork('', [], { cwd: cwd, env: newEnv, execArgv: ['-e', app] }); if (cp.pid === void 0) { reject(new Error(`Starting process to resolve node module ${moduleName} failed`)); return; } cp.on('error', (error) => { reject(error); }); cp.on('message', (message) => { if (message.c === 'r') { cp.send({ c: 'e' }); if (message.s) { resolve(message.r); } else { reject(new Error(`Failed to resolve module: ${moduleName}`)); } } }); let message = { c: 'rs', a: moduleName }; cp.send(message); } catch (error) { reject(error); } }); } exports.resolve = resolve; function resolveGlobalNodePath(tracer) { let npmCommand = 'npm'; const env = Object.create(null); Object.keys(process.env).forEach(key => env[key] = process.env[key]); env['NO_UPDATE_NOTIFIER'] = 'true'; const options = { encoding: 'utf8', env }; if (isWindows()) { npmCommand = 'npm.cmd'; options.shell = true; } let handler = () => { }; try { process.on('SIGPIPE', handler); let stdout = child_process_1__default['default'].spawnSync(npmCommand, ['config', 'get', 'prefix'], options).stdout; if (!stdout) { if (tracer) { tracer(`'npm config get prefix' didn't return a value.`); } return undefined; } let prefix = stdout.trim(); if (tracer) { tracer(`'npm config get prefix' value is: ${prefix}`); } if (prefix.length > 0) { if (isWindows()) { return path__default['default'].join(prefix, 'node_modules'); } else { return path__default['default'].join(prefix, 'lib', 'node_modules'); } } return undefined; } catch (err) { return undefined; } finally { process.removeListener('SIGPIPE', handler); } } exports.resolveGlobalNodePath = resolveGlobalNodePath; function resolveGlobalYarnPath(tracer) { let yarnCommand = 'yarn'; let options = { encoding: 'utf8' }; if (isWindows()) { yarnCommand = 'yarn.cmd'; options.shell = true; } let handler = () => { }; try { process.on('SIGPIPE', handler); let results = child_process_1__default['default'].spawnSync(yarnCommand, ['global', 'dir', '--json'], options); let stdout = results.stdout; if (!stdout) { if (tracer) { tracer(`'yarn global dir' didn't return a value.`); if (results.stderr) { tracer(results.stderr); } } return undefined; } let lines = stdout.trim().split(/\r?\n/); for (let line of lines) { try { let yarn = JSON.parse(line); if (yarn.type === 'log') { return path__default['default'].join(yarn.data, 'node_modules'); } } catch (e) { } } return undefined; } catch (err) { return undefined; } finally { process.removeListener('SIGPIPE', handler); } } exports.resolveGlobalYarnPath = resolveGlobalYarnPath; var FileSystem; (function (FileSystem) { let _isCaseSensitive = undefined; function isCaseSensitive() { if (_isCaseSensitive !== void 0) { return _isCaseSensitive; } if (process.platform === 'win32') { _isCaseSensitive = false; } else { _isCaseSensitive = !fs__default['default'].existsSync(__filename.toUpperCase()) || !fs__default['default'].existsSync(__filename.toLowerCase()); } return _isCaseSensitive; } FileSystem.isCaseSensitive = isCaseSensitive; function isParent(parent, child) { if (isCaseSensitive()) { return path__default['default'].normalize(child).indexOf(path__default['default'].normalize(parent)) === 0; } else { return path__default['default'].normalize(child).toLowerCase().indexOf(path__default['default'].normalize(parent).toLowerCase()) === 0; } } FileSystem.isParent = isParent; })(FileSystem = exports.FileSystem || (exports.FileSystem = {})); function resolveModulePath(workspaceRoot, moduleName, nodePath, tracer) { if (nodePath) { if (!path__default['default'].isAbsolute(nodePath)) { nodePath = path__default['default'].join(workspaceRoot, nodePath); } return resolve(moduleName, nodePath, nodePath, tracer).then((value) => { if (FileSystem.isParent(nodePath, value)) { return value; } else { return Promise.reject(new Error(`Failed to load ${moduleName} from node path location.`)); } }).then(undefined, (_error) => { return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer); }); } else { return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer); } } exports.resolveModulePath = resolveModulePath; }); getDefaultExportFromCjs(files); var node$2 = main$5; var proposed_diagnostic = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DiagnosticFeature = void 0; const DiagnosticFeature = (Base) => { return class extends Base { get diagnostics() { return { refresh: () => { return this.connection.sendRequest(main$5.Proposed.DiagnosticRefreshRequest.type); }, on: (handler) => { this.connection.onRequest(main$5.Proposed.DiagnosticRequest.type, (params, cancel) => { return handler(params, cancel, this.attachWorkDoneProgress(params), undefined); }); } }; } }; }; exports.DiagnosticFeature = DiagnosticFeature; }); getDefaultExportFromCjs(proposed_diagnostic); var api$2 = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProposedFeatures = exports.SemanticTokensBuilder = void 0; Object.defineProperty(exports, "SemanticTokensBuilder", { enumerable: true, get: function () { return semanticTokens.SemanticTokensBuilder; } }); __exportStar(main$5, exports); __exportStar(server$1, exports); (function (ProposedFeatures) { ProposedFeatures.all = { __brand: 'features', languages: proposed_diagnostic.DiagnosticFeature }; })(exports.ProposedFeatures || (exports.ProposedFeatures = {})); }); getDefaultExportFromCjs(api$2); var main$4 = createCommonjsModule(function (module, exports) { /// var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createConnection = exports.Files = void 0; __exportStar(node$2, exports); __exportStar(api$2, exports); (function (Files) { Files.uriToFilePath = files.uriToFilePath; Files.resolveGlobalNodePath = files.resolveGlobalNodePath; Files.resolveGlobalYarnPath = files.resolveGlobalYarnPath; Files.resolve = files.resolve; Files.resolveModulePath = files.resolveModulePath; })(exports.Files || (exports.Files = {})); function endProtocolConnection() { { return; } } let _shutdownReceived = false; let exitTimer = undefined; function setupExitTimer() { const argName = '--clientProcessId'; function runTimer(value) { try { let processId = parseInt(value); if (!isNaN(processId)) { exitTimer = setInterval(() => { try { process.kill(processId, 0); } catch (ex) { endProtocolConnection(); process.exit(_shutdownReceived ? 0 : 1); } }, 3000); } } catch (e) { } } for (let i = 2; i < process.argv.length; i++) { let arg = process.argv[i]; if (arg === argName && i + 1 < process.argv.length) { runTimer(process.argv[i + 1]); return; } else { let args = arg.split('='); if (args[0] === argName) { runTimer(args[1]); } } } } setupExitTimer(); const watchDog = { initialize: (params) => { const processId = params.processId; if (is$4.number(processId) && exitTimer === undefined) { setInterval(() => { try { process.kill(processId, 0); } catch (ex) { process.exit(_shutdownReceived ? 0 : 1); } }, 3000); } }, get shutdownReceived() { return _shutdownReceived; }, set shutdownReceived(value) { _shutdownReceived = value; }, exit: (code) => { process.exit(code); } }; function createConnection(arg1, arg2, arg3, arg4) { let factories; let input; let output; let options; if (arg1 !== void 0 && arg1.__brand === 'features') { factories = arg1; arg1 = arg2; arg2 = arg3; arg3 = arg4; } if (node$2.ConnectionStrategy.is(arg1) || node$2.ConnectionOptions.is(arg1)) { options = arg1; } else { input = arg1; output = arg2; options = arg3; } return _createConnection(input, output, options, factories); } exports.createConnection = createConnection; function _createConnection(input, output, options, factories) { if (!input && !output && process.argv.length > 2) { let port = void 0; let pipeName = void 0; let argv = process.argv.slice(2); for (let i = 0; i < argv.length; i++) { let arg = argv[i]; if (arg === '--node-ipc') { input = new node$2.IPCMessageReader(process); output = new node$2.IPCMessageWriter(process); break; } else if (arg === '--stdio') { input = process.stdin; output = process.stdout; break; } else if (arg === '--socket') { port = parseInt(argv[i + 1]); break; } else if (arg === '--pipe') { pipeName = argv[i + 1]; break; } else { var args = arg.split('='); if (args[0] === '--socket') { port = parseInt(args[1]); break; } else if (args[0] === '--pipe') { pipeName = args[1]; break; } } } if (port) { let transport = node$2.createServerSocketTransport(port); input = transport[0]; output = transport[1]; } else if (pipeName) { let transport = node$2.createServerPipeTransport(pipeName); input = transport[0]; output = transport[1]; } } var commandLineMessage = 'Use arguments of createConnection or set command line parameters: \'--node-ipc\', \'--stdio\' or \'--socket={number}\''; if (!input) { throw new Error('Connection input stream is not set. ' + commandLineMessage); } if (!output) { throw new Error('Connection output stream is not set. ' + commandLineMessage); } if (is$4.func(input.read) && is$4.func(input.on)) { let inputStream = input; inputStream.on('end', () => { process.exit(_shutdownReceived ? 0 : 1); }); inputStream.on('close', () => { process.exit(_shutdownReceived ? 0 : 1); }); } const connectionFactory = (logger) => { const result = node$2.createProtocolConnection(input, output, logger, options); return result; }; return server$1.createConnection(connectionFactory, watchDog, factories); } }); getDefaultExportFromCjs(main$4); var node$1 = main$4; var DiagnosticsManager_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DiagnosticsManager = void 0; class DiagnosticsManager { constructor(sendDiagnostics, docManager, getDiagnostics) { this.sendDiagnostics = sendDiagnostics; this.docManager = docManager; this.getDiagnostics = getDiagnostics; } updateAll() { this.docManager.getAllOpenedByClient().forEach((doc) => { this.update(doc[1]); }); } async update(document) { const diagnostics = await this.getDiagnostics({ uri: document.getURL() }); this.sendDiagnostics({ uri: document.getURL(), diagnostics }); } removeDiagnostics(document) { this.sendDiagnostics({ uri: document.getURL(), diagnostics: [] }); } } exports.DiagnosticsManager = DiagnosticsManager; }); getDefaultExportFromCjs(DiagnosticsManager_1); var lodash = createCommonjsModule(function (module, exports) { (function() { var undefined$1; var VERSION = '4.17.21'; var LARGE_ARRAY_SIZE = 200; var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', FUNC_ERROR_TEXT = 'Expected a function', INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; var HASH_UNDEFINED = '__lodash_hash_undefined__'; var MAX_MEMOIZE_SIZE = 500; var PLACEHOLDER = '__lodash_placeholder__'; var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512; var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = '...'; var HOT_COUNT = 800, HOT_SPAN = 16; var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 1.7976931348623157e+308, NAN = 0 / 0; var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; var wrapFlags = [ ['ary', WRAP_ARY_FLAG], ['bind', WRAP_BIND_FLAG], ['bindKey', WRAP_BIND_KEY_FLAG], ['curry', WRAP_CURRY_FLAG], ['curryRight', WRAP_CURRY_RIGHT_FLAG], ['flip', WRAP_FLIP_FLAG], ['partial', WRAP_PARTIAL_FLAG], ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], ['rearg', WRAP_REARG_FLAG] ]; var argsTag = '[object Arguments]', arrayTag = '[object Array]', asyncTag = '[object AsyncFunction]', boolTag = '[object Boolean]', dateTag = '[object Date]', domExcTag = '[object DOMException]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', nullTag = '[object Null]', objectTag = '[object Object]', promiseTag = '[object Promise]', proxyTag = '[object Proxy]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', undefinedTag = '[object Undefined]', weakMapTag = '[object WeakMap]', weakSetTag = '[object WeakSet]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); var reTrimStart = /^\s+/; var reWhitespace = /\s/; var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; var reEscapeChar = /\\(\\)?/g; var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; var reFlags = /\w*$/; var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; var reIsBinary = /^0b[01]+$/i; var reIsHostCtor = /^\[object .+?Constructor\]$/; var reIsOctal = /^0o[0-7]+$/i; var reIsUint = /^(?:0|[1-9]\d*)$/; var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; var reNoMatch = /($^)/; var reUnescapedString = /['\n\r\u2028\u2029\\]/g; var rsAstralRange = '\\ud800-\\udfff', rsComboMarksRange = '\\u0300-\\u036f', reComboHalfMarksRange = '\\ufe20-\\ufe2f', rsComboSymbolsRange = '\\u20d0-\\u20ff', rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = '\\u2700-\\u27bf', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', rsPunctuationRange = '\\u2000-\\u206f', rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', rsVarRange = '\\ufe0e\\ufe0f', rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; var rsApos = "['\u2019]", rsAstral = '[' + rsAstralRange + ']', rsBreak = '[' + rsBreakRange + ']', rsCombo = '[' + rsComboRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsFitz = '\\ud83c[\\udffb-\\udfff]', rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d'; var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; var reApos = RegExp(rsApos, 'g'); var reComboMark = RegExp(rsCombo, 'g'); var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); var reUnicodeWord = RegExp([ rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, rsUpper + '+' + rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji ].join('|'), 'g'); var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; var contextProps = [ 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' ]; var templateCounter = -1; var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; var deburredLetters = { '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', '\xc7': 'C', '\xe7': 'c', '\xd0': 'D', '\xf0': 'd', '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', '\xd1': 'N', '\xf1': 'n', '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', '\xc6': 'Ae', '\xe6': 'ae', '\xde': 'Th', '\xfe': 'th', '\xdf': 'ss', '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', '\u0134': 'J', '\u0135': 'j', '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', '\u0163': 't', '\u0165': 't', '\u0167': 't', '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', '\u0174': 'W', '\u0175': 'w', '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', '\u0132': 'IJ', '\u0133': 'ij', '\u0152': 'Oe', '\u0153': 'oe', '\u0149': "'n", '\u017f': 's' }; var htmlEscapes = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }; var htmlUnescapes = { '&': '&', '<': '<', '>': '>', '"': '"', ''': "'" }; var stringEscapes = { '\\': '\\', "'": "'", '\n': 'n', '\r': 'r', '\u2028': 'u2028', '\u2029': 'u2029' }; var freeParseFloat = parseFloat, freeParseInt = parseInt; var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; var freeSelf = typeof self == 'object' && self && self.Object === Object && self; var root = freeGlobal || freeSelf || Function('return this')(); var freeExports = exports && !exports.nodeType && exports; var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module; var moduleExports = freeModule && freeModule.exports === freeExports; var freeProcess = moduleExports && freeGlobal.process; var nodeUtil = (function() { try { var types = freeModule && freeModule.require && freeModule.require('util').types; if (types) { return types; } return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; function apply(func, thisArg, args) { switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } function arrayAggregator(array, setter, iteratee, accumulator) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { var value = array[index]; setter(accumulator, value, iteratee(value), array); } return accumulator; } function arrayEach(array, iteratee) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } function arrayEachRight(array, iteratee) { var length = array == null ? 0 : array.length; while (length--) { if (iteratee(array[length], length, array) === false) { break; } } return array; } function arrayEvery(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (!predicate(array[index], index, array)) { return false; } } return true; } function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } function arrayIncludes(array, value) { var length = array == null ? 0 : array.length; return !!length && baseIndexOf(array, value, 0) > -1; } function arrayIncludesWith(array, value, comparator) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (comparator(value, array[index])) { return true; } } return false; } function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } function arrayReduceRight(array, iteratee, accumulator, initAccum) { var length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[--length]; } while (length--) { accumulator = iteratee(accumulator, array[length], length, array); } return accumulator; } function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } var asciiSize = baseProperty('length'); function asciiToArray(string) { return string.split(''); } function asciiWords(string) { return string.match(reAsciiWord) || []; } function baseFindKey(collection, predicate, eachFunc) { var result; eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { result = key; return false; } }); return result; } function baseFindIndex(array, predicate, fromIndex, fromRight) { var length = array.length, index = fromIndex + (fromRight ? 1 : -1); while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { return index; } } return -1; } function baseIndexOf(array, value, fromIndex) { return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); } function baseIndexOfWith(array, value, fromIndex, comparator) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (comparator(array[index], value)) { return index; } } return -1; } function baseIsNaN(value) { return value !== value; } function baseMean(array, iteratee) { var length = array == null ? 0 : array.length; return length ? (baseSum(array, iteratee) / length) : NAN; } function baseProperty(key) { return function(object) { return object == null ? undefined$1 : object[key]; }; } function basePropertyOf(object) { return function(key) { return object == null ? undefined$1 : object[key]; }; } function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection); }); return accumulator; } function baseSortBy(array, comparer) { var length = array.length; array.sort(comparer); while (length--) { array[length] = array[length].value; } return array; } function baseSum(array, iteratee) { var result, index = -1, length = array.length; while (++index < length) { var current = iteratee(array[index]); if (current !== undefined$1) { result = result === undefined$1 ? current : (result + current); } } return result; } function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } function baseToPairs(object, props) { return arrayMap(props, function(key) { return [key, object[key]]; }); } function baseTrim(string) { return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string; } function baseUnary(func) { return function(value) { return func(value); }; } function baseValues(object, props) { return arrayMap(props, function(key) { return object[key]; }); } function cacheHas(cache, key) { return cache.has(key); } function charsStartIndex(strSymbols, chrSymbols) { var index = -1, length = strSymbols.length; while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } function charsEndIndex(strSymbols, chrSymbols) { var index = strSymbols.length; while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } function countHolders(array, placeholder) { var length = array.length, result = 0; while (length--) { if (array[length] === placeholder) { ++result; } } return result; } var deburrLetter = basePropertyOf(deburredLetters); var escapeHtmlChar = basePropertyOf(htmlEscapes); function escapeStringChar(chr) { return '\\' + stringEscapes[chr]; } function getValue(object, key) { return object == null ? undefined$1 : object[key]; } function hasUnicode(string) { return reHasUnicode.test(string); } function hasUnicodeWord(string) { return reHasUnicodeWord.test(string); } function iteratorToArray(iterator) { var data, result = []; while (!(data = iterator.next()).done) { result.push(data.value); } return result; } function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } function replaceHolders(array, placeholder) { var index = -1, length = array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (value === placeholder || value === PLACEHOLDER) { array[index] = PLACEHOLDER; result[resIndex++] = index; } } return result; } function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } function setToPairs(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = [value, value]; }); return result; } function strictIndexOf(array, value, fromIndex) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } function strictLastIndexOf(array, value, fromIndex) { var index = fromIndex + 1; while (index--) { if (array[index] === value) { return index; } } return index; } function stringSize(string) { return hasUnicode(string) ? unicodeSize(string) : asciiSize(string); } function stringToArray(string) { return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); } function trimmedEndIndex(string) { var index = string.length; while (index-- && reWhitespace.test(string.charAt(index))) {} return index; } var unescapeHtmlChar = basePropertyOf(htmlUnescapes); function unicodeSize(string) { var result = reUnicode.lastIndex = 0; while (reUnicode.test(string)) { ++result; } return result; } function unicodeToArray(string) { return string.match(reUnicode) || []; } function unicodeWords(string) { return string.match(reUnicodeWord) || []; } var runInContext = (function runInContext(context) { context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); var Array = context.Array, Date = context.Date, Error = context.Error, Function = context.Function, Math = context.Math, Object = context.Object, RegExp = context.RegExp, String = context.String, TypeError = context.TypeError; var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; var coreJsData = context['__core-js_shared__']; var funcToString = funcProto.toString; var hasOwnProperty = objectProto.hasOwnProperty; var idCounter = 0; var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); var nativeObjectToString = objectProto.toString; var objectCtorString = funcToString.call(Object); var oldDash = root._; var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); var Buffer = moduleExports ? context.Buffer : undefined$1, Symbol = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined$1, getPrototype = overArg(Object.getPrototypeOf, Object), objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined$1, symIterator = Symbol ? Symbol.iterator : undefined$1, symToStringTag = Symbol ? Symbol.toStringTag : undefined$1; var defineProperty = (function() { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }()); var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; var nativeCeil = Math.ceil, nativeFloor = Math.floor, nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max, nativeMin = Math.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeReverse = arrayProto.reverse; var DataView = getNative(context, 'DataView'), Map = getNative(context, 'Map'), Promise = getNative(context, 'Promise'), Set = getNative(context, 'Set'), WeakMap = getNative(context, 'WeakMap'), nativeCreate = getNative(Object, 'create'); var metaMap = WeakMap && new WeakMap; var realNames = {}; var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); var symbolProto = Symbol ? Symbol.prototype : undefined$1, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1, symbolToString = symbolProto ? symbolProto.toString : undefined$1; function lodash(value) { if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { if (value instanceof LodashWrapper) { return value; } if (hasOwnProperty.call(value, '__wrapped__')) { return wrapperClone(value); } } return new LodashWrapper(value); } var baseCreate = (function() { function object() {} return function(proto) { if (!isObject(proto)) { return {}; } if (objectCreate) { return objectCreate(proto); } object.prototype = proto; var result = new object; object.prototype = undefined$1; return result; }; }()); function baseLodash() { } function LodashWrapper(value, chainAll) { this.__wrapped__ = value; this.__actions__ = []; this.__chain__ = !!chainAll; this.__index__ = 0; this.__values__ = undefined$1; } lodash.templateSettings = { 'escape': reEscape, 'evaluate': reEvaluate, 'interpolate': reInterpolate, 'variable': '', 'imports': { '_': lodash } }; lodash.prototype = baseLodash.prototype; lodash.prototype.constructor = lodash; LodashWrapper.prototype = baseCreate(baseLodash.prototype); LodashWrapper.prototype.constructor = LodashWrapper; function LazyWrapper(value) { this.__wrapped__ = value; this.__actions__ = []; this.__dir__ = 1; this.__filtered__ = false; this.__iteratees__ = []; this.__takeCount__ = MAX_ARRAY_LENGTH; this.__views__ = []; } function lazyClone() { var result = new LazyWrapper(this.__wrapped__); result.__actions__ = copyArray(this.__actions__); result.__dir__ = this.__dir__; result.__filtered__ = this.__filtered__; result.__iteratees__ = copyArray(this.__iteratees__); result.__takeCount__ = this.__takeCount__; result.__views__ = copyArray(this.__views__); return result; } function lazyReverse() { if (this.__filtered__) { var result = new LazyWrapper(this); result.__dir__ = -1; result.__filtered__ = true; } else { result = this.clone(); result.__dir__ *= -1; } return result; } function lazyValue() { var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : (start - 1), iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); if (!isArr || (!isRight && arrLength == length && takeCount == length)) { return baseWrapperValue(array, this.__actions__); } var result = []; outer: while (length-- && resIndex < takeCount) { index += dir; var iterIndex = -1, value = array[index]; while (++iterIndex < iterLength) { var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value); if (type == LAZY_MAP_FLAG) { value = computed; } else if (!computed) { if (type == LAZY_FILTER_FLAG) { continue outer; } else { break outer; } } } result[resIndex++] = value; } return result; } LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined$1 : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined$1; } function hashHas(key) { var data = this.__data__; return nativeCreate ? (data[key] !== undefined$1) : hasOwnProperty.call(data, key); } function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined$1) ? HASH_UNDEFINED : value; return this; } Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function listCacheClear() { this.__data__ = []; this.size = 0; } function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined$1 : data[index][1]; } function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } function mapCacheDelete(key) { var result = getMapData(this, key)['delete'](key); this.size -= result ? 1 : 0; return result; } function mapCacheGet(key) { return getMapData(this, key).get(key); } function mapCacheHas(key) { return getMapData(this, key).has(key); } function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; function SetCache(values) { var index = -1, length = values == null ? 0 : values.length; this.__data__ = new MapCache; while (++index < length) { this.add(values[index]); } } function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } function setCacheHas(value) { return this.__data__.has(value); } SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; function Stack(entries) { var data = this.__data__ = new ListCache(entries); this.size = data.size; } function stackClear() { this.__data__ = new ListCache; this.size = 0; } function stackDelete(key) { var data = this.__data__, result = data['delete'](key); this.size = data.size; return result; } function stackGet(key) { return this.__data__.get(key); } function stackHas(key) { return this.__data__.has(key); } function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; function arrayLikeKeys(value, inherited) { var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( key == 'length' || (isBuff && (key == 'offset' || key == 'parent')) || (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || isIndex(key, length) ))) { result.push(key); } } return result; } function arraySample(array) { var length = array.length; return length ? array[baseRandom(0, length - 1)] : undefined$1; } function arraySampleSize(array, n) { return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); } function arrayShuffle(array) { return shuffleSelf(copyArray(array)); } function assignMergeValue(object, key, value) { if ((value !== undefined$1 && !eq(object[key], value)) || (value === undefined$1 && !(key in object))) { baseAssignValue(object, key, value); } } function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined$1 && !(key in object))) { baseAssignValue(object, key, value); } } function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } function baseAggregator(collection, setter, iteratee, accumulator) { baseEach(collection, function(value, key, collection) { setter(accumulator, value, iteratee(value), collection); }); return accumulator; } function baseAssign(object, source) { return object && copyObject(source, keys(source), object); } function baseAssignIn(object, source) { return object && copyObject(source, keysIn(source), object); } function baseAssignValue(object, key, value) { if (key == '__proto__' && defineProperty) { defineProperty(object, key, { 'configurable': true, 'enumerable': true, 'value': value, 'writable': true }); } else { object[key] = value; } } function baseAt(object, paths) { var index = -1, length = paths.length, result = Array(length), skip = object == null; while (++index < length) { result[index] = skip ? undefined$1 : get(object, paths[index]); } return result; } function baseClamp(number, lower, upper) { if (number === number) { if (upper !== undefined$1) { number = number <= upper ? number : upper; } if (lower !== undefined$1) { number = number >= lower ? number : lower; } } return number; } function baseClone(value, bitmask, customizer, key, object, stack) { var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); } if (result !== undefined$1) { return result; } if (!isObject(value)) { return value; } var isArr = isArray(value); if (isArr) { result = initCloneArray(value); if (!isDeep) { return copyArray(value, result); } } else { var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; if (isBuffer(value)) { return cloneBuffer(value, isDeep); } if (tag == objectTag || tag == argsTag || (isFunc && !object)) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { return object ? value : {}; } result = initCloneByTag(value, tag, isDeep); } } stack || (stack = new Stack); var stacked = stack.get(value); if (stacked) { return stacked; } stack.set(value, result); if (isSet(value)) { value.forEach(function(subValue) { result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); }); } else if (isMap(value)) { value.forEach(function(subValue, key) { result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); } var keysFunc = isFull ? (isFlat ? getAllKeysIn : getAllKeys) : (isFlat ? keysIn : keys); var props = isArr ? undefined$1 : keysFunc(value); arrayEach(props || value, function(subValue, key) { if (props) { key = subValue; subValue = value[key]; } assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); return result; } function baseConforms(source) { var props = keys(source); return function(object) { return baseConformsTo(object, source, props); }; } function baseConformsTo(object, source, props) { var length = props.length; if (object == null) { return !length; } object = Object(object); while (length--) { var key = props[length], predicate = source[key], value = object[key]; if ((value === undefined$1 && !(key in object)) || !predicate(value)) { return false; } } return true; } function baseDelay(func, wait, args) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return setTimeout(function() { func.apply(undefined$1, args); }, wait); } function baseDifference(array, values, iteratee, comparator) { var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length; if (!length) { return result; } if (iteratee) { values = arrayMap(values, baseUnary(iteratee)); } if (comparator) { includes = arrayIncludesWith; isCommon = false; } else if (values.length >= LARGE_ARRAY_SIZE) { includes = cacheHas; isCommon = false; values = new SetCache(values); } outer: while (++index < length) { var value = array[index], computed = iteratee == null ? value : iteratee(value); value = (comparator || value !== 0) ? value : 0; if (isCommon && computed === computed) { var valuesIndex = valuesLength; while (valuesIndex--) { if (values[valuesIndex] === computed) { continue outer; } } result.push(value); } else if (!includes(values, computed, comparator)) { result.push(value); } } return result; } var baseEach = createBaseEach(baseForOwn); var baseEachRight = createBaseEach(baseForOwnRight, true); function baseEvery(collection, predicate) { var result = true; baseEach(collection, function(value, index, collection) { result = !!predicate(value, index, collection); return result; }); return result; } function baseExtremum(array, iteratee, comparator) { var index = -1, length = array.length; while (++index < length) { var value = array[index], current = iteratee(value); if (current != null && (computed === undefined$1 ? (current === current && !isSymbol(current)) : comparator(current, computed) )) { var computed = current, result = value; } } return result; } function baseFill(array, value, start, end) { var length = array.length; start = toInteger(start); if (start < 0) { start = -start > length ? 0 : (length + start); } end = (end === undefined$1 || end > length) ? length : toInteger(end); if (end < 0) { end += length; } end = start > end ? 0 : toLength(end); while (start < end) { array[start++] = value; } return array; } function baseFilter(collection, predicate) { var result = []; baseEach(collection, function(value, index, collection) { if (predicate(value, index, collection)) { result.push(value); } }); return result; } function baseFlatten(array, depth, predicate, isStrict, result) { var index = -1, length = array.length; predicate || (predicate = isFlattenable); result || (result = []); while (++index < length) { var value = array[index]; if (depth > 0 && predicate(value)) { if (depth > 1) { baseFlatten(value, depth - 1, predicate, isStrict, result); } else { arrayPush(result, value); } } else if (!isStrict) { result[result.length] = value; } } return result; } var baseFor = createBaseFor(); var baseForRight = createBaseFor(true); function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } function baseForOwnRight(object, iteratee) { return object && baseForRight(object, iteratee, keys); } function baseFunctions(object, props) { return arrayFilter(props, function(key) { return isFunction(object[key]); }); } function baseGet(object, path) { path = castPath(path, object); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined$1; } function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } function baseGetTag(value) { if (value == null) { return value === undefined$1 ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } function baseGt(value, other) { return value > other; } function baseHas(object, key) { return object != null && hasOwnProperty.call(object, key); } function baseHasIn(object, key) { return object != null && key in Object(object); } function baseInRange(number, start, end) { return number >= nativeMin(start, end) && number < nativeMax(start, end); } function baseIntersection(arrays, iteratee, comparator) { var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = []; while (othIndex--) { var array = arrays[othIndex]; if (othIndex && iteratee) { array = arrayMap(array, baseUnary(iteratee)); } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) ? new SetCache(othIndex && array) : undefined$1; } array = arrays[0]; var index = -1, seen = caches[0]; outer: while (++index < length && result.length < maxLength) { var value = array[index], computed = iteratee ? iteratee(value) : value; value = (comparator || value !== 0) ? value : 0; if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator) )) { othIndex = othLength; while (--othIndex) { var cache = caches[othIndex]; if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator)) ) { continue outer; } } if (seen) { seen.push(computed); } result.push(value); } } return result; } function baseInverter(object, setter, iteratee, accumulator) { baseForOwn(object, function(value, key, object) { setter(accumulator, iteratee(value), key, object); }); return accumulator; } function baseInvoke(object, path, args) { path = castPath(path, object); object = parent(object, path); var func = object == null ? object : object[toKey(last(path))]; return func == null ? undefined$1 : apply(func, object, args); } function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } function baseIsArrayBuffer(value) { return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; } function baseIsDate(value) { return isObjectLike(value) && baseGetTag(value) == dateTag; } function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } function baseIsMap(value) { return isObjectLike(value) && getTag(value) == mapTag; } function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object) ) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined$1 && !(key in object)) { return false; } } else { var stack = new Stack; if (customizer) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined$1 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result )) { return false; } } } return true; } function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } function baseIsRegExp(value) { return isObjectLike(value) && baseGetTag(value) == regexpTag; } function baseIsSet(value) { return isObjectLike(value) && getTag(value) == setTag; } function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } function baseIteratee(value) { if (typeof value == 'function') { return value; } if (value == null) { return identity; } if (typeof value == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } function baseKeysIn(object) { if (!isObject(object)) { return nativeKeysIn(object); } var isProto = isPrototype(object), result = []; for (var key in object) { if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } function baseLt(value, other) { return value < other; } function baseMap(collection, iteratee) { var index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); }); return result; } function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } return function(object) { var objValue = get(object, path); return (objValue === undefined$1 && objValue === srcValue) ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } baseFor(source, function(srcValue, key) { stack || (stack = new Stack); if (isObject(srcValue)) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) : undefined$1; if (newValue === undefined$1) { newValue = srcValue; } assignMergeValue(object, key, newValue); } }, keysIn); } function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); if (stacked) { assignMergeValue(object, key, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined$1; var isCommon = newValue === undefined$1; if (isCommon) { var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (isArray(objValue)) { newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else if (isBuff) { isCommon = false; newValue = cloneBuffer(srcValue, true); } else if (isTyped) { isCommon = false; newValue = cloneTypedArray(srcValue, true); } else { newValue = []; } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { newValue = objValue; if (isArguments(objValue)) { newValue = toPlainObject(objValue); } else if (!isObject(objValue) || isFunction(objValue)) { newValue = initCloneObject(srcValue); } } else { isCommon = false; } } if (isCommon) { stack.set(srcValue, newValue); mergeFunc(newValue, srcValue, srcIndex, customizer, stack); stack['delete'](srcValue); } assignMergeValue(object, key, newValue); } function baseNth(array, n) { var length = array.length; if (!length) { return; } n += n < 0 ? length : 0; return isIndex(n, length) ? array[n] : undefined$1; } function baseOrderBy(collection, iteratees, orders) { if (iteratees.length) { iteratees = arrayMap(iteratees, function(iteratee) { if (isArray(iteratee)) { return function(value) { return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); } } return iteratee; }); } else { iteratees = [identity]; } var index = -1; iteratees = arrayMap(iteratees, baseUnary(getIteratee())); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); return { 'criteria': criteria, 'index': ++index, 'value': value }; }); return baseSortBy(result, function(object, other) { return compareMultiple(object, other, orders); }); } function basePick(object, paths) { return basePickBy(object, paths, function(value, path) { return hasIn(object, path); }); } function basePickBy(object, paths, predicate) { var index = -1, length = paths.length, result = {}; while (++index < length) { var path = paths[index], value = baseGet(object, path); if (predicate(value, path)) { baseSet(result, castPath(path, object), value); } } return result; } function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } function basePullAll(array, values, iteratee, comparator) { var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array; if (array === values) { values = copyArray(values); } if (iteratee) { seen = arrayMap(array, baseUnary(iteratee)); } while (++index < length) { var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value; while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { if (seen !== array) { splice.call(seen, fromIndex, 1); } splice.call(array, fromIndex, 1); } } return array; } function basePullAt(array, indexes) { var length = array ? indexes.length : 0, lastIndex = length - 1; while (length--) { var index = indexes[length]; if (length == lastIndex || index !== previous) { var previous = index; if (isIndex(index)) { splice.call(array, index, 1); } else { baseUnset(array, index); } } } return array; } function baseRandom(lower, upper) { return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } function baseRange(start, end, step, fromRight) { var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); while (length--) { result[fromRight ? length : ++index] = start; start += step; } return result; } function baseRepeat(string, n) { var result = ''; if (!string || n < 1 || n > MAX_SAFE_INTEGER) { return result; } do { if (n % 2) { result += string; } n = nativeFloor(n / 2); if (n) { string += string; } } while (n); return result; } function baseRest(func, start) { return setToString(overRest(func, start, identity), func + ''); } function baseSample(collection) { return arraySample(values(collection)); } function baseSampleSize(collection, n) { var array = values(collection); return shuffleSelf(array, baseClamp(n, 0, array.length)); } function baseSet(object, path, value, customizer) { if (!isObject(object)) { return object; } path = castPath(path, object); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = toKey(path[index]), newValue = value; if (key === '__proto__' || key === 'constructor' || key === 'prototype') { return object; } if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined$1; if (newValue === undefined$1) { newValue = isObject(objValue) ? objValue : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); nested = nested[key]; } return object; } var baseSetData = !metaMap ? identity : function(func, data) { metaMap.set(func, data); return func; }; var baseSetToString = !defineProperty ? identity : function(func, string) { return defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, 'value': constant(string), 'writable': true }); }; function baseShuffle(collection) { return shuffleSelf(values(collection)); } function baseSlice(array, start, end) { var index = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : (length + start); } end = end > length ? length : end; if (end < 0) { end += length; } length = start > end ? 0 : ((end - start) >>> 0); start >>>= 0; var result = Array(length); while (++index < length) { result[index] = array[index + start]; } return result; } function baseSome(collection, predicate) { var result; baseEach(collection, function(value, index, collection) { result = predicate(value, index, collection); return !result; }); return !!result; } function baseSortedIndex(array, value, retHighest) { var low = 0, high = array == null ? low : array.length; if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { while (low < high) { var mid = (low + high) >>> 1, computed = array[mid]; if (computed !== null && !isSymbol(computed) && (retHighest ? (computed <= value) : (computed < value))) { low = mid + 1; } else { high = mid; } } return high; } return baseSortedIndexBy(array, value, identity, retHighest); } function baseSortedIndexBy(array, value, iteratee, retHighest) { var low = 0, high = array == null ? 0 : array.length; if (high === 0) { return 0; } value = iteratee(value); var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined$1; while (low < high) { var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== undefined$1, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed); if (valIsNaN) { var setLow = retHighest || othIsReflexive; } else if (valIsUndefined) { setLow = othIsReflexive && (retHighest || othIsDefined); } else if (valIsNull) { setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); } else if (valIsSymbol) { setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); } else if (othIsNull || othIsSymbol) { setLow = false; } else { setLow = retHighest ? (computed <= value) : (computed < value); } if (setLow) { low = mid + 1; } else { high = mid; } } return nativeMin(high, MAX_ARRAY_INDEX); } function baseSortedUniq(array, iteratee) { var index = -1, length = array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; if (!index || !eq(computed, seen)) { var seen = computed; result[resIndex++] = value === 0 ? 0 : value; } } return result; } function baseToNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } return +value; } function baseToString(value) { if (typeof value == 'string') { return value; } if (isArray(value)) { return arrayMap(value, baseToString) + ''; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } function baseUniq(array, iteratee, comparator) { var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result; if (comparator) { isCommon = false; includes = arrayIncludesWith; } else if (length >= LARGE_ARRAY_SIZE) { var set = iteratee ? null : createSet(array); if (set) { return setToArray(set); } isCommon = false; includes = cacheHas; seen = new SetCache; } else { seen = iteratee ? [] : result; } outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; value = (comparator || value !== 0) ? value : 0; if (isCommon && computed === computed) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed) { continue outer; } } if (iteratee) { seen.push(computed); } result.push(value); } else if (!includes(seen, computed, comparator)) { if (seen !== result) { seen.push(computed); } result.push(value); } } return result; } function baseUnset(object, path) { path = castPath(path, object); object = parent(object, path); return object == null || delete object[toKey(last(path))]; } function baseUpdate(object, path, updater, customizer) { return baseSet(object, path, updater(baseGet(object, path)), customizer); } function baseWhile(array, predicate, isDrop, fromRight) { var length = array.length, index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} return isDrop ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); } function baseWrapperValue(value, actions) { var result = value; if (result instanceof LazyWrapper) { result = result.value(); } return arrayReduce(actions, function(result, action) { return action.func.apply(action.thisArg, arrayPush([result], action.args)); }, result); } function baseXor(arrays, iteratee, comparator) { var length = arrays.length; if (length < 2) { return length ? baseUniq(arrays[0]) : []; } var index = -1, result = Array(length); while (++index < length) { var array = arrays[index], othIndex = -1; while (++othIndex < length) { if (othIndex != index) { result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); } } } return baseUniq(baseFlatten(result, 1), iteratee, comparator); } function baseZipObject(props, values, assignFunc) { var index = -1, length = props.length, valsLength = values.length, result = {}; while (++index < length) { var value = index < valsLength ? values[index] : undefined$1; assignFunc(result, props[index], value); } return result; } function castArrayLikeObject(value) { return isArrayLikeObject(value) ? value : []; } function castFunction(value) { return typeof value == 'function' ? value : identity; } function castPath(value, object) { if (isArray(value)) { return value; } return isKey(value, object) ? [value] : stringToPath(toString(value)); } var castRest = baseRest; function castSlice(array, start, end) { var length = array.length; end = end === undefined$1 ? length : end; return (!start && end >= length) ? array : baseSlice(array, start, end); } var clearTimeout = ctxClearTimeout || function(id) { return root.clearTimeout(id); }; function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); buffer.copy(result); return result; } function cloneArrayBuffer(arrayBuffer) { var result = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array(result).set(new Uint8Array(arrayBuffer)); return result; } function cloneDataView(dataView, isDeep) { var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); } function cloneRegExp(regexp) { var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } function cloneSymbol(symbol) { return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; } function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } function compareAscending(value, other) { if (value !== other) { var valIsDefined = value !== undefined$1, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value); var othIsDefined = other !== undefined$1, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other); if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || (valIsNull && othIsDefined && othIsReflexive) || (!valIsDefined && othIsReflexive) || !valIsReflexive) { return 1; } if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || (othIsNull && valIsDefined && valIsReflexive) || (!othIsDefined && valIsReflexive) || !othIsReflexive) { return -1; } } return 0; } function compareMultiple(object, other, orders) { var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; while (++index < length) { var result = compareAscending(objCriteria[index], othCriteria[index]); if (result) { if (index >= ordersLength) { return result; } var order = orders[index]; return result * (order == 'desc' ? -1 : 1); } } return object.index - other.index; } function composeArgs(args, partials, holders, isCurried) { var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result = Array(leftLength + rangeLength), isUncurried = !isCurried; while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; } while (++argsIndex < holdersLength) { if (isUncurried || argsIndex < argsLength) { result[holders[argsIndex]] = args[argsIndex]; } } while (rangeLength--) { result[leftIndex++] = args[argsIndex++]; } return result; } function composeArgsRight(args, partials, holders, isCurried) { var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result = Array(rangeLength + rightLength), isUncurried = !isCurried; while (++argsIndex < rangeLength) { result[argsIndex] = args[argsIndex]; } var offset = argsIndex; while (++rightIndex < rightLength) { result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { if (isUncurried || argsIndex < argsLength) { result[offset + holders[holdersIndex]] = args[argsIndex++]; } } return result; } function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined$1; if (newValue === undefined$1) { newValue = source[key]; } if (isNew) { baseAssignValue(object, key, newValue); } else { assignValue(object, key, newValue); } } return object; } function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } function copySymbolsIn(source, object) { return copyObject(source, getSymbolsIn(source), object); } function createAggregator(setter, initializer) { return function(collection, iteratee) { var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; return func(collection, setter, getIteratee(iteratee, 2), accumulator); }; } function createAssigner(assigner) { return baseRest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined$1, guard = length > 2 ? sources[2] : undefined$1; customizer = (assigner.length > 3 && typeof customizer == 'function') ? (length--, customizer) : undefined$1; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined$1 : customizer; length = 1; } object = Object(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, index, customizer); } } return object; }); } function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { if (collection == null) { return collection; } if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { break; } } return collection; }; } function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } function createBind(func, bitmask, thisArg) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return fn.apply(isBind ? thisArg : this, arguments); } return wrapper; } function createCaseFirst(methodName) { return function(string) { string = toString(string); var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined$1; var chr = strSymbols ? strSymbols[0] : string.charAt(0); var trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1); return chr[methodName]() + trailing; }; } function createCompounder(callback) { return function(string) { return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); }; } function createCtor(Ctor) { return function() { var args = arguments; switch (args.length) { case 0: return new Ctor; case 1: return new Ctor(args[0]); case 2: return new Ctor(args[0], args[1]); case 3: return new Ctor(args[0], args[1], args[2]); case 4: return new Ctor(args[0], args[1], args[2], args[3]); case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); } var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args); return isObject(result) ? result : thisBinding; }; } function createCurry(func, bitmask, arity) { var Ctor = createCtor(func); function wrapper() { var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper); while (index--) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) ? [] : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( func, bitmask, createHybrid, wrapper.placeholder, undefined$1, args, holders, undefined$1, undefined$1, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); } return wrapper; } function createFind(findIndexFunc) { return function(collection, predicate, fromIndex) { var iterable = Object(collection); if (!isArrayLike(collection)) { var iteratee = getIteratee(predicate, 3); collection = keys(collection); predicate = function(key) { return iteratee(iterable[key], key, iterable); }; } var index = findIndexFunc(collection, predicate, fromIndex); return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined$1; }; } function createFlow(fromRight) { return flatRest(function(funcs) { var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; if (fromRight) { funcs.reverse(); } while (index--) { var func = funcs[index]; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (prereq && !wrapper && getFuncName(func) == 'wrapper') { var wrapper = new LodashWrapper([], true); } } index = wrapper ? index : length; while (++index < length) { func = funcs[index]; var funcName = getFuncName(func), data = funcName == 'wrapper' ? getData(func) : undefined$1; if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1 ) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); } } return function() { var args = arguments, value = args[0]; if (wrapper && args.length == 1 && isArray(value)) { return wrapper.plant(value).value(); } var index = 0, result = length ? funcs[index].apply(this, args) : value; while (++index < length) { result = funcs[index].call(this, result); } return result; }; }); } function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined$1 : createCtor(func); function wrapper() { var length = arguments.length, args = Array(length), index = length; while (index--) { args[index] = arguments[index]; } if (isCurried) { var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder); } if (partials) { args = composeArgs(args, partials, holders, isCurried); } if (partialsRight) { args = composeArgsRight(args, partialsRight, holdersRight, isCurried); } length -= holdersCount; if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; length = args.length; if (argPos) { args = reorder(args, argPos); } else if (isFlip && length > 1) { args.reverse(); } if (isAry && ary < length) { args.length = ary; } if (this && this !== root && this instanceof wrapper) { fn = Ctor || createCtor(fn); } return fn.apply(thisBinding, args); } return wrapper; } function createInverter(setter, toIteratee) { return function(object, iteratee) { return baseInverter(object, setter, toIteratee(iteratee), {}); }; } function createMathOperation(operator, defaultValue) { return function(value, other) { var result; if (value === undefined$1 && other === undefined$1) { return defaultValue; } if (value !== undefined$1) { result = value; } if (other !== undefined$1) { if (result === undefined$1) { return other; } if (typeof value == 'string' || typeof other == 'string') { value = baseToString(value); other = baseToString(other); } else { value = baseToNumber(value); other = baseToNumber(other); } result = operator(value, other); } return result; }; } function createOver(arrayFunc) { return flatRest(function(iteratees) { iteratees = arrayMap(iteratees, baseUnary(getIteratee())); return baseRest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { return apply(iteratee, thisArg, args); }); }); }); } function createPadding(length, chars) { chars = chars === undefined$1 ? ' ' : baseToString(chars); var charsLength = chars.length; if (charsLength < 2) { return charsLength ? baseRepeat(chars, length) : chars; } var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join('') : result.slice(0, length); } function createPartial(func, bitmask, thisArg, partials) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; } while (argsLength--) { args[leftIndex++] = arguments[++argsIndex]; } return apply(fn, isBind ? thisArg : this, args); } return wrapper; } function createRange(fromRight) { return function(start, end, step) { if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { end = step = undefined$1; } start = toFinite(start); if (end === undefined$1) { end = start; start = 0; } else { end = toFinite(end); } step = step === undefined$1 ? (start < end ? 1 : -1) : toFinite(step); return baseRange(start, end, step, fromRight); }; } function createRelationalOperation(operator) { return function(value, other) { if (!(typeof value == 'string' && typeof other == 'string')) { value = toNumber(value); other = toNumber(other); } return operator(value, other); }; } function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined$1, newHoldersRight = isCurry ? undefined$1 : holders, newPartials = isCurry ? partials : undefined$1, newPartialsRight = isCurry ? undefined$1 : partials; bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); } var newData = [ func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity ]; var result = wrapFunc.apply(undefined$1, newData); if (isLaziable(func)) { setData(result, newData); } result.placeholder = placeholder; return setWrapToString(result, func, bitmask); } function createRound(methodName) { var func = Math[methodName]; return function(number, precision) { number = toNumber(number); precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); if (precision && nativeIsFinite(number)) { var pair = (toString(number) + 'e').split('e'), value = func(pair[0] + 'e' + (+pair[1] + precision)); pair = (toString(value) + 'e').split('e'); return +(pair[0] + 'e' + (+pair[1] - precision)); } return func(number); }; } var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { return new Set(values); }; function createToPairs(keysFunc) { return function(object) { var tag = getTag(object); if (tag == mapTag) { return mapToArray(object); } if (tag == setTag) { return setToPairs(object); } return baseToPairs(object, keysFunc(object)); }; } function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; if (!isBindKey && typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } var length = partials ? partials.length : 0; if (!length) { bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); partials = holders = undefined$1; } ary = ary === undefined$1 ? ary : nativeMax(toInteger(ary), 0); arity = arity === undefined$1 ? arity : toInteger(arity); length -= holders ? holders.length : 0; if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; partials = holders = undefined$1; } var data = isBindKey ? undefined$1 : getData(func); var newData = [ func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity ]; if (data) { mergeData(newData, data); } func = newData[0]; bitmask = newData[1]; thisArg = newData[2]; partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined$1 ? (isBindKey ? 0 : func.length) : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); } if (!bitmask || bitmask == WRAP_BIND_FLAG) { var result = createBind(func, bitmask, thisArg); } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { result = createCurry(func, bitmask, arity); } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { result = createPartial(func, bitmask, thisArg, partials); } else { result = createHybrid.apply(undefined$1, newData); } var setter = data ? baseSetData : setData; return setWrapToString(setter(result, newData), func, bitmask); } function customDefaultsAssignIn(objValue, srcValue, key, object) { if (objValue === undefined$1 || (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { return srcValue; } return objValue; } function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { if (isObject(objValue) && isObject(srcValue)) { stack.set(srcValue, objValue); baseMerge(objValue, srcValue, undefined$1, customDefaultsMerge, stack); stack['delete'](srcValue); } return objValue; } function customOmitClone(value) { return isPlainObject(value) ? undefined$1 : value; } function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } var arrStacked = stack.get(array); var othStacked = stack.get(other); if (arrStacked && othStacked) { return arrStacked == other && othStacked == array; } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined$1; stack.set(array, other); stack.set(other, array); while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined$1) { if (compared) { continue; } result = false; break; } if (seen) { if (!arraySome(other, function(othValue, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!( arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack) )) { result = false; break; } } stack['delete'](array); stack['delete'](other); return result; } function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if ((object.byteLength != other.byteLength) || (object.byteOffset != other.byteOffset)) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: return object == (other + ''); case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG; stack.set(object, other); var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack['delete'](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } var objStacked = stack.get(object); var othStacked = stack.get(other); if (objStacked && othStacked) { return objStacked == other && othStacked == object; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } if (!(compared === undefined$1 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); stack['delete'](other); return result; } function flatRest(func) { return setToString(overRest(func, undefined$1, flatten), func + ''); } function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } function getAllKeysIn(object) { return baseGetAllKeys(object, keysIn, getSymbolsIn); } var getData = !metaMap ? noop : function(func) { return metaMap.get(func); }; function getFuncName(func) { var result = (func.name + ''), array = realNames[result], length = hasOwnProperty.call(realNames, result) ? array.length : 0; while (length--) { var data = array[length], otherFunc = data.func; if (otherFunc == null || otherFunc == func) { return data.name; } } return result; } function getHolder(func) { var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; return object.placeholder; } function getIteratee() { var result = lodash.iteratee || iteratee; result = result === iteratee ? baseIteratee : result; return arguments.length ? result(arguments[0], arguments[1]) : result; } function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } function getMatchData(object) { var result = keys(object), length = result.length; while (length--) { var key = result[length], value = object[key]; result[length] = [key, value, isStrictComparable(value)]; } return result; } function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined$1; } function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined$1; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } var getSymbols = !nativeGetSymbols ? stubArray : function(object) { if (object == null) { return []; } object = Object(object); return arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { var result = []; while (object) { arrayPush(result, getSymbols(object)); object = getPrototype(object); } return result; }; var getTag = baseGetTag; if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : undefined$1, ctorString = Ctor ? toSource(Ctor) : ''; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } function getView(start, end, transforms) { var index = -1, length = transforms.length; while (++index < length) { var data = transforms[index], size = data.size; switch (data.type) { case 'drop': start += size; break; case 'dropRight': end -= size; break; case 'take': end = nativeMin(end, start + size); break; case 'takeRight': start = nativeMax(start, end - size); break; } } return { 'start': start, 'end': end }; } function getWrapDetails(source) { var match = source.match(reWrapDetails); return match ? match[1].split(reSplitDetails) : []; } function hasPath(object, path, hasFunc) { path = castPath(path, object); var index = -1, length = path.length, result = false; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result || ++index != length) { return result; } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } function initCloneArray(array) { var length = array.length, result = new array.constructor(length); if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } return result; } function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) ? baseCreate(getPrototype(object)) : {}; } function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return cloneArrayBuffer(object); case boolTag: case dateTag: return new Ctor(+object); case dataViewTag: return cloneDataView(object, isDeep); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: return new Ctor; case numberTag: case stringTag: return new Ctor(object); case regexpTag: return cloneRegExp(object); case setTag: return new Ctor; case symbolTag: return cloneSymbol(object); } } function insertWrapDetails(source, details) { var length = details.length; if (!length) { return source; } var lastIndex = length - 1; details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; details = details.join(length > 2 ? ', ' : ' '); return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); } function isFlattenable(value) { return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); } function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length); } function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object) ) { return eq(object[index], value); } return false; } function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } function isLaziable(func) { var funcName = getFuncName(func), other = lodash[funcName]; if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { return false; } if (func === other) { return true; } var data = getData(other); return !!data && func === data[0]; } function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } var isMaskable = coreJsData ? isFunction : stubFalse; function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } function isStrictComparable(value) { return value === value && !isObject(value); } function matchesStrictComparable(key, srcValue) { return function(object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== undefined$1 || (key in Object(object))); }; } function memoizeCapped(func) { var result = memoize(func, function(key) { if (cache.size === MAX_MEMOIZE_SIZE) { cache.clear(); } return key; }); var cache = result.cache; return result; } function mergeData(data, source) { var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); if (!(isCommon || isCombo)) { return data; } if (srcBitmask & WRAP_BIND_FLAG) { data[2] = source[2]; newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; } var value = source[3]; if (value) { var partials = data[3]; data[3] = partials ? composeArgs(partials, value, source[4]) : value; data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; } value = source[5]; if (value) { partials = data[5]; data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; } value = source[7]; if (value) { data[7] = value; } if (srcBitmask & WRAP_ARY_FLAG) { data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); } if (data[9] == null) { data[9] = source[9]; } data[0] = source[0]; data[1] = newBitmask; return data; } function nativeKeysIn(object) { var result = []; if (object != null) { for (var key in Object(object)) { result.push(key); } } return result; } function objectToString(value) { return nativeObjectToString.call(value); } function overRest(func, start, transform) { start = nativeMax(start === undefined$1 ? (func.length - 1) : start, 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } index = -1; var otherArgs = Array(start + 1); while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = transform(array); return apply(func, this, otherArgs); }; } function parent(object, path) { return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); } function reorder(array, indexes) { var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); while (length--) { var index = indexes[length]; array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined$1; } return array; } function safeGet(object, key) { if (key === 'constructor' && typeof object[key] === 'function') { return; } if (key == '__proto__') { return; } return object[key]; } var setData = shortOut(baseSetData); var setTimeout = ctxSetTimeout || function(func, wait) { return root.setTimeout(func, wait); }; var setToString = shortOut(baseSetToString); function setWrapToString(wrapper, reference, bitmask) { var source = (reference + ''); return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); } function shortOut(func) { var count = 0, lastCalled = 0; return function() { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return arguments[0]; } } else { count = 0; } return func.apply(undefined$1, arguments); }; } function shuffleSelf(array, size) { var index = -1, length = array.length, lastIndex = length - 1; size = size === undefined$1 ? length : size; while (++index < size) { var rand = baseRandom(index, lastIndex), value = array[rand]; array[rand] = array[index]; array[index] = value; } array.length = size; return array; } var stringToPath = memoizeCapped(function(string) { var result = []; if (string.charCodeAt(0) === 46 ) { result.push(''); } string.replace(rePropName, function(match, number, quote, subString) { result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } function updateWrapDetails(details, bitmask) { arrayEach(wrapFlags, function(pair) { var value = '_.' + pair[0]; if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { details.push(value); } }); return details.sort(); } function wrapperClone(wrapper) { if (wrapper instanceof LazyWrapper) { return wrapper.clone(); } var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); result.__actions__ = copyArray(wrapper.__actions__); result.__index__ = wrapper.__index__; result.__values__ = wrapper.__values__; return result; } function chunk(array, size, guard) { if ((guard ? isIterateeCall(array, size, guard) : size === undefined$1)) { size = 1; } else { size = nativeMax(toInteger(size), 0); } var length = array == null ? 0 : array.length; if (!length || size < 1) { return []; } var index = 0, resIndex = 0, result = Array(nativeCeil(length / size)); while (index < length) { result[resIndex++] = baseSlice(array, index, (index += size)); } return result; } function compact(array) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (value) { result[resIndex++] = value; } } return result; } function concat() { var length = arguments.length; if (!length) { return []; } var args = Array(length - 1), array = arguments[0], index = length; while (index--) { args[index - 1] = arguments[index]; } return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); } var difference = baseRest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []; }); var differenceBy = baseRest(function(array, values) { var iteratee = last(values); if (isArrayLikeObject(iteratee)) { iteratee = undefined$1; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) : []; }); var differenceWith = baseRest(function(array, values) { var comparator = last(values); if (isArrayLikeObject(comparator)) { comparator = undefined$1; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined$1, comparator) : []; }); function drop(array, n, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n = (guard || n === undefined$1) ? 1 : toInteger(n); return baseSlice(array, n < 0 ? 0 : n, length); } function dropRight(array, n, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n = (guard || n === undefined$1) ? 1 : toInteger(n); n = length - n; return baseSlice(array, 0, n < 0 ? 0 : n); } function dropRightWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; } function dropWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), true) : []; } function fill(array, value, start, end) { var length = array == null ? 0 : array.length; if (!length) { return []; } if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { start = 0; end = length; } return baseFill(array, value, start, end); } function findIndex(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = fromIndex == null ? 0 : toInteger(fromIndex); if (index < 0) { index = nativeMax(length + index, 0); } return baseFindIndex(array, getIteratee(predicate, 3), index); } function findLastIndex(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = length - 1; if (fromIndex !== undefined$1) { index = toInteger(fromIndex); index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); } return baseFindIndex(array, getIteratee(predicate, 3), index, true); } function flatten(array) { var length = array == null ? 0 : array.length; return length ? baseFlatten(array, 1) : []; } function flattenDeep(array) { var length = array == null ? 0 : array.length; return length ? baseFlatten(array, INFINITY) : []; } function flattenDepth(array, depth) { var length = array == null ? 0 : array.length; if (!length) { return []; } depth = depth === undefined$1 ? 1 : toInteger(depth); return baseFlatten(array, depth); } function fromPairs(pairs) { var index = -1, length = pairs == null ? 0 : pairs.length, result = {}; while (++index < length) { var pair = pairs[index]; result[pair[0]] = pair[1]; } return result; } function head(array) { return (array && array.length) ? array[0] : undefined$1; } function indexOf(array, value, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = fromIndex == null ? 0 : toInteger(fromIndex); if (index < 0) { index = nativeMax(length + index, 0); } return baseIndexOf(array, value, index); } function initial(array) { var length = array == null ? 0 : array.length; return length ? baseSlice(array, 0, -1) : []; } var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped) : []; }); var intersectionBy = baseRest(function(arrays) { var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); if (iteratee === last(mapped)) { iteratee = undefined$1; } else { mapped.pop(); } return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped, getIteratee(iteratee, 2)) : []; }); var intersectionWith = baseRest(function(arrays) { var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); comparator = typeof comparator == 'function' ? comparator : undefined$1; if (comparator) { mapped.pop(); } return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped, undefined$1, comparator) : []; }); function join(array, separator) { return array == null ? '' : nativeJoin.call(array, separator); } function last(array) { var length = array == null ? 0 : array.length; return length ? array[length - 1] : undefined$1; } function lastIndexOf(array, value, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = length; if (fromIndex !== undefined$1) { index = toInteger(fromIndex); index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); } return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true); } function nth(array, n) { return (array && array.length) ? baseNth(array, toInteger(n)) : undefined$1; } var pull = baseRest(pullAll); function pullAll(array, values) { return (array && array.length && values && values.length) ? basePullAll(array, values) : array; } function pullAllBy(array, values, iteratee) { return (array && array.length && values && values.length) ? basePullAll(array, values, getIteratee(iteratee, 2)) : array; } function pullAllWith(array, values, comparator) { return (array && array.length && values && values.length) ? basePullAll(array, values, undefined$1, comparator) : array; } var pullAt = flatRest(function(array, indexes) { var length = array == null ? 0 : array.length, result = baseAt(array, indexes); basePullAt(array, arrayMap(indexes, function(index) { return isIndex(index, length) ? +index : index; }).sort(compareAscending)); return result; }); function remove(array, predicate) { var result = []; if (!(array && array.length)) { return result; } var index = -1, indexes = [], length = array.length; predicate = getIteratee(predicate, 3); while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result.push(value); indexes.push(index); } } basePullAt(array, indexes); return result; } function reverse(array) { return array == null ? array : nativeReverse.call(array); } function slice(array, start, end) { var length = array == null ? 0 : array.length; if (!length) { return []; } if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { start = 0; end = length; } else { start = start == null ? 0 : toInteger(start); end = end === undefined$1 ? length : toInteger(end); } return baseSlice(array, start, end); } function sortedIndex(array, value) { return baseSortedIndex(array, value); } function sortedIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); } function sortedIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { var index = baseSortedIndex(array, value); if (index < length && eq(array[index], value)) { return index; } } return -1; } function sortedLastIndex(array, value) { return baseSortedIndex(array, value, true); } function sortedLastIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); } function sortedLastIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { var index = baseSortedIndex(array, value, true) - 1; if (eq(array[index], value)) { return index; } } return -1; } function sortedUniq(array) { return (array && array.length) ? baseSortedUniq(array) : []; } function sortedUniqBy(array, iteratee) { return (array && array.length) ? baseSortedUniq(array, getIteratee(iteratee, 2)) : []; } function tail(array) { var length = array == null ? 0 : array.length; return length ? baseSlice(array, 1, length) : []; } function take(array, n, guard) { if (!(array && array.length)) { return []; } n = (guard || n === undefined$1) ? 1 : toInteger(n); return baseSlice(array, 0, n < 0 ? 0 : n); } function takeRight(array, n, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n = (guard || n === undefined$1) ? 1 : toInteger(n); n = length - n; return baseSlice(array, n < 0 ? 0 : n, length); } function takeRightWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; } function takeWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3)) : []; } var union = baseRest(function(arrays) { return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); }); var unionBy = baseRest(function(arrays) { var iteratee = last(arrays); if (isArrayLikeObject(iteratee)) { iteratee = undefined$1; } return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); }); var unionWith = baseRest(function(arrays) { var comparator = last(arrays); comparator = typeof comparator == 'function' ? comparator : undefined$1; return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined$1, comparator); }); function uniq(array) { return (array && array.length) ? baseUniq(array) : []; } function uniqBy(array, iteratee) { return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; } function uniqWith(array, comparator) { comparator = typeof comparator == 'function' ? comparator : undefined$1; return (array && array.length) ? baseUniq(array, undefined$1, comparator) : []; } function unzip(array) { if (!(array && array.length)) { return []; } var length = 0; array = arrayFilter(array, function(group) { if (isArrayLikeObject(group)) { length = nativeMax(group.length, length); return true; } }); return baseTimes(length, function(index) { return arrayMap(array, baseProperty(index)); }); } function unzipWith(array, iteratee) { if (!(array && array.length)) { return []; } var result = unzip(array); if (iteratee == null) { return result; } return arrayMap(result, function(group) { return apply(iteratee, undefined$1, group); }); } var without = baseRest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, values) : []; }); var xor = baseRest(function(arrays) { return baseXor(arrayFilter(arrays, isArrayLikeObject)); }); var xorBy = baseRest(function(arrays) { var iteratee = last(arrays); if (isArrayLikeObject(iteratee)) { iteratee = undefined$1; } return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); }); var xorWith = baseRest(function(arrays) { var comparator = last(arrays); comparator = typeof comparator == 'function' ? comparator : undefined$1; return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined$1, comparator); }); var zip = baseRest(unzip); function zipObject(props, values) { return baseZipObject(props || [], values || [], assignValue); } function zipObjectDeep(props, values) { return baseZipObject(props || [], values || [], baseSet); } var zipWith = baseRest(function(arrays) { var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : undefined$1; iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined$1; return unzipWith(arrays, iteratee); }); function chain(value) { var result = lodash(value); result.__chain__ = true; return result; } function tap(value, interceptor) { interceptor(value); return value; } function thru(value, interceptor) { return interceptor(value); } var wrapperAt = flatRest(function(paths) { var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { return baseAt(object, paths); }; if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { return this.thru(interceptor); } value = value.slice(start, +start + (length ? 1 : 0)); value.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined$1 }); return new LodashWrapper(value, this.__chain__).thru(function(array) { if (length && !array.length) { array.push(undefined$1); } return array; }); }); function wrapperChain() { return chain(this); } function wrapperCommit() { return new LodashWrapper(this.value(), this.__chain__); } function wrapperNext() { if (this.__values__ === undefined$1) { this.__values__ = toArray(this.value()); } var done = this.__index__ >= this.__values__.length, value = done ? undefined$1 : this.__values__[this.__index__++]; return { 'done': done, 'value': value }; } function wrapperToIterator() { return this; } function wrapperPlant(value) { var result, parent = this; while (parent instanceof baseLodash) { var clone = wrapperClone(parent); clone.__index__ = 0; clone.__values__ = undefined$1; if (result) { previous.__wrapped__ = clone; } else { result = clone; } var previous = clone; parent = parent.__wrapped__; } previous.__wrapped__ = value; return result; } function wrapperReverse() { var value = this.__wrapped__; if (value instanceof LazyWrapper) { var wrapped = value; if (this.__actions__.length) { wrapped = new LazyWrapper(this); } wrapped = wrapped.reverse(); wrapped.__actions__.push({ 'func': thru, 'args': [reverse], 'thisArg': undefined$1 }); return new LodashWrapper(wrapped, this.__chain__); } return this.thru(reverse); } function wrapperValue() { return baseWrapperValue(this.__wrapped__, this.__actions__); } var countBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { ++result[key]; } else { baseAssignValue(result, key, 1); } }); function every(collection, predicate, guard) { var func = isArray(collection) ? arrayEvery : baseEvery; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined$1; } return func(collection, getIteratee(predicate, 3)); } function filter(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; return func(collection, getIteratee(predicate, 3)); } var find = createFind(findIndex); var findLast = createFind(findLastIndex); function flatMap(collection, iteratee) { return baseFlatten(map(collection, iteratee), 1); } function flatMapDeep(collection, iteratee) { return baseFlatten(map(collection, iteratee), INFINITY); } function flatMapDepth(collection, iteratee, depth) { depth = depth === undefined$1 ? 1 : toInteger(depth); return baseFlatten(map(collection, iteratee), depth); } function forEach(collection, iteratee) { var func = isArray(collection) ? arrayEach : baseEach; return func(collection, getIteratee(iteratee, 3)); } function forEachRight(collection, iteratee) { var func = isArray(collection) ? arrayEachRight : baseEachRight; return func(collection, getIteratee(iteratee, 3)); } var groupBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { result[key].push(value); } else { baseAssignValue(result, key, [value]); } }); function includes(collection, value, fromIndex, guard) { collection = isArrayLike(collection) ? collection : values(collection); fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; var length = collection.length; if (fromIndex < 0) { fromIndex = nativeMax(length + fromIndex, 0); } return isString(collection) ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) : (!!length && baseIndexOf(collection, value, fromIndex) > -1); } var invokeMap = baseRest(function(collection, path, args) { var index = -1, isFunc = typeof path == 'function', result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value) { result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); }); return result; }); var keyBy = createAggregator(function(result, value, key) { baseAssignValue(result, key, value); }); function map(collection, iteratee) { var func = isArray(collection) ? arrayMap : baseMap; return func(collection, getIteratee(iteratee, 3)); } function orderBy(collection, iteratees, orders, guard) { if (collection == null) { return []; } if (!isArray(iteratees)) { iteratees = iteratees == null ? [] : [iteratees]; } orders = guard ? undefined$1 : orders; if (!isArray(orders)) { orders = orders == null ? [] : [orders]; } return baseOrderBy(collection, iteratees, orders); } var partition = createAggregator(function(result, value, key) { result[key ? 0 : 1].push(value); }, function() { return [[], []]; }); function reduce(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); } function reduceRight(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); } function reject(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; return func(collection, negate(getIteratee(predicate, 3))); } function sample(collection) { var func = isArray(collection) ? arraySample : baseSample; return func(collection); } function sampleSize(collection, n, guard) { if ((guard ? isIterateeCall(collection, n, guard) : n === undefined$1)) { n = 1; } else { n = toInteger(n); } var func = isArray(collection) ? arraySampleSize : baseSampleSize; return func(collection, n); } function shuffle(collection) { var func = isArray(collection) ? arrayShuffle : baseShuffle; return func(collection); } function size(collection) { if (collection == null) { return 0; } if (isArrayLike(collection)) { return isString(collection) ? stringSize(collection) : collection.length; } var tag = getTag(collection); if (tag == mapTag || tag == setTag) { return collection.size; } return baseKeys(collection).length; } function some(collection, predicate, guard) { var func = isArray(collection) ? arraySome : baseSome; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined$1; } return func(collection, getIteratee(predicate, 3)); } var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { return []; } var length = iteratees.length; if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { iteratees = []; } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees = [iteratees[0]]; } return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); var now = ctxNow || function() { return root.Date.now(); }; function after(n, func) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n < 1) { return func.apply(this, arguments); } }; } function ary(func, n, guard) { n = guard ? undefined$1 : n; n = (func && n == null) ? func.length : n; return createWrap(func, WRAP_ARY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, n); } function before(n, func) { var result; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n > 0) { result = func.apply(this, arguments); } if (n <= 1) { func = undefined$1; } return result; }; } var bind = baseRest(function(func, thisArg, partials) { var bitmask = WRAP_BIND_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bind)); bitmask |= WRAP_PARTIAL_FLAG; } return createWrap(func, bitmask, thisArg, partials, holders); }); var bindKey = baseRest(function(object, key, partials) { var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bindKey)); bitmask |= WRAP_PARTIAL_FLAG; } return createWrap(key, bitmask, object, partials, holders); }); function curry(func, arity, guard) { arity = guard ? undefined$1 : arity; var result = createWrap(func, WRAP_CURRY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity); result.placeholder = curry.placeholder; return result; } function curryRight(func, arity, guard) { arity = guard ? undefined$1 : arity; var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity); result.placeholder = curryRight.placeholder; return result; } function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; maxing = 'maxWait' in options; maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = undefined$1; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { lastInvokeTime = time; timerId = setTimeout(timerExpired, wait); return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; return (lastCallTime === undefined$1 || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { var time = now(); if (shouldInvoke(time)) { return trailingEdge(time); } timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = undefined$1; if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined$1; return result; } function cancel() { if (timerId !== undefined$1) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined$1; } function flush() { return timerId === undefined$1 ? result : trailingEdge(now()); } function debounced() { var time = now(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined$1) { return leadingEdge(lastCallTime); } if (maxing) { clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined$1) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } var defer = baseRest(function(func, args) { return baseDelay(func, 1, args); }); var delay = baseRest(function(func, wait, args) { return baseDelay(func, toNumber(wait) || 0, args); }); function flip(func) { return createWrap(func, WRAP_FLIP_FLAG); } function memoize(func, resolver) { if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result) || cache; return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } memoize.Cache = MapCache; function negate(predicate) { if (typeof predicate != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return function() { var args = arguments; switch (args.length) { case 0: return !predicate.call(this); case 1: return !predicate.call(this, args[0]); case 2: return !predicate.call(this, args[0], args[1]); case 3: return !predicate.call(this, args[0], args[1], args[2]); } return !predicate.apply(this, args); }; } function once(func) { return before(2, func); } var overArgs = castRest(function(func, transforms) { transforms = (transforms.length == 1 && isArray(transforms[0])) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); var funcsLength = transforms.length; return baseRest(function(args) { var index = -1, length = nativeMin(args.length, funcsLength); while (++index < length) { args[index] = transforms[index].call(this, args[index]); } return apply(func, this, args); }); }); var partial = baseRest(function(func, partials) { var holders = replaceHolders(partials, getHolder(partial)); return createWrap(func, WRAP_PARTIAL_FLAG, undefined$1, partials, holders); }); var partialRight = baseRest(function(func, partials) { var holders = replaceHolders(partials, getHolder(partialRight)); return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined$1, partials, holders); }); var rearg = flatRest(function(func, indexes) { return createWrap(func, WRAP_REARG_FLAG, undefined$1, undefined$1, undefined$1, indexes); }); function rest(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } start = start === undefined$1 ? start : toInteger(start); return baseRest(func, start); } function spread(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } start = start == null ? 0 : nativeMax(toInteger(start), 0); return baseRest(function(args) { var array = args[start], otherArgs = castSlice(args, 0, start); if (array) { arrayPush(otherArgs, array); } return apply(func, this, otherArgs); }); } function throttle(func, wait, options) { var leading = true, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (isObject(options)) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); } function unary(func) { return ary(func, 1); } function wrap(value, wrapper) { return partial(castFunction(wrapper), value); } function castArray() { if (!arguments.length) { return []; } var value = arguments[0]; return isArray(value) ? value : [value]; } function clone(value) { return baseClone(value, CLONE_SYMBOLS_FLAG); } function cloneWith(value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined$1; return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); } function cloneDeep(value) { return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); } function cloneDeepWith(value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined$1; return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); } function conformsTo(object, source) { return source == null || baseConformsTo(object, source, keys(source)); } function eq(value, other) { return value === other || (value !== value && other !== other); } var gt = createRelationalOperation(baseGt); var gte = createRelationalOperation(function(value, other) { return value >= other; }); var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; var isArray = Array.isArray; var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } function isBoolean(value) { return value === true || value === false || (isObjectLike(value) && baseGetTag(value) == boolTag); } var isBuffer = nativeIsBuffer || stubFalse; var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; function isElement(value) { return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); } function isEmpty(value) { if (value == null) { return true; } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); if (tag == mapTag || tag == setTag) { return !value.size; } if (isPrototype(value)) { return !baseKeys(value).length; } for (var key in value) { if (hasOwnProperty.call(value, key)) { return false; } } return true; } function isEqual(value, other) { return baseIsEqual(value, other); } function isEqualWith(value, other, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined$1; var result = customizer ? customizer(value, other) : undefined$1; return result === undefined$1 ? baseIsEqual(value, other, undefined$1, customizer) : !!result; } function isError(value) { if (!isObjectLike(value)) { return false; } var tag = baseGetTag(value); return tag == errorTag || tag == domExcTag || (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); } function isFinite(value) { return typeof value == 'number' && nativeIsFinite(value); } function isFunction(value) { if (!isObject(value)) { return false; } var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } function isInteger(value) { return typeof value == 'number' && value == toInteger(value); } function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } function isObjectLike(value) { return value != null && typeof value == 'object'; } var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; function isMatch(object, source) { return object === source || baseIsMatch(object, source, getMatchData(source)); } function isMatchWith(object, source, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined$1; return baseIsMatch(object, source, getMatchData(source), customizer); } function isNaN(value) { return isNumber(value) && value != +value; } function isNative(value) { if (isMaskable(value)) { throw new Error(CORE_ERROR_TEXT); } return baseIsNative(value); } function isNull(value) { return value === null; } function isNil(value) { return value == null; } function isNumber(value) { return typeof value == 'number' || (isObjectLike(value) && baseGetTag(value) == numberTag); } function isPlainObject(value) { if (!isObjectLike(value) || baseGetTag(value) != objectTag) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; function isSafeInteger(value) { return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; } var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; function isString(value) { return typeof value == 'string' || (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && baseGetTag(value) == symbolTag); } var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; function isUndefined(value) { return value === undefined$1; } function isWeakMap(value) { return isObjectLike(value) && getTag(value) == weakMapTag; } function isWeakSet(value) { return isObjectLike(value) && baseGetTag(value) == weakSetTag; } var lt = createRelationalOperation(baseLt); var lte = createRelationalOperation(function(value, other) { return value <= other; }); function toArray(value) { if (!value) { return []; } if (isArrayLike(value)) { return isString(value) ? stringToArray(value) : copyArray(value); } if (symIterator && value[symIterator]) { return iteratorToArray(value[symIterator]()); } var tag = getTag(value), func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); return func(value); } function toFinite(value) { if (!value) { return value === 0 ? value : 0; } value = toNumber(value); if (value === INFINITY || value === -INFINITY) { var sign = (value < 0 ? -1 : 1); return sign * MAX_INTEGER; } return value === value ? value : 0; } function toInteger(value) { var result = toFinite(value), remainder = result % 1; return result === result ? (remainder ? result - remainder : result) : 0; } function toLength(value) { return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; } function toNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } if (isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = baseTrim(value); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } function toPlainObject(value) { return copyObject(value, keysIn(value)); } function toSafeInteger(value) { return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : (value === 0 ? value : 0); } function toString(value) { return value == null ? '' : baseToString(value); } var assign = createAssigner(function(object, source) { if (isPrototype(source) || isArrayLike(source)) { copyObject(source, keys(source), object); return; } for (var key in source) { if (hasOwnProperty.call(source, key)) { assignValue(object, key, source[key]); } } }); var assignIn = createAssigner(function(object, source) { copyObject(source, keysIn(source), object); }); var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { copyObject(source, keysIn(source), object, customizer); }); var assignWith = createAssigner(function(object, source, srcIndex, customizer) { copyObject(source, keys(source), object, customizer); }); var at = flatRest(baseAt); function create(prototype, properties) { var result = baseCreate(prototype); return properties == null ? result : baseAssign(result, properties); } var defaults = baseRest(function(object, sources) { object = Object(object); var index = -1; var length = sources.length; var guard = length > 2 ? sources[2] : undefined$1; if (guard && isIterateeCall(sources[0], sources[1], guard)) { length = 1; } while (++index < length) { var source = sources[index]; var props = keysIn(source); var propsIndex = -1; var propsLength = props.length; while (++propsIndex < propsLength) { var key = props[propsIndex]; var value = object[key]; if (value === undefined$1 || (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { object[key] = source[key]; } } } return object; }); var defaultsDeep = baseRest(function(args) { args.push(undefined$1, customDefaultsMerge); return apply(mergeWith, undefined$1, args); }); function findKey(object, predicate) { return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); } function findLastKey(object, predicate) { return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); } function forIn(object, iteratee) { return object == null ? object : baseFor(object, getIteratee(iteratee, 3), keysIn); } function forInRight(object, iteratee) { return object == null ? object : baseForRight(object, getIteratee(iteratee, 3), keysIn); } function forOwn(object, iteratee) { return object && baseForOwn(object, getIteratee(iteratee, 3)); } function forOwnRight(object, iteratee) { return object && baseForOwnRight(object, getIteratee(iteratee, 3)); } function functions(object) { return object == null ? [] : baseFunctions(object, keys(object)); } function functionsIn(object) { return object == null ? [] : baseFunctions(object, keysIn(object)); } function get(object, path, defaultValue) { var result = object == null ? undefined$1 : baseGet(object, path); return result === undefined$1 ? defaultValue : result; } function has(object, path) { return object != null && hasPath(object, path, baseHas); } function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } var invert = createInverter(function(result, value, key) { if (value != null && typeof value.toString != 'function') { value = nativeObjectToString.call(value); } result[value] = key; }, constant(identity)); var invertBy = createInverter(function(result, value, key) { if (value != null && typeof value.toString != 'function') { value = nativeObjectToString.call(value); } if (hasOwnProperty.call(result, value)) { result[value].push(key); } else { result[value] = [key]; } }, getIteratee); var invoke = baseRest(baseInvoke); function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } function keysIn(object) { return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } function mapKeys(object, iteratee) { var result = {}; iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { baseAssignValue(result, iteratee(value, key, object), value); }); return result; } function mapValues(object, iteratee) { var result = {}; iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { baseAssignValue(result, key, iteratee(value, key, object)); }); return result; } var merge = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { baseMerge(object, source, srcIndex, customizer); }); var omit = flatRest(function(object, paths) { var result = {}; if (object == null) { return result; } var isDeep = false; paths = arrayMap(paths, function(path) { path = castPath(path, object); isDeep || (isDeep = path.length > 1); return path; }); copyObject(object, getAllKeysIn(object), result); if (isDeep) { result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); } var length = paths.length; while (length--) { baseUnset(result, paths[length]); } return result; }); function omitBy(object, predicate) { return pickBy(object, negate(getIteratee(predicate))); } var pick = flatRest(function(object, paths) { return object == null ? {} : basePick(object, paths); }); function pickBy(object, predicate) { if (object == null) { return {}; } var props = arrayMap(getAllKeysIn(object), function(prop) { return [prop]; }); predicate = getIteratee(predicate); return basePickBy(object, props, function(value, path) { return predicate(value, path[0]); }); } function result(object, path, defaultValue) { path = castPath(path, object); var index = -1, length = path.length; if (!length) { length = 1; object = undefined$1; } while (++index < length) { var value = object == null ? undefined$1 : object[toKey(path[index])]; if (value === undefined$1) { index = length; value = defaultValue; } object = isFunction(value) ? value.call(object) : value; } return object; } function set(object, path, value) { return object == null ? object : baseSet(object, path, value); } function setWith(object, path, value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined$1; return object == null ? object : baseSet(object, path, value, customizer); } var toPairs = createToPairs(keys); var toPairsIn = createToPairs(keysIn); function transform(object, iteratee, accumulator) { var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); iteratee = getIteratee(iteratee, 4); if (accumulator == null) { var Ctor = object && object.constructor; if (isArrLike) { accumulator = isArr ? new Ctor : []; } else if (isObject(object)) { accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; } else { accumulator = {}; } } (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { return iteratee(accumulator, value, index, object); }); return accumulator; } function unset(object, path) { return object == null ? true : baseUnset(object, path); } function update(object, path, updater) { return object == null ? object : baseUpdate(object, path, castFunction(updater)); } function updateWith(object, path, updater, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined$1; return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); } function values(object) { return object == null ? [] : baseValues(object, keys(object)); } function valuesIn(object) { return object == null ? [] : baseValues(object, keysIn(object)); } function clamp(number, lower, upper) { if (upper === undefined$1) { upper = lower; lower = undefined$1; } if (upper !== undefined$1) { upper = toNumber(upper); upper = upper === upper ? upper : 0; } if (lower !== undefined$1) { lower = toNumber(lower); lower = lower === lower ? lower : 0; } return baseClamp(toNumber(number), lower, upper); } function inRange(number, start, end) { start = toFinite(start); if (end === undefined$1) { end = start; start = 0; } else { end = toFinite(end); } number = toNumber(number); return baseInRange(number, start, end); } function random(lower, upper, floating) { if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { upper = floating = undefined$1; } if (floating === undefined$1) { if (typeof upper == 'boolean') { floating = upper; upper = undefined$1; } else if (typeof lower == 'boolean') { floating = lower; lower = undefined$1; } } if (lower === undefined$1 && upper === undefined$1) { lower = 0; upper = 1; } else { lower = toFinite(lower); if (upper === undefined$1) { upper = lower; lower = 0; } else { upper = toFinite(upper); } } if (lower > upper) { var temp = lower; lower = upper; upper = temp; } if (floating || lower % 1 || upper % 1) { var rand = nativeRandom(); return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); } return baseRandom(lower, upper); } var camelCase = createCompounder(function(result, word, index) { word = word.toLowerCase(); return result + (index ? capitalize(word) : word); }); function capitalize(string) { return upperFirst(toString(string).toLowerCase()); } function deburr(string) { string = toString(string); return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); } function endsWith(string, target, position) { string = toString(string); target = baseToString(target); var length = string.length; position = position === undefined$1 ? length : baseClamp(toInteger(position), 0, length); var end = position; position -= target.length; return position >= 0 && string.slice(position, end) == target; } function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; } function escapeRegExp(string) { string = toString(string); return (string && reHasRegExpChar.test(string)) ? string.replace(reRegExpChar, '\\$&') : string; } var kebabCase = createCompounder(function(result, word, index) { return result + (index ? '-' : '') + word.toLowerCase(); }); var lowerCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toLowerCase(); }); var lowerFirst = createCaseFirst('toLowerCase'); function pad(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; if (!length || strLength >= length) { return string; } var mid = (length - strLength) / 2; return ( createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars) ); } function padEnd(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; return (length && strLength < length) ? (string + createPadding(length - strLength, chars)) : string; } function padStart(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; return (length && strLength < length) ? (createPadding(length - strLength, chars) + string) : string; } function parseInt(string, radix, guard) { if (guard || radix == null) { radix = 0; } else if (radix) { radix = +radix; } return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); } function repeat(string, n, guard) { if ((guard ? isIterateeCall(string, n, guard) : n === undefined$1)) { n = 1; } else { n = toInteger(n); } return baseRepeat(toString(string), n); } function replace() { var args = arguments, string = toString(args[0]); return args.length < 3 ? string : string.replace(args[1], args[2]); } var snakeCase = createCompounder(function(result, word, index) { return result + (index ? '_' : '') + word.toLowerCase(); }); function split(string, separator, limit) { if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { separator = limit = undefined$1; } limit = limit === undefined$1 ? MAX_ARRAY_LENGTH : limit >>> 0; if (!limit) { return []; } string = toString(string); if (string && ( typeof separator == 'string' || (separator != null && !isRegExp(separator)) )) { separator = baseToString(separator); if (!separator && hasUnicode(string)) { return castSlice(stringToArray(string), 0, limit); } } return string.split(separator, limit); } var startCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + upperFirst(word); }); function startsWith(string, target, position) { string = toString(string); position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length); target = baseToString(target); return string.slice(position, position + target.length) == target; } function template(string, options, guard) { var settings = lodash.templateSettings; if (guard && isIterateeCall(string, options, guard)) { options = undefined$1; } string = toString(string); options = assignInWith({}, options, settings, customDefaultsAssignIn); var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; var reDelimiters = RegExp( (options.escape || reNoMatch).source + '|' + interpolate.source + '|' + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + (options.evaluate || reNoMatch).source + '|$' , 'g'); var sourceURL = '//# sourceURL=' + (hasOwnProperty.call(options, 'sourceURL') ? (options.sourceURL + '').replace(/\s/g, ' ') : ('lodash.templateSources[' + (++templateCounter) + ']') ) + '\n'; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { interpolateValue || (interpolateValue = esTemplateValue); source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); if (escapeValue) { isEscaping = true; source += "' +\n__e(" + escapeValue + ") +\n'"; } if (evaluateValue) { isEvaluating = true; source += "';\n" + evaluateValue + ";\n__p += '"; } if (interpolateValue) { source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; } index = offset + match.length; return match; }); source += "';\n"; var variable = hasOwnProperty.call(options, 'variable') && options.variable; if (!variable) { source = 'with (obj) {\n' + source + '\n}\n'; } else if (reForbiddenIdentifierChars.test(variable)) { throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT); } source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) .replace(reEmptyStringMiddle, '$1') .replace(reEmptyStringTrailing, '$1;'); source = 'function(' + (variable || 'obj') + ') {\n' + (variable ? '' : 'obj || (obj = {});\n' ) + "var __t, __p = ''" + (isEscaping ? ', __e = _.escape' : '' ) + (isEvaluating ? ', __j = Array.prototype.join;\n' + "function print() { __p += __j.call(arguments, '') }\n" : ';\n' ) + source + 'return __p\n}'; var result = attempt(function() { return Function(importsKeys, sourceURL + 'return ' + source) .apply(undefined$1, importsValues); }); result.source = source; if (isError(result)) { throw result; } return result; } function toLower(value) { return toString(value).toLowerCase(); } function toUpper(value) { return toString(value).toUpperCase(); } function trim(string, chars, guard) { string = toString(string); if (string && (guard || chars === undefined$1)) { return baseTrim(string); } if (!string || !(chars = baseToString(chars))) { return string; } var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; return castSlice(strSymbols, start, end).join(''); } function trimEnd(string, chars, guard) { string = toString(string); if (string && (guard || chars === undefined$1)) { return string.slice(0, trimmedEndIndex(string) + 1); } if (!string || !(chars = baseToString(chars))) { return string; } var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; return castSlice(strSymbols, 0, end).join(''); } function trimStart(string, chars, guard) { string = toString(string); if (string && (guard || chars === undefined$1)) { return string.replace(reTrimStart, ''); } if (!string || !(chars = baseToString(chars))) { return string; } var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars)); return castSlice(strSymbols, start).join(''); } function truncate(string, options) { var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; if (isObject(options)) { var separator = 'separator' in options ? options.separator : separator; length = 'length' in options ? toInteger(options.length) : length; omission = 'omission' in options ? baseToString(options.omission) : omission; } string = toString(string); var strLength = string.length; if (hasUnicode(string)) { var strSymbols = stringToArray(string); strLength = strSymbols.length; } if (length >= strLength) { return string; } var end = length - stringSize(omission); if (end < 1) { return omission; } var result = strSymbols ? castSlice(strSymbols, 0, end).join('') : string.slice(0, end); if (separator === undefined$1) { return result + omission; } if (strSymbols) { end += (result.length - end); } if (isRegExp(separator)) { if (string.slice(end).search(separator)) { var match, substring = result; if (!separator.global) { separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); } separator.lastIndex = 0; while ((match = separator.exec(substring))) { var newEnd = match.index; } result = result.slice(0, newEnd === undefined$1 ? end : newEnd); } } else if (string.indexOf(baseToString(separator), end) != end) { var index = result.lastIndexOf(separator); if (index > -1) { result = result.slice(0, index); } } return result + omission; } function unescape(string) { string = toString(string); return (string && reHasEscapedHtml.test(string)) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; } var upperCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toUpperCase(); }); var upperFirst = createCaseFirst('toUpperCase'); function words(string, pattern, guard) { string = toString(string); pattern = guard ? undefined$1 : pattern; if (pattern === undefined$1) { return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); } return string.match(pattern) || []; } var attempt = baseRest(function(func, args) { try { return apply(func, undefined$1, args); } catch (e) { return isError(e) ? e : new Error(e); } }); var bindAll = flatRest(function(object, methodNames) { arrayEach(methodNames, function(key) { key = toKey(key); baseAssignValue(object, key, bind(object[key], object)); }); return object; }); function cond(pairs) { var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee(); pairs = !length ? [] : arrayMap(pairs, function(pair) { if (typeof pair[1] != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return [toIteratee(pair[0]), pair[1]]; }); return baseRest(function(args) { var index = -1; while (++index < length) { var pair = pairs[index]; if (apply(pair[0], this, args)) { return apply(pair[1], this, args); } } }); } function conforms(source) { return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); } function constant(value) { return function() { return value; }; } function defaultTo(value, defaultValue) { return (value == null || value !== value) ? defaultValue : value; } var flow = createFlow(); var flowRight = createFlow(true); function identity(value) { return value; } function iteratee(func) { return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); } function matches(source) { return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); } function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); } var method = baseRest(function(path, args) { return function(object) { return baseInvoke(object, path, args); }; }); var methodOf = baseRest(function(object, args) { return function(path) { return baseInvoke(object, path, args); }; }); function mixin(object, source, options) { var props = keys(source), methodNames = baseFunctions(source, props); if (options == null && !(isObject(source) && (methodNames.length || !props.length))) { options = source; source = object; object = this; methodNames = baseFunctions(source, keys(source)); } var chain = !(isObject(options) && 'chain' in options) || !!options.chain, isFunc = isFunction(object); arrayEach(methodNames, function(methodName) { var func = source[methodName]; object[methodName] = func; if (isFunc) { object.prototype[methodName] = function() { var chainAll = this.__chain__; if (chain || chainAll) { var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__); actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); result.__chain__ = chainAll; return result; } return func.apply(object, arrayPush([this.value()], arguments)); }; } }); return object; } function noConflict() { if (root._ === this) { root._ = oldDash; } return this; } function noop() { } function nthArg(n) { n = toInteger(n); return baseRest(function(args) { return baseNth(args, n); }); } var over = createOver(arrayMap); var overEvery = createOver(arrayEvery); var overSome = createOver(arraySome); function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } function propertyOf(object) { return function(path) { return object == null ? undefined$1 : baseGet(object, path); }; } var range = createRange(); var rangeRight = createRange(true); function stubArray() { return []; } function stubFalse() { return false; } function stubObject() { return {}; } function stubString() { return ''; } function stubTrue() { return true; } function times(n, iteratee) { n = toInteger(n); if (n < 1 || n > MAX_SAFE_INTEGER) { return []; } var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); iteratee = getIteratee(iteratee); n -= MAX_ARRAY_LENGTH; var result = baseTimes(length, iteratee); while (++index < n) { iteratee(index); } return result; } function toPath(value) { if (isArray(value)) { return arrayMap(value, toKey); } return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); } function uniqueId(prefix) { var id = ++idCounter; return toString(prefix) + id; } var add = createMathOperation(function(augend, addend) { return augend + addend; }, 0); var ceil = createRound('ceil'); var divide = createMathOperation(function(dividend, divisor) { return dividend / divisor; }, 1); var floor = createRound('floor'); function max(array) { return (array && array.length) ? baseExtremum(array, identity, baseGt) : undefined$1; } function maxBy(array, iteratee) { return (array && array.length) ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) : undefined$1; } function mean(array) { return baseMean(array, identity); } function meanBy(array, iteratee) { return baseMean(array, getIteratee(iteratee, 2)); } function min(array) { return (array && array.length) ? baseExtremum(array, identity, baseLt) : undefined$1; } function minBy(array, iteratee) { return (array && array.length) ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) : undefined$1; } var multiply = createMathOperation(function(multiplier, multiplicand) { return multiplier * multiplicand; }, 1); var round = createRound('round'); var subtract = createMathOperation(function(minuend, subtrahend) { return minuend - subtrahend; }, 0); function sum(array) { return (array && array.length) ? baseSum(array, identity) : 0; } function sumBy(array, iteratee) { return (array && array.length) ? baseSum(array, getIteratee(iteratee, 2)) : 0; } lodash.after = after; lodash.ary = ary; lodash.assign = assign; lodash.assignIn = assignIn; lodash.assignInWith = assignInWith; lodash.assignWith = assignWith; lodash.at = at; lodash.before = before; lodash.bind = bind; lodash.bindAll = bindAll; lodash.bindKey = bindKey; lodash.castArray = castArray; lodash.chain = chain; lodash.chunk = chunk; lodash.compact = compact; lodash.concat = concat; lodash.cond = cond; lodash.conforms = conforms; lodash.constant = constant; lodash.countBy = countBy; lodash.create = create; lodash.curry = curry; lodash.curryRight = curryRight; lodash.debounce = debounce; lodash.defaults = defaults; lodash.defaultsDeep = defaultsDeep; lodash.defer = defer; lodash.delay = delay; lodash.difference = difference; lodash.differenceBy = differenceBy; lodash.differenceWith = differenceWith; lodash.drop = drop; lodash.dropRight = dropRight; lodash.dropRightWhile = dropRightWhile; lodash.dropWhile = dropWhile; lodash.fill = fill; lodash.filter = filter; lodash.flatMap = flatMap; lodash.flatMapDeep = flatMapDeep; lodash.flatMapDepth = flatMapDepth; lodash.flatten = flatten; lodash.flattenDeep = flattenDeep; lodash.flattenDepth = flattenDepth; lodash.flip = flip; lodash.flow = flow; lodash.flowRight = flowRight; lodash.fromPairs = fromPairs; lodash.functions = functions; lodash.functionsIn = functionsIn; lodash.groupBy = groupBy; lodash.initial = initial; lodash.intersection = intersection; lodash.intersectionBy = intersectionBy; lodash.intersectionWith = intersectionWith; lodash.invert = invert; lodash.invertBy = invertBy; lodash.invokeMap = invokeMap; lodash.iteratee = iteratee; lodash.keyBy = keyBy; lodash.keys = keys; lodash.keysIn = keysIn; lodash.map = map; lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; lodash.memoize = memoize; lodash.merge = merge; lodash.mergeWith = mergeWith; lodash.method = method; lodash.methodOf = methodOf; lodash.mixin = mixin; lodash.negate = negate; lodash.nthArg = nthArg; lodash.omit = omit; lodash.omitBy = omitBy; lodash.once = once; lodash.orderBy = orderBy; lodash.over = over; lodash.overArgs = overArgs; lodash.overEvery = overEvery; lodash.overSome = overSome; lodash.partial = partial; lodash.partialRight = partialRight; lodash.partition = partition; lodash.pick = pick; lodash.pickBy = pickBy; lodash.property = property; lodash.propertyOf = propertyOf; lodash.pull = pull; lodash.pullAll = pullAll; lodash.pullAllBy = pullAllBy; lodash.pullAllWith = pullAllWith; lodash.pullAt = pullAt; lodash.range = range; lodash.rangeRight = rangeRight; lodash.rearg = rearg; lodash.reject = reject; lodash.remove = remove; lodash.rest = rest; lodash.reverse = reverse; lodash.sampleSize = sampleSize; lodash.set = set; lodash.setWith = setWith; lodash.shuffle = shuffle; lodash.slice = slice; lodash.sortBy = sortBy; lodash.sortedUniq = sortedUniq; lodash.sortedUniqBy = sortedUniqBy; lodash.split = split; lodash.spread = spread; lodash.tail = tail; lodash.take = take; lodash.takeRight = takeRight; lodash.takeRightWhile = takeRightWhile; lodash.takeWhile = takeWhile; lodash.tap = tap; lodash.throttle = throttle; lodash.thru = thru; lodash.toArray = toArray; lodash.toPairs = toPairs; lodash.toPairsIn = toPairsIn; lodash.toPath = toPath; lodash.toPlainObject = toPlainObject; lodash.transform = transform; lodash.unary = unary; lodash.union = union; lodash.unionBy = unionBy; lodash.unionWith = unionWith; lodash.uniq = uniq; lodash.uniqBy = uniqBy; lodash.uniqWith = uniqWith; lodash.unset = unset; lodash.unzip = unzip; lodash.unzipWith = unzipWith; lodash.update = update; lodash.updateWith = updateWith; lodash.values = values; lodash.valuesIn = valuesIn; lodash.without = without; lodash.words = words; lodash.wrap = wrap; lodash.xor = xor; lodash.xorBy = xorBy; lodash.xorWith = xorWith; lodash.zip = zip; lodash.zipObject = zipObject; lodash.zipObjectDeep = zipObjectDeep; lodash.zipWith = zipWith; lodash.entries = toPairs; lodash.entriesIn = toPairsIn; lodash.extend = assignIn; lodash.extendWith = assignInWith; mixin(lodash, lodash); lodash.add = add; lodash.attempt = attempt; lodash.camelCase = camelCase; lodash.capitalize = capitalize; lodash.ceil = ceil; lodash.clamp = clamp; lodash.clone = clone; lodash.cloneDeep = cloneDeep; lodash.cloneDeepWith = cloneDeepWith; lodash.cloneWith = cloneWith; lodash.conformsTo = conformsTo; lodash.deburr = deburr; lodash.defaultTo = defaultTo; lodash.divide = divide; lodash.endsWith = endsWith; lodash.eq = eq; lodash.escape = escape; lodash.escapeRegExp = escapeRegExp; lodash.every = every; lodash.find = find; lodash.findIndex = findIndex; lodash.findKey = findKey; lodash.findLast = findLast; lodash.findLastIndex = findLastIndex; lodash.findLastKey = findLastKey; lodash.floor = floor; lodash.forEach = forEach; lodash.forEachRight = forEachRight; lodash.forIn = forIn; lodash.forInRight = forInRight; lodash.forOwn = forOwn; lodash.forOwnRight = forOwnRight; lodash.get = get; lodash.gt = gt; lodash.gte = gte; lodash.has = has; lodash.hasIn = hasIn; lodash.head = head; lodash.identity = identity; lodash.includes = includes; lodash.indexOf = indexOf; lodash.inRange = inRange; lodash.invoke = invoke; lodash.isArguments = isArguments; lodash.isArray = isArray; lodash.isArrayBuffer = isArrayBuffer; lodash.isArrayLike = isArrayLike; lodash.isArrayLikeObject = isArrayLikeObject; lodash.isBoolean = isBoolean; lodash.isBuffer = isBuffer; lodash.isDate = isDate; lodash.isElement = isElement; lodash.isEmpty = isEmpty; lodash.isEqual = isEqual; lodash.isEqualWith = isEqualWith; lodash.isError = isError; lodash.isFinite = isFinite; lodash.isFunction = isFunction; lodash.isInteger = isInteger; lodash.isLength = isLength; lodash.isMap = isMap; lodash.isMatch = isMatch; lodash.isMatchWith = isMatchWith; lodash.isNaN = isNaN; lodash.isNative = isNative; lodash.isNil = isNil; lodash.isNull = isNull; lodash.isNumber = isNumber; lodash.isObject = isObject; lodash.isObjectLike = isObjectLike; lodash.isPlainObject = isPlainObject; lodash.isRegExp = isRegExp; lodash.isSafeInteger = isSafeInteger; lodash.isSet = isSet; lodash.isString = isString; lodash.isSymbol = isSymbol; lodash.isTypedArray = isTypedArray; lodash.isUndefined = isUndefined; lodash.isWeakMap = isWeakMap; lodash.isWeakSet = isWeakSet; lodash.join = join; lodash.kebabCase = kebabCase; lodash.last = last; lodash.lastIndexOf = lastIndexOf; lodash.lowerCase = lowerCase; lodash.lowerFirst = lowerFirst; lodash.lt = lt; lodash.lte = lte; lodash.max = max; lodash.maxBy = maxBy; lodash.mean = mean; lodash.meanBy = meanBy; lodash.min = min; lodash.minBy = minBy; lodash.stubArray = stubArray; lodash.stubFalse = stubFalse; lodash.stubObject = stubObject; lodash.stubString = stubString; lodash.stubTrue = stubTrue; lodash.multiply = multiply; lodash.nth = nth; lodash.noConflict = noConflict; lodash.noop = noop; lodash.now = now; lodash.pad = pad; lodash.padEnd = padEnd; lodash.padStart = padStart; lodash.parseInt = parseInt; lodash.random = random; lodash.reduce = reduce; lodash.reduceRight = reduceRight; lodash.repeat = repeat; lodash.replace = replace; lodash.result = result; lodash.round = round; lodash.runInContext = runInContext; lodash.sample = sample; lodash.size = size; lodash.snakeCase = snakeCase; lodash.some = some; lodash.sortedIndex = sortedIndex; lodash.sortedIndexBy = sortedIndexBy; lodash.sortedIndexOf = sortedIndexOf; lodash.sortedLastIndex = sortedLastIndex; lodash.sortedLastIndexBy = sortedLastIndexBy; lodash.sortedLastIndexOf = sortedLastIndexOf; lodash.startCase = startCase; lodash.startsWith = startsWith; lodash.subtract = subtract; lodash.sum = sum; lodash.sumBy = sumBy; lodash.template = template; lodash.times = times; lodash.toFinite = toFinite; lodash.toInteger = toInteger; lodash.toLength = toLength; lodash.toLower = toLower; lodash.toNumber = toNumber; lodash.toSafeInteger = toSafeInteger; lodash.toString = toString; lodash.toUpper = toUpper; lodash.trim = trim; lodash.trimEnd = trimEnd; lodash.trimStart = trimStart; lodash.truncate = truncate; lodash.unescape = unescape; lodash.uniqueId = uniqueId; lodash.upperCase = upperCase; lodash.upperFirst = upperFirst; lodash.each = forEach; lodash.eachRight = forEachRight; lodash.first = head; mixin(lodash, (function() { var source = {}; baseForOwn(lodash, function(func, methodName) { if (!hasOwnProperty.call(lodash.prototype, methodName)) { source[methodName] = func; } }); return source; }()), { 'chain': false }); lodash.VERSION = VERSION; arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { lodash[methodName].placeholder = lodash; }); arrayEach(['drop', 'take'], function(methodName, index) { LazyWrapper.prototype[methodName] = function(n) { n = n === undefined$1 ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) ? new LazyWrapper(this) : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); } else { result.__views__.push({ 'size': nativeMin(n, MAX_ARRAY_LENGTH), 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); } return result; }; LazyWrapper.prototype[methodName + 'Right'] = function(n) { return this.reverse()[methodName](n).reverse(); }; }); arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; LazyWrapper.prototype[methodName] = function(iteratee) { var result = this.clone(); result.__iteratees__.push({ 'iteratee': getIteratee(iteratee, 3), 'type': type }); result.__filtered__ = result.__filtered__ || isFilter; return result; }; }); arrayEach(['head', 'last'], function(methodName, index) { var takeName = 'take' + (index ? 'Right' : ''); LazyWrapper.prototype[methodName] = function() { return this[takeName](1).value()[0]; }; }); arrayEach(['initial', 'tail'], function(methodName, index) { var dropName = 'drop' + (index ? '' : 'Right'); LazyWrapper.prototype[methodName] = function() { return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; }); LazyWrapper.prototype.compact = function() { return this.filter(identity); }; LazyWrapper.prototype.find = function(predicate) { return this.filter(predicate).head(); }; LazyWrapper.prototype.findLast = function(predicate) { return this.reverse().find(predicate); }; LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { if (typeof path == 'function') { return new LazyWrapper(this); } return this.map(function(value) { return baseInvoke(value, path, args); }); }); LazyWrapper.prototype.reject = function(predicate) { return this.filter(negate(getIteratee(predicate))); }; LazyWrapper.prototype.slice = function(start, end) { start = toInteger(start); var result = this; if (result.__filtered__ && (start > 0 || end < 0)) { return new LazyWrapper(result); } if (start < 0) { result = result.takeRight(-start); } else if (start) { result = result.drop(start); } if (end !== undefined$1) { end = toInteger(end); result = end < 0 ? result.dropRight(-end) : result.take(end - start); } return result; }; LazyWrapper.prototype.takeRightWhile = function(predicate) { return this.reverse().takeWhile(predicate).reverse(); }; LazyWrapper.prototype.toArray = function() { return this.take(MAX_ARRAY_LENGTH); }; baseForOwn(LazyWrapper.prototype, function(func, methodName) { var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], retUnwrapped = isTaker || /^find/.test(methodName); if (!lodashFunc) { return; } lodash.prototype[methodName] = function() { var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value); var interceptor = function(value) { var result = lodashFunc.apply(lodash, arrayPush([value], args)); return (isTaker && chainAll) ? result[0] : result; }; if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { isLazy = useLazy = false; } var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; if (!retUnwrapped && useLazy) { value = onlyLazy ? value : new LazyWrapper(this); var result = func.apply(value, args); result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined$1 }); return new LodashWrapper(result, chainAll); } if (isUnwrapped && onlyLazy) { return func.apply(this, args); } result = this.thru(interceptor); return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; }; }); arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', retUnwrapped = /^(?:pop|shift)$/.test(methodName); lodash.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { var value = this.value(); return func.apply(isArray(value) ? value : [], args); } return this[chainName](function(value) { return func.apply(isArray(value) ? value : [], args); }); }; }); baseForOwn(LazyWrapper.prototype, function(func, methodName) { var lodashFunc = lodash[methodName]; if (lodashFunc) { var key = lodashFunc.name + ''; if (!hasOwnProperty.call(realNames, key)) { realNames[key] = []; } realNames[key].push({ 'name': methodName, 'func': lodashFunc }); } }); realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined$1 }]; LazyWrapper.prototype.clone = lazyClone; LazyWrapper.prototype.reverse = lazyReverse; LazyWrapper.prototype.value = lazyValue; lodash.prototype.at = wrapperAt; lodash.prototype.chain = wrapperChain; lodash.prototype.commit = wrapperCommit; lodash.prototype.next = wrapperNext; lodash.prototype.plant = wrapperPlant; lodash.prototype.reverse = wrapperReverse; lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; lodash.prototype.first = lodash.prototype.head; if (symIterator) { lodash.prototype[symIterator] = wrapperToIterator; } return lodash; }); var _ = runInContext(); if (freeModule) { (freeModule.exports = _)._ = _; freeExports._ = _; } else { root._ = _; } }.call(commonjsGlobal)); }); var LIB;LIB=(()=>{var t={470:t=>{function e(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function r(t,e){for(var r,n="",o=0,i=-1,a=0,h=0;h<=t.length;++h){if(h2){var s=n.lastIndexOf("/");if(s!==n.length-1){-1===s?(n="",o=0):o=(n=n.slice(0,s)).length-1-n.lastIndexOf("/"),i=h,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=h,a=0;continue}e&&(n.length>0?n+="/..":n="..",o=2);}else n.length>0?n+="/"+t.slice(i+1,h):n=t.slice(i+1,h),o=h-i-1;i=h,a=0;}else 46===r&&-1!==a?++a:a=-1;}return n}var n={resolve:function(){for(var t,n="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a;i>=0?a=arguments[i]:(void 0===t&&(t=process.cwd()),a=t),e(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0));}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(t){if(e(t),0===t.length)return ".";var n=47===t.charCodeAt(0),o=47===t.charCodeAt(t.length-1);return 0!==(t=r(t,!n)).length||n||(t="."),t.length>0&&o&&(t+="/"),n?"/"+t:t},isAbsolute:function(t){return e(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return ".";for(var t,r=0;r0&&(void 0===t?t=o:t+="/"+o);}return void 0===t?".":n.normalize(t)},relative:function(t,r){if(e(t),e(r),t===r)return "";if((t=n.resolve(t))===(r=n.resolve(r)))return "";for(var o=1;oc){if(47===r.charCodeAt(h+u))return r.slice(h+u+1);if(0===u)return r.slice(h+u)}else a>c&&(47===t.charCodeAt(o+u)?f=u:0===u&&(f=0));break}var l=t.charCodeAt(o+u);if(l!==r.charCodeAt(h+u))break;47===l&&(f=u);}var p="";for(u=o+f+1;u<=i;++u)u!==i&&47!==t.charCodeAt(u)||(0===p.length?p+="..":p+="/..");return p.length>0?p+r.slice(h+f):(h+=f,47===r.charCodeAt(h)&&++h,r.slice(h))},_makeLong:function(t){return t},dirname:function(t){if(e(t),0===t.length)return ".";for(var r=t.charCodeAt(0),n=47===r,o=-1,i=!0,a=t.length-1;a>=1;--a)if(47===(r=t.charCodeAt(a))){if(!i){o=a;break}}else i=!1;return -1===o?n?"/":".":n&&1===o?"//":t.slice(0,o)},basename:function(t,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');e(t);var n,o=0,i=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return "";var h=r.length-1,s=-1;for(n=t.length-1;n>=0;--n){var c=t.charCodeAt(n);if(47===c){if(!a){o=n+1;break}}else -1===s&&(a=!1,s=n+1),h>=0&&(c===r.charCodeAt(h)?-1==--h&&(i=n):(h=-1,i=s));}return o===i?i=s:-1===i&&(i=t.length),t.slice(o,i)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!a){o=n+1;break}}else -1===i&&(a=!1,i=n+1);return -1===i?"":t.slice(o,i)},extname:function(t){e(t);for(var r=-1,n=0,o=-1,i=!0,a=0,h=t.length-1;h>=0;--h){var s=t.charCodeAt(h);if(47!==s)-1===o&&(i=!1,o=h+1),46===s?-1===r?r=h:1!==a&&(a=1):-1!==r&&(a=-1);else if(!i){n=h+1;break}}return -1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":t.slice(r,o)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+"/"+n:n}(0,t)},parse:function(t){e(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return r;var n,o=t.charCodeAt(0),i=47===o;i?(r.root="/",n=1):n=0;for(var a=-1,h=0,s=-1,c=!0,f=t.length-1,u=0;f>=n;--f)if(47!==(o=t.charCodeAt(f)))-1===s&&(c=!1,s=f+1),46===o?-1===a?a=f:1!==u&&(u=1):-1!==a&&(u=-1);else if(!c){h=f+1;break}return -1===a||-1===s||0===u||1===u&&a===s-1&&a===h+1?-1!==s&&(r.base=r.name=0===h&&i?t.slice(1,s):t.slice(h,s)):(0===h&&i?(r.name=t.slice(1,a),r.base=t.slice(1,s)):(r.name=t.slice(h,a),r.base=t.slice(h,s)),r.ext=t.slice(a,s)),h>0?r.dir=t.slice(0,h-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,t.exports=n;},447:(t,e,r)=>{var n;if(r.r(e),r.d(e,{URI:()=>d,Utils:()=>P}),"object"==typeof process)n="win32"===process.platform;else if("object"==typeof navigator){var o=navigator.userAgent;n=o.indexOf("Windows")>=0;}var i,a,h=(i=function(t,e){return (i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e;}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t;}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r);}),s=/^\w[\w\d+.-]*$/,c=/^\//,f=/^\/\//;function u(t,e){if(!t.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'.concat(t.authority,'", path: "').concat(t.path,'", query: "').concat(t.query,'", fragment: "').concat(t.fragment,'"}'));if(t.scheme&&!s.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path)if(t.authority){if(!c.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(f.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}var l="",p="/",g=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,d=function(){function t(t,e,r,n,o,i){void 0===i&&(i=!1),"object"==typeof t?(this.scheme=t.scheme||l,this.authority=t.authority||l,this.path=t.path||l,this.query=t.query||l,this.fragment=t.fragment||l):(this.scheme=function(t,e){return t||e?t:"file"}(t,i),this.authority=e||l,this.path=function(t,e){switch(t){case"https":case"http":case"file":e?e[0]!==p&&(e=p+e):e=p;}return e}(this.scheme,r||l),this.query=n||l,this.fragment=o||l,u(this,i));}return t.isUri=function(e){return e instanceof t||!!e&&"string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"string"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString},Object.defineProperty(t.prototype,"fsPath",{get:function(){return A(this,!1)},enumerable:!1,configurable:!0}),t.prototype.with=function(t){if(!t)return this;var e=t.scheme,r=t.authority,n=t.path,o=t.query,i=t.fragment;return void 0===e?e=this.scheme:null===e&&(e=l),void 0===r?r=this.authority:null===r&&(r=l),void 0===n?n=this.path:null===n&&(n=l),void 0===o?o=this.query:null===o&&(o=l),void 0===i?i=this.fragment:null===i&&(i=l),e===this.scheme&&r===this.authority&&n===this.path&&o===this.query&&i===this.fragment?this:new y(e,r,n,o,i)},t.parse=function(t,e){void 0===e&&(e=!1);var r=g.exec(t);return r?new y(r[2]||l,O(r[4]||l),O(r[5]||l),O(r[7]||l),O(r[9]||l),e):new y(l,l,l,l,l)},t.file=function(t){var e=l;if(n&&(t=t.replace(/\\/g,p)),t[0]===p&&t[1]===p){var r=t.indexOf(p,2);-1===r?(e=t.substring(2),t=p):(e=t.substring(2,r),t=t.substring(r)||p);}return new y("file",e,t,l,l)},t.from=function(t){var e=new y(t.scheme,t.authority,t.path,t.query,t.fragment);return u(e,!0),e},t.prototype.toString=function(t){return void 0===t&&(t=!1),w(this,t)},t.prototype.toJSON=function(){return this},t.revive=function(e){if(e){if(e instanceof t)return e;var r=new y(e);return r._formatted=e.external,r._fsPath=e._sep===v?e.fsPath:null,r}return e},t}(),v=n?1:void 0,y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._formatted=null,e._fsPath=null,e}return h(e,t),Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=A(this,!1)),this._fsPath},enumerable:!1,configurable:!0}),e.prototype.toString=function(t){return void 0===t&&(t=!1),t?w(this,!0):(this._formatted||(this._formatted=w(this,!1)),this._formatted)},e.prototype.toJSON=function(){var t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=v),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t},e}(d),m=((a={})[58]="%3A",a[47]="%2F",a[63]="%3F",a[35]="%23",a[91]="%5B",a[93]="%5D",a[64]="%40",a[33]="%21",a[36]="%24",a[38]="%26",a[39]="%27",a[40]="%28",a[41]="%29",a[42]="%2A",a[43]="%2B",a[44]="%2C",a[59]="%3B",a[61]="%3D",a[32]="%20",a);function b(t,e){for(var r=void 0,n=-1,o=0;o=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57||45===i||46===i||95===i||126===i||e&&47===i)-1!==n&&(r+=encodeURIComponent(t.substring(n,o)),n=-1),void 0!==r&&(r+=t.charAt(o));else {void 0===r&&(r=t.substr(0,o));var a=m[i];void 0!==a?(-1!==n&&(r+=encodeURIComponent(t.substring(n,o)),n=-1),r+=a):-1===n&&(n=o);}}return -1!==n&&(r+=encodeURIComponent(t.substring(n))),void 0!==r?r:t}function C(t){for(var e=void 0,r=0;r1&&"file"===t.scheme?"//".concat(t.authority).concat(t.path):47===t.path.charCodeAt(0)&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&58===t.path.charCodeAt(2)?e?t.path.substr(1):t.path[1].toLowerCase()+t.path.substr(2):t.path,n&&(r=r.replace(/\//g,"\\")),r}function w(t,e){var r=e?C:b,n="",o=t.scheme,i=t.authority,a=t.path,h=t.query,s=t.fragment;if(o&&(n+=o,n+=":"),(i||"file"===o)&&(n+=p,n+=p),i){var c=i.indexOf("@");if(-1!==c){var f=i.substr(0,c);i=i.substr(c+1),-1===(c=f.indexOf(":"))?n+=r(f,!1):(n+=r(f.substr(0,c),!1),n+=":",n+=r(f.substr(c+1),!1)),n+="@";}-1===(c=(i=i.toLowerCase()).indexOf(":"))?n+=r(i,!1):(n+=r(i.substr(0,c),!1),n+=i.substr(c));}if(a){if(a.length>=3&&47===a.charCodeAt(0)&&58===a.charCodeAt(2))(u=a.charCodeAt(1))>=65&&u<=90&&(a="/".concat(String.fromCharCode(u+32),":").concat(a.substr(3)));else if(a.length>=2&&58===a.charCodeAt(1)){var u;(u=a.charCodeAt(0))>=65&&u<=90&&(a="".concat(String.fromCharCode(u+32),":").concat(a.substr(2)));}n+=r(a,!0);}return h&&(n+="?",n+=r(h,!1)),s&&(n+="#",n+=e?s:b(s,!1)),n}function x(t){try{return decodeURIComponent(t)}catch(e){return t.length>3?t.substr(0,3)+x(t.substr(3)):t}}var _=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function O(t){return t.match(_)?t.replace(_,(function(t){return x(t)})):t}var P,j=r(470),U=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]});},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0});},r(447)})();const{URI: URI$1,Utils}=LIB; var esm = /*#__PURE__*/Object.freeze({ __proto__: null, URI: URI$1, Utils: Utils }); var vscode_uri_1 = /*@__PURE__*/getAugmentedNamespace(esm); var utils$4 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.returnObjectIfHasKeys = exports.possiblyComponent = exports.getIndent = exports.filterAsync = exports.modifyLines = exports.getRegExpMatches = exports.regexIndexOf = exports.regexLastIndexOf = exports.debounceThrottle = exports.debounceSameArg = exports.isNotNullOrUndefined = exports.isPositionEqual = exports.isBeforeOrEqualToPosition = exports.moveRangeStartToEndIfNecessary = exports.swapRangeStartEndIfNecessary = exports.isRangeStartAfterEnd = exports.isZeroLengthRange = exports.isInRange = exports.passMap = exports.flatten = exports.getLastPartOfPath = exports.normalizeUri = exports.normalizePath = exports.pathToUrl = exports.urlToPath = exports.clamp = exports.unique = exports.and = exports.or = exports.not = void 0; function not(predicate) { return (x) => !predicate(x); } exports.not = not; function or(...predicates) { return (x) => predicates.some((predicate) => predicate(x)); } exports.or = or; function and(...predicates) { return (x) => predicates.every((predicate) => predicate(x)); } exports.and = and; function unique(array) { return (0, lodash.uniqWith)(array, lodash.isEqual); } exports.unique = unique; function clamp(num, min, max) { return Math.max(min, Math.min(max, num)); } exports.clamp = clamp; function urlToPath(stringUrl) { const url = vscode_uri_1.URI.parse(stringUrl); if (url.scheme !== 'file') { return null; } return url.fsPath.replace(/\\/g, '/'); } exports.urlToPath = urlToPath; function pathToUrl(path) { return vscode_uri_1.URI.file(path).toString(); } exports.pathToUrl = pathToUrl; function normalizePath(path) { return vscode_uri_1.URI.file(path).fsPath.replace(/\\/g, '/'); } exports.normalizePath = normalizePath; function normalizeUri(uri) { return vscode_uri_1.URI.parse(uri).toString(); } exports.normalizeUri = normalizeUri; function getLastPartOfPath(path) { return path.replace(/\\/g, '/').split('/').pop() || ''; } exports.getLastPartOfPath = getLastPartOfPath; function flatten(arr) { return arr.reduce((all, item) => (Array.isArray(item) ? [...all, ...item] : [...all, item]), []); } exports.flatten = flatten; function passMap(array, mapper) { return array.map((x) => { const mapped = mapper(x); return mapped === undefined ? x : mapped; }); } exports.passMap = passMap; function isInRange(range, positionToTest) { return (isBeforeOrEqualToPosition(range.end, positionToTest) && isBeforeOrEqualToPosition(positionToTest, range.start)); } exports.isInRange = isInRange; function isZeroLengthRange(range) { return isPositionEqual(range.start, range.end); } exports.isZeroLengthRange = isZeroLengthRange; function isRangeStartAfterEnd(range) { return (range.end.line < range.start.line || (range.end.line === range.start.line && range.end.character < range.start.character)); } exports.isRangeStartAfterEnd = isRangeStartAfterEnd; function swapRangeStartEndIfNecessary(range) { if (isRangeStartAfterEnd(range)) { const start = range.start; range.start = range.end; range.end = start; } return range; } exports.swapRangeStartEndIfNecessary = swapRangeStartEndIfNecessary; function moveRangeStartToEndIfNecessary(range) { if (isRangeStartAfterEnd(range)) { range.start = range.end; } return range; } exports.moveRangeStartToEndIfNecessary = moveRangeStartToEndIfNecessary; function isBeforeOrEqualToPosition(position, positionToTest) { return (positionToTest.line < position.line || (positionToTest.line === position.line && positionToTest.character <= position.character)); } exports.isBeforeOrEqualToPosition = isBeforeOrEqualToPosition; function isPositionEqual(position1, position2) { return position1.line === position2.line && position1.character === position2.character; } exports.isPositionEqual = isPositionEqual; function isNotNullOrUndefined(val) { return val !== undefined && val !== null; } exports.isNotNullOrUndefined = isNotNullOrUndefined; function debounceSameArg(fn, shouldCancelPrevious, miliseconds) { let timeout; let prevArg; return (arg) => { if (shouldCancelPrevious(arg, prevArg)) { clearTimeout(timeout); } prevArg = arg; timeout = setTimeout(() => { fn(arg); prevArg = undefined; }, miliseconds); }; } exports.debounceSameArg = debounceSameArg; function debounceThrottle(fn, miliseconds) { let timeout; let lastInvocation = Date.now() - miliseconds; function maybeCall(...args) { clearTimeout(timeout); timeout = setTimeout(() => { if (Date.now() - lastInvocation < miliseconds) { maybeCall(...args); return; } fn(...args); lastInvocation = Date.now(); }, miliseconds); } return maybeCall; } exports.debounceThrottle = debounceThrottle; function regexLastIndexOf(text, regex, endPos) { if (endPos === undefined) { endPos = text.length; } else if (endPos < 0) { endPos = 0; } const stringToWorkWith = text.substring(0, endPos + 1); let lastIndexOf = -1; let result = null; while ((result = regex.exec(stringToWorkWith)) !== null) { lastIndexOf = result.index; } return lastIndexOf; } exports.regexLastIndexOf = regexLastIndexOf; function regexIndexOf(text, regex, startPos) { var _a; if (startPos === undefined || startPos < 0) { startPos = 0; } const stringToWorkWith = text.substring(startPos); const result = regex.exec(stringToWorkWith); return (_a = result === null || result === void 0 ? void 0 : result.index) !== null && _a !== void 0 ? _a : -1; } exports.regexIndexOf = regexIndexOf; function getRegExpMatches(regex, str) { const matches = []; let match; while ((match = regex.exec(str))) { matches.push(match); } return matches; } exports.getRegExpMatches = getRegExpMatches; function modifyLines(text, replacementFn) { let idx = 0; return text .split('\r\n') .map((l1) => l1 .split('\n') .map((line) => replacementFn(line, idx++)) .join('\n')) .join('\r\n'); } exports.modifyLines = modifyLines; async function filterAsync(array, predicate) { const fail = Symbol(); return (await Promise.all(array.map(async (item, idx) => ((await predicate(item, idx)) ? item : fail)))).filter((i) => i !== fail); } exports.filterAsync = filterAsync; function getIndent(text) { var _a, _b; return (_b = (_a = /^[ |\t]+/.exec(text)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : ''; } exports.getIndent = getIndent; function possiblyComponent(node) { var _a; return !!((_a = node.tag) === null || _a === void 0 ? void 0 : _a[0].match(/[A-Z]/)); } exports.possiblyComponent = possiblyComponent; function returnObjectIfHasKeys(obj) { if (Object.keys(obj || {}).length > 0) { return obj; } } exports.returnObjectIfHasKeys = returnObjectIfHasKeys; }); getDefaultExportFromCjs(utils$4); var DocumentManager_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DocumentManager = void 0; class DocumentManager { constructor(createDocument) { this.createDocument = createDocument; this.emitter = new events_1__default['default'].EventEmitter(); this.openedInClient = new Set(); this.documents = new Map(); this.locked = new Set(); this.deleteCandidates = new Set(); } openDocument(textDocument) { textDocument = { ...textDocument, uri: (0, utils$4.normalizeUri)(textDocument.uri) }; let document; if (this.documents.has(textDocument.uri)) { document = this.documents.get(textDocument.uri); document.setText(textDocument.text); } else { document = this.createDocument(textDocument); this.documents.set(textDocument.uri, document); this.notify('documentOpen', document); } this.notify('documentChange', document); return document; } lockDocument(uri) { this.locked.add((0, utils$4.normalizeUri)(uri)); } markAsOpenedInClient(uri) { this.openedInClient.add((0, utils$4.normalizeUri)(uri)); } getAllOpenedByClient() { return Array.from(this.documents.entries()).filter((doc) => this.openedInClient.has(doc[0])); } releaseDocument(uri) { uri = (0, utils$4.normalizeUri)(uri); this.locked.delete(uri); this.openedInClient.delete(uri); if (this.deleteCandidates.has(uri)) { this.deleteCandidates.delete(uri); this.closeDocument(uri); } } closeDocument(uri) { uri = (0, utils$4.normalizeUri)(uri); const document = this.documents.get(uri); if (!document) { throw new Error('Cannot call methods on an unopened document'); } this.notify('documentClose', document); if (!this.locked.has(uri)) { this.documents.delete(uri); } else { this.deleteCandidates.add(uri); } this.openedInClient.delete(uri); } updateDocument(textDocument, changes) { const document = this.documents.get((0, utils$4.normalizeUri)(textDocument.uri)); if (!document) { throw new Error('Cannot call methods on an unopened document'); } for (const change of changes) { let start = 0; let end = 0; if ('range' in change) { start = document.offsetAt(change.range.start); end = document.offsetAt(change.range.end); } else { end = document.getTextLength(); } document.update(change.text, start, end); } this.notify('documentChange', document); } on(name, listener) { this.emitter.on(name, listener); } get(uri) { return this.documents.get((0, utils$4.normalizeUri)(uri)); } notify(name, document) { this.emitter.emit(name, document); } } exports.DocumentManager = DocumentManager; }); getDefaultExportFromCjs(DocumentManager_1); var ral$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); var _ral; function RAL() { if (_ral === undefined) { throw new Error("No runtime abstraction layer installed"); } return _ral; } (function (RAL) { function install(ral) { if (ral === undefined) { throw new Error("No runtime abstraction layer provided"); } _ral = ral; } RAL.install = install; })(RAL || (RAL = {})); exports.default = RAL; }); getDefaultExportFromCjs(ral$1); var common = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.config = exports.loadMessageBundle = exports.localize = exports.format = exports.setPseudo = exports.isPseudo = exports.isDefined = exports.BundleFormat = exports.MessageFormat = void 0; (function (MessageFormat) { MessageFormat["file"] = "file"; MessageFormat["bundle"] = "bundle"; MessageFormat["both"] = "both"; })(exports.MessageFormat || (exports.MessageFormat = {})); (function (BundleFormat) { BundleFormat["standalone"] = "standalone"; BundleFormat["languagePack"] = "languagePack"; })(exports.BundleFormat || (exports.BundleFormat = {})); var LocalizeInfo; (function (LocalizeInfo) { function is(value) { var candidate = value; return candidate && isDefined(candidate.key) && isDefined(candidate.comment); } LocalizeInfo.is = is; })(LocalizeInfo || (LocalizeInfo = {})); function isDefined(value) { return typeof value !== 'undefined'; } exports.isDefined = isDefined; exports.isPseudo = false; function setPseudo(pseudo) { exports.isPseudo = pseudo; } exports.setPseudo = setPseudo; function format(message, args) { var result; if (exports.isPseudo) { message = '\uFF3B' + message.replace(/[aouei]/g, '$&$&') + '\uFF3D'; } if (args.length === 0) { result = message; } else { result = message.replace(/\{(\d+)\}/g, function (match, rest) { var index = rest[0]; var arg = args[index]; var replacement = match; if (typeof arg === 'string') { replacement = arg; } else if (typeof arg === 'number' || typeof arg === 'boolean' || arg === void 0 || arg === null) { replacement = String(arg); } return replacement; }); } return result; } exports.format = format; function localize(_key, message) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } return format(message, args); } exports.localize = localize; function loadMessageBundle(file) { return (0, ral$1.default)().loadMessageBundle(file); } exports.loadMessageBundle = loadMessageBundle; function config(opts) { return (0, ral$1.default)().config(opts); } exports.config = config; }); getDefaultExportFromCjs(common); var main$3 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.config = exports.loadMessageBundle = exports.BundleFormat = exports.MessageFormat = void 0; var common_2 = common; Object.defineProperty(exports, "MessageFormat", { enumerable: true, get: function () { return common_2.MessageFormat; } }); Object.defineProperty(exports, "BundleFormat", { enumerable: true, get: function () { return common_2.BundleFormat; } }); var toString = Object.prototype.toString; function isNumber(value) { return toString.call(value) === '[object Number]'; } function isString(value) { return toString.call(value) === '[object String]'; } function isBoolean(value) { return value === true || value === false; } function readJsonFileSync(filename) { return JSON.parse(fs__default['default'].readFileSync(filename, 'utf8')); } var resolvedBundles; var options; function initializeSettings() { options = { locale: undefined, language: undefined, languagePackSupport: false, cacheLanguageResolution: true, messageFormat: common.MessageFormat.bundle }; if (isString(process.env.VSCODE_NLS_CONFIG)) { try { var vscodeOptions_1 = JSON.parse(process.env.VSCODE_NLS_CONFIG); var language = void 0; if (vscodeOptions_1.availableLanguages) { var value = vscodeOptions_1.availableLanguages['*']; if (isString(value)) { language = value; } } if (isString(vscodeOptions_1.locale)) { options.locale = vscodeOptions_1.locale.toLowerCase(); } if (language === undefined) { options.language = options.locale; } else if (language !== 'en') { options.language = language; } if (isBoolean(vscodeOptions_1._languagePackSupport)) { options.languagePackSupport = vscodeOptions_1._languagePackSupport; } if (isString(vscodeOptions_1._cacheRoot)) { options.cacheRoot = vscodeOptions_1._cacheRoot; } if (isString(vscodeOptions_1._languagePackId)) { options.languagePackId = vscodeOptions_1._languagePackId; } if (isString(vscodeOptions_1._translationsConfigFile)) { options.translationsConfigFile = vscodeOptions_1._translationsConfigFile; try { options.translationsConfig = readJsonFileSync(options.translationsConfigFile); } catch (error) { if (vscodeOptions_1._corruptedFile) { var dirname = path__default['default'].dirname(vscodeOptions_1._corruptedFile); fs__default['default'].exists(dirname, function (exists) { if (exists) { fs__default['default'].writeFile(vscodeOptions_1._corruptedFile, 'corrupted', 'utf8', function (err) { console.error(err); }); } }); } } } } catch (_a) { } } (0, common.setPseudo)(options.locale === 'pseudo'); resolvedBundles = Object.create(null); } initializeSettings(); function supportsLanguagePack() { return options.languagePackSupport === true && options.cacheRoot !== undefined && options.languagePackId !== undefined && options.translationsConfigFile !== undefined && options.translationsConfig !== undefined; } function createScopedLocalizeFunction(messages) { return function (key, message) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } if (isNumber(key)) { if (key >= messages.length) { console.error("Broken localize call found. Index out of bounds. Stacktrace is\n: ".concat(new Error('').stack)); return; } return (0, common.format)(messages[key], args); } else { if (isString(message)) { console.warn("Message ".concat(message, " didn't get externalized correctly.")); return (0, common.format)(message, args); } else { console.error("Broken localize call found. Stacktrace is\n: ".concat(new Error('').stack)); } } }; } function resolveLanguage(file) { var resolvedLanguage; if (options.cacheLanguageResolution && resolvedLanguage) { resolvedLanguage = resolvedLanguage; } else { if (common.isPseudo || !options.language) { resolvedLanguage = '.nls.json'; } else { var locale = options.language; while (locale) { var candidate = '.nls.' + locale + '.json'; if (fs__default['default'].existsSync(file + candidate)) { resolvedLanguage = candidate; break; } else { var index = locale.lastIndexOf('-'); if (index > 0) { locale = locale.substring(0, index); } else { resolvedLanguage = '.nls.json'; locale = null; } } } } if (options.cacheLanguageResolution) { resolvedLanguage = resolvedLanguage; } } return file + resolvedLanguage; } function findInTheBoxBundle(root) { var language = options.language; while (language) { var candidate = path__default['default'].join(root, "nls.bundle.".concat(language, ".json")); if (fs__default['default'].existsSync(candidate)) { return candidate; } else { var index = language.lastIndexOf('-'); if (index > 0) { language = language.substring(0, index); } else { language = undefined; } } } if (language === undefined) { var candidate = path__default['default'].join(root, 'nls.bundle.json'); if (fs__default['default'].existsSync(candidate)) { return candidate; } } return undefined; } function createDefaultNlsBundle(folder) { var metaData = readJsonFileSync(path__default['default'].join(folder, 'nls.metadata.json')); var result = Object.create(null); for (var module_1 in metaData) { var entry = metaData[module_1]; result[module_1] = entry.messages; } return result; } function createNLSBundle(header, metaDataPath) { var languagePackLocation = options.translationsConfig[header.id]; if (!languagePackLocation) { return undefined; } var languagePack = readJsonFileSync(languagePackLocation).contents; var metaData = readJsonFileSync(path__default['default'].join(metaDataPath, 'nls.metadata.json')); var result = Object.create(null); for (var module_2 in metaData) { var entry = metaData[module_2]; var translations = languagePack["".concat(header.outDir, "/").concat(module_2)]; if (translations) { var resultMessages = []; for (var i = 0; i < entry.keys.length; i++) { var messageKey = entry.keys[i]; var key = isString(messageKey) ? messageKey : messageKey.key; var translatedMessage = translations[key]; if (translatedMessage === undefined) { translatedMessage = entry.messages[i]; } resultMessages.push(translatedMessage); } result[module_2] = resultMessages; } else { result[module_2] = entry.messages; } } return result; } function touch(file) { var d = new Date(); fs__default['default'].utimes(file, d, d, function () { }); } function cacheBundle(key, bundle) { resolvedBundles[key] = bundle; return bundle; } function loadNlsBundleOrCreateFromI18n(header, bundlePath) { var result; var bundle = path__default['default'].join(options.cacheRoot, "".concat(header.id, "-").concat(header.hash, ".json")); var useMemoryOnly = false; var writeBundle = false; try { result = JSON.parse(fs__default['default'].readFileSync(bundle, { encoding: 'utf8', flag: 'r' })); touch(bundle); return result; } catch (err) { if (err.code === 'ENOENT') { writeBundle = true; } else if (err instanceof SyntaxError) { console.log("Syntax error parsing message bundle: ".concat(err.message, ".")); fs__default['default'].unlink(bundle, function (err) { if (err) { console.error("Deleting corrupted bundle ".concat(bundle, " failed.")); } }); useMemoryOnly = true; } else { throw err; } } result = createNLSBundle(header, bundlePath); if (!result || useMemoryOnly) { return result; } if (writeBundle) { try { fs__default['default'].writeFileSync(bundle, JSON.stringify(result), { encoding: 'utf8', flag: 'wx' }); } catch (err) { if (err.code === 'EEXIST') { return result; } throw err; } } return result; } function loadDefaultNlsBundle(bundlePath) { try { return createDefaultNlsBundle(bundlePath); } catch (err) { console.log("Generating default bundle from meta data failed.", err); return undefined; } } function loadNlsBundle(header, bundlePath) { var result; if (supportsLanguagePack()) { try { result = loadNlsBundleOrCreateFromI18n(header, bundlePath); } catch (err) { console.log("Load or create bundle failed ", err); } } if (!result) { if (options.languagePackSupport) { return loadDefaultNlsBundle(bundlePath); } var candidate = findInTheBoxBundle(bundlePath); if (candidate) { try { return readJsonFileSync(candidate); } catch (err) { console.log("Loading in the box message bundle failed.", err); } } result = loadDefaultNlsBundle(bundlePath); } return result; } function tryFindMetaDataHeaderFile(file) { var result; var dirname = path__default['default'].dirname(file); while (true) { result = path__default['default'].join(dirname, 'nls.metadata.header.json'); if (fs__default['default'].existsSync(result)) { break; } var parent = path__default['default'].dirname(dirname); if (parent === dirname) { result = undefined; break; } else { dirname = parent; } } return result; } function loadMessageBundle(file) { if (!file) { return common.localize; } var ext = path__default['default'].extname(file); if (ext) { file = file.substr(0, file.length - ext.length); } if (options.messageFormat === common.MessageFormat.both || options.messageFormat === common.MessageFormat.bundle) { var headerFile = tryFindMetaDataHeaderFile(file); if (headerFile) { var bundlePath = path__default['default'].dirname(headerFile); var bundle = resolvedBundles[bundlePath]; if (bundle === undefined) { try { var header = JSON.parse(fs__default['default'].readFileSync(headerFile, 'utf8')); try { var nlsBundle = loadNlsBundle(header, bundlePath); bundle = cacheBundle(bundlePath, nlsBundle ? { header: header, nlsBundle: nlsBundle } : null); } catch (err) { console.error('Failed to load nls bundle', err); bundle = cacheBundle(bundlePath, null); } } catch (err) { console.error('Failed to read header file', err); bundle = cacheBundle(bundlePath, null); } } if (bundle) { var module_3 = file.substr(bundlePath.length + 1).replace(/\\/g, '/'); var messages = bundle.nlsBundle[module_3]; if (messages === undefined) { console.error("Messages for file ".concat(file, " not found. See console for details.")); return function () { return 'Messages not found.'; }; } return createScopedLocalizeFunction(messages); } } } if (options.messageFormat === common.MessageFormat.both || options.messageFormat === common.MessageFormat.file) { try { var json = readJsonFileSync(resolveLanguage(file)); if (Array.isArray(json)) { return createScopedLocalizeFunction(json); } else { if ((0, common.isDefined)(json.messages) && (0, common.isDefined)(json.keys)) { return createScopedLocalizeFunction(json.messages); } else { console.error("String bundle '".concat(file, "' uses an unsupported format.")); return function () { return 'File bundle has unsupported format. See console for details'; }; } } } catch (err) { if (err.code !== 'ENOENT') { console.error('Failed to load single file bundle', err); } } } console.error("Failed to load message bundle for file ".concat(file)); return function () { return 'Failed to load message bundle. See console for details.'; }; } exports.loadMessageBundle = loadMessageBundle; function config(opts) { if (opts) { if (isString(opts.locale)) { options.locale = opts.locale.toLowerCase(); options.language = options.locale; resolvedBundles = Object.create(null); } if (opts.messageFormat !== undefined) { options.messageFormat = opts.messageFormat; } if (opts.bundleFormat === common.BundleFormat.standalone && options.languagePackSupport === true) { options.languagePackSupport = false; } } (0, common.setPseudo)(options.locale === 'pseudo'); return loadMessageBundle; } exports.config = config; ral$1.default.install(Object.freeze({ loadMessageBundle: loadMessageBundle, config: config })); }); getDefaultExportFromCjs(main$3); var integer; (function (integer) { integer.MIN_VALUE = -2147483648; integer.MAX_VALUE = 2147483647; })(integer || (integer = {})); var uinteger; (function (uinteger) { uinteger.MIN_VALUE = 0; uinteger.MAX_VALUE = 2147483647; })(uinteger || (uinteger = {})); var Position; (function (Position) { function create(line, character) { if (line === Number.MAX_VALUE) { line = uinteger.MAX_VALUE; } if (character === Number.MAX_VALUE) { character = uinteger.MAX_VALUE; } return { line: line, character: character }; } Position.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); } Position.is = is; })(Position || (Position = {})); var Range; (function (Range) { function create(one, two, three, four) { if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) { return { start: Position.create(one, two), end: Position.create(three, four) }; } else if (Position.is(one) && Position.is(two)) { return { start: one, end: two }; } else { throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]"); } } Range.create = create; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); } Range.is = is; })(Range || (Range = {})); var Location; (function (Location) { function create(uri, range) { return { uri: uri, range: range }; } Location.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); } Location.is = is; })(Location || (Location = {})); var LocationLink; (function (LocationLink) { function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange }; } LocationLink.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange)) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); } LocationLink.is = is; })(LocationLink || (LocationLink = {})); var Color; (function (Color) { function create(red, green, blue, alpha) { return { red: red, green: green, blue: blue, alpha: alpha, }; } Color.create = create; function is(value) { var candidate = value; return Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1); } Color.is = is; })(Color || (Color = {})); var ColorInformation; (function (ColorInformation) { function create(range, color) { return { range: range, color: color, }; } ColorInformation.create = create; function is(value) { var candidate = value; return Range.is(candidate.range) && Color.is(candidate.color); } ColorInformation.is = is; })(ColorInformation || (ColorInformation = {})); var ColorPresentation; (function (ColorPresentation) { function create(label, textEdit, additionalTextEdits) { return { label: label, textEdit: textEdit, additionalTextEdits: additionalTextEdits, }; } ColorPresentation.create = create; function is(value) { var candidate = value; return Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); } ColorPresentation.is = is; })(ColorPresentation || (ColorPresentation = {})); var FoldingRangeKind; (function (FoldingRangeKind) { FoldingRangeKind["Comment"] = "comment"; FoldingRangeKind["Imports"] = "imports"; FoldingRangeKind["Region"] = "region"; })(FoldingRangeKind || (FoldingRangeKind = {})); var FoldingRange; (function (FoldingRange) { function create(startLine, endLine, startCharacter, endCharacter, kind) { var result = { startLine: startLine, endLine: endLine }; if (Is.defined(startCharacter)) { result.startCharacter = startCharacter; } if (Is.defined(endCharacter)) { result.endCharacter = endCharacter; } if (Is.defined(kind)) { result.kind = kind; } return result; } FoldingRange.create = create; function is(value) { var candidate = value; return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); } FoldingRange.is = is; })(FoldingRange || (FoldingRange = {})); var DiagnosticRelatedInformation; (function (DiagnosticRelatedInformation) { function create(location, message) { return { location: location, message: message }; } DiagnosticRelatedInformation.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); } DiagnosticRelatedInformation.is = is; })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); var DiagnosticSeverity; (function (DiagnosticSeverity) { DiagnosticSeverity.Error = 1; DiagnosticSeverity.Warning = 2; DiagnosticSeverity.Information = 3; DiagnosticSeverity.Hint = 4; })(DiagnosticSeverity || (DiagnosticSeverity = {})); var DiagnosticTag; (function (DiagnosticTag) { DiagnosticTag.Unnecessary = 1; DiagnosticTag.Deprecated = 2; })(DiagnosticTag || (DiagnosticTag = {})); var CodeDescription; (function (CodeDescription) { function is(value) { var candidate = value; return candidate !== undefined && candidate !== null && Is.string(candidate.href); } CodeDescription.is = is; })(CodeDescription || (CodeDescription = {})); var Diagnostic; (function (Diagnostic) { function create(range, message, severity, code, source, relatedInformation) { var result = { range: range, message: message }; if (Is.defined(severity)) { result.severity = severity; } if (Is.defined(code)) { result.code = code; } if (Is.defined(source)) { result.source = source; } if (Is.defined(relatedInformation)) { result.relatedInformation = relatedInformation; } return result; } Diagnostic.create = create; function is(value) { var _a; var candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href))) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); } Diagnostic.is = is; })(Diagnostic || (Diagnostic = {})); var Command; (function (Command) { function create(title, command) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } var result = { title: title, command: command }; if (Is.defined(args) && args.length > 0) { result.arguments = args; } return result; } Command.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); } Command.is = is; })(Command || (Command = {})); var TextEdit; (function (TextEdit) { function replace(range, newText) { return { range: range, newText: newText }; } TextEdit.replace = replace; function insert(position, newText) { return { range: { start: position, end: position }, newText: newText }; } TextEdit.insert = insert; function del(range) { return { range: range, newText: '' }; } TextEdit.del = del; function is(value) { var candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range); } TextEdit.is = is; })(TextEdit || (TextEdit = {})); var ChangeAnnotation; (function (ChangeAnnotation) { function create(label, needsConfirmation, description) { var result = { label: label }; if (needsConfirmation !== undefined) { result.needsConfirmation = needsConfirmation; } if (description !== undefined) { result.description = description; } return result; } ChangeAnnotation.create = create; function is(value) { var candidate = value; return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) && (Is.string(candidate.description) || candidate.description === undefined); } ChangeAnnotation.is = is; })(ChangeAnnotation || (ChangeAnnotation = {})); var ChangeAnnotationIdentifier; (function (ChangeAnnotationIdentifier) { function is(value) { var candidate = value; return typeof candidate === 'string'; } ChangeAnnotationIdentifier.is = is; })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); var AnnotatedTextEdit; (function (AnnotatedTextEdit) { function replace(range, newText, annotation) { return { range: range, newText: newText, annotationId: annotation }; } AnnotatedTextEdit.replace = replace; function insert(position, newText, annotation) { return { range: { start: position, end: position }, newText: newText, annotationId: annotation }; } AnnotatedTextEdit.insert = insert; function del(range, annotation) { return { range: range, newText: '', annotationId: annotation }; } AnnotatedTextEdit.del = del; function is(value) { var candidate = value; return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); } AnnotatedTextEdit.is = is; })(AnnotatedTextEdit || (AnnotatedTextEdit = {})); var TextDocumentEdit; (function (TextDocumentEdit) { function create(textDocument, edits) { return { textDocument: textDocument, edits: edits }; } TextDocumentEdit.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits); } TextDocumentEdit.is = is; })(TextDocumentEdit || (TextDocumentEdit = {})); var CreateFile; (function (CreateFile) { function create(uri, options, annotation) { var result = { kind: 'create', uri: uri }; if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) { result.options = options; } if (annotation !== undefined) { result.annotationId = annotation; } return result; } CreateFile.create = create; function is(value) { var candidate = value; return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined || ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId)); } CreateFile.is = is; })(CreateFile || (CreateFile = {})); var RenameFile; (function (RenameFile) { function create(oldUri, newUri, options, annotation) { var result = { kind: 'rename', oldUri: oldUri, newUri: newUri }; if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) { result.options = options; } if (annotation !== undefined) { result.annotationId = annotation; } return result; } RenameFile.create = create; function is(value) { var candidate = value; return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined || ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId)); } RenameFile.is = is; })(RenameFile || (RenameFile = {})); var DeleteFile; (function (DeleteFile) { function create(uri, options, annotation) { var result = { kind: 'delete', uri: uri }; if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) { result.options = options; } if (annotation !== undefined) { result.annotationId = annotation; } return result; } DeleteFile.create = create; function is(value) { var candidate = value; return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined || ((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId)); } DeleteFile.is = is; })(DeleteFile || (DeleteFile = {})); var WorkspaceEdit; (function (WorkspaceEdit) { function is(value) { var candidate = value; return candidate && (candidate.changes !== undefined || candidate.documentChanges !== undefined) && (candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) { if (Is.string(change.kind)) { return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); } else { return TextDocumentEdit.is(change); } })); } WorkspaceEdit.is = is; })(WorkspaceEdit || (WorkspaceEdit = {})); var TextEditChangeImpl = (function () { function TextEditChangeImpl(edits, changeAnnotations) { this.edits = edits; this.changeAnnotations = changeAnnotations; } TextEditChangeImpl.prototype.insert = function (position, newText, annotation) { var edit; var id; if (annotation === undefined) { edit = TextEdit.insert(position, newText); } else if (ChangeAnnotationIdentifier.is(annotation)) { id = annotation; edit = AnnotatedTextEdit.insert(position, newText, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit.insert(position, newText, id); } this.edits.push(edit); if (id !== undefined) { return id; } }; TextEditChangeImpl.prototype.replace = function (range, newText, annotation) { var edit; var id; if (annotation === undefined) { edit = TextEdit.replace(range, newText); } else if (ChangeAnnotationIdentifier.is(annotation)) { id = annotation; edit = AnnotatedTextEdit.replace(range, newText, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit.replace(range, newText, id); } this.edits.push(edit); if (id !== undefined) { return id; } }; TextEditChangeImpl.prototype.delete = function (range, annotation) { var edit; var id; if (annotation === undefined) { edit = TextEdit.del(range); } else if (ChangeAnnotationIdentifier.is(annotation)) { id = annotation; edit = AnnotatedTextEdit.del(range, annotation); } else { this.assertChangeAnnotations(this.changeAnnotations); id = this.changeAnnotations.manage(annotation); edit = AnnotatedTextEdit.del(range, id); } this.edits.push(edit); if (id !== undefined) { return id; } }; TextEditChangeImpl.prototype.add = function (edit) { this.edits.push(edit); }; TextEditChangeImpl.prototype.all = function () { return this.edits; }; TextEditChangeImpl.prototype.clear = function () { this.edits.splice(0, this.edits.length); }; TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) { if (value === undefined) { throw new Error("Text edit change is not configured to manage change annotations."); } }; return TextEditChangeImpl; }()); var ChangeAnnotations = (function () { function ChangeAnnotations(annotations) { this._annotations = annotations === undefined ? Object.create(null) : annotations; this._counter = 0; this._size = 0; } ChangeAnnotations.prototype.all = function () { return this._annotations; }; Object.defineProperty(ChangeAnnotations.prototype, "size", { get: function () { return this._size; }, enumerable: false, configurable: true }); ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) { var id; if (ChangeAnnotationIdentifier.is(idOrAnnotation)) { id = idOrAnnotation; } else { id = this.nextId(); annotation = idOrAnnotation; } if (this._annotations[id] !== undefined) { throw new Error("Id " + id + " is already in use."); } if (annotation === undefined) { throw new Error("No annotation provided for id " + id); } this._annotations[id] = annotation; this._size++; return id; }; ChangeAnnotations.prototype.nextId = function () { this._counter++; return this._counter.toString(); }; return ChangeAnnotations; }()); var WorkspaceChange = (function () { function WorkspaceChange(workspaceEdit) { var _this = this; this._textEditChanges = Object.create(null); if (workspaceEdit !== undefined) { this._workspaceEdit = workspaceEdit; if (workspaceEdit.documentChanges) { this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); workspaceEdit.changeAnnotations = this._changeAnnotations.all(); workspaceEdit.documentChanges.forEach(function (change) { if (TextDocumentEdit.is(change)) { var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations); _this._textEditChanges[change.textDocument.uri] = textEditChange; } }); } else if (workspaceEdit.changes) { Object.keys(workspaceEdit.changes).forEach(function (key) { var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); _this._textEditChanges[key] = textEditChange; }); } } else { this._workspaceEdit = {}; } } Object.defineProperty(WorkspaceChange.prototype, "edit", { get: function () { this.initDocumentChanges(); if (this._changeAnnotations !== undefined) { if (this._changeAnnotations.size === 0) { this._workspaceEdit.changeAnnotations = undefined; } else { this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); } } return this._workspaceEdit; }, enumerable: false, configurable: true }); WorkspaceChange.prototype.getTextEditChange = function (key) { if (OptionalVersionedTextDocumentIdentifier.is(key)) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === undefined) { throw new Error('Workspace edit is not configured for document changes.'); } var textDocument = { uri: key.uri, version: key.version }; var result = this._textEditChanges[textDocument.uri]; if (!result) { var edits = []; var textDocumentEdit = { textDocument: textDocument, edits: edits }; this._workspaceEdit.documentChanges.push(textDocumentEdit); result = new TextEditChangeImpl(edits, this._changeAnnotations); this._textEditChanges[textDocument.uri] = result; } return result; } else { this.initChanges(); if (this._workspaceEdit.changes === undefined) { throw new Error('Workspace edit is not configured for normal text edit changes.'); } var result = this._textEditChanges[key]; if (!result) { var edits = []; this._workspaceEdit.changes[key] = edits; result = new TextEditChangeImpl(edits); this._textEditChanges[key] = result; } return result; } }; WorkspaceChange.prototype.initDocumentChanges = function () { if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) { this._changeAnnotations = new ChangeAnnotations(); this._workspaceEdit.documentChanges = []; this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); } }; WorkspaceChange.prototype.initChanges = function () { if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) { this._workspaceEdit.changes = Object.create(null); } }; WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === undefined) { throw new Error('Workspace edit is not configured for document changes.'); } var annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === undefined) { operation = CreateFile.create(uri, options); } else { id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = CreateFile.create(uri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== undefined) { return id; } }; WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === undefined) { throw new Error('Workspace edit is not configured for document changes.'); } var annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === undefined) { operation = RenameFile.create(oldUri, newUri, options); } else { id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = RenameFile.create(oldUri, newUri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== undefined) { return id; } }; WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) { this.initDocumentChanges(); if (this._workspaceEdit.documentChanges === undefined) { throw new Error('Workspace edit is not configured for document changes.'); } var annotation; if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { annotation = optionsOrAnnotation; } else { options = optionsOrAnnotation; } var operation; var id; if (annotation === undefined) { operation = DeleteFile.create(uri, options); } else { id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); operation = DeleteFile.create(uri, options, id); } this._workspaceEdit.documentChanges.push(operation); if (id !== undefined) { return id; } }; return WorkspaceChange; }()); var TextDocumentIdentifier; (function (TextDocumentIdentifier) { function create(uri) { return { uri: uri }; } TextDocumentIdentifier.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri); } TextDocumentIdentifier.is = is; })(TextDocumentIdentifier || (TextDocumentIdentifier = {})); var VersionedTextDocumentIdentifier; (function (VersionedTextDocumentIdentifier) { function create(uri, version) { return { uri: uri, version: version }; } VersionedTextDocumentIdentifier.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); } VersionedTextDocumentIdentifier.is = is; })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); var OptionalVersionedTextDocumentIdentifier; (function (OptionalVersionedTextDocumentIdentifier) { function create(uri, version) { return { uri: uri, version: version }; } OptionalVersionedTextDocumentIdentifier.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); } OptionalVersionedTextDocumentIdentifier.is = is; })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); var TextDocumentItem; (function (TextDocumentItem) { function create(uri, languageId, version, text) { return { uri: uri, languageId: languageId, version: version, text: text }; } TextDocumentItem.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); } TextDocumentItem.is = is; })(TextDocumentItem || (TextDocumentItem = {})); var MarkupKind; (function (MarkupKind) { MarkupKind.PlainText = 'plaintext'; MarkupKind.Markdown = 'markdown'; })(MarkupKind || (MarkupKind = {})); (function (MarkupKind) { function is(value) { var candidate = value; return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown; } MarkupKind.is = is; })(MarkupKind || (MarkupKind = {})); var MarkupContent; (function (MarkupContent) { function is(value) { var candidate = value; return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); } MarkupContent.is = is; })(MarkupContent || (MarkupContent = {})); var CompletionItemKind; (function (CompletionItemKind) { CompletionItemKind.Text = 1; CompletionItemKind.Method = 2; CompletionItemKind.Function = 3; CompletionItemKind.Constructor = 4; CompletionItemKind.Field = 5; CompletionItemKind.Variable = 6; CompletionItemKind.Class = 7; CompletionItemKind.Interface = 8; CompletionItemKind.Module = 9; CompletionItemKind.Property = 10; CompletionItemKind.Unit = 11; CompletionItemKind.Value = 12; CompletionItemKind.Enum = 13; CompletionItemKind.Keyword = 14; CompletionItemKind.Snippet = 15; CompletionItemKind.Color = 16; CompletionItemKind.File = 17; CompletionItemKind.Reference = 18; CompletionItemKind.Folder = 19; CompletionItemKind.EnumMember = 20; CompletionItemKind.Constant = 21; CompletionItemKind.Struct = 22; CompletionItemKind.Event = 23; CompletionItemKind.Operator = 24; CompletionItemKind.TypeParameter = 25; })(CompletionItemKind || (CompletionItemKind = {})); var InsertTextFormat; (function (InsertTextFormat) { InsertTextFormat.PlainText = 1; InsertTextFormat.Snippet = 2; })(InsertTextFormat || (InsertTextFormat = {})); var CompletionItemTag; (function (CompletionItemTag) { CompletionItemTag.Deprecated = 1; })(CompletionItemTag || (CompletionItemTag = {})); var InsertReplaceEdit; (function (InsertReplaceEdit) { function create(newText, insert, replace) { return { newText: newText, insert: insert, replace: replace }; } InsertReplaceEdit.create = create; function is(value) { var candidate = value; return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace); } InsertReplaceEdit.is = is; })(InsertReplaceEdit || (InsertReplaceEdit = {})); var InsertTextMode; (function (InsertTextMode) { InsertTextMode.asIs = 1; InsertTextMode.adjustIndentation = 2; })(InsertTextMode || (InsertTextMode = {})); var CompletionItem; (function (CompletionItem) { function create(label) { return { label: label }; } CompletionItem.create = create; })(CompletionItem || (CompletionItem = {})); var CompletionList; (function (CompletionList) { function create(items, isIncomplete) { return { items: items ? items : [], isIncomplete: !!isIncomplete }; } CompletionList.create = create; })(CompletionList || (CompletionList = {})); var MarkedString; (function (MarkedString) { function fromPlainText(plainText) { return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); } MarkedString.fromPlainText = fromPlainText; function is(value) { var candidate = value; return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value)); } MarkedString.is = is; })(MarkedString || (MarkedString = {})); var Hover; (function (Hover) { function is(value) { var candidate = value; return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range)); } Hover.is = is; })(Hover || (Hover = {})); var ParameterInformation; (function (ParameterInformation) { function create(label, documentation) { return documentation ? { label: label, documentation: documentation } : { label: label }; } ParameterInformation.create = create; })(ParameterInformation || (ParameterInformation = {})); var SignatureInformation; (function (SignatureInformation) { function create(label, documentation) { var parameters = []; for (var _i = 2; _i < arguments.length; _i++) { parameters[_i - 2] = arguments[_i]; } var result = { label: label }; if (Is.defined(documentation)) { result.documentation = documentation; } if (Is.defined(parameters)) { result.parameters = parameters; } else { result.parameters = []; } return result; } SignatureInformation.create = create; })(SignatureInformation || (SignatureInformation = {})); var DocumentHighlightKind; (function (DocumentHighlightKind) { DocumentHighlightKind.Text = 1; DocumentHighlightKind.Read = 2; DocumentHighlightKind.Write = 3; })(DocumentHighlightKind || (DocumentHighlightKind = {})); var DocumentHighlight; (function (DocumentHighlight) { function create(range, kind) { var result = { range: range }; if (Is.number(kind)) { result.kind = kind; } return result; } DocumentHighlight.create = create; })(DocumentHighlight || (DocumentHighlight = {})); var SymbolKind; (function (SymbolKind) { SymbolKind.File = 1; SymbolKind.Module = 2; SymbolKind.Namespace = 3; SymbolKind.Package = 4; SymbolKind.Class = 5; SymbolKind.Method = 6; SymbolKind.Property = 7; SymbolKind.Field = 8; SymbolKind.Constructor = 9; SymbolKind.Enum = 10; SymbolKind.Interface = 11; SymbolKind.Function = 12; SymbolKind.Variable = 13; SymbolKind.Constant = 14; SymbolKind.String = 15; SymbolKind.Number = 16; SymbolKind.Boolean = 17; SymbolKind.Array = 18; SymbolKind.Object = 19; SymbolKind.Key = 20; SymbolKind.Null = 21; SymbolKind.EnumMember = 22; SymbolKind.Struct = 23; SymbolKind.Event = 24; SymbolKind.Operator = 25; SymbolKind.TypeParameter = 26; })(SymbolKind || (SymbolKind = {})); var SymbolTag; (function (SymbolTag) { SymbolTag.Deprecated = 1; })(SymbolTag || (SymbolTag = {})); var SymbolInformation; (function (SymbolInformation) { function create(name, kind, range, uri, containerName) { var result = { name: name, kind: kind, location: { uri: uri, range: range } }; if (containerName) { result.containerName = containerName; } return result; } SymbolInformation.create = create; })(SymbolInformation || (SymbolInformation = {})); var DocumentSymbol; (function (DocumentSymbol) { function create(name, detail, kind, range, selectionRange, children) { var result = { name: name, detail: detail, kind: kind, range: range, selectionRange: selectionRange }; if (children !== undefined) { result.children = children; } return result; } DocumentSymbol.create = create; function is(value) { var candidate = value; return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.is(candidate.selectionRange) && (candidate.detail === undefined || Is.string(candidate.detail)) && (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) && (candidate.children === undefined || Array.isArray(candidate.children)) && (candidate.tags === undefined || Array.isArray(candidate.tags)); } DocumentSymbol.is = is; })(DocumentSymbol || (DocumentSymbol = {})); var CodeActionKind; (function (CodeActionKind) { CodeActionKind.Empty = ''; CodeActionKind.QuickFix = 'quickfix'; CodeActionKind.Refactor = 'refactor'; CodeActionKind.RefactorExtract = 'refactor.extract'; CodeActionKind.RefactorInline = 'refactor.inline'; CodeActionKind.RefactorRewrite = 'refactor.rewrite'; CodeActionKind.Source = 'source'; CodeActionKind.SourceOrganizeImports = 'source.organizeImports'; CodeActionKind.SourceFixAll = 'source.fixAll'; })(CodeActionKind || (CodeActionKind = {})); var CodeActionContext; (function (CodeActionContext) { function create(diagnostics, only) { var result = { diagnostics: diagnostics }; if (only !== undefined && only !== null) { result.only = only; } return result; } CodeActionContext.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string)); } CodeActionContext.is = is; })(CodeActionContext || (CodeActionContext = {})); var CodeAction; (function (CodeAction) { function create(title, kindOrCommandOrEdit, kind) { var result = { title: title }; var checkKind = true; if (typeof kindOrCommandOrEdit === 'string') { checkKind = false; result.kind = kindOrCommandOrEdit; } else if (Command.is(kindOrCommandOrEdit)) { result.command = kindOrCommandOrEdit; } else { result.edit = kindOrCommandOrEdit; } if (checkKind && kind !== undefined) { result.kind = kind; } return result; } CodeAction.create = create; function is(value) { var candidate = value; return candidate && Is.string(candidate.title) && (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === undefined || Is.string(candidate.kind)) && (candidate.edit !== undefined || candidate.command !== undefined) && (candidate.command === undefined || Command.is(candidate.command)) && (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) && (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit)); } CodeAction.is = is; })(CodeAction || (CodeAction = {})); var CodeLens; (function (CodeLens) { function create(range, data) { var result = { range: range }; if (Is.defined(data)) { result.data = data; } return result; } CodeLens.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); } CodeLens.is = is; })(CodeLens || (CodeLens = {})); var FormattingOptions; (function (FormattingOptions) { function create(tabSize, insertSpaces) { return { tabSize: tabSize, insertSpaces: insertSpaces }; } FormattingOptions.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); } FormattingOptions.is = is; })(FormattingOptions || (FormattingOptions = {})); var DocumentLink; (function (DocumentLink) { function create(range, target, data) { return { range: range, target: target, data: data }; } DocumentLink.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); } DocumentLink.is = is; })(DocumentLink || (DocumentLink = {})); var SelectionRange; (function (SelectionRange) { function create(range, parent) { return { range: range, parent: parent }; } SelectionRange.create = create; function is(value) { var candidate = value; return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent)); } SelectionRange.is = is; })(SelectionRange || (SelectionRange = {})); var EOL = ['\n', '\r\n', '\r']; var TextDocument$1; (function (TextDocument) { function create(uri, languageId, version, content) { return new FullTextDocument$1(uri, languageId, version, content); } TextDocument.create = create; function is(value) { var candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false; } TextDocument.is = is; function applyEdits(document, edits) { var text = document.getText(); var sortedEdits = mergeSort(edits, function (a, b) { var diff = a.range.start.line - b.range.start.line; if (diff === 0) { return a.range.start.character - b.range.start.character; } return diff; }); var lastModifiedOffset = text.length; for (var i = sortedEdits.length - 1; i >= 0; i--) { var e = sortedEdits[i]; var startOffset = document.offsetAt(e.range.start); var endOffset = document.offsetAt(e.range.end); if (endOffset <= lastModifiedOffset) { text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length); } else { throw new Error('Overlapping edit'); } lastModifiedOffset = startOffset; } return text; } TextDocument.applyEdits = applyEdits; function mergeSort(data, compare) { if (data.length <= 1) { return data; } var p = (data.length / 2) | 0; var left = data.slice(0, p); var right = data.slice(p); mergeSort(left, compare); mergeSort(right, compare); var leftIdx = 0; var rightIdx = 0; var i = 0; while (leftIdx < left.length && rightIdx < right.length) { var ret = compare(left[leftIdx], right[rightIdx]); if (ret <= 0) { data[i++] = left[leftIdx++]; } else { data[i++] = right[rightIdx++]; } } while (leftIdx < left.length) { data[i++] = left[leftIdx++]; } while (rightIdx < right.length) { data[i++] = right[rightIdx++]; } return data; } })(TextDocument$1 || (TextDocument$1 = {})); var FullTextDocument$1 = (function () { function FullTextDocument(uri, languageId, version, content) { this._uri = uri; this._languageId = languageId; this._version = version; this._content = content; this._lineOffsets = undefined; } Object.defineProperty(FullTextDocument.prototype, "uri", { get: function () { return this._uri; }, enumerable: false, configurable: true }); Object.defineProperty(FullTextDocument.prototype, "languageId", { get: function () { return this._languageId; }, enumerable: false, configurable: true }); Object.defineProperty(FullTextDocument.prototype, "version", { get: function () { return this._version; }, enumerable: false, configurable: true }); FullTextDocument.prototype.getText = function (range) { if (range) { var start = this.offsetAt(range.start); var end = this.offsetAt(range.end); return this._content.substring(start, end); } return this._content; }; FullTextDocument.prototype.update = function (event, version) { this._content = event.text; this._version = version; this._lineOffsets = undefined; }; FullTextDocument.prototype.getLineOffsets = function () { if (this._lineOffsets === undefined) { var lineOffsets = []; var text = this._content; var isLineStart = true; for (var i = 0; i < text.length; i++) { if (isLineStart) { lineOffsets.push(i); isLineStart = false; } var ch = text.charAt(i); isLineStart = (ch === '\r' || ch === '\n'); if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') { i++; } } if (isLineStart && text.length > 0) { lineOffsets.push(text.length); } this._lineOffsets = lineOffsets; } return this._lineOffsets; }; FullTextDocument.prototype.positionAt = function (offset) { offset = Math.max(Math.min(offset, this._content.length), 0); var lineOffsets = this.getLineOffsets(); var low = 0, high = lineOffsets.length; if (high === 0) { return Position.create(0, offset); } while (low < high) { var mid = Math.floor((low + high) / 2); if (lineOffsets[mid] > offset) { high = mid; } else { low = mid + 1; } } var line = low - 1; return Position.create(line, offset - lineOffsets[line]); }; FullTextDocument.prototype.offsetAt = function (position) { var lineOffsets = this.getLineOffsets(); if (position.line >= lineOffsets.length) { return this._content.length; } else if (position.line < 0) { return 0; } var lineOffset = lineOffsets[position.line]; var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length; return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); }; Object.defineProperty(FullTextDocument.prototype, "lineCount", { get: function () { return this.getLineOffsets().length; }, enumerable: false, configurable: true }); return FullTextDocument; }()); var Is; (function (Is) { var toString = Object.prototype.toString; function defined(value) { return typeof value !== 'undefined'; } Is.defined = defined; function undefined$1(value) { return typeof value === 'undefined'; } Is.undefined = undefined$1; function boolean(value) { return value === true || value === false; } Is.boolean = boolean; function string(value) { return toString.call(value) === '[object String]'; } Is.string = string; function number(value) { return toString.call(value) === '[object Number]'; } Is.number = number; function numberRange(value, min, max) { return toString.call(value) === '[object Number]' && min <= value && value <= max; } Is.numberRange = numberRange; function integer(value) { return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647; } Is.integer = integer; function uinteger(value) { return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647; } Is.uinteger = uinteger; function func(value) { return toString.call(value) === '[object Function]'; } Is.func = func; function objectLiteral(value) { return value !== null && typeof value === 'object'; } Is.objectLiteral = objectLiteral; function typedArray(value, check) { return Array.isArray(value) && value.every(check); } Is.typedArray = typedArray; })(Is || (Is = {})); var main$2 = /*#__PURE__*/Object.freeze({ __proto__: null, get integer () { return integer; }, get uinteger () { return uinteger; }, get Position () { return Position; }, get Range () { return Range; }, get Location () { return Location; }, get LocationLink () { return LocationLink; }, get Color () { return Color; }, get ColorInformation () { return ColorInformation; }, get ColorPresentation () { return ColorPresentation; }, get FoldingRangeKind () { return FoldingRangeKind; }, get FoldingRange () { return FoldingRange; }, get DiagnosticRelatedInformation () { return DiagnosticRelatedInformation; }, get DiagnosticSeverity () { return DiagnosticSeverity; }, get DiagnosticTag () { return DiagnosticTag; }, get CodeDescription () { return CodeDescription; }, get Diagnostic () { return Diagnostic; }, get Command () { return Command; }, get TextEdit () { return TextEdit; }, get ChangeAnnotation () { return ChangeAnnotation; }, get ChangeAnnotationIdentifier () { return ChangeAnnotationIdentifier; }, get AnnotatedTextEdit () { return AnnotatedTextEdit; }, get TextDocumentEdit () { return TextDocumentEdit; }, get CreateFile () { return CreateFile; }, get RenameFile () { return RenameFile; }, get DeleteFile () { return DeleteFile; }, get WorkspaceEdit () { return WorkspaceEdit; }, WorkspaceChange: WorkspaceChange, get TextDocumentIdentifier () { return TextDocumentIdentifier; }, get VersionedTextDocumentIdentifier () { return VersionedTextDocumentIdentifier; }, get OptionalVersionedTextDocumentIdentifier () { return OptionalVersionedTextDocumentIdentifier; }, get TextDocumentItem () { return TextDocumentItem; }, get MarkupKind () { return MarkupKind; }, get MarkupContent () { return MarkupContent; }, get CompletionItemKind () { return CompletionItemKind; }, get InsertTextFormat () { return InsertTextFormat; }, get CompletionItemTag () { return CompletionItemTag; }, get InsertReplaceEdit () { return InsertReplaceEdit; }, get InsertTextMode () { return InsertTextMode; }, get CompletionItem () { return CompletionItem; }, get CompletionList () { return CompletionList; }, get MarkedString () { return MarkedString; }, get Hover () { return Hover; }, get ParameterInformation () { return ParameterInformation; }, get SignatureInformation () { return SignatureInformation; }, get DocumentHighlightKind () { return DocumentHighlightKind; }, get DocumentHighlight () { return DocumentHighlight; }, get SymbolKind () { return SymbolKind; }, get SymbolTag () { return SymbolTag; }, get SymbolInformation () { return SymbolInformation; }, get DocumentSymbol () { return DocumentSymbol; }, get CodeActionKind () { return CodeActionKind; }, get CodeActionContext () { return CodeActionContext; }, get CodeAction () { return CodeAction; }, get CodeLens () { return CodeLens; }, get FormattingOptions () { return FormattingOptions; }, get DocumentLink () { return DocumentLink; }, get SelectionRange () { return SelectionRange; }, EOL: EOL, get TextDocument () { return TextDocument$1; } }); class FullTextDocument { constructor(uri, languageId, version, content) { this._uri = uri; this._languageId = languageId; this._version = version; this._content = content; this._lineOffsets = undefined; } get uri() { return this._uri; } get languageId() { return this._languageId; } get version() { return this._version; } getText(range) { if (range) { const start = this.offsetAt(range.start); const end = this.offsetAt(range.end); return this._content.substring(start, end); } return this._content; } update(changes, version) { for (let change of changes) { if (FullTextDocument.isIncremental(change)) { const range = getWellformedRange(change.range); const startOffset = this.offsetAt(range.start); const endOffset = this.offsetAt(range.end); this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length); const startLine = Math.max(range.start.line, 0); const endLine = Math.max(range.end.line, 0); let lineOffsets = this._lineOffsets; const addedLineOffsets = computeLineOffsets(change.text, false, startOffset); if (endLine - startLine === addedLineOffsets.length) { for (let i = 0, len = addedLineOffsets.length; i < len; i++) { lineOffsets[i + startLine + 1] = addedLineOffsets[i]; } } else { if (addedLineOffsets.length < 10000) { lineOffsets.splice(startLine + 1, endLine - startLine, ...addedLineOffsets); } else { this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1)); } } const diff = change.text.length - (endOffset - startOffset); if (diff !== 0) { for (let i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) { lineOffsets[i] = lineOffsets[i] + diff; } } } else if (FullTextDocument.isFull(change)) { this._content = change.text; this._lineOffsets = undefined; } else { throw new Error('Unknown change event received'); } } this._version = version; } getLineOffsets() { if (this._lineOffsets === undefined) { this._lineOffsets = computeLineOffsets(this._content, true); } return this._lineOffsets; } positionAt(offset) { offset = Math.max(Math.min(offset, this._content.length), 0); let lineOffsets = this.getLineOffsets(); let low = 0, high = lineOffsets.length; if (high === 0) { return { line: 0, character: offset }; } while (low < high) { let mid = Math.floor((low + high) / 2); if (lineOffsets[mid] > offset) { high = mid; } else { low = mid + 1; } } let line = low - 1; return { line, character: offset - lineOffsets[line] }; } offsetAt(position) { let lineOffsets = this.getLineOffsets(); if (position.line >= lineOffsets.length) { return this._content.length; } else if (position.line < 0) { return 0; } let lineOffset = lineOffsets[position.line]; let nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length; return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); } get lineCount() { return this.getLineOffsets().length; } static isIncremental(event) { let candidate = event; return candidate !== undefined && candidate !== null && typeof candidate.text === 'string' && candidate.range !== undefined && (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number'); } static isFull(event) { let candidate = event; return candidate !== undefined && candidate !== null && typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined; } } var TextDocument; (function (TextDocument) { function create(uri, languageId, version, content) { return new FullTextDocument(uri, languageId, version, content); } TextDocument.create = create; function update(document, changes, version) { if (document instanceof FullTextDocument) { document.update(changes, version); return document; } else { throw new Error('TextDocument.update: document must be created by TextDocument.create'); } } TextDocument.update = update; function applyEdits(document, edits) { let text = document.getText(); let sortedEdits = mergeSort(edits.map(getWellformedEdit), (a, b) => { let diff = a.range.start.line - b.range.start.line; if (diff === 0) { return a.range.start.character - b.range.start.character; } return diff; }); let lastModifiedOffset = 0; const spans = []; for (const e of sortedEdits) { let startOffset = document.offsetAt(e.range.start); if (startOffset < lastModifiedOffset) { throw new Error('Overlapping edit'); } else if (startOffset > lastModifiedOffset) { spans.push(text.substring(lastModifiedOffset, startOffset)); } if (e.newText.length) { spans.push(e.newText); } lastModifiedOffset = document.offsetAt(e.range.end); } spans.push(text.substr(lastModifiedOffset)); return spans.join(''); } TextDocument.applyEdits = applyEdits; })(TextDocument || (TextDocument = {})); function mergeSort(data, compare) { if (data.length <= 1) { return data; } const p = (data.length / 2) | 0; const left = data.slice(0, p); const right = data.slice(p); mergeSort(left, compare); mergeSort(right, compare); let leftIdx = 0; let rightIdx = 0; let i = 0; while (leftIdx < left.length && rightIdx < right.length) { let ret = compare(left[leftIdx], right[rightIdx]); if (ret <= 0) { data[i++] = left[leftIdx++]; } else { data[i++] = right[rightIdx++]; } } while (leftIdx < left.length) { data[i++] = left[leftIdx++]; } while (rightIdx < right.length) { data[i++] = right[rightIdx++]; } return data; } function computeLineOffsets(text, isAtLineStart, textOffset = 0) { const result = isAtLineStart ? [textOffset] : []; for (let i = 0; i < text.length; i++) { let ch = text.charCodeAt(i); if (ch === 13 || ch === 10 ) { if (ch === 13 && i + 1 < text.length && text.charCodeAt(i + 1) === 10 ) { i++; } result.push(textOffset + i + 1); } } return result; } function getWellformedRange(range) { const start = range.start; const end = range.end; if (start.line > end.line || (start.line === end.line && start.character > end.character)) { return { start: end, end: start }; } return range; } function getWellformedEdit(textEdit) { const range = getWellformedRange(textEdit.range); if (range !== textEdit.range) { return { newText: textEdit.newText, range }; } return textEdit; } var TokenType$1; (function (TokenType) { TokenType[TokenType["StartCommentTag"] = 0] = "StartCommentTag"; TokenType[TokenType["Comment"] = 1] = "Comment"; TokenType[TokenType["EndCommentTag"] = 2] = "EndCommentTag"; TokenType[TokenType["StartTagOpen"] = 3] = "StartTagOpen"; TokenType[TokenType["StartTagClose"] = 4] = "StartTagClose"; TokenType[TokenType["StartTagSelfClose"] = 5] = "StartTagSelfClose"; TokenType[TokenType["StartTag"] = 6] = "StartTag"; TokenType[TokenType["EndTagOpen"] = 7] = "EndTagOpen"; TokenType[TokenType["EndTagClose"] = 8] = "EndTagClose"; TokenType[TokenType["EndTag"] = 9] = "EndTag"; TokenType[TokenType["DelimiterAssign"] = 10] = "DelimiterAssign"; TokenType[TokenType["AttributeName"] = 11] = "AttributeName"; TokenType[TokenType["AttributeValue"] = 12] = "AttributeValue"; TokenType[TokenType["StartDoctypeTag"] = 13] = "StartDoctypeTag"; TokenType[TokenType["Doctype"] = 14] = "Doctype"; TokenType[TokenType["EndDoctypeTag"] = 15] = "EndDoctypeTag"; TokenType[TokenType["Content"] = 16] = "Content"; TokenType[TokenType["Whitespace"] = 17] = "Whitespace"; TokenType[TokenType["Unknown"] = 18] = "Unknown"; TokenType[TokenType["Script"] = 19] = "Script"; TokenType[TokenType["Styles"] = 20] = "Styles"; TokenType[TokenType["EOS"] = 21] = "EOS"; })(TokenType$1 || (TokenType$1 = {})); var ScannerState; (function (ScannerState) { ScannerState[ScannerState["WithinContent"] = 0] = "WithinContent"; ScannerState[ScannerState["AfterOpeningStartTag"] = 1] = "AfterOpeningStartTag"; ScannerState[ScannerState["AfterOpeningEndTag"] = 2] = "AfterOpeningEndTag"; ScannerState[ScannerState["WithinDoctype"] = 3] = "WithinDoctype"; ScannerState[ScannerState["WithinTag"] = 4] = "WithinTag"; ScannerState[ScannerState["WithinEndTag"] = 5] = "WithinEndTag"; ScannerState[ScannerState["WithinComment"] = 6] = "WithinComment"; ScannerState[ScannerState["WithinScriptContent"] = 7] = "WithinScriptContent"; ScannerState[ScannerState["WithinStyleContent"] = 8] = "WithinStyleContent"; ScannerState[ScannerState["AfterAttributeName"] = 9] = "AfterAttributeName"; ScannerState[ScannerState["BeforeAttributeValue"] = 10] = "BeforeAttributeValue"; })(ScannerState || (ScannerState = {})); var ClientCapabilities$1; (function (ClientCapabilities) { ClientCapabilities.LATEST = { textDocument: { completion: { completionItem: { documentationFormat: [MarkupKind.Markdown, MarkupKind.PlainText] } }, hover: { contentFormat: [MarkupKind.Markdown, MarkupKind.PlainText] } } }; })(ClientCapabilities$1 || (ClientCapabilities$1 = {})); var FileType$2; (function (FileType) { FileType[FileType["Unknown"] = 0] = "Unknown"; FileType[FileType["File"] = 1] = "File"; FileType[FileType["Directory"] = 2] = "Directory"; FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink"; })(FileType$2 || (FileType$2 = {})); var localize$e = main$3.loadMessageBundle(); var MultiLineStream$1 = (function () { function MultiLineStream(source, position) { this.source = source; this.len = source.length; this.position = position; } MultiLineStream.prototype.eos = function () { return this.len <= this.position; }; MultiLineStream.prototype.getSource = function () { return this.source; }; MultiLineStream.prototype.pos = function () { return this.position; }; MultiLineStream.prototype.goBackTo = function (pos) { this.position = pos; }; MultiLineStream.prototype.goBack = function (n) { this.position -= n; }; MultiLineStream.prototype.advance = function (n) { this.position += n; }; MultiLineStream.prototype.goToEnd = function () { this.position = this.source.length; }; MultiLineStream.prototype.nextChar = function () { return this.source.charCodeAt(this.position++) || 0; }; MultiLineStream.prototype.peekChar = function (n) { if (n === void 0) { n = 0; } return this.source.charCodeAt(this.position + n) || 0; }; MultiLineStream.prototype.advanceIfChar = function (ch) { if (ch === this.source.charCodeAt(this.position)) { this.position++; return true; } return false; }; MultiLineStream.prototype.advanceIfChars = function (ch) { var i; if (this.position + ch.length > this.source.length) { return false; } for (i = 0; i < ch.length; i++) { if (this.source.charCodeAt(this.position + i) !== ch[i]) { return false; } } this.advance(i); return true; }; MultiLineStream.prototype.advanceIfRegExp = function (regex) { var str = this.source.substr(this.position); var match = str.match(regex); if (match) { this.position = this.position + match.index + match[0].length; return match[0]; } return ''; }; MultiLineStream.prototype.advanceUntilRegExp = function (regex) { var str = this.source.substr(this.position); var match = str.match(regex); if (match) { this.position = this.position + match.index; return match[0]; } else { this.goToEnd(); } return ''; }; MultiLineStream.prototype.advanceUntilChar = function (ch) { while (this.position < this.source.length) { if (this.source.charCodeAt(this.position) === ch) { return true; } this.advance(1); } return false; }; MultiLineStream.prototype.advanceUntilChars = function (ch) { while (this.position + ch.length <= this.source.length) { var i = 0; for (; i < ch.length && this.source.charCodeAt(this.position + i) === ch[i]; i++) { } if (i === ch.length) { return true; } this.advance(1); } this.goToEnd(); return false; }; MultiLineStream.prototype.skipWhitespace = function () { var n = this.advanceWhileChar(function (ch) { return ch === _WSP$1 || ch === _TAB$1 || ch === _NWL$3 || ch === _LFD$3 || ch === _CAR$3; }); return n > 0; }; MultiLineStream.prototype.advanceWhileChar = function (condition) { var posNow = this.position; while (this.position < this.len && condition(this.source.charCodeAt(this.position))) { this.position++; } return this.position - posNow; }; return MultiLineStream; }()); var _BNG$2 = '!'.charCodeAt(0); var _MIN$1 = '-'.charCodeAt(0); var _LAN$2 = '<'.charCodeAt(0); var _RAN$2 = '>'.charCodeAt(0); var _FSL$3 = '/'.charCodeAt(0); var _EQS$2 = '='.charCodeAt(0); var _DQO$1 = '"'.charCodeAt(0); var _SQO$1 = '\''.charCodeAt(0); var _NWL$3 = '\n'.charCodeAt(0); var _CAR$3 = '\r'.charCodeAt(0); var _LFD$3 = '\f'.charCodeAt(0); var _WSP$1 = ' '.charCodeAt(0); var _TAB$1 = '\t'.charCodeAt(0); var htmlScriptContents = { 'text/x-handlebars-template': true, 'text/html': true, }; function createScanner$1(input, initialOffset, initialState, emitPseudoCloseTags) { if (initialOffset === void 0) { initialOffset = 0; } if (initialState === void 0) { initialState = ScannerState.WithinContent; } if (emitPseudoCloseTags === void 0) { emitPseudoCloseTags = false; } var stream = new MultiLineStream$1(input, initialOffset); var state = initialState; var tokenOffset = 0; var tokenType = TokenType$1.Unknown; var tokenError; var hasSpaceAfterTag; var lastTag; var lastAttributeName; var lastTypeValue; function nextElementName() { return stream.advanceIfRegExp(/^[_:\w][_:\w-.\d]*/).toLowerCase(); } function nextAttributeName() { return stream.advanceIfRegExp(/^[^\s"'> 0) { state = ScannerState.WithinEndTag; return finishToken(offset, TokenType$1.EndTag); } if (stream.skipWhitespace()) { return finishToken(offset, TokenType$1.Whitespace, localize$e('error.unexpectedWhitespace', 'Tag name must directly follow the open bracket.')); } state = ScannerState.WithinEndTag; stream.advanceUntilChar(_RAN$2); if (offset < stream.pos()) { return finishToken(offset, TokenType$1.Unknown, localize$e('error.endTagNameExpected', 'End tag name expected.')); } return internalScan(); case ScannerState.WithinEndTag: if (stream.skipWhitespace()) { return finishToken(offset, TokenType$1.Whitespace); } if (stream.advanceIfChar(_RAN$2)) { state = ScannerState.WithinContent; return finishToken(offset, TokenType$1.EndTagClose); } if (emitPseudoCloseTags && stream.peekChar() === _LAN$2) { state = ScannerState.WithinContent; return finishToken(offset, TokenType$1.EndTagClose, localize$e('error.closingBracketMissing', 'Closing bracket missing.')); } errorMessage = localize$e('error.closingBracketExpected', 'Closing bracket expected.'); break; case ScannerState.AfterOpeningStartTag: lastTag = nextElementName(); lastTypeValue = void 0; lastAttributeName = void 0; if (lastTag.length > 0) { hasSpaceAfterTag = false; state = ScannerState.WithinTag; return finishToken(offset, TokenType$1.StartTag); } if (stream.skipWhitespace()) { return finishToken(offset, TokenType$1.Whitespace, localize$e('error.unexpectedWhitespace', 'Tag name must directly follow the open bracket.')); } state = ScannerState.WithinTag; stream.advanceUntilChar(_RAN$2); if (offset < stream.pos()) { return finishToken(offset, TokenType$1.Unknown, localize$e('error.startTagNameExpected', 'Start tag name expected.')); } return internalScan(); case ScannerState.WithinTag: if (stream.skipWhitespace()) { hasSpaceAfterTag = true; return finishToken(offset, TokenType$1.Whitespace); } if (hasSpaceAfterTag) { lastAttributeName = nextAttributeName(); if (lastAttributeName.length > 0) { state = ScannerState.AfterAttributeName; hasSpaceAfterTag = false; return finishToken(offset, TokenType$1.AttributeName); } } if (stream.advanceIfChars([_FSL$3, _RAN$2])) { state = ScannerState.WithinContent; return finishToken(offset, TokenType$1.StartTagSelfClose); } if (stream.advanceIfChar(_RAN$2)) { if (lastTag === 'script') { if (lastTypeValue && htmlScriptContents[lastTypeValue]) { state = ScannerState.WithinContent; } else { state = ScannerState.WithinScriptContent; } } else if (lastTag === 'style') { state = ScannerState.WithinStyleContent; } else { state = ScannerState.WithinContent; } return finishToken(offset, TokenType$1.StartTagClose); } if (emitPseudoCloseTags && stream.peekChar() === _LAN$2) { state = ScannerState.WithinContent; return finishToken(offset, TokenType$1.StartTagClose, localize$e('error.closingBracketMissing', 'Closing bracket missing.')); } stream.advance(1); return finishToken(offset, TokenType$1.Unknown, localize$e('error.unexpectedCharacterInTag', 'Unexpected character in tag.')); case ScannerState.AfterAttributeName: if (stream.skipWhitespace()) { hasSpaceAfterTag = true; return finishToken(offset, TokenType$1.Whitespace); } if (stream.advanceIfChar(_EQS$2)) { state = ScannerState.BeforeAttributeValue; return finishToken(offset, TokenType$1.DelimiterAssign); } state = ScannerState.WithinTag; return internalScan(); case ScannerState.BeforeAttributeValue: if (stream.skipWhitespace()) { return finishToken(offset, TokenType$1.Whitespace); } var attributeValue = stream.advanceIfRegExp(/^[^\s"'`=<>]+/); if (attributeValue.length > 0) { if (stream.peekChar() === _RAN$2 && stream.peekChar(-1) === _FSL$3) { stream.goBack(1); attributeValue = attributeValue.substr(0, attributeValue.length - 1); } if (lastAttributeName === 'type') { lastTypeValue = attributeValue; } state = ScannerState.WithinTag; hasSpaceAfterTag = false; return finishToken(offset, TokenType$1.AttributeValue); } var ch = stream.peekChar(); if (ch === _SQO$1 || ch === _DQO$1) { stream.advance(1); if (stream.advanceUntilChar(ch)) { stream.advance(1); } if (lastAttributeName === 'type') { lastTypeValue = stream.getSource().substring(offset + 1, stream.pos() - 1); } state = ScannerState.WithinTag; hasSpaceAfterTag = false; return finishToken(offset, TokenType$1.AttributeValue); } state = ScannerState.WithinTag; hasSpaceAfterTag = false; return internalScan(); case ScannerState.WithinScriptContent: var sciptState = 1; while (!stream.eos()) { var match = stream.advanceIfRegExp(/|<\/?script\s*\/?>?/i); if (match.length === 0) { stream.goToEnd(); return finishToken(offset, TokenType$1.Script); } else if (match === '') { sciptState = 1; } else if (match[1] !== '/') { if (sciptState === 2) { sciptState = 3; } } else { if (sciptState === 3) { sciptState = 2; } else { stream.goBack(match.length); break; } } } state = ScannerState.WithinContent; if (offset < stream.pos()) { return finishToken(offset, TokenType$1.Script); } return internalScan(); case ScannerState.WithinStyleContent: stream.advanceUntilRegExp(/<\/style/i); state = ScannerState.WithinContent; if (offset < stream.pos()) { return finishToken(offset, TokenType$1.Styles); } return internalScan(); } stream.advance(1); state = ScannerState.WithinContent; return finishToken(offset, TokenType$1.Unknown, errorMessage); } return { scan: scan, getTokenType: function () { return tokenType; }, getTokenOffset: function () { return tokenOffset; }, getTokenLength: function () { return stream.pos() - tokenOffset; }, getTokenEnd: function () { return stream.pos(); }, getTokenText: function () { return stream.getSource().substring(tokenOffset, stream.pos()); }, getScannerState: function () { return state; }, getTokenError: function () { return tokenError; } }; } function findFirst$1(array, p) { var low = 0, high = array.length; if (high === 0) { return 0; } while (low < high) { var mid = Math.floor((low + high) / 2); if (p(array[mid])) { high = mid; } else { low = mid + 1; } } return low; } function binarySearch(array, key, comparator) { var low = 0, high = array.length - 1; while (low <= high) { var mid = ((low + high) / 2) | 0; var comp = comparator(array[mid], key); if (comp < 0) { low = mid + 1; } else if (comp > 0) { high = mid - 1; } else { return mid; } } return -(low + 1); } var VOID_ELEMENTS = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']; function isVoidElement(e) { return !!e && binarySearch(VOID_ELEMENTS, e.toLowerCase(), function (s1, s2) { return s1.localeCompare(s2); }) >= 0; } var Node$1 = (function () { function Node(start, end, children, parent) { this.start = start; this.end = end; this.children = children; this.parent = parent; this.closed = false; } Object.defineProperty(Node.prototype, "attributeNames", { get: function () { return this.attributes ? Object.keys(this.attributes) : []; }, enumerable: false, configurable: true }); Node.prototype.isSameTag = function (tagInLowerCase) { if (this.tag === undefined) { return tagInLowerCase === undefined; } else { return tagInLowerCase !== undefined && this.tag.length === tagInLowerCase.length && this.tag.toLowerCase() === tagInLowerCase; } }; Object.defineProperty(Node.prototype, "firstChild", { get: function () { return this.children[0]; }, enumerable: false, configurable: true }); Object.defineProperty(Node.prototype, "lastChild", { get: function () { return this.children.length ? this.children[this.children.length - 1] : void 0; }, enumerable: false, configurable: true }); Node.prototype.findNodeBefore = function (offset) { var idx = findFirst$1(this.children, function (c) { return offset <= c.start; }) - 1; if (idx >= 0) { var child = this.children[idx]; if (offset > child.start) { if (offset < child.end) { return child.findNodeBefore(offset); } var lastChild = child.lastChild; if (lastChild && lastChild.end === child.end) { return child.findNodeBefore(offset); } return child; } } return this; }; Node.prototype.findNodeAt = function (offset) { var idx = findFirst$1(this.children, function (c) { return offset <= c.start; }) - 1; if (idx >= 0) { var child = this.children[idx]; if (offset > child.start && offset <= child.end) { return child.findNodeAt(offset); } } return this; }; return Node; }()); function parse$5(text) { var scanner = createScanner$1(text, undefined, undefined, true); var htmlDocument = new Node$1(0, text.length, [], void 0); var curr = htmlDocument; var endTagStart = -1; var endTagName = undefined; var pendingAttribute = null; var token = scanner.scan(); while (token !== TokenType$1.EOS) { switch (token) { case TokenType$1.StartTagOpen: var child = new Node$1(scanner.getTokenOffset(), text.length, [], curr); curr.children.push(child); curr = child; break; case TokenType$1.StartTag: curr.tag = scanner.getTokenText(); break; case TokenType$1.StartTagClose: if (curr.parent) { curr.end = scanner.getTokenEnd(); if (scanner.getTokenLength()) { curr.startTagEnd = scanner.getTokenEnd(); if (curr.tag && isVoidElement(curr.tag)) { curr.closed = true; curr = curr.parent; } } else { curr = curr.parent; } } break; case TokenType$1.StartTagSelfClose: if (curr.parent) { curr.closed = true; curr.end = scanner.getTokenEnd(); curr.startTagEnd = scanner.getTokenEnd(); curr = curr.parent; } break; case TokenType$1.EndTagOpen: endTagStart = scanner.getTokenOffset(); endTagName = undefined; break; case TokenType$1.EndTag: endTagName = scanner.getTokenText().toLowerCase(); break; case TokenType$1.EndTagClose: var node = curr; while (!node.isSameTag(endTagName) && node.parent) { node = node.parent; } if (node.parent) { while (curr !== node) { curr.end = endTagStart; curr.closed = false; curr = curr.parent; } curr.closed = true; curr.endTagStart = endTagStart; curr.end = scanner.getTokenEnd(); curr = curr.parent; } break; case TokenType$1.AttributeName: { pendingAttribute = scanner.getTokenText(); var attributes = curr.attributes; if (!attributes) { curr.attributes = attributes = {}; } attributes[pendingAttribute] = null; break; } case TokenType$1.AttributeValue: { var value = scanner.getTokenText(); var attributes = curr.attributes; if (attributes && pendingAttribute) { attributes[pendingAttribute] = value; pendingAttribute = null; } break; } } token = scanner.scan(); } while (curr.parent) { curr.end = text.length; curr.closed = false; curr = curr.parent; } return { roots: htmlDocument.children, findNodeBefore: htmlDocument.findNodeBefore.bind(htmlDocument), findNodeAt: htmlDocument.findNodeAt.bind(htmlDocument) }; } var entities = { "Aacute;": "\u00C1", "Aacute": "\u00C1", "aacute;": "\u00E1", "aacute": "\u00E1", "Abreve;": "\u0102", "abreve;": "\u0103", "ac;": "\u223E", "acd;": "\u223F", "acE;": "\u223E\u0333", "Acirc;": "\u00C2", "Acirc": "\u00C2", "acirc;": "\u00E2", "acirc": "\u00E2", "acute;": "\u00B4", "acute": "\u00B4", "Acy;": "\u0410", "acy;": "\u0430", "AElig;": "\u00C6", "AElig": "\u00C6", "aelig;": "\u00E6", "aelig": "\u00E6", "af;": "\u2061", "Afr;": "\uD835\uDD04", "afr;": "\uD835\uDD1E", "Agrave;": "\u00C0", "Agrave": "\u00C0", "agrave;": "\u00E0", "agrave": "\u00E0", "alefsym;": "\u2135", "aleph;": "\u2135", "Alpha;": "\u0391", "alpha;": "\u03B1", "Amacr;": "\u0100", "amacr;": "\u0101", "amalg;": "\u2A3F", "AMP;": "\u0026", "AMP": "\u0026", "amp;": "\u0026", "amp": "\u0026", "And;": "\u2A53", "and;": "\u2227", "andand;": "\u2A55", "andd;": "\u2A5C", "andslope;": "\u2A58", "andv;": "\u2A5A", "ang;": "\u2220", "ange;": "\u29A4", "angle;": "\u2220", "angmsd;": "\u2221", "angmsdaa;": "\u29A8", "angmsdab;": "\u29A9", "angmsdac;": "\u29AA", "angmsdad;": "\u29AB", "angmsdae;": "\u29AC", "angmsdaf;": "\u29AD", "angmsdag;": "\u29AE", "angmsdah;": "\u29AF", "angrt;": "\u221F", "angrtvb;": "\u22BE", "angrtvbd;": "\u299D", "angsph;": "\u2222", "angst;": "\u00C5", "angzarr;": "\u237C", "Aogon;": "\u0104", "aogon;": "\u0105", "Aopf;": "\uD835\uDD38", "aopf;": "\uD835\uDD52", "ap;": "\u2248", "apacir;": "\u2A6F", "apE;": "\u2A70", "ape;": "\u224A", "apid;": "\u224B", "apos;": "\u0027", "ApplyFunction;": "\u2061", "approx;": "\u2248", "approxeq;": "\u224A", "Aring;": "\u00C5", "Aring": "\u00C5", "aring;": "\u00E5", "aring": "\u00E5", "Ascr;": "\uD835\uDC9C", "ascr;": "\uD835\uDCB6", "Assign;": "\u2254", "ast;": "\u002A", "asymp;": "\u2248", "asympeq;": "\u224D", "Atilde;": "\u00C3", "Atilde": "\u00C3", "atilde;": "\u00E3", "atilde": "\u00E3", "Auml;": "\u00C4", "Auml": "\u00C4", "auml;": "\u00E4", "auml": "\u00E4", "awconint;": "\u2233", "awint;": "\u2A11", "backcong;": "\u224C", "backepsilon;": "\u03F6", "backprime;": "\u2035", "backsim;": "\u223D", "backsimeq;": "\u22CD", "Backslash;": "\u2216", "Barv;": "\u2AE7", "barvee;": "\u22BD", "Barwed;": "\u2306", "barwed;": "\u2305", "barwedge;": "\u2305", "bbrk;": "\u23B5", "bbrktbrk;": "\u23B6", "bcong;": "\u224C", "Bcy;": "\u0411", "bcy;": "\u0431", "bdquo;": "\u201E", "becaus;": "\u2235", "Because;": "\u2235", "because;": "\u2235", "bemptyv;": "\u29B0", "bepsi;": "\u03F6", "bernou;": "\u212C", "Bernoullis;": "\u212C", "Beta;": "\u0392", "beta;": "\u03B2", "beth;": "\u2136", "between;": "\u226C", "Bfr;": "\uD835\uDD05", "bfr;": "\uD835\uDD1F", "bigcap;": "\u22C2", "bigcirc;": "\u25EF", "bigcup;": "\u22C3", "bigodot;": "\u2A00", "bigoplus;": "\u2A01", "bigotimes;": "\u2A02", "bigsqcup;": "\u2A06", "bigstar;": "\u2605", "bigtriangledown;": "\u25BD", "bigtriangleup;": "\u25B3", "biguplus;": "\u2A04", "bigvee;": "\u22C1", "bigwedge;": "\u22C0", "bkarow;": "\u290D", "blacklozenge;": "\u29EB", "blacksquare;": "\u25AA", "blacktriangle;": "\u25B4", "blacktriangledown;": "\u25BE", "blacktriangleleft;": "\u25C2", "blacktriangleright;": "\u25B8", "blank;": "\u2423", "blk12;": "\u2592", "blk14;": "\u2591", "blk34;": "\u2593", "block;": "\u2588", "bne;": "\u003D\u20E5", "bnequiv;": "\u2261\u20E5", "bNot;": "\u2AED", "bnot;": "\u2310", "Bopf;": "\uD835\uDD39", "bopf;": "\uD835\uDD53", "bot;": "\u22A5", "bottom;": "\u22A5", "bowtie;": "\u22C8", "boxbox;": "\u29C9", "boxDL;": "\u2557", "boxDl;": "\u2556", "boxdL;": "\u2555", "boxdl;": "\u2510", "boxDR;": "\u2554", "boxDr;": "\u2553", "boxdR;": "\u2552", "boxdr;": "\u250C", "boxH;": "\u2550", "boxh;": "\u2500", "boxHD;": "\u2566", "boxHd;": "\u2564", "boxhD;": "\u2565", "boxhd;": "\u252C", "boxHU;": "\u2569", "boxHu;": "\u2567", "boxhU;": "\u2568", "boxhu;": "\u2534", "boxminus;": "\u229F", "boxplus;": "\u229E", "boxtimes;": "\u22A0", "boxUL;": "\u255D", "boxUl;": "\u255C", "boxuL;": "\u255B", "boxul;": "\u2518", "boxUR;": "\u255A", "boxUr;": "\u2559", "boxuR;": "\u2558", "boxur;": "\u2514", "boxV;": "\u2551", "boxv;": "\u2502", "boxVH;": "\u256C", "boxVh;": "\u256B", "boxvH;": "\u256A", "boxvh;": "\u253C", "boxVL;": "\u2563", "boxVl;": "\u2562", "boxvL;": "\u2561", "boxvl;": "\u2524", "boxVR;": "\u2560", "boxVr;": "\u255F", "boxvR;": "\u255E", "boxvr;": "\u251C", "bprime;": "\u2035", "Breve;": "\u02D8", "breve;": "\u02D8", "brvbar;": "\u00A6", "brvbar": "\u00A6", "Bscr;": "\u212C", "bscr;": "\uD835\uDCB7", "bsemi;": "\u204F", "bsim;": "\u223D", "bsime;": "\u22CD", "bsol;": "\u005C", "bsolb;": "\u29C5", "bsolhsub;": "\u27C8", "bull;": "\u2022", "bullet;": "\u2022", "bump;": "\u224E", "bumpE;": "\u2AAE", "bumpe;": "\u224F", "Bumpeq;": "\u224E", "bumpeq;": "\u224F", "Cacute;": "\u0106", "cacute;": "\u0107", "Cap;": "\u22D2", "cap;": "\u2229", "capand;": "\u2A44", "capbrcup;": "\u2A49", "capcap;": "\u2A4B", "capcup;": "\u2A47", "capdot;": "\u2A40", "CapitalDifferentialD;": "\u2145", "caps;": "\u2229\uFE00", "caret;": "\u2041", "caron;": "\u02C7", "Cayleys;": "\u212D", "ccaps;": "\u2A4D", "Ccaron;": "\u010C", "ccaron;": "\u010D", "Ccedil;": "\u00C7", "Ccedil": "\u00C7", "ccedil;": "\u00E7", "ccedil": "\u00E7", "Ccirc;": "\u0108", "ccirc;": "\u0109", "Cconint;": "\u2230", "ccups;": "\u2A4C", "ccupssm;": "\u2A50", "Cdot;": "\u010A", "cdot;": "\u010B", "cedil;": "\u00B8", "cedil": "\u00B8", "Cedilla;": "\u00B8", "cemptyv;": "\u29B2", "cent;": "\u00A2", "cent": "\u00A2", "CenterDot;": "\u00B7", "centerdot;": "\u00B7", "Cfr;": "\u212D", "cfr;": "\uD835\uDD20", "CHcy;": "\u0427", "chcy;": "\u0447", "check;": "\u2713", "checkmark;": "\u2713", "Chi;": "\u03A7", "chi;": "\u03C7", "cir;": "\u25CB", "circ;": "\u02C6", "circeq;": "\u2257", "circlearrowleft;": "\u21BA", "circlearrowright;": "\u21BB", "circledast;": "\u229B", "circledcirc;": "\u229A", "circleddash;": "\u229D", "CircleDot;": "\u2299", "circledR;": "\u00AE", "circledS;": "\u24C8", "CircleMinus;": "\u2296", "CirclePlus;": "\u2295", "CircleTimes;": "\u2297", "cirE;": "\u29C3", "cire;": "\u2257", "cirfnint;": "\u2A10", "cirmid;": "\u2AEF", "cirscir;": "\u29C2", "ClockwiseContourIntegral;": "\u2232", "CloseCurlyDoubleQuote;": "\u201D", "CloseCurlyQuote;": "\u2019", "clubs;": "\u2663", "clubsuit;": "\u2663", "Colon;": "\u2237", "colon;": "\u003A", "Colone;": "\u2A74", "colone;": "\u2254", "coloneq;": "\u2254", "comma;": "\u002C", "commat;": "\u0040", "comp;": "\u2201", "compfn;": "\u2218", "complement;": "\u2201", "complexes;": "\u2102", "cong;": "\u2245", "congdot;": "\u2A6D", "Congruent;": "\u2261", "Conint;": "\u222F", "conint;": "\u222E", "ContourIntegral;": "\u222E", "Copf;": "\u2102", "copf;": "\uD835\uDD54", "coprod;": "\u2210", "Coproduct;": "\u2210", "COPY;": "\u00A9", "COPY": "\u00A9", "copy;": "\u00A9", "copy": "\u00A9", "copysr;": "\u2117", "CounterClockwiseContourIntegral;": "\u2233", "crarr;": "\u21B5", "Cross;": "\u2A2F", "cross;": "\u2717", "Cscr;": "\uD835\uDC9E", "cscr;": "\uD835\uDCB8", "csub;": "\u2ACF", "csube;": "\u2AD1", "csup;": "\u2AD0", "csupe;": "\u2AD2", "ctdot;": "\u22EF", "cudarrl;": "\u2938", "cudarrr;": "\u2935", "cuepr;": "\u22DE", "cuesc;": "\u22DF", "cularr;": "\u21B6", "cularrp;": "\u293D", "Cup;": "\u22D3", "cup;": "\u222A", "cupbrcap;": "\u2A48", "CupCap;": "\u224D", "cupcap;": "\u2A46", "cupcup;": "\u2A4A", "cupdot;": "\u228D", "cupor;": "\u2A45", "cups;": "\u222A\uFE00", "curarr;": "\u21B7", "curarrm;": "\u293C", "curlyeqprec;": "\u22DE", "curlyeqsucc;": "\u22DF", "curlyvee;": "\u22CE", "curlywedge;": "\u22CF", "curren;": "\u00A4", "curren": "\u00A4", "curvearrowleft;": "\u21B6", "curvearrowright;": "\u21B7", "cuvee;": "\u22CE", "cuwed;": "\u22CF", "cwconint;": "\u2232", "cwint;": "\u2231", "cylcty;": "\u232D", "Dagger;": "\u2021", "dagger;": "\u2020", "daleth;": "\u2138", "Darr;": "\u21A1", "dArr;": "\u21D3", "darr;": "\u2193", "dash;": "\u2010", "Dashv;": "\u2AE4", "dashv;": "\u22A3", "dbkarow;": "\u290F", "dblac;": "\u02DD", "Dcaron;": "\u010E", "dcaron;": "\u010F", "Dcy;": "\u0414", "dcy;": "\u0434", "DD;": "\u2145", "dd;": "\u2146", "ddagger;": "\u2021", "ddarr;": "\u21CA", "DDotrahd;": "\u2911", "ddotseq;": "\u2A77", "deg;": "\u00B0", "deg": "\u00B0", "Del;": "\u2207", "Delta;": "\u0394", "delta;": "\u03B4", "demptyv;": "\u29B1", "dfisht;": "\u297F", "Dfr;": "\uD835\uDD07", "dfr;": "\uD835\uDD21", "dHar;": "\u2965", "dharl;": "\u21C3", "dharr;": "\u21C2", "DiacriticalAcute;": "\u00B4", "DiacriticalDot;": "\u02D9", "DiacriticalDoubleAcute;": "\u02DD", "DiacriticalGrave;": "\u0060", "DiacriticalTilde;": "\u02DC", "diam;": "\u22C4", "Diamond;": "\u22C4", "diamond;": "\u22C4", "diamondsuit;": "\u2666", "diams;": "\u2666", "die;": "\u00A8", "DifferentialD;": "\u2146", "digamma;": "\u03DD", "disin;": "\u22F2", "div;": "\u00F7", "divide;": "\u00F7", "divide": "\u00F7", "divideontimes;": "\u22C7", "divonx;": "\u22C7", "DJcy;": "\u0402", "djcy;": "\u0452", "dlcorn;": "\u231E", "dlcrop;": "\u230D", "dollar;": "\u0024", "Dopf;": "\uD835\uDD3B", "dopf;": "\uD835\uDD55", "Dot;": "\u00A8", "dot;": "\u02D9", "DotDot;": "\u20DC", "doteq;": "\u2250", "doteqdot;": "\u2251", "DotEqual;": "\u2250", "dotminus;": "\u2238", "dotplus;": "\u2214", "dotsquare;": "\u22A1", "doublebarwedge;": "\u2306", "DoubleContourIntegral;": "\u222F", "DoubleDot;": "\u00A8", "DoubleDownArrow;": "\u21D3", "DoubleLeftArrow;": "\u21D0", "DoubleLeftRightArrow;": "\u21D4", "DoubleLeftTee;": "\u2AE4", "DoubleLongLeftArrow;": "\u27F8", "DoubleLongLeftRightArrow;": "\u27FA", "DoubleLongRightArrow;": "\u27F9", "DoubleRightArrow;": "\u21D2", "DoubleRightTee;": "\u22A8", "DoubleUpArrow;": "\u21D1", "DoubleUpDownArrow;": "\u21D5", "DoubleVerticalBar;": "\u2225", "DownArrow;": "\u2193", "Downarrow;": "\u21D3", "downarrow;": "\u2193", "DownArrowBar;": "\u2913", "DownArrowUpArrow;": "\u21F5", "DownBreve;": "\u0311", "downdownarrows;": "\u21CA", "downharpoonleft;": "\u21C3", "downharpoonright;": "\u21C2", "DownLeftRightVector;": "\u2950", "DownLeftTeeVector;": "\u295E", "DownLeftVector;": "\u21BD", "DownLeftVectorBar;": "\u2956", "DownRightTeeVector;": "\u295F", "DownRightVector;": "\u21C1", "DownRightVectorBar;": "\u2957", "DownTee;": "\u22A4", "DownTeeArrow;": "\u21A7", "drbkarow;": "\u2910", "drcorn;": "\u231F", "drcrop;": "\u230C", "Dscr;": "\uD835\uDC9F", "dscr;": "\uD835\uDCB9", "DScy;": "\u0405", "dscy;": "\u0455", "dsol;": "\u29F6", "Dstrok;": "\u0110", "dstrok;": "\u0111", "dtdot;": "\u22F1", "dtri;": "\u25BF", "dtrif;": "\u25BE", "duarr;": "\u21F5", "duhar;": "\u296F", "dwangle;": "\u29A6", "DZcy;": "\u040F", "dzcy;": "\u045F", "dzigrarr;": "\u27FF", "Eacute;": "\u00C9", "Eacute": "\u00C9", "eacute;": "\u00E9", "eacute": "\u00E9", "easter;": "\u2A6E", "Ecaron;": "\u011A", "ecaron;": "\u011B", "ecir;": "\u2256", "Ecirc;": "\u00CA", "Ecirc": "\u00CA", "ecirc;": "\u00EA", "ecirc": "\u00EA", "ecolon;": "\u2255", "Ecy;": "\u042D", "ecy;": "\u044D", "eDDot;": "\u2A77", "Edot;": "\u0116", "eDot;": "\u2251", "edot;": "\u0117", "ee;": "\u2147", "efDot;": "\u2252", "Efr;": "\uD835\uDD08", "efr;": "\uD835\uDD22", "eg;": "\u2A9A", "Egrave;": "\u00C8", "Egrave": "\u00C8", "egrave;": "\u00E8", "egrave": "\u00E8", "egs;": "\u2A96", "egsdot;": "\u2A98", "el;": "\u2A99", "Element;": "\u2208", "elinters;": "\u23E7", "ell;": "\u2113", "els;": "\u2A95", "elsdot;": "\u2A97", "Emacr;": "\u0112", "emacr;": "\u0113", "empty;": "\u2205", "emptyset;": "\u2205", "EmptySmallSquare;": "\u25FB", "emptyv;": "\u2205", "EmptyVerySmallSquare;": "\u25AB", "emsp;": "\u2003", "emsp13;": "\u2004", "emsp14;": "\u2005", "ENG;": "\u014A", "eng;": "\u014B", "ensp;": "\u2002", "Eogon;": "\u0118", "eogon;": "\u0119", "Eopf;": "\uD835\uDD3C", "eopf;": "\uD835\uDD56", "epar;": "\u22D5", "eparsl;": "\u29E3", "eplus;": "\u2A71", "epsi;": "\u03B5", "Epsilon;": "\u0395", "epsilon;": "\u03B5", "epsiv;": "\u03F5", "eqcirc;": "\u2256", "eqcolon;": "\u2255", "eqsim;": "\u2242", "eqslantgtr;": "\u2A96", "eqslantless;": "\u2A95", "Equal;": "\u2A75", "equals;": "\u003D", "EqualTilde;": "\u2242", "equest;": "\u225F", "Equilibrium;": "\u21CC", "equiv;": "\u2261", "equivDD;": "\u2A78", "eqvparsl;": "\u29E5", "erarr;": "\u2971", "erDot;": "\u2253", "Escr;": "\u2130", "escr;": "\u212F", "esdot;": "\u2250", "Esim;": "\u2A73", "esim;": "\u2242", "Eta;": "\u0397", "eta;": "\u03B7", "ETH;": "\u00D0", "ETH": "\u00D0", "eth;": "\u00F0", "eth": "\u00F0", "Euml;": "\u00CB", "Euml": "\u00CB", "euml;": "\u00EB", "euml": "\u00EB", "euro;": "\u20AC", "excl;": "\u0021", "exist;": "\u2203", "Exists;": "\u2203", "expectation;": "\u2130", "ExponentialE;": "\u2147", "exponentiale;": "\u2147", "fallingdotseq;": "\u2252", "Fcy;": "\u0424", "fcy;": "\u0444", "female;": "\u2640", "ffilig;": "\uFB03", "fflig;": "\uFB00", "ffllig;": "\uFB04", "Ffr;": "\uD835\uDD09", "ffr;": "\uD835\uDD23", "filig;": "\uFB01", "FilledSmallSquare;": "\u25FC", "FilledVerySmallSquare;": "\u25AA", "fjlig;": "\u0066\u006A", "flat;": "\u266D", "fllig;": "\uFB02", "fltns;": "\u25B1", "fnof;": "\u0192", "Fopf;": "\uD835\uDD3D", "fopf;": "\uD835\uDD57", "ForAll;": "\u2200", "forall;": "\u2200", "fork;": "\u22D4", "forkv;": "\u2AD9", "Fouriertrf;": "\u2131", "fpartint;": "\u2A0D", "frac12;": "\u00BD", "frac12": "\u00BD", "frac13;": "\u2153", "frac14;": "\u00BC", "frac14": "\u00BC", "frac15;": "\u2155", "frac16;": "\u2159", "frac18;": "\u215B", "frac23;": "\u2154", "frac25;": "\u2156", "frac34;": "\u00BE", "frac34": "\u00BE", "frac35;": "\u2157", "frac38;": "\u215C", "frac45;": "\u2158", "frac56;": "\u215A", "frac58;": "\u215D", "frac78;": "\u215E", "frasl;": "\u2044", "frown;": "\u2322", "Fscr;": "\u2131", "fscr;": "\uD835\uDCBB", "gacute;": "\u01F5", "Gamma;": "\u0393", "gamma;": "\u03B3", "Gammad;": "\u03DC", "gammad;": "\u03DD", "gap;": "\u2A86", "Gbreve;": "\u011E", "gbreve;": "\u011F", "Gcedil;": "\u0122", "Gcirc;": "\u011C", "gcirc;": "\u011D", "Gcy;": "\u0413", "gcy;": "\u0433", "Gdot;": "\u0120", "gdot;": "\u0121", "gE;": "\u2267", "ge;": "\u2265", "gEl;": "\u2A8C", "gel;": "\u22DB", "geq;": "\u2265", "geqq;": "\u2267", "geqslant;": "\u2A7E", "ges;": "\u2A7E", "gescc;": "\u2AA9", "gesdot;": "\u2A80", "gesdoto;": "\u2A82", "gesdotol;": "\u2A84", "gesl;": "\u22DB\uFE00", "gesles;": "\u2A94", "Gfr;": "\uD835\uDD0A", "gfr;": "\uD835\uDD24", "Gg;": "\u22D9", "gg;": "\u226B", "ggg;": "\u22D9", "gimel;": "\u2137", "GJcy;": "\u0403", "gjcy;": "\u0453", "gl;": "\u2277", "gla;": "\u2AA5", "glE;": "\u2A92", "glj;": "\u2AA4", "gnap;": "\u2A8A", "gnapprox;": "\u2A8A", "gnE;": "\u2269", "gne;": "\u2A88", "gneq;": "\u2A88", "gneqq;": "\u2269", "gnsim;": "\u22E7", "Gopf;": "\uD835\uDD3E", "gopf;": "\uD835\uDD58", "grave;": "\u0060", "GreaterEqual;": "\u2265", "GreaterEqualLess;": "\u22DB", "GreaterFullEqual;": "\u2267", "GreaterGreater;": "\u2AA2", "GreaterLess;": "\u2277", "GreaterSlantEqual;": "\u2A7E", "GreaterTilde;": "\u2273", "Gscr;": "\uD835\uDCA2", "gscr;": "\u210A", "gsim;": "\u2273", "gsime;": "\u2A8E", "gsiml;": "\u2A90", "GT;": "\u003E", "GT": "\u003E", "Gt;": "\u226B", "gt;": "\u003E", "gt": "\u003E", "gtcc;": "\u2AA7", "gtcir;": "\u2A7A", "gtdot;": "\u22D7", "gtlPar;": "\u2995", "gtquest;": "\u2A7C", "gtrapprox;": "\u2A86", "gtrarr;": "\u2978", "gtrdot;": "\u22D7", "gtreqless;": "\u22DB", "gtreqqless;": "\u2A8C", "gtrless;": "\u2277", "gtrsim;": "\u2273", "gvertneqq;": "\u2269\uFE00", "gvnE;": "\u2269\uFE00", "Hacek;": "\u02C7", "hairsp;": "\u200A", "half;": "\u00BD", "hamilt;": "\u210B", "HARDcy;": "\u042A", "hardcy;": "\u044A", "hArr;": "\u21D4", "harr;": "\u2194", "harrcir;": "\u2948", "harrw;": "\u21AD", "Hat;": "\u005E", "hbar;": "\u210F", "Hcirc;": "\u0124", "hcirc;": "\u0125", "hearts;": "\u2665", "heartsuit;": "\u2665", "hellip;": "\u2026", "hercon;": "\u22B9", "Hfr;": "\u210C", "hfr;": "\uD835\uDD25", "HilbertSpace;": "\u210B", "hksearow;": "\u2925", "hkswarow;": "\u2926", "hoarr;": "\u21FF", "homtht;": "\u223B", "hookleftarrow;": "\u21A9", "hookrightarrow;": "\u21AA", "Hopf;": "\u210D", "hopf;": "\uD835\uDD59", "horbar;": "\u2015", "HorizontalLine;": "\u2500", "Hscr;": "\u210B", "hscr;": "\uD835\uDCBD", "hslash;": "\u210F", "Hstrok;": "\u0126", "hstrok;": "\u0127", "HumpDownHump;": "\u224E", "HumpEqual;": "\u224F", "hybull;": "\u2043", "hyphen;": "\u2010", "Iacute;": "\u00CD", "Iacute": "\u00CD", "iacute;": "\u00ED", "iacute": "\u00ED", "ic;": "\u2063", "Icirc;": "\u00CE", "Icirc": "\u00CE", "icirc;": "\u00EE", "icirc": "\u00EE", "Icy;": "\u0418", "icy;": "\u0438", "Idot;": "\u0130", "IEcy;": "\u0415", "iecy;": "\u0435", "iexcl;": "\u00A1", "iexcl": "\u00A1", "iff;": "\u21D4", "Ifr;": "\u2111", "ifr;": "\uD835\uDD26", "Igrave;": "\u00CC", "Igrave": "\u00CC", "igrave;": "\u00EC", "igrave": "\u00EC", "ii;": "\u2148", "iiiint;": "\u2A0C", "iiint;": "\u222D", "iinfin;": "\u29DC", "iiota;": "\u2129", "IJlig;": "\u0132", "ijlig;": "\u0133", "Im;": "\u2111", "Imacr;": "\u012A", "imacr;": "\u012B", "image;": "\u2111", "ImaginaryI;": "\u2148", "imagline;": "\u2110", "imagpart;": "\u2111", "imath;": "\u0131", "imof;": "\u22B7", "imped;": "\u01B5", "Implies;": "\u21D2", "in;": "\u2208", "incare;": "\u2105", "infin;": "\u221E", "infintie;": "\u29DD", "inodot;": "\u0131", "Int;": "\u222C", "int;": "\u222B", "intcal;": "\u22BA", "integers;": "\u2124", "Integral;": "\u222B", "intercal;": "\u22BA", "Intersection;": "\u22C2", "intlarhk;": "\u2A17", "intprod;": "\u2A3C", "InvisibleComma;": "\u2063", "InvisibleTimes;": "\u2062", "IOcy;": "\u0401", "iocy;": "\u0451", "Iogon;": "\u012E", "iogon;": "\u012F", "Iopf;": "\uD835\uDD40", "iopf;": "\uD835\uDD5A", "Iota;": "\u0399", "iota;": "\u03B9", "iprod;": "\u2A3C", "iquest;": "\u00BF", "iquest": "\u00BF", "Iscr;": "\u2110", "iscr;": "\uD835\uDCBE", "isin;": "\u2208", "isindot;": "\u22F5", "isinE;": "\u22F9", "isins;": "\u22F4", "isinsv;": "\u22F3", "isinv;": "\u2208", "it;": "\u2062", "Itilde;": "\u0128", "itilde;": "\u0129", "Iukcy;": "\u0406", "iukcy;": "\u0456", "Iuml;": "\u00CF", "Iuml": "\u00CF", "iuml;": "\u00EF", "iuml": "\u00EF", "Jcirc;": "\u0134", "jcirc;": "\u0135", "Jcy;": "\u0419", "jcy;": "\u0439", "Jfr;": "\uD835\uDD0D", "jfr;": "\uD835\uDD27", "jmath;": "\u0237", "Jopf;": "\uD835\uDD41", "jopf;": "\uD835\uDD5B", "Jscr;": "\uD835\uDCA5", "jscr;": "\uD835\uDCBF", "Jsercy;": "\u0408", "jsercy;": "\u0458", "Jukcy;": "\u0404", "jukcy;": "\u0454", "Kappa;": "\u039A", "kappa;": "\u03BA", "kappav;": "\u03F0", "Kcedil;": "\u0136", "kcedil;": "\u0137", "Kcy;": "\u041A", "kcy;": "\u043A", "Kfr;": "\uD835\uDD0E", "kfr;": "\uD835\uDD28", "kgreen;": "\u0138", "KHcy;": "\u0425", "khcy;": "\u0445", "KJcy;": "\u040C", "kjcy;": "\u045C", "Kopf;": "\uD835\uDD42", "kopf;": "\uD835\uDD5C", "Kscr;": "\uD835\uDCA6", "kscr;": "\uD835\uDCC0", "lAarr;": "\u21DA", "Lacute;": "\u0139", "lacute;": "\u013A", "laemptyv;": "\u29B4", "lagran;": "\u2112", "Lambda;": "\u039B", "lambda;": "\u03BB", "Lang;": "\u27EA", "lang;": "\u27E8", "langd;": "\u2991", "langle;": "\u27E8", "lap;": "\u2A85", "Laplacetrf;": "\u2112", "laquo;": "\u00AB", "laquo": "\u00AB", "Larr;": "\u219E", "lArr;": "\u21D0", "larr;": "\u2190", "larrb;": "\u21E4", "larrbfs;": "\u291F", "larrfs;": "\u291D", "larrhk;": "\u21A9", "larrlp;": "\u21AB", "larrpl;": "\u2939", "larrsim;": "\u2973", "larrtl;": "\u21A2", "lat;": "\u2AAB", "lAtail;": "\u291B", "latail;": "\u2919", "late;": "\u2AAD", "lates;": "\u2AAD\uFE00", "lBarr;": "\u290E", "lbarr;": "\u290C", "lbbrk;": "\u2772", "lbrace;": "\u007B", "lbrack;": "\u005B", "lbrke;": "\u298B", "lbrksld;": "\u298F", "lbrkslu;": "\u298D", "Lcaron;": "\u013D", "lcaron;": "\u013E", "Lcedil;": "\u013B", "lcedil;": "\u013C", "lceil;": "\u2308", "lcub;": "\u007B", "Lcy;": "\u041B", "lcy;": "\u043B", "ldca;": "\u2936", "ldquo;": "\u201C", "ldquor;": "\u201E", "ldrdhar;": "\u2967", "ldrushar;": "\u294B", "ldsh;": "\u21B2", "lE;": "\u2266", "le;": "\u2264", "LeftAngleBracket;": "\u27E8", "LeftArrow;": "\u2190", "Leftarrow;": "\u21D0", "leftarrow;": "\u2190", "LeftArrowBar;": "\u21E4", "LeftArrowRightArrow;": "\u21C6", "leftarrowtail;": "\u21A2", "LeftCeiling;": "\u2308", "LeftDoubleBracket;": "\u27E6", "LeftDownTeeVector;": "\u2961", "LeftDownVector;": "\u21C3", "LeftDownVectorBar;": "\u2959", "LeftFloor;": "\u230A", "leftharpoondown;": "\u21BD", "leftharpoonup;": "\u21BC", "leftleftarrows;": "\u21C7", "LeftRightArrow;": "\u2194", "Leftrightarrow;": "\u21D4", "leftrightarrow;": "\u2194", "leftrightarrows;": "\u21C6", "leftrightharpoons;": "\u21CB", "leftrightsquigarrow;": "\u21AD", "LeftRightVector;": "\u294E", "LeftTee;": "\u22A3", "LeftTeeArrow;": "\u21A4", "LeftTeeVector;": "\u295A", "leftthreetimes;": "\u22CB", "LeftTriangle;": "\u22B2", "LeftTriangleBar;": "\u29CF", "LeftTriangleEqual;": "\u22B4", "LeftUpDownVector;": "\u2951", "LeftUpTeeVector;": "\u2960", "LeftUpVector;": "\u21BF", "LeftUpVectorBar;": "\u2958", "LeftVector;": "\u21BC", "LeftVectorBar;": "\u2952", "lEg;": "\u2A8B", "leg;": "\u22DA", "leq;": "\u2264", "leqq;": "\u2266", "leqslant;": "\u2A7D", "les;": "\u2A7D", "lescc;": "\u2AA8", "lesdot;": "\u2A7F", "lesdoto;": "\u2A81", "lesdotor;": "\u2A83", "lesg;": "\u22DA\uFE00", "lesges;": "\u2A93", "lessapprox;": "\u2A85", "lessdot;": "\u22D6", "lesseqgtr;": "\u22DA", "lesseqqgtr;": "\u2A8B", "LessEqualGreater;": "\u22DA", "LessFullEqual;": "\u2266", "LessGreater;": "\u2276", "lessgtr;": "\u2276", "LessLess;": "\u2AA1", "lesssim;": "\u2272", "LessSlantEqual;": "\u2A7D", "LessTilde;": "\u2272", "lfisht;": "\u297C", "lfloor;": "\u230A", "Lfr;": "\uD835\uDD0F", "lfr;": "\uD835\uDD29", "lg;": "\u2276", "lgE;": "\u2A91", "lHar;": "\u2962", "lhard;": "\u21BD", "lharu;": "\u21BC", "lharul;": "\u296A", "lhblk;": "\u2584", "LJcy;": "\u0409", "ljcy;": "\u0459", "Ll;": "\u22D8", "ll;": "\u226A", "llarr;": "\u21C7", "llcorner;": "\u231E", "Lleftarrow;": "\u21DA", "llhard;": "\u296B", "lltri;": "\u25FA", "Lmidot;": "\u013F", "lmidot;": "\u0140", "lmoust;": "\u23B0", "lmoustache;": "\u23B0", "lnap;": "\u2A89", "lnapprox;": "\u2A89", "lnE;": "\u2268", "lne;": "\u2A87", "lneq;": "\u2A87", "lneqq;": "\u2268", "lnsim;": "\u22E6", "loang;": "\u27EC", "loarr;": "\u21FD", "lobrk;": "\u27E6", "LongLeftArrow;": "\u27F5", "Longleftarrow;": "\u27F8", "longleftarrow;": "\u27F5", "LongLeftRightArrow;": "\u27F7", "Longleftrightarrow;": "\u27FA", "longleftrightarrow;": "\u27F7", "longmapsto;": "\u27FC", "LongRightArrow;": "\u27F6", "Longrightarrow;": "\u27F9", "longrightarrow;": "\u27F6", "looparrowleft;": "\u21AB", "looparrowright;": "\u21AC", "lopar;": "\u2985", "Lopf;": "\uD835\uDD43", "lopf;": "\uD835\uDD5D", "loplus;": "\u2A2D", "lotimes;": "\u2A34", "lowast;": "\u2217", "lowbar;": "\u005F", "LowerLeftArrow;": "\u2199", "LowerRightArrow;": "\u2198", "loz;": "\u25CA", "lozenge;": "\u25CA", "lozf;": "\u29EB", "lpar;": "\u0028", "lparlt;": "\u2993", "lrarr;": "\u21C6", "lrcorner;": "\u231F", "lrhar;": "\u21CB", "lrhard;": "\u296D", "lrm;": "\u200E", "lrtri;": "\u22BF", "lsaquo;": "\u2039", "Lscr;": "\u2112", "lscr;": "\uD835\uDCC1", "Lsh;": "\u21B0", "lsh;": "\u21B0", "lsim;": "\u2272", "lsime;": "\u2A8D", "lsimg;": "\u2A8F", "lsqb;": "\u005B", "lsquo;": "\u2018", "lsquor;": "\u201A", "Lstrok;": "\u0141", "lstrok;": "\u0142", "LT;": "\u003C", "LT": "\u003C", "Lt;": "\u226A", "lt;": "\u003C", "lt": "\u003C", "ltcc;": "\u2AA6", "ltcir;": "\u2A79", "ltdot;": "\u22D6", "lthree;": "\u22CB", "ltimes;": "\u22C9", "ltlarr;": "\u2976", "ltquest;": "\u2A7B", "ltri;": "\u25C3", "ltrie;": "\u22B4", "ltrif;": "\u25C2", "ltrPar;": "\u2996", "lurdshar;": "\u294A", "luruhar;": "\u2966", "lvertneqq;": "\u2268\uFE00", "lvnE;": "\u2268\uFE00", "macr;": "\u00AF", "macr": "\u00AF", "male;": "\u2642", "malt;": "\u2720", "maltese;": "\u2720", "Map;": "\u2905", "map;": "\u21A6", "mapsto;": "\u21A6", "mapstodown;": "\u21A7", "mapstoleft;": "\u21A4", "mapstoup;": "\u21A5", "marker;": "\u25AE", "mcomma;": "\u2A29", "Mcy;": "\u041C", "mcy;": "\u043C", "mdash;": "\u2014", "mDDot;": "\u223A", "measuredangle;": "\u2221", "MediumSpace;": "\u205F", "Mellintrf;": "\u2133", "Mfr;": "\uD835\uDD10", "mfr;": "\uD835\uDD2A", "mho;": "\u2127", "micro;": "\u00B5", "micro": "\u00B5", "mid;": "\u2223", "midast;": "\u002A", "midcir;": "\u2AF0", "middot;": "\u00B7", "middot": "\u00B7", "minus;": "\u2212", "minusb;": "\u229F", "minusd;": "\u2238", "minusdu;": "\u2A2A", "MinusPlus;": "\u2213", "mlcp;": "\u2ADB", "mldr;": "\u2026", "mnplus;": "\u2213", "models;": "\u22A7", "Mopf;": "\uD835\uDD44", "mopf;": "\uD835\uDD5E", "mp;": "\u2213", "Mscr;": "\u2133", "mscr;": "\uD835\uDCC2", "mstpos;": "\u223E", "Mu;": "\u039C", "mu;": "\u03BC", "multimap;": "\u22B8", "mumap;": "\u22B8", "nabla;": "\u2207", "Nacute;": "\u0143", "nacute;": "\u0144", "nang;": "\u2220\u20D2", "nap;": "\u2249", "napE;": "\u2A70\u0338", "napid;": "\u224B\u0338", "napos;": "\u0149", "napprox;": "\u2249", "natur;": "\u266E", "natural;": "\u266E", "naturals;": "\u2115", "nbsp;": "\u00A0", "nbsp": "\u00A0", "nbump;": "\u224E\u0338", "nbumpe;": "\u224F\u0338", "ncap;": "\u2A43", "Ncaron;": "\u0147", "ncaron;": "\u0148", "Ncedil;": "\u0145", "ncedil;": "\u0146", "ncong;": "\u2247", "ncongdot;": "\u2A6D\u0338", "ncup;": "\u2A42", "Ncy;": "\u041D", "ncy;": "\u043D", "ndash;": "\u2013", "ne;": "\u2260", "nearhk;": "\u2924", "neArr;": "\u21D7", "nearr;": "\u2197", "nearrow;": "\u2197", "nedot;": "\u2250\u0338", "NegativeMediumSpace;": "\u200B", "NegativeThickSpace;": "\u200B", "NegativeThinSpace;": "\u200B", "NegativeVeryThinSpace;": "\u200B", "nequiv;": "\u2262", "nesear;": "\u2928", "nesim;": "\u2242\u0338", "NestedGreaterGreater;": "\u226B", "NestedLessLess;": "\u226A", "NewLine;": "\u000A", "nexist;": "\u2204", "nexists;": "\u2204", "Nfr;": "\uD835\uDD11", "nfr;": "\uD835\uDD2B", "ngE;": "\u2267\u0338", "nge;": "\u2271", "ngeq;": "\u2271", "ngeqq;": "\u2267\u0338", "ngeqslant;": "\u2A7E\u0338", "nges;": "\u2A7E\u0338", "nGg;": "\u22D9\u0338", "ngsim;": "\u2275", "nGt;": "\u226B\u20D2", "ngt;": "\u226F", "ngtr;": "\u226F", "nGtv;": "\u226B\u0338", "nhArr;": "\u21CE", "nharr;": "\u21AE", "nhpar;": "\u2AF2", "ni;": "\u220B", "nis;": "\u22FC", "nisd;": "\u22FA", "niv;": "\u220B", "NJcy;": "\u040A", "njcy;": "\u045A", "nlArr;": "\u21CD", "nlarr;": "\u219A", "nldr;": "\u2025", "nlE;": "\u2266\u0338", "nle;": "\u2270", "nLeftarrow;": "\u21CD", "nleftarrow;": "\u219A", "nLeftrightarrow;": "\u21CE", "nleftrightarrow;": "\u21AE", "nleq;": "\u2270", "nleqq;": "\u2266\u0338", "nleqslant;": "\u2A7D\u0338", "nles;": "\u2A7D\u0338", "nless;": "\u226E", "nLl;": "\u22D8\u0338", "nlsim;": "\u2274", "nLt;": "\u226A\u20D2", "nlt;": "\u226E", "nltri;": "\u22EA", "nltrie;": "\u22EC", "nLtv;": "\u226A\u0338", "nmid;": "\u2224", "NoBreak;": "\u2060", "NonBreakingSpace;": "\u00A0", "Nopf;": "\u2115", "nopf;": "\uD835\uDD5F", "Not;": "\u2AEC", "not;": "\u00AC", "not": "\u00AC", "NotCongruent;": "\u2262", "NotCupCap;": "\u226D", "NotDoubleVerticalBar;": "\u2226", "NotElement;": "\u2209", "NotEqual;": "\u2260", "NotEqualTilde;": "\u2242\u0338", "NotExists;": "\u2204", "NotGreater;": "\u226F", "NotGreaterEqual;": "\u2271", "NotGreaterFullEqual;": "\u2267\u0338", "NotGreaterGreater;": "\u226B\u0338", "NotGreaterLess;": "\u2279", "NotGreaterSlantEqual;": "\u2A7E\u0338", "NotGreaterTilde;": "\u2275", "NotHumpDownHump;": "\u224E\u0338", "NotHumpEqual;": "\u224F\u0338", "notin;": "\u2209", "notindot;": "\u22F5\u0338", "notinE;": "\u22F9\u0338", "notinva;": "\u2209", "notinvb;": "\u22F7", "notinvc;": "\u22F6", "NotLeftTriangle;": "\u22EA", "NotLeftTriangleBar;": "\u29CF\u0338", "NotLeftTriangleEqual;": "\u22EC", "NotLess;": "\u226E", "NotLessEqual;": "\u2270", "NotLessGreater;": "\u2278", "NotLessLess;": "\u226A\u0338", "NotLessSlantEqual;": "\u2A7D\u0338", "NotLessTilde;": "\u2274", "NotNestedGreaterGreater;": "\u2AA2\u0338", "NotNestedLessLess;": "\u2AA1\u0338", "notni;": "\u220C", "notniva;": "\u220C", "notnivb;": "\u22FE", "notnivc;": "\u22FD", "NotPrecedes;": "\u2280", "NotPrecedesEqual;": "\u2AAF\u0338", "NotPrecedesSlantEqual;": "\u22E0", "NotReverseElement;": "\u220C", "NotRightTriangle;": "\u22EB", "NotRightTriangleBar;": "\u29D0\u0338", "NotRightTriangleEqual;": "\u22ED", "NotSquareSubset;": "\u228F\u0338", "NotSquareSubsetEqual;": "\u22E2", "NotSquareSuperset;": "\u2290\u0338", "NotSquareSupersetEqual;": "\u22E3", "NotSubset;": "\u2282\u20D2", "NotSubsetEqual;": "\u2288", "NotSucceeds;": "\u2281", "NotSucceedsEqual;": "\u2AB0\u0338", "NotSucceedsSlantEqual;": "\u22E1", "NotSucceedsTilde;": "\u227F\u0338", "NotSuperset;": "\u2283\u20D2", "NotSupersetEqual;": "\u2289", "NotTilde;": "\u2241", "NotTildeEqual;": "\u2244", "NotTildeFullEqual;": "\u2247", "NotTildeTilde;": "\u2249", "NotVerticalBar;": "\u2224", "npar;": "\u2226", "nparallel;": "\u2226", "nparsl;": "\u2AFD\u20E5", "npart;": "\u2202\u0338", "npolint;": "\u2A14", "npr;": "\u2280", "nprcue;": "\u22E0", "npre;": "\u2AAF\u0338", "nprec;": "\u2280", "npreceq;": "\u2AAF\u0338", "nrArr;": "\u21CF", "nrarr;": "\u219B", "nrarrc;": "\u2933\u0338", "nrarrw;": "\u219D\u0338", "nRightarrow;": "\u21CF", "nrightarrow;": "\u219B", "nrtri;": "\u22EB", "nrtrie;": "\u22ED", "nsc;": "\u2281", "nsccue;": "\u22E1", "nsce;": "\u2AB0\u0338", "Nscr;": "\uD835\uDCA9", "nscr;": "\uD835\uDCC3", "nshortmid;": "\u2224", "nshortparallel;": "\u2226", "nsim;": "\u2241", "nsime;": "\u2244", "nsimeq;": "\u2244", "nsmid;": "\u2224", "nspar;": "\u2226", "nsqsube;": "\u22E2", "nsqsupe;": "\u22E3", "nsub;": "\u2284", "nsubE;": "\u2AC5\u0338", "nsube;": "\u2288", "nsubset;": "\u2282\u20D2", "nsubseteq;": "\u2288", "nsubseteqq;": "\u2AC5\u0338", "nsucc;": "\u2281", "nsucceq;": "\u2AB0\u0338", "nsup;": "\u2285", "nsupE;": "\u2AC6\u0338", "nsupe;": "\u2289", "nsupset;": "\u2283\u20D2", "nsupseteq;": "\u2289", "nsupseteqq;": "\u2AC6\u0338", "ntgl;": "\u2279", "Ntilde;": "\u00D1", "Ntilde": "\u00D1", "ntilde;": "\u00F1", "ntilde": "\u00F1", "ntlg;": "\u2278", "ntriangleleft;": "\u22EA", "ntrianglelefteq;": "\u22EC", "ntriangleright;": "\u22EB", "ntrianglerighteq;": "\u22ED", "Nu;": "\u039D", "nu;": "\u03BD", "num;": "\u0023", "numero;": "\u2116", "numsp;": "\u2007", "nvap;": "\u224D\u20D2", "nVDash;": "\u22AF", "nVdash;": "\u22AE", "nvDash;": "\u22AD", "nvdash;": "\u22AC", "nvge;": "\u2265\u20D2", "nvgt;": "\u003E\u20D2", "nvHarr;": "\u2904", "nvinfin;": "\u29DE", "nvlArr;": "\u2902", "nvle;": "\u2264\u20D2", "nvlt;": "\u003C\u20D2", "nvltrie;": "\u22B4\u20D2", "nvrArr;": "\u2903", "nvrtrie;": "\u22B5\u20D2", "nvsim;": "\u223C\u20D2", "nwarhk;": "\u2923", "nwArr;": "\u21D6", "nwarr;": "\u2196", "nwarrow;": "\u2196", "nwnear;": "\u2927", "Oacute;": "\u00D3", "Oacute": "\u00D3", "oacute;": "\u00F3", "oacute": "\u00F3", "oast;": "\u229B", "ocir;": "\u229A", "Ocirc;": "\u00D4", "Ocirc": "\u00D4", "ocirc;": "\u00F4", "ocirc": "\u00F4", "Ocy;": "\u041E", "ocy;": "\u043E", "odash;": "\u229D", "Odblac;": "\u0150", "odblac;": "\u0151", "odiv;": "\u2A38", "odot;": "\u2299", "odsold;": "\u29BC", "OElig;": "\u0152", "oelig;": "\u0153", "ofcir;": "\u29BF", "Ofr;": "\uD835\uDD12", "ofr;": "\uD835\uDD2C", "ogon;": "\u02DB", "Ograve;": "\u00D2", "Ograve": "\u00D2", "ograve;": "\u00F2", "ograve": "\u00F2", "ogt;": "\u29C1", "ohbar;": "\u29B5", "ohm;": "\u03A9", "oint;": "\u222E", "olarr;": "\u21BA", "olcir;": "\u29BE", "olcross;": "\u29BB", "oline;": "\u203E", "olt;": "\u29C0", "Omacr;": "\u014C", "omacr;": "\u014D", "Omega;": "\u03A9", "omega;": "\u03C9", "Omicron;": "\u039F", "omicron;": "\u03BF", "omid;": "\u29B6", "ominus;": "\u2296", "Oopf;": "\uD835\uDD46", "oopf;": "\uD835\uDD60", "opar;": "\u29B7", "OpenCurlyDoubleQuote;": "\u201C", "OpenCurlyQuote;": "\u2018", "operp;": "\u29B9", "oplus;": "\u2295", "Or;": "\u2A54", "or;": "\u2228", "orarr;": "\u21BB", "ord;": "\u2A5D", "order;": "\u2134", "orderof;": "\u2134", "ordf;": "\u00AA", "ordf": "\u00AA", "ordm;": "\u00BA", "ordm": "\u00BA", "origof;": "\u22B6", "oror;": "\u2A56", "orslope;": "\u2A57", "orv;": "\u2A5B", "oS;": "\u24C8", "Oscr;": "\uD835\uDCAA", "oscr;": "\u2134", "Oslash;": "\u00D8", "Oslash": "\u00D8", "oslash;": "\u00F8", "oslash": "\u00F8", "osol;": "\u2298", "Otilde;": "\u00D5", "Otilde": "\u00D5", "otilde;": "\u00F5", "otilde": "\u00F5", "Otimes;": "\u2A37", "otimes;": "\u2297", "otimesas;": "\u2A36", "Ouml;": "\u00D6", "Ouml": "\u00D6", "ouml;": "\u00F6", "ouml": "\u00F6", "ovbar;": "\u233D", "OverBar;": "\u203E", "OverBrace;": "\u23DE", "OverBracket;": "\u23B4", "OverParenthesis;": "\u23DC", "par;": "\u2225", "para;": "\u00B6", "para": "\u00B6", "parallel;": "\u2225", "parsim;": "\u2AF3", "parsl;": "\u2AFD", "part;": "\u2202", "PartialD;": "\u2202", "Pcy;": "\u041F", "pcy;": "\u043F", "percnt;": "\u0025", "period;": "\u002E", "permil;": "\u2030", "perp;": "\u22A5", "pertenk;": "\u2031", "Pfr;": "\uD835\uDD13", "pfr;": "\uD835\uDD2D", "Phi;": "\u03A6", "phi;": "\u03C6", "phiv;": "\u03D5", "phmmat;": "\u2133", "phone;": "\u260E", "Pi;": "\u03A0", "pi;": "\u03C0", "pitchfork;": "\u22D4", "piv;": "\u03D6", "planck;": "\u210F", "planckh;": "\u210E", "plankv;": "\u210F", "plus;": "\u002B", "plusacir;": "\u2A23", "plusb;": "\u229E", "pluscir;": "\u2A22", "plusdo;": "\u2214", "plusdu;": "\u2A25", "pluse;": "\u2A72", "PlusMinus;": "\u00B1", "plusmn;": "\u00B1", "plusmn": "\u00B1", "plussim;": "\u2A26", "plustwo;": "\u2A27", "pm;": "\u00B1", "Poincareplane;": "\u210C", "pointint;": "\u2A15", "Popf;": "\u2119", "popf;": "\uD835\uDD61", "pound;": "\u00A3", "pound": "\u00A3", "Pr;": "\u2ABB", "pr;": "\u227A", "prap;": "\u2AB7", "prcue;": "\u227C", "prE;": "\u2AB3", "pre;": "\u2AAF", "prec;": "\u227A", "precapprox;": "\u2AB7", "preccurlyeq;": "\u227C", "Precedes;": "\u227A", "PrecedesEqual;": "\u2AAF", "PrecedesSlantEqual;": "\u227C", "PrecedesTilde;": "\u227E", "preceq;": "\u2AAF", "precnapprox;": "\u2AB9", "precneqq;": "\u2AB5", "precnsim;": "\u22E8", "precsim;": "\u227E", "Prime;": "\u2033", "prime;": "\u2032", "primes;": "\u2119", "prnap;": "\u2AB9", "prnE;": "\u2AB5", "prnsim;": "\u22E8", "prod;": "\u220F", "Product;": "\u220F", "profalar;": "\u232E", "profline;": "\u2312", "profsurf;": "\u2313", "prop;": "\u221D", "Proportion;": "\u2237", "Proportional;": "\u221D", "propto;": "\u221D", "prsim;": "\u227E", "prurel;": "\u22B0", "Pscr;": "\uD835\uDCAB", "pscr;": "\uD835\uDCC5", "Psi;": "\u03A8", "psi;": "\u03C8", "puncsp;": "\u2008", "Qfr;": "\uD835\uDD14", "qfr;": "\uD835\uDD2E", "qint;": "\u2A0C", "Qopf;": "\u211A", "qopf;": "\uD835\uDD62", "qprime;": "\u2057", "Qscr;": "\uD835\uDCAC", "qscr;": "\uD835\uDCC6", "quaternions;": "\u210D", "quatint;": "\u2A16", "quest;": "\u003F", "questeq;": "\u225F", "QUOT;": "\u0022", "QUOT": "\u0022", "quot;": "\u0022", "quot": "\u0022", "rAarr;": "\u21DB", "race;": "\u223D\u0331", "Racute;": "\u0154", "racute;": "\u0155", "radic;": "\u221A", "raemptyv;": "\u29B3", "Rang;": "\u27EB", "rang;": "\u27E9", "rangd;": "\u2992", "range;": "\u29A5", "rangle;": "\u27E9", "raquo;": "\u00BB", "raquo": "\u00BB", "Rarr;": "\u21A0", "rArr;": "\u21D2", "rarr;": "\u2192", "rarrap;": "\u2975", "rarrb;": "\u21E5", "rarrbfs;": "\u2920", "rarrc;": "\u2933", "rarrfs;": "\u291E", "rarrhk;": "\u21AA", "rarrlp;": "\u21AC", "rarrpl;": "\u2945", "rarrsim;": "\u2974", "Rarrtl;": "\u2916", "rarrtl;": "\u21A3", "rarrw;": "\u219D", "rAtail;": "\u291C", "ratail;": "\u291A", "ratio;": "\u2236", "rationals;": "\u211A", "RBarr;": "\u2910", "rBarr;": "\u290F", "rbarr;": "\u290D", "rbbrk;": "\u2773", "rbrace;": "\u007D", "rbrack;": "\u005D", "rbrke;": "\u298C", "rbrksld;": "\u298E", "rbrkslu;": "\u2990", "Rcaron;": "\u0158", "rcaron;": "\u0159", "Rcedil;": "\u0156", "rcedil;": "\u0157", "rceil;": "\u2309", "rcub;": "\u007D", "Rcy;": "\u0420", "rcy;": "\u0440", "rdca;": "\u2937", "rdldhar;": "\u2969", "rdquo;": "\u201D", "rdquor;": "\u201D", "rdsh;": "\u21B3", "Re;": "\u211C", "real;": "\u211C", "realine;": "\u211B", "realpart;": "\u211C", "reals;": "\u211D", "rect;": "\u25AD", "REG;": "\u00AE", "REG": "\u00AE", "reg;": "\u00AE", "reg": "\u00AE", "ReverseElement;": "\u220B", "ReverseEquilibrium;": "\u21CB", "ReverseUpEquilibrium;": "\u296F", "rfisht;": "\u297D", "rfloor;": "\u230B", "Rfr;": "\u211C", "rfr;": "\uD835\uDD2F", "rHar;": "\u2964", "rhard;": "\u21C1", "rharu;": "\u21C0", "rharul;": "\u296C", "Rho;": "\u03A1", "rho;": "\u03C1", "rhov;": "\u03F1", "RightAngleBracket;": "\u27E9", "RightArrow;": "\u2192", "Rightarrow;": "\u21D2", "rightarrow;": "\u2192", "RightArrowBar;": "\u21E5", "RightArrowLeftArrow;": "\u21C4", "rightarrowtail;": "\u21A3", "RightCeiling;": "\u2309", "RightDoubleBracket;": "\u27E7", "RightDownTeeVector;": "\u295D", "RightDownVector;": "\u21C2", "RightDownVectorBar;": "\u2955", "RightFloor;": "\u230B", "rightharpoondown;": "\u21C1", "rightharpoonup;": "\u21C0", "rightleftarrows;": "\u21C4", "rightleftharpoons;": "\u21CC", "rightrightarrows;": "\u21C9", "rightsquigarrow;": "\u219D", "RightTee;": "\u22A2", "RightTeeArrow;": "\u21A6", "RightTeeVector;": "\u295B", "rightthreetimes;": "\u22CC", "RightTriangle;": "\u22B3", "RightTriangleBar;": "\u29D0", "RightTriangleEqual;": "\u22B5", "RightUpDownVector;": "\u294F", "RightUpTeeVector;": "\u295C", "RightUpVector;": "\u21BE", "RightUpVectorBar;": "\u2954", "RightVector;": "\u21C0", "RightVectorBar;": "\u2953", "ring;": "\u02DA", "risingdotseq;": "\u2253", "rlarr;": "\u21C4", "rlhar;": "\u21CC", "rlm;": "\u200F", "rmoust;": "\u23B1", "rmoustache;": "\u23B1", "rnmid;": "\u2AEE", "roang;": "\u27ED", "roarr;": "\u21FE", "robrk;": "\u27E7", "ropar;": "\u2986", "Ropf;": "\u211D", "ropf;": "\uD835\uDD63", "roplus;": "\u2A2E", "rotimes;": "\u2A35", "RoundImplies;": "\u2970", "rpar;": "\u0029", "rpargt;": "\u2994", "rppolint;": "\u2A12", "rrarr;": "\u21C9", "Rrightarrow;": "\u21DB", "rsaquo;": "\u203A", "Rscr;": "\u211B", "rscr;": "\uD835\uDCC7", "Rsh;": "\u21B1", "rsh;": "\u21B1", "rsqb;": "\u005D", "rsquo;": "\u2019", "rsquor;": "\u2019", "rthree;": "\u22CC", "rtimes;": "\u22CA", "rtri;": "\u25B9", "rtrie;": "\u22B5", "rtrif;": "\u25B8", "rtriltri;": "\u29CE", "RuleDelayed;": "\u29F4", "ruluhar;": "\u2968", "rx;": "\u211E", "Sacute;": "\u015A", "sacute;": "\u015B", "sbquo;": "\u201A", "Sc;": "\u2ABC", "sc;": "\u227B", "scap;": "\u2AB8", "Scaron;": "\u0160", "scaron;": "\u0161", "sccue;": "\u227D", "scE;": "\u2AB4", "sce;": "\u2AB0", "Scedil;": "\u015E", "scedil;": "\u015F", "Scirc;": "\u015C", "scirc;": "\u015D", "scnap;": "\u2ABA", "scnE;": "\u2AB6", "scnsim;": "\u22E9", "scpolint;": "\u2A13", "scsim;": "\u227F", "Scy;": "\u0421", "scy;": "\u0441", "sdot;": "\u22C5", "sdotb;": "\u22A1", "sdote;": "\u2A66", "searhk;": "\u2925", "seArr;": "\u21D8", "searr;": "\u2198", "searrow;": "\u2198", "sect;": "\u00A7", "sect": "\u00A7", "semi;": "\u003B", "seswar;": "\u2929", "setminus;": "\u2216", "setmn;": "\u2216", "sext;": "\u2736", "Sfr;": "\uD835\uDD16", "sfr;": "\uD835\uDD30", "sfrown;": "\u2322", "sharp;": "\u266F", "SHCHcy;": "\u0429", "shchcy;": "\u0449", "SHcy;": "\u0428", "shcy;": "\u0448", "ShortDownArrow;": "\u2193", "ShortLeftArrow;": "\u2190", "shortmid;": "\u2223", "shortparallel;": "\u2225", "ShortRightArrow;": "\u2192", "ShortUpArrow;": "\u2191", "shy;": "\u00AD", "shy": "\u00AD", "Sigma;": "\u03A3", "sigma;": "\u03C3", "sigmaf;": "\u03C2", "sigmav;": "\u03C2", "sim;": "\u223C", "simdot;": "\u2A6A", "sime;": "\u2243", "simeq;": "\u2243", "simg;": "\u2A9E", "simgE;": "\u2AA0", "siml;": "\u2A9D", "simlE;": "\u2A9F", "simne;": "\u2246", "simplus;": "\u2A24", "simrarr;": "\u2972", "slarr;": "\u2190", "SmallCircle;": "\u2218", "smallsetminus;": "\u2216", "smashp;": "\u2A33", "smeparsl;": "\u29E4", "smid;": "\u2223", "smile;": "\u2323", "smt;": "\u2AAA", "smte;": "\u2AAC", "smtes;": "\u2AAC\uFE00", "SOFTcy;": "\u042C", "softcy;": "\u044C", "sol;": "\u002F", "solb;": "\u29C4", "solbar;": "\u233F", "Sopf;": "\uD835\uDD4A", "sopf;": "\uD835\uDD64", "spades;": "\u2660", "spadesuit;": "\u2660", "spar;": "\u2225", "sqcap;": "\u2293", "sqcaps;": "\u2293\uFE00", "sqcup;": "\u2294", "sqcups;": "\u2294\uFE00", "Sqrt;": "\u221A", "sqsub;": "\u228F", "sqsube;": "\u2291", "sqsubset;": "\u228F", "sqsubseteq;": "\u2291", "sqsup;": "\u2290", "sqsupe;": "\u2292", "sqsupset;": "\u2290", "sqsupseteq;": "\u2292", "squ;": "\u25A1", "Square;": "\u25A1", "square;": "\u25A1", "SquareIntersection;": "\u2293", "SquareSubset;": "\u228F", "SquareSubsetEqual;": "\u2291", "SquareSuperset;": "\u2290", "SquareSupersetEqual;": "\u2292", "SquareUnion;": "\u2294", "squarf;": "\u25AA", "squf;": "\u25AA", "srarr;": "\u2192", "Sscr;": "\uD835\uDCAE", "sscr;": "\uD835\uDCC8", "ssetmn;": "\u2216", "ssmile;": "\u2323", "sstarf;": "\u22C6", "Star;": "\u22C6", "star;": "\u2606", "starf;": "\u2605", "straightepsilon;": "\u03F5", "straightphi;": "\u03D5", "strns;": "\u00AF", "Sub;": "\u22D0", "sub;": "\u2282", "subdot;": "\u2ABD", "subE;": "\u2AC5", "sube;": "\u2286", "subedot;": "\u2AC3", "submult;": "\u2AC1", "subnE;": "\u2ACB", "subne;": "\u228A", "subplus;": "\u2ABF", "subrarr;": "\u2979", "Subset;": "\u22D0", "subset;": "\u2282", "subseteq;": "\u2286", "subseteqq;": "\u2AC5", "SubsetEqual;": "\u2286", "subsetneq;": "\u228A", "subsetneqq;": "\u2ACB", "subsim;": "\u2AC7", "subsub;": "\u2AD5", "subsup;": "\u2AD3", "succ;": "\u227B", "succapprox;": "\u2AB8", "succcurlyeq;": "\u227D", "Succeeds;": "\u227B", "SucceedsEqual;": "\u2AB0", "SucceedsSlantEqual;": "\u227D", "SucceedsTilde;": "\u227F", "succeq;": "\u2AB0", "succnapprox;": "\u2ABA", "succneqq;": "\u2AB6", "succnsim;": "\u22E9", "succsim;": "\u227F", "SuchThat;": "\u220B", "Sum;": "\u2211", "sum;": "\u2211", "sung;": "\u266A", "Sup;": "\u22D1", "sup;": "\u2283", "sup1;": "\u00B9", "sup1": "\u00B9", "sup2;": "\u00B2", "sup2": "\u00B2", "sup3;": "\u00B3", "sup3": "\u00B3", "supdot;": "\u2ABE", "supdsub;": "\u2AD8", "supE;": "\u2AC6", "supe;": "\u2287", "supedot;": "\u2AC4", "Superset;": "\u2283", "SupersetEqual;": "\u2287", "suphsol;": "\u27C9", "suphsub;": "\u2AD7", "suplarr;": "\u297B", "supmult;": "\u2AC2", "supnE;": "\u2ACC", "supne;": "\u228B", "supplus;": "\u2AC0", "Supset;": "\u22D1", "supset;": "\u2283", "supseteq;": "\u2287", "supseteqq;": "\u2AC6", "supsetneq;": "\u228B", "supsetneqq;": "\u2ACC", "supsim;": "\u2AC8", "supsub;": "\u2AD4", "supsup;": "\u2AD6", "swarhk;": "\u2926", "swArr;": "\u21D9", "swarr;": "\u2199", "swarrow;": "\u2199", "swnwar;": "\u292A", "szlig;": "\u00DF", "szlig": "\u00DF", "Tab;": "\u0009", "target;": "\u2316", "Tau;": "\u03A4", "tau;": "\u03C4", "tbrk;": "\u23B4", "Tcaron;": "\u0164", "tcaron;": "\u0165", "Tcedil;": "\u0162", "tcedil;": "\u0163", "Tcy;": "\u0422", "tcy;": "\u0442", "tdot;": "\u20DB", "telrec;": "\u2315", "Tfr;": "\uD835\uDD17", "tfr;": "\uD835\uDD31", "there4;": "\u2234", "Therefore;": "\u2234", "therefore;": "\u2234", "Theta;": "\u0398", "theta;": "\u03B8", "thetasym;": "\u03D1", "thetav;": "\u03D1", "thickapprox;": "\u2248", "thicksim;": "\u223C", "ThickSpace;": "\u205F\u200A", "thinsp;": "\u2009", "ThinSpace;": "\u2009", "thkap;": "\u2248", "thksim;": "\u223C", "THORN;": "\u00DE", "THORN": "\u00DE", "thorn;": "\u00FE", "thorn": "\u00FE", "Tilde;": "\u223C", "tilde;": "\u02DC", "TildeEqual;": "\u2243", "TildeFullEqual;": "\u2245", "TildeTilde;": "\u2248", "times;": "\u00D7", "times": "\u00D7", "timesb;": "\u22A0", "timesbar;": "\u2A31", "timesd;": "\u2A30", "tint;": "\u222D", "toea;": "\u2928", "top;": "\u22A4", "topbot;": "\u2336", "topcir;": "\u2AF1", "Topf;": "\uD835\uDD4B", "topf;": "\uD835\uDD65", "topfork;": "\u2ADA", "tosa;": "\u2929", "tprime;": "\u2034", "TRADE;": "\u2122", "trade;": "\u2122", "triangle;": "\u25B5", "triangledown;": "\u25BF", "triangleleft;": "\u25C3", "trianglelefteq;": "\u22B4", "triangleq;": "\u225C", "triangleright;": "\u25B9", "trianglerighteq;": "\u22B5", "tridot;": "\u25EC", "trie;": "\u225C", "triminus;": "\u2A3A", "TripleDot;": "\u20DB", "triplus;": "\u2A39", "trisb;": "\u29CD", "tritime;": "\u2A3B", "trpezium;": "\u23E2", "Tscr;": "\uD835\uDCAF", "tscr;": "\uD835\uDCC9", "TScy;": "\u0426", "tscy;": "\u0446", "TSHcy;": "\u040B", "tshcy;": "\u045B", "Tstrok;": "\u0166", "tstrok;": "\u0167", "twixt;": "\u226C", "twoheadleftarrow;": "\u219E", "twoheadrightarrow;": "\u21A0", "Uacute;": "\u00DA", "Uacute": "\u00DA", "uacute;": "\u00FA", "uacute": "\u00FA", "Uarr;": "\u219F", "uArr;": "\u21D1", "uarr;": "\u2191", "Uarrocir;": "\u2949", "Ubrcy;": "\u040E", "ubrcy;": "\u045E", "Ubreve;": "\u016C", "ubreve;": "\u016D", "Ucirc;": "\u00DB", "Ucirc": "\u00DB", "ucirc;": "\u00FB", "ucirc": "\u00FB", "Ucy;": "\u0423", "ucy;": "\u0443", "udarr;": "\u21C5", "Udblac;": "\u0170", "udblac;": "\u0171", "udhar;": "\u296E", "ufisht;": "\u297E", "Ufr;": "\uD835\uDD18", "ufr;": "\uD835\uDD32", "Ugrave;": "\u00D9", "Ugrave": "\u00D9", "ugrave;": "\u00F9", "ugrave": "\u00F9", "uHar;": "\u2963", "uharl;": "\u21BF", "uharr;": "\u21BE", "uhblk;": "\u2580", "ulcorn;": "\u231C", "ulcorner;": "\u231C", "ulcrop;": "\u230F", "ultri;": "\u25F8", "Umacr;": "\u016A", "umacr;": "\u016B", "uml;": "\u00A8", "uml": "\u00A8", "UnderBar;": "\u005F", "UnderBrace;": "\u23DF", "UnderBracket;": "\u23B5", "UnderParenthesis;": "\u23DD", "Union;": "\u22C3", "UnionPlus;": "\u228E", "Uogon;": "\u0172", "uogon;": "\u0173", "Uopf;": "\uD835\uDD4C", "uopf;": "\uD835\uDD66", "UpArrow;": "\u2191", "Uparrow;": "\u21D1", "uparrow;": "\u2191", "UpArrowBar;": "\u2912", "UpArrowDownArrow;": "\u21C5", "UpDownArrow;": "\u2195", "Updownarrow;": "\u21D5", "updownarrow;": "\u2195", "UpEquilibrium;": "\u296E", "upharpoonleft;": "\u21BF", "upharpoonright;": "\u21BE", "uplus;": "\u228E", "UpperLeftArrow;": "\u2196", "UpperRightArrow;": "\u2197", "Upsi;": "\u03D2", "upsi;": "\u03C5", "upsih;": "\u03D2", "Upsilon;": "\u03A5", "upsilon;": "\u03C5", "UpTee;": "\u22A5", "UpTeeArrow;": "\u21A5", "upuparrows;": "\u21C8", "urcorn;": "\u231D", "urcorner;": "\u231D", "urcrop;": "\u230E", "Uring;": "\u016E", "uring;": "\u016F", "urtri;": "\u25F9", "Uscr;": "\uD835\uDCB0", "uscr;": "\uD835\uDCCA", "utdot;": "\u22F0", "Utilde;": "\u0168", "utilde;": "\u0169", "utri;": "\u25B5", "utrif;": "\u25B4", "uuarr;": "\u21C8", "Uuml;": "\u00DC", "Uuml": "\u00DC", "uuml;": "\u00FC", "uuml": "\u00FC", "uwangle;": "\u29A7", "vangrt;": "\u299C", "varepsilon;": "\u03F5", "varkappa;": "\u03F0", "varnothing;": "\u2205", "varphi;": "\u03D5", "varpi;": "\u03D6", "varpropto;": "\u221D", "vArr;": "\u21D5", "varr;": "\u2195", "varrho;": "\u03F1", "varsigma;": "\u03C2", "varsubsetneq;": "\u228A\uFE00", "varsubsetneqq;": "\u2ACB\uFE00", "varsupsetneq;": "\u228B\uFE00", "varsupsetneqq;": "\u2ACC\uFE00", "vartheta;": "\u03D1", "vartriangleleft;": "\u22B2", "vartriangleright;": "\u22B3", "Vbar;": "\u2AEB", "vBar;": "\u2AE8", "vBarv;": "\u2AE9", "Vcy;": "\u0412", "vcy;": "\u0432", "VDash;": "\u22AB", "Vdash;": "\u22A9", "vDash;": "\u22A8", "vdash;": "\u22A2", "Vdashl;": "\u2AE6", "Vee;": "\u22C1", "vee;": "\u2228", "veebar;": "\u22BB", "veeeq;": "\u225A", "vellip;": "\u22EE", "Verbar;": "\u2016", "verbar;": "\u007C", "Vert;": "\u2016", "vert;": "\u007C", "VerticalBar;": "\u2223", "VerticalLine;": "\u007C", "VerticalSeparator;": "\u2758", "VerticalTilde;": "\u2240", "VeryThinSpace;": "\u200A", "Vfr;": "\uD835\uDD19", "vfr;": "\uD835\uDD33", "vltri;": "\u22B2", "vnsub;": "\u2282\u20D2", "vnsup;": "\u2283\u20D2", "Vopf;": "\uD835\uDD4D", "vopf;": "\uD835\uDD67", "vprop;": "\u221D", "vrtri;": "\u22B3", "Vscr;": "\uD835\uDCB1", "vscr;": "\uD835\uDCCB", "vsubnE;": "\u2ACB\uFE00", "vsubne;": "\u228A\uFE00", "vsupnE;": "\u2ACC\uFE00", "vsupne;": "\u228B\uFE00", "Vvdash;": "\u22AA", "vzigzag;": "\u299A", "Wcirc;": "\u0174", "wcirc;": "\u0175", "wedbar;": "\u2A5F", "Wedge;": "\u22C0", "wedge;": "\u2227", "wedgeq;": "\u2259", "weierp;": "\u2118", "Wfr;": "\uD835\uDD1A", "wfr;": "\uD835\uDD34", "Wopf;": "\uD835\uDD4E", "wopf;": "\uD835\uDD68", "wp;": "\u2118", "wr;": "\u2240", "wreath;": "\u2240", "Wscr;": "\uD835\uDCB2", "wscr;": "\uD835\uDCCC", "xcap;": "\u22C2", "xcirc;": "\u25EF", "xcup;": "\u22C3", "xdtri;": "\u25BD", "Xfr;": "\uD835\uDD1B", "xfr;": "\uD835\uDD35", "xhArr;": "\u27FA", "xharr;": "\u27F7", "Xi;": "\u039E", "xi;": "\u03BE", "xlArr;": "\u27F8", "xlarr;": "\u27F5", "xmap;": "\u27FC", "xnis;": "\u22FB", "xodot;": "\u2A00", "Xopf;": "\uD835\uDD4F", "xopf;": "\uD835\uDD69", "xoplus;": "\u2A01", "xotime;": "\u2A02", "xrArr;": "\u27F9", "xrarr;": "\u27F6", "Xscr;": "\uD835\uDCB3", "xscr;": "\uD835\uDCCD", "xsqcup;": "\u2A06", "xuplus;": "\u2A04", "xutri;": "\u25B3", "xvee;": "\u22C1", "xwedge;": "\u22C0", "Yacute;": "\u00DD", "Yacute": "\u00DD", "yacute;": "\u00FD", "yacute": "\u00FD", "YAcy;": "\u042F", "yacy;": "\u044F", "Ycirc;": "\u0176", "ycirc;": "\u0177", "Ycy;": "\u042B", "ycy;": "\u044B", "yen;": "\u00A5", "yen": "\u00A5", "Yfr;": "\uD835\uDD1C", "yfr;": "\uD835\uDD36", "YIcy;": "\u0407", "yicy;": "\u0457", "Yopf;": "\uD835\uDD50", "yopf;": "\uD835\uDD6A", "Yscr;": "\uD835\uDCB4", "yscr;": "\uD835\uDCCE", "YUcy;": "\u042E", "yucy;": "\u044E", "Yuml;": "\u0178", "yuml;": "\u00FF", "yuml": "\u00FF", "Zacute;": "\u0179", "zacute;": "\u017A", "Zcaron;": "\u017D", "zcaron;": "\u017E", "Zcy;": "\u0417", "zcy;": "\u0437", "Zdot;": "\u017B", "zdot;": "\u017C", "zeetrf;": "\u2128", "ZeroWidthSpace;": "\u200B", "Zeta;": "\u0396", "zeta;": "\u03B6", "Zfr;": "\u2128", "zfr;": "\uD835\uDD37", "ZHcy;": "\u0416", "zhcy;": "\u0436", "zigrarr;": "\u21DD", "Zopf;": "\u2124", "zopf;": "\uD835\uDD6B", "Zscr;": "\uD835\uDCB5", "zscr;": "\uD835\uDCCF", "zwj;": "\u200D", "zwnj;": "\u200C" }; function startsWith$1(haystack, needle) { if (haystack.length < needle.length) { return false; } for (var i = 0; i < needle.length; i++) { if (haystack[i] !== needle[i]) { return false; } } return true; } function endsWith$1(haystack, needle) { var diff = haystack.length - needle.length; if (diff > 0) { return haystack.lastIndexOf(needle) === diff; } else if (diff === 0) { return haystack === needle; } else { return false; } } function repeat(value, count) { var s = ''; while (count > 0) { if ((count & 1) === 1) { s += value; } value += value; count = count >>> 1; } return s; } var _a$2 = 'a'.charCodeAt(0); var _z$1 = 'z'.charCodeAt(0); var _A$1 = 'A'.charCodeAt(0); var _Z$1 = 'Z'.charCodeAt(0); var _0$2 = '0'.charCodeAt(0); var _9$2 = '9'.charCodeAt(0); function isLetterOrDigit(text, index) { var c = text.charCodeAt(index); return (_a$2 <= c && c <= _z$1) || (_A$1 <= c && c <= _Z$1) || (_0$2 <= c && c <= _9$2); } function isDefined$1(obj) { return typeof obj !== 'undefined'; } function normalizeMarkupContent(input) { if (!input) { return undefined; } if (typeof input === 'string') { return { kind: 'markdown', value: input }; } return { kind: 'markdown', value: input.value }; } var HTMLDataProvider = (function () { function HTMLDataProvider(id, customData) { var _this = this; this.id = id; this._tags = []; this._tagMap = {}; this._valueSetMap = {}; this._tags = customData.tags || []; this._globalAttributes = customData.globalAttributes || []; this._tags.forEach(function (t) { _this._tagMap[t.name.toLowerCase()] = t; }); if (customData.valueSets) { customData.valueSets.forEach(function (vs) { _this._valueSetMap[vs.name] = vs.values; }); } } HTMLDataProvider.prototype.isApplicable = function () { return true; }; HTMLDataProvider.prototype.getId = function () { return this.id; }; HTMLDataProvider.prototype.provideTags = function () { return this._tags; }; HTMLDataProvider.prototype.provideAttributes = function (tag) { var attributes = []; var processAttribute = function (a) { attributes.push(a); }; var tagEntry = this._tagMap[tag.toLowerCase()]; if (tagEntry) { tagEntry.attributes.forEach(processAttribute); } this._globalAttributes.forEach(processAttribute); return attributes; }; HTMLDataProvider.prototype.provideValues = function (tag, attribute) { var _this = this; var values = []; attribute = attribute.toLowerCase(); var processAttributes = function (attributes) { attributes.forEach(function (a) { if (a.name.toLowerCase() === attribute) { if (a.values) { a.values.forEach(function (v) { values.push(v); }); } if (a.valueSet) { if (_this._valueSetMap[a.valueSet]) { _this._valueSetMap[a.valueSet].forEach(function (v) { values.push(v); }); } } } }); }; var tagEntry = this._tagMap[tag.toLowerCase()]; if (tagEntry) { processAttributes(tagEntry.attributes); } processAttributes(this._globalAttributes); return values; }; return HTMLDataProvider; }()); function generateDocumentation(item, settings, doesSupportMarkdown) { if (settings === void 0) { settings = {}; } var result = { kind: doesSupportMarkdown ? 'markdown' : 'plaintext', value: '' }; if (item.description && settings.documentation !== false) { var normalizedDescription = normalizeMarkupContent(item.description); if (normalizedDescription) { result.value += normalizedDescription.value; } } if (item.references && item.references.length > 0 && settings.references !== false) { if (result.value.length) { result.value += "\n\n"; } if (doesSupportMarkdown) { result.value += item.references.map(function (r) { return "[" + r.name + "](" + r.url + ")"; }).join(' | '); } else { result.value += item.references.map(function (r) { return r.name + ": " + r.url; }).join('\n'); } } if (result.value === '') { return undefined; } return result; } var __awaiter$6 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator$5 = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var PathCompletionParticipant$1 = (function () { function PathCompletionParticipant(readDirectory) { this.readDirectory = readDirectory; this.atributeCompletions = []; } PathCompletionParticipant.prototype.onHtmlAttributeValue = function (context) { if (isPathAttribute(context.tag, context.attribute)) { this.atributeCompletions.push(context); } }; PathCompletionParticipant.prototype.computeCompletions = function (document, documentContext) { return __awaiter$6(this, void 0, void 0, function () { var result, _i, _a, attributeCompletion, fullValue, replaceRange, suggestions, _b, suggestions_1, item; return __generator$5(this, function (_c) { switch (_c.label) { case 0: result = { items: [], isIncomplete: false }; _i = 0, _a = this.atributeCompletions; _c.label = 1; case 1: if (!(_i < _a.length)) return [3 , 5]; attributeCompletion = _a[_i]; fullValue = stripQuotes$1(document.getText(attributeCompletion.range)); if (!isCompletablePath(fullValue)) return [3 , 4]; if (!(fullValue === '.' || fullValue === '..')) return [3 , 2]; result.isIncomplete = true; return [3 , 4]; case 2: replaceRange = pathToReplaceRange$1(attributeCompletion.value, fullValue, attributeCompletion.range); return [4 , this.providePathSuggestions(attributeCompletion.value, replaceRange, document, documentContext)]; case 3: suggestions = _c.sent(); for (_b = 0, suggestions_1 = suggestions; _b < suggestions_1.length; _b++) { item = suggestions_1[_b]; result.items.push(item); } _c.label = 4; case 4: _i++; return [3 , 1]; case 5: return [2 , result]; } }); }); }; PathCompletionParticipant.prototype.providePathSuggestions = function (valueBeforeCursor, replaceRange, document, documentContext) { return __awaiter$6(this, void 0, void 0, function () { var valueBeforeLastSlash, parentDir, result, infos, _i, infos_1, _a, name, type; return __generator$5(this, function (_b) { switch (_b.label) { case 0: valueBeforeLastSlash = valueBeforeCursor.substring(0, valueBeforeCursor.lastIndexOf('/') + 1); parentDir = documentContext.resolveReference(valueBeforeLastSlash || '.', document.uri); if (!parentDir) return [3 , 4]; _b.label = 1; case 1: _b.trys.push([1, 3, , 4]); result = []; return [4 , this.readDirectory(parentDir)]; case 2: infos = _b.sent(); for (_i = 0, infos_1 = infos; _i < infos_1.length; _i++) { _a = infos_1[_i], name = _a[0], type = _a[1]; if (name.charCodeAt(0) !== CharCode_dot$1) { result.push(createCompletionItem$1(name, type === FileType$2.Directory, replaceRange)); } } return [2 , result]; case 3: _b.sent(); return [3 , 4]; case 4: return [2 , []]; } }); }); }; return PathCompletionParticipant; }()); var CharCode_dot$1 = '.'.charCodeAt(0); function stripQuotes$1(fullValue) { if (startsWith$1(fullValue, "'") || startsWith$1(fullValue, "\"")) { return fullValue.slice(1, -1); } else { return fullValue; } } function isCompletablePath(value) { if (startsWith$1(value, 'http') || startsWith$1(value, 'https') || startsWith$1(value, '//')) { return false; } return true; } function isPathAttribute(tag, attr) { var a = PATH_TAG_AND_ATTR[tag]; if (a) { if (typeof a === 'string') { return a === attr; } else { return a.indexOf(attr) !== -1; } } return false; } function pathToReplaceRange$1(valueBeforeCursor, fullValue, range) { var replaceRange; var lastIndexOfSlash = valueBeforeCursor.lastIndexOf('/'); if (lastIndexOfSlash === -1) { replaceRange = shiftRange$1(range, 1, -1); } else { var valueAfterLastSlash = fullValue.slice(lastIndexOfSlash + 1); var startPos = shiftPosition$1(range.end, -1 - valueAfterLastSlash.length); var whitespaceIndex = valueAfterLastSlash.indexOf(' '); var endPos = void 0; if (whitespaceIndex !== -1) { endPos = shiftPosition$1(startPos, whitespaceIndex); } else { endPos = shiftPosition$1(range.end, -1); } replaceRange = Range.create(startPos, endPos); } return replaceRange; } function createCompletionItem$1(p, isDir, replaceRange) { if (isDir) { p = p + '/'; return { label: p, kind: CompletionItemKind.Folder, textEdit: TextEdit.replace(replaceRange, p), command: { title: 'Suggest', command: 'editor.action.triggerSuggest' } }; } else { return { label: p, kind: CompletionItemKind.File, textEdit: TextEdit.replace(replaceRange, p) }; } } function shiftPosition$1(pos, offset) { return Position.create(pos.line, pos.character + offset); } function shiftRange$1(range, startOffset, endOffset) { var start = shiftPosition$1(range.start, startOffset); var end = shiftPosition$1(range.end, endOffset); return Range.create(start, end); } var PATH_TAG_AND_ATTR = { a: 'href', area: 'href', body: 'background', del: 'cite', form: 'action', frame: ['src', 'longdesc'], img: ['src', 'longdesc'], ins: 'cite', link: 'href', object: 'data', q: 'cite', script: 'src', audio: 'src', button: 'formaction', command: 'icon', embed: 'src', html: 'manifest', input: ['src', 'formaction'], source: 'src', track: 'src', video: ['src', 'poster'] }; var __awaiter$5 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator$4 = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var localize$d = main$3.loadMessageBundle(); var HTMLCompletion = (function () { function HTMLCompletion(lsOptions, dataManager) { this.lsOptions = lsOptions; this.dataManager = dataManager; this.completionParticipants = []; } HTMLCompletion.prototype.setCompletionParticipants = function (registeredCompletionParticipants) { this.completionParticipants = registeredCompletionParticipants || []; }; HTMLCompletion.prototype.doComplete2 = function (document, position, htmlDocument, documentContext, settings) { return __awaiter$5(this, void 0, void 0, function () { var participant, contributedParticipants, result, pathCompletionResult; return __generator$4(this, function (_a) { switch (_a.label) { case 0: if (!this.lsOptions.fileSystemProvider || !this.lsOptions.fileSystemProvider.readDirectory) { return [2 , this.doComplete(document, position, htmlDocument, settings)]; } participant = new PathCompletionParticipant$1(this.lsOptions.fileSystemProvider.readDirectory); contributedParticipants = this.completionParticipants; this.completionParticipants = [participant].concat(contributedParticipants); result = this.doComplete(document, position, htmlDocument, settings); _a.label = 1; case 1: _a.trys.push([1, , 3, 4]); return [4 , participant.computeCompletions(document, documentContext)]; case 2: pathCompletionResult = _a.sent(); return [2 , { isIncomplete: result.isIncomplete || pathCompletionResult.isIncomplete, items: pathCompletionResult.items.concat(result.items) }]; case 3: this.completionParticipants = contributedParticipants; return [7 ]; case 4: return [2 ]; } }); }); }; HTMLCompletion.prototype.doComplete = function (document, position, htmlDocument, settings) { var result = this._doComplete(document, position, htmlDocument, settings); return this.convertCompletionList(result); }; HTMLCompletion.prototype._doComplete = function (document, position, htmlDocument, settings) { var result = { isIncomplete: false, items: [] }; var completionParticipants = this.completionParticipants; var dataProviders = this.dataManager.getDataProviders().filter(function (p) { return p.isApplicable(document.languageId) && (!settings || settings[p.getId()] !== false); }); var doesSupportMarkdown = this.doesSupportMarkdown(); var text = document.getText(); var offset = document.offsetAt(position); var node = htmlDocument.findNodeBefore(offset); if (!node) { return result; } var scanner = createScanner$1(text, node.start); var currentTag = ''; var currentAttributeName; function getReplaceRange(replaceStart, replaceEnd) { if (replaceEnd === void 0) { replaceEnd = offset; } if (replaceStart > offset) { replaceStart = offset; } return { start: document.positionAt(replaceStart), end: document.positionAt(replaceEnd) }; } function collectOpenTagSuggestions(afterOpenBracket, tagNameEnd) { var range = getReplaceRange(afterOpenBracket, tagNameEnd); dataProviders.forEach(function (provider) { provider.provideTags().forEach(function (tag) { result.items.push({ label: tag.name, kind: CompletionItemKind.Property, documentation: generateDocumentation(tag, undefined, doesSupportMarkdown), textEdit: TextEdit.replace(range, tag.name), insertTextFormat: InsertTextFormat.PlainText }); }); }); return result; } function getLineIndent(offset) { var start = offset; while (start > 0) { var ch = text.charAt(start - 1); if ("\n\r".indexOf(ch) >= 0) { return text.substring(start, offset); } if (!isWhiteSpace$5(ch)) { return null; } start--; } return text.substring(0, offset); } function collectCloseTagSuggestions(afterOpenBracket, inOpenTag, tagNameEnd) { if (tagNameEnd === void 0) { tagNameEnd = offset; } var range = getReplaceRange(afterOpenBracket, tagNameEnd); var closeTag = isFollowedBy(text, tagNameEnd, ScannerState.WithinEndTag, TokenType$1.EndTagClose) ? '' : '>'; var curr = node; if (inOpenTag) { curr = curr.parent; } while (curr) { var tag = curr.tag; if (tag && (!curr.closed || curr.endTagStart && (curr.endTagStart > offset))) { var item = { label: '/' + tag, kind: CompletionItemKind.Property, filterText: '/' + tag, textEdit: TextEdit.replace(range, '/' + tag + closeTag), insertTextFormat: InsertTextFormat.PlainText }; var startIndent = getLineIndent(curr.start); var endIndent = getLineIndent(afterOpenBracket - 1); if (startIndent !== null && endIndent !== null && startIndent !== endIndent) { var insertText = startIndent + '', kind: CompletionItemKind.Property, filterText: '', textEdit: TextEdit.insert(pos, '$0'), insertTextFormat: InsertTextFormat.Snippet }); } return result; } function collectTagSuggestions(tagStart, tagEnd) { collectOpenTagSuggestions(tagStart, tagEnd); collectCloseTagSuggestions(tagStart, true, tagEnd); return result; } function getExistingAttributes() { var existingAttributes = Object.create(null); node.attributeNames.forEach(function (attribute) { existingAttributes[attribute] = true; }); return existingAttributes; } function collectAttributeNameSuggestions(nameStart, nameEnd) { var _a; if (nameEnd === void 0) { nameEnd = offset; } var replaceEnd = offset; while (replaceEnd < nameEnd && text[replaceEnd] !== '<') { replaceEnd++; } var currentAttribute = text.substring(nameStart, nameEnd); var range = getReplaceRange(nameStart, replaceEnd); var value = ''; if (!isFollowedBy(text, nameEnd, ScannerState.AfterAttributeName, TokenType$1.DelimiterAssign)) { var defaultValue = (_a = settings === null || settings === void 0 ? void 0 : settings.attributeDefaultValue) !== null && _a !== void 0 ? _a : 'doublequotes'; if (defaultValue === 'empty') { value = '=$1'; } else if (defaultValue === 'singlequotes') { value = '=\'$1\''; } else { value = '="$1"'; } } var seenAttributes = getExistingAttributes(); seenAttributes[currentAttribute] = false; dataProviders.forEach(function (provider) { provider.provideAttributes(currentTag).forEach(function (attr) { if (seenAttributes[attr.name]) { return; } seenAttributes[attr.name] = true; var codeSnippet = attr.name; var command; if (attr.valueSet !== 'v' && value.length) { codeSnippet = codeSnippet + value; if (attr.valueSet || attr.name === 'style') { command = { title: 'Suggest', command: 'editor.action.triggerSuggest' }; } } result.items.push({ label: attr.name, kind: attr.valueSet === 'handler' ? CompletionItemKind.Function : CompletionItemKind.Value, documentation: generateDocumentation(attr, undefined, doesSupportMarkdown), textEdit: TextEdit.replace(range, codeSnippet), insertTextFormat: InsertTextFormat.Snippet, command: command }); }); }); collectDataAttributesSuggestions(range, seenAttributes); return result; } function collectDataAttributesSuggestions(range, seenAttributes) { var dataAttr = 'data-'; var dataAttributes = {}; dataAttributes[dataAttr] = dataAttr + "$1=\"$2\""; function addNodeDataAttributes(node) { node.attributeNames.forEach(function (attr) { if (startsWith$1(attr, dataAttr) && !dataAttributes[attr] && !seenAttributes[attr]) { dataAttributes[attr] = attr + '="$1"'; } }); node.children.forEach(function (child) { return addNodeDataAttributes(child); }); } if (htmlDocument) { htmlDocument.roots.forEach(function (root) { return addNodeDataAttributes(root); }); } Object.keys(dataAttributes).forEach(function (attr) { return result.items.push({ label: attr, kind: CompletionItemKind.Value, textEdit: TextEdit.replace(range, dataAttributes[attr]), insertTextFormat: InsertTextFormat.Snippet }); }); } function collectAttributeValueSuggestions(valueStart, valueEnd) { if (valueEnd === void 0) { valueEnd = offset; } var range; var addQuotes; var valuePrefix; if (offset > valueStart && offset <= valueEnd && isQuote$4(text[valueStart])) { var valueContentStart = valueStart + 1; var valueContentEnd = valueEnd; if (valueEnd > valueStart && text[valueEnd - 1] === text[valueStart]) { valueContentEnd--; } var wsBefore = getWordStart(text, offset, valueContentStart); var wsAfter = getWordEnd(text, offset, valueContentEnd); range = getReplaceRange(wsBefore, wsAfter); valuePrefix = offset >= valueContentStart && offset <= valueContentEnd ? text.substring(valueContentStart, offset) : ''; addQuotes = false; } else { range = getReplaceRange(valueStart, valueEnd); valuePrefix = text.substring(valueStart, offset); addQuotes = true; } if (completionParticipants.length > 0) { var tag = currentTag.toLowerCase(); var attribute = currentAttributeName.toLowerCase(); var fullRange = getReplaceRange(valueStart, valueEnd); for (var _i = 0, completionParticipants_1 = completionParticipants; _i < completionParticipants_1.length; _i++) { var participant = completionParticipants_1[_i]; if (participant.onHtmlAttributeValue) { participant.onHtmlAttributeValue({ document: document, position: position, tag: tag, attribute: attribute, value: valuePrefix, range: fullRange }); } } } dataProviders.forEach(function (provider) { provider.provideValues(currentTag, currentAttributeName).forEach(function (value) { var insertText = addQuotes ? '"' + value.name + '"' : value.name; result.items.push({ label: value.name, filterText: insertText, kind: CompletionItemKind.Unit, documentation: generateDocumentation(value, undefined, doesSupportMarkdown), textEdit: TextEdit.replace(range, insertText), insertTextFormat: InsertTextFormat.PlainText }); }); }); collectCharacterEntityProposals(); return result; } function scanNextForEndPos(nextToken) { if (offset === scanner.getTokenEnd()) { token = scanner.scan(); if (token === nextToken && scanner.getTokenOffset() === offset) { return scanner.getTokenEnd(); } } return offset; } function collectInsideContent() { for (var _i = 0, completionParticipants_2 = completionParticipants; _i < completionParticipants_2.length; _i++) { var participant = completionParticipants_2[_i]; if (participant.onHtmlContent) { participant.onHtmlContent({ document: document, position: position }); } } return collectCharacterEntityProposals(); } function collectCharacterEntityProposals() { var k = offset - 1; var characterStart = position.character; while (k >= 0 && isLetterOrDigit(text, k)) { k--; characterStart--; } if (k >= 0 && text[k] === '&') { var range = Range.create(Position.create(position.line, characterStart - 1), position); for (var entity in entities) { if (endsWith$1(entity, ';')) { var label = '&' + entity; result.items.push({ label: label, kind: CompletionItemKind.Keyword, documentation: localize$d('entity.propose', "Character entity representing '" + entities[entity] + "'"), textEdit: TextEdit.replace(range, label), insertTextFormat: InsertTextFormat.PlainText }); } } } return result; } function suggestDoctype(replaceStart, replaceEnd) { var range = getReplaceRange(replaceStart, replaceEnd); result.items.push({ label: '!DOCTYPE', kind: CompletionItemKind.Property, documentation: 'A preamble for an HTML document.', textEdit: TextEdit.replace(range, '!DOCTYPE html>'), insertTextFormat: InsertTextFormat.PlainText }); } var token = scanner.scan(); while (token !== TokenType$1.EOS && scanner.getTokenOffset() <= offset) { switch (token) { case TokenType$1.StartTagOpen: if (scanner.getTokenEnd() === offset) { var endPos = scanNextForEndPos(TokenType$1.StartTag); if (position.line === 0) { suggestDoctype(offset, endPos); } return collectTagSuggestions(offset, endPos); } break; case TokenType$1.StartTag: if (scanner.getTokenOffset() <= offset && offset <= scanner.getTokenEnd()) { return collectOpenTagSuggestions(scanner.getTokenOffset(), scanner.getTokenEnd()); } currentTag = scanner.getTokenText(); break; case TokenType$1.AttributeName: if (scanner.getTokenOffset() <= offset && offset <= scanner.getTokenEnd()) { return collectAttributeNameSuggestions(scanner.getTokenOffset(), scanner.getTokenEnd()); } currentAttributeName = scanner.getTokenText(); break; case TokenType$1.DelimiterAssign: if (scanner.getTokenEnd() === offset) { var endPos = scanNextForEndPos(TokenType$1.AttributeValue); return collectAttributeValueSuggestions(offset, endPos); } break; case TokenType$1.AttributeValue: if (scanner.getTokenOffset() <= offset && offset <= scanner.getTokenEnd()) { return collectAttributeValueSuggestions(scanner.getTokenOffset(), scanner.getTokenEnd()); } break; case TokenType$1.Whitespace: if (offset <= scanner.getTokenEnd()) { switch (scanner.getScannerState()) { case ScannerState.AfterOpeningStartTag: var startPos = scanner.getTokenOffset(); var endTagPos = scanNextForEndPos(TokenType$1.StartTag); return collectTagSuggestions(startPos, endTagPos); case ScannerState.WithinTag: case ScannerState.AfterAttributeName: return collectAttributeNameSuggestions(scanner.getTokenEnd()); case ScannerState.BeforeAttributeValue: return collectAttributeValueSuggestions(scanner.getTokenEnd()); case ScannerState.AfterOpeningEndTag: return collectCloseTagSuggestions(scanner.getTokenOffset() - 1, false); case ScannerState.WithinContent: return collectInsideContent(); } } break; case TokenType$1.EndTagOpen: if (offset <= scanner.getTokenEnd()) { var afterOpenBracket = scanner.getTokenOffset() + 1; var endOffset = scanNextForEndPos(TokenType$1.EndTag); return collectCloseTagSuggestions(afterOpenBracket, false, endOffset); } break; case TokenType$1.EndTag: if (offset <= scanner.getTokenEnd()) { var start = scanner.getTokenOffset() - 1; while (start >= 0) { var ch = text.charAt(start); if (ch === '/') { return collectCloseTagSuggestions(start, false, scanner.getTokenEnd()); } else if (!isWhiteSpace$5(ch)) { break; } start--; } } break; case TokenType$1.StartTagClose: if (offset <= scanner.getTokenEnd()) { if (currentTag) { return collectAutoCloseTagSuggestion(scanner.getTokenEnd(), currentTag); } } break; case TokenType$1.Content: if (offset <= scanner.getTokenEnd()) { return collectInsideContent(); } break; default: if (offset <= scanner.getTokenEnd()) { return result; } break; } token = scanner.scan(); } return result; }; HTMLCompletion.prototype.doTagComplete = function (document, position, htmlDocument) { var offset = document.offsetAt(position); if (offset <= 0) { return null; } var char = document.getText().charAt(offset - 1); if (char === '>') { var node = htmlDocument.findNodeBefore(offset); if (node && node.tag && !isVoidElement(node.tag) && node.start < offset && (!node.endTagStart || node.endTagStart > offset)) { var scanner = createScanner$1(document.getText(), node.start); var token = scanner.scan(); while (token !== TokenType$1.EOS && scanner.getTokenEnd() <= offset) { if (token === TokenType$1.StartTagClose && scanner.getTokenEnd() === offset) { return "$0"; } token = scanner.scan(); } } } else if (char === '/') { var node = htmlDocument.findNodeBefore(offset); while (node && node.closed && !(node.endTagStart && (node.endTagStart > offset))) { node = node.parent; } if (node && node.tag) { var scanner = createScanner$1(document.getText(), node.start); var token = scanner.scan(); while (token !== TokenType$1.EOS && scanner.getTokenEnd() <= offset) { if (token === TokenType$1.EndTagOpen && scanner.getTokenEnd() === offset) { return node.tag + ">"; } token = scanner.scan(); } } } return null; }; HTMLCompletion.prototype.convertCompletionList = function (list) { if (!this.doesSupportMarkdown()) { list.items.forEach(function (item) { if (item.documentation && typeof item.documentation !== 'string') { item.documentation = { kind: 'plaintext', value: item.documentation.value }; } }); } return list; }; HTMLCompletion.prototype.doesSupportMarkdown = function () { var _a, _b, _c; if (!isDefined$1(this.supportsMarkdown)) { if (!isDefined$1(this.lsOptions.clientCapabilities)) { this.supportsMarkdown = true; return this.supportsMarkdown; } var documentationFormat = (_c = (_b = (_a = this.lsOptions.clientCapabilities.textDocument) === null || _a === void 0 ? void 0 : _a.completion) === null || _b === void 0 ? void 0 : _b.completionItem) === null || _c === void 0 ? void 0 : _c.documentationFormat; this.supportsMarkdown = Array.isArray(documentationFormat) && documentationFormat.indexOf(MarkupKind.Markdown) !== -1; } return this.supportsMarkdown; }; return HTMLCompletion; }()); function isQuote$4(s) { return /^["']*$/.test(s); } function isWhiteSpace$5(s) { return /^\s*$/.test(s); } function isFollowedBy(s, offset, intialState, expectedToken) { var scanner = createScanner$1(s, offset, intialState); var token = scanner.scan(); while (token === TokenType$1.Whitespace) { token = scanner.scan(); } return token === expectedToken; } function getWordStart(s, offset, limit) { while (offset > limit && !isWhiteSpace$5(s[offset - 1])) { offset--; } return offset; } function getWordEnd(s, offset, limit) { while (offset < limit && !isWhiteSpace$5(s[offset])) { offset++; } return offset; } var localize$c = main$3.loadMessageBundle(); var HTMLHover = (function () { function HTMLHover(lsOptions, dataManager) { this.lsOptions = lsOptions; this.dataManager = dataManager; } HTMLHover.prototype.doHover = function (document, position, htmlDocument, options) { var convertContents = this.convertContents.bind(this); var doesSupportMarkdown = this.doesSupportMarkdown(); var offset = document.offsetAt(position); var node = htmlDocument.findNodeAt(offset); var text = document.getText(); if (!node || !node.tag) { return null; } var dataProviders = this.dataManager.getDataProviders().filter(function (p) { return p.isApplicable(document.languageId); }); function getTagHover(currTag, range, open) { var _loop_1 = function (provider) { var hover = null; provider.provideTags().forEach(function (tag) { if (tag.name.toLowerCase() === currTag.toLowerCase()) { var markupContent = generateDocumentation(tag, options, doesSupportMarkdown); if (!markupContent) { markupContent = { kind: doesSupportMarkdown ? 'markdown' : 'plaintext', value: '' }; } hover = { contents: markupContent, range: range }; } }); if (hover) { hover.contents = convertContents(hover.contents); return { value: hover }; } }; for (var _i = 0, dataProviders_1 = dataProviders; _i < dataProviders_1.length; _i++) { var provider = dataProviders_1[_i]; var state_1 = _loop_1(provider); if (typeof state_1 === "object") return state_1.value; } return null; } function getAttrHover(currTag, currAttr, range) { var _loop_2 = function (provider) { var hover = null; provider.provideAttributes(currTag).forEach(function (attr) { if (currAttr === attr.name && attr.description) { var contentsDoc = generateDocumentation(attr, options, doesSupportMarkdown); if (contentsDoc) { hover = { contents: contentsDoc, range: range }; } else { hover = null; } } }); if (hover) { hover.contents = convertContents(hover.contents); return { value: hover }; } }; for (var _i = 0, dataProviders_2 = dataProviders; _i < dataProviders_2.length; _i++) { var provider = dataProviders_2[_i]; var state_2 = _loop_2(provider); if (typeof state_2 === "object") return state_2.value; } return null; } function getAttrValueHover(currTag, currAttr, currAttrValue, range) { var _loop_3 = function (provider) { var hover = null; provider.provideValues(currTag, currAttr).forEach(function (attrValue) { if (currAttrValue === attrValue.name && attrValue.description) { var contentsDoc = generateDocumentation(attrValue, options, doesSupportMarkdown); if (contentsDoc) { hover = { contents: contentsDoc, range: range }; } else { hover = null; } } }); if (hover) { hover.contents = convertContents(hover.contents); return { value: hover }; } }; for (var _i = 0, dataProviders_3 = dataProviders; _i < dataProviders_3.length; _i++) { var provider = dataProviders_3[_i]; var state_3 = _loop_3(provider); if (typeof state_3 === "object") return state_3.value; } return null; } function getEntityHover(text, range) { var currEntity = filterEntity(text); for (var entity in entities) { var hover = null; var label = '&' + entity; if (currEntity === label) { var code = entities[entity].charCodeAt(0).toString(16).toUpperCase(); var hex = 'U+'; if (code.length < 4) { var zeroes = 4 - code.length; var k = 0; while (k < zeroes) { hex += '0'; k += 1; } } hex += code; var contentsDoc = localize$c('entity.propose', "Character entity representing '" + entities[entity] + "', unicode equivalent '" + hex + "'"); if (contentsDoc) { hover = { contents: contentsDoc, range: range }; } else { hover = null; } } if (hover) { hover.contents = convertContents(hover.contents); return hover; } } return null; } function getTagNameRange(tokenType, startOffset) { var scanner = createScanner$1(document.getText(), startOffset); var token = scanner.scan(); while (token !== TokenType$1.EOS && (scanner.getTokenEnd() < offset || scanner.getTokenEnd() === offset && token !== tokenType)) { token = scanner.scan(); } if (token === tokenType && offset <= scanner.getTokenEnd()) { return { start: document.positionAt(scanner.getTokenOffset()), end: document.positionAt(scanner.getTokenEnd()) }; } return null; } function getEntityRange() { var k = offset - 1; var characterStart = position.character; while (k >= 0 && isLetterOrDigit(text, k)) { k--; characterStart--; } var n = k + 1; var characterEnd = characterStart; while (isLetterOrDigit(text, n)) { n++; characterEnd++; } if (k >= 0 && text[k] === '&') { var range = null; if (text[n] === ';') { range = Range.create(Position.create(position.line, characterStart), Position.create(position.line, characterEnd + 1)); } else { range = Range.create(Position.create(position.line, characterStart), Position.create(position.line, characterEnd)); } return range; } return null; } function filterEntity(text) { var k = offset - 1; var newText = '&'; while (k >= 0 && isLetterOrDigit(text, k)) { k--; } k = k + 1; while (isLetterOrDigit(text, k)) { newText += text[k]; k += 1; } newText += ';'; return newText; } if (node.endTagStart && offset >= node.endTagStart) { var tagRange_1 = getTagNameRange(TokenType$1.EndTag, node.endTagStart); if (tagRange_1) { return getTagHover(node.tag, tagRange_1); } return null; } var tagRange = getTagNameRange(TokenType$1.StartTag, node.start); if (tagRange) { return getTagHover(node.tag, tagRange); } var attrRange = getTagNameRange(TokenType$1.AttributeName, node.start); if (attrRange) { var tag = node.tag; var attr = document.getText(attrRange); return getAttrHover(tag, attr, attrRange); } var entityRange = getEntityRange(); if (entityRange) { return getEntityHover(text, entityRange); } function scanAttrAndAttrValue(nodeStart, attrValueStart) { var scanner = createScanner$1(document.getText(), nodeStart); var token = scanner.scan(); var prevAttr = undefined; while (token !== TokenType$1.EOS && (scanner.getTokenEnd() <= attrValueStart)) { token = scanner.scan(); if (token === TokenType$1.AttributeName) { prevAttr = scanner.getTokenText(); } } return prevAttr; } var attrValueRange = getTagNameRange(TokenType$1.AttributeValue, node.start); if (attrValueRange) { var tag = node.tag; var attrValue = trimQuotes(document.getText(attrValueRange)); var matchAttr = scanAttrAndAttrValue(node.start, document.offsetAt(attrValueRange.start)); if (matchAttr) { return getAttrValueHover(tag, matchAttr, attrValue, attrValueRange); } } return null; }; HTMLHover.prototype.convertContents = function (contents) { if (!this.doesSupportMarkdown()) { if (typeof contents === 'string') { return contents; } else if ('kind' in contents) { return { kind: 'plaintext', value: contents.value }; } else if (Array.isArray(contents)) { contents.map(function (c) { return typeof c === 'string' ? c : c.value; }); } else { return contents.value; } } return contents; }; HTMLHover.prototype.doesSupportMarkdown = function () { var _a, _b, _c; if (!isDefined$1(this.supportsMarkdown)) { if (!isDefined$1(this.lsOptions.clientCapabilities)) { this.supportsMarkdown = true; return this.supportsMarkdown; } var contentFormat = (_c = (_b = (_a = this.lsOptions.clientCapabilities) === null || _a === void 0 ? void 0 : _a.textDocument) === null || _b === void 0 ? void 0 : _b.hover) === null || _c === void 0 ? void 0 : _c.contentFormat; this.supportsMarkdown = Array.isArray(contentFormat) && contentFormat.indexOf(MarkupKind.Markdown) !== -1; } return this.supportsMarkdown; }; return HTMLHover; }()); function trimQuotes(s) { if (s.length <= 1) { return s.replace(/['"]/, ''); } if (s[0] === "'" || s[0] === "\"") { s = s.slice(1); } if (s[s.length - 1] === "'" || s[s.length - 1] === "\"") { s = s.slice(0, -1); } return s; } function js_beautify(js_source_text, options) { return js_source_text; } var legacy_beautify_css; (function() { var __webpack_modules__ = ([ , , (function(module) { function OutputLine(parent) { this.__parent = parent; this.__character_count = 0; this.__indent_count = -1; this.__alignment_count = 0; this.__wrap_point_index = 0; this.__wrap_point_character_count = 0; this.__wrap_point_indent_count = -1; this.__wrap_point_alignment_count = 0; this.__items = []; } OutputLine.prototype.clone_empty = function() { var line = new OutputLine(this.__parent); line.set_indent(this.__indent_count, this.__alignment_count); return line; }; OutputLine.prototype.item = function(index) { if (index < 0) { return this.__items[this.__items.length + index]; } else { return this.__items[index]; } }; OutputLine.prototype.has_match = function(pattern) { for (var lastCheckedOutput = this.__items.length - 1; lastCheckedOutput >= 0; lastCheckedOutput--) { if (this.__items[lastCheckedOutput].match(pattern)) { return true; } } return false; }; OutputLine.prototype.set_indent = function(indent, alignment) { if (this.is_empty()) { this.__indent_count = indent || 0; this.__alignment_count = alignment || 0; this.__character_count = this.__parent.get_indent_size(this.__indent_count, this.__alignment_count); } }; OutputLine.prototype._set_wrap_point = function() { if (this.__parent.wrap_line_length) { this.__wrap_point_index = this.__items.length; this.__wrap_point_character_count = this.__character_count; this.__wrap_point_indent_count = this.__parent.next_line.__indent_count; this.__wrap_point_alignment_count = this.__parent.next_line.__alignment_count; } }; OutputLine.prototype._should_wrap = function() { return this.__wrap_point_index && this.__character_count > this.__parent.wrap_line_length && this.__wrap_point_character_count > this.__parent.next_line.__character_count; }; OutputLine.prototype._allow_wrap = function() { if (this._should_wrap()) { this.__parent.add_new_line(); var next = this.__parent.current_line; next.set_indent(this.__wrap_point_indent_count, this.__wrap_point_alignment_count); next.__items = this.__items.slice(this.__wrap_point_index); this.__items = this.__items.slice(0, this.__wrap_point_index); next.__character_count += this.__character_count - this.__wrap_point_character_count; this.__character_count = this.__wrap_point_character_count; if (next.__items[0] === " ") { next.__items.splice(0, 1); next.__character_count -= 1; } return true; } return false; }; OutputLine.prototype.is_empty = function() { return this.__items.length === 0; }; OutputLine.prototype.last = function() { if (!this.is_empty()) { return this.__items[this.__items.length - 1]; } else { return null; } }; OutputLine.prototype.push = function(item) { this.__items.push(item); var last_newline_index = item.lastIndexOf('\n'); if (last_newline_index !== -1) { this.__character_count = item.length - last_newline_index; } else { this.__character_count += item.length; } }; OutputLine.prototype.pop = function() { var item = null; if (!this.is_empty()) { item = this.__items.pop(); this.__character_count -= item.length; } return item; }; OutputLine.prototype._remove_indent = function() { if (this.__indent_count > 0) { this.__indent_count -= 1; this.__character_count -= this.__parent.indent_size; } }; OutputLine.prototype._remove_wrap_indent = function() { if (this.__wrap_point_indent_count > 0) { this.__wrap_point_indent_count -= 1; } }; OutputLine.prototype.trim = function() { while (this.last() === ' ') { this.__items.pop(); this.__character_count -= 1; } }; OutputLine.prototype.toString = function() { var result = ''; if (this.is_empty()) { if (this.__parent.indent_empty_lines) { result = this.__parent.get_indent_string(this.__indent_count); } } else { result = this.__parent.get_indent_string(this.__indent_count, this.__alignment_count); result += this.__items.join(''); } return result; }; function IndentStringCache(options, baseIndentString) { this.__cache = ['']; this.__indent_size = options.indent_size; this.__indent_string = options.indent_char; if (!options.indent_with_tabs) { this.__indent_string = new Array(options.indent_size + 1).join(options.indent_char); } baseIndentString = baseIndentString || ''; if (options.indent_level > 0) { baseIndentString = new Array(options.indent_level + 1).join(this.__indent_string); } this.__base_string = baseIndentString; this.__base_string_length = baseIndentString.length; } IndentStringCache.prototype.get_indent_size = function(indent, column) { var result = this.__base_string_length; column = column || 0; if (indent < 0) { result = 0; } result += indent * this.__indent_size; result += column; return result; }; IndentStringCache.prototype.get_indent_string = function(indent_level, column) { var result = this.__base_string; column = column || 0; if (indent_level < 0) { indent_level = 0; result = ''; } column += indent_level * this.__indent_size; this.__ensure_cache(column); result += this.__cache[column]; return result; }; IndentStringCache.prototype.__ensure_cache = function(column) { while (column >= this.__cache.length) { this.__add_column(); } }; IndentStringCache.prototype.__add_column = function() { var column = this.__cache.length; var indent = 0; var result = ''; if (this.__indent_size && column >= this.__indent_size) { indent = Math.floor(column / this.__indent_size); column -= indent * this.__indent_size; result = new Array(indent + 1).join(this.__indent_string); } if (column) { result += new Array(column + 1).join(' '); } this.__cache.push(result); }; function Output(options, baseIndentString) { this.__indent_cache = new IndentStringCache(options, baseIndentString); this.raw = false; this._end_with_newline = options.end_with_newline; this.indent_size = options.indent_size; this.wrap_line_length = options.wrap_line_length; this.indent_empty_lines = options.indent_empty_lines; this.__lines = []; this.previous_line = null; this.current_line = null; this.next_line = new OutputLine(this); this.space_before_token = false; this.non_breaking_space = false; this.previous_token_wrapped = false; this.__add_outputline(); } Output.prototype.__add_outputline = function() { this.previous_line = this.current_line; this.current_line = this.next_line.clone_empty(); this.__lines.push(this.current_line); }; Output.prototype.get_line_number = function() { return this.__lines.length; }; Output.prototype.get_indent_string = function(indent, column) { return this.__indent_cache.get_indent_string(indent, column); }; Output.prototype.get_indent_size = function(indent, column) { return this.__indent_cache.get_indent_size(indent, column); }; Output.prototype.is_empty = function() { return !this.previous_line && this.current_line.is_empty(); }; Output.prototype.add_new_line = function(force_newline) { if (this.is_empty() || (!force_newline && this.just_added_newline())) { return false; } if (!this.raw) { this.__add_outputline(); } return true; }; Output.prototype.get_code = function(eol) { this.trim(true); var last_item = this.current_line.pop(); if (last_item) { if (last_item[last_item.length - 1] === '\n') { last_item = last_item.replace(/\n+$/g, ''); } this.current_line.push(last_item); } if (this._end_with_newline) { this.__add_outputline(); } var sweet_code = this.__lines.join('\n'); if (eol !== '\n') { sweet_code = sweet_code.replace(/[\n]/g, eol); } return sweet_code; }; Output.prototype.set_wrap_point = function() { this.current_line._set_wrap_point(); }; Output.prototype.set_indent = function(indent, alignment) { indent = indent || 0; alignment = alignment || 0; this.next_line.set_indent(indent, alignment); if (this.__lines.length > 1) { this.current_line.set_indent(indent, alignment); return true; } this.current_line.set_indent(); return false; }; Output.prototype.add_raw_token = function(token) { for (var x = 0; x < token.newlines; x++) { this.__add_outputline(); } this.current_line.set_indent(-1); this.current_line.push(token.whitespace_before); this.current_line.push(token.text); this.space_before_token = false; this.non_breaking_space = false; this.previous_token_wrapped = false; }; Output.prototype.add_token = function(printable_token) { this.__add_space_before_token(); this.current_line.push(printable_token); this.space_before_token = false; this.non_breaking_space = false; this.previous_token_wrapped = this.current_line._allow_wrap(); }; Output.prototype.__add_space_before_token = function() { if (this.space_before_token && !this.just_added_newline()) { if (!this.non_breaking_space) { this.set_wrap_point(); } this.current_line.push(' '); } }; Output.prototype.remove_indent = function(index) { var output_length = this.__lines.length; while (index < output_length) { this.__lines[index]._remove_indent(); index++; } this.current_line._remove_wrap_indent(); }; Output.prototype.trim = function(eat_newlines) { eat_newlines = (eat_newlines === undefined) ? false : eat_newlines; this.current_line.trim(); while (eat_newlines && this.__lines.length > 1 && this.current_line.is_empty()) { this.__lines.pop(); this.current_line = this.__lines[this.__lines.length - 1]; this.current_line.trim(); } this.previous_line = this.__lines.length > 1 ? this.__lines[this.__lines.length - 2] : null; }; Output.prototype.just_added_newline = function() { return this.current_line.is_empty(); }; Output.prototype.just_added_blankline = function() { return this.is_empty() || (this.current_line.is_empty() && this.previous_line.is_empty()); }; Output.prototype.ensure_empty_line_above = function(starts_with, ends_with) { var index = this.__lines.length - 2; while (index >= 0) { var potentialEmptyLine = this.__lines[index]; if (potentialEmptyLine.is_empty()) { break; } else if (potentialEmptyLine.item(0).indexOf(starts_with) !== 0 && potentialEmptyLine.item(-1) !== ends_with) { this.__lines.splice(index + 1, 0, new OutputLine(this)); this.previous_line = this.__lines[this.__lines.length - 2]; break; } index--; } }; module.exports.Output = Output; }), , , , (function(module) { function Options(options, merge_child_field) { this.raw_options = _mergeOpts(options, merge_child_field); this.disabled = this._get_boolean('disabled'); this.eol = this._get_characters('eol', 'auto'); this.end_with_newline = this._get_boolean('end_with_newline'); this.indent_size = this._get_number('indent_size', 4); this.indent_char = this._get_characters('indent_char', ' '); this.indent_level = this._get_number('indent_level'); this.preserve_newlines = this._get_boolean('preserve_newlines', true); this.max_preserve_newlines = this._get_number('max_preserve_newlines', 32786); if (!this.preserve_newlines) { this.max_preserve_newlines = 0; } this.indent_with_tabs = this._get_boolean('indent_with_tabs', this.indent_char === '\t'); if (this.indent_with_tabs) { this.indent_char = '\t'; if (this.indent_size === 1) { this.indent_size = 4; } } this.wrap_line_length = this._get_number('wrap_line_length', this._get_number('max_char')); this.indent_empty_lines = this._get_boolean('indent_empty_lines'); this.templating = this._get_selection_list('templating', ['auto', 'none', 'django', 'erb', 'handlebars', 'php', 'smarty'], ['auto']); } Options.prototype._get_array = function(name, default_value) { var option_value = this.raw_options[name]; var result = default_value || []; if (typeof option_value === 'object') { if (option_value !== null && typeof option_value.concat === 'function') { result = option_value.concat(); } } else if (typeof option_value === 'string') { result = option_value.split(/[^a-zA-Z0-9_\/\-]+/); } return result; }; Options.prototype._get_boolean = function(name, default_value) { var option_value = this.raw_options[name]; var result = option_value === undefined ? !!default_value : !!option_value; return result; }; Options.prototype._get_characters = function(name, default_value) { var option_value = this.raw_options[name]; var result = default_value || ''; if (typeof option_value === 'string') { result = option_value.replace(/\\r/, '\r').replace(/\\n/, '\n').replace(/\\t/, '\t'); } return result; }; Options.prototype._get_number = function(name, default_value) { var option_value = this.raw_options[name]; default_value = parseInt(default_value, 10); if (isNaN(default_value)) { default_value = 0; } var result = parseInt(option_value, 10); if (isNaN(result)) { result = default_value; } return result; }; Options.prototype._get_selection = function(name, selection_list, default_value) { var result = this._get_selection_list(name, selection_list, default_value); if (result.length !== 1) { throw new Error( "Invalid Option Value: The option '" + name + "' can only be one of the following values:\n" + selection_list + "\nYou passed in: '" + this.raw_options[name] + "'"); } return result[0]; }; Options.prototype._get_selection_list = function(name, selection_list, default_value) { if (!selection_list || selection_list.length === 0) { throw new Error("Selection list cannot be empty."); } default_value = default_value || [selection_list[0]]; if (!this._is_valid_selection(default_value, selection_list)) { throw new Error("Invalid Default Value!"); } var result = this._get_array(name, default_value); if (!this._is_valid_selection(result, selection_list)) { throw new Error( "Invalid Option Value: The option '" + name + "' can contain only the following values:\n" + selection_list + "\nYou passed in: '" + this.raw_options[name] + "'"); } return result; }; Options.prototype._is_valid_selection = function(result, selection_list) { return result.length && selection_list.length && !result.some(function(item) { return selection_list.indexOf(item) === -1; }); }; function _mergeOpts(allOptions, childFieldName) { var finalOpts = {}; allOptions = _normalizeOpts(allOptions); var name; for (name in allOptions) { if (name !== childFieldName) { finalOpts[name] = allOptions[name]; } } if (childFieldName && allOptions[childFieldName]) { for (name in allOptions[childFieldName]) { finalOpts[name] = allOptions[childFieldName][name]; } } return finalOpts; } function _normalizeOpts(options) { var convertedOpts = {}; var key; for (key in options) { var newKey = key.replace(/-/g, "_"); convertedOpts[newKey] = options[key]; } return convertedOpts; } module.exports.Options = Options; module.exports.normalizeOpts = _normalizeOpts; module.exports.mergeOpts = _mergeOpts; }), , (function(module) { var regexp_has_sticky = RegExp.prototype.hasOwnProperty('sticky'); function InputScanner(input_string) { this.__input = input_string || ''; this.__input_length = this.__input.length; this.__position = 0; } InputScanner.prototype.restart = function() { this.__position = 0; }; InputScanner.prototype.back = function() { if (this.__position > 0) { this.__position -= 1; } }; InputScanner.prototype.hasNext = function() { return this.__position < this.__input_length; }; InputScanner.prototype.next = function() { var val = null; if (this.hasNext()) { val = this.__input.charAt(this.__position); this.__position += 1; } return val; }; InputScanner.prototype.peek = function(index) { var val = null; index = index || 0; index += this.__position; if (index >= 0 && index < this.__input_length) { val = this.__input.charAt(index); } return val; }; InputScanner.prototype.__match = function(pattern, index) { pattern.lastIndex = index; var pattern_match = pattern.exec(this.__input); if (pattern_match && !(regexp_has_sticky && pattern.sticky)) { if (pattern_match.index !== index) { pattern_match = null; } } return pattern_match; }; InputScanner.prototype.test = function(pattern, index) { index = index || 0; index += this.__position; if (index >= 0 && index < this.__input_length) { return !!this.__match(pattern, index); } else { return false; } }; InputScanner.prototype.testChar = function(pattern, index) { var val = this.peek(index); pattern.lastIndex = 0; return val !== null && pattern.test(val); }; InputScanner.prototype.match = function(pattern) { var pattern_match = this.__match(pattern, this.__position); if (pattern_match) { this.__position += pattern_match[0].length; } else { pattern_match = null; } return pattern_match; }; InputScanner.prototype.read = function(starting_pattern, until_pattern, until_after) { var val = ''; var match; if (starting_pattern) { match = this.match(starting_pattern); if (match) { val += match[0]; } } if (until_pattern && (match || !starting_pattern)) { val += this.readUntil(until_pattern, until_after); } return val; }; InputScanner.prototype.readUntil = function(pattern, until_after) { var val = ''; var match_index = this.__position; pattern.lastIndex = this.__position; var pattern_match = pattern.exec(this.__input); if (pattern_match) { match_index = pattern_match.index; if (until_after) { match_index += pattern_match[0].length; } } else { match_index = this.__input_length; } val = this.__input.substring(this.__position, match_index); this.__position = match_index; return val; }; InputScanner.prototype.readUntilAfter = function(pattern) { return this.readUntil(pattern, true); }; InputScanner.prototype.get_regexp = function(pattern, match_from) { var result = null; var flags = 'g'; if (match_from && regexp_has_sticky) { flags = 'y'; } if (typeof pattern === "string" && pattern !== '') { result = new RegExp(pattern, flags); } else if (pattern) { result = new RegExp(pattern.source, flags); } return result; }; InputScanner.prototype.get_literal_regexp = function(literal_string) { return RegExp(literal_string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')); }; InputScanner.prototype.peekUntilAfter = function(pattern) { var start = this.__position; var val = this.readUntilAfter(pattern); this.__position = start; return val; }; InputScanner.prototype.lookBack = function(testVal) { var start = this.__position - 1; return start >= testVal.length && this.__input.substring(start - testVal.length, start) .toLowerCase() === testVal; }; module.exports.InputScanner = InputScanner; }), , , , , (function(module) { function Directives(start_block_pattern, end_block_pattern) { start_block_pattern = typeof start_block_pattern === 'string' ? start_block_pattern : start_block_pattern.source; end_block_pattern = typeof end_block_pattern === 'string' ? end_block_pattern : end_block_pattern.source; this.__directives_block_pattern = new RegExp(start_block_pattern + / beautify( \w+[:]\w+)+ /.source + end_block_pattern, 'g'); this.__directive_pattern = / (\w+)[:](\w+)/g; this.__directives_end_ignore_pattern = new RegExp(start_block_pattern + /\sbeautify\signore:end\s/.source + end_block_pattern, 'g'); } Directives.prototype.get_directives = function(text) { if (!text.match(this.__directives_block_pattern)) { return null; } var directives = {}; this.__directive_pattern.lastIndex = 0; var directive_match = this.__directive_pattern.exec(text); while (directive_match) { directives[directive_match[1]] = directive_match[2]; directive_match = this.__directive_pattern.exec(text); } return directives; }; Directives.prototype.readIgnored = function(input) { return input.readUntilAfter(this.__directives_end_ignore_pattern); }; module.exports.Directives = Directives; }), , (function(module, __unused_webpack_exports, __webpack_require__) { var Beautifier = __webpack_require__(16).Beautifier, Options = __webpack_require__(17).Options; function css_beautify(source_text, options) { var beautifier = new Beautifier(source_text, options); return beautifier.beautify(); } module.exports = css_beautify; module.exports.defaultOptions = function() { return new Options(); }; }), (function(module, __unused_webpack_exports, __webpack_require__) { var Options = __webpack_require__(17).Options; var Output = __webpack_require__(2).Output; var InputScanner = __webpack_require__(8).InputScanner; var Directives = __webpack_require__(13).Directives; var directives_core = new Directives(/\/\*/, /\*\//); var lineBreak = /\r\n|[\r\n]/; var allLineBreaks = /\r\n|[\r\n]/g; var whitespaceChar = /\s/; var whitespacePattern = /(?:\s|\n)+/g; var block_comment_pattern = /\/\*(?:[\s\S]*?)((?:\*\/)|$)/g; var comment_pattern = /\/\/(?:[^\n\r\u2028\u2029]*)/g; function Beautifier(source_text, options) { this._source_text = source_text || ''; this._options = new Options(options); this._ch = null; this._input = null; this.NESTED_AT_RULE = { "@page": true, "@font-face": true, "@keyframes": true, "@media": true, "@supports": true, "@document": true }; this.CONDITIONAL_GROUP_RULE = { "@media": true, "@supports": true, "@document": true }; } Beautifier.prototype.eatString = function(endChars) { var result = ''; this._ch = this._input.next(); while (this._ch) { result += this._ch; if (this._ch === "\\") { result += this._input.next(); } else if (endChars.indexOf(this._ch) !== -1 || this._ch === "\n") { break; } this._ch = this._input.next(); } return result; }; Beautifier.prototype.eatWhitespace = function(allowAtLeastOneNewLine) { var result = whitespaceChar.test(this._input.peek()); var newline_count = 0; while (whitespaceChar.test(this._input.peek())) { this._ch = this._input.next(); if (allowAtLeastOneNewLine && this._ch === '\n') { if (newline_count === 0 || newline_count < this._options.max_preserve_newlines) { newline_count++; this._output.add_new_line(true); } } } return result; }; Beautifier.prototype.foundNestedPseudoClass = function() { var openParen = 0; var i = 1; var ch = this._input.peek(i); while (ch) { if (ch === "{") { return true; } else if (ch === '(') { openParen += 1; } else if (ch === ')') { if (openParen === 0) { return false; } openParen -= 1; } else if (ch === ";" || ch === "}") { return false; } i++; ch = this._input.peek(i); } return false; }; Beautifier.prototype.print_string = function(output_string) { this._output.set_indent(this._indentLevel); this._output.non_breaking_space = true; this._output.add_token(output_string); }; Beautifier.prototype.preserveSingleSpace = function(isAfterSpace) { if (isAfterSpace) { this._output.space_before_token = true; } }; Beautifier.prototype.indent = function() { this._indentLevel++; }; Beautifier.prototype.outdent = function() { if (this._indentLevel > 0) { this._indentLevel--; } }; Beautifier.prototype.beautify = function() { if (this._options.disabled) { return this._source_text; } var source_text = this._source_text; var eol = this._options.eol; if (eol === 'auto') { eol = '\n'; if (source_text && lineBreak.test(source_text || '')) { eol = source_text.match(lineBreak)[0]; } } source_text = source_text.replace(allLineBreaks, '\n'); var baseIndentString = source_text.match(/^[\t ]*/)[0]; this._output = new Output(this._options, baseIndentString); this._input = new InputScanner(source_text); this._indentLevel = 0; this._nestedLevel = 0; this._ch = null; var parenLevel = 0; var insideRule = false; var insidePropertyValue = false; var enteringConditionalGroup = false; var insideAtExtend = false; var insideAtImport = false; var topCharacter = this._ch; var whitespace; var isAfterSpace; var previous_ch; while (true) { whitespace = this._input.read(whitespacePattern); isAfterSpace = whitespace !== ''; previous_ch = topCharacter; this._ch = this._input.next(); if (this._ch === '\\' && this._input.hasNext()) { this._ch += this._input.next(); } topCharacter = this._ch; if (!this._ch) { break; } else if (this._ch === '/' && this._input.peek() === '*') { this._output.add_new_line(); this._input.back(); var comment = this._input.read(block_comment_pattern); var directives = directives_core.get_directives(comment); if (directives && directives.ignore === 'start') { comment += directives_core.readIgnored(this._input); } this.print_string(comment); this.eatWhitespace(true); this._output.add_new_line(); } else if (this._ch === '/' && this._input.peek() === '/') { this._output.space_before_token = true; this._input.back(); this.print_string(this._input.read(comment_pattern)); this.eatWhitespace(true); } else if (this._ch === '@') { this.preserveSingleSpace(isAfterSpace); if (this._input.peek() === '{') { this.print_string(this._ch + this.eatString('}')); } else { this.print_string(this._ch); var variableOrRule = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g); if (variableOrRule.match(/[ :]$/)) { variableOrRule = this.eatString(": ").replace(/\s$/, ''); this.print_string(variableOrRule); this._output.space_before_token = true; } variableOrRule = variableOrRule.replace(/\s$/, ''); if (variableOrRule === 'extend') { insideAtExtend = true; } else if (variableOrRule === 'import') { insideAtImport = true; } if (variableOrRule in this.NESTED_AT_RULE) { this._nestedLevel += 1; if (variableOrRule in this.CONDITIONAL_GROUP_RULE) { enteringConditionalGroup = true; } } else if (!insideRule && parenLevel === 0 && variableOrRule.indexOf(':') !== -1) { insidePropertyValue = true; this.indent(); } } } else if (this._ch === '#' && this._input.peek() === '{') { this.preserveSingleSpace(isAfterSpace); this.print_string(this._ch + this.eatString('}')); } else if (this._ch === '{') { if (insidePropertyValue) { insidePropertyValue = false; this.outdent(); } if (enteringConditionalGroup) { enteringConditionalGroup = false; insideRule = (this._indentLevel >= this._nestedLevel); } else { insideRule = (this._indentLevel >= this._nestedLevel - 1); } if (this._options.newline_between_rules && insideRule) { if (this._output.previous_line && this._output.previous_line.item(-1) !== '{') { this._output.ensure_empty_line_above('/', ','); } } this._output.space_before_token = true; if (this._options.brace_style === 'expand') { this._output.add_new_line(); this.print_string(this._ch); this.indent(); this._output.set_indent(this._indentLevel); } else { this.indent(); this.print_string(this._ch); } this.eatWhitespace(true); this._output.add_new_line(); } else if (this._ch === '}') { this.outdent(); this._output.add_new_line(); if (previous_ch === '{') { this._output.trim(true); } insideAtImport = false; insideAtExtend = false; if (insidePropertyValue) { this.outdent(); insidePropertyValue = false; } this.print_string(this._ch); insideRule = false; if (this._nestedLevel) { this._nestedLevel--; } this.eatWhitespace(true); this._output.add_new_line(); if (this._options.newline_between_rules && !this._output.just_added_blankline()) { if (this._input.peek() !== '}') { this._output.add_new_line(true); } } } else if (this._ch === ":") { if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) { this.print_string(':'); if (!insidePropertyValue) { insidePropertyValue = true; this._output.space_before_token = true; this.eatWhitespace(true); this.indent(); } } else { if (this._input.lookBack(" ")) { this._output.space_before_token = true; } if (this._input.peek() === ":") { this._ch = this._input.next(); this.print_string("::"); } else { this.print_string(':'); } } } else if (this._ch === '"' || this._ch === '\'') { this.preserveSingleSpace(isAfterSpace); this.print_string(this._ch + this.eatString(this._ch)); this.eatWhitespace(true); } else if (this._ch === ';') { if (parenLevel === 0) { if (insidePropertyValue) { this.outdent(); insidePropertyValue = false; } insideAtExtend = false; insideAtImport = false; this.print_string(this._ch); this.eatWhitespace(true); if (this._input.peek() !== '/') { this._output.add_new_line(); } } else { this.print_string(this._ch); this.eatWhitespace(true); this._output.space_before_token = true; } } else if (this._ch === '(') { if (this._input.lookBack("url")) { this.print_string(this._ch); this.eatWhitespace(); parenLevel++; this.indent(); this._ch = this._input.next(); if (this._ch === ')' || this._ch === '"' || this._ch === '\'') { this._input.back(); } else if (this._ch) { this.print_string(this._ch + this.eatString(')')); if (parenLevel) { parenLevel--; this.outdent(); } } } else { this.preserveSingleSpace(isAfterSpace); this.print_string(this._ch); this.eatWhitespace(); parenLevel++; this.indent(); } } else if (this._ch === ')') { if (parenLevel) { parenLevel--; this.outdent(); } this.print_string(this._ch); } else if (this._ch === ',') { this.print_string(this._ch); this.eatWhitespace(true); if (this._options.selector_separator_newline && !insidePropertyValue && parenLevel === 0 && !insideAtImport && !insideAtExtend) { this._output.add_new_line(); } else { this._output.space_before_token = true; } } else if ((this._ch === '>' || this._ch === '+' || this._ch === '~') && !insidePropertyValue && parenLevel === 0) { if (this._options.space_around_combinator) { this._output.space_before_token = true; this.print_string(this._ch); this._output.space_before_token = true; } else { this.print_string(this._ch); this.eatWhitespace(); if (this._ch && whitespaceChar.test(this._ch)) { this._ch = ''; } } } else if (this._ch === ']') { this.print_string(this._ch); } else if (this._ch === '[') { this.preserveSingleSpace(isAfterSpace); this.print_string(this._ch); } else if (this._ch === '=') { this.eatWhitespace(); this.print_string('='); if (whitespaceChar.test(this._ch)) { this._ch = ''; } } else if (this._ch === '!' && !this._input.lookBack("\\")) { this.print_string(' '); this.print_string(this._ch); } else { this.preserveSingleSpace(isAfterSpace); this.print_string(this._ch); } } var sweetCode = this._output.get_code(eol); return sweetCode; }; module.exports.Beautifier = Beautifier; }), (function(module, __unused_webpack_exports, __webpack_require__) { var BaseOptions = __webpack_require__(6).Options; function Options(options) { BaseOptions.call(this, options, 'css'); this.selector_separator_newline = this._get_boolean('selector_separator_newline', true); this.newline_between_rules = this._get_boolean('newline_between_rules', true); var space_around_selector_separator = this._get_boolean('space_around_selector_separator'); this.space_around_combinator = this._get_boolean('space_around_combinator') || space_around_selector_separator; var brace_style_split = this._get_selection_list('brace_style', ['collapse', 'expand', 'end-expand', 'none', 'preserve-inline']); this.brace_style = 'collapse'; for (var bs = 0; bs < brace_style_split.length; bs++) { if (brace_style_split[bs] !== 'expand') { this.brace_style = 'collapse'; } else { this.brace_style = brace_style_split[bs]; } } } Options.prototype = new BaseOptions(); module.exports.Options = Options; }) ]); var __webpack_module_cache__ = {}; function __webpack_require__(moduleId) { var cachedModule = __webpack_module_cache__[moduleId]; if (cachedModule !== undefined) { return cachedModule.exports; } var module = __webpack_module_cache__[moduleId] = { exports: {} }; __webpack_modules__[moduleId](module, module.exports, __webpack_require__); return module.exports; } var __webpack_exports__ = __webpack_require__(15); legacy_beautify_css = __webpack_exports__; })() ; var css_beautify = legacy_beautify_css; var legacy_beautify_html; (function() { var __webpack_modules__ = ([ , , (function(module) { function OutputLine(parent) { this.__parent = parent; this.__character_count = 0; this.__indent_count = -1; this.__alignment_count = 0; this.__wrap_point_index = 0; this.__wrap_point_character_count = 0; this.__wrap_point_indent_count = -1; this.__wrap_point_alignment_count = 0; this.__items = []; } OutputLine.prototype.clone_empty = function() { var line = new OutputLine(this.__parent); line.set_indent(this.__indent_count, this.__alignment_count); return line; }; OutputLine.prototype.item = function(index) { if (index < 0) { return this.__items[this.__items.length + index]; } else { return this.__items[index]; } }; OutputLine.prototype.has_match = function(pattern) { for (var lastCheckedOutput = this.__items.length - 1; lastCheckedOutput >= 0; lastCheckedOutput--) { if (this.__items[lastCheckedOutput].match(pattern)) { return true; } } return false; }; OutputLine.prototype.set_indent = function(indent, alignment) { if (this.is_empty()) { this.__indent_count = indent || 0; this.__alignment_count = alignment || 0; this.__character_count = this.__parent.get_indent_size(this.__indent_count, this.__alignment_count); } }; OutputLine.prototype._set_wrap_point = function() { if (this.__parent.wrap_line_length) { this.__wrap_point_index = this.__items.length; this.__wrap_point_character_count = this.__character_count; this.__wrap_point_indent_count = this.__parent.next_line.__indent_count; this.__wrap_point_alignment_count = this.__parent.next_line.__alignment_count; } }; OutputLine.prototype._should_wrap = function() { return this.__wrap_point_index && this.__character_count > this.__parent.wrap_line_length && this.__wrap_point_character_count > this.__parent.next_line.__character_count; }; OutputLine.prototype._allow_wrap = function() { if (this._should_wrap()) { this.__parent.add_new_line(); var next = this.__parent.current_line; next.set_indent(this.__wrap_point_indent_count, this.__wrap_point_alignment_count); next.__items = this.__items.slice(this.__wrap_point_index); this.__items = this.__items.slice(0, this.__wrap_point_index); next.__character_count += this.__character_count - this.__wrap_point_character_count; this.__character_count = this.__wrap_point_character_count; if (next.__items[0] === " ") { next.__items.splice(0, 1); next.__character_count -= 1; } return true; } return false; }; OutputLine.prototype.is_empty = function() { return this.__items.length === 0; }; OutputLine.prototype.last = function() { if (!this.is_empty()) { return this.__items[this.__items.length - 1]; } else { return null; } }; OutputLine.prototype.push = function(item) { this.__items.push(item); var last_newline_index = item.lastIndexOf('\n'); if (last_newline_index !== -1) { this.__character_count = item.length - last_newline_index; } else { this.__character_count += item.length; } }; OutputLine.prototype.pop = function() { var item = null; if (!this.is_empty()) { item = this.__items.pop(); this.__character_count -= item.length; } return item; }; OutputLine.prototype._remove_indent = function() { if (this.__indent_count > 0) { this.__indent_count -= 1; this.__character_count -= this.__parent.indent_size; } }; OutputLine.prototype._remove_wrap_indent = function() { if (this.__wrap_point_indent_count > 0) { this.__wrap_point_indent_count -= 1; } }; OutputLine.prototype.trim = function() { while (this.last() === ' ') { this.__items.pop(); this.__character_count -= 1; } }; OutputLine.prototype.toString = function() { var result = ''; if (this.is_empty()) { if (this.__parent.indent_empty_lines) { result = this.__parent.get_indent_string(this.__indent_count); } } else { result = this.__parent.get_indent_string(this.__indent_count, this.__alignment_count); result += this.__items.join(''); } return result; }; function IndentStringCache(options, baseIndentString) { this.__cache = ['']; this.__indent_size = options.indent_size; this.__indent_string = options.indent_char; if (!options.indent_with_tabs) { this.__indent_string = new Array(options.indent_size + 1).join(options.indent_char); } baseIndentString = baseIndentString || ''; if (options.indent_level > 0) { baseIndentString = new Array(options.indent_level + 1).join(this.__indent_string); } this.__base_string = baseIndentString; this.__base_string_length = baseIndentString.length; } IndentStringCache.prototype.get_indent_size = function(indent, column) { var result = this.__base_string_length; column = column || 0; if (indent < 0) { result = 0; } result += indent * this.__indent_size; result += column; return result; }; IndentStringCache.prototype.get_indent_string = function(indent_level, column) { var result = this.__base_string; column = column || 0; if (indent_level < 0) { indent_level = 0; result = ''; } column += indent_level * this.__indent_size; this.__ensure_cache(column); result += this.__cache[column]; return result; }; IndentStringCache.prototype.__ensure_cache = function(column) { while (column >= this.__cache.length) { this.__add_column(); } }; IndentStringCache.prototype.__add_column = function() { var column = this.__cache.length; var indent = 0; var result = ''; if (this.__indent_size && column >= this.__indent_size) { indent = Math.floor(column / this.__indent_size); column -= indent * this.__indent_size; result = new Array(indent + 1).join(this.__indent_string); } if (column) { result += new Array(column + 1).join(' '); } this.__cache.push(result); }; function Output(options, baseIndentString) { this.__indent_cache = new IndentStringCache(options, baseIndentString); this.raw = false; this._end_with_newline = options.end_with_newline; this.indent_size = options.indent_size; this.wrap_line_length = options.wrap_line_length; this.indent_empty_lines = options.indent_empty_lines; this.__lines = []; this.previous_line = null; this.current_line = null; this.next_line = new OutputLine(this); this.space_before_token = false; this.non_breaking_space = false; this.previous_token_wrapped = false; this.__add_outputline(); } Output.prototype.__add_outputline = function() { this.previous_line = this.current_line; this.current_line = this.next_line.clone_empty(); this.__lines.push(this.current_line); }; Output.prototype.get_line_number = function() { return this.__lines.length; }; Output.prototype.get_indent_string = function(indent, column) { return this.__indent_cache.get_indent_string(indent, column); }; Output.prototype.get_indent_size = function(indent, column) { return this.__indent_cache.get_indent_size(indent, column); }; Output.prototype.is_empty = function() { return !this.previous_line && this.current_line.is_empty(); }; Output.prototype.add_new_line = function(force_newline) { if (this.is_empty() || (!force_newline && this.just_added_newline())) { return false; } if (!this.raw) { this.__add_outputline(); } return true; }; Output.prototype.get_code = function(eol) { this.trim(true); var last_item = this.current_line.pop(); if (last_item) { if (last_item[last_item.length - 1] === '\n') { last_item = last_item.replace(/\n+$/g, ''); } this.current_line.push(last_item); } if (this._end_with_newline) { this.__add_outputline(); } var sweet_code = this.__lines.join('\n'); if (eol !== '\n') { sweet_code = sweet_code.replace(/[\n]/g, eol); } return sweet_code; }; Output.prototype.set_wrap_point = function() { this.current_line._set_wrap_point(); }; Output.prototype.set_indent = function(indent, alignment) { indent = indent || 0; alignment = alignment || 0; this.next_line.set_indent(indent, alignment); if (this.__lines.length > 1) { this.current_line.set_indent(indent, alignment); return true; } this.current_line.set_indent(); return false; }; Output.prototype.add_raw_token = function(token) { for (var x = 0; x < token.newlines; x++) { this.__add_outputline(); } this.current_line.set_indent(-1); this.current_line.push(token.whitespace_before); this.current_line.push(token.text); this.space_before_token = false; this.non_breaking_space = false; this.previous_token_wrapped = false; }; Output.prototype.add_token = function(printable_token) { this.__add_space_before_token(); this.current_line.push(printable_token); this.space_before_token = false; this.non_breaking_space = false; this.previous_token_wrapped = this.current_line._allow_wrap(); }; Output.prototype.__add_space_before_token = function() { if (this.space_before_token && !this.just_added_newline()) { if (!this.non_breaking_space) { this.set_wrap_point(); } this.current_line.push(' '); } }; Output.prototype.remove_indent = function(index) { var output_length = this.__lines.length; while (index < output_length) { this.__lines[index]._remove_indent(); index++; } this.current_line._remove_wrap_indent(); }; Output.prototype.trim = function(eat_newlines) { eat_newlines = (eat_newlines === undefined) ? false : eat_newlines; this.current_line.trim(); while (eat_newlines && this.__lines.length > 1 && this.current_line.is_empty()) { this.__lines.pop(); this.current_line = this.__lines[this.__lines.length - 1]; this.current_line.trim(); } this.previous_line = this.__lines.length > 1 ? this.__lines[this.__lines.length - 2] : null; }; Output.prototype.just_added_newline = function() { return this.current_line.is_empty(); }; Output.prototype.just_added_blankline = function() { return this.is_empty() || (this.current_line.is_empty() && this.previous_line.is_empty()); }; Output.prototype.ensure_empty_line_above = function(starts_with, ends_with) { var index = this.__lines.length - 2; while (index >= 0) { var potentialEmptyLine = this.__lines[index]; if (potentialEmptyLine.is_empty()) { break; } else if (potentialEmptyLine.item(0).indexOf(starts_with) !== 0 && potentialEmptyLine.item(-1) !== ends_with) { this.__lines.splice(index + 1, 0, new OutputLine(this)); this.previous_line = this.__lines[this.__lines.length - 2]; break; } index--; } }; module.exports.Output = Output; }), (function(module) { function Token(type, text, newlines, whitespace_before) { this.type = type; this.text = text; this.comments_before = null; this.newlines = newlines || 0; this.whitespace_before = whitespace_before || ''; this.parent = null; this.next = null; this.previous = null; this.opened = null; this.closed = null; this.directives = null; } module.exports.Token = Token; }), , , (function(module) { function Options(options, merge_child_field) { this.raw_options = _mergeOpts(options, merge_child_field); this.disabled = this._get_boolean('disabled'); this.eol = this._get_characters('eol', 'auto'); this.end_with_newline = this._get_boolean('end_with_newline'); this.indent_size = this._get_number('indent_size', 4); this.indent_char = this._get_characters('indent_char', ' '); this.indent_level = this._get_number('indent_level'); this.preserve_newlines = this._get_boolean('preserve_newlines', true); this.max_preserve_newlines = this._get_number('max_preserve_newlines', 32786); if (!this.preserve_newlines) { this.max_preserve_newlines = 0; } this.indent_with_tabs = this._get_boolean('indent_with_tabs', this.indent_char === '\t'); if (this.indent_with_tabs) { this.indent_char = '\t'; if (this.indent_size === 1) { this.indent_size = 4; } } this.wrap_line_length = this._get_number('wrap_line_length', this._get_number('max_char')); this.indent_empty_lines = this._get_boolean('indent_empty_lines'); this.templating = this._get_selection_list('templating', ['auto', 'none', 'django', 'erb', 'handlebars', 'php', 'smarty'], ['auto']); } Options.prototype._get_array = function(name, default_value) { var option_value = this.raw_options[name]; var result = default_value || []; if (typeof option_value === 'object') { if (option_value !== null && typeof option_value.concat === 'function') { result = option_value.concat(); } } else if (typeof option_value === 'string') { result = option_value.split(/[^a-zA-Z0-9_\/\-]+/); } return result; }; Options.prototype._get_boolean = function(name, default_value) { var option_value = this.raw_options[name]; var result = option_value === undefined ? !!default_value : !!option_value; return result; }; Options.prototype._get_characters = function(name, default_value) { var option_value = this.raw_options[name]; var result = default_value || ''; if (typeof option_value === 'string') { result = option_value.replace(/\\r/, '\r').replace(/\\n/, '\n').replace(/\\t/, '\t'); } return result; }; Options.prototype._get_number = function(name, default_value) { var option_value = this.raw_options[name]; default_value = parseInt(default_value, 10); if (isNaN(default_value)) { default_value = 0; } var result = parseInt(option_value, 10); if (isNaN(result)) { result = default_value; } return result; }; Options.prototype._get_selection = function(name, selection_list, default_value) { var result = this._get_selection_list(name, selection_list, default_value); if (result.length !== 1) { throw new Error( "Invalid Option Value: The option '" + name + "' can only be one of the following values:\n" + selection_list + "\nYou passed in: '" + this.raw_options[name] + "'"); } return result[0]; }; Options.prototype._get_selection_list = function(name, selection_list, default_value) { if (!selection_list || selection_list.length === 0) { throw new Error("Selection list cannot be empty."); } default_value = default_value || [selection_list[0]]; if (!this._is_valid_selection(default_value, selection_list)) { throw new Error("Invalid Default Value!"); } var result = this._get_array(name, default_value); if (!this._is_valid_selection(result, selection_list)) { throw new Error( "Invalid Option Value: The option '" + name + "' can contain only the following values:\n" + selection_list + "\nYou passed in: '" + this.raw_options[name] + "'"); } return result; }; Options.prototype._is_valid_selection = function(result, selection_list) { return result.length && selection_list.length && !result.some(function(item) { return selection_list.indexOf(item) === -1; }); }; function _mergeOpts(allOptions, childFieldName) { var finalOpts = {}; allOptions = _normalizeOpts(allOptions); var name; for (name in allOptions) { if (name !== childFieldName) { finalOpts[name] = allOptions[name]; } } if (childFieldName && allOptions[childFieldName]) { for (name in allOptions[childFieldName]) { finalOpts[name] = allOptions[childFieldName][name]; } } return finalOpts; } function _normalizeOpts(options) { var convertedOpts = {}; var key; for (key in options) { var newKey = key.replace(/-/g, "_"); convertedOpts[newKey] = options[key]; } return convertedOpts; } module.exports.Options = Options; module.exports.normalizeOpts = _normalizeOpts; module.exports.mergeOpts = _mergeOpts; }), , (function(module) { var regexp_has_sticky = RegExp.prototype.hasOwnProperty('sticky'); function InputScanner(input_string) { this.__input = input_string || ''; this.__input_length = this.__input.length; this.__position = 0; } InputScanner.prototype.restart = function() { this.__position = 0; }; InputScanner.prototype.back = function() { if (this.__position > 0) { this.__position -= 1; } }; InputScanner.prototype.hasNext = function() { return this.__position < this.__input_length; }; InputScanner.prototype.next = function() { var val = null; if (this.hasNext()) { val = this.__input.charAt(this.__position); this.__position += 1; } return val; }; InputScanner.prototype.peek = function(index) { var val = null; index = index || 0; index += this.__position; if (index >= 0 && index < this.__input_length) { val = this.__input.charAt(index); } return val; }; InputScanner.prototype.__match = function(pattern, index) { pattern.lastIndex = index; var pattern_match = pattern.exec(this.__input); if (pattern_match && !(regexp_has_sticky && pattern.sticky)) { if (pattern_match.index !== index) { pattern_match = null; } } return pattern_match; }; InputScanner.prototype.test = function(pattern, index) { index = index || 0; index += this.__position; if (index >= 0 && index < this.__input_length) { return !!this.__match(pattern, index); } else { return false; } }; InputScanner.prototype.testChar = function(pattern, index) { var val = this.peek(index); pattern.lastIndex = 0; return val !== null && pattern.test(val); }; InputScanner.prototype.match = function(pattern) { var pattern_match = this.__match(pattern, this.__position); if (pattern_match) { this.__position += pattern_match[0].length; } else { pattern_match = null; } return pattern_match; }; InputScanner.prototype.read = function(starting_pattern, until_pattern, until_after) { var val = ''; var match; if (starting_pattern) { match = this.match(starting_pattern); if (match) { val += match[0]; } } if (until_pattern && (match || !starting_pattern)) { val += this.readUntil(until_pattern, until_after); } return val; }; InputScanner.prototype.readUntil = function(pattern, until_after) { var val = ''; var match_index = this.__position; pattern.lastIndex = this.__position; var pattern_match = pattern.exec(this.__input); if (pattern_match) { match_index = pattern_match.index; if (until_after) { match_index += pattern_match[0].length; } } else { match_index = this.__input_length; } val = this.__input.substring(this.__position, match_index); this.__position = match_index; return val; }; InputScanner.prototype.readUntilAfter = function(pattern) { return this.readUntil(pattern, true); }; InputScanner.prototype.get_regexp = function(pattern, match_from) { var result = null; var flags = 'g'; if (match_from && regexp_has_sticky) { flags = 'y'; } if (typeof pattern === "string" && pattern !== '') { result = new RegExp(pattern, flags); } else if (pattern) { result = new RegExp(pattern.source, flags); } return result; }; InputScanner.prototype.get_literal_regexp = function(literal_string) { return RegExp(literal_string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')); }; InputScanner.prototype.peekUntilAfter = function(pattern) { var start = this.__position; var val = this.readUntilAfter(pattern); this.__position = start; return val; }; InputScanner.prototype.lookBack = function(testVal) { var start = this.__position - 1; return start >= testVal.length && this.__input.substring(start - testVal.length, start) .toLowerCase() === testVal; }; module.exports.InputScanner = InputScanner; }), (function(module, __unused_webpack_exports, __webpack_require__) { var InputScanner = __webpack_require__(8).InputScanner; var Token = __webpack_require__(3).Token; var TokenStream = __webpack_require__(10).TokenStream; var WhitespacePattern = __webpack_require__(11).WhitespacePattern; var TOKEN = { START: 'TK_START', RAW: 'TK_RAW', EOF: 'TK_EOF' }; var Tokenizer = function(input_string, options) { this._input = new InputScanner(input_string); this._options = options || {}; this.__tokens = null; this._patterns = {}; this._patterns.whitespace = new WhitespacePattern(this._input); }; Tokenizer.prototype.tokenize = function() { this._input.restart(); this.__tokens = new TokenStream(); this._reset(); var current; var previous = new Token(TOKEN.START, ''); var open_token = null; var open_stack = []; var comments = new TokenStream(); while (previous.type !== TOKEN.EOF) { current = this._get_next_token(previous, open_token); while (this._is_comment(current)) { comments.add(current); current = this._get_next_token(previous, open_token); } if (!comments.isEmpty()) { current.comments_before = comments; comments = new TokenStream(); } current.parent = open_token; if (this._is_opening(current)) { open_stack.push(open_token); open_token = current; } else if (open_token && this._is_closing(current, open_token)) { current.opened = open_token; open_token.closed = current; open_token = open_stack.pop(); current.parent = open_token; } current.previous = previous; previous.next = current; this.__tokens.add(current); previous = current; } return this.__tokens; }; Tokenizer.prototype._is_first_token = function() { return this.__tokens.isEmpty(); }; Tokenizer.prototype._reset = function() {}; Tokenizer.prototype._get_next_token = function(previous_token, open_token) { this._readWhitespace(); var resulting_string = this._input.read(/.+/g); if (resulting_string) { return this._create_token(TOKEN.RAW, resulting_string); } else { return this._create_token(TOKEN.EOF, ''); } }; Tokenizer.prototype._is_comment = function(current_token) { return false; }; Tokenizer.prototype._is_opening = function(current_token) { return false; }; Tokenizer.prototype._is_closing = function(current_token, open_token) { return false; }; Tokenizer.prototype._create_token = function(type, text) { var token = new Token(type, text, this._patterns.whitespace.newline_count, this._patterns.whitespace.whitespace_before_token); return token; }; Tokenizer.prototype._readWhitespace = function() { return this._patterns.whitespace.read(); }; module.exports.Tokenizer = Tokenizer; module.exports.TOKEN = TOKEN; }), (function(module) { function TokenStream(parent_token) { this.__tokens = []; this.__tokens_length = this.__tokens.length; this.__position = 0; this.__parent_token = parent_token; } TokenStream.prototype.restart = function() { this.__position = 0; }; TokenStream.prototype.isEmpty = function() { return this.__tokens_length === 0; }; TokenStream.prototype.hasNext = function() { return this.__position < this.__tokens_length; }; TokenStream.prototype.next = function() { var val = null; if (this.hasNext()) { val = this.__tokens[this.__position]; this.__position += 1; } return val; }; TokenStream.prototype.peek = function(index) { var val = null; index = index || 0; index += this.__position; if (index >= 0 && index < this.__tokens_length) { val = this.__tokens[index]; } return val; }; TokenStream.prototype.add = function(token) { if (this.__parent_token) { token.parent = this.__parent_token; } this.__tokens.push(token); this.__tokens_length += 1; }; module.exports.TokenStream = TokenStream; }), (function(module, __unused_webpack_exports, __webpack_require__) { var Pattern = __webpack_require__(12).Pattern; function WhitespacePattern(input_scanner, parent) { Pattern.call(this, input_scanner, parent); if (parent) { this._line_regexp = this._input.get_regexp(parent._line_regexp); } else { this.__set_whitespace_patterns('', ''); } this.newline_count = 0; this.whitespace_before_token = ''; } WhitespacePattern.prototype = new Pattern(); WhitespacePattern.prototype.__set_whitespace_patterns = function(whitespace_chars, newline_chars) { whitespace_chars += '\\t '; newline_chars += '\\n\\r'; this._match_pattern = this._input.get_regexp( '[' + whitespace_chars + newline_chars + ']+', true); this._newline_regexp = this._input.get_regexp( '\\r\\n|[' + newline_chars + ']'); }; WhitespacePattern.prototype.read = function() { this.newline_count = 0; this.whitespace_before_token = ''; var resulting_string = this._input.read(this._match_pattern); if (resulting_string === ' ') { this.whitespace_before_token = ' '; } else if (resulting_string) { var matches = this.__split(this._newline_regexp, resulting_string); this.newline_count = matches.length - 1; this.whitespace_before_token = matches[this.newline_count]; } return resulting_string; }; WhitespacePattern.prototype.matching = function(whitespace_chars, newline_chars) { var result = this._create(); result.__set_whitespace_patterns(whitespace_chars, newline_chars); result._update(); return result; }; WhitespacePattern.prototype._create = function() { return new WhitespacePattern(this._input, this); }; WhitespacePattern.prototype.__split = function(regexp, input_string) { regexp.lastIndex = 0; var start_index = 0; var result = []; var next_match = regexp.exec(input_string); while (next_match) { result.push(input_string.substring(start_index, next_match.index)); start_index = next_match.index + next_match[0].length; next_match = regexp.exec(input_string); } if (start_index < input_string.length) { result.push(input_string.substring(start_index, input_string.length)); } else { result.push(''); } return result; }; module.exports.WhitespacePattern = WhitespacePattern; }), (function(module) { function Pattern(input_scanner, parent) { this._input = input_scanner; this._starting_pattern = null; this._match_pattern = null; this._until_pattern = null; this._until_after = false; if (parent) { this._starting_pattern = this._input.get_regexp(parent._starting_pattern, true); this._match_pattern = this._input.get_regexp(parent._match_pattern, true); this._until_pattern = this._input.get_regexp(parent._until_pattern); this._until_after = parent._until_after; } } Pattern.prototype.read = function() { var result = this._input.read(this._starting_pattern); if (!this._starting_pattern || result) { result += this._input.read(this._match_pattern, this._until_pattern, this._until_after); } return result; }; Pattern.prototype.read_match = function() { return this._input.match(this._match_pattern); }; Pattern.prototype.until_after = function(pattern) { var result = this._create(); result._until_after = true; result._until_pattern = this._input.get_regexp(pattern); result._update(); return result; }; Pattern.prototype.until = function(pattern) { var result = this._create(); result._until_after = false; result._until_pattern = this._input.get_regexp(pattern); result._update(); return result; }; Pattern.prototype.starting_with = function(pattern) { var result = this._create(); result._starting_pattern = this._input.get_regexp(pattern, true); result._update(); return result; }; Pattern.prototype.matching = function(pattern) { var result = this._create(); result._match_pattern = this._input.get_regexp(pattern, true); result._update(); return result; }; Pattern.prototype._create = function() { return new Pattern(this._input, this); }; Pattern.prototype._update = function() {}; module.exports.Pattern = Pattern; }), (function(module) { function Directives(start_block_pattern, end_block_pattern) { start_block_pattern = typeof start_block_pattern === 'string' ? start_block_pattern : start_block_pattern.source; end_block_pattern = typeof end_block_pattern === 'string' ? end_block_pattern : end_block_pattern.source; this.__directives_block_pattern = new RegExp(start_block_pattern + / beautify( \w+[:]\w+)+ /.source + end_block_pattern, 'g'); this.__directive_pattern = / (\w+)[:](\w+)/g; this.__directives_end_ignore_pattern = new RegExp(start_block_pattern + /\sbeautify\signore:end\s/.source + end_block_pattern, 'g'); } Directives.prototype.get_directives = function(text) { if (!text.match(this.__directives_block_pattern)) { return null; } var directives = {}; this.__directive_pattern.lastIndex = 0; var directive_match = this.__directive_pattern.exec(text); while (directive_match) { directives[directive_match[1]] = directive_match[2]; directive_match = this.__directive_pattern.exec(text); } return directives; }; Directives.prototype.readIgnored = function(input) { return input.readUntilAfter(this.__directives_end_ignore_pattern); }; module.exports.Directives = Directives; }), (function(module, __unused_webpack_exports, __webpack_require__) { var Pattern = __webpack_require__(12).Pattern; var template_names = { django: false, erb: false, handlebars: false, php: false, smarty: false }; function TemplatablePattern(input_scanner, parent) { Pattern.call(this, input_scanner, parent); this.__template_pattern = null; this._disabled = Object.assign({}, template_names); this._excluded = Object.assign({}, template_names); if (parent) { this.__template_pattern = this._input.get_regexp(parent.__template_pattern); this._excluded = Object.assign(this._excluded, parent._excluded); this._disabled = Object.assign(this._disabled, parent._disabled); } var pattern = new Pattern(input_scanner); this.__patterns = { handlebars_comment: pattern.starting_with(/{{!--/).until_after(/--}}/), handlebars_unescaped: pattern.starting_with(/{{{/).until_after(/}}}/), handlebars: pattern.starting_with(/{{/).until_after(/}}/), php: pattern.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/), erb: pattern.starting_with(/<%[^%]/).until_after(/[^%]%>/), django: pattern.starting_with(/{%/).until_after(/%}/), django_value: pattern.starting_with(/{{/).until_after(/}}/), django_comment: pattern.starting_with(/{#/).until_after(/#}/), smarty: pattern.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/), smarty_comment: pattern.starting_with(/{\*/).until_after(/\*}/), smarty_literal: pattern.starting_with(/{literal}/).until_after(/{\/literal}/) }; } TemplatablePattern.prototype = new Pattern(); TemplatablePattern.prototype._create = function() { return new TemplatablePattern(this._input, this); }; TemplatablePattern.prototype._update = function() { this.__set_templated_pattern(); }; TemplatablePattern.prototype.disable = function(language) { var result = this._create(); result._disabled[language] = true; result._update(); return result; }; TemplatablePattern.prototype.read_options = function(options) { var result = this._create(); for (var language in template_names) { result._disabled[language] = options.templating.indexOf(language) === -1; } result._update(); return result; }; TemplatablePattern.prototype.exclude = function(language) { var result = this._create(); result._excluded[language] = true; result._update(); return result; }; TemplatablePattern.prototype.read = function() { var result = ''; if (this._match_pattern) { result = this._input.read(this._starting_pattern); } else { result = this._input.read(this._starting_pattern, this.__template_pattern); } var next = this._read_template(); while (next) { if (this._match_pattern) { next += this._input.read(this._match_pattern); } else { next += this._input.readUntil(this.__template_pattern); } result += next; next = this._read_template(); } if (this._until_after) { result += this._input.readUntilAfter(this._until_pattern); } return result; }; TemplatablePattern.prototype.__set_templated_pattern = function() { var items = []; if (!this._disabled.php) { items.push(this.__patterns.php._starting_pattern.source); } if (!this._disabled.handlebars) { items.push(this.__patterns.handlebars._starting_pattern.source); } if (!this._disabled.erb) { items.push(this.__patterns.erb._starting_pattern.source); } if (!this._disabled.django) { items.push(this.__patterns.django._starting_pattern.source); items.push(this.__patterns.django_value._starting_pattern.source); items.push(this.__patterns.django_comment._starting_pattern.source); } if (!this._disabled.smarty) { items.push(this.__patterns.smarty._starting_pattern.source); } if (this._until_pattern) { items.push(this._until_pattern.source); } this.__template_pattern = this._input.get_regexp('(?:' + items.join('|') + ')'); }; TemplatablePattern.prototype._read_template = function() { var resulting_string = ''; var c = this._input.peek(); if (c === '<') { var peek1 = this._input.peek(1); if (!this._disabled.php && !this._excluded.php && peek1 === '?') { resulting_string = resulting_string || this.__patterns.php.read(); } if (!this._disabled.erb && !this._excluded.erb && peek1 === '%') { resulting_string = resulting_string || this.__patterns.erb.read(); } } else if (c === '{') { if (!this._disabled.handlebars && !this._excluded.handlebars) { resulting_string = resulting_string || this.__patterns.handlebars_comment.read(); resulting_string = resulting_string || this.__patterns.handlebars_unescaped.read(); resulting_string = resulting_string || this.__patterns.handlebars.read(); } if (!this._disabled.django) { if (!this._excluded.django && !this._excluded.handlebars) { resulting_string = resulting_string || this.__patterns.django_value.read(); } if (!this._excluded.django) { resulting_string = resulting_string || this.__patterns.django_comment.read(); resulting_string = resulting_string || this.__patterns.django.read(); } } if (!this._disabled.smarty) { if (this._disabled.django && this._disabled.handlebars) { resulting_string = resulting_string || this.__patterns.smarty_comment.read(); resulting_string = resulting_string || this.__patterns.smarty_literal.read(); resulting_string = resulting_string || this.__patterns.smarty.read(); } } } return resulting_string; }; module.exports.TemplatablePattern = TemplatablePattern; }), , , , (function(module, __unused_webpack_exports, __webpack_require__) { var Beautifier = __webpack_require__(19).Beautifier, Options = __webpack_require__(20).Options; function style_html(html_source, options, js_beautify, css_beautify) { var beautifier = new Beautifier(html_source, options, js_beautify, css_beautify); return beautifier.beautify(); } module.exports = style_html; module.exports.defaultOptions = function() { return new Options(); }; }), (function(module, __unused_webpack_exports, __webpack_require__) { var Options = __webpack_require__(20).Options; var Output = __webpack_require__(2).Output; var Tokenizer = __webpack_require__(21).Tokenizer; var TOKEN = __webpack_require__(21).TOKEN; var lineBreak = /\r\n|[\r\n]/; var allLineBreaks = /\r\n|[\r\n]/g; var Printer = function(options, base_indent_string) { this.indent_level = 0; this.alignment_size = 0; this.max_preserve_newlines = options.max_preserve_newlines; this.preserve_newlines = options.preserve_newlines; this._output = new Output(options, base_indent_string); }; Printer.prototype.current_line_has_match = function(pattern) { return this._output.current_line.has_match(pattern); }; Printer.prototype.set_space_before_token = function(value, non_breaking) { this._output.space_before_token = value; this._output.non_breaking_space = non_breaking; }; Printer.prototype.set_wrap_point = function() { this._output.set_indent(this.indent_level, this.alignment_size); this._output.set_wrap_point(); }; Printer.prototype.add_raw_token = function(token) { this._output.add_raw_token(token); }; Printer.prototype.print_preserved_newlines = function(raw_token) { var newlines = 0; if (raw_token.type !== TOKEN.TEXT && raw_token.previous.type !== TOKEN.TEXT) { newlines = raw_token.newlines ? 1 : 0; } if (this.preserve_newlines) { newlines = raw_token.newlines < this.max_preserve_newlines + 1 ? raw_token.newlines : this.max_preserve_newlines + 1; } for (var n = 0; n < newlines; n++) { this.print_newline(n > 0); } return newlines !== 0; }; Printer.prototype.traverse_whitespace = function(raw_token) { if (raw_token.whitespace_before || raw_token.newlines) { if (!this.print_preserved_newlines(raw_token)) { this._output.space_before_token = true; } return true; } return false; }; Printer.prototype.previous_token_wrapped = function() { return this._output.previous_token_wrapped; }; Printer.prototype.print_newline = function(force) { this._output.add_new_line(force); }; Printer.prototype.print_token = function(token) { if (token.text) { this._output.set_indent(this.indent_level, this.alignment_size); this._output.add_token(token.text); } }; Printer.prototype.indent = function() { this.indent_level++; }; Printer.prototype.get_full_indent = function(level) { level = this.indent_level + (level || 0); if (level < 1) { return ''; } return this._output.get_indent_string(level); }; var get_type_attribute = function(start_token) { var result = null; var raw_token = start_token.next; while (raw_token.type !== TOKEN.EOF && start_token.closed !== raw_token) { if (raw_token.type === TOKEN.ATTRIBUTE && raw_token.text === 'type') { if (raw_token.next && raw_token.next.type === TOKEN.EQUALS && raw_token.next.next && raw_token.next.next.type === TOKEN.VALUE) { result = raw_token.next.next.text; } break; } raw_token = raw_token.next; } return result; }; var get_custom_beautifier_name = function(tag_check, raw_token) { var typeAttribute = null; var result = null; if (!raw_token.closed) { return null; } if (tag_check === 'script') { typeAttribute = 'text/javascript'; } else if (tag_check === 'style') { typeAttribute = 'text/css'; } typeAttribute = get_type_attribute(raw_token) || typeAttribute; if (typeAttribute.search('text/css') > -1) { result = 'css'; } else if (typeAttribute.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/) > -1) { result = 'javascript'; } else if (typeAttribute.search(/(text|application|dojo)\/(x-)?(html)/) > -1) { result = 'html'; } else if (typeAttribute.search(/test\/null/) > -1) { result = 'null'; } return result; }; function in_array(what, arr) { return arr.indexOf(what) !== -1; } function TagFrame(parent, parser_token, indent_level) { this.parent = parent || null; this.tag = parser_token ? parser_token.tag_name : ''; this.indent_level = indent_level || 0; this.parser_token = parser_token || null; } function TagStack(printer) { this._printer = printer; this._current_frame = null; } TagStack.prototype.get_parser_token = function() { return this._current_frame ? this._current_frame.parser_token : null; }; TagStack.prototype.record_tag = function(parser_token) { var new_frame = new TagFrame(this._current_frame, parser_token, this._printer.indent_level); this._current_frame = new_frame; }; TagStack.prototype._try_pop_frame = function(frame) { var parser_token = null; if (frame) { parser_token = frame.parser_token; this._printer.indent_level = frame.indent_level; this._current_frame = frame.parent; } return parser_token; }; TagStack.prototype._get_frame = function(tag_list, stop_list) { var frame = this._current_frame; while (frame) { if (tag_list.indexOf(frame.tag) !== -1) { break; } else if (stop_list && stop_list.indexOf(frame.tag) !== -1) { frame = null; break; } frame = frame.parent; } return frame; }; TagStack.prototype.try_pop = function(tag, stop_list) { var frame = this._get_frame([tag], stop_list); return this._try_pop_frame(frame); }; TagStack.prototype.indent_to_tag = function(tag_list) { var frame = this._get_frame(tag_list); if (frame) { this._printer.indent_level = frame.indent_level; } }; function Beautifier(source_text, options, js_beautify, css_beautify) { this._source_text = source_text || ''; options = options || {}; this._js_beautify = js_beautify; this._css_beautify = css_beautify; this._tag_stack = null; var optionHtml = new Options(options, 'html'); this._options = optionHtml; this._is_wrap_attributes_force = this._options.wrap_attributes.substr(0, 'force'.length) === 'force'; this._is_wrap_attributes_force_expand_multiline = (this._options.wrap_attributes === 'force-expand-multiline'); this._is_wrap_attributes_force_aligned = (this._options.wrap_attributes === 'force-aligned'); this._is_wrap_attributes_aligned_multiple = (this._options.wrap_attributes === 'aligned-multiple'); this._is_wrap_attributes_preserve = this._options.wrap_attributes.substr(0, 'preserve'.length) === 'preserve'; this._is_wrap_attributes_preserve_aligned = (this._options.wrap_attributes === 'preserve-aligned'); } Beautifier.prototype.beautify = function() { if (this._options.disabled) { return this._source_text; } var source_text = this._source_text; var eol = this._options.eol; if (this._options.eol === 'auto') { eol = '\n'; if (source_text && lineBreak.test(source_text)) { eol = source_text.match(lineBreak)[0]; } } source_text = source_text.replace(allLineBreaks, '\n'); var baseIndentString = source_text.match(/^[\t ]*/)[0]; var last_token = { text: '', type: '' }; var last_tag_token = new TagOpenParserToken(); var printer = new Printer(this._options, baseIndentString); var tokens = new Tokenizer(source_text, this._options).tokenize(); this._tag_stack = new TagStack(printer); var parser_token = null; var raw_token = tokens.next(); while (raw_token.type !== TOKEN.EOF) { if (raw_token.type === TOKEN.TAG_OPEN || raw_token.type === TOKEN.COMMENT) { parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token); last_tag_token = parser_token; } else if ((raw_token.type === TOKEN.ATTRIBUTE || raw_token.type === TOKEN.EQUALS || raw_token.type === TOKEN.VALUE) || (raw_token.type === TOKEN.TEXT && !last_tag_token.tag_complete)) { parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token, tokens); } else if (raw_token.type === TOKEN.TAG_CLOSE) { parser_token = this._handle_tag_close(printer, raw_token, last_tag_token); } else if (raw_token.type === TOKEN.TEXT) { parser_token = this._handle_text(printer, raw_token, last_tag_token); } else { printer.add_raw_token(raw_token); } last_token = parser_token; raw_token = tokens.next(); } var sweet_code = printer._output.get_code(eol); return sweet_code; }; Beautifier.prototype._handle_tag_close = function(printer, raw_token, last_tag_token) { var parser_token = { text: raw_token.text, type: raw_token.type }; printer.alignment_size = 0; last_tag_token.tag_complete = true; printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true); if (last_tag_token.is_unformatted) { printer.add_raw_token(raw_token); } else { if (last_tag_token.tag_start_char === '<') { printer.set_space_before_token(raw_token.text[0] === '/', true); if (this._is_wrap_attributes_force_expand_multiline && last_tag_token.has_wrapped_attrs) { printer.print_newline(false); } } printer.print_token(raw_token); } if (last_tag_token.indent_content && !(last_tag_token.is_unformatted || last_tag_token.is_content_unformatted)) { printer.indent(); last_tag_token.indent_content = false; } if (!last_tag_token.is_inline_element && !(last_tag_token.is_unformatted || last_tag_token.is_content_unformatted)) { printer.set_wrap_point(); } return parser_token; }; Beautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token, tokens) { var wrapped = last_tag_token.has_wrapped_attrs; var parser_token = { text: raw_token.text, type: raw_token.type }; printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true); if (last_tag_token.is_unformatted) { printer.add_raw_token(raw_token); } else if (last_tag_token.tag_start_char === '{' && raw_token.type === TOKEN.TEXT) { if (printer.print_preserved_newlines(raw_token)) { raw_token.newlines = 0; printer.add_raw_token(raw_token); } else { printer.print_token(raw_token); } } else { if (raw_token.type === TOKEN.ATTRIBUTE) { printer.set_space_before_token(true); last_tag_token.attr_count += 1; } else if (raw_token.type === TOKEN.EQUALS) { printer.set_space_before_token(false); } else if (raw_token.type === TOKEN.VALUE && raw_token.previous.type === TOKEN.EQUALS) { printer.set_space_before_token(false); } if (raw_token.type === TOKEN.ATTRIBUTE && last_tag_token.tag_start_char === '<') { if (this._is_wrap_attributes_preserve || this._is_wrap_attributes_preserve_aligned) { printer.traverse_whitespace(raw_token); wrapped = wrapped || raw_token.newlines !== 0; } if (this._is_wrap_attributes_force) { var force_attr_wrap = last_tag_token.attr_count > 1; if (this._is_wrap_attributes_force_expand_multiline && last_tag_token.attr_count === 1) { var is_only_attribute = true; var peek_index = 0; var peek_token; do { peek_token = tokens.peek(peek_index); if (peek_token.type === TOKEN.ATTRIBUTE) { is_only_attribute = false; break; } peek_index += 1; } while (peek_index < 4 && peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE); force_attr_wrap = !is_only_attribute; } if (force_attr_wrap) { printer.print_newline(false); wrapped = true; } } } printer.print_token(raw_token); wrapped = wrapped || printer.previous_token_wrapped(); last_tag_token.has_wrapped_attrs = wrapped; } return parser_token; }; Beautifier.prototype._handle_text = function(printer, raw_token, last_tag_token) { var parser_token = { text: raw_token.text, type: 'TK_CONTENT' }; if (last_tag_token.custom_beautifier_name) { this._print_custom_beatifier_text(printer, raw_token, last_tag_token); } else if (last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) { printer.add_raw_token(raw_token); } else { printer.traverse_whitespace(raw_token); printer.print_token(raw_token); } return parser_token; }; Beautifier.prototype._print_custom_beatifier_text = function(printer, raw_token, last_tag_token) { var local = this; if (raw_token.text !== '') { var text = raw_token.text, _beautifier, script_indent_level = 1, pre = '', post = ''; if (last_tag_token.custom_beautifier_name === 'javascript' && typeof this._js_beautify === 'function') { _beautifier = this._js_beautify; } else if (last_tag_token.custom_beautifier_name === 'css' && typeof this._css_beautify === 'function') { _beautifier = this._css_beautify; } else if (last_tag_token.custom_beautifier_name === 'html') { _beautifier = function(html_source, options) { var beautifier = new Beautifier(html_source, options, local._js_beautify, local._css_beautify); return beautifier.beautify(); }; } if (this._options.indent_scripts === "keep") { script_indent_level = 0; } else if (this._options.indent_scripts === "separate") { script_indent_level = -printer.indent_level; } var indentation = printer.get_full_indent(script_indent_level); text = text.replace(/\n[ \t]*$/, ''); if (last_tag_token.custom_beautifier_name !== 'html' && text[0] === '<' && text.match(/^(|]]>)$/.exec(text); if (!matched) { printer.add_raw_token(raw_token); return; } pre = indentation + matched[1] + '\n'; text = matched[4]; if (matched[5]) { post = indentation + matched[5]; } text = text.replace(/\n[ \t]*$/, ''); if (matched[2] || matched[3].indexOf('\n') !== -1) { matched = matched[3].match(/[ \t]+$/); if (matched) { raw_token.whitespace_before = matched[0]; } } } if (text) { if (_beautifier) { var Child_options = function() { this.eol = '\n'; }; Child_options.prototype = this._options.raw_options; var child_options = new Child_options(); text = _beautifier(indentation + text, child_options); } else { var white = raw_token.whitespace_before; if (white) { text = text.replace(new RegExp('\n(' + white + ')?', 'g'), '\n'); } text = indentation + text.replace(/\n/g, '\n' + indentation); } } if (pre) { if (!text) { text = pre + post; } else { text = pre + text + '\n' + post; } } printer.print_newline(false); if (text) { raw_token.text = text; raw_token.whitespace_before = ''; raw_token.newlines = 0; printer.add_raw_token(raw_token); printer.print_newline(true); } } }; Beautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token) { var parser_token = this._get_tag_open_token(raw_token); if ((last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) && !last_tag_token.is_empty_element && raw_token.type === TOKEN.TAG_OPEN && raw_token.text.indexOf(']*)/); this.tag_check = tag_check_match ? tag_check_match[1] : ''; } else { tag_check_match = raw_token.text.match(/^{{(?:[\^]|#\*?)?([^\s}]+)/); this.tag_check = tag_check_match ? tag_check_match[1] : ''; if (raw_token.text === '{{#>' && this.tag_check === '>' && raw_token.next !== null) { this.tag_check = raw_token.next.text; } } this.tag_check = this.tag_check.toLowerCase(); if (raw_token.type === TOKEN.COMMENT) { this.tag_complete = true; } this.is_start_tag = this.tag_check.charAt(0) !== '/'; this.tag_name = !this.is_start_tag ? this.tag_check.substr(1) : this.tag_check; this.is_end_tag = !this.is_start_tag || (raw_token.closed && raw_token.closed.text === '/>'); this.is_end_tag = this.is_end_tag || (this.tag_start_char === '{' && (this.text.length < 3 || (/[^#\^]/.test(this.text.charAt(2))))); } }; Beautifier.prototype._get_tag_open_token = function(raw_token) { var parser_token = new TagOpenParserToken(this._tag_stack.get_parser_token(), raw_token); parser_token.alignment_size = this._options.wrap_attributes_indent_size; parser_token.is_end_tag = parser_token.is_end_tag || in_array(parser_token.tag_check, this._options.void_elements); parser_token.is_empty_element = parser_token.tag_complete || (parser_token.is_start_tag && parser_token.is_end_tag); parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted); parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted); parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_start_char === '{'; return parser_token; }; Beautifier.prototype._set_tag_position = function(printer, raw_token, parser_token, last_tag_token, last_token) { if (!parser_token.is_empty_element) { if (parser_token.is_end_tag) { parser_token.start_tag_token = this._tag_stack.try_pop(parser_token.tag_name); } else { if (this._do_optional_end_element(parser_token)) { if (!parser_token.is_inline_element) { printer.print_newline(false); } } this._tag_stack.record_tag(parser_token); if ((parser_token.tag_name === 'script' || parser_token.tag_name === 'style') && !(parser_token.is_unformatted || parser_token.is_content_unformatted)) { parser_token.custom_beautifier_name = get_custom_beautifier_name(parser_token.tag_check, raw_token); } } } if (in_array(parser_token.tag_check, this._options.extra_liners)) { printer.print_newline(false); if (!printer._output.just_added_blankline()) { printer.print_newline(true); } } if (parser_token.is_empty_element) { if (parser_token.tag_start_char === '{' && parser_token.tag_check === 'else') { this._tag_stack.indent_to_tag(['if', 'unless', 'each']); parser_token.indent_content = true; var foundIfOnCurrentLine = printer.current_line_has_match(/{{#if/); if (!foundIfOnCurrentLine) { printer.print_newline(false); } } if (parser_token.tag_name === '!--' && last_token.type === TOKEN.TAG_CLOSE && last_tag_token.is_end_tag && parser_token.text.indexOf('\n') === -1) ; else { if (!(parser_token.is_inline_element || parser_token.is_unformatted)) { printer.print_newline(false); } this._calcluate_parent_multiline(printer, parser_token); } } else if (parser_token.is_end_tag) { var do_end_expand = false; do_end_expand = parser_token.start_tag_token && parser_token.start_tag_token.multiline_content; do_end_expand = do_end_expand || (!parser_token.is_inline_element && !(last_tag_token.is_inline_element || last_tag_token.is_unformatted) && !(last_token.type === TOKEN.TAG_CLOSE && parser_token.start_tag_token === last_tag_token) && last_token.type !== 'TK_CONTENT' ); if (parser_token.is_content_unformatted || parser_token.is_unformatted) { do_end_expand = false; } if (do_end_expand) { printer.print_newline(false); } } else { parser_token.indent_content = !parser_token.custom_beautifier_name; if (parser_token.tag_start_char === '<') { if (parser_token.tag_name === 'html') { parser_token.indent_content = this._options.indent_inner_html; } else if (parser_token.tag_name === 'head') { parser_token.indent_content = this._options.indent_head_inner_html; } else if (parser_token.tag_name === 'body') { parser_token.indent_content = this._options.indent_body_inner_html; } } if (!(parser_token.is_inline_element || parser_token.is_unformatted) && (last_token.type !== 'TK_CONTENT' || parser_token.is_content_unformatted)) { printer.print_newline(false); } this._calcluate_parent_multiline(printer, parser_token); } }; Beautifier.prototype._calcluate_parent_multiline = function(printer, parser_token) { if (parser_token.parent && printer._output.just_added_newline() && !((parser_token.is_inline_element || parser_token.is_unformatted) && parser_token.parent.is_inline_element)) { parser_token.parent.multiline_content = true; } }; var p_closers = ['address', 'article', 'aside', 'blockquote', 'details', 'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'main', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul']; var p_parent_excludes = ['a', 'audio', 'del', 'ins', 'map', 'noscript', 'video']; Beautifier.prototype._do_optional_end_element = function(parser_token) { var result = null; if (parser_token.is_empty_element || !parser_token.is_start_tag || !parser_token.parent) { return; } if (parser_token.tag_name === 'body') { result = result || this._tag_stack.try_pop('head'); } else if (parser_token.tag_name === 'li') { result = result || this._tag_stack.try_pop('li', ['ol', 'ul']); } else if (parser_token.tag_name === 'dd' || parser_token.tag_name === 'dt') { result = result || this._tag_stack.try_pop('dt', ['dl']); result = result || this._tag_stack.try_pop('dd', ['dl']); } else if (parser_token.parent.tag_name === 'p' && p_closers.indexOf(parser_token.tag_name) !== -1) { var p_parent = parser_token.parent.parent; if (!p_parent || p_parent_excludes.indexOf(p_parent.tag_name) === -1) { result = result || this._tag_stack.try_pop('p'); } } else if (parser_token.tag_name === 'rp' || parser_token.tag_name === 'rt') { result = result || this._tag_stack.try_pop('rt', ['ruby', 'rtc']); result = result || this._tag_stack.try_pop('rp', ['ruby', 'rtc']); } else if (parser_token.tag_name === 'optgroup') { result = result || this._tag_stack.try_pop('optgroup', ['select']); } else if (parser_token.tag_name === 'option') { result = result || this._tag_stack.try_pop('option', ['select', 'datalist', 'optgroup']); } else if (parser_token.tag_name === 'colgroup') { result = result || this._tag_stack.try_pop('caption', ['table']); } else if (parser_token.tag_name === 'thead') { result = result || this._tag_stack.try_pop('caption', ['table']); result = result || this._tag_stack.try_pop('colgroup', ['table']); } else if (parser_token.tag_name === 'tbody' || parser_token.tag_name === 'tfoot') { result = result || this._tag_stack.try_pop('caption', ['table']); result = result || this._tag_stack.try_pop('colgroup', ['table']); result = result || this._tag_stack.try_pop('thead', ['table']); result = result || this._tag_stack.try_pop('tbody', ['table']); } else if (parser_token.tag_name === 'tr') { result = result || this._tag_stack.try_pop('caption', ['table']); result = result || this._tag_stack.try_pop('colgroup', ['table']); result = result || this._tag_stack.try_pop('tr', ['table', 'thead', 'tbody', 'tfoot']); } else if (parser_token.tag_name === 'th' || parser_token.tag_name === 'td') { result = result || this._tag_stack.try_pop('td', ['table', 'thead', 'tbody', 'tfoot', 'tr']); result = result || this._tag_stack.try_pop('th', ['table', 'thead', 'tbody', 'tfoot', 'tr']); } parser_token.parent = this._tag_stack.get_parser_token(); return result; }; module.exports.Beautifier = Beautifier; }), (function(module, __unused_webpack_exports, __webpack_require__) { var BaseOptions = __webpack_require__(6).Options; function Options(options) { BaseOptions.call(this, options, 'html'); if (this.templating.length === 1 && this.templating[0] === 'auto') { this.templating = ['django', 'erb', 'handlebars', 'php']; } this.indent_inner_html = this._get_boolean('indent_inner_html'); this.indent_body_inner_html = this._get_boolean('indent_body_inner_html', true); this.indent_head_inner_html = this._get_boolean('indent_head_inner_html', true); this.indent_handlebars = this._get_boolean('indent_handlebars', true); this.wrap_attributes = this._get_selection('wrap_attributes', ['auto', 'force', 'force-aligned', 'force-expand-multiline', 'aligned-multiple', 'preserve', 'preserve-aligned']); this.wrap_attributes_indent_size = this._get_number('wrap_attributes_indent_size', this.indent_size); this.extra_liners = this._get_array('extra_liners', ['head', 'body', '/html']); this.inline = this._get_array('inline', [ 'a', 'abbr', 'area', 'audio', 'b', 'bdi', 'bdo', 'br', 'button', 'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'map', 'mark', 'math', 'meter', 'noscript', 'object', 'output', 'progress', 'q', 'ruby', 's', 'samp', 'select', 'small', 'span', 'strong', 'sub', 'sup', 'svg', 'template', 'textarea', 'time', 'u', 'var', 'video', 'wbr', 'text', 'acronym', 'big', 'strike', 'tt' ]); this.void_elements = this._get_array('void_elements', [ 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr', '!doctype', '?xml', 'basefont', 'isindex' ]); this.unformatted = this._get_array('unformatted', []); this.content_unformatted = this._get_array('content_unformatted', [ 'pre', 'textarea' ]); this.unformatted_content_delimiter = this._get_characters('unformatted_content_delimiter'); this.indent_scripts = this._get_selection('indent_scripts', ['normal', 'keep', 'separate']); } Options.prototype = new BaseOptions(); module.exports.Options = Options; }), (function(module, __unused_webpack_exports, __webpack_require__) { var BaseTokenizer = __webpack_require__(9).Tokenizer; var BASETOKEN = __webpack_require__(9).TOKEN; var Directives = __webpack_require__(13).Directives; var TemplatablePattern = __webpack_require__(14).TemplatablePattern; var Pattern = __webpack_require__(12).Pattern; var TOKEN = { TAG_OPEN: 'TK_TAG_OPEN', TAG_CLOSE: 'TK_TAG_CLOSE', ATTRIBUTE: 'TK_ATTRIBUTE', EQUALS: 'TK_EQUALS', VALUE: 'TK_VALUE', COMMENT: 'TK_COMMENT', TEXT: 'TK_TEXT', UNKNOWN: 'TK_UNKNOWN', START: BASETOKEN.START, RAW: BASETOKEN.RAW, EOF: BASETOKEN.EOF }; var directives_core = new Directives(/<\!--/, /-->/); var Tokenizer = function(input_string, options) { BaseTokenizer.call(this, input_string, options); this._current_tag_name = ''; var templatable_reader = new TemplatablePattern(this._input).read_options(this._options); var pattern_reader = new Pattern(this._input); this.__patterns = { word: templatable_reader.until(/[\n\r\t <]/), single_quote: templatable_reader.until_after(/'/), double_quote: templatable_reader.until_after(/"/), attribute: templatable_reader.until(/[\n\r\t =>]|\/>/), element_name: templatable_reader.until(/[\n\r\t >\/]/), handlebars_comment: pattern_reader.starting_with(/{{!--/).until_after(/--}}/), handlebars: pattern_reader.starting_with(/{{/).until_after(/}}/), handlebars_open: pattern_reader.until(/[\n\r\t }]/), handlebars_raw_close: pattern_reader.until(/}}/), comment: pattern_reader.starting_with(//), cdata: pattern_reader.starting_with(//), conditional_comment: pattern_reader.starting_with(//), processing: pattern_reader.starting_with(/<\?/).until_after(/\?>/) }; if (this._options.indent_handlebars) { this.__patterns.word = this.__patterns.word.exclude('handlebars'); } this._unformatted_content_delimiter = null; if (this._options.unformatted_content_delimiter) { var literal_regexp = this._input.get_literal_regexp(this._options.unformatted_content_delimiter); this.__patterns.unformatted_content_delimiter = pattern_reader.matching(literal_regexp) .until_after(literal_regexp); } }; Tokenizer.prototype = new BaseTokenizer(); Tokenizer.prototype._is_comment = function(current_token) { return false; }; Tokenizer.prototype._is_opening = function(current_token) { return current_token.type === TOKEN.TAG_OPEN; }; Tokenizer.prototype._is_closing = function(current_token, open_token) { return current_token.type === TOKEN.TAG_CLOSE && (open_token && ( ((current_token.text === '>' || current_token.text === '/>') && open_token.text[0] === '<') || (current_token.text === '}}' && open_token.text[0] === '{' && open_token.text[1] === '{'))); }; Tokenizer.prototype._reset = function() { this._current_tag_name = ''; }; Tokenizer.prototype._get_next_token = function(previous_token, open_token) { var token = null; this._readWhitespace(); var c = this._input.peek(); if (c === null) { return this._create_token(TOKEN.EOF, ''); } token = token || this._read_open_handlebars(c, open_token); token = token || this._read_attribute(c, previous_token, open_token); token = token || this._read_close(c, open_token); token = token || this._read_raw_content(c, previous_token, open_token); token = token || this._read_content_word(c); token = token || this._read_comment_or_cdata(c); token = token || this._read_processing(c); token = token || this._read_open(c, open_token); token = token || this._create_token(TOKEN.UNKNOWN, this._input.next()); return token; }; Tokenizer.prototype._read_comment_or_cdata = function(c) { var token = null; var resulting_string = null; var directives = null; if (c === '<') { var peek1 = this._input.peek(1); if (peek1 === '!') { resulting_string = this.__patterns.comment.read(); if (resulting_string) { directives = directives_core.get_directives(resulting_string); if (directives && directives.ignore === 'start') { resulting_string += directives_core.readIgnored(this._input); } } else { resulting_string = this.__patterns.cdata.read(); } } if (resulting_string) { token = this._create_token(TOKEN.COMMENT, resulting_string); token.directives = directives; } } return token; }; Tokenizer.prototype._read_processing = function(c) { var token = null; var resulting_string = null; var directives = null; if (c === '<') { var peek1 = this._input.peek(1); if (peek1 === '!' || peek1 === '?') { resulting_string = this.__patterns.conditional_comment.read(); resulting_string = resulting_string || this.__patterns.processing.read(); } if (resulting_string) { token = this._create_token(TOKEN.COMMENT, resulting_string); token.directives = directives; } } return token; }; Tokenizer.prototype._read_open = function(c, open_token) { var resulting_string = null; var token = null; if (!open_token) { if (c === '<') { resulting_string = this._input.next(); if (this._input.peek() === '/') { resulting_string += this._input.next(); } resulting_string += this.__patterns.element_name.read(); token = this._create_token(TOKEN.TAG_OPEN, resulting_string); } } return token; }; Tokenizer.prototype._read_open_handlebars = function(c, open_token) { var resulting_string = null; var token = null; if (!open_token) { if (this._options.indent_handlebars && c === '{' && this._input.peek(1) === '{') { if (this._input.peek(2) === '!') { resulting_string = this.__patterns.handlebars_comment.read(); resulting_string = resulting_string || this.__patterns.handlebars.read(); token = this._create_token(TOKEN.COMMENT, resulting_string); } else { resulting_string = this.__patterns.handlebars_open.read(); token = this._create_token(TOKEN.TAG_OPEN, resulting_string); } } } return token; }; Tokenizer.prototype._read_close = function(c, open_token) { var resulting_string = null; var token = null; if (open_token) { if (open_token.text[0] === '<' && (c === '>' || (c === '/' && this._input.peek(1) === '>'))) { resulting_string = this._input.next(); if (c === '/') { resulting_string += this._input.next(); } token = this._create_token(TOKEN.TAG_CLOSE, resulting_string); } else if (open_token.text[0] === '{' && c === '}' && this._input.peek(1) === '}') { this._input.next(); this._input.next(); token = this._create_token(TOKEN.TAG_CLOSE, '}}'); } } return token; }; Tokenizer.prototype._read_attribute = function(c, previous_token, open_token) { var token = null; var resulting_string = ''; if (open_token && open_token.text[0] === '<') { if (c === '=') { token = this._create_token(TOKEN.EQUALS, this._input.next()); } else if (c === '"' || c === "'") { var content = this._input.next(); if (c === '"') { content += this.__patterns.double_quote.read(); } else { content += this.__patterns.single_quote.read(); } token = this._create_token(TOKEN.VALUE, content); } else { resulting_string = this.__patterns.attribute.read(); if (resulting_string) { if (previous_token.type === TOKEN.EQUALS) { token = this._create_token(TOKEN.VALUE, resulting_string); } else { token = this._create_token(TOKEN.ATTRIBUTE, resulting_string); } } } } return token; }; Tokenizer.prototype._is_content_unformatted = function(tag_name) { return this._options.void_elements.indexOf(tag_name) === -1 && (this._options.content_unformatted.indexOf(tag_name) !== -1 || this._options.unformatted.indexOf(tag_name) !== -1); }; Tokenizer.prototype._read_raw_content = function(c, previous_token, open_token) { var resulting_string = ''; if (open_token && open_token.text[0] === '{') { resulting_string = this.__patterns.handlebars_raw_close.read(); } else if (previous_token.type === TOKEN.TAG_CLOSE && previous_token.opened.text[0] === '<' && previous_token.text[0] !== '/') { var tag_name = previous_token.opened.text.substr(1).toLowerCase(); if (tag_name === 'script' || tag_name === 'style') { var token = this._read_comment_or_cdata(c); if (token) { token.type = TOKEN.TEXT; return token; } resulting_string = this._input.readUntil(new RegExp('', 'ig')); } else if (this._is_content_unformatted(tag_name)) { resulting_string = this._input.readUntil(new RegExp('', 'ig')); } } if (resulting_string) { return this._create_token(TOKEN.TEXT, resulting_string); } return null; }; Tokenizer.prototype._read_content_word = function(c) { var resulting_string = ''; if (this._options.unformatted_content_delimiter) { if (c === this._options.unformatted_content_delimiter[0]) { resulting_string = this.__patterns.unformatted_content_delimiter.read(); } } if (!resulting_string) { resulting_string = this.__patterns.word.read(); } if (resulting_string) { return this._create_token(TOKEN.TEXT, resulting_string); } }; module.exports.Tokenizer = Tokenizer; module.exports.TOKEN = TOKEN; }) ]); var __webpack_module_cache__ = {}; function __webpack_require__(moduleId) { var cachedModule = __webpack_module_cache__[moduleId]; if (cachedModule !== undefined) { return cachedModule.exports; } var module = __webpack_module_cache__[moduleId] = { exports: {} }; __webpack_modules__[moduleId](module, module.exports, __webpack_require__); return module.exports; } var __webpack_exports__ = __webpack_require__(18); legacy_beautify_html = __webpack_exports__; })() ; function html_beautify(html_source, options) { return legacy_beautify_html(html_source, options, js_beautify, css_beautify); } function format(document, range, options) { var value = document.getText(); var includesEnd = true; var initialIndentLevel = 0; var tabSize = options.tabSize || 4; if (range) { var startOffset = document.offsetAt(range.start); var extendedStart = startOffset; while (extendedStart > 0 && isWhitespace(value, extendedStart - 1)) { extendedStart--; } if (extendedStart === 0 || isEOL(value, extendedStart - 1)) { startOffset = extendedStart; } else { if (extendedStart < startOffset) { startOffset = extendedStart + 1; } } var endOffset = document.offsetAt(range.end); var extendedEnd = endOffset; while (extendedEnd < value.length && isWhitespace(value, extendedEnd)) { extendedEnd++; } if (extendedEnd === value.length || isEOL(value, extendedEnd)) { endOffset = extendedEnd; } range = Range.create(document.positionAt(startOffset), document.positionAt(endOffset)); var firstHalf = value.substring(0, startOffset); if (new RegExp(/.*[<][^>]*$/).test(firstHalf)) { value = value.substring(startOffset, endOffset); return [{ range: range, newText: value }]; } includesEnd = endOffset === value.length; value = value.substring(startOffset, endOffset); if (startOffset !== 0) { var startOfLineOffset = document.offsetAt(Position.create(range.start.line, 0)); initialIndentLevel = computeIndentLevel(document.getText(), startOfLineOffset, options); } } else { range = Range.create(Position.create(0, 0), document.positionAt(value.length)); } var htmlOptions = { indent_size: tabSize, indent_char: options.insertSpaces ? ' ' : '\t', indent_empty_lines: getFormatOption(options, 'indentEmptyLines', false), wrap_line_length: getFormatOption(options, 'wrapLineLength', 120), unformatted: getTagsFormatOption(options, 'unformatted', void 0), content_unformatted: getTagsFormatOption(options, 'contentUnformatted', void 0), indent_inner_html: getFormatOption(options, 'indentInnerHtml', false), preserve_newlines: getFormatOption(options, 'preserveNewLines', true), max_preserve_newlines: getFormatOption(options, 'maxPreserveNewLines', 32786), indent_handlebars: getFormatOption(options, 'indentHandlebars', false), end_with_newline: includesEnd && getFormatOption(options, 'endWithNewline', false), extra_liners: getTagsFormatOption(options, 'extraLiners', void 0), wrap_attributes: getFormatOption(options, 'wrapAttributes', 'auto'), wrap_attributes_indent_size: getFormatOption(options, 'wrapAttributesIndentSize', void 0), eol: '\n', indent_scripts: getFormatOption(options, 'indentScripts', 'normal'), templating: getTemplatingFormatOption(options, 'all'), unformatted_content_delimiter: getFormatOption(options, 'unformattedContentDelimiter', ''), }; var result = html_beautify(trimLeft(value), htmlOptions); if (initialIndentLevel > 0) { var indent = options.insertSpaces ? repeat(' ', tabSize * initialIndentLevel) : repeat('\t', initialIndentLevel); result = result.split('\n').join('\n' + indent); if (range.start.character === 0) { result = indent + result; } } return [{ range: range, newText: result }]; } function trimLeft(str) { return str.replace(/^\s+/, ''); } function getFormatOption(options, key, dflt) { if (options && options.hasOwnProperty(key)) { var value = options[key]; if (value !== null) { return value; } } return dflt; } function getTagsFormatOption(options, key, dflt) { var list = getFormatOption(options, key, null); if (typeof list === 'string') { if (list.length > 0) { return list.split(',').map(function (t) { return t.trim().toLowerCase(); }); } return []; } return dflt; } function getTemplatingFormatOption(options, dflt) { var value = getFormatOption(options, 'templating', dflt); if (value === true) { return ['auto']; } return ['none']; } function computeIndentLevel(content, offset, options) { var i = offset; var nChars = 0; var tabSize = options.tabSize || 4; while (i < content.length) { var ch = content.charAt(i); if (ch === ' ') { nChars++; } else if (ch === '\t') { nChars += tabSize; } else { break; } i++; } return Math.floor(nChars / tabSize); } function isEOL(text, offset) { return '\r\n'.indexOf(text.charAt(offset)) !== -1; } function isWhitespace(text, offset) { return ' \t'.indexOf(text.charAt(offset)) !== -1; } function normalizeRef(url) { var first = url[0]; var last = url[url.length - 1]; if (first === last && (first === '\'' || first === '\"')) { url = url.substr(1, url.length - 2); } return url; } function validateRef(url, languageId) { if (!url.length) { return false; } if (languageId === 'handlebars' && /{{|}}/.test(url)) { return false; } return /\b(w[\w\d+.-]*:\/\/)?[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|\/?))/.test(url); } function getWorkspaceUrl(documentUri, tokenContent, documentContext, base) { if (/^\s*javascript\:/i.test(tokenContent) || /[\n\r]/.test(tokenContent)) { return undefined; } tokenContent = tokenContent.replace(/^\s*/g, ''); if (/^https?:\/\//i.test(tokenContent) || /^file:\/\//i.test(tokenContent)) { return tokenContent; } if (/^\#/i.test(tokenContent)) { return documentUri + tokenContent; } if (/^\/\//i.test(tokenContent)) { var pickedScheme = startsWith$1(documentUri, 'https://') ? 'https' : 'http'; return pickedScheme + ':' + tokenContent.replace(/^\s*/g, ''); } if (documentContext) { return documentContext.resolveReference(tokenContent, base || documentUri); } return tokenContent; } function createLink(document, documentContext, attributeValue, startOffset, endOffset, base) { var tokenContent = normalizeRef(attributeValue); if (!validateRef(tokenContent, document.languageId)) { return undefined; } if (tokenContent.length < attributeValue.length) { startOffset++; endOffset--; } var workspaceUrl = getWorkspaceUrl(document.uri, tokenContent, documentContext, base); if (!workspaceUrl || !isValidURI(workspaceUrl)) { return undefined; } return { range: Range.create(document.positionAt(startOffset), document.positionAt(endOffset)), target: workspaceUrl }; } function isValidURI(uri) { try { URI$1.parse(uri); return true; } catch (e) { return false; } } function findDocumentLinks(document, documentContext) { var newLinks = []; var scanner = createScanner$1(document.getText(), 0); var token = scanner.scan(); var lastAttributeName = undefined; var afterBase = false; var base = void 0; var idLocations = {}; while (token !== TokenType$1.EOS) { switch (token) { case TokenType$1.StartTag: if (!base) { var tagName = scanner.getTokenText().toLowerCase(); afterBase = tagName === 'base'; } break; case TokenType$1.AttributeName: lastAttributeName = scanner.getTokenText().toLowerCase(); break; case TokenType$1.AttributeValue: if (lastAttributeName === 'src' || lastAttributeName === 'href') { var attributeValue = scanner.getTokenText(); if (!afterBase) { var link = createLink(document, documentContext, attributeValue, scanner.getTokenOffset(), scanner.getTokenEnd(), base); if (link) { newLinks.push(link); } } if (afterBase && typeof base === 'undefined') { base = normalizeRef(attributeValue); if (base && documentContext) { base = documentContext.resolveReference(base, document.uri); } } afterBase = false; lastAttributeName = undefined; } else if (lastAttributeName === 'id') { var id = normalizeRef(scanner.getTokenText()); idLocations[id] = scanner.getTokenOffset(); } break; } token = scanner.scan(); } for (var _i = 0, newLinks_1 = newLinks; _i < newLinks_1.length; _i++) { var link = newLinks_1[_i]; var localWithHash = document.uri + '#'; if (link.target && startsWith$1(link.target, localWithHash)) { var target = link.target.substr(localWithHash.length); var offset = idLocations[target]; if (offset !== undefined) { var pos = document.positionAt(offset); link.target = "" + localWithHash + (pos.line + 1) + "," + (pos.character + 1); } } } return newLinks; } function findDocumentHighlights(document, position, htmlDocument) { var offset = document.offsetAt(position); var node = htmlDocument.findNodeAt(offset); if (!node.tag) { return []; } var result = []; var startTagRange = getTagNameRange(TokenType$1.StartTag, document, node.start); var endTagRange = typeof node.endTagStart === 'number' && getTagNameRange(TokenType$1.EndTag, document, node.endTagStart); if (startTagRange && covers(startTagRange, position) || endTagRange && covers(endTagRange, position)) { if (startTagRange) { result.push({ kind: DocumentHighlightKind.Read, range: startTagRange }); } if (endTagRange) { result.push({ kind: DocumentHighlightKind.Read, range: endTagRange }); } } return result; } function isBeforeOrEqual(pos1, pos2) { return pos1.line < pos2.line || (pos1.line === pos2.line && pos1.character <= pos2.character); } function covers(range, position) { return isBeforeOrEqual(range.start, position) && isBeforeOrEqual(position, range.end); } function getTagNameRange(tokenType, document, startOffset) { var scanner = createScanner$1(document.getText(), startOffset); var token = scanner.scan(); while (token !== TokenType$1.EOS && token !== tokenType) { token = scanner.scan(); } if (token !== TokenType$1.EOS) { return { start: document.positionAt(scanner.getTokenOffset()), end: document.positionAt(scanner.getTokenEnd()) }; } return null; } function findDocumentSymbols(document, htmlDocument) { var symbols = []; htmlDocument.roots.forEach(function (node) { provideFileSymbolsInternal(document, node, '', symbols); }); return symbols; } function provideFileSymbolsInternal(document, node, container, symbols) { var name = nodeToName(node); var location = Location.create(document.uri, Range.create(document.positionAt(node.start), document.positionAt(node.end))); var symbol = { name: name, location: location, containerName: container, kind: SymbolKind.Field }; symbols.push(symbol); node.children.forEach(function (child) { provideFileSymbolsInternal(document, child, name, symbols); }); } function nodeToName(node) { var name = node.tag; if (node.attributes) { var id = node.attributes['id']; var classes = node.attributes['class']; if (id) { name += "#" + id.replace(/[\"\']/g, ''); } if (classes) { name += classes.replace(/[\"\']/g, '').split(/\s+/).map(function (className) { return "." + className; }).join(''); } } return name || '?'; } function doRename(document, position, newName, htmlDocument) { var _a; var offset = document.offsetAt(position); var node = htmlDocument.findNodeAt(offset); if (!node.tag) { return null; } if (!isWithinTagRange(node, offset, node.tag)) { return null; } var edits = []; var startTagRange = { start: document.positionAt(node.start + '<'.length), end: document.positionAt(node.start + '<'.length + node.tag.length) }; edits.push({ range: startTagRange, newText: newName }); if (node.endTagStart) { var endTagRange = { start: document.positionAt(node.endTagStart + ' top.startLine) { if (entry.endLine <= top.endLine) { previous.push(top); top = entry; setNestingLevel(i, previous.length); } else if (entry.startLine > top.endLine) { do { top = previous.pop(); } while (top && entry.startLine > top.endLine); if (top) { previous.push(top); } top = entry; setNestingLevel(i, previous.length); } } } } var entries = 0; var maxLevel = 0; for (var i = 0; i < nestingLevelCounts.length; i++) { var n = nestingLevelCounts[i]; if (n) { if (n + entries > rangeLimit) { maxLevel = i; break; } entries += n; } } var result = []; for (var i = 0; i < ranges.length; i++) { var level = nestingLevels[i]; if (typeof level === 'number') { if (level < maxLevel || (level === maxLevel && entries++ < rangeLimit)) { result.push(ranges[i]); } } } return result; } function getFoldingRanges$1(document, context) { var scanner = createScanner$1(document.getText()); var token = scanner.scan(); var ranges = []; var stack = []; var lastTagName = null; var prevStart = -1; function addRange(range) { ranges.push(range); prevStart = range.startLine; } while (token !== TokenType$1.EOS) { switch (token) { case TokenType$1.StartTag: { var tagName = scanner.getTokenText(); var startLine = document.positionAt(scanner.getTokenOffset()).line; stack.push({ startLine: startLine, tagName: tagName }); lastTagName = tagName; break; } case TokenType$1.EndTag: { lastTagName = scanner.getTokenText(); break; } case TokenType$1.StartTagClose: if (!lastTagName || !isVoidElement(lastTagName)) { break; } case TokenType$1.EndTagClose: case TokenType$1.StartTagSelfClose: { var i = stack.length - 1; while (i >= 0 && stack[i].tagName !== lastTagName) { i--; } if (i >= 0) { var stackElement = stack[i]; stack.length = i; var line = document.positionAt(scanner.getTokenOffset()).line; var startLine = stackElement.startLine; var endLine = line - 1; if (endLine > startLine && prevStart !== startLine) { addRange({ startLine: startLine, endLine: endLine }); } } break; } case TokenType$1.Comment: { var startLine = document.positionAt(scanner.getTokenOffset()).line; var text = scanner.getTokenText(); var m = text.match(/^\s*#(region\b)|(endregion\b)/); if (m) { if (m[1]) { stack.push({ startLine: startLine, tagName: '' }); } else { var i = stack.length - 1; while (i >= 0 && stack[i].tagName.length) { i--; } if (i >= 0) { var stackElement = stack[i]; stack.length = i; var endLine = startLine; startLine = stackElement.startLine; if (endLine > startLine && prevStart !== startLine) { addRange({ startLine: startLine, endLine: endLine, kind: FoldingRangeKind.Region }); } } } } else { var endLine = document.positionAt(scanner.getTokenOffset() + scanner.getTokenLength()).line; if (startLine < endLine) { addRange({ startLine: startLine, endLine: endLine, kind: FoldingRangeKind.Comment }); } } break; } } token = scanner.scan(); } var rangeLimit = context && context.rangeLimit || Number.MAX_VALUE; if (ranges.length > rangeLimit) { return limitRanges(ranges, rangeLimit); } return ranges; } function getSelectionRanges$2(document, positions) { function getSelectionRange(position) { var applicableRanges = getApplicableRanges(document, position); var prev = undefined; var current = undefined; for (var index = applicableRanges.length - 1; index >= 0; index--) { var range = applicableRanges[index]; if (!prev || range[0] !== prev[0] || range[1] !== prev[1]) { current = SelectionRange.create(Range.create(document.positionAt(applicableRanges[index][0]), document.positionAt(applicableRanges[index][1])), current); } prev = range; } if (!current) { current = SelectionRange.create(Range.create(position, position)); } return current; } return positions.map(getSelectionRange); } function getApplicableRanges(document, position) { var htmlDoc = parse$5(document.getText()); var currOffset = document.offsetAt(position); var currNode = htmlDoc.findNodeAt(currOffset); var result = getAllParentTagRanges(currNode); if (currNode.startTagEnd && !currNode.endTagStart) { if (currNode.startTagEnd !== currNode.end) { return [[currNode.start, currNode.end]]; } var closeRange = Range.create(document.positionAt(currNode.startTagEnd - 2), document.positionAt(currNode.startTagEnd)); var closeText = document.getText(closeRange); if (closeText === '/>') { result.unshift([currNode.start + 1, currNode.startTagEnd - 2]); } else { result.unshift([currNode.start + 1, currNode.startTagEnd - 1]); } var attributeLevelRanges = getAttributeLevelRanges(document, currNode, currOffset); result = attributeLevelRanges.concat(result); return result; } if (!currNode.startTagEnd || !currNode.endTagStart) { return result; } result.unshift([currNode.start, currNode.end]); if (currNode.start < currOffset && currOffset < currNode.startTagEnd) { result.unshift([currNode.start + 1, currNode.startTagEnd - 1]); var attributeLevelRanges = getAttributeLevelRanges(document, currNode, currOffset); result = attributeLevelRanges.concat(result); return result; } else if (currNode.startTagEnd <= currOffset && currOffset <= currNode.endTagStart) { result.unshift([currNode.startTagEnd, currNode.endTagStart]); return result; } else { if (currOffset >= currNode.endTagStart + 2) { result.unshift([currNode.endTagStart + 2, currNode.end - 1]); } return result; } } function getAllParentTagRanges(initialNode) { var currNode = initialNode; var getNodeRanges = function (n) { if (n.startTagEnd && n.endTagStart && n.startTagEnd < n.endTagStart) { return [ [n.startTagEnd, n.endTagStart], [n.start, n.end] ]; } return [ [n.start, n.end] ]; }; var result = []; while (currNode.parent) { currNode = currNode.parent; getNodeRanges(currNode).forEach(function (r) { return result.push(r); }); } return result; } function getAttributeLevelRanges(document, currNode, currOffset) { var currNodeRange = Range.create(document.positionAt(currNode.start), document.positionAt(currNode.end)); var currNodeText = document.getText(currNodeRange); var relativeOffset = currOffset - currNode.start; var scanner = createScanner$1(currNodeText); var token = scanner.scan(); var positionOffset = currNode.start; var result = []; var isInsideAttribute = false; var attrStart = -1; while (token !== TokenType$1.EOS) { switch (token) { case TokenType$1.AttributeName: { if (relativeOffset < scanner.getTokenOffset()) { isInsideAttribute = false; break; } if (relativeOffset <= scanner.getTokenEnd()) { result.unshift([scanner.getTokenOffset(), scanner.getTokenEnd()]); } isInsideAttribute = true; attrStart = scanner.getTokenOffset(); break; } case TokenType$1.AttributeValue: { if (!isInsideAttribute) { break; } var valueText = scanner.getTokenText(); if (relativeOffset < scanner.getTokenOffset()) { result.push([attrStart, scanner.getTokenEnd()]); break; } if (relativeOffset >= scanner.getTokenOffset() && relativeOffset <= scanner.getTokenEnd()) { result.unshift([scanner.getTokenOffset(), scanner.getTokenEnd()]); if ((valueText[0] === "\"" && valueText[valueText.length - 1] === "\"") || (valueText[0] === "'" && valueText[valueText.length - 1] === "'")) { if (relativeOffset >= scanner.getTokenOffset() + 1 && relativeOffset <= scanner.getTokenEnd() - 1) { result.unshift([scanner.getTokenOffset() + 1, scanner.getTokenEnd() - 1]); } } result.push([attrStart, scanner.getTokenEnd()]); } break; } } token = scanner.scan(); } return result.map(function (pair) { return [pair[0] + positionOffset, pair[1] + positionOffset]; }); } var htmlData$1 = { "version": 1.1, "tags": [ { "name": "html", "description": { "kind": "markdown", "value": "The html element represents the root of an HTML document." }, "attributes": [ { "name": "manifest", "description": { "kind": "markdown", "value": "Specifies the URI of a resource manifest indicating resources that should be cached locally. See [Using the application cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache) for details." } }, { "name": "version", "description": "Specifies the version of the HTML [Document Type Definition](https://developer.mozilla.org/en-US/docs/Glossary/DTD \"Document Type Definition: In HTML, the doctype is the required \"\" preamble found at the top of all documents. Its sole purpose is to prevent a browser from switching into so-called “quirks mode” when rendering a document; that is, the \"\" doctype ensures that the browser makes a best-effort attempt at following the relevant specifications, rather than using a different rendering mode that is incompatible with some specifications.\") that governs the current document. This attribute is not needed, because it is redundant with the version information in the document type declaration." }, { "name": "xmlns", "description": "Specifies the XML Namespace of the document. Default value is `\"http://www.w3.org/1999/xhtml\"`. This is required in documents parsed with XML parsers, and optional in text/html documents." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/html" } ] }, { "name": "head", "description": { "kind": "markdown", "value": "The head element represents a collection of metadata for the Document." }, "attributes": [ { "name": "profile", "description": "The URIs of one or more metadata profiles, separated by white space." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/head" } ] }, { "name": "title", "description": { "kind": "markdown", "value": "The title element represents the document's title or name. Authors should use titles that identify their documents even when they are used out of context, for example in a user's history or bookmarks, or in search results. The document's title is often different from its first heading, since the first heading does not have to stand alone when taken out of context." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/title" } ] }, { "name": "base", "description": { "kind": "markdown", "value": "The base element allows authors to specify the document base URL for the purposes of resolving relative URLs, and the name of the default browsing context for the purposes of following hyperlinks. The element does not represent any content beyond this information." }, "attributes": [ { "name": "href", "description": { "kind": "markdown", "value": "The base URL to be used throughout the document for relative URL addresses. If this attribute is specified, this element must come before any other elements with attributes whose values are URLs. Absolute and relative URLs are allowed." } }, { "name": "target", "description": { "kind": "markdown", "value": "A name or keyword indicating the default location to display the result when hyperlinks or forms cause navigation, for elements that do not have an explicit target reference. It is a name of, or keyword for, a _browsing context_ (for example: tab, window, or inline frame). The following keywords have special meanings:\n\n* `_self`: Load the result into the same browsing context as the current one. This value is the default if the attribute is not specified.\n* `_blank`: Load the result into a new unnamed browsing context.\n* `_parent`: Load the result into the parent browsing context of the current one. If there is no parent, this option behaves the same way as `_self`.\n* `_top`: Load the result into the top-level browsing context (that is, the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as `_self`.\n\nIf this attribute is specified, this element must come before any other elements with attributes whose values are URLs." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/base" } ] }, { "name": "link", "description": { "kind": "markdown", "value": "The link element allows authors to link their document to other resources." }, "attributes": [ { "name": "href", "description": { "kind": "markdown", "value": "This attribute specifies the [URL](https://developer.mozilla.org/en-US/docs/Glossary/URL \"URL: Uniform Resource Locator (URL) is a text string specifying where a resource can be found on the Internet.\") of the linked resource. A URL can be absolute or relative." } }, { "name": "crossorigin", "valueSet": "xo", "description": { "kind": "markdown", "value": "This enumerated attribute indicates whether [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS \"CORS: CORS (Cross-Origin Resource Sharing) is a system, consisting of transmitting HTTP headers, that determines whether browsers block frontend JavaScript code from accessing responses for cross-origin requests.\") must be used when fetching the resource. [CORS-enabled images](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_Enabled_Image) can be reused in the [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas \"Use the HTML element with either the canvas scripting API or the WebGL API to draw graphics and animations.\") element without being _tainted_. The allowed values are:\n\n`anonymous`\n\nA cross-origin request (i.e. with an [`Origin`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin \"The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.\") HTTP header) is performed, but no credential is sent (i.e. no cookie, X.509 certificate, or HTTP Basic authentication). If the server does not give credentials to the origin site (by not setting the [`Access-Control-Allow-Origin`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin \"The Access-Control-Allow-Origin response header indicates whether the response can be shared with requesting code from the given origin.\") HTTP header) the image will be tainted and its usage restricted.\n\n`use-credentials`\n\nA cross-origin request (i.e. with an `Origin` HTTP header) is performed along with a credential sent (i.e. a cookie, certificate, and/or HTTP Basic authentication is performed). If the server does not give credentials to the origin site (through [`Access-Control-Allow-Credentials`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials \"The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to frontend JavaScript code when the request's credentials mode (Request.credentials) is \"include\".\") HTTP header), the resource will be _tainted_ and its usage restricted.\n\nIf the attribute is not present, the resource is fetched without a [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS \"CORS: CORS (Cross-Origin Resource Sharing) is a system, consisting of transmitting HTTP headers, that determines whether browsers block frontend JavaScript code from accessing responses for cross-origin requests.\") request (i.e. without sending the `Origin` HTTP header), preventing its non-tainted usage. If invalid, it is handled as if the enumerated keyword **anonymous** was used. See [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for additional information." } }, { "name": "rel", "description": { "kind": "markdown", "value": "This attribute names a relationship of the linked document to the current document. The attribute must be a space-separated list of the [link types values](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types)." } }, { "name": "media", "description": { "kind": "markdown", "value": "This attribute specifies the media that the linked resource applies to. Its value must be a media type / [media query](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_queries). This attribute is mainly useful when linking to external stylesheets — it allows the user agent to pick the best adapted one for the device it runs on.\n\n**Notes:**\n\n* In HTML 4, this can only be a simple white-space-separated list of media description literals, i.e., [media types and groups](https://developer.mozilla.org/en-US/docs/Web/CSS/@media), where defined and allowed as values for this attribute, such as `print`, `screen`, `aural`, `braille`. HTML5 extended this to any kind of [media queries](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_queries), which are a superset of the allowed values of HTML 4.\n* Browsers not supporting [CSS3 Media Queries](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_queries) won't necessarily recognize the adequate link; do not forget to set fallback links, the restricted set of media queries defined in HTML 4." } }, { "name": "hreflang", "description": { "kind": "markdown", "value": "This attribute indicates the language of the linked resource. It is purely advisory. Allowed values are determined by [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt). Use this attribute only if the [`href`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href) attribute is present." } }, { "name": "type", "description": { "kind": "markdown", "value": "This attribute is used to define the type of the content linked to. The value of the attribute should be a MIME type such as **text/html**, **text/css**, and so on. The common use of this attribute is to define the type of stylesheet being referenced (such as **text/css**), but given that CSS is the only stylesheet language used on the web, not only is it possible to omit the `type` attribute, but is actually now recommended practice. It is also used on `rel=\"preload\"` link types, to make sure the browser only downloads file types that it supports." } }, { "name": "sizes", "description": { "kind": "markdown", "value": "This attribute defines the sizes of the icons for visual media contained in the resource. It must be present only if the [`rel`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-rel) contains a value of `icon` or a non-standard type such as Apple's `apple-touch-icon`. It may have the following values:\n\n* `any`, meaning that the icon can be scaled to any size as it is in a vector format, like `image/svg+xml`.\n* a white-space separated list of sizes, each in the format `__x__` or `__X__`. Each of these sizes must be contained in the resource.\n\n**Note:** Most icon formats are only able to store one single icon; therefore most of the time the [`sizes`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-sizes) contains only one entry. MS's ICO format does, as well as Apple's ICNS. ICO is more ubiquitous; you should definitely use it." } }, { "name": "as", "description": "This attribute is only used when `rel=\"preload\"` or `rel=\"prefetch\"` has been set on the `` element. It specifies the type of content being loaded by the ``, which is necessary for content prioritization, request matching, application of correct [content security policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP), and setting of correct [`Accept`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept \"The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Type response header. Browsers set adequate values for this header depending on the context where the request is done: when fetching a CSS stylesheet a different value is set for the request than when fetching an image, video or a script.\") request header." }, { "name": "importance", "description": "Indicates the relative importance of the resource. Priority hints are delegated using the values:" }, { "name": "importance", "description": "**`auto`**: Indicates **no preference**. The browser may use its own heuristics to decide the priority of the resource.\n\n**`high`**: Indicates to the browser that the resource is of **high** priority.\n\n**`low`**: Indicates to the browser that the resource is of **low** priority.\n\n**Note:** The `importance` attribute may only be used for the `` element if `rel=\"preload\"` or `rel=\"prefetch\"` is present." }, { "name": "integrity", "description": "Contains inline metadata — a base64-encoded cryptographic hash of the resource (file) you’re telling the browser to fetch. The browser can use this to verify that the fetched resource has been delivered free of unexpected manipulation. See [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)." }, { "name": "referrerpolicy", "description": "A string indicating which referrer to use when fetching the resource:\n\n* `no-referrer` means that the [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent.\n* `no-referrer-when-downgrade` means that no [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will be sent when navigating to an origin without TLS (HTTPS). This is a user agent’s default behavior, if no policy is otherwise specified.\n* `origin` means that the referrer will be the origin of the page, which is roughly the scheme, the host, and the port.\n* `origin-when-cross-origin` means that navigating to other origins will be limited to the scheme, the host, and the port, while navigating on the same origin will include the referrer's path.\n* `unsafe-url` means that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe because it can leak origins and paths from TLS-protected resources to insecure origins." }, { "name": "title", "description": "The `title` attribute has special semantics on the `` element. When used on a `` it defines a [preferred or an alternate stylesheet](https://developer.mozilla.org/en-US/docs/Web/CSS/Alternative_style_sheets). Incorrectly using it may [cause the stylesheet to be ignored](https://developer.mozilla.org/en-US/docs/Correctly_Using_Titles_With_External_Stylesheets)." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/link" } ] }, { "name": "meta", "description": { "kind": "markdown", "value": "The meta element represents various kinds of metadata that cannot be expressed using the title, base, link, style, and script elements." }, "attributes": [ { "name": "name", "description": { "kind": "markdown", "value": "This attribute defines the name of a piece of document-level metadata. It should not be set if one of the attributes [`itemprop`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-itemprop), [`http-equiv`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-http-equiv) or [`charset`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-charset) is also set.\n\nThis metadata name is associated with the value contained by the [`content`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content) attribute. The possible values for the name attribute are:\n\n* `application-name` which defines the name of the application running in the web page.\n \n **Note:**\n \n * Browsers may use this to identify the application. It is different from the [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title \"The HTML Title element (<title>) defines the document's title that is shown in a browser's title bar or a page's tab.\") element, which usually contain the application name, but may also contain information like the document name or a status.\n * Simple web pages shouldn't define an application-name.\n \n* `author` which defines the name of the document's author.\n* `description` which contains a short and accurate summary of the content of the page. Several browsers, like Firefox and Opera, use this as the default description of bookmarked pages.\n* `generator` which contains the identifier of the software that generated the page.\n* `keywords` which contains words relevant to the page's content separated by commas.\n* `referrer` which controls the [`Referer` HTTP header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer) attached to requests sent from the document:\n \n Values for the `content` attribute of `<meta name=\"referrer\">`\n \n `no-referrer`\n \n Do not send a HTTP `Referrer` header.\n \n `origin`\n \n Send the [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) of the document.\n \n `no-referrer-when-downgrade`\n \n Send the [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) as a referrer to URLs as secure as the current page, (https→https), but does not send a referrer to less secure URLs (https→http). This is the default behaviour.\n \n `origin-when-cross-origin`\n \n Send the full URL (stripped of parameters) for same-origin requests, but only send the [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) for other cases.\n \n `same-origin`\n \n A referrer will be sent for [same-site origins](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy), but cross-origin requests will contain no referrer information.\n \n `strict-origin`\n \n Only send the origin of the document as the referrer to a-priori as-much-secure destination (HTTPS->HTTPS), but don't send it to a less secure destination (HTTPS->HTTP).\n \n `strict-origin-when-cross-origin`\n \n Send a full URL when performing a same-origin request, only send the origin of the document to a-priori as-much-secure destination (HTTPS->HTTPS), and send no header to a less secure destination (HTTPS->HTTP).\n \n `unsafe-URL`\n \n Send the full URL (stripped of parameters) for same-origin or cross-origin requests.\n \n **Notes:**\n \n * Some browsers support the deprecated values of `always`, `default`, and `never` for referrer.\n * Dynamically inserting `<meta name=\"referrer\">` (with [`document.write`](https://developer.mozilla.org/en-US/docs/Web/API/Document/write) or [`appendChild`](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild)) makes the referrer behaviour unpredictable.\n * When several conflicting policies are defined, the no-referrer policy is applied.\n \n\nThis attribute may also have a value taken from the extended list defined on [WHATWG Wiki MetaExtensions page](https://wiki.whatwg.org/wiki/MetaExtensions). Although none have been formally accepted yet, a few commonly used names are:\n\n* `creator` which defines the name of the creator of the document, such as an organization or institution. If there are more than one, several [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") elements should be used.\n* `googlebot`, a synonym of `robots`, is only followed by Googlebot (the indexing crawler for Google).\n* `publisher` which defines the name of the document's publisher.\n* `robots` which defines the behaviour that cooperative crawlers, or \"robots\", should use with the page. It is a comma-separated list of the values below:\n \n Values for the content of `<meta name=\"robots\">`\n \n Value\n \n Description\n \n Used by\n \n `index`\n \n Allows the robot to index the page (default).\n \n All\n \n `noindex`\n \n Requests the robot to not index the page.\n \n All\n \n `follow`\n \n Allows the robot to follow the links on the page (default).\n \n All\n \n `nofollow`\n \n Requests the robot to not follow the links on the page.\n \n All\n \n `none`\n \n Equivalent to `noindex, nofollow`\n \n [Google](https://support.google.com/webmasters/answer/79812)\n \n `noodp`\n \n Prevents using the [Open Directory Project](https://www.dmoz.org/) description, if any, as the page description in search engine results.\n \n [Google](https://support.google.com/webmasters/answer/35624#nodmoz), [Yahoo](https://help.yahoo.com/kb/search-for-desktop/meta-tags-robotstxt-yahoo-search-sln2213.html#cont5), [Bing](https://www.bing.com/webmaster/help/which-robots-metatags-does-bing-support-5198d240)\n \n `noarchive`\n \n Requests the search engine not to cache the page content.\n \n [Google](https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag#valid-indexing--serving-directives), [Yahoo](https://help.yahoo.com/kb/search-for-desktop/SLN2213.html), [Bing](https://www.bing.com/webmaster/help/which-robots-metatags-does-bing-support-5198d240)\n \n `nosnippet`\n \n Prevents displaying any description of the page in search engine results.\n \n [Google](https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag#valid-indexing--serving-directives), [Bing](https://www.bing.com/webmaster/help/which-robots-metatags-does-bing-support-5198d240)\n \n `noimageindex`\n \n Requests this page not to appear as the referring page of an indexed image.\n \n [Google](https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag#valid-indexing--serving-directives)\n \n `nocache`\n \n Synonym of `noarchive`.\n \n [Bing](https://www.bing.com/webmaster/help/which-robots-metatags-does-bing-support-5198d240)\n \n **Notes:**\n \n * Only cooperative robots follow these rules. Do not expect to prevent e-mail harvesters with them.\n * The robot still needs to access the page in order to read these rules. To prevent bandwidth consumption, use a _[robots.txt](https://developer.mozilla.org/en-US/docs/Glossary/robots.txt \"robots.txt: Robots.txt is a file which is usually placed in the root of any website. It decides whether crawlers are permitted or forbidden access to the web site.\")_ file.\n * If you want to remove a page, `noindex` will work, but only after the robot visits the page again. Ensure that the `robots.txt` file is not preventing revisits.\n * Some values are mutually exclusive, like `index` and `noindex`, or `follow` and `nofollow`. In these cases the robot's behaviour is undefined and may vary between them.\n * Some crawler robots, like Google, Yahoo and Bing, support the same values for the HTTP header `X-Robots-Tag`; this allows non-HTML documents like images to use these rules.\n \n* `slurp`, is a synonym of `robots`, but only for Slurp - the crawler for Yahoo Search.\n* `viewport`, which gives hints about the size of the initial size of the [viewport](https://developer.mozilla.org/en-US/docs/Glossary/viewport \"viewport: A viewport represents a polygonal (normally rectangular) area in computer graphics that is currently being viewed. In web browser terms, it refers to the part of the document you're viewing which is currently visible in its window (or the screen, if the document is being viewed in full screen mode). Content outside the viewport is not visible onscreen until scrolled into view.\"). Used by mobile devices only.\n \n Values for the content of `<meta name=\"viewport\">`\n \n Value\n \n Possible subvalues\n \n Description\n \n `width`\n \n A positive integer number, or the text `device-width`\n \n Defines the pixel width of the viewport that you want the web site to be rendered at.\n \n `height`\n \n A positive integer, or the text `device-height`\n \n Defines the height of the viewport. Not used by any browser.\n \n `initial-scale`\n \n A positive number between `0.0` and `10.0`\n \n Defines the ratio between the device width (`device-width` in portrait mode or `device-height` in landscape mode) and the viewport size.\n \n `maximum-scale`\n \n A positive number between `0.0` and `10.0`\n \n Defines the maximum amount to zoom in. It must be greater or equal to the `minimum-scale` or the behaviour is undefined. Browser settings can ignore this rule and iOS10+ ignores it by default.\n \n `minimum-scale`\n \n A positive number between `0.0` and `10.0`\n \n Defines the minimum zoom level. It must be smaller or equal to the `maximum-scale` or the behaviour is undefined. Browser settings can ignore this rule and iOS10+ ignores it by default.\n \n `user-scalable`\n \n `yes` or `no`\n \n If set to `no`, the user is not able to zoom in the webpage. The default is `yes`. Browser settings can ignore this rule, and iOS10+ ignores it by default.\n \n Specification\n \n Status\n \n Comment\n \n [CSS Device Adaptation \n The definition of '<meta name=\"viewport\">' in that specification.](https://drafts.csswg.org/css-device-adapt/#viewport-meta)\n \n Working Draft\n \n Non-normatively describes the Viewport META element\n \n See also: [`@viewport`](https://developer.mozilla.org/en-US/docs/Web/CSS/@viewport \"The @viewport CSS at-rule lets you configure the viewport through which the document is viewed. It's primarily used for mobile devices, but is also used by desktop browsers that support features like \"snap to edge\" (such as Microsoft Edge).\")\n \n **Notes:**\n \n * Though unstandardized, this declaration is respected by most mobile browsers due to de-facto dominance.\n * The default values may vary between devices and browsers.\n * To learn about this declaration in Firefox for Mobile, see [this article](https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag \"Mobile/Viewport meta tag\")." } }, { "name": "http-equiv", "description": { "kind": "markdown", "value": "Defines a pragma directive. The attribute is named `**http-equiv**(alent)` because all the allowed values are names of particular HTTP headers:\n\n* `\"content-language\"` \n Defines the default language of the page. It can be overridden by the [lang](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang) attribute on any element.\n \n **Warning:** Do not use this value, as it is obsolete. Prefer the `lang` attribute on the [`<html>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html \"The HTML <html> element represents the root (top-level element) of an HTML document, so it is also referred to as the root element. All other elements must be descendants of this element.\") element.\n \n* `\"content-security-policy\"` \n Allows page authors to define a [content policy](https://developer.mozilla.org/en-US/docs/Web/Security/CSP/CSP_policy_directives) for the current page. Content policies mostly specify allowed server origins and script endpoints which help guard against cross-site scripting attacks.\n* `\"content-type\"` \n Defines the [MIME type](https://developer.mozilla.org/en-US/docs/Glossary/MIME_type) of the document, followed by its character encoding. It follows the same syntax as the HTTP `content-type` entity-header field, but as it is inside a HTML page, most values other than `text/html` are impossible. Therefore the valid syntax for its `content` is the string '`text/html`' followed by a character set with the following syntax: '`; charset=_IANAcharset_`', where `IANAcharset` is the _preferred MIME name_ for a character set as [defined by the IANA.](https://www.iana.org/assignments/character-sets)\n \n **Warning:** Do not use this value, as it is obsolete. Use the [`charset`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-charset) attribute on the [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") element.\n \n **Note:** As [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") can't change documents' types in XHTML or HTML5's XHTML serialization, never set the MIME type to an XHTML MIME type with `<meta>`.\n \n* `\"refresh\"` \n This instruction specifies:\n * The number of seconds until the page should be reloaded - only if the [`content`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content) attribute contains a positive integer.\n * The number of seconds until the page should redirect to another - only if the [`content`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content) attribute contains a positive integer followed by the string '`;url=`', and a valid URL.\n* `\"set-cookie\"` \n Defines a [cookie](https://developer.mozilla.org/en-US/docs/cookie) for the page. Its content must follow the syntax defined in the [IETF HTTP Cookie Specification](https://tools.ietf.org/html/draft-ietf-httpstate-cookie-14).\n \n **Warning:** Do not use this instruction, as it is obsolete. Use the HTTP header [`Set-Cookie`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) instead." } }, { "name": "content", "description": { "kind": "markdown", "value": "This attribute contains the value for the [`http-equiv`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-http-equiv) or [`name`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-name) attribute, depending on which is used." } }, { "name": "charset", "description": { "kind": "markdown", "value": "This attribute declares the page's character encoding. It must contain a [standard IANA MIME name for character encodings](https://www.iana.org/assignments/character-sets). Although the standard doesn't request a specific encoding, it suggests:\n\n* Authors are encouraged to use [`UTF-8`](https://developer.mozilla.org/en-US/docs/Glossary/UTF-8).\n* Authors should not use ASCII-incompatible encodings to avoid security risk: browsers not supporting them may interpret harmful content as HTML. This happens with the `JIS_C6226-1983`, `JIS_X0212-1990`, `HZ-GB-2312`, `JOHAB`, the ISO-2022 family and the EBCDIC family.\n\n**Note:** ASCII-incompatible encodings are those that don't map the 8-bit code points `0x20` to `0x7E` to the `0x0020` to `0x007E` Unicode code points)\n\n* Authors **must not** use `CESU-8`, `UTF-7`, `BOCU-1` and/or `SCSU` as [cross-site scripting](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting) attacks with these encodings have been demonstrated.\n* Authors should not use `UTF-32` because not all HTML5 encoding algorithms can distinguish it from `UTF-16`.\n\n**Notes:**\n\n* The declared character encoding must match the one the page was saved with to avoid garbled characters and security holes.\n* The [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") element declaring the encoding must be inside the [`<head>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head \"The HTML <head> element provides general information (metadata) about the document, including its title and links to its scripts and style sheets.\") element and **within the first 1024 bytes** of the HTML as some browsers only look at those bytes before choosing an encoding.\n* This [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") element is only one part of the [algorithm to determine a page's character set](https://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#encoding-sniffing-algorithm \"Algorithm charset page\"). The [`Content-Type` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) and any [Byte-Order Marks](https://developer.mozilla.org/en-US/docs/Glossary/Byte-Order_Mark \"The definition of that term (Byte-Order Marks) has not been written yet; please consider contributing it!\") override this element.\n* It is strongly recommended to define the character encoding. If a page's encoding is undefined, cross-scripting techniques are possible, such as the [`UTF-7` fallback cross-scripting technique](https://code.google.com/p/doctype-mirror/wiki/ArticleUtf7).\n* The [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") element with a `charset` attribute is a synonym for the pre-HTML5 `<meta http-equiv=\"Content-Type\" content=\"text/html; charset=_IANAcharset_\">`, where _`IANAcharset`_ contains the value of the equivalent [`charset`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-charset) attribute. This syntax is still allowed, although no longer recommended." } }, { "name": "scheme", "description": "This attribute defines the scheme in which metadata is described. A scheme is a context leading to the correct interpretations of the [`content`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content) value, like a format.\n\n**Warning:** Do not use this value, as it is obsolete. There is no replacement as there was no real usage for it." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/meta" } ] }, { "name": "style", "description": { "kind": "markdown", "value": "The style element allows authors to embed style information in their documents. The style element is one of several inputs to the styling processing model. The element does not represent content for the user." }, "attributes": [ { "name": "media", "description": { "kind": "markdown", "value": "This attribute defines which media the style should be applied to. Its value is a [media query](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries), which defaults to `all` if the attribute is missing." } }, { "name": "nonce", "description": { "kind": "markdown", "value": "A cryptographic nonce (number used once) used to whitelist inline styles in a [style-src Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide a nonce that cannot be guessed as bypassing a resource’s policy is otherwise trivial." } }, { "name": "type", "description": { "kind": "markdown", "value": "This attribute defines the styling language as a MIME type (charset should not be specified). This attribute is optional and defaults to `text/css` if it is not specified — there is very little reason to include this in modern web documents." } }, { "name": "scoped", "valueSet": "v" }, { "name": "title", "description": "This attribute specifies [alternative style sheet](https://developer.mozilla.org/en-US/docs/Web/CSS/Alternative_style_sheets) sets." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/style" } ] }, { "name": "body", "description": { "kind": "markdown", "value": "The body element represents the content of the document." }, "attributes": [ { "name": "onafterprint", "description": { "kind": "markdown", "value": "Function to call after the user has printed the document." } }, { "name": "onbeforeprint", "description": { "kind": "markdown", "value": "Function to call when the user requests printing of the document." } }, { "name": "onbeforeunload", "description": { "kind": "markdown", "value": "Function to call when the document is about to be unloaded." } }, { "name": "onhashchange", "description": { "kind": "markdown", "value": "Function to call when the fragment identifier part (starting with the hash (`'#'`) character) of the document's current address has changed." } }, { "name": "onlanguagechange", "description": { "kind": "markdown", "value": "Function to call when the preferred languages changed." } }, { "name": "onmessage", "description": { "kind": "markdown", "value": "Function to call when the document has received a message." } }, { "name": "onoffline", "description": { "kind": "markdown", "value": "Function to call when network communication has failed." } }, { "name": "ononline", "description": { "kind": "markdown", "value": "Function to call when network communication has been restored." } }, { "name": "onpagehide" }, { "name": "onpageshow" }, { "name": "onpopstate", "description": { "kind": "markdown", "value": "Function to call when the user has navigated session history." } }, { "name": "onstorage", "description": { "kind": "markdown", "value": "Function to call when the storage area has changed." } }, { "name": "onunload", "description": { "kind": "markdown", "value": "Function to call when the document is going away." } }, { "name": "alink", "description": "Color of text for hyperlinks when selected. _This method is non-conforming, use CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color \"The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value.\") property in conjunction with the [`:active`](https://developer.mozilla.org/en-US/docs/Web/CSS/:active \"The :active CSS pseudo-class represents an element (such as a button) that is being activated by the user.\") pseudo-class instead._" }, { "name": "background", "description": "URI of a image to use as a background. _This method is non-conforming, use CSS [`background`](https://developer.mozilla.org/en-US/docs/Web/CSS/background \"The background shorthand CSS property sets all background style properties at once, such as color, image, origin and size, or repeat method.\") property on the element instead._" }, { "name": "bgcolor", "description": "Background color for the document. _This method is non-conforming, use CSS [`background-color`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-color \"The background-color CSS property sets the background color of an element.\") property on the element instead._" }, { "name": "bottommargin", "description": "The margin of the bottom of the body. _This method is non-conforming, use CSS [`margin-bottom`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom \"The margin-bottom CSS property sets the margin area on the bottom of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") property on the element instead._" }, { "name": "leftmargin", "description": "The margin of the left of the body. _This method is non-conforming, use CSS [`margin-left`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left \"The margin-left CSS property sets the margin area on the left side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") property on the element instead._" }, { "name": "link", "description": "Color of text for unvisited hypertext links. _This method is non-conforming, use CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color \"The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value.\") property in conjunction with the [`:link`](https://developer.mozilla.org/en-US/docs/Web/CSS/:link \"The :link CSS pseudo-class represents an element that has not yet been visited. It matches every unvisited <a>, <area>, or <link> element that has an href attribute.\") pseudo-class instead._" }, { "name": "onblur", "description": "Function to call when the document loses focus." }, { "name": "onerror", "description": "Function to call when the document fails to load properly." }, { "name": "onfocus", "description": "Function to call when the document receives focus." }, { "name": "onload", "description": "Function to call when the document has finished loading." }, { "name": "onredo", "description": "Function to call when the user has moved forward in undo transaction history." }, { "name": "onresize", "description": "Function to call when the document has been resized." }, { "name": "onundo", "description": "Function to call when the user has moved backward in undo transaction history." }, { "name": "rightmargin", "description": "The margin of the right of the body. _This method is non-conforming, use CSS [`margin-right`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right \"The margin-right CSS property sets the margin area on the right side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") property on the element instead._" }, { "name": "text", "description": "Foreground color of text. _This method is non-conforming, use CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color \"The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value.\") property on the element instead._" }, { "name": "topmargin", "description": "The margin of the top of the body. _This method is non-conforming, use CSS [`margin-top`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top \"The margin-top CSS property sets the margin area on the top of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") property on the element instead._" }, { "name": "vlink", "description": "Color of text for visited hypertext links. _This method is non-conforming, use CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color \"The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value.\") property in conjunction with the [`:visited`](https://developer.mozilla.org/en-US/docs/Web/CSS/:visited \"The :visited CSS pseudo-class represents links that the user has already visited. For privacy reasons, the styles that can be modified using this selector are very limited.\") pseudo-class instead._" } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/body" } ] }, { "name": "article", "description": { "kind": "markdown", "value": "The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content. Each article should be identified, typically by including a heading (h1–h6 element) as a child of the article element." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/article" } ] }, { "name": "section", "description": { "kind": "markdown", "value": "The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content. Each section should be identified, typically by including a heading ( h1- h6 element) as a child of the section element." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/section" } ] }, { "name": "nav", "description": { "kind": "markdown", "value": "The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/nav" } ] }, { "name": "aside", "description": { "kind": "markdown", "value": "The aside element represents a section of a page that consists of content that is tangentially related to the content around the aside element, and which could be considered separate from that content. Such sections are often represented as sidebars in printed typography." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/aside" } ] }, { "name": "h1", "description": { "kind": "markdown", "value": "The h1 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "h2", "description": { "kind": "markdown", "value": "The h2 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "h3", "description": { "kind": "markdown", "value": "The h3 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "h4", "description": { "kind": "markdown", "value": "The h4 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "h5", "description": { "kind": "markdown", "value": "The h5 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "h6", "description": { "kind": "markdown", "value": "The h6 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "header", "description": { "kind": "markdown", "value": "The header element represents introductory content for its nearest ancestor sectioning content or sectioning root element. A header typically contains a group of introductory or navigational aids. When the nearest ancestor sectioning content or sectioning root element is the body element, then it applies to the whole page." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/header" } ] }, { "name": "footer", "description": { "kind": "markdown", "value": "The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/footer" } ] }, { "name": "address", "description": { "kind": "markdown", "value": "The address element represents the contact information for its nearest article or body element ancestor. If that is the body element, then the contact information applies to the document as a whole." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/address" } ] }, { "name": "p", "description": { "kind": "markdown", "value": "The p element represents a paragraph." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/p" } ] }, { "name": "hr", "description": { "kind": "markdown", "value": "The hr element represents a paragraph-level thematic break, e.g. a scene change in a story, or a transition to another topic within a section of a reference book." }, "attributes": [ { "name": "align", "description": "Sets the alignment of the rule on the page. If no value is specified, the default value is `left`." }, { "name": "color", "description": "Sets the color of the rule through color name or hexadecimal value." }, { "name": "noshade", "description": "Sets the rule to have no shading." }, { "name": "size", "description": "Sets the height, in pixels, of the rule." }, { "name": "width", "description": "Sets the length of the rule on the page through a pixel or percentage value." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/hr" } ] }, { "name": "pre", "description": { "kind": "markdown", "value": "The pre element represents a block of preformatted text, in which structure is represented by typographic conventions rather than by elements." }, "attributes": [ { "name": "cols", "description": "Contains the _preferred_ count of characters that a line should have. It was a non-standard synonym of [`width`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre#attr-width). To achieve such an effect, use CSS [`width`](https://developer.mozilla.org/en-US/docs/Web/CSS/width \"The width CSS property sets an element's width. By default it sets the width of the content area, but if box-sizing is set to border-box, it sets the width of the border area.\") instead." }, { "name": "width", "description": "Contains the _preferred_ count of characters that a line should have. Though technically still implemented, this attribute has no visual effect; to achieve such an effect, use CSS [`width`](https://developer.mozilla.org/en-US/docs/Web/CSS/width \"The width CSS property sets an element's width. By default it sets the width of the content area, but if box-sizing is set to border-box, it sets the width of the border area.\") instead." }, { "name": "wrap", "description": "Is a _hint_ indicating how the overflow must happen. In modern browser this hint is ignored and no visual effect results in its present; to achieve such an effect, use CSS [`white-space`](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space \"The white-space CSS property sets how white space inside an element is handled.\") instead." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/pre" } ] }, { "name": "blockquote", "description": { "kind": "markdown", "value": "The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a footer or cite element, and optionally with in-line changes such as annotations and abbreviations." }, "attributes": [ { "name": "cite", "description": { "kind": "markdown", "value": "A URL that designates a source document or message for the information quoted. This attribute is intended to point to information explaining the context or the reference for the quote." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/blockquote" } ] }, { "name": "ol", "description": { "kind": "markdown", "value": "The ol element represents a list of items, where the items have been intentionally ordered, such that changing the order would change the meaning of the document." }, "attributes": [ { "name": "reversed", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute specifies that the items of the list are specified in reversed order." } }, { "name": "start", "description": { "kind": "markdown", "value": "This integer attribute specifies the start value for numbering the individual list items. Although the ordering type of list elements might be Roman numerals, such as XXXI, or letters, the value of start is always represented as a number. To start numbering elements from the letter \"C\", use `<ol start=\"3\">`.\n\n**Note**: This attribute was deprecated in HTML4, but reintroduced in HTML5." } }, { "name": "type", "valueSet": "lt", "description": { "kind": "markdown", "value": "Indicates the numbering type:\n\n* `'a'` indicates lowercase letters,\n* `'A'` indicates uppercase letters,\n* `'i'` indicates lowercase Roman numerals,\n* `'I'` indicates uppercase Roman numerals,\n* and `'1'` indicates numbers (default).\n\nThe type set is used for the entire list unless a different [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li#attr-type) attribute is used within an enclosed [`<li>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li \"The HTML <li> element is used to represent an item in a list. It must be contained in a parent element: an ordered list (<ol>), an unordered list (<ul>), or a menu (<menu>). In menus and unordered lists, list items are usually displayed using bullet points. In ordered lists, they are usually displayed with an ascending counter on the left, such as a number or letter.\") element.\n\n**Note:** This attribute was deprecated in HTML4, but reintroduced in HTML5.\n\nUnless the value of the list number matters (e.g. in legal or technical documents where items are to be referenced by their number/letter), the CSS [`list-style-type`](https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type \"The list-style-type CSS property sets the marker (such as a disc, character, or custom counter style) of a list item element.\") property should be used instead." } }, { "name": "compact", "description": "This Boolean attribute hints that the list should be rendered in a compact style. The interpretation of this attribute depends on the user agent and it doesn't work in all browsers.\n\n**Warning:** Do not use this attribute, as it has been deprecated: the [`<ol>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol \"The HTML <ol> element represents an ordered list of items, typically rendered as a numbered list.\") element should be styled using [CSS](https://developer.mozilla.org/en-US/docs/CSS). To give an effect similar to the `compact` attribute, the [CSS](https://developer.mozilla.org/en-US/docs/CSS) property [`line-height`](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height \"The line-height CSS property sets the amount of space used for lines, such as in text. On block-level elements, it specifies the minimum height of line boxes within the element. On non-replaced inline elements, it specifies the height that is used to calculate line box height.\") can be used with a value of `80%`." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/ol" } ] }, { "name": "ul", "description": { "kind": "markdown", "value": "The ul element represents a list of items, where the order of the items is not important — that is, where changing the order would not materially change the meaning of the document." }, "attributes": [ { "name": "compact", "description": "This Boolean attribute hints that the list should be rendered in a compact style. The interpretation of this attribute depends on the user agent and it doesn't work in all browsers.\n\n**Usage note: **Do not use this attribute, as it has been deprecated: the [`<ul>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul \"The HTML <ul> element represents an unordered list of items, typically rendered as a bulleted list.\") element should be styled using [CSS](https://developer.mozilla.org/en-US/docs/CSS). To give a similar effect as the `compact` attribute, the [CSS](https://developer.mozilla.org/en-US/docs/CSS) property [line-height](https://developer.mozilla.org/en-US/docs/CSS/line-height) can be used with a value of `80%`." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/ul" } ] }, { "name": "li", "description": { "kind": "markdown", "value": "The li element represents a list item. If its parent element is an ol, ul, or menu element, then the element is an item of the parent element's list, as defined for those elements. Otherwise, the list item has no defined list-related relationship to any other li element." }, "attributes": [ { "name": "value", "description": { "kind": "markdown", "value": "This integer attribute indicates the current ordinal value of the list item as defined by the [`<ol>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol \"The HTML <ol> element represents an ordered list of items, typically rendered as a numbered list.\") element. The only allowed value for this attribute is a number, even if the list is displayed with Roman numerals or letters. List items that follow this one continue numbering from the value set. The **value** attribute has no meaning for unordered lists ([`<ul>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul \"The HTML <ul> element represents an unordered list of items, typically rendered as a bulleted list.\")) or for menus ([`<menu>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menu \"The HTML <menu> element represents a group of commands that a user can perform or activate. This includes both list menus, which might appear across the top of a screen, as well as context menus, such as those that might appear underneath a button after it has been clicked.\")).\n\n**Note**: This attribute was deprecated in HTML4, but reintroduced in HTML5.\n\n**Note:** Prior to Gecko 9.0, negative values were incorrectly converted to 0. Starting in Gecko 9.0 all integer values are correctly parsed." } }, { "name": "type", "description": "This character attribute indicates the numbering type:\n\n* `a`: lowercase letters\n* `A`: uppercase letters\n* `i`: lowercase Roman numerals\n* `I`: uppercase Roman numerals\n* `1`: numbers\n\nThis type overrides the one used by its parent [`<ol>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol \"The HTML <ol> element represents an ordered list of items, typically rendered as a numbered list.\") element, if any.\n\n**Usage note:** This attribute has been deprecated: use the CSS [`list-style-type`](https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type \"The list-style-type CSS property sets the marker (such as a disc, character, or custom counter style) of a list item element.\") property instead." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/li" } ] }, { "name": "dl", "description": { "kind": "markdown", "value": "The dl element represents an association list consisting of zero or more name-value groups (a description list). A name-value group consists of one or more names (dt elements) followed by one or more values (dd elements), ignoring any nodes other than dt and dd elements. Within a single dl element, there should not be more than one dt element for each name." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/dl" } ] }, { "name": "dt", "description": { "kind": "markdown", "value": "The dt element represents the term, or name, part of a term-description group in a description list (dl element)." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/dt" } ] }, { "name": "dd", "description": { "kind": "markdown", "value": "The dd element represents the description, definition, or value, part of a term-description group in a description list (dl element)." }, "attributes": [ { "name": "nowrap", "description": "If the value of this attribute is set to `yes`, the definition text will not wrap. The default value is `no`." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/dd" } ] }, { "name": "figure", "description": { "kind": "markdown", "value": "The figure element represents some flow content, optionally with a caption, that is self-contained (like a complete sentence) and is typically referenced as a single unit from the main flow of the document." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/figure" } ] }, { "name": "figcaption", "description": { "kind": "markdown", "value": "The figcaption element represents a caption or legend for the rest of the contents of the figcaption element's parent figure element, if any." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/figcaption" } ] }, { "name": "main", "description": { "kind": "markdown", "value": "The main element represents the main content of the body of a document or application. The main content area consists of content that is directly related to or expands upon the central topic of a document or central functionality of an application." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/main" } ] }, { "name": "div", "description": { "kind": "markdown", "value": "The div element has no special meaning at all. It represents its children. It can be used with the class, lang, and title attributes to mark up semantics common to a group of consecutive elements." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/div" } ] }, { "name": "a", "description": { "kind": "markdown", "value": "If the a element has an href attribute, then it represents a hyperlink (a hypertext anchor) labeled by its contents." }, "attributes": [ { "name": "href", "description": { "kind": "markdown", "value": "Contains a URL or a URL fragment that the hyperlink points to." } }, { "name": "target", "description": { "kind": "markdown", "value": "Specifies where to display the linked URL. It is a name of, or keyword for, a _browsing context_: a tab, window, or `<iframe>`. The following keywords have special meanings:\n\n* `_self`: Load the URL into the same browsing context as the current one. This is the default behavior.\n* `_blank`: Load the URL into a new browsing context. This is usually a tab, but users can configure browsers to use new windows instead.\n* `_parent`: Load the URL into the parent browsing context of the current one. If there is no parent, this behaves the same way as `_self`.\n* `_top`: Load the URL into the top-level browsing context (that is, the \"highest\" browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this behaves the same way as `_self`.\n\n**Note:** When using `target`, consider adding `rel=\"noreferrer\"` to avoid exploitation of the `window.opener` API.\n\n**Note:** Linking to another page using `target=\"_blank\"` will run the new page on the same process as your page. If the new page is executing expensive JS, your page's performance may suffer. To avoid this use `rel=\"noopener\"`." } }, { "name": "download", "description": { "kind": "markdown", "value": "This attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want). There are no restrictions on allowed values, though `/` and `\\` are converted to underscores. Most file systems limit some punctuation in file names, and browsers will adjust the suggested name accordingly.\n\n**Notes:**\n\n* This attribute only works for [same-origin URLs](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy).\n* Although HTTP(s) URLs need to be in the same-origin, [`blob:` URLs](https://developer.mozilla.org/en-US/docs/Web/API/URL.createObjectURL) and [`data:` URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) are allowed so that content generated by JavaScript, such as pictures created in an image-editor Web app, can be downloaded.\n* If the HTTP header [`Content-Disposition:`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) gives a different filename than this attribute, the HTTP header takes priority over this attribute.\n* If `Content-Disposition:` is set to `inline`, Firefox prioritizes `Content-Disposition`, like the filename case, while Chrome prioritizes the `download` attribute." } }, { "name": "ping", "description": { "kind": "markdown", "value": "Contains a space-separated list of URLs to which, when the hyperlink is followed, [`POST`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST \"The HTTP POST method sends data to the server. The type of the body of the request is indicated by the Content-Type header.\") requests with the body `PING` will be sent by the browser (in the background). Typically used for tracking." } }, { "name": "rel", "description": { "kind": "markdown", "value": "Specifies the relationship of the target object to the link object. The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types)." } }, { "name": "hreflang", "description": { "kind": "markdown", "value": "This attribute indicates the human language of the linked resource. It is purely advisory, with no built-in functionality. Allowed values are determined by [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt \"Tags for Identifying Languages\")." } }, { "name": "type", "description": { "kind": "markdown", "value": "Specifies the media type in the form of a [MIME type](https://developer.mozilla.org/en-US/docs/Glossary/MIME_type \"MIME type: A MIME type (now properly called \"media type\", but also sometimes \"content type\") is a string sent along with a file indicating the type of the file (describing the content format, for example, a sound file might be labeled audio/ogg, or an image file image/png).\") for the linked URL. It is purely advisory, with no built-in functionality." } }, { "name": "referrerpolicy", "description": "Indicates which [referrer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer) to send when fetching the URL:\n\n* `'no-referrer'` means the `Referer:` header will not be sent.\n* `'no-referrer-when-downgrade'` means no `Referer:` header will be sent when navigating to an origin without HTTPS. This is the default behavior.\n* `'origin'` means the referrer will be the [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) of the page, not including information after the domain.\n* `'origin-when-cross-origin'` meaning that navigations to other origins will be limited to the scheme, the host and the port, while navigations on the same origin will include the referrer's path.\n* `'strict-origin-when-cross-origin'`\n* `'unsafe-url'` means the referrer will include the origin and path, but not the fragment, password, or username. This is unsafe because it can leak data from secure URLs to insecure ones." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/a" } ] }, { "name": "em", "description": { "kind": "markdown", "value": "The em element represents stress emphasis of its contents." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/em" } ] }, { "name": "strong", "description": { "kind": "markdown", "value": "The strong element represents strong importance, seriousness, or urgency for its contents." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/strong" } ] }, { "name": "small", "description": { "kind": "markdown", "value": "The small element represents side comments such as small print." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/small" } ] }, { "name": "s", "description": { "kind": "markdown", "value": "The s element represents contents that are no longer accurate or no longer relevant." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/s" } ] }, { "name": "cite", "description": { "kind": "markdown", "value": "The cite element represents a reference to a creative work. It must include the title of the work or the name of the author(person, people or organization) or an URL reference, or a reference in abbreviated form as per the conventions used for the addition of citation metadata." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/cite" } ] }, { "name": "q", "description": { "kind": "markdown", "value": "The q element represents some phrasing content quoted from another source." }, "attributes": [ { "name": "cite", "description": { "kind": "markdown", "value": "The value of this attribute is a URL that designates a source document or message for the information quoted. This attribute is intended to point to information explaining the context or the reference for the quote." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/q" } ] }, { "name": "dfn", "description": { "kind": "markdown", "value": "The dfn element represents the defining instance of a term. The paragraph, description list group, or section that is the nearest ancestor of the dfn element must also contain the definition(s) for the term given by the dfn element." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/dfn" } ] }, { "name": "abbr", "description": { "kind": "markdown", "value": "The abbr element represents an abbreviation or acronym, optionally with its expansion. The title attribute may be used to provide an expansion of the abbreviation. The attribute, if specified, must contain an expansion of the abbreviation, and nothing else." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/abbr" } ] }, { "name": "ruby", "description": { "kind": "markdown", "value": "The ruby element allows one or more spans of phrasing content to be marked with ruby annotations. Ruby annotations are short runs of text presented alongside base text, primarily used in East Asian typography as a guide for pronunciation or to include other annotations. In Japanese, this form of typography is also known as furigana. Ruby text can appear on either side, and sometimes both sides, of the base text, and it is possible to control its position using CSS. A more complete introduction to ruby can be found in the Use Cases & Exploratory Approaches for Ruby Markup document as well as in CSS Ruby Module Level 1. [RUBY-UC] [CSSRUBY]" }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/ruby" } ] }, { "name": "rb", "description": { "kind": "markdown", "value": "The rb element marks the base text component of a ruby annotation. When it is the child of a ruby element, it doesn't represent anything itself, but its parent ruby element uses it as part of determining what it represents." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/rb" } ] }, { "name": "rt", "description": { "kind": "markdown", "value": "The rt element marks the ruby text component of a ruby annotation. When it is the child of a ruby element or of an rtc element that is itself the child of a ruby element, it doesn't represent anything itself, but its ancestor ruby element uses it as part of determining what it represents." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/rt" } ] }, { "name": "rp", "description": { "kind": "markdown", "value": "The rp element is used to provide fallback text to be shown by user agents that don't support ruby annotations. One widespread convention is to provide parentheses around the ruby text component of a ruby annotation." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/rp" } ] }, { "name": "time", "description": { "kind": "markdown", "value": "The time element represents its contents, along with a machine-readable form of those contents in the datetime attribute. The kind of content is limited to various kinds of dates, times, time-zone offsets, and durations, as described below." }, "attributes": [ { "name": "datetime", "description": { "kind": "markdown", "value": "This attribute indicates the time and/or date of the element and must be in one of the formats described below." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/time" } ] }, { "name": "code", "description": { "kind": "markdown", "value": "The code element represents a fragment of computer code. This could be an XML element name, a file name, a computer program, or any other string that a computer would recognize." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/code" } ] }, { "name": "var", "description": { "kind": "markdown", "value": "The var element represents a variable. This could be an actual variable in a mathematical expression or programming context, an identifier representing a constant, a symbol identifying a physical quantity, a function parameter, or just be a term used as a placeholder in prose." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/var" } ] }, { "name": "samp", "description": { "kind": "markdown", "value": "The samp element represents sample or quoted output from another program or computing system." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/samp" } ] }, { "name": "kbd", "description": { "kind": "markdown", "value": "The kbd element represents user input (typically keyboard input, although it may also be used to represent other input, such as voice commands)." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/kbd" } ] }, { "name": "sub", "description": { "kind": "markdown", "value": "The sub element represents a subscript." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/sub" } ] }, { "name": "sup", "description": { "kind": "markdown", "value": "The sup element represents a superscript." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/sup" } ] }, { "name": "i", "description": { "kind": "markdown", "value": "The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/i" } ] }, { "name": "b", "description": { "kind": "markdown", "value": "The b element represents a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/b" } ] }, { "name": "u", "description": { "kind": "markdown", "value": "The u element represents a span of text with an unarticulated, though explicitly rendered, non-textual annotation, such as labeling the text as being a proper name in Chinese text (a Chinese proper name mark), or labeling the text as being misspelt." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/u" } ] }, { "name": "mark", "description": { "kind": "markdown", "value": "The mark element represents a run of text in one document marked or highlighted for reference purposes, due to its relevance in another context. When used in a quotation or other block of text referred to from the prose, it indicates a highlight that was not originally present but which has been added to bring the reader's attention to a part of the text that might not have been considered important by the original author when the block was originally written, but which is now under previously unexpected scrutiny. When used in the main prose of a document, it indicates a part of the document that has been highlighted due to its likely relevance to the user's current activity." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/mark" } ] }, { "name": "bdi", "description": { "kind": "markdown", "value": "The bdi element represents a span of text that is to be isolated from its surroundings for the purposes of bidirectional text formatting. [BIDI]" }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/bdi" } ] }, { "name": "bdo", "description": { "kind": "markdown", "value": "The bdo element represents explicit text directionality formatting control for its children. It allows authors to override the Unicode bidirectional algorithm by explicitly specifying a direction override. [BIDI]" }, "attributes": [ { "name": "dir", "description": "The direction in which text should be rendered in this element's contents. Possible values are:\n\n* `ltr`: Indicates that the text should go in a left-to-right direction.\n* `rtl`: Indicates that the text should go in a right-to-left direction." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/bdo" } ] }, { "name": "span", "description": { "kind": "markdown", "value": "The span element doesn't mean anything on its own, but can be useful when used together with the global attributes, e.g. class, lang, or dir. It represents its children." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/span" } ] }, { "name": "br", "description": { "kind": "markdown", "value": "The br element represents a line break." }, "attributes": [ { "name": "clear", "description": "Indicates where to begin the next line after the break." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/br" } ] }, { "name": "wbr", "description": { "kind": "markdown", "value": "The wbr element represents a line break opportunity." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/wbr" } ] }, { "name": "ins", "description": { "kind": "markdown", "value": "The ins element represents an addition to the document." }, "attributes": [ { "name": "cite", "description": "This attribute defines the URI of a resource that explains the change, such as a link to meeting minutes or a ticket in a troubleshooting system." }, { "name": "datetime", "description": "This attribute indicates the time and date of the change and must be a valid date with an optional time string. If the value cannot be parsed as a date with an optional time string, the element does not have an associated time stamp. For the format of the string without a time, see [Format of a valid date string](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#Format_of_a_valid_date_string \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\") in [Date and time formats used in HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\"). The format of the string if it includes both date and time is covered in [Format of a valid local date and time string](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#Format_of_a_valid_local_date_and_time_string \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\") in [Date and time formats used in HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\")." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/ins" } ] }, { "name": "del", "description": { "kind": "markdown", "value": "The del element represents a removal from the document." }, "attributes": [ { "name": "cite", "description": { "kind": "markdown", "value": "A URI for a resource that explains the change (for example, meeting minutes)." } }, { "name": "datetime", "description": { "kind": "markdown", "value": "This attribute indicates the time and date of the change and must be a valid date string with an optional time. If the value cannot be parsed as a date with an optional time string, the element does not have an associated time stamp. For the format of the string without a time, see [Format of a valid date string](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#Format_of_a_valid_date_string \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\") in [Date and time formats used in HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\"). The format of the string if it includes both date and time is covered in [Format of a valid local date and time string](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#Format_of_a_valid_local_date_and_time_string \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\") in [Date and time formats used in HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\")." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/del" } ] }, { "name": "picture", "description": { "kind": "markdown", "value": "The picture element is a container which provides multiple sources to its contained img element to allow authors to declaratively control or give hints to the user agent about which image resource to use, based on the screen pixel density, viewport size, image format, and other factors. It represents its children." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/picture" } ] }, { "name": "img", "description": { "kind": "markdown", "value": "An img element represents an image." }, "attributes": [ { "name": "alt", "description": { "kind": "markdown", "value": "This attribute defines an alternative text description of the image.\n\n**Note:** Browsers do not always display the image referenced by the element. This is the case for non-graphical browsers (including those used by people with visual impairments), if the user chooses not to display images, or if the browser cannot display the image because it is invalid or an [unsupported type](#Supported_image_formats). In these cases, the browser may replace the image with the text defined in this element's `alt` attribute. You should, for these reasons and others, provide a useful value for `alt` whenever possible.\n\n**Note:** Omitting this attribute altogether indicates that the image is a key part of the content, and no textual equivalent is available. Setting this attribute to an empty string (`alt=\"\"`) indicates that this image is _not_ a key part of the content (decorative), and that non-visual browsers may omit it from rendering." } }, { "name": "src", "description": { "kind": "markdown", "value": "The image URL. This attribute is mandatory for the `<img>` element. On browsers supporting `srcset`, `src` is treated like a candidate image with a pixel density descriptor `1x` unless an image with this pixel density descriptor is already defined in `srcset,` or unless `srcset` contains '`w`' descriptors." } }, { "name": "srcset", "description": { "kind": "markdown", "value": "A list of one or more strings separated by commas indicating a set of possible image sources for the user agent to use. Each string is composed of:\n\n1. a URL to an image,\n2. optionally, whitespace followed by one of:\n * A width descriptor, or a positive integer directly followed by '`w`'. The width descriptor is divided by the source size given in the `sizes` attribute to calculate the effective pixel density.\n * A pixel density descriptor, which is a positive floating point number directly followed by '`x`'.\n\nIf no descriptor is specified, the source is assigned the default descriptor: `1x`.\n\nIt is incorrect to mix width descriptors and pixel density descriptors in the same `srcset` attribute. Duplicate descriptors (for instance, two sources in the same `srcset` which are both described with '`2x`') are also invalid.\n\nThe user agent selects any one of the available sources at its discretion. This provides them with significant leeway to tailor their selection based on things like user preferences or bandwidth conditions. See our [Responsive images](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images) tutorial for an example." } }, { "name": "crossorigin", "valueSet": "xo", "description": { "kind": "markdown", "value": "This enumerated attribute indicates if the fetching of the related image must be done using CORS or not. [CORS-enabled images](https://developer.mozilla.org/en-US/docs/CORS_Enabled_Image) can be reused in the [`<canvas>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas \"Use the HTML <canvas> element with either the canvas scripting API or the WebGL API to draw graphics and animations.\") element without being \"[tainted](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image#What_is_a_tainted_canvas).\" The allowed values are:" } }, { "name": "usemap", "description": { "kind": "markdown", "value": "The partial URL (starting with '#') of an [image map](https://developer.mozilla.org/en-US/docs/HTML/Element/map) associated with the element.\n\n**Note:** You cannot use this attribute if the `<img>` element is a descendant of an [`<a>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a \"The HTML <a> element (or anchor element) creates a hyperlink to other web pages, files, locations within the same page, email addresses, or any other URL.\") or [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") element." } }, { "name": "ismap", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the image is part of a server-side map. If so, the precise coordinates of a click are sent to the server.\n\n**Note:** This attribute is allowed only if the `<img>` element is a descendant of an [`<a>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a \"The HTML <a> element (or anchor element) creates a hyperlink to other web pages, files, locations within the same page, email addresses, or any other URL.\") element with a valid [`href`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href) attribute." } }, { "name": "width", "description": { "kind": "markdown", "value": "The intrinsic width of the image in pixels." } }, { "name": "height", "description": { "kind": "markdown", "value": "The intrinsic height of the image in pixels." } }, { "name": "decoding", "description": "Provides an image decoding hint to the browser. The allowed values are:" }, { "name": "decoding", "description": "`sync`\n\nDecode the image synchronously for atomic presentation with other content.\n\n`async`\n\nDecode the image asynchronously to reduce delay in presenting other content.\n\n`auto`\n\nDefault mode, which indicates no preference for the decoding mode. The browser decides what is best for the user." }, { "name": "importance", "description": "Indicates the relative importance of the resource. Priority hints are delegated using the values:" }, { "name": "importance", "description": "`auto`: Indicates **no preference**. The browser may use its own heuristics to decide the priority of the image.\n\n`high`: Indicates to the browser that the image is of **high** priority.\n\n`low`: Indicates to the browser that the image is of **low** priority." }, { "name": "intrinsicsize", "description": "This attribute tells the browser to ignore the actual intrinsic size of the image and pretend it’s the size specified in the attribute. Specifically, the image would raster at these dimensions and `naturalWidth`/`naturalHeight` on images would return the values specified in this attribute. [Explainer](https://github.com/ojanvafai/intrinsicsize-attribute), [examples](https://googlechrome.github.io/samples/intrinsic-size/index.html)" }, { "name": "referrerpolicy", "description": "A string indicating which referrer to use when fetching the resource:\n\n* `no-referrer:` The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent.\n* `no-referrer-when-downgrade:` No `Referer` header will be sent when navigating to an origin without TLS (HTTPS). This is a user agent’s default behavior if no policy is otherwise specified.\n* `origin:` The `Referer` header will include the page of origin's scheme, the host, and the port.\n* `origin-when-cross-origin:` Navigating to other origins will limit the included referral data to the scheme, the host and the port, while navigating from the same origin will include the referrer's full path.\n* `unsafe-url:` The `Referer` header will include the origin and the path, but not the fragment, password, or username. This case is unsafe because it can leak origins and paths from TLS-protected resources to insecure origins." }, { "name": "sizes", "description": "A list of one or more strings separated by commas indicating a set of source sizes. Each source size consists of:\n\n1. a media condition. This must be omitted for the last item.\n2. a source size value.\n\nSource size values specify the intended display size of the image. User agents use the current source size to select one of the sources supplied by the `srcset` attribute, when those sources are described using width ('`w`') descriptors. The selected source size affects the intrinsic size of the image (the image’s display size if no CSS styling is applied). If the `srcset` attribute is absent, or contains no values with a width (`w`) descriptor, then the `sizes` attribute has no effect." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/img" } ] }, { "name": "iframe", "description": { "kind": "markdown", "value": "The iframe element represents a nested browsing context." }, "attributes": [ { "name": "src", "description": { "kind": "markdown", "value": "The URL of the page to embed. Use a value of `about:blank` to embed an empty page that conforms to the [same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#Inherited_origins). Also note that programatically removing an `<iframe>`'s src attribute (e.g. via [`Element.removeAttribute()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute \"The Element method removeAttribute() removes the attribute with the specified name from the element.\")) causes `about:blank` to be loaded in the frame in Firefox (from version 65), Chromium-based browsers, and Safari/iOS." } }, { "name": "srcdoc", "description": { "kind": "markdown", "value": "Inline HTML to embed, overriding the `src` attribute. If a browser does not support the `srcdoc` attribute, it will fall back to the URL in the `src` attribute." } }, { "name": "name", "description": { "kind": "markdown", "value": "A targetable name for the embedded browsing context. This can be used in the `target` attribute of the [`<a>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a \"The HTML <a> element (or anchor element) creates a hyperlink to other web pages, files, locations within the same page, email addresses, or any other URL.\"), [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\"), or [`<base>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base \"The HTML <base> element specifies the base URL to use for all relative URLs contained within a document. There can be only one <base> element in a document.\") elements; the `formtarget` attribute of the [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") or [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") elements; or the `windowName` parameter in the [`window.open()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/open \"The Window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. If the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.\") method." } }, { "name": "sandbox", "valueSet": "sb", "description": { "kind": "markdown", "value": "Applies extra restrictions to the content in the frame. The value of the attribute can either be empty to apply all restrictions, or space-separated tokens to lift particular restrictions:\n\n* `allow-forms`: Allows the resource to submit forms. If this keyword is not used, form submission is blocked.\n* `allow-modals`: Lets the resource [open modal windows](https://html.spec.whatwg.org/multipage/origin.html#sandboxed-modals-flag).\n* `allow-orientation-lock`: Lets the resource [lock the screen orientation](https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation).\n* `allow-pointer-lock`: Lets the resource use the [Pointer Lock API](https://developer.mozilla.org/en-US/docs/WebAPI/Pointer_Lock).\n* `allow-popups`: Allows popups (such as `window.open()`, `target=\"_blank\"`, or `showModalDialog()`). If this keyword is not used, the popup will silently fail to open.\n* `allow-popups-to-escape-sandbox`: Lets the sandboxed document open new windows without those windows inheriting the sandboxing. For example, this can safely sandbox an advertisement without forcing the same restrictions upon the page the ad links to.\n* `allow-presentation`: Lets the resource start a [presentation session](https://developer.mozilla.org/en-US/docs/Web/API/PresentationRequest).\n* `allow-same-origin`: If this token is not used, the resource is treated as being from a special origin that always fails the [same-origin policy](https://developer.mozilla.org/en-US/docs/Glossary/same-origin_policy \"same-origin policy: The same-origin policy is a critical security mechanism that restricts how a document or script loaded from one origin can interact with a resource from another origin.\").\n* `allow-scripts`: Lets the resource run scripts (but not create popup windows).\n* `allow-storage-access-by-user-activation` : Lets the resource request access to the parent's storage capabilities with the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).\n* `allow-top-navigation`: Lets the resource navigate the top-level browsing context (the one named `_top`).\n* `allow-top-navigation-by-user-activation`: Lets the resource navigate the top-level browsing context, but only if initiated by a user gesture.\n\n**Notes about sandboxing:**\n\n* When the embedded document has the same origin as the embedding page, it is **strongly discouraged** to use both `allow-scripts` and `allow-same-origin`, as that lets the embedded document remove the `sandbox` attribute — making it no more secure than not using the `sandbox` attribute at all.\n* Sandboxing is useless if the attacker can display content outside a sandboxed `iframe` — such as if the viewer opens the frame in a new tab. Such content should be also served from a _separate origin_ to limit potential damage.\n* The `sandbox` attribute is unsupported in Internet Explorer 9 and earlier." } }, { "name": "seamless", "valueSet": "v" }, { "name": "allowfullscreen", "valueSet": "v", "description": { "kind": "markdown", "value": "Set to `true` if the `<iframe>` can activate fullscreen mode by calling the [`requestFullscreen()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen \"The Element.requestFullscreen() method issues an asynchronous request to make the element be displayed in full-screen mode.\") method." } }, { "name": "width", "description": { "kind": "markdown", "value": "The width of the frame in CSS pixels. Default is `300`." } }, { "name": "height", "description": { "kind": "markdown", "value": "The height of the frame in CSS pixels. Default is `150`." } }, { "name": "allow", "description": "Specifies a [feature policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Feature_Policy) for the `<iframe>`." }, { "name": "allowpaymentrequest", "description": "Set to `true` if a cross-origin `<iframe>` should be allowed to invoke the [Payment Request API](https://developer.mozilla.org/en-US/docs/Web/API/Payment_Request_API)." }, { "name": "allowpaymentrequest", "description": "This attribute is considered a legacy attribute and redefined as `allow=\"payment\"`." }, { "name": "csp", "description": "A [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) enforced for the embedded resource. See [`HTMLIFrameElement.csp`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/csp \"The csp property of the HTMLIFrameElement interface specifies the Content Security Policy that an embedded document must agree to enforce upon itself.\") for details." }, { "name": "importance", "description": "The download priority of the resource in the `<iframe>`'s `src` attribute. Allowed values:\n\n`auto` (default)\n\nNo preference. The browser uses its own heuristics to decide the priority of the resource.\n\n`high`\n\nThe resource should be downloaded before other lower-priority page resources.\n\n`low`\n\nThe resource should be downloaded after other higher-priority page resources." }, { "name": "referrerpolicy", "description": "Indicates which [referrer](https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer) to send when fetching the frame's resource:\n\n* `no-referrer`: The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent.\n* `no-referrer-when-downgrade` (default): The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent to [origin](https://developer.mozilla.org/en-US/docs/Glossary/origin \"origin: Web content's origin is defined by the scheme (protocol), host (domain), and port of the URL used to access it. Two objects have the same origin only when the scheme, host, and port all match.\")s without [TLS](https://developer.mozilla.org/en-US/docs/Glossary/TLS \"TLS: Transport Layer Security (TLS), previously known as Secure Sockets Layer (SSL), is a protocol used by applications to communicate securely across a network, preventing tampering with and eavesdropping on email, web browsing, messaging, and other protocols.\") ([HTTPS](https://developer.mozilla.org/en-US/docs/Glossary/HTTPS \"HTTPS: HTTPS (HTTP Secure) is an encrypted version of the HTTP protocol. It usually uses SSL or TLS to encrypt all communication between a client and a server. This secure connection allows clients to safely exchange sensitive data with a server, for example for banking activities or online shopping.\")).\n* `origin`: The sent referrer will be limited to the origin of the referring page: its [scheme](https://developer.mozilla.org/en-US/docs/Archive/Mozilla/URIScheme), [host](https://developer.mozilla.org/en-US/docs/Glossary/host \"host: A host is a device connected to the Internet (or a local network). Some hosts called servers offer additional services like serving webpages or storing files and emails.\"), and [port](https://developer.mozilla.org/en-US/docs/Glossary/port \"port: For a computer connected to a network with an IP address, a port is a communication endpoint. Ports are designated by numbers, and below 1024 each port is associated by default with a specific protocol.\").\n* `origin-when-cross-origin`: The referrer sent to other origins will be limited to the scheme, the host, and the port. Navigations on the same origin will still include the path.\n* `same-origin`: A referrer will be sent for [same origin](https://developer.mozilla.org/en-US/docs/Glossary/Same-origin_policy \"same origin: The same-origin policy is a critical security mechanism that restricts how a document or script loaded from one origin can interact with a resource from another origin.\"), but cross-origin requests will contain no referrer information.\n* `strict-origin`: Only send the origin of the document as the referrer when the protocol security level stays the same (HTTPS→HTTPS), but don't send it to a less secure destination (HTTPS→HTTP).\n* `strict-origin-when-cross-origin`: Send a full URL when performing a same-origin request, only send the origin when the protocol security level stays the same (HTTPS→HTTPS), and send no header to a less secure destination (HTTPS→HTTP).\n* `unsafe-url`: The referrer will include the origin _and_ the path (but not the [fragment](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/hash), [password](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/password), or [username](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/username)). **This value is unsafe**, because it leaks origins and paths from TLS-protected resources to insecure origins." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/iframe" } ] }, { "name": "embed", "description": { "kind": "markdown", "value": "The embed element provides an integration point for an external (typically non-HTML) application or interactive content." }, "attributes": [ { "name": "src", "description": { "kind": "markdown", "value": "The URL of the resource being embedded." } }, { "name": "type", "description": { "kind": "markdown", "value": "The MIME type to use to select the plug-in to instantiate." } }, { "name": "width", "description": { "kind": "markdown", "value": "The displayed width of the resource, in [CSS pixels](https://drafts.csswg.org/css-values/#px). This must be an absolute value; percentages are _not_ allowed." } }, { "name": "height", "description": { "kind": "markdown", "value": "The displayed height of the resource, in [CSS pixels](https://drafts.csswg.org/css-values/#px). This must be an absolute value; percentages are _not_ allowed." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/embed" } ] }, { "name": "object", "description": { "kind": "markdown", "value": "The object element can represent an external resource, which, depending on the type of the resource, will either be treated as an image, as a nested browsing context, or as an external resource to be processed by a plugin." }, "attributes": [ { "name": "data", "description": { "kind": "markdown", "value": "The address of the resource as a valid URL. At least one of **data** and **type** must be defined." } }, { "name": "type", "description": { "kind": "markdown", "value": "The [content type](https://developer.mozilla.org/en-US/docs/Glossary/Content_type) of the resource specified by **data**. At least one of **data** and **type** must be defined." } }, { "name": "typemustmatch", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates if the **type** attribute and the actual [content type](https://developer.mozilla.org/en-US/docs/Glossary/Content_type) of the resource must match to be used." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name of valid browsing context (HTML5), or the name of the control (HTML 4)." } }, { "name": "usemap", "description": { "kind": "markdown", "value": "A hash-name reference to a [`<map>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map \"The HTML <map> element is used with <area> elements to define an image map (a clickable link area).\") element; that is a '#' followed by the value of a [`name`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map#attr-name) of a map element." } }, { "name": "form", "description": { "kind": "markdown", "value": "The form element, if any, that the object element is associated with (its _form owner_). The value of the attribute must be an ID of a [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element in the same document." } }, { "name": "width", "description": { "kind": "markdown", "value": "The width of the display resource, in [CSS pixels](https://drafts.csswg.org/css-values/#px). -- (Absolute values only. [NO percentages](https://html.spec.whatwg.org/multipage/embedded-content.html#dimension-attributes))" } }, { "name": "height", "description": { "kind": "markdown", "value": "The height of the displayed resource, in [CSS pixels](https://drafts.csswg.org/css-values/#px). -- (Absolute values only. [NO percentages](https://html.spec.whatwg.org/multipage/embedded-content.html#dimension-attributes))" } }, { "name": "archive", "description": "A space-separated list of URIs for archives of resources for the object." }, { "name": "border", "description": "The width of a border around the control, in pixels." }, { "name": "classid", "description": "The URI of the object's implementation. It can be used together with, or in place of, the **data** attribute." }, { "name": "codebase", "description": "The base path used to resolve relative URIs specified by **classid**, **data**, or **archive**. If not specified, the default is the base URI of the current document." }, { "name": "codetype", "description": "The content type of the data specified by **classid**." }, { "name": "declare", "description": "The presence of this Boolean attribute makes this element a declaration only. The object must be instantiated by a subsequent `<object>` element. In HTML5, repeat the <object> element completely each that that the resource is reused." }, { "name": "standby", "description": "A message that the browser can show while loading the object's implementation and data." }, { "name": "tabindex", "description": "The position of the element in the tabbing navigation order for the current document." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/object" } ] }, { "name": "param", "description": { "kind": "markdown", "value": "The param element defines parameters for plugins invoked by object elements. It does not represent anything on its own." }, "attributes": [ { "name": "name", "description": { "kind": "markdown", "value": "Name of the parameter." } }, { "name": "value", "description": { "kind": "markdown", "value": "Specifies the value of the parameter." } }, { "name": "type", "description": "Only used if the `valuetype` is set to \"ref\". Specifies the MIME type of values found at the URI specified by value." }, { "name": "valuetype", "description": "Specifies the type of the `value` attribute. Possible values are:\n\n* data: Default value. The value is passed to the object's implementation as a string.\n* ref: The value is a URI to a resource where run-time values are stored.\n* object: An ID of another [`<object>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object \"The HTML <object> element represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.\") in the same document." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/param" } ] }, { "name": "video", "description": { "kind": "markdown", "value": "A video element is used for playing videos or movies, and audio files with captions." }, "attributes": [ { "name": "src" }, { "name": "crossorigin", "valueSet": "xo" }, { "name": "poster" }, { "name": "preload", "valueSet": "pl" }, { "name": "autoplay", "valueSet": "v", "description": { "kind": "markdown", "value": "A Boolean attribute; if specified, the video automatically begins to play back as soon as it can do so without stopping to finish loading the data." } }, { "name": "mediagroup" }, { "name": "loop", "valueSet": "v" }, { "name": "muted", "valueSet": "v" }, { "name": "controls", "valueSet": "v" }, { "name": "width" }, { "name": "height" } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/video" } ] }, { "name": "audio", "description": { "kind": "markdown", "value": "An audio element represents a sound or audio stream." }, "attributes": [ { "name": "src", "description": { "kind": "markdown", "value": "The URL of the audio to embed. This is subject to [HTTP access controls](https://developer.mozilla.org/en-US/docs/HTTP_access_control). This is optional; you may instead use the [`<source>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source \"The HTML <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element.\") element within the audio block to specify the audio to embed." } }, { "name": "crossorigin", "valueSet": "xo", "description": { "kind": "markdown", "value": "This enumerated attribute indicates whether to use CORS to fetch the related image. [CORS-enabled resources](https://developer.mozilla.org/en-US/docs/CORS_Enabled_Image) can be reused in the [`<canvas>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas \"Use the HTML <canvas> element with either the canvas scripting API or the WebGL API to draw graphics and animations.\") element without being _tainted_. The allowed values are:\n\nanonymous\n\nSends a cross-origin request without a credential. In other words, it sends the `Origin:` HTTP header without a cookie, X.509 certificate, or performing HTTP Basic authentication. If the server does not give credentials to the origin site (by not setting the `Access-Control-Allow-Origin:` HTTP header), the image will be _tainted_, and its usage restricted.\n\nuse-credentials\n\nSends a cross-origin request with a credential. In other words, it sends the `Origin:` HTTP header with a cookie, a certificate, or performing HTTP Basic authentication. If the server does not give credentials to the origin site (through `Access-Control-Allow-Credentials:` HTTP header), the image will be _tainted_ and its usage restricted.\n\nWhen not present, the resource is fetched without a CORS request (i.e. without sending the `Origin:` HTTP header), preventing its non-tainted used in [`<canvas>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas \"Use the HTML <canvas> element with either the canvas scripting API or the WebGL API to draw graphics and animations.\") elements. If invalid, it is handled as if the enumerated keyword **anonymous** was used. See [CORS settings attributes](https://developer.mozilla.org/en-US/docs/HTML/CORS_settings_attributes) for additional information." } }, { "name": "preload", "valueSet": "pl", "description": { "kind": "markdown", "value": "This enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience. It may have one of the following values:\n\n* `none`: Indicates that the audio should not be preloaded.\n* `metadata`: Indicates that only audio metadata (e.g. length) is fetched.\n* `auto`: Indicates that the whole audio file can be downloaded, even if the user is not expected to use it.\n* _empty string_: A synonym of the `auto` value.\n\nIf not set, `preload`'s default value is browser-defined (i.e. each browser may have its own default value). The spec advises it to be set to `metadata`.\n\n**Usage notes:**\n\n* The `autoplay` attribute has precedence over `preload`. If `autoplay` is specified, the browser would obviously need to start downloading the audio for playback.\n* The browser is not forced by the specification to follow the value of this attribute; it is a mere hint." } }, { "name": "autoplay", "valueSet": "v", "description": { "kind": "markdown", "value": "A Boolean attribute: if specified, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading.\n\n**Note**: Sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible. If you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). However, this can be useful when creating media elements whose source will be set at a later time, under user control." } }, { "name": "mediagroup" }, { "name": "loop", "valueSet": "v", "description": { "kind": "markdown", "value": "A Boolean attribute: if specified, the audio player will automatically seek back to the start upon reaching the end of the audio." } }, { "name": "muted", "valueSet": "v", "description": { "kind": "markdown", "value": "A Boolean attribute that indicates whether the audio will be initially silenced. Its default value is `false`." } }, { "name": "controls", "valueSet": "v", "description": { "kind": "markdown", "value": "If this attribute is present, the browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/audio" } ] }, { "name": "source", "description": { "kind": "markdown", "value": "The source element allows authors to specify multiple alternative media resources for media elements. It does not represent anything on its own." }, "attributes": [ { "name": "src", "description": { "kind": "markdown", "value": "Required for [`<audio>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio \"The HTML <audio> element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the <source> element: the browser will choose the most suitable one. It can also be the destination for streamed media, using a MediaStream.\") and [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video \"The HTML Video element (<video>) embeds a media player which supports video playback into the document.\"), address of the media resource. The value of this attribute is ignored when the `<source>` element is placed inside a [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture \"The HTML <picture> element contains zero or more <source> elements and one <img> element to provide versions of an image for different display/device scenarios.\") element." } }, { "name": "type", "description": { "kind": "markdown", "value": "The MIME-type of the resource, optionally with a `codecs` parameter. See [RFC 4281](https://tools.ietf.org/html/rfc4281) for information about how to specify codecs." } }, { "name": "sizes", "description": "Is a list of source sizes that describes the final rendered width of the image represented by the source. Each source size consists of a comma-separated list of media condition-length pairs. This information is used by the browser to determine, before laying the page out, which image defined in [`srcset`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source#attr-srcset) to use. \nThe `sizes` attribute has an effect only when the [`<source>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source \"The HTML <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element.\") element is the direct child of a [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture \"The HTML <picture> element contains zero or more <source> elements and one <img> element to provide versions of an image for different display/device scenarios.\") element." }, { "name": "srcset", "description": "A list of one or more strings separated by commas indicating a set of possible images represented by the source for the browser to use. Each string is composed of:\n\n1. one URL to an image,\n2. a width descriptor, that is a positive integer directly followed by `'w'`. The default value, if missing, is the infinity.\n3. a pixel density descriptor, that is a positive floating number directly followed by `'x'`. The default value, if missing, is `1x`.\n\nEach string in the list must have at least a width descriptor or a pixel density descriptor to be valid. Among the list, there must be only one string containing the same tuple of width descriptor and pixel density descriptor. \nThe browser chooses the most adequate image to display at a given point of time. \nThe `srcset` attribute has an effect only when the [`<source>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source \"The HTML <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element.\") element is the direct child of a [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture \"The HTML <picture> element contains zero or more <source> elements and one <img> element to provide versions of an image for different display/device scenarios.\") element." }, { "name": "media", "description": "[Media query](https://developer.mozilla.org/en-US/docs/CSS/Media_queries) of the resource's intended media; this should be used only in a [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture \"The HTML <picture> element contains zero or more <source> elements and one <img> element to provide versions of an image for different display/device scenarios.\") element." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/source" } ] }, { "name": "track", "description": { "kind": "markdown", "value": "The track element allows authors to specify explicit external timed text tracks for media elements. It does not represent anything on its own." }, "attributes": [ { "name": "default", "valueSet": "v", "description": { "kind": "markdown", "value": "This attribute indicates that the track should be enabled unless the user's preferences indicate that another track is more appropriate. This may only be used on one `track` element per media element." } }, { "name": "kind", "valueSet": "tk", "description": { "kind": "markdown", "value": "How the text track is meant to be used. If omitted the default kind is `subtitles`. If the attribute is not present, it will use the `subtitles`. If the attribute contains an invalid value, it will use `metadata`. (Versions of Chrome earlier than 52 treated an invalid value as `subtitles`.) The following keywords are allowed:\n\n* `subtitles`\n * Subtitles provide translation of content that cannot be understood by the viewer. For example dialogue or text that is not English in an English language film.\n * Subtitles may contain additional content, usually extra background information. For example the text at the beginning of the Star Wars films, or the date, time, and location of a scene.\n* `captions`\n * Closed captions provide a transcription and possibly a translation of audio.\n * It may include important non-verbal information such as music cues or sound effects. It may indicate the cue's source (e.g. music, text, character).\n * Suitable for users who are deaf or when the sound is muted.\n* `descriptions`\n * Textual description of the video content.\n * Suitable for users who are blind or where the video cannot be seen.\n* `chapters`\n * Chapter titles are intended to be used when the user is navigating the media resource.\n* `metadata`\n * Tracks used by scripts. Not visible to the user." } }, { "name": "label", "description": { "kind": "markdown", "value": "A user-readable title of the text track which is used by the browser when listing available text tracks." } }, { "name": "src", "description": { "kind": "markdown", "value": "Address of the track (`.vtt` file). Must be a valid URL. This attribute must be specified and its URL value must have the same origin as the document — unless the [`<audio>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio \"The HTML <audio> element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the <source> element: the browser will choose the most suitable one. It can also be the destination for streamed media, using a MediaStream.\") or [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video \"The HTML Video element (<video>) embeds a media player which supports video playback into the document.\") parent element of the `track` element has a [`crossorigin`](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) attribute." } }, { "name": "srclang", "description": { "kind": "markdown", "value": "Language of the track text data. It must be a valid [BCP 47](https://r12a.github.io/app-subtags/) language tag. If the `kind` attribute is set to `subtitles,` then `srclang` must be defined." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/track" } ] }, { "name": "map", "description": { "kind": "markdown", "value": "The map element, in conjunction with an img element and any area element descendants, defines an image map. The element represents its children." }, "attributes": [ { "name": "name", "description": { "kind": "markdown", "value": "The name attribute gives the map a name so that it can be referenced. The attribute must be present and must have a non-empty value with no space characters. The value of the name attribute must not be a compatibility-caseless match for the value of the name attribute of another map element in the same document. If the id attribute is also specified, both attributes must have the same value." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/map" } ] }, { "name": "area", "description": { "kind": "markdown", "value": "The area element represents either a hyperlink with some text and a corresponding area on an image map, or a dead area on an image map." }, "attributes": [ { "name": "alt" }, { "name": "coords" }, { "name": "shape", "valueSet": "sh" }, { "name": "href" }, { "name": "target" }, { "name": "download" }, { "name": "ping" }, { "name": "rel" }, { "name": "hreflang" }, { "name": "type" }, { "name": "accesskey", "description": "Specifies a keyboard navigation accelerator for the element. Pressing ALT or a similar key in association with the specified character selects the form control correlated with that key sequence. Page designers are forewarned to avoid key sequences already bound to browsers. This attribute is global since HTML5." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/area" } ] }, { "name": "table", "description": { "kind": "markdown", "value": "The table element represents data with more than one dimension, in the form of a table." }, "attributes": [ { "name": "border" }, { "name": "align", "description": "This enumerated attribute indicates how the table must be aligned inside the containing document. It may have the following values:\n\n* left: the table is displayed on the left side of the document;\n* center: the table is displayed in the center of the document;\n* right: the table is displayed on the right side of the document.\n\n**Usage Note**\n\n* **Do not use this attribute**, as it has been deprecated. The [`<table>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table \"The HTML <table> element represents tabular data — that is, information presented in a two-dimensional table comprised of rows and columns of cells containing data.\") element should be styled using [CSS](https://developer.mozilla.org/en-US/docs/CSS). Set [`margin-left`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left \"The margin-left CSS property sets the margin area on the left side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") and [`margin-right`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right \"The margin-right CSS property sets the margin area on the right side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") to `auto` or [`margin`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin \"The margin CSS property sets the margin area on all four sides of an element. It is a shorthand for margin-top, margin-right, margin-bottom, and margin-left.\") to `0 auto` to achieve an effect that is similar to the align attribute.\n* Prior to Firefox 4, Firefox also supported the `middle`, `absmiddle`, and `abscenter` values as synonyms of `center`, in quirks mode only." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/table" } ] }, { "name": "caption", "description": { "kind": "markdown", "value": "The caption element represents the title of the table that is its parent, if it has a parent and that is a table element." }, "attributes": [ { "name": "align", "description": "This enumerated attribute indicates how the caption must be aligned with respect to the table. It may have one of the following values:\n\n`left`\n\nThe caption is displayed to the left of the table.\n\n`top`\n\nThe caption is displayed above the table.\n\n`right`\n\nThe caption is displayed to the right of the table.\n\n`bottom`\n\nThe caption is displayed below the table.\n\n**Usage note:** Do not use this attribute, as it has been deprecated. The [`<caption>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption \"The HTML Table Caption element (<caption>) specifies the caption (or title) of a table, and if used is always the first child of a <table>.\") element should be styled using the [CSS](https://developer.mozilla.org/en-US/docs/CSS) properties [`caption-side`](https://developer.mozilla.org/en-US/docs/Web/CSS/caption-side \"The caption-side CSS property puts the content of a table's <caption> on the specified side. The values are relative to the writing-mode of the table.\") and [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\")." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/caption" } ] }, { "name": "colgroup", "description": { "kind": "markdown", "value": "The colgroup element represents a group of one or more columns in the table that is its parent, if it has a parent and that is a table element." }, "attributes": [ { "name": "span" }, { "name": "align", "description": "This enumerated attribute specifies how horizontal alignment of each column cell content will be handled. Possible values are:\n\n* `left`, aligning the content to the left of the cell\n* `center`, centering the content in the cell\n* `right`, aligning the content to the right of the cell\n* `justify`, inserting spaces into the textual content so that the content is justified in the cell\n* `char`, aligning the textual content on a special character with a minimal offset, defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-charoff) attributes Unimplemented (see [bug 2212](https://bugzilla.mozilla.org/show_bug.cgi?id=2212 \"character alignment not implemented (align=char, charoff=, text-align:<string>)\")).\n\nIf this attribute is not set, the `left` value is assumed. The descendant [`<col>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col \"The HTML <col> element defines a column within a table and is used for defining common semantics on all common cells. It is generally found within a <colgroup> element.\") elements may override this value using their own [`align`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-align) attribute.\n\n**Note:** Do not use this attribute as it is obsolete (not supported) in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values:\n * Do not try to set the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property on a selector giving a [`<colgroup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup \"The HTML <colgroup> element defines a group of columns within a table.\") element. Because [`<td>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td \"The HTML <td> element defines a cell of a table that contains data. It participates in the table model.\") elements are not descendant of the [`<colgroup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup \"The HTML <colgroup> element defines a group of columns within a table.\") element, they won't inherit it.\n * If the table doesn't use a [`colspan`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-colspan) attribute, use one `td:nth-child(an+b)` CSS selector per column, where a is the total number of the columns in the table and b is the ordinal position of this column in the table. Only after this selector the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property can be used.\n * If the table does use a [`colspan`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-colspan) attribute, the effect can be achieved by combining adequate CSS attribute selectors like `[colspan=n]`, though this is not trivial.\n* To achieve the same effect as the `char` value, in CSS3, you can use the value of the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup#attr-char) as the value of the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property Unimplemented." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/colgroup" } ] }, { "name": "col", "description": { "kind": "markdown", "value": "If a col element has a parent and that is a colgroup element that itself has a parent that is a table element, then the col element represents one or more columns in the column group represented by that colgroup." }, "attributes": [ { "name": "span" }, { "name": "align", "description": "This enumerated attribute specifies how horizontal alignment of each column cell content will be handled. Possible values are:\n\n* `left`, aligning the content to the left of the cell\n* `center`, centering the content in the cell\n* `right`, aligning the content to the right of the cell\n* `justify`, inserting spaces into the textual content so that the content is justified in the cell\n* `char`, aligning the textual content on a special character with a minimal offset, defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-charoff) attributes Unimplemented (see [bug 2212](https://bugzilla.mozilla.org/show_bug.cgi?id=2212 \"character alignment not implemented (align=char, charoff=, text-align:<string>)\")).\n\nIf this attribute is not set, its value is inherited from the [`align`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup#attr-align) of the [`<colgroup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup \"The HTML <colgroup> element defines a group of columns within a table.\") element this `<col>` element belongs too. If there are none, the `left` value is assumed.\n\n**Note:** Do not use this attribute as it is obsolete (not supported) in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values:\n * Do not try to set the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property on a selector giving a [`<col>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col \"The HTML <col> element defines a column within a table and is used for defining common semantics on all common cells. It is generally found within a <colgroup> element.\") element. Because [`<td>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td \"The HTML <td> element defines a cell of a table that contains data. It participates in the table model.\") elements are not descendant of the [`<col>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col \"The HTML <col> element defines a column within a table and is used for defining common semantics on all common cells. It is generally found within a <colgroup> element.\") element, they won't inherit it.\n * If the table doesn't use a [`colspan`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-colspan) attribute, use the `td:nth-child(an+b)` CSS selector. Set `a` to zero and `b` to the position of the column in the table, e.g. `td:nth-child(2) { text-align: right; }` to right-align the second column.\n * If the table does use a [`colspan`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-colspan) attribute, the effect can be achieved by combining adequate CSS attribute selectors like `[colspan=n]`, though this is not trivial.\n* To achieve the same effect as the `char` value, in CSS3, you can use the value of the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-char) as the value of the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property Unimplemented." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/col" } ] }, { "name": "tbody", "description": { "kind": "markdown", "value": "The tbody element represents a block of rows that consist of a body of data for the parent table element, if the tbody element has a parent and it is a table." }, "attributes": [ { "name": "align", "description": "This enumerated attribute specifies how horizontal alignment of each cell content will be handled. Possible values are:\n\n* `left`, aligning the content to the left of the cell\n* `center`, centering the content in the cell\n* `right`, aligning the content to the right of the cell\n* `justify`, inserting spaces into the textual content so that the content is justified in the cell\n* `char`, aligning the textual content on a special character with a minimal offset, defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody#attr-charoff) attributes.\n\nIf this attribute is not set, the `left` value is assumed.\n\n**Note:** Do not use this attribute as it is obsolete (not supported) in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values, use the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property on it.\n* To achieve the same effect as the `char` value, in CSS3, you can use the value of the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody#attr-char) as the value of the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property Unimplemented." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/tbody" } ] }, { "name": "thead", "description": { "kind": "markdown", "value": "The thead element represents the block of rows that consist of the column labels (headers) for the parent table element, if the thead element has a parent and it is a table." }, "attributes": [ { "name": "align", "description": "This enumerated attribute specifies how horizontal alignment of each cell content will be handled. Possible values are:\n\n* `left`, aligning the content to the left of the cell\n* `center`, centering the content in the cell\n* `right`, aligning the content to the right of the cell\n* `justify`, inserting spaces into the textual content so that the content is justified in the cell\n* `char`, aligning the textual content on a special character with a minimal offset, defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead#attr-charoff) attributes Unimplemented (see [bug 2212](https://bugzilla.mozilla.org/show_bug.cgi?id=2212 \"character alignment not implemented (align=char, charoff=, text-align:<string>)\")).\n\nIf this attribute is not set, the `left` value is assumed.\n\n**Note:** Do not use this attribute as it is obsolete (not supported) in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values, use the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property on it.\n* To achieve the same effect as the `char` value, in CSS3, you can use the value of the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead#attr-char) as the value of the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property Unimplemented." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/thead" } ] }, { "name": "tfoot", "description": { "kind": "markdown", "value": "The tfoot element represents the block of rows that consist of the column summaries (footers) for the parent table element, if the tfoot element has a parent and it is a table." }, "attributes": [ { "name": "align", "description": "This enumerated attribute specifies how horizontal alignment of each cell content will be handled. Possible values are:\n\n* `left`, aligning the content to the left of the cell\n* `center`, centering the content in the cell\n* `right`, aligning the content to the right of the cell\n* `justify`, inserting spaces into the textual content so that the content is justified in the cell\n* `char`, aligning the textual content on a special character with a minimal offset, defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody#attr-charoff) attributes Unimplemented (see [bug 2212](https://bugzilla.mozilla.org/show_bug.cgi?id=2212 \"character alignment not implemented (align=char, charoff=, text-align:<string>)\")).\n\nIf this attribute is not set, the `left` value is assumed.\n\n**Note:** Do not use this attribute as it is obsolete (not supported) in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values, use the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property on it.\n* To achieve the same effect as the `char` value, in CSS3, you can use the value of the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot#attr-char) as the value of the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property Unimplemented." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/tfoot" } ] }, { "name": "tr", "description": { "kind": "markdown", "value": "The tr element represents a row of cells in a table." }, "attributes": [ { "name": "align", "description": "A [`DOMString`](https://developer.mozilla.org/en-US/docs/Web/API/DOMString \"DOMString is a UTF-16 String. As JavaScript already uses such strings, DOMString is mapped directly to a String.\") which specifies how the cell's context should be aligned horizontally within the cells in the row; this is shorthand for using `align` on every cell in the row individually. Possible values are:\n\n`left`\n\nAlign the content of each cell at its left edge.\n\n`center`\n\nCenter the contents of each cell between their left and right edges.\n\n`right`\n\nAlign the content of each cell at its right edge.\n\n`justify`\n\nWiden whitespaces within the text of each cell so that the text fills the full width of each cell (full justification).\n\n`char`\n\nAlign each cell in the row on a specific character (such that each row in the column that is configured this way will horizontally align its cells on that character). This uses the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr#attr-charoff) to establish the alignment character (typically \".\" or \",\" when aligning numerical data) and the number of characters that should follow the alignment character. This alignment type was never widely supported.\n\nIf no value is expressly set for `align`, the parent node's value is inherited.\n\nInstead of using the obsolete `align` attribute, you should instead use the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property to establish `left`, `center`, `right`, or `justify` alignment for the row's cells. To apply character-based alignment, set the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property to the alignment character (such as `\".\"` or `\",\"`)." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/tr" } ] }, { "name": "td", "description": { "kind": "markdown", "value": "The td element represents a data cell in a table." }, "attributes": [ { "name": "colspan" }, { "name": "rowspan" }, { "name": "headers" }, { "name": "abbr", "description": "This attribute contains a short abbreviated description of the cell's content. Some user-agents, such as speech readers, may present this description before the content itself.\n\n**Note:** Do not use this attribute as it is obsolete in the latest standard. Alternatively, you can put the abbreviated description inside the cell and place the long content in the **title** attribute." }, { "name": "align", "description": "This enumerated attribute specifies how the cell content's horizontal alignment will be handled. Possible values are:\n\n* `left`: The content is aligned to the left of the cell.\n* `center`: The content is centered in the cell.\n* `right`: The content is aligned to the right of the cell.\n* `justify` (with text only): The content is stretched out inside the cell so that it covers its entire width.\n* `char` (with text only): The content is aligned to a character inside the `<th>` element with minimal offset. This character is defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-charoff) attributes Unimplemented (see [bug 2212](https://bugzilla.mozilla.org/show_bug.cgi?id=2212 \"character alignment not implemented (align=char, charoff=, text-align:<string>)\")).\n\nThe default value when this attribute is not specified is `left`.\n\n**Note:** Do not use this attribute as it is obsolete in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values, apply the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property to the element.\n* To achieve the same effect as the `char` value, give the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property the same value you would use for the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-char). Unimplemented in CSS3." }, { "name": "axis", "description": "This attribute contains a list of space-separated strings. Each string is the `id` of a group of cells that this header applies to.\n\n**Note:** Do not use this attribute as it is obsolete in the latest standard." }, { "name": "bgcolor", "description": "This attribute defines the background color of each cell in a column. It consists of a 6-digit hexadecimal code as defined in [sRGB](https://www.w3.org/Graphics/Color/sRGB) and is prefixed by '#'. This attribute may be used with one of sixteen predefined color strings:\n\n \n\n`black` = \"#000000\"\n\n \n\n`green` = \"#008000\"\n\n \n\n`silver` = \"#C0C0C0\"\n\n \n\n`lime` = \"#00FF00\"\n\n \n\n`gray` = \"#808080\"\n\n \n\n`olive` = \"#808000\"\n\n \n\n`white` = \"#FFFFFF\"\n\n \n\n`yellow` = \"#FFFF00\"\n\n \n\n`maroon` = \"#800000\"\n\n \n\n`navy` = \"#000080\"\n\n \n\n`red` = \"#FF0000\"\n\n \n\n`blue` = \"#0000FF\"\n\n \n\n`purple` = \"#800080\"\n\n \n\n`teal` = \"#008080\"\n\n \n\n`fuchsia` = \"#FF00FF\"\n\n \n\n`aqua` = \"#00FFFF\"\n\n**Note:** Do not use this attribute, as it is non-standard and only implemented in some versions of Microsoft Internet Explorer: The [`<td>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td \"The HTML <td> element defines a cell of a table that contains data. It participates in the table model.\") element should be styled using [CSS](https://developer.mozilla.org/en-US/docs/CSS). To create a similar effect use the [`background-color`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-color \"The background-color CSS property sets the background color of an element.\") property in [CSS](https://developer.mozilla.org/en-US/docs/CSS) instead." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/td" } ] }, { "name": "th", "description": { "kind": "markdown", "value": "The th element represents a header cell in a table." }, "attributes": [ { "name": "colspan" }, { "name": "rowspan" }, { "name": "headers" }, { "name": "scope", "valueSet": "s" }, { "name": "sorted" }, { "name": "abbr", "description": { "kind": "markdown", "value": "This attribute contains a short abbreviated description of the cell's content. Some user-agents, such as speech readers, may present this description before the content itself." } }, { "name": "align", "description": "This enumerated attribute specifies how the cell content's horizontal alignment will be handled. Possible values are:\n\n* `left`: The content is aligned to the left of the cell.\n* `center`: The content is centered in the cell.\n* `right`: The content is aligned to the right of the cell.\n* `justify` (with text only): The content is stretched out inside the cell so that it covers its entire width.\n* `char` (with text only): The content is aligned to a character inside the `<th>` element with minimal offset. This character is defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-charoff) attributes.\n\nThe default value when this attribute is not specified is `left`.\n\n**Note:** Do not use this attribute as it is obsolete in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values, apply the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property to the element.\n* To achieve the same effect as the `char` value, give the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property the same value you would use for the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-char). Unimplemented in CSS3." }, { "name": "axis", "description": "This attribute contains a list of space-separated strings. Each string is the `id` of a group of cells that this header applies to.\n\n**Note:** Do not use this attribute as it is obsolete in the latest standard: use the [`scope`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope) attribute instead." }, { "name": "bgcolor", "description": "This attribute defines the background color of each cell in a column. It consists of a 6-digit hexadecimal code as defined in [sRGB](https://www.w3.org/Graphics/Color/sRGB) and is prefixed by '#'. This attribute may be used with one of sixteen predefined color strings:\n\n \n\n`black` = \"#000000\"\n\n \n\n`green` = \"#008000\"\n\n \n\n`silver` = \"#C0C0C0\"\n\n \n\n`lime` = \"#00FF00\"\n\n \n\n`gray` = \"#808080\"\n\n \n\n`olive` = \"#808000\"\n\n \n\n`white` = \"#FFFFFF\"\n\n \n\n`yellow` = \"#FFFF00\"\n\n \n\n`maroon` = \"#800000\"\n\n \n\n`navy` = \"#000080\"\n\n \n\n`red` = \"#FF0000\"\n\n \n\n`blue` = \"#0000FF\"\n\n \n\n`purple` = \"#800080\"\n\n \n\n`teal` = \"#008080\"\n\n \n\n`fuchsia` = \"#FF00FF\"\n\n \n\n`aqua` = \"#00FFFF\"\n\n**Note:** Do not use this attribute, as it is non-standard and only implemented in some versions of Microsoft Internet Explorer: The [`<th>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th \"The HTML <th> element defines a cell as header of a group of table cells. The exact nature of this group is defined by the scope and headers attributes.\") element should be styled using [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS). To create a similar effect use the [`background-color`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-color \"The background-color CSS property sets the background color of an element.\") property in [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) instead." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/th" } ] }, { "name": "form", "description": { "kind": "markdown", "value": "The form element represents a collection of form-associated elements, some of which can represent editable values that can be submitted to a server for processing." }, "attributes": [ { "name": "accept-charset", "description": { "kind": "markdown", "value": "A space- or comma-delimited list of character encodings that the server accepts. The browser uses them in the order in which they are listed. The default value, the reserved string `\"UNKNOWN\"`, indicates the same encoding as that of the document containing the form element. \nIn previous versions of HTML, the different character encodings could be delimited by spaces or commas. In HTML5, only spaces are allowed as delimiters." } }, { "name": "action", "description": { "kind": "markdown", "value": "The URI of a program that processes the form information. This value can be overridden by a [`formaction`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formaction) attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") or [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element." } }, { "name": "autocomplete", "valueSet": "o", "description": { "kind": "markdown", "value": "Indicates whether input elements can by default have their values automatically completed by the browser. This setting can be overridden by an `autocomplete` attribute on an element belonging to the form. Possible values are:\n\n* `off`: The user must explicitly enter a value into each field for every use, or the document provides its own auto-completion method; the browser does not automatically complete entries.\n* `on`: The browser can automatically complete values based on values that the user has previously entered in the form.\n\nFor most modern browsers (including Firefox 38+, Google Chrome 34+, IE 11+) setting the autocomplete attribute will not prevent a browser's password manager from asking the user if they want to store login fields (username and password), if the user permits the storage the browser will autofill the login the next time the user visits the page. See [The autocomplete attribute and login fields](https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields)." } }, { "name": "enctype", "valueSet": "et", "description": { "kind": "markdown", "value": "When the value of the `method` attribute is `post`, enctype is the [MIME type](https://en.wikipedia.org/wiki/Mime_type) of content that is used to submit the form to the server. Possible values are:\n\n* `application/x-www-form-urlencoded`: The default value if the attribute is not specified.\n* `multipart/form-data`: The value used for an [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element with the `type` attribute set to \"file\".\n* `text/plain`: (HTML5)\n\nThis value can be overridden by a [`formenctype`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formenctype) attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") or [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element." } }, { "name": "method", "valueSet": "m", "description": { "kind": "markdown", "value": "The [HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP) method that the browser uses to submit the form. Possible values are:\n\n* `post`: Corresponds to the HTTP [POST method](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5) ; form data are included in the body of the form and sent to the server.\n* `get`: Corresponds to the HTTP [GET method](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3); form data are appended to the `action` attribute URI with a '?' as separator, and the resulting URI is sent to the server. Use this method when the form has no side-effects and contains only ASCII characters.\n* `dialog`: Use when the form is inside a [`<dialog>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog \"The HTML <dialog> element represents a dialog box or other interactive component, such as an inspector or window.\") element to close the dialog when submitted.\n\nThis value can be overridden by a [`formmethod`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formmethod) attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") or [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name of the form. In HTML 4, its use is deprecated (`id` should be used instead). It must be unique among the forms in a document and not just an empty string in HTML 5." } }, { "name": "novalidate", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the form is not to be validated when submitted. If this attribute is not specified (and therefore the form is validated), this default setting can be overridden by a [`formnovalidate`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formnovalidate) attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") or [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element belonging to the form." } }, { "name": "target", "description": { "kind": "markdown", "value": "A name or keyword indicating where to display the response that is received after submitting the form. In HTML 4, this is the name/keyword for a frame. In HTML5, it is a name/keyword for a _browsing context_ (for example, tab, window, or inline frame). The following keywords have special meanings:\n\n* `_self`: Load the response into the same HTML 4 frame (or HTML5 browsing context) as the current one. This value is the default if the attribute is not specified.\n* `_blank`: Load the response into a new unnamed HTML 4 window or HTML5 browsing context.\n* `_parent`: Load the response into the HTML 4 frameset parent of the current frame, or HTML5 parent browsing context of the current one. If there is no parent, this option behaves the same way as `_self`.\n* `_top`: HTML 4: Load the response into the full original window, and cancel all other frames. HTML5: Load the response into the top-level browsing context (i.e., the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as `_self`.\n* _iframename_: The response is displayed in a named [`<iframe>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe \"The HTML Inline Frame element (<iframe>) represents a nested browsing context, embedding another HTML page into the current one.\").\n\nHTML5: This value can be overridden by a [`formtarget`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formtarget) attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") or [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element." } }, { "name": "accept", "description": "A comma-separated list of content types that the server accepts.\n\n**Usage note:** This attribute has been removed in HTML5 and should no longer be used. Instead, use the [`accept`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept) attribute of the specific [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element." }, { "name": "autocapitalize", "description": "This is a nonstandard attribute used by iOS Safari Mobile which controls whether and how the text value for textual form control descendants should be automatically capitalized as it is entered/edited by the user. If the `autocapitalize` attribute is specified on an individual form control descendant, it trumps the form-wide `autocapitalize` setting. The non-deprecated values are available in iOS 5 and later. The default value is `sentences`. Possible values are:\n\n* `none`: Completely disables automatic capitalization\n* `sentences`: Automatically capitalize the first letter of sentences.\n* `words`: Automatically capitalize the first letter of words.\n* `characters`: Automatically capitalize all characters.\n* `on`: Deprecated since iOS 5.\n* `off`: Deprecated since iOS 5." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/form" } ] }, { "name": "label", "description": { "kind": "markdown", "value": "The label element represents a caption in a user interface. The caption can be associated with a specific form control, known as the label element's labeled control, either using the for attribute, or by putting the form control inside the label element itself." }, "attributes": [ { "name": "form", "description": { "kind": "markdown", "value": "The [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element with which the label is associated (its _form owner_). If specified, the value of the attribute is the `id` of a [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element in the same document. This lets you place label elements anywhere within a document, not just as descendants of their form elements." } }, { "name": "for", "description": { "kind": "markdown", "value": "The [`id`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-id) of a [labelable](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Form_labelable) form-related element in the same document as the `<label>` element. The first element in the document with an `id` matching the value of the `for` attribute is the _labeled control_ for this label element, if it is a labelable element. If it is not labelable then the `for` attribute has no effect. If there are other elements which also match the `id` value, later in the document, they are not considered.\n\n**Note**: A `<label>` element can have both a `for` attribute and a contained control element, as long as the `for` attribute points to the contained control element." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/label" } ] }, { "name": "input", "description": { "kind": "markdown", "value": "The input element represents a typed data field, usually with a form control to allow the user to edit the data." }, "attributes": [ { "name": "accept" }, { "name": "alt" }, { "name": "autocomplete", "valueSet": "inputautocomplete" }, { "name": "autofocus", "valueSet": "v" }, { "name": "checked", "valueSet": "v" }, { "name": "dirname" }, { "name": "disabled", "valueSet": "v" }, { "name": "form" }, { "name": "formaction" }, { "name": "formenctype", "valueSet": "et" }, { "name": "formmethod", "valueSet": "fm" }, { "name": "formnovalidate", "valueSet": "v" }, { "name": "formtarget" }, { "name": "height" }, { "name": "inputmode", "valueSet": "im" }, { "name": "list" }, { "name": "max" }, { "name": "maxlength" }, { "name": "min" }, { "name": "minlength" }, { "name": "multiple", "valueSet": "v" }, { "name": "name" }, { "name": "pattern" }, { "name": "placeholder" }, { "name": "readonly", "valueSet": "v" }, { "name": "required", "valueSet": "v" }, { "name": "size" }, { "name": "src" }, { "name": "step" }, { "name": "type", "valueSet": "t" }, { "name": "value" }, { "name": "width" } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/input" } ] }, { "name": "button", "description": { "kind": "markdown", "value": "The button element represents a button labeled by its contents." }, "attributes": [ { "name": "autofocus", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute lets you specify that the button should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specified." } }, { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the user cannot interact with the button. If this attribute is not specified, the button inherits its setting from the containing element, for example [`<fieldset>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset \"The HTML <fieldset> element is used to group several controls as well as labels (<label>) within a web form.\"); if there is no containing element with the **disabled** attribute set, then the button is enabled.\n\nFirefox will, unlike other browsers, by default, [persist the dynamic disabled state](https://stackoverflow.com/questions/5985839/bug-with-firefox-disabled-attribute-of-input-not-resetting-when-refreshing) of a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") across page loads. Use the [`autocomplete`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-autocomplete) attribute to control this feature." } }, { "name": "form", "description": { "kind": "markdown", "value": "The form element that the button is associated with (its _form owner_). The value of the attribute must be the **id** attribute of a [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element in the same document. If this attribute is not specified, the `<button>` element will be associated to an ancestor [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element, if one exists. This attribute enables you to associate `<button>` elements to [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") elements anywhere within a document, not just as descendants of [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") elements." } }, { "name": "formaction", "description": { "kind": "markdown", "value": "The URI of a program that processes the information submitted by the button. If specified, it overrides the [`action`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-action) attribute of the button's form owner." } }, { "name": "formenctype", "valueSet": "et", "description": { "kind": "markdown", "value": "If the button is a submit button, this attribute specifies the type of content that is used to submit the form to the server. Possible values are:\n\n* `application/x-www-form-urlencoded`: The default value if the attribute is not specified.\n* `multipart/form-data`: Use this value if you are using an [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element with the [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type) attribute set to `file`.\n* `text/plain`\n\nIf this attribute is specified, it overrides the [`enctype`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-enctype) attribute of the button's form owner." } }, { "name": "formmethod", "valueSet": "fm", "description": { "kind": "markdown", "value": "If the button is a submit button, this attribute specifies the HTTP method that the browser uses to submit the form. Possible values are:\n\n* `post`: The data from the form are included in the body of the form and sent to the server.\n* `get`: The data from the form are appended to the **form** attribute URI, with a '?' as a separator, and the resulting URI is sent to the server. Use this method when the form has no side-effects and contains only ASCII characters.\n\nIf specified, this attribute overrides the [`method`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-method) attribute of the button's form owner." } }, { "name": "formnovalidate", "valueSet": "v", "description": { "kind": "markdown", "value": "If the button is a submit button, this Boolean attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the [`novalidate`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-novalidate) attribute of the button's form owner." } }, { "name": "formtarget", "description": { "kind": "markdown", "value": "If the button is a submit button, this attribute is a name or keyword indicating where to display the response that is received after submitting the form. This is a name of, or keyword for, a _browsing context_ (for example, tab, window, or inline frame). If this attribute is specified, it overrides the [`target`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-target) attribute of the button's form owner. The following keywords have special meanings:\n\n* `_self`: Load the response into the same browsing context as the current one. This value is the default if the attribute is not specified.\n* `_blank`: Load the response into a new unnamed browsing context.\n* `_parent`: Load the response into the parent browsing context of the current one. If there is no parent, this option behaves the same way as `_self`.\n* `_top`: Load the response into the top-level browsing context (that is, the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as `_self`." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name of the button, which is submitted with the form data." } }, { "name": "type", "valueSet": "bt", "description": { "kind": "markdown", "value": "The type of the button. Possible values are:\n\n* `submit`: The button submits the form data to the server. This is the default if the attribute is not specified, or if the attribute is dynamically changed to an empty or invalid value.\n* `reset`: The button resets all the controls to their initial values.\n* `button`: The button has no default behavior. It can have client-side scripts associated with the element's events, which are triggered when the events occur." } }, { "name": "value", "description": { "kind": "markdown", "value": "The initial value of the button. It defines the value associated with the button which is submitted with the form data. This value is passed to the server in params when the form is submitted." } }, { "name": "autocomplete", "description": "The use of this attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") is nonstandard and Firefox-specific. By default, unlike other browsers, [Firefox persists the dynamic disabled state](https://stackoverflow.com/questions/5985839/bug-with-firefox-disabled-attribute-of-input-not-resetting-when-refreshing) of a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") across page loads. Setting the value of this attribute to `off` (i.e. `autocomplete=\"off\"`) disables this feature. See [bug 654072](https://bugzilla.mozilla.org/show_bug.cgi?id=654072 \"if disabled state is changed with javascript, the normal state doesn't return after refreshing the page\")." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/button" } ] }, { "name": "select", "description": { "kind": "markdown", "value": "The select element represents a control for selecting amongst a set of options." }, "attributes": [ { "name": "autocomplete", "valueSet": "inputautocomplete", "description": { "kind": "markdown", "value": "A [`DOMString`](https://developer.mozilla.org/en-US/docs/Web/API/DOMString \"DOMString is a UTF-16 String. As JavaScript already uses such strings, DOMString is mapped directly to a String.\") providing a hint for a [user agent's](https://developer.mozilla.org/en-US/docs/Glossary/user_agent \"user agent's: A user agent is a computer program representing a person, for example, a browser in a Web context.\") autocomplete feature. See [The HTML autocomplete attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for a complete list of values and details on how to use autocomplete." } }, { "name": "autofocus", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute lets you specify that a form control should have input focus when the page loads. Only one form element in a document can have the `autofocus` attribute." } }, { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the user cannot interact with the control. If this attribute is not specified, the control inherits its setting from the containing element, for example `fieldset`; if there is no containing element with the `disabled` attribute set, then the control is enabled." } }, { "name": "form", "description": { "kind": "markdown", "value": "This attribute lets you specify the form element to which the select element is associated (that is, its \"form owner\"). If this attribute is specified, its value must be the same as the `id` of a form element in the same document. This enables you to place select elements anywhere within a document, not just as descendants of their form elements." } }, { "name": "multiple", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that multiple options can be selected in the list. If it is not specified, then only one option can be selected at a time. When `multiple` is specified, most browsers will show a scrolling list box instead of a single line dropdown." } }, { "name": "name", "description": { "kind": "markdown", "value": "This attribute is used to specify the name of the control." } }, { "name": "required", "valueSet": "v", "description": { "kind": "markdown", "value": "A Boolean attribute indicating that an option with a non-empty string value must be selected." } }, { "name": "size", "description": { "kind": "markdown", "value": "If the control is presented as a scrolling list box (e.g. when `multiple` is specified), this attribute represents the number of rows in the list that should be visible at one time. Browsers are not required to present a select element as a scrolled list box. The default value is 0.\n\n**Note:** According to the HTML5 specification, the default value for size should be 1; however, in practice, this has been found to break some web sites, and no other browser currently does that, so Mozilla has opted to continue to return 0 for the time being with Firefox." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/select" } ] }, { "name": "datalist", "description": { "kind": "markdown", "value": "The datalist element represents a set of option elements that represent predefined options for other controls. In the rendering, the datalist element represents nothing and it, along with its children, should be hidden." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/datalist" } ] }, { "name": "optgroup", "description": { "kind": "markdown", "value": "The optgroup element represents a group of option elements with a common label." }, "attributes": [ { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "If this Boolean attribute is set, none of the items in this option group is selectable. Often browsers grey out such control and it won't receive any browsing events, like mouse clicks or focus-related ones." } }, { "name": "label", "description": { "kind": "markdown", "value": "The name of the group of options, which the browser can use when labeling the options in the user interface. This attribute is mandatory if this element is used." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/optgroup" } ] }, { "name": "option", "description": { "kind": "markdown", "value": "The option element represents an option in a select element or as part of a list of suggestions in a datalist element." }, "attributes": [ { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "If this Boolean attribute is set, this option is not checkable. Often browsers grey out such control and it won't receive any browsing event, like mouse clicks or focus-related ones. If this attribute is not set, the element can still be disabled if one of its ancestors is a disabled [`<optgroup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup \"The HTML <optgroup> element creates a grouping of options within a <select> element.\") element." } }, { "name": "label", "description": { "kind": "markdown", "value": "This attribute is text for the label indicating the meaning of the option. If the `label` attribute isn't defined, its value is that of the element text content." } }, { "name": "selected", "valueSet": "v", "description": { "kind": "markdown", "value": "If present, this Boolean attribute indicates that the option is initially selected. If the `<option>` element is the descendant of a [`<select>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select \"The HTML <select> element represents a control that provides a menu of options\") element whose [`multiple`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple) attribute is not set, only one single `<option>` of this [`<select>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select \"The HTML <select> element represents a control that provides a menu of options\") element may have the `selected` attribute." } }, { "name": "value", "description": { "kind": "markdown", "value": "The content of this attribute represents the value to be submitted with the form, should this option be selected. If this attribute is omitted, the value is taken from the text content of the option element." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/option" } ] }, { "name": "textarea", "description": { "kind": "markdown", "value": "The textarea element represents a multiline plain text edit control for the element's raw value. The contents of the control represent the control's default value." }, "attributes": [ { "name": "autocomplete", "valueSet": "inputautocomplete", "description": { "kind": "markdown", "value": "This attribute indicates whether the value of the control can be automatically completed by the browser. Possible values are:\n\n* `off`: The user must explicitly enter a value into this field for every use, or the document provides its own auto-completion method; the browser does not automatically complete the entry.\n* `on`: The browser can automatically complete the value based on values that the user has entered during previous uses.\n\nIf the `autocomplete` attribute is not specified on a `<textarea>` element, then the browser uses the `autocomplete` attribute value of the `<textarea>` element's form owner. The form owner is either the [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element that this `<textarea>` element is a descendant of or the form element whose `id` is specified by the `form` attribute of the input element. For more information, see the [`autocomplete`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-autocomplete) attribute in [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\")." } }, { "name": "autofocus", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute lets you specify that a form control should have input focus when the page loads. Only one form-associated element in a document can have this attribute specified." } }, { "name": "cols", "description": { "kind": "markdown", "value": "The visible width of the text control, in average character widths. If it is specified, it must be a positive integer. If it is not specified, the default value is `20`." } }, { "name": "dirname" }, { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the user cannot interact with the control. If this attribute is not specified, the control inherits its setting from the containing element, for example [`<fieldset>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset \"The HTML <fieldset> element is used to group several controls as well as labels (<label>) within a web form.\"); if there is no containing element when the `disabled` attribute is set, the control is enabled." } }, { "name": "form", "description": { "kind": "markdown", "value": "The form element that the `<textarea>` element is associated with (its \"form owner\"). The value of the attribute must be the `id` of a form element in the same document. If this attribute is not specified, the `<textarea>` element must be a descendant of a form element. This attribute enables you to place `<textarea>` elements anywhere within a document, not just as descendants of form elements." } }, { "name": "inputmode", "valueSet": "im" }, { "name": "maxlength", "description": { "kind": "markdown", "value": "The maximum number of characters (unicode code points) that the user can enter. If this value isn't specified, the user can enter an unlimited number of characters." } }, { "name": "minlength", "description": { "kind": "markdown", "value": "The minimum number of characters (unicode code points) required that the user should enter." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name of the control." } }, { "name": "placeholder", "description": { "kind": "markdown", "value": "A hint to the user of what can be entered in the control. Carriage returns or line-feeds within the placeholder text must be treated as line breaks when rendering the hint.\n\n**Note:** Placeholders should only be used to show an example of the type of data that should be entered into a form; they are _not_ a substitute for a proper [`<label>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label \"The HTML <label> element represents a caption for an item in a user interface.\") element tied to the input. See [Labels and placeholders](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Labels_and_placeholders \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") in [<input>: The Input (Form Input) element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") for a full explanation." } }, { "name": "readonly", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the user cannot modify the value of the control. Unlike the `disabled` attribute, the `readonly` attribute does not prevent the user from clicking or selecting in the control. The value of a read-only control is still submitted with the form." } }, { "name": "required", "valueSet": "v", "description": { "kind": "markdown", "value": "This attribute specifies that the user must fill in a value before submitting a form." } }, { "name": "rows", "description": { "kind": "markdown", "value": "The number of visible text lines for the control." } }, { "name": "wrap", "valueSet": "w", "description": { "kind": "markdown", "value": "Indicates how the control wraps text. Possible values are:\n\n* `hard`: The browser automatically inserts line breaks (CR+LF) so that each line has no more than the width of the control; the `cols` attribute must also be specified for this to take effect.\n* `soft`: The browser ensures that all line breaks in the value consist of a CR+LF pair, but does not insert any additional line breaks.\n* `off` : Like `soft` but changes appearance to `white-space: pre` so line segments exceeding `cols` are not wrapped and the `<textarea>` becomes horizontally scrollable.\n\nIf this attribute is not specified, `soft` is its default value." } }, { "name": "autocapitalize", "description": "This is a non-standard attribute supported by WebKit on iOS (therefore nearly all browsers running on iOS, including Safari, Firefox, and Chrome), which controls whether and how the text value should be automatically capitalized as it is entered/edited by the user. The non-deprecated values are available in iOS 5 and later. Possible values are:\n\n* `none`: Completely disables automatic capitalization.\n* `sentences`: Automatically capitalize the first letter of sentences.\n* `words`: Automatically capitalize the first letter of words.\n* `characters`: Automatically capitalize all characters.\n* `on`: Deprecated since iOS 5.\n* `off`: Deprecated since iOS 5." }, { "name": "spellcheck", "description": "Specifies whether the `<textarea>` is subject to spell checking by the underlying browser/OS. the value can be:\n\n* `true`: Indicates that the element needs to have its spelling and grammar checked.\n* `default` : Indicates that the element is to act according to a default behavior, possibly based on the parent element's own `spellcheck` value.\n* `false` : Indicates that the element should not be spell checked." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/textarea" } ] }, { "name": "output", "description": { "kind": "markdown", "value": "The output element represents the result of a calculation performed by the application, or the result of a user action." }, "attributes": [ { "name": "for", "description": { "kind": "markdown", "value": "A space-separated list of other elements’ [`id`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id)s, indicating that those elements contributed input values to (or otherwise affected) the calculation." } }, { "name": "form", "description": { "kind": "markdown", "value": "The [form element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) that this element is associated with (its \"form owner\"). The value of the attribute must be an `id` of a form element in the same document. If this attribute is not specified, the output element must be a descendant of a form element. This attribute enables you to place output elements anywhere within a document, not just as descendants of their form elements." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name of the element, exposed in the [`HTMLFormElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement \"The HTMLFormElement interface represents a <form> element in the DOM; it allows access to and in some cases modification of aspects of the form, as well as access to its component elements.\") API." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/output" } ] }, { "name": "progress", "description": { "kind": "markdown", "value": "The progress element represents the completion progress of a task. The progress is either indeterminate, indicating that progress is being made but that it is not clear how much more work remains to be done before the task is complete (e.g. because the task is waiting for a remote host to respond), or the progress is a number in the range zero to a maximum, giving the fraction of work that has so far been completed." }, "attributes": [ { "name": "value", "description": { "kind": "markdown", "value": "This attribute specifies how much of the task that has been completed. It must be a valid floating point number between 0 and `max`, or between 0 and 1 if `max` is omitted. If there is no `value` attribute, the progress bar is indeterminate; this indicates that an activity is ongoing with no indication of how long it is expected to take." } }, { "name": "max", "description": { "kind": "markdown", "value": "This attribute describes how much work the task indicated by the `progress` element requires. The `max` attribute, if present, must have a value greater than zero and be a valid floating point number. The default value is 1." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/progress" } ] }, { "name": "meter", "description": { "kind": "markdown", "value": "The meter element represents a scalar measurement within a known range, or a fractional value; for example disk usage, the relevance of a query result, or the fraction of a voting population to have selected a particular candidate." }, "attributes": [ { "name": "value", "description": { "kind": "markdown", "value": "The current numeric value. This must be between the minimum and maximum values (`min` attribute and `max` attribute) if they are specified. If unspecified or malformed, the value is 0. If specified, but not within the range given by the `min` attribute and `max` attribute, the value is equal to the nearest end of the range.\n\n**Usage note:** Unless the `value` attribute is between `0` and `1` (inclusive), the `min` and `max` attributes should define the range so that the `value` attribute's value is within it." } }, { "name": "min", "description": { "kind": "markdown", "value": "The lower numeric bound of the measured range. This must be less than the maximum value (`max` attribute), if specified. If unspecified, the minimum value is 0." } }, { "name": "max", "description": { "kind": "markdown", "value": "The upper numeric bound of the measured range. This must be greater than the minimum value (`min` attribute), if specified. If unspecified, the maximum value is 1." } }, { "name": "low", "description": { "kind": "markdown", "value": "The upper numeric bound of the low end of the measured range. This must be greater than the minimum value (`min` attribute), and it also must be less than the high value and maximum value (`high` attribute and `max` attribute, respectively), if any are specified. If unspecified, or if less than the minimum value, the `low` value is equal to the minimum value." } }, { "name": "high", "description": { "kind": "markdown", "value": "The lower numeric bound of the high end of the measured range. This must be less than the maximum value (`max` attribute), and it also must be greater than the low value and minimum value (`low` attribute and **min** attribute, respectively), if any are specified. If unspecified, or if greater than the maximum value, the `high` value is equal to the maximum value." } }, { "name": "optimum", "description": { "kind": "markdown", "value": "This attribute indicates the optimal numeric value. It must be within the range (as defined by the `min` attribute and `max` attribute). When used with the `low` attribute and `high` attribute, it gives an indication where along the range is considered preferable. For example, if it is between the `min` attribute and the `low` attribute, then the lower range is considered preferred." } }, { "name": "form", "description": "This attribute associates the element with a `form` element that has ownership of the `meter` element. For example, a `meter` might be displaying a range corresponding to an `input` element of `type` _number_. This attribute is only used if the `meter` element is being used as a form-associated element; even then, it may be omitted if the element appears as a descendant of a `form` element." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/meter" } ] }, { "name": "fieldset", "description": { "kind": "markdown", "value": "The fieldset element represents a set of form controls optionally grouped under a common name." }, "attributes": [ { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "If this Boolean attribute is set, all form controls that are descendants of the `<fieldset>`, are disabled, meaning they are not editable and won't be submitted along with the `<form>`. They won't receive any browsing events, like mouse clicks or focus-related events. By default browsers display such controls grayed out. Note that form elements inside the [`<legend>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend \"The HTML <legend> element represents a caption for the content of its parent <fieldset>.\") element won't be disabled." } }, { "name": "form", "description": { "kind": "markdown", "value": "This attribute takes the value of the `id` attribute of a [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element you want the `<fieldset>` to be part of, even if it is not inside the form." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name associated with the group.\n\n**Note**: The caption for the fieldset is given by the first [`<legend>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend \"The HTML <legend> element represents a caption for the content of its parent <fieldset>.\") element nested inside it." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/fieldset" } ] }, { "name": "legend", "description": { "kind": "markdown", "value": "The legend element represents a caption for the rest of the contents of the legend element's parent fieldset element, if any." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/legend" } ] }, { "name": "details", "description": { "kind": "markdown", "value": "The details element represents a disclosure widget from which the user can obtain additional information or controls." }, "attributes": [ { "name": "open", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates whether or not the details — that is, the contents of the `<details>` element — are currently visible. The default, `false`, means the details are not visible." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/details" } ] }, { "name": "summary", "description": { "kind": "markdown", "value": "The summary element represents a summary, caption, or legend for the rest of the contents of the summary element's parent details element, if any." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/summary" } ] }, { "name": "dialog", "description": { "kind": "markdown", "value": "The dialog element represents a part of an application that a user interacts with to perform a task, for example a dialog box, inspector, or window." }, "attributes": [ { "name": "open", "description": "Indicates that the dialog is active and available for interaction. When the `open` attribute is not set, the dialog shouldn't be shown to the user." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/dialog" } ] }, { "name": "script", "description": { "kind": "markdown", "value": "The script element allows authors to include dynamic script and data blocks in their documents. The element does not represent content for the user." }, "attributes": [ { "name": "src", "description": { "kind": "markdown", "value": "This attribute specifies the URI of an external script; this can be used as an alternative to embedding a script directly within a document.\n\nIf a `script` element has a `src` attribute specified, it should not have a script embedded inside its tags." } }, { "name": "type", "description": { "kind": "markdown", "value": "This attribute indicates the type of script represented. The value of this attribute will be in one of the following categories:\n\n* **Omitted or a JavaScript MIME type:** For HTML5-compliant browsers this indicates the script is JavaScript. HTML5 specification urges authors to omit the attribute rather than provide a redundant MIME type. In earlier browsers, this identified the scripting language of the embedded or imported (via the `src` attribute) code. JavaScript MIME types are [listed in the specification](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#JavaScript_types).\n* **`module`:** For HTML5-compliant browsers the code is treated as a JavaScript module. The processing of the script contents is not affected by the `charset` and `defer` attributes. For information on using `module`, see [ES6 in Depth: Modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/). Code may behave differently when the `module` keyword is used.\n* **Any other value:** The embedded content is treated as a data block which won't be processed by the browser. Developers must use a valid MIME type that is not a JavaScript MIME type to denote data blocks. The `src` attribute will be ignored.\n\n**Note:** in Firefox you could specify the version of JavaScript contained in a `<script>` element by including a non-standard `version` parameter inside the `type` attribute — for example `type=\"text/javascript;version=1.8\"`. This has been removed in Firefox 59 (see [bug 1428745](https://bugzilla.mozilla.org/show_bug.cgi?id=1428745 \"FIXED: Remove support for version parameter from script loader\"))." } }, { "name": "charset" }, { "name": "async", "valueSet": "v", "description": { "kind": "markdown", "value": "This is a Boolean attribute indicating that the browser should, if possible, load the script asynchronously.\n\nThis attribute must not be used if the `src` attribute is absent (i.e. for inline scripts). If it is included in this case it will have no effect.\n\nBrowsers usually assume the worst case scenario and load scripts synchronously, (i.e. `async=\"false\"`) during HTML parsing.\n\nDynamically inserted scripts (using [`document.createElement()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement \"In an HTML document, the document.createElement() method creates the HTML element specified by tagName, or an HTMLUnknownElement if tagName isn't recognized.\")) load asynchronously by default, so to turn on synchronous loading (i.e. scripts load in the order they were inserted) set `async=\"false\"`.\n\nSee [Browser compatibility](#Browser_compatibility) for notes on browser support. See also [Async scripts for asm.js](https://developer.mozilla.org/en-US/docs/Games/Techniques/Async_scripts)." } }, { "name": "defer", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded \"/en-US/docs/Web/Events/DOMContentLoaded\").\n\nScripts with the `defer` attribute will prevent the `DOMContentLoaded` event from firing until the script has loaded and finished evaluating.\n\nThis attribute must not be used if the `src` attribute is absent (i.e. for inline scripts), in this case it would have no effect.\n\nTo achieve a similar effect for dynamically inserted scripts use `async=\"false\"` instead. Scripts with the `defer` attribute will execute in the order in which they appear in the document." } }, { "name": "crossorigin", "valueSet": "xo", "description": { "kind": "markdown", "value": "Normal `script` elements pass minimal information to the [`window.onerror`](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror \"The onerror property of the GlobalEventHandlers mixin is an EventHandler that processes error events.\") for scripts which do not pass the standard [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS \"CORS: CORS (Cross-Origin Resource Sharing) is a system, consisting of transmitting HTTP headers, that determines whether browsers block frontend JavaScript code from accessing responses for cross-origin requests.\") checks. To allow error logging for sites which use a separate domain for static media, use this attribute. See [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for a more descriptive explanation of its valid arguments." } }, { "name": "nonce", "description": { "kind": "markdown", "value": "A cryptographic nonce (number used once) to whitelist inline scripts in a [script-src Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide a nonce that cannot be guessed as bypassing a resource's policy is otherwise trivial." } }, { "name": "integrity", "description": "This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation. See [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)." }, { "name": "nomodule", "description": "This Boolean attribute is set to indicate that the script should not be executed in browsers that support [ES2015 modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/) — in effect, this can be used to serve fallback scripts to older browsers that do not support modular JavaScript code." }, { "name": "referrerpolicy", "description": "Indicates which [referrer](https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer) to send when fetching the script, or resources fetched by the script:\n\n* `no-referrer`: The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent.\n* `no-referrer-when-downgrade` (default): The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent to [origin](https://developer.mozilla.org/en-US/docs/Glossary/origin \"origin: Web content's origin is defined by the scheme (protocol), host (domain), and port of the URL used to access it. Two objects have the same origin only when the scheme, host, and port all match.\")s without [TLS](https://developer.mozilla.org/en-US/docs/Glossary/TLS \"TLS: Transport Layer Security (TLS), previously known as Secure Sockets Layer (SSL), is a protocol used by applications to communicate securely across a network, preventing tampering with and eavesdropping on email, web browsing, messaging, and other protocols.\") ([HTTPS](https://developer.mozilla.org/en-US/docs/Glossary/HTTPS \"HTTPS: HTTPS (HTTP Secure) is an encrypted version of the HTTP protocol. It usually uses SSL or TLS to encrypt all communication between a client and a server. This secure connection allows clients to safely exchange sensitive data with a server, for example for banking activities or online shopping.\")).\n* `origin`: The sent referrer will be limited to the origin of the referring page: its [scheme](https://developer.mozilla.org/en-US/docs/Archive/Mozilla/URIScheme), [host](https://developer.mozilla.org/en-US/docs/Glossary/host \"host: A host is a device connected to the Internet (or a local network). Some hosts called servers offer additional services like serving webpages or storing files and emails.\"), and [port](https://developer.mozilla.org/en-US/docs/Glossary/port \"port: For a computer connected to a network with an IP address, a port is a communication endpoint. Ports are designated by numbers, and below 1024 each port is associated by default with a specific protocol.\").\n* `origin-when-cross-origin`: The referrer sent to other origins will be limited to the scheme, the host, and the port. Navigations on the same origin will still include the path.\n* `same-origin`: A referrer will be sent for [same origin](https://developer.mozilla.org/en-US/docs/Glossary/Same-origin_policy \"same origin: The same-origin policy is a critical security mechanism that restricts how a document or script loaded from one origin can interact with a resource from another origin.\"), but cross-origin requests will contain no referrer information.\n* `strict-origin`: Only send the origin of the document as the referrer when the protocol security level stays the same (e.g. HTTPS→HTTPS), but don't send it to a less secure destination (e.g. HTTPS→HTTP).\n* `strict-origin-when-cross-origin`: Send a full URL when performing a same-origin request, but only send the origin when the protocol security level stays the same (e.g.HTTPS→HTTPS), and send no header to a less secure destination (e.g. HTTPS→HTTP).\n* `unsafe-url`: The referrer will include the origin _and_ the path (but not the [fragment](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/hash), [password](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/password), or [username](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/username)). **This value is unsafe**, because it leaks origins and paths from TLS-protected resources to insecure origins.\n\n**Note**: An empty string value (`\"\"`) is both the default value, and a fallback value if `referrerpolicy` is not supported. If `referrerpolicy` is not explicitly specified on the `<script>` element, it will adopt a higher-level referrer policy, i.e. one set on the whole document or domain. If a higher-level policy is not available, the empty string is treated as being equivalent to `no-referrer-when-downgrade`." }, { "name": "text", "description": "Like the `textContent` attribute, this attribute sets the text content of the element. Unlike the `textContent` attribute, however, this attribute is evaluated as executable code after the node is inserted into the DOM." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/script" } ] }, { "name": "noscript", "description": { "kind": "markdown", "value": "The noscript element represents nothing if scripting is enabled, and represents its children if scripting is disabled. It is used to present different markup to user agents that support scripting and those that don't support scripting, by affecting how the document is parsed." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/noscript" } ] }, { "name": "template", "description": { "kind": "markdown", "value": "The template element is used to declare fragments of HTML that can be cloned and inserted in the document by script." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/template" } ] }, { "name": "canvas", "description": { "kind": "markdown", "value": "The canvas element provides scripts with a resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, art, or other visual images on the fly." }, "attributes": [ { "name": "width", "description": { "kind": "markdown", "value": "The width of the coordinate space in CSS pixels. Defaults to 300." } }, { "name": "height", "description": { "kind": "markdown", "value": "The height of the coordinate space in CSS pixels. Defaults to 150." } }, { "name": "moz-opaque", "description": "Lets the canvas know whether or not translucency will be a factor. If the canvas knows there's no translucency, painting performance can be optimized. This is only supported by Mozilla-based browsers; use the standardized [`canvas.getContext('2d', { alpha: false })`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext \"The HTMLCanvasElement.getContext() method returns a drawing context on the canvas, or null if the context identifier is not supported.\") instead." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/canvas" } ] } ], "globalAttributes": [ { "name": "accesskey", "description": { "kind": "markdown", "value": "Provides a hint for generating a keyboard shortcut for the current element. This attribute consists of a space-separated list of characters. The browser should use the first one that exists on the computer keyboard layout." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/accesskey" } ] }, { "name": "autocapitalize", "description": { "kind": "markdown", "value": "Controls whether and how text input is automatically capitalized as it is entered/edited by the user. It can have the following values:\n\n* `off` or `none`, no autocapitalization is applied (all letters default to lowercase)\n* `on` or `sentences`, the first letter of each sentence defaults to a capital letter; all other letters default to lowercase\n* `words`, the first letter of each word defaults to a capital letter; all other letters default to lowercase\n* `characters`, all letters should default to uppercase" }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/autocapitalize" } ] }, { "name": "class", "description": { "kind": "markdown", "value": "A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the [class selectors](/en-US/docs/Web/CSS/Class_selectors) or functions like the method [`Document.getElementsByClassName()`](/en-US/docs/Web/API/Document/getElementsByClassName \"returns an array-like object of all child elements which have all of the given class names.\")." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/class" } ] }, { "name": "contenteditable", "description": { "kind": "markdown", "value": "An enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing. The attribute must take one of the following values:\n\n* `true` or the _empty string_, which indicates that the element must be editable;\n* `false`, which indicates that the element must not be editable." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/contenteditable" } ] }, { "name": "contextmenu", "description": { "kind": "markdown", "value": "The `[**id**](#attr-id)` of a [`<menu>`](/en-US/docs/Web/HTML/Element/menu \"The HTML <menu> element represents a group of commands that a user can perform or activate. This includes both list menus, which might appear across the top of a screen, as well as context menus, such as those that might appear underneath a button after it has been clicked.\") to use as the contextual menu for this element." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/contextmenu" } ] }, { "name": "dir", "description": { "kind": "markdown", "value": "An enumerated attribute indicating the directionality of the element's text. It can have the following values:\n\n* `ltr`, which means _left to right_ and is to be used for languages that are written from the left to the right (like English);\n* `rtl`, which means _right to left_ and is to be used for languages that are written from the right to the left (like Arabic);\n* `auto`, which lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then it applies that directionality to the whole element." }, "valueSet": "d", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/dir" } ] }, { "name": "draggable", "description": { "kind": "markdown", "value": "An enumerated attribute indicating whether the element can be dragged, using the [Drag and Drop API](/en-us/docs/DragDrop/Drag_and_Drop). It can have the following values:\n\n* `true`, which indicates that the element may be dragged\n* `false`, which indicates that the element may not be dragged." }, "valueSet": "b", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/draggable" } ] }, { "name": "dropzone", "description": { "kind": "markdown", "value": "An enumerated attribute indicating what types of content can be dropped on an element, using the [Drag and Drop API](/en-US/docs/DragDrop/Drag_and_Drop). It can have the following values:\n\n* `copy`, which indicates that dropping will create a copy of the element that was dragged\n* `move`, which indicates that the element that was dragged will be moved to this new location.\n* `link`, will create a link to the dragged data." } }, { "name": "exportparts", "description": { "kind": "markdown", "value": "Used to transitively export shadow parts from a nested shadow tree into a containing light tree." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/exportparts" } ] }, { "name": "hidden", "description": { "kind": "markdown", "value": "A Boolean attribute indicates that the element is not yet, or is no longer, _relevant_. For example, it can be used to hide elements of the page that can't be used until the login process has been completed. The browser won't render such elements. This attribute must not be used to hide content that could legitimately be shown." }, "valueSet": "v", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/hidden" } ] }, { "name": "id", "description": { "kind": "markdown", "value": "Defines a unique identifier (ID) which must be unique in the whole document. Its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with CSS)." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/id" } ] }, { "name": "inputmode", "description": { "kind": "markdown", "value": "Provides a hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents. Used primarily on [`<input>`](/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") elements, but is usable on any element while in `[contenteditable](/en-US/docs/Web/HTML/Global_attributes#attr-contenteditable)` mode." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/inputmode" } ] }, { "name": "is", "description": { "kind": "markdown", "value": "Allows you to specify that a standard HTML element should behave like a registered custom built-in element (see [Using custom elements](/en-US/docs/Web/Web_Components/Using_custom_elements) for more details)." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/is" } ] }, { "name": "itemid", "description": { "kind": "markdown", "value": "The unique, global identifier of an item." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemid" } ] }, { "name": "itemprop", "description": { "kind": "markdown", "value": "Used to add properties to an item. Every HTML element may have an `itemprop` attribute specified, where an `itemprop` consists of a name and value pair." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemprop" } ] }, { "name": "itemref", "description": { "kind": "markdown", "value": "Properties that are not descendants of an element with the `itemscope` attribute can be associated with the item using an `itemref`. It provides a list of element ids (not `itemid`s) with additional properties elsewhere in the document." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemref" } ] }, { "name": "itemscope", "description": { "kind": "markdown", "value": "`itemscope` (usually) works along with `[itemtype](/en-US/docs/Web/HTML/Global_attributes#attr-itemtype)` to specify that the HTML contained in a block is about a particular item. `itemscope` creates the Item and defines the scope of the `itemtype` associated with it. `itemtype` is a valid URL of a vocabulary (such as [schema.org](https://schema.org/)) that describes the item and its properties context." }, "valueSet": "v", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemscope" } ] }, { "name": "itemtype", "description": { "kind": "markdown", "value": "Specifies the URL of the vocabulary that will be used to define `itemprop`s (item properties) in the data structure. `[itemscope](/en-US/docs/Web/HTML/Global_attributes#attr-itemscope)` is used to set the scope of where in the data structure the vocabulary set by `itemtype` will be active." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemtype" } ] }, { "name": "lang", "description": { "kind": "markdown", "value": "Helps define the language of an element: the language that non-editable elements are in, or the language that editable elements should be written in by the user. The attribute contains one “language tag” (made of hyphen-separated “language subtags”) in the format defined in [_Tags for Identifying Languages (BCP47)_](https://www.ietf.org/rfc/bcp/bcp47.txt). [**xml:lang**](#attr-xml:lang) has priority over it." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/lang" } ] }, { "name": "part", "description": { "kind": "markdown", "value": "A space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the [`::part`](/en-US/docs/Web/CSS/::part \"The ::part CSS pseudo-element represents any element within a shadow tree that has a matching part attribute.\") pseudo-element." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/part" } ] }, { "name": "role", "valueSet": "roles" }, { "name": "slot", "description": { "kind": "markdown", "value": "Assigns a slot in a [shadow DOM](/en-US/docs/Web/Web_Components/Shadow_DOM) shadow tree to an element: An element with a `slot` attribute is assigned to the slot created by the [`<slot>`](/en-US/docs/Web/HTML/Element/slot \"The HTML <slot> element—part of the Web Components technology suite—is a placeholder inside a web component that you can fill with your own markup, which lets you create separate DOM trees and present them together.\") element whose `[name](/en-US/docs/Web/HTML/Element/slot#attr-name)` attribute's value matches that `slot` attribute's value." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/slot" } ] }, { "name": "spellcheck", "description": { "kind": "markdown", "value": "An enumerated attribute defines whether the element may be checked for spelling errors. It may have the following values:\n\n* `true`, which indicates that the element should be, if possible, checked for spelling errors;\n* `false`, which indicates that the element should not be checked for spelling errors." }, "valueSet": "b", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/spellcheck" } ] }, { "name": "style", "description": { "kind": "markdown", "value": "Contains [CSS](/en-US/docs/Web/CSS) styling declarations to be applied to the element. Note that it is recommended for styles to be defined in a separate file or files. This attribute and the [`<style>`](/en-US/docs/Web/HTML/Element/style \"The HTML <style> element contains style information for a document, or part of a document.\") element have mainly the purpose of allowing for quick styling, for example for testing purposes." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/style" } ] }, { "name": "tabindex", "description": { "kind": "markdown", "value": "An integer attribute indicating if the element can take input focus (is _focusable_), if it should participate to sequential keyboard navigation, and if so, at what position. It can take several values:\n\n* a _negative value_ means that the element should be focusable, but should not be reachable via sequential keyboard navigation;\n* `0` means that the element should be focusable and reachable via sequential keyboard navigation, but its relative order is defined by the platform convention;\n* a _positive value_ means that the element should be focusable and reachable via sequential keyboard navigation; the order in which the elements are focused is the increasing value of the [**tabindex**](#attr-tabindex). If several elements share the same tabindex, their relative order follows their relative positions in the document." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/tabindex" } ] }, { "name": "title", "description": { "kind": "markdown", "value": "Contains a text representing advisory information related to the element it belongs to. Such information can typically, but not necessarily, be presented to the user as a tooltip." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/title" } ] }, { "name": "translate", "description": { "kind": "markdown", "value": "An enumerated attribute that is used to specify whether an element's attribute values and the values of its [`Text`](/en-US/docs/Web/API/Text \"The Text interface represents the textual content of Element or Attr. If an element has no markup within its content, it has a single child implementing Text that contains the element's text. However, if the element contains markup, it is parsed into information items and Text nodes that form its children.\") node children are to be translated when the page is localized, or whether to leave them unchanged. It can have the following values:\n\n* empty string and `yes`, which indicates that the element will be translated.\n* `no`, which indicates that the element will not be translated." }, "valueSet": "y", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/translate" } ] }, { "name": "onabort", "description": { "kind": "markdown", "value": "The loading of a resource has been aborted." } }, { "name": "onblur", "description": { "kind": "markdown", "value": "An element has lost focus (does not bubble)." } }, { "name": "oncanplay", "description": { "kind": "markdown", "value": "The user agent can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content." } }, { "name": "oncanplaythrough", "description": { "kind": "markdown", "value": "The user agent can play the media up to its end without having to stop for further buffering of content." } }, { "name": "onchange", "description": { "kind": "markdown", "value": "The change event is fired for <input>, <select>, and <textarea> elements when a change to the element's value is committed by the user." } }, { "name": "onclick", "description": { "kind": "markdown", "value": "A pointing device button has been pressed and released on an element." } }, { "name": "oncontextmenu", "description": { "kind": "markdown", "value": "The right button of the mouse is clicked (before the context menu is displayed)." } }, { "name": "ondblclick", "description": { "kind": "markdown", "value": "A pointing device button is clicked twice on an element." } }, { "name": "ondrag", "description": { "kind": "markdown", "value": "An element or text selection is being dragged (every 350ms)." } }, { "name": "ondragend", "description": { "kind": "markdown", "value": "A drag operation is being ended (by releasing a mouse button or hitting the escape key)." } }, { "name": "ondragenter", "description": { "kind": "markdown", "value": "A dragged element or text selection enters a valid drop target." } }, { "name": "ondragleave", "description": { "kind": "markdown", "value": "A dragged element or text selection leaves a valid drop target." } }, { "name": "ondragover", "description": { "kind": "markdown", "value": "An element or text selection is being dragged over a valid drop target (every 350ms)." } }, { "name": "ondragstart", "description": { "kind": "markdown", "value": "The user starts dragging an element or text selection." } }, { "name": "ondrop", "description": { "kind": "markdown", "value": "An element is dropped on a valid drop target." } }, { "name": "ondurationchange", "description": { "kind": "markdown", "value": "The duration attribute has been updated." } }, { "name": "onemptied", "description": { "kind": "markdown", "value": "The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it." } }, { "name": "onended", "description": { "kind": "markdown", "value": "Playback has stopped because the end of the media was reached." } }, { "name": "onerror", "description": { "kind": "markdown", "value": "A resource failed to load." } }, { "name": "onfocus", "description": { "kind": "markdown", "value": "An element has received focus (does not bubble)." } }, { "name": "onformchange" }, { "name": "onforminput" }, { "name": "oninput", "description": { "kind": "markdown", "value": "The value of an element changes or the content of an element with the attribute contenteditable is modified." } }, { "name": "oninvalid", "description": { "kind": "markdown", "value": "A submittable element has been checked and doesn't satisfy its constraints." } }, { "name": "onkeydown", "description": { "kind": "markdown", "value": "A key is pressed down." } }, { "name": "onkeypress", "description": { "kind": "markdown", "value": "A key is pressed down and that key normally produces a character value (use input instead)." } }, { "name": "onkeyup", "description": { "kind": "markdown", "value": "A key is released." } }, { "name": "onload", "description": { "kind": "markdown", "value": "A resource and its dependent resources have finished loading." } }, { "name": "onloadeddata", "description": { "kind": "markdown", "value": "The first frame of the media has finished loading." } }, { "name": "onloadedmetadata", "description": { "kind": "markdown", "value": "The metadata has been loaded." } }, { "name": "onloadstart", "description": { "kind": "markdown", "value": "Progress has begun." } }, { "name": "onmousedown", "description": { "kind": "markdown", "value": "A pointing device button (usually a mouse) is pressed on an element." } }, { "name": "onmousemove", "description": { "kind": "markdown", "value": "A pointing device is moved over an element." } }, { "name": "onmouseout", "description": { "kind": "markdown", "value": "A pointing device is moved off the element that has the listener attached or off one of its children." } }, { "name": "onmouseover", "description": { "kind": "markdown", "value": "A pointing device is moved onto the element that has the listener attached or onto one of its children." } }, { "name": "onmouseup", "description": { "kind": "markdown", "value": "A pointing device button is released over an element." } }, { "name": "onmousewheel" }, { "name": "onmouseenter", "description": { "kind": "markdown", "value": "A pointing device is moved onto the element that has the listener attached." } }, { "name": "onmouseleave", "description": { "kind": "markdown", "value": "A pointing device is moved off the element that has the listener attached." } }, { "name": "onpause", "description": { "kind": "markdown", "value": "Playback has been paused." } }, { "name": "onplay", "description": { "kind": "markdown", "value": "Playback has begun." } }, { "name": "onplaying", "description": { "kind": "markdown", "value": "Playback is ready to start after having been paused or delayed due to lack of data." } }, { "name": "onprogress", "description": { "kind": "markdown", "value": "In progress." } }, { "name": "onratechange", "description": { "kind": "markdown", "value": "The playback rate has changed." } }, { "name": "onreset", "description": { "kind": "markdown", "value": "A form is reset." } }, { "name": "onresize", "description": { "kind": "markdown", "value": "The document view has been resized." } }, { "name": "onreadystatechange", "description": { "kind": "markdown", "value": "The readyState attribute of a document has changed." } }, { "name": "onscroll", "description": { "kind": "markdown", "value": "The document view or an element has been scrolled." } }, { "name": "onseeked", "description": { "kind": "markdown", "value": "A seek operation completed." } }, { "name": "onseeking", "description": { "kind": "markdown", "value": "A seek operation began." } }, { "name": "onselect", "description": { "kind": "markdown", "value": "Some text is being selected." } }, { "name": "onshow", "description": { "kind": "markdown", "value": "A contextmenu event was fired on/bubbled to an element that has a contextmenu attribute" } }, { "name": "onstalled", "description": { "kind": "markdown", "value": "The user agent is trying to fetch media data, but data is unexpectedly not forthcoming." } }, { "name": "onsubmit", "description": { "kind": "markdown", "value": "A form is submitted." } }, { "name": "onsuspend", "description": { "kind": "markdown", "value": "Media data loading has been suspended." } }, { "name": "ontimeupdate", "description": { "kind": "markdown", "value": "The time indicated by the currentTime attribute has been updated." } }, { "name": "onvolumechange", "description": { "kind": "markdown", "value": "The volume has changed." } }, { "name": "onwaiting", "description": { "kind": "markdown", "value": "Playback has stopped because of a temporary lack of data." } }, { "name": "onpointercancel", "description": { "kind": "markdown", "value": "The pointer is unlikely to produce any more events." } }, { "name": "onpointerdown", "description": { "kind": "markdown", "value": "The pointer enters the active buttons state." } }, { "name": "onpointerenter", "description": { "kind": "markdown", "value": "Pointing device is moved inside the hit-testing boundary." } }, { "name": "onpointerleave", "description": { "kind": "markdown", "value": "Pointing device is moved out of the hit-testing boundary." } }, { "name": "onpointerlockchange", "description": { "kind": "markdown", "value": "The pointer was locked or released." } }, { "name": "onpointerlockerror", "description": { "kind": "markdown", "value": "It was impossible to lock the pointer for technical reasons or because the permission was denied." } }, { "name": "onpointermove", "description": { "kind": "markdown", "value": "The pointer changed coordinates." } }, { "name": "onpointerout", "description": { "kind": "markdown", "value": "The pointing device moved out of hit-testing boundary or leaves detectable hover range." } }, { "name": "onpointerover", "description": { "kind": "markdown", "value": "The pointing device is moved into the hit-testing boundary." } }, { "name": "onpointerup", "description": { "kind": "markdown", "value": "The pointer leaves the active buttons state." } }, { "name": "aria-activedescendant", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-activedescendant" } ], "description": { "kind": "markdown", "value": "Identifies the currently active element when DOM focus is on a [`composite`](https://www.w3.org/TR/wai-aria-1.1/#composite) widget, [`textbox`](https://www.w3.org/TR/wai-aria-1.1/#textbox), [`group`](https://www.w3.org/TR/wai-aria-1.1/#group), or [`application`](https://www.w3.org/TR/wai-aria-1.1/#application)." } }, { "name": "aria-atomic", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-atomic" } ], "description": { "kind": "markdown", "value": "Indicates whether [assistive technologies](https://www.w3.org/TR/wai-aria-1.1/#dfn-assistive-technology) will present all, or only parts of, the changed region based on the change notifications defined by the [`aria-relevant`](https://www.w3.org/TR/wai-aria-1.1/#aria-relevant) attribute." } }, { "name": "aria-autocomplete", "valueSet": "autocomplete", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-autocomplete" } ], "description": { "kind": "markdown", "value": "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made." } }, { "name": "aria-busy", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-busy" } ], "description": { "kind": "markdown", "value": "Indicates an element is being modified and that assistive technologies _MAY_ want to wait until the modifications are complete before exposing them to the user." } }, { "name": "aria-checked", "valueSet": "tristate", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-checked" } ], "description": { "kind": "markdown", "value": "Indicates the current \"checked\" [state](https://www.w3.org/TR/wai-aria-1.1/#dfn-state) of checkboxes, radio buttons, and other [widgets](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget). See related [`aria-pressed`](https://www.w3.org/TR/wai-aria-1.1/#aria-pressed) and [`aria-selected`](https://www.w3.org/TR/wai-aria-1.1/#aria-selected)." } }, { "name": "aria-colcount", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-colcount" } ], "description": { "kind": "markdown", "value": "Defines the total number of columns in a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-colindex`](https://www.w3.org/TR/wai-aria-1.1/#aria-colindex)." } }, { "name": "aria-colindex", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-colindex" } ], "description": { "kind": "markdown", "value": "Defines an [element's](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) column index or position with respect to the total number of columns within a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-colcount`](https://www.w3.org/TR/wai-aria-1.1/#aria-colcount) and [`aria-colspan`](https://www.w3.org/TR/wai-aria-1.1/#aria-colspan)." } }, { "name": "aria-colspan", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-colspan" } ], "description": { "kind": "markdown", "value": "Defines the number of columns spanned by a cell or gridcell within a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-colindex`](https://www.w3.org/TR/wai-aria-1.1/#aria-colindex) and [`aria-rowspan`](https://www.w3.org/TR/wai-aria-1.1/#aria-rowspan)." } }, { "name": "aria-controls", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-controls" } ], "description": { "kind": "markdown", "value": "Identifies the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) (or elements) whose contents or presence are controlled by the current element. See related [`aria-owns`](https://www.w3.org/TR/wai-aria-1.1/#aria-owns)." } }, { "name": "aria-current", "valueSet": "current", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-current" } ], "description": { "kind": "markdown", "value": "Indicates the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) that represents the current item within a container or set of related elements." } }, { "name": "aria-describedat", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-describedat" } ] }, { "name": "aria-describedby", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-describedby" } ], "description": { "kind": "markdown", "value": "Identifies the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) (or elements) that describes the [object](https://www.w3.org/TR/wai-aria-1.1/#dfn-object). See related [`aria-labelledby`](https://www.w3.org/TR/wai-aria-1.1/#aria-labelledby)." } }, { "name": "aria-disabled", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-disabled" } ], "description": { "kind": "markdown", "value": "Indicates that the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) is [perceivable](https://www.w3.org/TR/wai-aria-1.1/#dfn-perceivable) but disabled, so it is not editable or otherwise [operable](https://www.w3.org/TR/wai-aria-1.1/#dfn-operable). See related [`aria-hidden`](https://www.w3.org/TR/wai-aria-1.1/#aria-hidden) and [`aria-readonly`](https://www.w3.org/TR/wai-aria-1.1/#aria-readonly)." } }, { "name": "aria-dropeffect", "valueSet": "dropeffect", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-dropeffect" } ], "description": { "kind": "markdown", "value": "\\[Deprecated in ARIA 1.1\\] Indicates what functions can be performed when a dragged object is released on the drop target." } }, { "name": "aria-errormessage", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-errormessage" } ], "description": { "kind": "markdown", "value": "Identifies the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) that provides an error message for the [object](https://www.w3.org/TR/wai-aria-1.1/#dfn-object). See related [`aria-invalid`](https://www.w3.org/TR/wai-aria-1.1/#aria-invalid) and [`aria-describedby`](https://www.w3.org/TR/wai-aria-1.1/#aria-describedby)." } }, { "name": "aria-expanded", "valueSet": "u", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-expanded" } ], "description": { "kind": "markdown", "value": "Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed." } }, { "name": "aria-flowto", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-flowto" } ], "description": { "kind": "markdown", "value": "Identifies the next [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order." } }, { "name": "aria-grabbed", "valueSet": "u", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-grabbed" } ], "description": { "kind": "markdown", "value": "\\[Deprecated in ARIA 1.1\\] Indicates an element's \"grabbed\" [state](https://www.w3.org/TR/wai-aria-1.1/#dfn-state) in a drag-and-drop operation." } }, { "name": "aria-haspopup", "valueSet": "haspopup", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup" } ], "description": { "kind": "markdown", "value": "Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element)." } }, { "name": "aria-hidden", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-hidden" } ], "description": { "kind": "markdown", "value": "Indicates whether the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) is exposed to an accessibility API. See related [`aria-disabled`](https://www.w3.org/TR/wai-aria-1.1/#aria-disabled)." } }, { "name": "aria-invalid", "valueSet": "invalid", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-invalid" } ], "description": { "kind": "markdown", "value": "Indicates the entered value does not conform to the format expected by the application. See related [`aria-errormessage`](https://www.w3.org/TR/wai-aria-1.1/#aria-errormessage)." } }, { "name": "aria-kbdshortcuts", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-kbdshortcuts" } ] }, { "name": "aria-label", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-label" } ], "description": { "kind": "markdown", "value": "Defines a string value that labels the current element. See related [`aria-labelledby`](https://www.w3.org/TR/wai-aria-1.1/#aria-labelledby)." } }, { "name": "aria-labelledby", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-labelledby" } ], "description": { "kind": "markdown", "value": "Identifies the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) (or elements) that labels the current element. See related [`aria-describedby`](https://www.w3.org/TR/wai-aria-1.1/#aria-describedby)." } }, { "name": "aria-level", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-level" } ], "description": { "kind": "markdown", "value": "Defines the hierarchical level of an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) within a structure." } }, { "name": "aria-live", "valueSet": "live", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-live" } ], "description": { "kind": "markdown", "value": "Indicates that an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) will be updated, and describes the types of updates the [user agents](https://www.w3.org/TR/wai-aria-1.1/#dfn-user-agent), [assistive technologies](https://www.w3.org/TR/wai-aria-1.1/#dfn-assistive-technology), and user can expect from the [live region](https://www.w3.org/TR/wai-aria-1.1/#dfn-live-region)." } }, { "name": "aria-modal", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-modal" } ], "description": { "kind": "markdown", "value": "Indicates whether an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) is modal when displayed." } }, { "name": "aria-multiline", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-multiline" } ], "description": { "kind": "markdown", "value": "Indicates whether a text box accepts multiple lines of input or only a single line." } }, { "name": "aria-multiselectable", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-multiselectable" } ], "description": { "kind": "markdown", "value": "Indicates that the user may select more than one item from the current selectable descendants." } }, { "name": "aria-orientation", "valueSet": "orientation", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-orientation" } ], "description": { "kind": "markdown", "value": "Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous." } }, { "name": "aria-owns", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-owns" } ], "description": { "kind": "markdown", "value": "Identifies an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) (or elements) in order to define a visual, functional, or contextual parent/child [relationship](https://www.w3.org/TR/wai-aria-1.1/#dfn-relationship) between DOM elements where the DOM hierarchy cannot be used to represent the relationship. See related [`aria-controls`](https://www.w3.org/TR/wai-aria-1.1/#aria-controls)." } }, { "name": "aria-placeholder", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-placeholder" } ], "description": { "kind": "markdown", "value": "Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format." } }, { "name": "aria-posinset", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-posinset" } ], "description": { "kind": "markdown", "value": "Defines an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element)'s number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. See related [`aria-setsize`](https://www.w3.org/TR/wai-aria-1.1/#aria-setsize)." } }, { "name": "aria-pressed", "valueSet": "tristate", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-pressed" } ], "description": { "kind": "markdown", "value": "Indicates the current \"pressed\" [state](https://www.w3.org/TR/wai-aria-1.1/#dfn-state) of toggle buttons. See related [`aria-checked`](https://www.w3.org/TR/wai-aria-1.1/#aria-checked) and [`aria-selected`](https://www.w3.org/TR/wai-aria-1.1/#aria-selected)." } }, { "name": "aria-readonly", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-readonly" } ], "description": { "kind": "markdown", "value": "Indicates that the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) is not editable, but is otherwise [operable](https://www.w3.org/TR/wai-aria-1.1/#dfn-operable). See related [`aria-disabled`](https://www.w3.org/TR/wai-aria-1.1/#aria-disabled)." } }, { "name": "aria-relevant", "valueSet": "relevant", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-relevant" } ], "description": { "kind": "markdown", "value": "Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. See related [`aria-atomic`](https://www.w3.org/TR/wai-aria-1.1/#aria-atomic)." } }, { "name": "aria-required", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-required" } ], "description": { "kind": "markdown", "value": "Indicates that user input is required on the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) before a form may be submitted." } }, { "name": "aria-roledescription", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-roledescription" } ], "description": { "kind": "markdown", "value": "Defines a human-readable, author-localized description for the [role](https://www.w3.org/TR/wai-aria-1.1/#dfn-role) of an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element)." } }, { "name": "aria-rowcount", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-rowcount" } ], "description": { "kind": "markdown", "value": "Defines the total number of rows in a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-rowindex`](https://www.w3.org/TR/wai-aria-1.1/#aria-rowindex)." } }, { "name": "aria-rowindex", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-rowindex" } ], "description": { "kind": "markdown", "value": "Defines an [element's](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) row index or position with respect to the total number of rows within a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-rowcount`](https://www.w3.org/TR/wai-aria-1.1/#aria-rowcount) and [`aria-rowspan`](https://www.w3.org/TR/wai-aria-1.1/#aria-rowspan)." } }, { "name": "aria-rowspan", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-rowspan" } ], "description": { "kind": "markdown", "value": "Defines the number of rows spanned by a cell or gridcell within a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-rowindex`](https://www.w3.org/TR/wai-aria-1.1/#aria-rowindex) and [`aria-colspan`](https://www.w3.org/TR/wai-aria-1.1/#aria-colspan)." } }, { "name": "aria-selected", "valueSet": "u", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-selected" } ], "description": { "kind": "markdown", "value": "Indicates the current \"selected\" [state](https://www.w3.org/TR/wai-aria-1.1/#dfn-state) of various [widgets](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget). See related [`aria-checked`](https://www.w3.org/TR/wai-aria-1.1/#aria-checked) and [`aria-pressed`](https://www.w3.org/TR/wai-aria-1.1/#aria-pressed)." } }, { "name": "aria-setsize", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-setsize" } ], "description": { "kind": "markdown", "value": "Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. See related [`aria-posinset`](https://www.w3.org/TR/wai-aria-1.1/#aria-posinset)." } }, { "name": "aria-sort", "valueSet": "sort", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-sort" } ], "description": { "kind": "markdown", "value": "Indicates if items in a table or grid are sorted in ascending or descending order." } }, { "name": "aria-valuemax", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-valuemax" } ], "description": { "kind": "markdown", "value": "Defines the maximum allowed value for a range [widget](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget)." } }, { "name": "aria-valuemin", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-valuemin" } ], "description": { "kind": "markdown", "value": "Defines the minimum allowed value for a range [widget](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget)." } }, { "name": "aria-valuenow", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-valuenow" } ], "description": { "kind": "markdown", "value": "Defines the current value for a range [widget](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget). See related [`aria-valuetext`](https://www.w3.org/TR/wai-aria-1.1/#aria-valuetext)." } }, { "name": "aria-valuetext", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-valuetext" } ], "description": { "kind": "markdown", "value": "Defines the human readable text alternative of [`aria-valuenow`](https://www.w3.org/TR/wai-aria-1.1/#aria-valuenow) for a range [widget](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget)." } }, { "name": "aria-details", "description": { "kind": "markdown", "value": "Identifies the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) that provides a detailed, extended description for the [object](https://www.w3.org/TR/wai-aria-1.1/#dfn-object). See related [`aria-describedby`](https://www.w3.org/TR/wai-aria-1.1/#aria-describedby)." } }, { "name": "aria-keyshortcuts", "description": { "kind": "markdown", "value": "Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element." } } ], "valueSets": [ { "name": "b", "values": [ { "name": "true" }, { "name": "false" } ] }, { "name": "u", "values": [ { "name": "true" }, { "name": "false" }, { "name": "undefined" } ] }, { "name": "o", "values": [ { "name": "on" }, { "name": "off" } ] }, { "name": "y", "values": [ { "name": "yes" }, { "name": "no" } ] }, { "name": "w", "values": [ { "name": "soft" }, { "name": "hard" } ] }, { "name": "d", "values": [ { "name": "ltr" }, { "name": "rtl" }, { "name": "auto" } ] }, { "name": "m", "values": [ { "name": "get", "description": { "kind": "markdown", "value": "Corresponds to the HTTP [GET method](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3); form data are appended to the `action` attribute URI with a '?' as separator, and the resulting URI is sent to the server. Use this method when the form has no side-effects and contains only ASCII characters." } }, { "name": "post", "description": { "kind": "markdown", "value": "Corresponds to the HTTP [POST method](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5); form data are included in the body of the form and sent to the server." } }, { "name": "dialog", "description": { "kind": "markdown", "value": "Use when the form is inside a [`<dialog>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog) element to close the dialog when submitted." } } ] }, { "name": "fm", "values": [ { "name": "get" }, { "name": "post" } ] }, { "name": "s", "values": [ { "name": "row" }, { "name": "col" }, { "name": "rowgroup" }, { "name": "colgroup" } ] }, { "name": "t", "values": [ { "name": "hidden" }, { "name": "text" }, { "name": "search" }, { "name": "tel" }, { "name": "url" }, { "name": "email" }, { "name": "password" }, { "name": "datetime" }, { "name": "date" }, { "name": "month" }, { "name": "week" }, { "name": "time" }, { "name": "datetime-local" }, { "name": "number" }, { "name": "range" }, { "name": "color" }, { "name": "checkbox" }, { "name": "radio" }, { "name": "file" }, { "name": "submit" }, { "name": "image" }, { "name": "reset" }, { "name": "button" } ] }, { "name": "im", "values": [ { "name": "verbatim" }, { "name": "latin" }, { "name": "latin-name" }, { "name": "latin-prose" }, { "name": "full-width-latin" }, { "name": "kana" }, { "name": "kana-name" }, { "name": "katakana" }, { "name": "numeric" }, { "name": "tel" }, { "name": "email" }, { "name": "url" } ] }, { "name": "bt", "values": [ { "name": "button" }, { "name": "submit" }, { "name": "reset" }, { "name": "menu" } ] }, { "name": "lt", "values": [ { "name": "1" }, { "name": "a" }, { "name": "A" }, { "name": "i" }, { "name": "I" } ] }, { "name": "mt", "values": [ { "name": "context" }, { "name": "toolbar" } ] }, { "name": "mit", "values": [ { "name": "command" }, { "name": "checkbox" }, { "name": "radio" } ] }, { "name": "et", "values": [ { "name": "application/x-www-form-urlencoded" }, { "name": "multipart/form-data" }, { "name": "text/plain" } ] }, { "name": "tk", "values": [ { "name": "subtitles" }, { "name": "captions" }, { "name": "descriptions" }, { "name": "chapters" }, { "name": "metadata" } ] }, { "name": "pl", "values": [ { "name": "none" }, { "name": "metadata" }, { "name": "auto" } ] }, { "name": "sh", "values": [ { "name": "circle" }, { "name": "default" }, { "name": "poly" }, { "name": "rect" } ] }, { "name": "xo", "values": [ { "name": "anonymous" }, { "name": "use-credentials" } ] }, { "name": "sb", "values": [ { "name": "allow-forms" }, { "name": "allow-modals" }, { "name": "allow-pointer-lock" }, { "name": "allow-popups" }, { "name": "allow-popups-to-escape-sandbox" }, { "name": "allow-same-origin" }, { "name": "allow-scripts" }, { "name": "allow-top-navigation" } ] }, { "name": "tristate", "values": [ { "name": "true" }, { "name": "false" }, { "name": "mixed" }, { "name": "undefined" } ] }, { "name": "inputautocomplete", "values": [ { "name": "additional-name" }, { "name": "address-level1" }, { "name": "address-level2" }, { "name": "address-level3" }, { "name": "address-level4" }, { "name": "address-line1" }, { "name": "address-line2" }, { "name": "address-line3" }, { "name": "bday" }, { "name": "bday-year" }, { "name": "bday-day" }, { "name": "bday-month" }, { "name": "billing" }, { "name": "cc-additional-name" }, { "name": "cc-csc" }, { "name": "cc-exp" }, { "name": "cc-exp-month" }, { "name": "cc-exp-year" }, { "name": "cc-family-name" }, { "name": "cc-given-name" }, { "name": "cc-name" }, { "name": "cc-number" }, { "name": "cc-type" }, { "name": "country" }, { "name": "country-name" }, { "name": "current-password" }, { "name": "email" }, { "name": "family-name" }, { "name": "fax" }, { "name": "given-name" }, { "name": "home" }, { "name": "honorific-prefix" }, { "name": "honorific-suffix" }, { "name": "impp" }, { "name": "language" }, { "name": "mobile" }, { "name": "name" }, { "name": "new-password" }, { "name": "nickname" }, { "name": "organization" }, { "name": "organization-title" }, { "name": "pager" }, { "name": "photo" }, { "name": "postal-code" }, { "name": "sex" }, { "name": "shipping" }, { "name": "street-address" }, { "name": "tel-area-code" }, { "name": "tel" }, { "name": "tel-country-code" }, { "name": "tel-extension" }, { "name": "tel-local" }, { "name": "tel-local-prefix" }, { "name": "tel-local-suffix" }, { "name": "tel-national" }, { "name": "transaction-amount" }, { "name": "transaction-currency" }, { "name": "url" }, { "name": "username" }, { "name": "work" } ] }, { "name": "autocomplete", "values": [ { "name": "inline" }, { "name": "list" }, { "name": "both" }, { "name": "none" } ] }, { "name": "current", "values": [ { "name": "page" }, { "name": "step" }, { "name": "location" }, { "name": "date" }, { "name": "time" }, { "name": "true" }, { "name": "false" } ] }, { "name": "dropeffect", "values": [ { "name": "copy" }, { "name": "move" }, { "name": "link" }, { "name": "execute" }, { "name": "popup" }, { "name": "none" } ] }, { "name": "invalid", "values": [ { "name": "grammar" }, { "name": "false" }, { "name": "spelling" }, { "name": "true" } ] }, { "name": "live", "values": [ { "name": "off" }, { "name": "polite" }, { "name": "assertive" } ] }, { "name": "orientation", "values": [ { "name": "vertical" }, { "name": "horizontal" }, { "name": "undefined" } ] }, { "name": "relevant", "values": [ { "name": "additions" }, { "name": "removals" }, { "name": "text" }, { "name": "all" }, { "name": "additions text" } ] }, { "name": "sort", "values": [ { "name": "ascending" }, { "name": "descending" }, { "name": "none" }, { "name": "other" } ] }, { "name": "roles", "values": [ { "name": "alert" }, { "name": "alertdialog" }, { "name": "button" }, { "name": "checkbox" }, { "name": "dialog" }, { "name": "gridcell" }, { "name": "link" }, { "name": "log" }, { "name": "marquee" }, { "name": "menuitem" }, { "name": "menuitemcheckbox" }, { "name": "menuitemradio" }, { "name": "option" }, { "name": "progressbar" }, { "name": "radio" }, { "name": "scrollbar" }, { "name": "searchbox" }, { "name": "slider" }, { "name": "spinbutton" }, { "name": "status" }, { "name": "switch" }, { "name": "tab" }, { "name": "tabpanel" }, { "name": "textbox" }, { "name": "timer" }, { "name": "tooltip" }, { "name": "treeitem" }, { "name": "combobox" }, { "name": "grid" }, { "name": "listbox" }, { "name": "menu" }, { "name": "menubar" }, { "name": "radiogroup" }, { "name": "tablist" }, { "name": "tree" }, { "name": "treegrid" }, { "name": "application" }, { "name": "article" }, { "name": "cell" }, { "name": "columnheader" }, { "name": "definition" }, { "name": "directory" }, { "name": "document" }, { "name": "feed" }, { "name": "figure" }, { "name": "group" }, { "name": "heading" }, { "name": "img" }, { "name": "list" }, { "name": "listitem" }, { "name": "math" }, { "name": "none" }, { "name": "note" }, { "name": "presentation" }, { "name": "region" }, { "name": "row" }, { "name": "rowgroup" }, { "name": "rowheader" }, { "name": "separator" }, { "name": "table" }, { "name": "term" }, { "name": "text" }, { "name": "toolbar" }, { "name": "banner" }, { "name": "complementary" }, { "name": "contentinfo" }, { "name": "form" }, { "name": "main" }, { "name": "navigation" }, { "name": "region" }, { "name": "search" }, { "name": "doc-abstract" }, { "name": "doc-acknowledgments" }, { "name": "doc-afterword" }, { "name": "doc-appendix" }, { "name": "doc-backlink" }, { "name": "doc-biblioentry" }, { "name": "doc-bibliography" }, { "name": "doc-biblioref" }, { "name": "doc-chapter" }, { "name": "doc-colophon" }, { "name": "doc-conclusion" }, { "name": "doc-cover" }, { "name": "doc-credit" }, { "name": "doc-credits" }, { "name": "doc-dedication" }, { "name": "doc-endnote" }, { "name": "doc-endnotes" }, { "name": "doc-epigraph" }, { "name": "doc-epilogue" }, { "name": "doc-errata" }, { "name": "doc-example" }, { "name": "doc-footnote" }, { "name": "doc-foreword" }, { "name": "doc-glossary" }, { "name": "doc-glossref" }, { "name": "doc-index" }, { "name": "doc-introduction" }, { "name": "doc-noteref" }, { "name": "doc-notice" }, { "name": "doc-pagebreak" }, { "name": "doc-pagelist" }, { "name": "doc-part" }, { "name": "doc-preface" }, { "name": "doc-prologue" }, { "name": "doc-pullquote" }, { "name": "doc-qna" }, { "name": "doc-subtitle" }, { "name": "doc-tip" }, { "name": "doc-toc" } ] }, { "name": "metanames", "values": [ { "name": "application-name" }, { "name": "author" }, { "name": "description" }, { "name": "format-detection" }, { "name": "generator" }, { "name": "keywords" }, { "name": "publisher" }, { "name": "referrer" }, { "name": "robots" }, { "name": "theme-color" }, { "name": "viewport" } ] }, { "name": "haspopup", "values": [ { "name": "false", "description": { "kind": "markdown", "value": "(default) Indicates the element does not have a popup." } }, { "name": "true", "description": { "kind": "markdown", "value": "Indicates the popup is a menu." } }, { "name": "menu", "description": { "kind": "markdown", "value": "Indicates the popup is a menu." } }, { "name": "listbox", "description": { "kind": "markdown", "value": "Indicates the popup is a listbox." } }, { "name": "tree", "description": { "kind": "markdown", "value": "Indicates the popup is a tree." } }, { "name": "grid", "description": { "kind": "markdown", "value": "Indicates the popup is a grid." } }, { "name": "dialog", "description": { "kind": "markdown", "value": "Indicates the popup is a dialog." } } ] } ] }; var HTMLDataManager = (function () { function HTMLDataManager(options) { this.dataProviders = []; this.setDataProviders(options.useDefaultDataProvider !== false, options.customDataProviders || []); } HTMLDataManager.prototype.setDataProviders = function (builtIn, providers) { var _a; this.dataProviders = []; if (builtIn) { this.dataProviders.push(new HTMLDataProvider('html5', htmlData$1)); } (_a = this.dataProviders).push.apply(_a, providers); }; HTMLDataManager.prototype.getDataProviders = function () { return this.dataProviders; }; return HTMLDataManager; }()); var defaultLanguageServiceOptions$1 = {}; function getLanguageService(options) { if (options === void 0) { options = defaultLanguageServiceOptions$1; } var dataManager = new HTMLDataManager(options); var htmlHover = new HTMLHover(options, dataManager); var htmlCompletion = new HTMLCompletion(options, dataManager); return { setDataProviders: dataManager.setDataProviders.bind(dataManager), createScanner: createScanner$1, parseHTMLDocument: function (document) { return parse$5(document.getText()); }, doComplete: htmlCompletion.doComplete.bind(htmlCompletion), doComplete2: htmlCompletion.doComplete2.bind(htmlCompletion), setCompletionParticipants: htmlCompletion.setCompletionParticipants.bind(htmlCompletion), doHover: htmlHover.doHover.bind(htmlHover), format: format, findDocumentHighlights: findDocumentHighlights, findDocumentLinks: findDocumentLinks, findDocumentSymbols: findDocumentSymbols, getFoldingRanges: getFoldingRanges$1, getSelectionRanges: getSelectionRanges$2, doTagComplete: htmlCompletion.doTagComplete.bind(htmlCompletion), doRename: doRename, findMatchingTagPosition: findMatchingTagPosition, findOnTypeRenameRanges: findLinkedEditingRanges, findLinkedEditingRanges: findLinkedEditingRanges }; } function newHTMLDataProvider(id, customData) { return new HTMLDataProvider(id, customData); } function getDefaultHTMLDataProvider() { return newHTMLDataProvider('default', htmlData$1); } var htmlLanguageService = /*#__PURE__*/Object.freeze({ __proto__: null, getLanguageService: getLanguageService, newHTMLDataProvider: newHTMLDataProvider, getDefaultHTMLDataProvider: getDefaultHTMLDataProvider, get TextDocument () { return TextDocument; }, get Position () { return Position; }, get Range () { return Range; }, get Location () { return Location; }, get MarkupContent () { return MarkupContent; }, get MarkupKind () { return MarkupKind; }, get MarkedString () { return MarkedString; }, get SelectionRange () { return SelectionRange; }, get WorkspaceEdit () { return WorkspaceEdit; }, get CompletionList () { return CompletionList; }, get CompletionItemKind () { return CompletionItemKind; }, get CompletionItem () { return CompletionItem; }, get CompletionItemTag () { return CompletionItemTag; }, get InsertTextMode () { return InsertTextMode; }, get Command () { return Command; }, get SymbolInformation () { return SymbolInformation; }, get SymbolKind () { return SymbolKind; }, get Hover () { return Hover; }, get TextEdit () { return TextEdit; }, get InsertReplaceEdit () { return InsertReplaceEdit; }, get InsertTextFormat () { return InsertTextFormat; }, get DocumentHighlight () { return DocumentHighlight; }, get DocumentHighlightKind () { return DocumentHighlightKind; }, get DocumentLink () { return DocumentLink; }, get FoldingRange () { return FoldingRange; }, get FoldingRangeKind () { return FoldingRangeKind; }, get Diagnostic () { return Diagnostic; }, get FormattingOptions () { return FormattingOptions; }, get Color () { return Color; }, get ColorInformation () { return ColorInformation; }, get ColorPresentation () { return ColorPresentation; }, get TokenType () { return TokenType$1; }, get ScannerState () { return ScannerState; }, get ClientCapabilities () { return ClientCapabilities$1; }, get FileType () { return FileType$2; } }); var vscode_html_languageservice_1 = /*@__PURE__*/getAugmentedNamespace(htmlLanguageService); var parseHtml_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getAttributeContextAtPosition = exports.parseHtml = void 0; const parser = (0, vscode_html_languageservice_1.getLanguageService)(); function parseHtml(text) { const preprocessed = preprocess(text); const parsedDoc = parser.parseHTMLDocument({ getText: () => preprocessed }); return parsedDoc; } exports.parseHtml = parseHtml; const createScanner = parser.createScanner; function preprocess(text) { let scanner = createScanner(text); let token = scanner.scan(); let currentStartTagStart = null; while (token !== vscode_html_languageservice_1.TokenType.EOS) { const offset = scanner.getTokenOffset(); if (token === vscode_html_languageservice_1.TokenType.StartTagOpen) { if (shouldBlankStartOrEndTagLike(offset)) { blankStartOrEndTagLike(offset); } else { currentStartTagStart = offset; } } if (token === vscode_html_languageservice_1.TokenType.StartTagClose) { if (shouldBlankStartOrEndTagLike(offset)) { blankStartOrEndTagLike(offset); } else { currentStartTagStart = null; } } if (token === vscode_html_languageservice_1.TokenType.StartTagSelfClose) { currentStartTagStart = null; } if (token === vscode_html_languageservice_1.TokenType.Unknown && scanner.getScannerState() === vscode_html_languageservice_1.ScannerState.WithinTag && scanner.getTokenText() === '<' && shouldBlankStartOrEndTagLike(offset)) { blankStartOrEndTagLike(offset); } token = scanner.scan(); } return text; function shouldBlankStartOrEndTagLike(offset) { return (0, utils$3.isInsideMoustacheTag)(text, currentStartTagStart, offset); } function blankStartOrEndTagLike(offset) { text = text.substring(0, offset) + ' ' + text.substring(offset + 1); scanner = createScanner(text, offset, vscode_html_languageservice_1.ScannerState.WithinTag); } } function getAttributeContextAtPosition(document, position) { const offset = document.offsetAt(position); const { html } = document; const tag = html.findNodeAt(offset); if (!inStartTag(offset, tag) || !tag.attributes) { return null; } const text = document.getText(); const beforeStartTagEnd = text.substring(0, tag.start) + preprocess(text.substring(tag.start, tag.startTagEnd)); const scanner = createScanner(beforeStartTagEnd, tag.start); let token = scanner.scan(); let currentAttributeName; const inTokenRange = () => scanner.getTokenOffset() <= offset && offset <= scanner.getTokenEnd(); while (token != vscode_html_languageservice_1.TokenType.EOS) { if (token === vscode_html_languageservice_1.TokenType.AttributeName) { currentAttributeName = scanner.getTokenText(); if (inTokenRange()) { return { elementTag: tag, name: currentAttributeName, inValue: false }; } } else if (token === vscode_html_languageservice_1.TokenType.DelimiterAssign) { if (scanner.getTokenEnd() === offset && currentAttributeName) { const nextToken = scanner.scan(); return { elementTag: tag, name: currentAttributeName, inValue: true, valueRange: [ offset, nextToken === vscode_html_languageservice_1.TokenType.AttributeValue ? scanner.getTokenEnd() : offset ] }; } } else if (token === vscode_html_languageservice_1.TokenType.AttributeValue) { if (inTokenRange() && currentAttributeName) { let start = scanner.getTokenOffset(); let end = scanner.getTokenEnd(); const char = text[start]; if (char === '"' || char === "'") { start++; end--; } return { elementTag: tag, name: currentAttributeName, inValue: true, valueRange: [start, end] }; } currentAttributeName = undefined; } token = scanner.scan(); } return null; } exports.getAttributeContextAtPosition = getAttributeContextAtPosition; function inStartTag(offset, node) { return offset > node.start && node.startTagEnd != undefined && offset < node.startTagEnd; } }); getDefaultExportFromCjs(parseHtml_1); var utils$3 = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isInsideMoustacheTag = exports.getLangAttribute = exports.toRange = exports.getWordAt = exports.getWordRangeAt = exports.isInHTMLTagRange = exports.getNodeIfIsInStartTag = exports.getNodeIfIsInHTMLStartTag = exports.getNodeIfIsInComponentStartTag = exports.updateRelativeImport = exports.isAtEndOfLine = exports.getLineAtPosition = exports.getTextInRange = exports.isRangeInTag = exports.isInTag = exports.getLineOffsets = exports.offsetAt = exports.positionAt = exports.extractTemplateTag = exports.extractStyleTag = exports.extractScriptTags = void 0; const path = __importStar(path__default['default']); function parseAttributes(rawAttrs) { const attrs = {}; if (!rawAttrs) { return attrs; } Object.keys(rawAttrs).forEach((attrName) => { const attrValue = rawAttrs[attrName]; attrs[attrName] = attrValue === null ? attrName : removeOuterQuotes(attrValue); }); return attrs; function removeOuterQuotes(attrValue) { if ((attrValue.startsWith('"') && attrValue.endsWith('"')) || (attrValue.startsWith("'") && attrValue.endsWith("'"))) { return attrValue.slice(1, attrValue.length - 1); } return attrValue; } } const regexIf = new RegExp('{\\s*#if\\s.*?}', 'gms'); const regexIfEnd = new RegExp('{\\s*/if}', 'gms'); const regexEach = new RegExp('{\\s*#each\\s.*?}', 'gms'); const regexEachEnd = new RegExp('{\\s*/each}', 'gms'); const regexAwait = new RegExp('{\\s*#await\\s.*?}', 'gms'); const regexAwaitEnd = new RegExp('{\\s*/await}', 'gms'); const regexHtml = new RegExp('{\\s*@html\\s.*?', 'gms'); function extractTags(text, tag, html) { const rootNodes = (html === null || html === void 0 ? void 0 : html.roots) || (0, parseHtml_1.parseHtml)(text).roots; const matchedNodes = rootNodes .filter((node) => node.tag === tag) .filter((tag) => { return isNotInsideControlFlowTag(tag) && isNotInsideHtmlTag(tag); }); return matchedNodes.map(transformToTagInfo); function isNotInsideControlFlowTag(tag) { const nodes = rootNodes.slice(rootNodes.indexOf(tag)); const rootContentAfterTag = nodes .map((node, idx) => { var _a, _b; const start = node.startTagEnd ? node.end : node.start + (((_a = node.tag) === null || _a === void 0 ? void 0 : _a.length) || 0); return text.substring(start, (_b = nodes[idx + 1]) === null || _b === void 0 ? void 0 : _b.start); }) .join(''); return ![ [regexIf, regexIfEnd], [regexEach, regexEachEnd], [regexAwait, regexAwaitEnd] ].some((pair) => { var _a, _b; pair[0].lastIndex = 0; pair[1].lastIndex = 0; const start = pair[0].exec(rootContentAfterTag); const end = pair[1].exec(rootContentAfterTag); return ((_a = end === null || end === void 0 ? void 0 : end.index) !== null && _a !== void 0 ? _a : text.length) < ((_b = start === null || start === void 0 ? void 0 : start.index) !== null && _b !== void 0 ? _b : text.length); }); } function isNotInsideHtmlTag(tag) { const nodes = rootNodes.slice(0, rootNodes.indexOf(tag)); const rootContentBeforeTag = [{ start: 0, end: 0 }, ...nodes] .map((node, idx) => { var _a; return text.substring(node.end, (_a = nodes[idx]) === null || _a === void 0 ? void 0 : _a.start); }) .join(''); return !((0, utils$4.regexLastIndexOf)(rootContentBeforeTag, regexHtml) > rootContentBeforeTag.lastIndexOf('}')); } function transformToTagInfo(matchedNode) { var _a, _b; const start = (_a = matchedNode.startTagEnd) !== null && _a !== void 0 ? _a : matchedNode.start; const end = (_b = matchedNode.endTagStart) !== null && _b !== void 0 ? _b : matchedNode.end; const startPos = positionAt(start, text); const endPos = positionAt(end, text); const container = { start: matchedNode.start, end: matchedNode.end }; const content = text.substring(start, end); return { content, attributes: parseAttributes(matchedNode.attributes), start, end, startPos, endPos, container }; } } function extractScriptTags(source, html) { const scripts = extractTags(source, 'script', html); if (!scripts.length) { return null; } const script = scripts.find((s) => s.attributes['context'] !== 'module'); const moduleScript = scripts.find((s) => s.attributes['context'] === 'module'); return { script, moduleScript }; } exports.extractScriptTags = extractScriptTags; function extractStyleTag(source, html) { const styles = extractTags(source, 'style', html); if (!styles.length) { return null; } return styles[0]; } exports.extractStyleTag = extractStyleTag; function extractTemplateTag(source, html) { const templates = extractTags(source, 'template', html); if (!templates.length) { return null; } return templates[0]; } exports.extractTemplateTag = extractTemplateTag; function positionAt(offset, text, lineOffsets = getLineOffsets(text)) { offset = (0, utils$4.clamp)(offset, 0, text.length); let low = 0; let high = lineOffsets.length; if (high === 0) { return main$4.Position.create(0, offset); } while (low <= high) { const mid = Math.floor((low + high) / 2); const lineOffset = lineOffsets[mid]; if (lineOffset === offset) { return main$4.Position.create(mid, 0); } else if (offset > lineOffset) { low = mid + 1; } else { high = mid - 1; } } const line = low - 1; return main$4.Position.create(line, offset - lineOffsets[line]); } exports.positionAt = positionAt; function offsetAt(position, text, lineOffsets = getLineOffsets(text)) { if (position.line >= lineOffsets.length) { return text.length; } else if (position.line < 0) { return 0; } const lineOffset = lineOffsets[position.line]; const nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : text.length; return (0, utils$4.clamp)(nextLineOffset, lineOffset, lineOffset + position.character); } exports.offsetAt = offsetAt; function getLineOffsets(text) { const lineOffsets = []; let isLineStart = true; for (let i = 0; i < text.length; i++) { if (isLineStart) { lineOffsets.push(i); isLineStart = false; } const ch = text.charAt(i); isLineStart = ch === '\r' || ch === '\n'; if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') { i++; } } if (isLineStart && text.length > 0) { lineOffsets.push(text.length); } return lineOffsets; } exports.getLineOffsets = getLineOffsets; function isInTag(position, tagInfo) { return !!tagInfo && (0, utils$4.isInRange)(main$4.Range.create(tagInfo.startPos, tagInfo.endPos), position); } exports.isInTag = isInTag; function isRangeInTag(range, tagInfo) { return isInTag(range.start, tagInfo) && isInTag(range.end, tagInfo); } exports.isRangeInTag = isRangeInTag; function getTextInRange(range, text) { return text.substring(offsetAt(range.start, text), offsetAt(range.end, text)); } exports.getTextInRange = getTextInRange; function getLineAtPosition(position, text) { return text.substring(offsetAt({ line: position.line, character: 0 }, text), offsetAt({ line: position.line, character: Number.MAX_VALUE }, text)); } exports.getLineAtPosition = getLineAtPosition; function isAtEndOfLine(line, offset) { return [undefined, '\r', '\n'].includes(line[offset]); } exports.isAtEndOfLine = isAtEndOfLine; function updateRelativeImport(oldPath, newPath, relativeImportPath) { let newImportPath = path .join(path.relative(newPath, oldPath), relativeImportPath) .replace(/\\/g, '/'); if (!newImportPath.startsWith('.')) { newImportPath = './' + newImportPath; } return newImportPath; } exports.updateRelativeImport = updateRelativeImport; function getNodeIfIsInComponentStartTag(html, offset) { const node = html.findNodeAt(offset); if (!!node.tag && node.tag[0] === node.tag[0].toUpperCase() && (!node.startTagEnd || offset < node.startTagEnd)) { return node; } } exports.getNodeIfIsInComponentStartTag = getNodeIfIsInComponentStartTag; function getNodeIfIsInHTMLStartTag(html, offset) { const node = html.findNodeAt(offset); if (!!node.tag && node.tag[0] === node.tag[0].toLowerCase() && (!node.startTagEnd || offset < node.startTagEnd)) { return node; } } exports.getNodeIfIsInHTMLStartTag = getNodeIfIsInHTMLStartTag; function getNodeIfIsInStartTag(html, offset) { const node = html.findNodeAt(offset); if (!!node.tag && (!node.startTagEnd || offset < node.startTagEnd)) { return node; } } exports.getNodeIfIsInStartTag = getNodeIfIsInStartTag; function isInHTMLTagRange(html, offset) { const node = html.findNodeAt(offset); return (!!node.tag && node.tag[0] === node.tag[0].toLowerCase() && (node.start + node.tag.length + 1 >= offset || (!!node.endTagStart && node.endTagStart <= offset))); } exports.isInHTMLTagRange = isInHTMLTagRange; function getWordRangeAt(str, pos, delimiterRegex = { left: /\S+$/, right: /\s/ }) { let start = str.slice(0, pos).search(delimiterRegex.left); if (start < 0) { start = pos; } let end = str.slice(pos).search(delimiterRegex.right); if (end < 0) { end = str.length; } else { end = end + pos; } return { start, end }; } exports.getWordRangeAt = getWordRangeAt; function getWordAt(str, pos, delimiterRegex = { left: /\S+$/, right: /\s/ }) { const { start, end } = getWordRangeAt(str, pos, delimiterRegex); return str.slice(start, end); } exports.getWordAt = getWordAt; function toRange(str, start, end) { return main$4.Range.create(positionAt(start, str), positionAt(end, str)); } exports.toRange = toRange; function getLangAttribute(...tags) { const tag = tags.find((tag) => (tag === null || tag === void 0 ? void 0 : tag.attributes.lang) || (tag === null || tag === void 0 ? void 0 : tag.attributes.type)); if (!tag) { return null; } const attribute = tag.attributes.lang || tag.attributes.type; if (!attribute) { return null; } return attribute.replace(/^text\//, ''); } exports.getLangAttribute = getLangAttribute; function isInsideMoustacheTag(html, tagStart, position) { if (tagStart === null) { const charactersBeforePosition = html.substring(0, position); return (Math.max( charactersBeforePosition.lastIndexOf('{#'), charactersBeforePosition.lastIndexOf('{:'), charactersBeforePosition.lastIndexOf('{@')) > charactersBeforePosition.lastIndexOf('}')); } else { const charactersInNode = html.substring(tagStart, position); return charactersInNode.lastIndexOf('{') > charactersInNode.lastIndexOf('}'); } } exports.isInsideMoustacheTag = isInsideMoustacheTag; }); getDefaultExportFromCjs(utils$3); var DocumentBase = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.WritableDocument = exports.ReadableDocument = void 0; class ReadableDocument { constructor() { this.version = 0; } getTextLength() { return this.getText().length; } positionAt(offset) { return (0, utils$3.positionAt)(offset, this.getText(), this.getLineOffsets()); } offsetAt(position) { return (0, utils$3.offsetAt)(position, this.getText(), this.getLineOffsets()); } getLineOffsets() { if (!this.lineOffsets) { this.lineOffsets = (0, utils$3.getLineOffsets)(this.getText()); } return this.lineOffsets; } get uri() { return this.getURL(); } get lineCount() { return this.getText().split(/\r?\n/).length; } } exports.ReadableDocument = ReadableDocument; class WritableDocument extends ReadableDocument { update(text, start, end) { this.lineOffsets = undefined; const content = this.getText(); this.setText(content.slice(0, start) + text + content.slice(end)); } } exports.WritableDocument = WritableDocument; }); getDefaultExportFromCjs(DocumentBase); var logger = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Logger = void 0; class Logger { static setLogErrorsOnly(logErrorsOnly) { Logger.logErrorsOnly = logErrorsOnly; } static log(...args) { if (!Logger.logErrorsOnly) { console.log(...args); } } static error(...args) { console.error(...args); } } exports.Logger = Logger; Logger.logErrorsOnly = false; }); getDefaultExportFromCjs(logger); var importPackage = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.importSveltePreprocess = exports.importSvelte = exports.importPrettier = exports.getPackageInfo = exports.setIsTrusted = void 0; let isTrusted = true; function setIsTrusted(_isTrusted) { isTrusted = _isTrusted; } exports.setIsTrusted = setIsTrusted; function dynamicRequire(dynamicFileToRequire) { return require(dynamicFileToRequire); } function getPackageInfo(packageName, fromPath) { const paths = [__dirname]; if (isTrusted) { paths.unshift(fromPath); } const packageJSONPath = require.resolve(`${packageName}/package.json`, { paths }); const { version } = dynamicRequire(packageJSONPath); const [major, minor, patch] = version.split('.'); return { path: (0, path__default['default'].dirname)(packageJSONPath), version: { full: version, major: Number(major), minor: Number(minor), patch: Number(patch) } }; } exports.getPackageInfo = getPackageInfo; function importPrettier(fromPath) { const pkg = getPackageInfo('prettier', fromPath); const main = (0, path__default['default'].resolve)(pkg.path); logger.Logger.log('Using Prettier v' + pkg.version.full, 'from', main); return dynamicRequire(main); } exports.importPrettier = importPrettier; function importSvelte(fromPath) { const pkg = getPackageInfo('svelte', fromPath); const main = (0, path__default['default'].resolve)(pkg.path, 'compiler'); logger.Logger.log('Using Svelte v' + pkg.version.full, 'from', main); return dynamicRequire(main); } exports.importSvelte = importSvelte; function importSveltePreprocess(fromPath) { const pkg = getPackageInfo('svelte-preprocess', fromPath); const main = (0, path__default['default'].resolve)(pkg.path); logger.Logger.log('Using svelte-preprocess v' + pkg.version.full, 'from', main); return dynamicRequire(main); } exports.importSveltePreprocess = importSveltePreprocess; }); getDefaultExportFromCjs(importPackage); var configLoader = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.configLoader = exports.ConfigLoader = void 0; const fast_glob_1 = __importDefault(out); const path_1 = __importDefault(path__default['default']); const fs_1 = __importDefault(fs__default['default']); const DEFAULT_OPTIONS = { dev: true }; const NO_GENERATE = { generate: false }; const _dynamicImport = new Function('modulePath', 'return import(modulePath)'); class ConfigLoader { constructor(globSync, fs, path, dynamicImport) { this.globSync = globSync; this.fs = fs; this.path = path; this.dynamicImport = dynamicImport; this.configFiles = new Map(); this.configFilesAsync = new Map(); this.filePathToConfigPath = new Map(); this.disabled = false; } setDisabled(disabled) { this.disabled = disabled; } async loadConfigs(directory) { logger.Logger.log('Trying to load configs for', directory); try { const pathResults = this.globSync('**/svelte.config.{js,cjs,mjs}', { cwd: directory, ignore: ['**/node_modules/**'] }); const someConfigIsImmediateFileInDirectory = pathResults.length > 0 && pathResults.some((res) => !this.path.dirname(res)); if (!someConfigIsImmediateFileInDirectory) { const configPathUpwards = this.searchConfigPathUpwards(directory); if (configPathUpwards) { pathResults.push(this.path.relative(directory, configPathUpwards)); } } if (pathResults.length === 0) { this.addFallbackConfig(directory); return; } const promises = pathResults .map((pathResult) => this.path.join(directory, pathResult)) .filter((pathResult) => { const config = this.configFiles.get(pathResult); return !config || config.loadConfigError; }) .map(async (pathResult) => { await this.loadAndCacheConfig(pathResult, directory); }); await Promise.all(promises); } catch (e) { logger.Logger.error(e); } } addFallbackConfig(directory) { const fallback = this.useFallbackPreprocessor(directory, false); const path = this.path.join(directory, 'svelte.config.js'); this.configFilesAsync.set(path, Promise.resolve(fallback)); this.configFiles.set(path, fallback); } searchConfigPathUpwards(path) { let currentDir = path; let nextDir = this.path.dirname(path); while (currentDir !== nextDir) { const tryFindConfigPath = (ending) => { const path = this.path.join(currentDir, `svelte.config.${ending}`); return this.fs.existsSync(path) ? path : undefined; }; const configPath = tryFindConfigPath('js') || tryFindConfigPath('cjs') || tryFindConfigPath('mjs'); if (configPath) { return configPath; } currentDir = nextDir; nextDir = this.path.dirname(currentDir); } } async loadAndCacheConfig(configPath, directory) { const loadingConfig = this.configFilesAsync.get(configPath); if (loadingConfig) { await loadingConfig; } else { const newConfig = this.loadConfig(configPath, directory); this.configFilesAsync.set(configPath, newConfig); this.configFiles.set(configPath, await newConfig); } } async loadConfig(configPath, directory) { var _a; try { let config = this.disabled ? {} : (_a = (await this.dynamicImport((0, url__default['default'].pathToFileURL)(configPath)))) === null || _a === void 0 ? void 0 : _a.default; if (!config) { throw new Error('Missing exports in the config. Make sure to include "export default config" or "module.exports = config"'); } config = { ...config, compilerOptions: { ...DEFAULT_OPTIONS, ...config.compilerOptions, ...NO_GENERATE } }; logger.Logger.log('Loaded config at ', configPath); return config; } catch (err) { logger.Logger.error('Error while loading config at ', configPath); logger.Logger.error(err); const config = { ...this.useFallbackPreprocessor(directory, true), compilerOptions: { ...DEFAULT_OPTIONS, ...NO_GENERATE }, loadConfigError: err }; return config; } } getConfig(file) { const cached = this.filePathToConfigPath.get(file); if (cached) { return this.configFiles.get(cached); } let currentDir = file; let nextDir = this.path.dirname(file); while (currentDir !== nextDir) { currentDir = nextDir; const config = this.tryGetConfig(file, currentDir, 'js') || this.tryGetConfig(file, currentDir, 'cjs') || this.tryGetConfig(file, currentDir, 'mjs'); if (config) { return config; } nextDir = this.path.dirname(currentDir); } } async awaitConfig(file) { const config = this.getConfig(file); if (config) { return config; } const fileDirectory = this.path.dirname(file); const configPath = this.searchConfigPathUpwards(fileDirectory); if (configPath) { await this.loadAndCacheConfig(configPath, fileDirectory); } else { this.addFallbackConfig(fileDirectory); } return this.getConfig(file); } tryGetConfig(file, fromDirectory, configFileEnding) { const path = this.path.join(fromDirectory, `svelte.config.${configFileEnding}`); const config = this.configFiles.get(path); if (config) { this.filePathToConfigPath.set(file, path); return config; } } useFallbackPreprocessor(path, foundConfig) { logger.Logger.log((foundConfig ? 'Found svelte.config.js but there was an error loading it. ' : 'No svelte.config.js found. ') + 'Using https://github.com/sveltejs/svelte-preprocess as fallback'); const sveltePreprocess = (0, importPackage.importSveltePreprocess)(path); return { preprocess: sveltePreprocess({ typescript: { transpileOnly: true, compilerOptions: { sourceMap: true, inlineSourceMap: false } } }) }; } } exports.ConfigLoader = ConfigLoader; exports.configLoader = new ConfigLoader(fast_glob_1.default.sync, fs_1.default, path_1.default, _dynamicImport); }); getDefaultExportFromCjs(configLoader); var Document_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Document = void 0; class Document extends DocumentBase.WritableDocument { constructor(url, content) { super(); this.url = url; this.content = content; this.languageId = 'svelte'; this.scriptInfo = null; this.moduleScriptInfo = null; this.styleInfo = null; this.templateInfo = null; this.path = (0, utils$4.urlToPath)(this.url); this.configPromise = configLoader.configLoader.awaitConfig(this.getFilePath() || ''); this.updateDocInfo(); } updateDocInfo() { this.html = (0, parseHtml_1.parseHtml)(this.content); const update = (config) => { const scriptTags = (0, utils$3.extractScriptTags)(this.content, this.html); this.config = config; this.scriptInfo = this.addDefaultLanguage(config, (scriptTags === null || scriptTags === void 0 ? void 0 : scriptTags.script) || null, 'script'); this.moduleScriptInfo = this.addDefaultLanguage(config, (scriptTags === null || scriptTags === void 0 ? void 0 : scriptTags.moduleScript) || null, 'script'); this.styleInfo = this.addDefaultLanguage(config, (0, utils$3.extractStyleTag)(this.content, this.html), 'style'); this.templateInfo = this.addDefaultLanguage(config, (0, utils$3.extractTemplateTag)(this.content, this.html), 'markup'); }; const config = configLoader.configLoader.getConfig(this.getFilePath() || ''); if (config && !config.loadConfigError) { update(config); } else { update(undefined); this.configPromise.then((c) => update(c)); } } getText(range) { if (range) { return this.content.substring(this.offsetAt(range.start), this.offsetAt(range.end)); } return this.content; } setText(text) { this.content = text; this.version++; this.lineOffsets = undefined; this.updateDocInfo(); } getFilePath() { return this.path; } getURL() { return this.url; } getLanguageAttribute(tag) { var _a, _b, _c, _d; const attrs = (tag === 'style' ? (_a = this.styleInfo) === null || _a === void 0 ? void 0 : _a.attributes : tag === 'script' ? ((_b = this.scriptInfo) === null || _b === void 0 ? void 0 : _b.attributes) || ((_c = this.moduleScriptInfo) === null || _c === void 0 ? void 0 : _c.attributes) : (_d = this.templateInfo) === null || _d === void 0 ? void 0 : _d.attributes) || {}; const lang = attrs.lang || attrs.type || ''; return lang.replace(/^text\//, ''); } addDefaultLanguage(config, tagInfo, tag) { var _a, _b, _c, _d; if (!tagInfo || !config) { return tagInfo; } const defaultLang = Array.isArray(config.preprocess) ? (_b = (_a = config.preprocess.find((group) => { var _a; return (_a = group.defaultLanguages) === null || _a === void 0 ? void 0 : _a[tag]; })) === null || _a === void 0 ? void 0 : _a.defaultLanguages) === null || _b === void 0 ? void 0 : _b[tag] : (_d = (_c = config.preprocess) === null || _c === void 0 ? void 0 : _c.defaultLanguages) === null || _d === void 0 ? void 0 : _d[tag]; if (!tagInfo.attributes.lang && !tagInfo.attributes.type && defaultLang) { tagInfo.attributes.lang = defaultLang; } return tagInfo; } } exports.Document = Document; }); getDefaultExportFromCjs(Document_1); var DocumentMapper$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.mapSelectionRangeToParent = exports.mapCodeActionToOriginal = exports.mapTextDocumentEditToOriginal = exports.mapLocationLinkToOriginal = exports.mapSymbolInformationToOriginal = exports.mapColorPresentationToOriginal = exports.mapDiagnosticToGenerated = exports.mapEditToOriginal = exports.mapInsertReplaceEditToOriginal = exports.mapObjWithRangeToOriginal = exports.mapHoverToParent = exports.mapCompletionItemToOriginal = exports.mapRangeToGenerated = exports.mapRangeToOriginal = exports.SourceMapDocumentMapper = exports.FragmentMapper = exports.IdentityMapper = void 0; class IdentityMapper { constructor(url, parent) { this.url = url; this.parent = parent; } getOriginalPosition(generatedPosition) { if (this.parent) { generatedPosition = this.getOriginalPosition(generatedPosition); } return generatedPosition; } getGeneratedPosition(originalPosition) { if (this.parent) { originalPosition = this.getGeneratedPosition(originalPosition); } return originalPosition; } isInGenerated(position) { if (this.parent && !this.parent.isInGenerated(position)) { return false; } return true; } getURL() { return this.url; } } exports.IdentityMapper = IdentityMapper; class FragmentMapper { constructor(originalText, tagInfo, url) { this.originalText = originalText; this.tagInfo = tagInfo; this.url = url; this.lineOffsetsOriginal = (0, utils$3.getLineOffsets)(this.originalText); this.lineOffsetsGenerated = (0, utils$3.getLineOffsets)(this.tagInfo.content); } getOriginalPosition(generatedPosition) { const parentOffset = this.offsetInParent((0, utils$3.offsetAt)(generatedPosition, this.tagInfo.content, this.lineOffsetsGenerated)); return (0, utils$3.positionAt)(parentOffset, this.originalText, this.lineOffsetsOriginal); } offsetInParent(offset) { return this.tagInfo.start + offset; } getGeneratedPosition(originalPosition) { const fragmentOffset = (0, utils$3.offsetAt)(originalPosition, this.originalText, this.lineOffsetsOriginal) - this.tagInfo.start; return (0, utils$3.positionAt)(fragmentOffset, this.tagInfo.content, this.lineOffsetsGenerated); } isInGenerated(pos) { const offset = (0, utils$3.offsetAt)(pos, this.originalText, this.lineOffsetsOriginal); return offset >= this.tagInfo.start && offset <= this.tagInfo.end; } getURL() { return this.url; } } exports.FragmentMapper = FragmentMapper; class SourceMapDocumentMapper { constructor(traceMap, sourceUri, parent) { this.traceMap = traceMap; this.sourceUri = sourceUri; this.parent = parent; } getOriginalPosition(generatedPosition) { if (this.parent) { generatedPosition = this.parent.getOriginalPosition(generatedPosition); } if (generatedPosition.line < 0) { return { line: -1, character: -1 }; } const mapped = (0, trace_mapping_1__default['default'].originalPositionFor)(this.traceMap, { line: generatedPosition.line + 1, column: generatedPosition.character }); if (!mapped) { return { line: -1, character: -1 }; } if (mapped.line === 0) { logger.Logger.log('Got 0 mapped line from', generatedPosition, 'col was', mapped.column); } return { line: (mapped.line || 0) - 1, character: mapped.column || 0 }; } getGeneratedPosition(originalPosition) { if (this.parent) { originalPosition = this.parent.getGeneratedPosition(originalPosition); } const mapped = (0, trace_mapping_1__default['default'].generatedPositionFor)(this.traceMap, { line: originalPosition.line + 1, column: originalPosition.character, source: this.sourceUri }); if (!mapped) { return { line: -1, character: -1 }; } const result = { line: (mapped.line || 0) - 1, character: mapped.column || 0 }; if (result.line < 0) { return result; } return result; } isInGenerated(position) { if (this.parent && !this.isInGenerated(position)) { return false; } const generated = this.getGeneratedPosition(position); return generated.line >= 0; } getURL() { return this.sourceUri; } } exports.SourceMapDocumentMapper = SourceMapDocumentMapper; function mapRangeToOriginal(fragment, range) { const originalRange = { start: fragment.getOriginalPosition(range.start), end: fragment.getOriginalPosition(range.end) }; if (originalRange.start.line === originalRange.end.line && range.start.line === range.end.line && originalRange.end.character - originalRange.start.character === range.end.character - range.start.character - 1) { originalRange.end.character += 1; } return originalRange; } exports.mapRangeToOriginal = mapRangeToOriginal; function mapRangeToGenerated(fragment, range) { return main$4.Range.create(fragment.getGeneratedPosition(range.start), fragment.getGeneratedPosition(range.end)); } exports.mapRangeToGenerated = mapRangeToGenerated; function mapCompletionItemToOriginal(fragment, item) { if (!item.textEdit) { return item; } return { ...item, textEdit: mapEditToOriginal(fragment, item.textEdit) }; } exports.mapCompletionItemToOriginal = mapCompletionItemToOriginal; function mapHoverToParent(fragment, hover) { if (!hover.range) { return hover; } return { ...hover, range: mapRangeToOriginal(fragment, hover.range) }; } exports.mapHoverToParent = mapHoverToParent; function mapObjWithRangeToOriginal(fragment, objWithRange) { return { ...objWithRange, range: mapRangeToOriginal(fragment, objWithRange.range) }; } exports.mapObjWithRangeToOriginal = mapObjWithRangeToOriginal; function mapInsertReplaceEditToOriginal(fragment, edit) { return { ...edit, insert: mapRangeToOriginal(fragment, edit.insert), replace: mapRangeToOriginal(fragment, edit.replace) }; } exports.mapInsertReplaceEditToOriginal = mapInsertReplaceEditToOriginal; function mapEditToOriginal(fragment, edit) { return main$4.TextEdit.is(edit) ? mapObjWithRangeToOriginal(fragment, edit) : mapInsertReplaceEditToOriginal(fragment, edit); } exports.mapEditToOriginal = mapEditToOriginal; function mapDiagnosticToGenerated(fragment, diagnostic) { return { ...diagnostic, range: mapRangeToGenerated(fragment, diagnostic.range) }; } exports.mapDiagnosticToGenerated = mapDiagnosticToGenerated; function mapColorPresentationToOriginal(fragment, presentation) { const item = { ...presentation }; if (item.textEdit) { item.textEdit = mapObjWithRangeToOriginal(fragment, item.textEdit); } if (item.additionalTextEdits) { item.additionalTextEdits = item.additionalTextEdits.map((edit) => mapObjWithRangeToOriginal(fragment, edit)); } return item; } exports.mapColorPresentationToOriginal = mapColorPresentationToOriginal; function mapSymbolInformationToOriginal(fragment, info) { return { ...info, location: mapObjWithRangeToOriginal(fragment, info.location) }; } exports.mapSymbolInformationToOriginal = mapSymbolInformationToOriginal; function mapLocationLinkToOriginal(fragment, def) { return main$4.LocationLink.create(def.targetUri, fragment.getURL() === def.targetUri ? mapRangeToOriginal(fragment, def.targetRange) : def.targetRange, fragment.getURL() === def.targetUri ? mapRangeToOriginal(fragment, def.targetSelectionRange) : def.targetSelectionRange, def.originSelectionRange ? mapRangeToOriginal(fragment, def.originSelectionRange) : undefined); } exports.mapLocationLinkToOriginal = mapLocationLinkToOriginal; function mapTextDocumentEditToOriginal(fragment, edit) { if (edit.textDocument.uri !== fragment.getURL()) { return edit; } return main$4.TextDocumentEdit.create(edit.textDocument, edit.edits.map((textEdit) => mapObjWithRangeToOriginal(fragment, textEdit))); } exports.mapTextDocumentEditToOriginal = mapTextDocumentEditToOriginal; function mapCodeActionToOriginal(fragment, codeAction) { return main$4.CodeAction.create(codeAction.title, { documentChanges: codeAction.edit.documentChanges.map((edit) => mapTextDocumentEditToOriginal(fragment, edit)) }, codeAction.kind); } exports.mapCodeActionToOriginal = mapCodeActionToOriginal; function mapSelectionRangeToParent(fragment, selectionRange) { const { range, parent } = selectionRange; return main$4.SelectionRange.create(mapRangeToOriginal(fragment, range), parent && mapSelectionRangeToParent(fragment, parent)); } exports.mapSelectionRangeToParent = mapSelectionRangeToParent; }); getDefaultExportFromCjs(DocumentMapper$1); var documents = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(DocumentManager_1, exports); __exportStar(Document_1, exports); __exportStar(DocumentBase, exports); __exportStar(DocumentMapper$1, exports); __exportStar(utils$3, exports); }); getDefaultExportFromCjs(documents); var semanticTokenLegend = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getSemanticTokenLegends = void 0; function getSemanticTokenLegends() { const tokenModifiers = []; [ [0 , main$4.SemanticTokenModifiers.declaration], [1 , main$4.SemanticTokenModifiers.static], [2 , main$4.SemanticTokenModifiers.async], [3 , main$4.SemanticTokenModifiers.readonly], [4 , main$4.SemanticTokenModifiers.defaultLibrary], [5 , 'local'] ].forEach(([tsModifier, legend]) => (tokenModifiers[tsModifier] = legend)); const tokenTypes = []; [ [0 , main$4.SemanticTokenTypes.class], [1 , main$4.SemanticTokenTypes.enum], [2 , main$4.SemanticTokenTypes.interface], [3 , main$4.SemanticTokenTypes.namespace], [4 , main$4.SemanticTokenTypes.typeParameter], [5 , main$4.SemanticTokenTypes.type], [6 , main$4.SemanticTokenTypes.parameter], [7 , main$4.SemanticTokenTypes.variable], [8 , main$4.SemanticTokenTypes.enumMember], [9 , main$4.SemanticTokenTypes.property], [10 , main$4.SemanticTokenTypes.function], [11 , main$4.SemanticTokenTypes.method], [12 , main$4.SemanticTokenTypes.event] ].forEach(([tokenType, legend]) => (tokenTypes[tokenType] = legend)); return { tokenModifiers, tokenTypes }; } exports.getSemanticTokenLegends = getSemanticTokenLegends; }); getDefaultExportFromCjs(semanticTokenLegend); var lsConfig = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.lsConfig = exports.LSConfigManager = void 0; const defaultLSConfig = { typescript: { enable: true, diagnostics: { enable: true }, hover: { enable: true }, completions: { enable: true }, documentSymbols: { enable: true }, codeActions: { enable: true }, selectionRange: { enable: true }, signatureHelp: { enable: true }, semanticTokens: { enable: true } }, css: { enable: true, globals: '', diagnostics: { enable: true }, hover: { enable: true }, completions: { enable: true, emmet: true }, documentColors: { enable: true }, colorPresentations: { enable: true }, documentSymbols: { enable: true }, selectionRange: { enable: true } }, html: { enable: true, hover: { enable: true }, completions: { enable: true, emmet: true }, tagComplete: { enable: true }, documentSymbols: { enable: true }, linkedEditing: { enable: true } }, svelte: { enable: true, useNewTransformation: false, compilerWarnings: {}, diagnostics: { enable: true }, rename: { enable: true }, format: { enable: true, config: { svelteSortOrder: 'options-scripts-markup-styles', svelteStrictMode: false, svelteAllowShorthand: true, svelteBracketNewLine: true, svelteIndentScriptAndStyle: true, printWidth: 80, singleQuote: false } }, completions: { enable: true }, hover: { enable: true }, codeActions: { enable: true }, selectionRange: { enable: true }, defaultScriptLanguage: 'none' } }; class LSConfigManager { constructor() { this.config = defaultLSConfig; this.listeners = []; this.tsUserPreferences = { typescript: { includeCompletionsForModuleExports: true, includeCompletionsForImportStatements: true, includeCompletionsWithInsertText: true, includeAutomaticOptionalChainCompletions: true }, javascript: { includeCompletionsForModuleExports: true, includeCompletionsForImportStatements: true, includeCompletionsWithInsertText: true, includeAutomaticOptionalChainCompletions: true } }; this.prettierConfig = {}; this.emmetConfig = {}; this.isTrusted = true; } update(config) { var _a; this.config = (0, lodash.merge)({}, defaultLSConfig, this.config, config); if ((_a = config.svelte) === null || _a === void 0 ? void 0 : _a.compilerWarnings) { this.config.svelte.compilerWarnings = config.svelte.compilerWarnings; } this.listeners.forEach((listener) => listener(this)); } enabled(key) { return !!this.get(key); } get(key) { return (0, lodash.get)(this.config, key); } getConfig() { return this.config; } onChange(callback) { this.listeners.push(callback); } updateEmmetConfig(config) { this.emmetConfig = config || {}; this.listeners.forEach((listener) => listener(this)); } getEmmetConfig() { return this.emmetConfig; } updatePrettierConfig(config) { this.prettierConfig = config || {}; this.listeners.forEach((listener) => listener(this)); } getPrettierConfig() { return this.prettierConfig; } getMergedPrettierConfig(prettierFromFileConfig, overridesWhenNoPrettierConfig = {}) { return ((0, utils$4.returnObjectIfHasKeys)(prettierFromFileConfig) || (0, lodash.merge)({}, this.get('svelte.format.config'), (0, utils$4.returnObjectIfHasKeys)(this.getPrettierConfig()) || overridesWhenNoPrettierConfig || {})); } updateTsJsUserPreferences(config) { ['typescript', 'javascript'].forEach((lang) => { if (config[lang]) { this._updateTsUserPreferences(lang, config[lang]); } }); this.listeners.forEach((listener) => listener(this)); } getIsTrusted() { return this.isTrusted; } updateIsTrusted(isTrusted) { this.isTrusted = isTrusted; this.listeners.forEach((listener) => listener(this)); } _updateTsUserPreferences(lang, config) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; this.tsUserPreferences[lang] = { ...this.tsUserPreferences[lang], importModuleSpecifierPreference: (_a = config.preferences) === null || _a === void 0 ? void 0 : _a.importModuleSpecifier, importModuleSpecifierEnding: (_b = config.preferences) === null || _b === void 0 ? void 0 : _b.importModuleSpecifierEnding, includePackageJsonAutoImports: (_c = config.preferences) === null || _c === void 0 ? void 0 : _c.includePackageJsonAutoImports, quotePreference: (_d = config.preferences) === null || _d === void 0 ? void 0 : _d.quoteStyle, includeCompletionsForModuleExports: (_f = (_e = config.suggest) === null || _e === void 0 ? void 0 : _e.autoImports) !== null && _f !== void 0 ? _f : true, includeCompletionsForImportStatements: (_h = (_g = config.suggest) === null || _g === void 0 ? void 0 : _g.includeCompletionsForImportStatements) !== null && _h !== void 0 ? _h : true, includeAutomaticOptionalChainCompletions: (_k = (_j = config.suggest) === null || _j === void 0 ? void 0 : _j.includeAutomaticOptionalChainCompletions) !== null && _k !== void 0 ? _k : true, includeCompletionsWithInsertText: true }; } getTsUserPreferences(lang) { return this.tsUserPreferences[lang]; } updateCssConfig(config) { this.cssConfig = config; this.listeners.forEach((listener) => listener(this)); } getCssConfig() { return this.cssConfig; } updateScssConfig(config) { this.scssConfig = config; this.listeners.forEach((listener) => listener(this)); } getScssConfig() { return this.scssConfig; } updateLessConfig(config) { this.lessConfig = config; this.listeners.forEach((listener) => listener(this)); } getLessConfig() { return this.lessConfig; } } exports.LSConfigManager = LSConfigManager; exports.lsConfig = new LSConfigManager(); }); getDefaultExportFromCjs(lsConfig); function createScanner(text, ignoreTrivia) { if (ignoreTrivia === void 0) { ignoreTrivia = false; } var len = text.length; var pos = 0, value = '', tokenOffset = 0, token = 16 , lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0 ; function scanHexDigits(count, exact) { var digits = 0; var value = 0; while (digits < count || !exact) { var ch = text.charCodeAt(pos); if (ch >= 48 && ch <= 57 ) { value = value * 16 + ch - 48 ; } else if (ch >= 65 && ch <= 70 ) { value = value * 16 + ch - 65 + 10; } else if (ch >= 97 && ch <= 102 ) { value = value * 16 + ch - 97 + 10; } else { break; } pos++; digits++; } if (digits < count) { value = -1; } return value; } function setPosition(newPosition) { pos = newPosition; value = ''; tokenOffset = 0; token = 16 ; scanError = 0 ; } function scanNumber() { var start = pos; if (text.charCodeAt(pos) === 48 ) { pos++; } else { pos++; while (pos < text.length && isDigit(text.charCodeAt(pos))) { pos++; } } if (pos < text.length && text.charCodeAt(pos) === 46 ) { pos++; if (pos < text.length && isDigit(text.charCodeAt(pos))) { pos++; while (pos < text.length && isDigit(text.charCodeAt(pos))) { pos++; } } else { scanError = 3 ; return text.substring(start, pos); } } var end = pos; if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101 )) { pos++; if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45 ) { pos++; } if (pos < text.length && isDigit(text.charCodeAt(pos))) { pos++; while (pos < text.length && isDigit(text.charCodeAt(pos))) { pos++; } end = pos; } else { scanError = 3 ; } } return text.substring(start, end); } function scanString() { var result = '', start = pos; while (true) { if (pos >= len) { result += text.substring(start, pos); scanError = 2 ; break; } var ch = text.charCodeAt(pos); if (ch === 34 ) { result += text.substring(start, pos); pos++; break; } if (ch === 92 ) { result += text.substring(start, pos); pos++; if (pos >= len) { scanError = 2 ; break; } var ch2 = text.charCodeAt(pos++); switch (ch2) { case 34 : result += '\"'; break; case 92 : result += '\\'; break; case 47 : result += '/'; break; case 98 : result += '\b'; break; case 102 : result += '\f'; break; case 110 : result += '\n'; break; case 114 : result += '\r'; break; case 116 : result += '\t'; break; case 117 : var ch3 = scanHexDigits(4, true); if (ch3 >= 0) { result += String.fromCharCode(ch3); } else { scanError = 4 ; } break; default: scanError = 5 ; } start = pos; continue; } if (ch >= 0 && ch <= 0x1f) { if (isLineBreak(ch)) { result += text.substring(start, pos); scanError = 2 ; break; } else { scanError = 6 ; } } pos++; } return result; } function scanNext() { value = ''; scanError = 0 ; tokenOffset = pos; lineStartOffset = lineNumber; prevTokenLineStartOffset = tokenLineStartOffset; if (pos >= len) { tokenOffset = len; return token = 17 ; } var code = text.charCodeAt(pos); if (isWhiteSpace$4(code)) { do { pos++; value += String.fromCharCode(code); code = text.charCodeAt(pos); } while (isWhiteSpace$4(code)); return token = 15 ; } if (isLineBreak(code)) { pos++; value += String.fromCharCode(code); if (code === 13 && text.charCodeAt(pos) === 10 ) { pos++; value += '\n'; } lineNumber++; tokenLineStartOffset = pos; return token = 14 ; } switch (code) { case 123 : pos++; return token = 1 ; case 125 : pos++; return token = 2 ; case 91 : pos++; return token = 3 ; case 93 : pos++; return token = 4 ; case 58 : pos++; return token = 6 ; case 44 : pos++; return token = 5 ; case 34 : pos++; value = scanString(); return token = 10 ; case 47 : var start = pos - 1; if (text.charCodeAt(pos + 1) === 47 ) { pos += 2; while (pos < len) { if (isLineBreak(text.charCodeAt(pos))) { break; } pos++; } value = text.substring(start, pos); return token = 12 ; } if (text.charCodeAt(pos + 1) === 42 ) { pos += 2; var safeLength = len - 1; var commentClosed = false; while (pos < safeLength) { var ch = text.charCodeAt(pos); if (ch === 42 && text.charCodeAt(pos + 1) === 47 ) { pos += 2; commentClosed = true; break; } pos++; if (isLineBreak(ch)) { if (ch === 13 && text.charCodeAt(pos) === 10 ) { pos++; } lineNumber++; tokenLineStartOffset = pos; } } if (!commentClosed) { pos++; scanError = 1 ; } value = text.substring(start, pos); return token = 13 ; } value += String.fromCharCode(code); pos++; return token = 16 ; case 45 : value += String.fromCharCode(code); pos++; if (pos === len || !isDigit(text.charCodeAt(pos))) { return token = 16 ; } case 48 : case 49 : case 50 : case 51 : case 52 : case 53 : case 54 : case 55 : case 56 : case 57 : value += scanNumber(); return token = 11 ; default: while (pos < len && isUnknownContentCharacter(code)) { pos++; code = text.charCodeAt(pos); } if (tokenOffset !== pos) { value = text.substring(tokenOffset, pos); switch (value) { case 'true': return token = 8 ; case 'false': return token = 9 ; case 'null': return token = 7 ; } return token = 16 ; } value += String.fromCharCode(code); pos++; return token = 16 ; } } function isUnknownContentCharacter(code) { if (isWhiteSpace$4(code) || isLineBreak(code)) { return false; } switch (code) { case 125 : case 93 : case 123 : case 91 : case 34 : case 58 : case 44 : case 47 : return false; } return true; } function scanNextNonTrivia() { var result; do { result = scanNext(); } while (result >= 12 && result <= 15 ); return result; } return { setPosition: setPosition, getPosition: function () { return pos; }, scan: ignoreTrivia ? scanNextNonTrivia : scanNext, getToken: function () { return token; }, getTokenValue: function () { return value; }, getTokenOffset: function () { return tokenOffset; }, getTokenLength: function () { return pos - tokenOffset; }, getTokenStartLine: function () { return lineStartOffset; }, getTokenStartCharacter: function () { return tokenOffset - prevTokenLineStartOffset; }, getTokenError: function () { return scanError; }, }; } function isWhiteSpace$4(ch) { return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279 ; } function isLineBreak(ch) { return ch === 10 || ch === 13 || ch === 8232 || ch === 8233 ; } function isDigit(ch) { return ch >= 48 && ch <= 57 ; } var ParseOptions; (function (ParseOptions) { ParseOptions.DEFAULT = { allowTrailingComma: false }; })(ParseOptions || (ParseOptions = {})); function parse$4(text, errors, options) { if (errors === void 0) { errors = []; } if (options === void 0) { options = ParseOptions.DEFAULT; } var currentProperty = null; var currentParent = []; var previousParents = []; function onValue(value) { if (Array.isArray(currentParent)) { currentParent.push(value); } else if (currentProperty !== null) { currentParent[currentProperty] = value; } } var visitor = { onObjectBegin: function () { var object = {}; onValue(object); previousParents.push(currentParent); currentParent = object; currentProperty = null; }, onObjectProperty: function (name) { currentProperty = name; }, onObjectEnd: function () { currentParent = previousParents.pop(); }, onArrayBegin: function () { var array = []; onValue(array); previousParents.push(currentParent); currentParent = array; currentProperty = null; }, onArrayEnd: function () { currentParent = previousParents.pop(); }, onLiteralValue: onValue, onError: function (error, offset, length) { errors.push({ error: error, offset: offset, length: length }); } }; visit(text, visitor, options); return currentParent[0]; } function visit(text, visitor, options) { if (options === void 0) { options = ParseOptions.DEFAULT; } var _scanner = createScanner(text, false); function toNoArgVisit(visitFunction) { return visitFunction ? function () { return visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; }; } function toOneArgVisit(visitFunction) { return visitFunction ? function (arg) { return visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()); } : function () { return true; }; } var onObjectBegin = toNoArgVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisit(visitor.onObjectProperty), onObjectEnd = toNoArgVisit(visitor.onObjectEnd), onArrayBegin = toNoArgVisit(visitor.onArrayBegin), onArrayEnd = toNoArgVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisit(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError); var disallowComments = options && options.disallowComments; var allowTrailingComma = options && options.allowTrailingComma; function scanNext() { while (true) { var token = _scanner.scan(); switch (_scanner.getTokenError()) { case 4 : handleError(14 ); break; case 5 : handleError(15 ); break; case 3 : handleError(13 ); break; case 1 : if (!disallowComments) { handleError(11 ); } break; case 2 : handleError(12 ); break; case 6 : handleError(16 ); break; } switch (token) { case 12 : case 13 : if (disallowComments) { handleError(10 ); } else { onComment(); } break; case 16 : handleError(1 ); break; case 15 : case 14 : break; default: return token; } } } function handleError(error, skipUntilAfter, skipUntil) { if (skipUntilAfter === void 0) { skipUntilAfter = []; } if (skipUntil === void 0) { skipUntil = []; } onError(error); if (skipUntilAfter.length + skipUntil.length > 0) { var token = _scanner.getToken(); while (token !== 17 ) { if (skipUntilAfter.indexOf(token) !== -1) { scanNext(); break; } else if (skipUntil.indexOf(token) !== -1) { break; } token = scanNext(); } } } function parseString(isValue) { var value = _scanner.getTokenValue(); if (isValue) { onLiteralValue(value); } else { onObjectProperty(value); } scanNext(); return true; } function parseLiteral() { switch (_scanner.getToken()) { case 11 : var tokenValue = _scanner.getTokenValue(); var value = Number(tokenValue); if (isNaN(value)) { handleError(2 ); value = 0; } onLiteralValue(value); break; case 7 : onLiteralValue(null); break; case 8 : onLiteralValue(true); break; case 9 : onLiteralValue(false); break; default: return false; } scanNext(); return true; } function parseProperty() { if (_scanner.getToken() !== 10 ) { handleError(3 , [], [2 , 5 ]); return false; } parseString(false); if (_scanner.getToken() === 6 ) { onSeparator(':'); scanNext(); if (!parseValue()) { handleError(4 , [], [2 , 5 ]); } } else { handleError(5 , [], [2 , 5 ]); } return true; } function parseObject() { onObjectBegin(); scanNext(); var needsComma = false; while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17 ) { if (_scanner.getToken() === 5 ) { if (!needsComma) { handleError(4 , [], []); } onSeparator(','); scanNext(); if (_scanner.getToken() === 2 && allowTrailingComma) { break; } } else if (needsComma) { handleError(6 , [], []); } if (!parseProperty()) { handleError(4 , [], [2 , 5 ]); } needsComma = true; } onObjectEnd(); if (_scanner.getToken() !== 2 ) { handleError(7 , [2 ], []); } else { scanNext(); } return true; } function parseArray() { onArrayBegin(); scanNext(); var needsComma = false; while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17 ) { if (_scanner.getToken() === 5 ) { if (!needsComma) { handleError(4 , [], []); } onSeparator(','); scanNext(); if (_scanner.getToken() === 4 && allowTrailingComma) { break; } } else if (needsComma) { handleError(6 , [], []); } if (!parseValue()) { handleError(4 , [], [4 , 5 ]); } needsComma = true; } onArrayEnd(); if (_scanner.getToken() !== 4 ) { handleError(8 , [4 ], []); } else { scanNext(); } return true; } function parseValue() { switch (_scanner.getToken()) { case 3 : return parseArray(); case 1 : return parseObject(); case 10 : return parseString(true); default: return parseLiteral(); } } scanNext(); if (_scanner.getToken() === 17 ) { if (options.allowEmptyContent) { return true; } handleError(4 , [], []); return false; } if (!parseValue()) { handleError(4 , [], []); return false; } if (_scanner.getToken() !== 17 ) { handleError(9 , [], []); } return true; } var parse$3 = parse$4; function printParseErrorCode(code) { switch (code) { case 1 : return 'InvalidSymbol'; case 2 : return 'InvalidNumberFormat'; case 3 : return 'PropertyNameExpected'; case 4 : return 'ValueExpected'; case 5 : return 'ColonExpected'; case 6 : return 'CommaExpected'; case 7 : return 'CloseBraceExpected'; case 8 : return 'CloseBracketExpected'; case 9 : return 'EndOfFileExpected'; case 10 : return 'InvalidCommentToken'; case 11 : return 'UnexpectedEndOfComment'; case 12 : return 'UnexpectedEndOfString'; case 13 : return 'UnexpectedEndOfNumber'; case 14 : return 'InvalidUnicode'; case 15 : return 'InvalidEscapeCharacter'; case 16 : return 'InvalidCharacter'; } return '<unknown ParseErrorCode>'; } const cssData$1 = { "properties": ["additive-symbols", "align-content", "align-items", "justify-items", "justify-self", "justify-items", "align-self", "all", "alt", "animation", "animation-delay", "animation-direction", "animation-duration", "animation-fill-mode", "animation-iteration-count", "animation-name", "animation-play-state", "animation-timing-function", "backface-visibility", "background", "background-attachment", "background-blend-mode", "background-clip", "background-color", "background-image", "background-origin", "background-position", "background-position-x", "background-position-y", "background-repeat", "background-size", "behavior", "block-size", "border", "border-block-end", "border-block-start", "border-block-end-color", "border-block-start-color", "border-block-end-style", "border-block-start-style", "border-block-end-width", "border-block-start-width", "border-bottom", "border-bottom-color", "border-bottom-left-radius", "border-bottom-right-radius", "border-bottom-style", "border-bottom-width", "border-collapse", "border-color", "border-image", "border-image-outset", "border-image-repeat", "border-image-slice", "border-image-source", "border-image-width", "border-inline-end", "border-inline-start", "border-inline-end-color", "border-inline-start-color", "border-inline-end-style", "border-inline-start-style", "border-inline-end-width", "border-inline-start-width", "border-left", "border-left-color", "border-left-style", "border-left-width", "border-radius", "border-right", "border-right-color", "border-right-style", "border-right-width", "border-spacing", "border-style", "border-top", "border-top-color", "border-top-left-radius", "border-top-right-radius", "border-top-style", "border-top-width", "border-width", "bottom", "box-decoration-break", "box-shadow", "box-sizing", "break-after", "break-before", "break-inside", "caption-side", "caret-color", "clear", "clip", "clip-path", "clip-rule", "color", "color-interpolation-filters", "column-count", "column-fill", "column-gap", "column-rule", "column-rule-color", "column-rule-style", "column-rule-width", "columns", "column-span", "column-width", "contain", "content", "counter-increment", "counter-reset", "cursor", "direction", "display", "empty-cells", "enable-background", "fallback", "fill", "fill-opacity", "fill-rule", "filter", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "float", "flood-color", "flood-opacity", "font", "font-family", "font-feature-settings", "font-kerning", "font-language-override", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-synthesis", "font-variant", "font-variant-alternates", "font-variant-caps", "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric", "font-variant-position", "font-weight", "glyph-orientation-horizontal", "glyph-orientation-vertical", "grid-area", "grid-auto-columns", "grid-auto-flow", "grid-auto-rows", "grid-column", "grid-column-end", "grid-column-gap", "grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap", "grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns", "grid-template-rows", "height", "hyphens", "image-orientation", "image-rendering", "ime-mode", "inline-size", "isolation", "justify-content", "kerning", "left", "letter-spacing", "lighting-color", "line-break", "line-height", "list-style", "list-style-image", "list-style-position", "list-style-type", "margin", "margin-block-end", "margin-block-start", "margin-bottom", "margin-inline-end", "margin-inline-start", "margin-left", "margin-right", "margin-top", "marker", "marker-end", "marker-mid", "marker-start", "mask-type", "max-block-size", "max-height", "max-inline-size", "max-width", "min-block-size", "min-height", "min-inline-size", "min-width", "mix-blend-mode", "motion", "motion-offset", "motion-path", "motion-rotation", "-moz-animation", "-moz-animation-delay", "-moz-animation-direction", "-moz-animation-duration", "-moz-animation-iteration-count", "-moz-animation-name", "-moz-animation-play-state", "-moz-animation-timing-function", "-moz-appearance", "-moz-backface-visibility", "-moz-background-clip", "-moz-background-inline-policy", "-moz-background-origin", "-moz-border-bottom-colors", "-moz-border-image", "-moz-border-left-colors", "-moz-border-right-colors", "-moz-border-top-colors", "-moz-box-align", "-moz-box-direction", "-moz-box-flex", "-moz-box-flexgroup", "-moz-box-ordinal-group", "-moz-box-orient", "-moz-box-pack", "-moz-box-sizing", "-moz-column-count", "-moz-column-gap", "-moz-column-rule", "-moz-column-rule-color", "-moz-column-rule-style", "-moz-column-rule-width", "-moz-columns", "-moz-column-width", "-moz-font-feature-settings", "-moz-hyphens", "-moz-perspective", "-moz-perspective-origin", "-moz-text-align-last", "-moz-text-decoration-color", "-moz-text-decoration-line", "-moz-text-decoration-style", "-moz-text-size-adjust", "-moz-transform", "-moz-transform-origin", "-moz-transition", "-moz-transition-delay", "-moz-transition-duration", "-moz-transition-property", "-moz-transition-timing-function", "-moz-user-focus", "-moz-user-select", "-ms-accelerator", "-ms-behavior", "-ms-block-progression", "-ms-content-zoom-chaining", "-ms-content-zooming", "-ms-content-zoom-limit", "-ms-content-zoom-limit-max", "-ms-content-zoom-limit-min", "-ms-content-zoom-snap", "-ms-content-zoom-snap-points", "-ms-content-zoom-snap-type", "-ms-filter", "-ms-flex", "-ms-flex-align", "-ms-flex-direction", "-ms-flex-flow", "-ms-flex-item-align", "-ms-flex-line-pack", "-ms-flex-order", "-ms-flex-pack", "-ms-flex-wrap", "-ms-flow-from", "-ms-flow-into", "-ms-grid-column", "-ms-grid-column-align", "-ms-grid-columns", "-ms-grid-column-span", "-ms-grid-layer", "-ms-grid-row", "-ms-grid-row-align", "-ms-grid-rows", "-ms-grid-row-span", "-ms-high-contrast-adjust", "-ms-hyphenate-limit-chars", "-ms-hyphenate-limit-lines", "-ms-hyphenate-limit-zone", "-ms-hyphens", "-ms-ime-mode", "-ms-interpolation-mode", "-ms-layout-grid", "-ms-layout-grid-char", "-ms-layout-grid-line", "-ms-layout-grid-mode", "-ms-layout-grid-type", "-ms-line-break", "-ms-overflow-style", "-ms-perspective", "-ms-perspective-origin", "-ms-perspective-origin-x", "-ms-perspective-origin-y", "-ms-progress-appearance", "-ms-scrollbar-3dlight-color", "-ms-scrollbar-arrow-color", "-ms-scrollbar-base-color", "-ms-scrollbar-darkshadow-color", "-ms-scrollbar-face-color", "-ms-scrollbar-highlight-color", "-ms-scrollbar-shadow-color", "-ms-scrollbar-track-color", "-ms-scroll-chaining", "-ms-scroll-limit", "-ms-scroll-limit-x-max", "-ms-scroll-limit-x-min", "-ms-scroll-limit-y-max", "-ms-scroll-limit-y-min", "-ms-scroll-rails", "-ms-scroll-snap-points-x", "-ms-scroll-snap-points-y", "-ms-scroll-snap-type", "-ms-scroll-snap-x", "-ms-scroll-snap-y", "-ms-scroll-translation", "-ms-text-align-last", "-ms-text-autospace", "-ms-text-combine-horizontal", "-ms-text-justify", "-ms-text-kashida-space", "-ms-text-overflow", "-ms-text-size-adjust", "-ms-text-underline-position", "-ms-touch-action", "-ms-touch-select", "-ms-transform", "-ms-transform-origin", "-ms-transform-origin-x", "-ms-transform-origin-y", "-ms-transform-origin-z", "-ms-user-select", "-ms-word-break", "-ms-word-wrap", "-ms-wrap-flow", "-ms-wrap-margin", "-ms-wrap-through", "-ms-writing-mode", "-ms-zoom", "-ms-zoom-animation", "nav-down", "nav-index", "nav-left", "nav-right", "nav-up", "negative", "-o-animation", "-o-animation-delay", "-o-animation-direction", "-o-animation-duration", "-o-animation-fill-mode", "-o-animation-iteration-count", "-o-animation-name", "-o-animation-play-state", "-o-animation-timing-function", "object-fit", "object-position", "-o-border-image", "-o-object-fit", "-o-object-position", "opacity", "order", "orphans", "-o-table-baseline", "-o-tab-size", "-o-text-overflow", "-o-transform", "-o-transform-origin", "-o-transition", "-o-transition-delay", "-o-transition-duration", "-o-transition-property", "-o-transition-timing-function", "offset-block-end", "offset-block-start", "offset-inline-end", "offset-inline-start", "outline", "outline-color", "outline-offset", "outline-style", "outline-width", "overflow", "overflow-wrap", "overflow-x", "overflow-y", "pad", "padding", "padding-bottom", "padding-block-end", "padding-block-start", "padding-inline-end", "padding-inline-start", "padding-left", "padding-right", "padding-top", "page-break-after", "page-break-before", "page-break-inside", "paint-order", "perspective", "perspective-origin", "pointer-events", "position", "prefix", "quotes", "range", "resize", "right", "ruby-align", "ruby-overhang", "ruby-position", "ruby-span", "scrollbar-3dlight-color", "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-darkshadow-color", "scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color", "scrollbar-track-color", "scroll-behavior", "scroll-snap-coordinate", "scroll-snap-destination", "scroll-snap-points-x", "scroll-snap-points-y", "scroll-snap-type", "shape-image-threshold", "shape-margin", "shape-outside", "shape-rendering", "size", "src", "stop-color", "stop-opacity", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "suffix", "system", "symbols", "table-layout", "tab-size", "text-align", "text-align-last", "text-anchor", "text-decoration", "text-decoration-color", "text-decoration-line", "text-decoration-style", "text-indent", "text-justify", "text-orientation", "text-overflow", "text-rendering", "text-shadow", "text-transform", "text-underline-position", "top", "touch-action", "transform", "transform-origin", "transform-style", "transition", "transition-delay", "transition-duration", "transition-property", "transition-timing-function", "unicode-bidi", "unicode-range", "user-select", "vertical-align", "visibility", "-webkit-animation", "-webkit-animation-delay", "-webkit-animation-direction", "-webkit-animation-duration", "-webkit-animation-fill-mode", "-webkit-animation-iteration-count", "-webkit-animation-name", "-webkit-animation-play-state", "-webkit-animation-timing-function", "-webkit-appearance", "-webkit-backdrop-filter", "-webkit-backface-visibility", "-webkit-background-clip", "-webkit-background-composite", "-webkit-background-origin", "-webkit-border-image", "-webkit-box-align", "-webkit-box-direction", "-webkit-box-flex", "-webkit-box-flex-group", "-webkit-box-ordinal-group", "-webkit-box-orient", "-webkit-box-pack", "-webkit-box-reflect", "-webkit-box-sizing", "-webkit-break-after", "-webkit-break-before", "-webkit-break-inside", "-webkit-column-break-after", "-webkit-column-break-before", "-webkit-column-break-inside", "-webkit-column-count", "-webkit-column-gap", "-webkit-column-rule", "-webkit-column-rule-color", "-webkit-column-rule-style", "-webkit-column-rule-width", "-webkit-columns", "-webkit-column-span", "-webkit-column-width", "-webkit-filter", "-webkit-flow-from", "-webkit-flow-into", "-webkit-font-feature-settings", "-webkit-hyphens", "-webkit-line-break", "-webkit-margin-bottom-collapse", "-webkit-margin-collapse", "-webkit-margin-start", "-webkit-margin-top-collapse", "-webkit-mask-clip", "-webkit-mask-image", "-webkit-mask-origin", "-webkit-mask-repeat", "-webkit-mask-size", "-webkit-nbsp-mode", "-webkit-overflow-scrolling", "-webkit-padding-start", "-webkit-perspective", "-webkit-perspective-origin", "-webkit-region-fragment", "-webkit-tap-highlight-color", "-webkit-text-fill-color", "-webkit-text-size-adjust", "-webkit-text-stroke", "-webkit-text-stroke-color", "-webkit-text-stroke-width", "-webkit-touch-callout", "-webkit-transform", "-webkit-transform-origin", "-webkit-transform-origin-x", "-webkit-transform-origin-y", "-webkit-transform-origin-z", "-webkit-transform-style", "-webkit-transition", "-webkit-transition-delay", "-webkit-transition-duration", "-webkit-transition-property", "-webkit-transition-timing-function", "-webkit-user-drag", "-webkit-user-modify", "-webkit-user-select", "white-space", "widows", "width", "will-change", "word-break", "word-spacing", "word-wrap", "writing-mode", "z-index", "zoom"] }; const htmlData = { "tags": [ "body", "head", "html", "address", "blockquote", "dd", "div", "section", "article", "aside", "header", "footer", "nav", "menu", "dl", "dt", "fieldset", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "iframe", "noframes", "object", "ol", "p", "ul", "applet", "center", "dir", "hr", "pre", "a", "abbr", "acronym", "area", "b", "base", "basefont", "bdo", "big", "br", "button", "caption", "cite", "code", "col", "colgroup", "del", "dfn", "em", "font", "i", "img", "input", "ins", "isindex", "kbd", "label", "legend", "li", "link", "map", "meta", "noscript", "optgroup", "option", "param", "q", "s", "samp", "script", "select", "small", "span", "strike", "strong", "style", "sub", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "tt", "u", "var", "canvas", "main", "figure", "plaintext", "figcaption", "hgroup", "details", "summary" ] }; var __extends$a = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var _a$1; var isWindows; if (typeof process === 'object') { isWindows = process.platform === 'win32'; } else if (typeof navigator === 'object') { var userAgent = navigator.userAgent; isWindows = userAgent.indexOf('Windows') >= 0; } var _schemePattern = /^\w[\w\d+.-]*$/; var _singleSlashStart = /^\//; var _doubleSlashStart = /^\/\//; function _validateUri(ret, _strict) { if (!ret.scheme && _strict) { throw new Error("[UriError]: Scheme is missing: {scheme: \"\", authority: \"" + ret.authority + "\", path: \"" + ret.path + "\", query: \"" + ret.query + "\", fragment: \"" + ret.fragment + "\"}"); } if (ret.scheme && !_schemePattern.test(ret.scheme)) { throw new Error('[UriError]: Scheme contains illegal characters.'); } if (ret.path) { if (ret.authority) { if (!_singleSlashStart.test(ret.path)) { throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character'); } } else { if (_doubleSlashStart.test(ret.path)) { throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")'); } } } } function _schemeFix(scheme, _strict) { if (!scheme && !_strict) { return 'file'; } return scheme; } function _referenceResolution(scheme, path) { switch (scheme) { case 'https': case 'http': case 'file': if (!path) { path = _slash; } else if (path[0] !== _slash) { path = _slash + path; } break; } return path; } var _empty = ''; var _slash = '/'; var _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; var URI = (function () { function URI(schemeOrData, authority, path, query, fragment, _strict) { if (_strict === void 0) { _strict = false; } if (typeof schemeOrData === 'object') { this.scheme = schemeOrData.scheme || _empty; this.authority = schemeOrData.authority || _empty; this.path = schemeOrData.path || _empty; this.query = schemeOrData.query || _empty; this.fragment = schemeOrData.fragment || _empty; } else { this.scheme = _schemeFix(schemeOrData, _strict); this.authority = authority || _empty; this.path = _referenceResolution(this.scheme, path || _empty); this.query = query || _empty; this.fragment = fragment || _empty; _validateUri(this, _strict); } } URI.isUri = function (thing) { if (thing instanceof URI) { return true; } if (!thing) { return false; } return typeof thing.authority === 'string' && typeof thing.fragment === 'string' && typeof thing.path === 'string' && typeof thing.query === 'string' && typeof thing.scheme === 'string' && typeof thing.fsPath === 'function' && typeof thing.with === 'function' && typeof thing.toString === 'function'; }; Object.defineProperty(URI.prototype, "fsPath", { get: function () { return uriToFsPath(this, false); }, enumerable: true, configurable: true }); URI.prototype.with = function (change) { if (!change) { return this; } var scheme = change.scheme, authority = change.authority, path = change.path, query = change.query, fragment = change.fragment; if (scheme === undefined) { scheme = this.scheme; } else if (scheme === null) { scheme = _empty; } if (authority === undefined) { authority = this.authority; } else if (authority === null) { authority = _empty; } if (path === undefined) { path = this.path; } else if (path === null) { path = _empty; } if (query === undefined) { query = this.query; } else if (query === null) { query = _empty; } if (fragment === undefined) { fragment = this.fragment; } else if (fragment === null) { fragment = _empty; } if (scheme === this.scheme && authority === this.authority && path === this.path && query === this.query && fragment === this.fragment) { return this; } return new _URI(scheme, authority, path, query, fragment); }; URI.parse = function (value, _strict) { if (_strict === void 0) { _strict = false; } var match = _regexp.exec(value); if (!match) { return new _URI(_empty, _empty, _empty, _empty, _empty); } return new _URI(match[2] || _empty, percentDecode(match[4] || _empty), percentDecode(match[5] || _empty), percentDecode(match[7] || _empty), percentDecode(match[9] || _empty), _strict); }; URI.file = function (path) { var authority = _empty; if (isWindows) { path = path.replace(/\\/g, _slash); } if (path[0] === _slash && path[1] === _slash) { var idx = path.indexOf(_slash, 2); if (idx === -1) { authority = path.substring(2); path = _slash; } else { authority = path.substring(2, idx); path = path.substring(idx) || _slash; } } return new _URI('file', authority, path, _empty, _empty); }; URI.from = function (components) { return new _URI(components.scheme, components.authority, components.path, components.query, components.fragment); }; URI.prototype.toString = function (skipEncoding) { if (skipEncoding === void 0) { skipEncoding = false; } return _asFormatted(this, skipEncoding); }; URI.prototype.toJSON = function () { return this; }; URI.revive = function (data) { if (!data) { return data; } else if (data instanceof URI) { return data; } else { var result = new _URI(data); result._formatted = data.external; result._fsPath = data._sep === _pathSepMarker ? data.fsPath : null; return result; } }; return URI; }()); var _pathSepMarker = isWindows ? 1 : undefined; var _URI = (function (_super) { __extends$a(_URI, _super); function _URI() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._formatted = null; _this._fsPath = null; return _this; } Object.defineProperty(_URI.prototype, "fsPath", { get: function () { if (!this._fsPath) { this._fsPath = uriToFsPath(this, false); } return this._fsPath; }, enumerable: true, configurable: true }); _URI.prototype.toString = function (skipEncoding) { if (skipEncoding === void 0) { skipEncoding = false; } if (!skipEncoding) { if (!this._formatted) { this._formatted = _asFormatted(this, false); } return this._formatted; } else { return _asFormatted(this, true); } }; _URI.prototype.toJSON = function () { var res = { $mid: 1 }; if (this._fsPath) { res.fsPath = this._fsPath; res._sep = _pathSepMarker; } if (this._formatted) { res.external = this._formatted; } if (this.path) { res.path = this.path; } if (this.scheme) { res.scheme = this.scheme; } if (this.authority) { res.authority = this.authority; } if (this.query) { res.query = this.query; } if (this.fragment) { res.fragment = this.fragment; } return res; }; return _URI; }(URI)); var encodeTable = (_a$1 = {}, _a$1[58 ] = '%3A', _a$1[47 ] = '%2F', _a$1[63 ] = '%3F', _a$1[35 ] = '%23', _a$1[91 ] = '%5B', _a$1[93 ] = '%5D', _a$1[64 ] = '%40', _a$1[33 ] = '%21', _a$1[36 ] = '%24', _a$1[38 ] = '%26', _a$1[39 ] = '%27', _a$1[40 ] = '%28', _a$1[41 ] = '%29', _a$1[42 ] = '%2A', _a$1[43 ] = '%2B', _a$1[44 ] = '%2C', _a$1[59 ] = '%3B', _a$1[61 ] = '%3D', _a$1[32 ] = '%20', _a$1); function encodeURIComponentFast(uriComponent, allowSlash) { var res = undefined; var nativeEncodePos = -1; for (var pos = 0; pos < uriComponent.length; pos++) { var code = uriComponent.charCodeAt(pos); if ((code >= 97 && code <= 122 ) || (code >= 65 && code <= 90 ) || (code >= 48 && code <= 57 ) || code === 45 || code === 46 || code === 95 || code === 126 || (allowSlash && code === 47 )) { if (nativeEncodePos !== -1) { res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos)); nativeEncodePos = -1; } if (res !== undefined) { res += uriComponent.charAt(pos); } } else { if (res === undefined) { res = uriComponent.substr(0, pos); } var escaped = encodeTable[code]; if (escaped !== undefined) { if (nativeEncodePos !== -1) { res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos)); nativeEncodePos = -1; } res += escaped; } else if (nativeEncodePos === -1) { nativeEncodePos = pos; } } } if (nativeEncodePos !== -1) { res += encodeURIComponent(uriComponent.substring(nativeEncodePos)); } return res !== undefined ? res : uriComponent; } function encodeURIComponentMinimal(path) { var res = undefined; for (var pos = 0; pos < path.length; pos++) { var code = path.charCodeAt(pos); if (code === 35 || code === 63 ) { if (res === undefined) { res = path.substr(0, pos); } res += encodeTable[code]; } else { if (res !== undefined) { res += path[pos]; } } } return res !== undefined ? res : path; } function uriToFsPath(uri, keepDriveLetterCasing) { var value; if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') { value = "//" + uri.authority + uri.path; } else if (uri.path.charCodeAt(0) === 47 && (uri.path.charCodeAt(1) >= 65 && uri.path.charCodeAt(1) <= 90 || uri.path.charCodeAt(1) >= 97 && uri.path.charCodeAt(1) <= 122 ) && uri.path.charCodeAt(2) === 58 ) { if (!keepDriveLetterCasing) { value = uri.path[1].toLowerCase() + uri.path.substr(2); } else { value = uri.path.substr(1); } } else { value = uri.path; } if (isWindows) { value = value.replace(/\//g, '\\'); } return value; } function _asFormatted(uri, skipEncoding) { var encoder = !skipEncoding ? encodeURIComponentFast : encodeURIComponentMinimal; var res = ''; var scheme = uri.scheme, authority = uri.authority, path = uri.path, query = uri.query, fragment = uri.fragment; if (scheme) { res += scheme; res += ':'; } if (authority || scheme === 'file') { res += _slash; res += _slash; } if (authority) { var idx = authority.indexOf('@'); if (idx !== -1) { var userinfo = authority.substr(0, idx); authority = authority.substr(idx + 1); idx = userinfo.indexOf(':'); if (idx === -1) { res += encoder(userinfo, false); } else { res += encoder(userinfo.substr(0, idx), false); res += ':'; res += encoder(userinfo.substr(idx + 1), false); } res += '@'; } authority = authority.toLowerCase(); idx = authority.indexOf(':'); if (idx === -1) { res += encoder(authority, false); } else { res += encoder(authority.substr(0, idx), false); res += authority.substr(idx); } } if (path) { if (path.length >= 3 && path.charCodeAt(0) === 47 && path.charCodeAt(2) === 58 ) { var code = path.charCodeAt(1); if (code >= 65 && code <= 90 ) { path = "/" + String.fromCharCode(code + 32) + ":" + path.substr(3); } } else if (path.length >= 2 && path.charCodeAt(1) === 58 ) { var code = path.charCodeAt(0); if (code >= 65 && code <= 90 ) { path = String.fromCharCode(code + 32) + ":" + path.substr(2); } } res += encoder(path, true); } if (query) { res += '?'; res += encoder(query, false); } if (fragment) { res += '#'; res += !skipEncoding ? encodeURIComponentFast(fragment, false) : fragment; } return res; } function decodeURIComponentGraceful(str) { try { return decodeURIComponent(str); } catch (_a) { if (str.length > 3) { return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3)); } else { return str; } } } var _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g; function percentDecode(str) { if (!str.match(_rEncodedAsHex)) { return str; } return str.replace(_rEncodedAsHex, function (match) { return decodeURIComponentGraceful(match); }); } var FileType$1; (function (FileType) { FileType[FileType["Unknown"] = 0] = "Unknown"; FileType[FileType["File"] = 1] = "File"; FileType[FileType["Directory"] = 2] = "Directory"; FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink"; })(FileType$1 || (FileType$1 = {})); const PathMatchRegex = new RegExp('^(/|//|\\\\\\\\|[A-Za-z]:(/|\\\\))'); const Dot = '.'.charCodeAt(0); function isAbsolutePath(path) { return PathMatchRegex.test(path); } function normalizePath(parts) { const newParts = []; for (const part of parts) { if (part.length === 0 || part.length === 1 && part.charCodeAt(0) === Dot) ; else if (part.length === 2 && part.charCodeAt(0) === Dot && part.charCodeAt(1) === Dot) { newParts.pop(); } else { newParts.push(part); } } if (parts.length > 1 && parts[parts.length - 1].length === 0) { newParts.push(''); } let res = newParts.join('/'); if (parts[0].length === 0) { res = '/' + res; } return res; } function joinPath$1(uri, ...paths) { const parts = uri.path.split('/'); for (const path of paths) { parts.push(...path.split('/')); } return uri.with({ path: normalizePath(parts) }); } function isNumber$1(code) { return code > 47 && code < 58; } function isAlpha$1(code, from, to) { from = from || 65; to = to || 90; code &= ~32; return code >= from && code <= to; } function isAlphaNumericWord(code) { return isNumber$1(code) || isAlphaWord(code); } function isAlphaWord(code) { return code === 95 || isAlpha$1(code); } function isWhiteSpace$3(code) { return code === 32 || code === 9 || code === 160; } function isSpace(code) { return isWhiteSpace$3(code) || code === 10 || code === 13; } function isQuote$3(code) { return code === 39 || code === 34 ; } class Scanner$1 { constructor(str, start, end) { if (end == null && typeof str === 'string') { end = str.length; } this.string = str; this.pos = this.start = start || 0; this.end = end || 0; } eof() { return this.pos >= this.end; } limit(start, end) { return new Scanner$1(this.string, start, end); } peek() { return this.string.charCodeAt(this.pos); } next() { if (this.pos < this.string.length) { return this.string.charCodeAt(this.pos++); } } eat(match) { const ch = this.peek(); const ok = typeof match === 'function' ? match(ch) : ch === match; if (ok) { this.next(); } return ok; } eatWhile(match) { const start = this.pos; while (!this.eof() && this.eat(match)) { } return this.pos !== start; } backUp(n) { this.pos -= (n || 1); } current() { return this.substring(this.start, this.pos); } substring(start, end) { return this.string.slice(start, end); } error(message, pos = this.pos) { return new ScannerError(`${message} at ${pos + 1}`, pos, this.string); } } class ScannerError extends Error { constructor(message, pos, str) { super(message); this.pos = pos; this.string = str; } } function tokenScanner$1(tokens) { return { tokens, start: 0, pos: 0, size: tokens.length }; } function peek$3(scanner) { return scanner.tokens[scanner.pos]; } function next(scanner) { return scanner.tokens[scanner.pos++]; } function slice(scanner, from = scanner.start, to = scanner.pos) { return scanner.tokens.slice(from, to); } function readable$1(scanner) { return scanner.pos < scanner.size; } function consume$2(scanner, test) { const token = peek$3(scanner); if (token && test(token)) { scanner.pos++; return true; } return false; } function error$1(scanner, message, token = peek$3(scanner)) { if (token && token.start != null) { message += ` at ${token.start}`; } const err = new Error(message); err['pos'] = token && token.start; return err; } function abbreviation(abbr, options = {}) { const scanner = tokenScanner$1(abbr); const result = statements(scanner, options); if (readable$1(scanner)) { throw error$1(scanner, 'Unexpected character'); } return result; } function statements(scanner, options) { const result = { type: 'TokenGroup', elements: [] }; let ctx = result; let node; const stack = []; while (readable$1(scanner)) { if (node = element$2(scanner, options) || group(scanner, options)) { ctx.elements.push(node); if (consume$2(scanner, isChildOperator)) { stack.push(ctx); ctx = node; } else if (consume$2(scanner, isSiblingOperator$1)) { continue; } else if (consume$2(scanner, isClimbOperator)) { do { if (stack.length) { ctx = stack.pop(); } } while (consume$2(scanner, isClimbOperator)); } } else { break; } } return result; } function group(scanner, options) { if (consume$2(scanner, isGroupStart)) { const result = statements(scanner, options); const token = next(scanner); if (isBracket$2(token, 'group', false)) { result.repeat = repeater(scanner); } return result; } } function element$2(scanner, options) { let attr; const elem = { type: 'TokenElement', name: void 0, attributes: void 0, value: void 0, repeat: void 0, selfClose: false, elements: [] }; if (elementName(scanner, options)) { elem.name = slice(scanner); } while (readable$1(scanner)) { scanner.start = scanner.pos; if (!elem.repeat && !isEmpty(elem) && consume$2(scanner, isRepeater)) { elem.repeat = scanner.tokens[scanner.pos - 1]; } else if (!elem.value && text(scanner)) { elem.value = getText(scanner); } else if (attr = shortAttribute(scanner, 'id', options) || shortAttribute(scanner, 'class', options) || attributeSet(scanner)) { if (!elem.attributes) { elem.attributes = Array.isArray(attr) ? attr.slice() : [attr]; } else { elem.attributes = elem.attributes.concat(attr); } } else { if (!isEmpty(elem) && consume$2(scanner, isCloseOperator)) { elem.selfClose = true; if (!elem.repeat && consume$2(scanner, isRepeater)) { elem.repeat = scanner.tokens[scanner.pos - 1]; } } break; } } return !isEmpty(elem) ? elem : void 0; } function attributeSet(scanner) { if (consume$2(scanner, isAttributeSetStart)) { const attributes = []; let attr; while (readable$1(scanner)) { if (attr = attribute(scanner)) { attributes.push(attr); } else if (consume$2(scanner, isAttributeSetEnd)) { break; } else if (!consume$2(scanner, isWhiteSpace$2)) { throw error$1(scanner, `Unexpected "${peek$3(scanner).type}" token`); } } return attributes; } } function shortAttribute(scanner, type, options) { if (isOperator$1(peek$3(scanner), type)) { scanner.pos++; const attr = { name: [createLiteral$1(type)] }; if (options.jsx && text(scanner)) { attr.value = getText(scanner); attr.expression = true; } else { attr.value = literal$2(scanner) ? slice(scanner) : void 0; } return attr; } } function attribute(scanner) { if (quoted(scanner)) { return { value: slice(scanner) }; } if (literal$2(scanner, true)) { return { name: slice(scanner), value: consume$2(scanner, isEquals) && (quoted(scanner) || literal$2(scanner, true)) ? slice(scanner) : void 0 }; } } function repeater(scanner) { return isRepeater(peek$3(scanner)) ? scanner.tokens[scanner.pos++] : void 0; } function quoted(scanner) { const start = scanner.pos; const quote = peek$3(scanner); if (isQuote$2(quote)) { scanner.pos++; while (readable$1(scanner)) { if (isQuote$2(next(scanner), quote.single)) { scanner.start = start; return true; } } throw error$1(scanner, 'Unclosed quote', quote); } return false; } function literal$2(scanner, allowBrackets) { const start = scanner.pos; const brackets = { attribute: 0, expression: 0, group: 0 }; while (readable$1(scanner)) { const token = peek$3(scanner); if (brackets.expression) { if (isBracket$2(token, 'expression')) { brackets[token.context] += token.open ? 1 : -1; } } else if (isQuote$2(token) || isOperator$1(token) || isWhiteSpace$2(token) || isRepeater(token)) { break; } else if (isBracket$2(token)) { if (!allowBrackets) { break; } if (token.open) { brackets[token.context]++; } else if (!brackets[token.context]) { break; } else { brackets[token.context]--; } } scanner.pos++; } if (start !== scanner.pos) { scanner.start = start; return true; } return false; } function elementName(scanner, options) { const start = scanner.pos; if (options.jsx && consume$2(scanner, isCapitalizedLiteral)) { while (readable$1(scanner)) { const { pos } = scanner; if (!consume$2(scanner, isClassNameOperator) || !consume$2(scanner, isCapitalizedLiteral)) { scanner.pos = pos; break; } } } while (readable$1(scanner) && consume$2(scanner, isElementName)) { } if (scanner.pos !== start) { scanner.start = start; return true; } return false; } function text(scanner) { const start = scanner.pos; if (consume$2(scanner, isTextStart)) { let brackets = 0; while (readable$1(scanner)) { const token = next(scanner); if (isBracket$2(token, 'expression')) { if (token.open) { brackets++; } else if (!brackets) { break; } else { brackets--; } } } scanner.start = start; return true; } return false; } function getText(scanner) { let from = scanner.start; let to = scanner.pos; if (isBracket$2(scanner.tokens[from], 'expression', true)) { from++; } if (isBracket$2(scanner.tokens[to - 1], 'expression', false)) { to--; } return slice(scanner, from, to); } function isBracket$2(token, context, isOpen) { return Boolean(token && token.type === 'Bracket' && (!context || token.context === context) && (isOpen == null || token.open === isOpen)); } function isOperator$1(token, type) { return Boolean(token && token.type === 'Operator' && (!type || token.operator === type)); } function isQuote$2(token, isSingle) { return Boolean(token && token.type === 'Quote' && (isSingle == null || token.single === isSingle)); } function isWhiteSpace$2(token) { return Boolean(token && token.type === 'WhiteSpace'); } function isEquals(token) { return isOperator$1(token, 'equal'); } function isRepeater(token) { return Boolean(token && token.type === 'Repeater'); } function isLiteral$2(token) { return token.type === 'Literal'; } function isCapitalizedLiteral(token) { if (isLiteral$2(token)) { const ch = token.value.charCodeAt(0); return ch >= 65 && ch <= 90; } return false; } function isElementName(token) { return token.type === 'Literal' || token.type === 'RepeaterNumber' || token.type === 'RepeaterPlaceholder'; } function isClassNameOperator(token) { return isOperator$1(token, 'class'); } function isAttributeSetStart(token) { return isBracket$2(token, 'attribute', true); } function isAttributeSetEnd(token) { return isBracket$2(token, 'attribute', false); } function isTextStart(token) { return isBracket$2(token, 'expression', true); } function isGroupStart(token) { return isBracket$2(token, 'group', true); } function createLiteral$1(value) { return { type: 'Literal', value }; } function isEmpty(elem) { return !elem.name && !elem.value && !elem.attributes; } function isChildOperator(token) { return isOperator$1(token, 'child'); } function isSiblingOperator$1(token) { return isOperator$1(token, 'sibling'); } function isClimbOperator(token) { return isOperator$1(token, 'climb'); } function isCloseOperator(token) { return isOperator$1(token, 'close'); } function escaped(scanner) { if (scanner.eat(92 )) { scanner.start = scanner.pos; if (!scanner.eof()) { scanner.pos++; } return true; } return false; } function tokenize$1(source) { const scanner = new Scanner$1(source); const result = []; const ctx = { group: 0, attribute: 0, expression: 0, quote: 0 }; let ch = 0; let token; while (!scanner.eof()) { ch = scanner.peek(); token = getToken$1(scanner, ctx); if (token) { result.push(token); if (token.type === 'Quote') { ctx.quote = ch === ctx.quote ? 0 : ch; } else if (token.type === 'Bracket') { ctx[token.context] += token.open ? 1 : -1; } } else { throw scanner.error('Unexpected character'); } } return result; } function getToken$1(scanner, ctx) { return field$2(scanner, ctx) || repeaterPlaceholder(scanner) || repeaterNumber(scanner) || repeater$1(scanner) || whiteSpace$1(scanner) || literal$1$1(scanner, ctx) || operator$1(scanner) || quote(scanner) || bracket$1(scanner); } function literal$1$1(scanner, ctx) { const start = scanner.pos; let value = ''; while (!scanner.eof()) { if (escaped(scanner)) { value += scanner.current(); continue; } const ch = scanner.peek(); if (ch === ctx.quote || ch === 36 || isAllowedOperator(ch, ctx)) { break; } if (ctx.expression && ch === 125 ) { break; } if (!ctx.quote && !ctx.expression) { if (!ctx.attribute && !isElementName$1(ch)) { break; } if (isAllowedSpace(ch, ctx) || isAllowedRepeater(ch, ctx) || isQuote$3(ch) || bracketType(ch)) { break; } } value += scanner.string[scanner.pos++]; } if (start !== scanner.pos) { scanner.start = start; return { type: 'Literal', value, start, end: scanner.pos }; } } function whiteSpace$1(scanner) { const start = scanner.pos; if (scanner.eatWhile(isSpace)) { return { type: 'WhiteSpace', start, end: scanner.pos, value: scanner.substring(start, scanner.pos) }; } } function quote(scanner) { const ch = scanner.peek(); if (isQuote$3(ch)) { return { type: 'Quote', single: ch === 39 , start: scanner.pos++, end: scanner.pos }; } } function bracket$1(scanner) { const ch = scanner.peek(); const context = bracketType(ch); if (context) { return { type: 'Bracket', open: isOpenBracket$2(ch), context, start: scanner.pos++, end: scanner.pos }; } } function operator$1(scanner) { const op = operatorType$1(scanner.peek()); if (op) { return { type: 'Operator', operator: op, start: scanner.pos++, end: scanner.pos }; } } function repeater$1(scanner) { const start = scanner.pos; if (scanner.eat(42 )) { scanner.start = scanner.pos; let count = 1; let implicit = false; if (scanner.eatWhile(isNumber$1)) { count = Number(scanner.current()); } else { implicit = true; } return { type: 'Repeater', count, value: 0, implicit, start, end: scanner.pos }; } } function repeaterPlaceholder(scanner) { const start = scanner.pos; if (scanner.eat(36 ) && scanner.eat(35 )) { return { type: 'RepeaterPlaceholder', value: void 0, start, end: scanner.pos }; } scanner.pos = start; } function repeaterNumber(scanner) { const start = scanner.pos; if (scanner.eatWhile(36 )) { const size = scanner.pos - start; let reverse = false; let base = 1; let parent = 0; if (scanner.eat(64 )) { while (scanner.eat(94 )) { parent++; } reverse = scanner.eat(45 ); scanner.start = scanner.pos; if (scanner.eatWhile(isNumber$1)) { base = Number(scanner.current()); } } scanner.start = start; return { type: 'RepeaterNumber', size, reverse, base, parent, start, end: scanner.pos }; } } function field$2(scanner, ctx) { const start = scanner.pos; if ((ctx.expression || ctx.attribute) && scanner.eat(36 ) && scanner.eat(123 )) { scanner.start = scanner.pos; let index; let name = ''; if (scanner.eatWhile(isNumber$1)) { index = Number(scanner.current()); name = scanner.eat(58 ) ? consumePlaceholder$2(scanner) : ''; } else if (isAlpha$1(scanner.peek())) { name = consumePlaceholder$2(scanner); } if (scanner.eat(125 )) { return { type: 'Field', index, name, start, end: scanner.pos }; } throw scanner.error('Expecting }'); } scanner.pos = start; } function consumePlaceholder$2(stream) { const stack = []; stream.start = stream.pos; while (!stream.eof()) { if (stream.eat(123 )) { stack.push(stream.pos); } else if (stream.eat(125 )) { if (!stack.length) { stream.pos--; break; } stack.pop(); } else { stream.pos++; } } if (stack.length) { stream.pos = stack.pop(); throw stream.error(`Expecting }`); } return stream.current(); } function isAllowedOperator(ch, ctx) { const op = operatorType$1(ch); if (!op || ctx.quote || ctx.expression) { return false; } return !ctx.attribute || op === 'equal'; } function isAllowedSpace(ch, ctx) { return isSpace(ch) && !ctx.expression; } function isAllowedRepeater(ch, ctx) { return ch === 42 && !ctx.attribute && !ctx.expression; } function bracketType(ch) { if (ch === 40 || ch === 41 ) { return 'group'; } if (ch === 91 || ch === 93 ) { return 'attribute'; } if (ch === 123 || ch === 125 ) { return 'expression'; } } function operatorType$1(ch) { return (ch === 62 && 'child') || (ch === 43 && 'sibling') || (ch === 94 && 'climb') || (ch === 46 && 'class') || (ch === 35 && 'id') || (ch === 47 && 'close') || (ch === 61 && 'equal') || void 0; } function isOpenBracket$2(ch) { return ch === 123 || ch === 91 || ch === 40 ; } function isElementName$1(ch) { return isAlphaNumericWord(ch) || ch === 45 || ch === 58 || ch === 33 ; } const operators = { child: '>', class: '.', climb: '^', id: '#', equal: '=', close: '/', sibling: '+' }; const tokenVisitor = { Literal(token) { return token.value; }, Quote(token) { return token.single ? '\'' : '"'; }, Bracket(token) { if (token.context === 'attribute') { return token.open ? '[' : ']'; } else if (token.context === 'expression') { return token.open ? '{' : '}'; } else { return token.open ? '(' : '}'; } }, Operator(token) { return operators[token.operator]; }, Field(token, state) { if (token.index != null) { return token.name ? `\${${token.index}:${token.name}}` : `\${${token.index}`; } else if (token.name) { return state.getVariable(token.name); } return ''; }, RepeaterPlaceholder(token, state) { let repeater; for (let i = state.repeaters.length - 1; i >= 0; i--) { if (state.repeaters[i].implicit) { repeater = state.repeaters[i]; break; } } state.inserted = true; return state.getText(repeater && repeater.value); }, RepeaterNumber(token, state) { let value = 1; const lastIx = state.repeaters.length - 1; const repeater = state.repeaters[lastIx]; if (repeater) { value = token.reverse ? token.base + repeater.count - repeater.value - 1 : token.base + repeater.value; if (token.parent) { const parentIx = Math.max(0, lastIx - token.parent); if (parentIx !== lastIx) { const parentRepeater = state.repeaters[parentIx]; value += repeater.count * parentRepeater.value; } } } let result = String(value); while (result.length < token.size) { result = '0' + result; } return result; }, WhiteSpace(token) { return token.value; } }; function stringify$1(token, state) { if (!tokenVisitor[token.type]) { throw new Error(`Unknown token ${token.type}`); } return tokenVisitor[token.type](token, state); } const urlRegex = /^((https?:|ftp:|file:)?\/\/|(www|ftp)\.)[^ ]*$/; const emailRegex = /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,5}$/; function convert(abbr, options = {}) { let textInserted = false; let cleanText; if (options.text) { if (Array.isArray(options.text)) { cleanText = options.text.filter(s => s.trim()); } else { cleanText = options.text; } } const result = { type: 'Abbreviation', children: convertGroup(abbr, { inserted: false, repeaters: [], text: options.text, cleanText, repeatGuard: options.maxRepeat || Number.POSITIVE_INFINITY, getText(pos) { var _a; textInserted = true; let value; if (Array.isArray(options.text)) { if (pos !== undefined && pos >= 0 && pos < cleanText.length) { return cleanText[pos]; } value = pos !== undefined ? options.text[pos] : options.text.join('\n'); } else { value = (_a = options.text) !== null && _a !== void 0 ? _a : ''; } return value; }, getVariable(name) { const varValue = options.variables && options.variables[name]; return varValue != null ? varValue : name; } }) }; if (options.text != null && !textInserted) { const deepest = deepestNode(last$1(result.children)); if (deepest) { const text = Array.isArray(options.text) ? options.text.join('\n') : options.text; insertText(deepest, text); if (deepest.name === 'a' && options.href) { insertHref(deepest, text); } } } return result; } function convertStatement(node, state) { let result = []; if (node.repeat) { const original = node.repeat; const repeat = Object.assign({}, original); repeat.count = repeat.implicit && Array.isArray(state.text) ? state.cleanText.length : (repeat.count || 1); let items; state.repeaters.push(repeat); for (let i = 0; i < repeat.count; i++) { repeat.value = i; node.repeat = repeat; items = isGroup(node) ? convertGroup(node, state) : convertElement(node, state); if (repeat.implicit && !state.inserted) { const target = last$1(items); const deepest = target && deepestNode(target); if (deepest) { insertText(deepest, state.getText(repeat.value)); } } result = result.concat(items); if (--state.repeatGuard <= 0) { break; } } state.repeaters.pop(); node.repeat = original; if (repeat.implicit) { state.inserted = true; } } else { result = result.concat(isGroup(node) ? convertGroup(node, state) : convertElement(node, state)); } return result; } function convertElement(node, state) { let children = []; const elem = { type: 'AbbreviationNode', name: node.name && stringifyName(node.name, state), value: node.value && stringifyValue$1(node.value, state), attributes: void 0, children, repeat: node.repeat && Object.assign({}, node.repeat), selfClosing: node.selfClose, }; let result = [elem]; for (const child of node.elements) { children = children.concat(convertStatement(child, state)); } if (node.attributes) { elem.attributes = []; for (const attr of node.attributes) { elem.attributes.push(convertAttribute(attr, state)); } } if (!elem.name && !elem.attributes && elem.value && !elem.value.some(isField$1)) { result = result.concat(children); } else { elem.children = children; } return result; } function convertGroup(node, state) { let result = []; for (const child of node.elements) { result = result.concat(convertStatement(child, state)); } if (node.repeat) { result = attachRepeater(result, node.repeat); } return result; } function convertAttribute(node, state) { let implied = false; let isBoolean = false; let valueType = node.expression ? 'expression' : 'raw'; let value; const name = node.name && stringifyName(node.name, state); if (name && name[0] === '!') { implied = true; } if (name && name[name.length - 1] === '.') { isBoolean = true; } if (node.value) { const tokens = node.value.slice(); if (isQuote$2(tokens[0])) { const quote = tokens.shift(); if (tokens.length && last$1(tokens).type === quote.type) { tokens.pop(); } valueType = quote.single ? 'singleQuote' : 'doubleQuote'; } else if (isBracket$2(tokens[0], 'expression', true)) { valueType = 'expression'; tokens.shift(); if (isBracket$2(last$1(tokens), 'expression', false)) { tokens.pop(); } } value = stringifyValue$1(tokens, state); } return { name: isBoolean || implied ? name.slice(implied ? 1 : 0, isBoolean ? -1 : void 0) : name, value, boolean: isBoolean, implied, valueType }; } function stringifyName(tokens, state) { let str = ''; for (let i = 0; i < tokens.length; i++) { str += stringify$1(tokens[i], state); } return str; } function stringifyValue$1(tokens, state) { const result = []; let str = ''; for (let i = 0, token; i < tokens.length; i++) { token = tokens[i]; if (isField$1(token)) { if (str) { result.push(str); str = ''; } result.push(token); } else { str += stringify$1(token, state); } } if (str) { result.push(str); } return result; } function isGroup(node) { return node.type === 'TokenGroup'; } function isField$1(token) { return typeof token === 'object' && token.type === 'Field' && token.index != null; } function last$1(arr) { return arr[arr.length - 1]; } function deepestNode(node) { return node.children.length ? deepestNode(last$1(node.children)) : node; } function insertText(node, text) { if (node.value) { const lastToken = last$1(node.value); if (typeof lastToken === 'string') { node.value[node.value.length - 1] += text; } else { node.value.push(text); } } else { node.value = [text]; } } function insertHref(node, text) { var _a; let href = ''; if (urlRegex.test(text)) { href = text; if (!/\w+:/.test(href) && !href.startsWith('//')) { href = `http://${href}`; } } else if (emailRegex.test(text)) { href = `mailto:${text}`; } const hrefAttribute = (_a = node.attributes) === null || _a === void 0 ? void 0 : _a.find(attr => attr.name === 'href'); if (!hrefAttribute) { if (!node.attributes) { node.attributes = []; } node.attributes.push({ name: 'href', value: [href], valueType: 'doubleQuote' }); } else if (!hrefAttribute.value) { hrefAttribute.value = [href]; } } function attachRepeater(items, repeater) { for (const item of items) { if (!item.repeat) { item.repeat = Object.assign({}, repeater); } } return items; } function parseAbbreviation$1(abbr, options) { try { const tokens = typeof abbr === 'string' ? tokenize$1(abbr) : abbr; return convert(abbreviation(tokens, options), options); } catch (err) { if (err instanceof ScannerError && typeof abbr === 'string') { err.message += `\n${abbr}\n${'-'.repeat(err.pos)}^`; } throw err; } } function tokenize(abbr, isValue) { let brackets = 0; let token; const scanner = new Scanner$1(abbr); const tokens = []; while (!scanner.eof()) { token = getToken(scanner, brackets === 0 && !isValue); if (!token) { throw scanner.error('Unexpected character'); } if (token.type === 'Bracket') { if (!brackets && token.open) { mergeTokens(scanner, tokens); } brackets += token.open ? 1 : -1; if (brackets < 0) { throw scanner.error('Unexpected bracket', token.start); } } tokens.push(token); if (shouldConsumeDashAfter(token) && (token = operator(scanner))) { tokens.push(token); } } return tokens; } function getToken(scanner, short) { return field$1(scanner) || numberValue(scanner) || colorValue(scanner) || stringValue(scanner) || bracket(scanner) || operator(scanner) || whiteSpace(scanner) || literal$1(scanner, short); } function field$1(scanner) { const start = scanner.pos; if (scanner.eat(36 ) && scanner.eat(123 )) { scanner.start = scanner.pos; let index; let name = ''; if (scanner.eatWhile(isNumber$1)) { index = Number(scanner.current()); name = scanner.eat(58 ) ? consumePlaceholder$1(scanner) : ''; } else if (isAlpha$1(scanner.peek())) { name = consumePlaceholder$1(scanner); } if (scanner.eat(125 )) { return { type: 'Field', index, name, start, end: scanner.pos }; } throw scanner.error('Expecting }'); } scanner.pos = start; } function consumePlaceholder$1(stream) { const stack = []; stream.start = stream.pos; while (!stream.eof()) { if (stream.eat(123 )) { stack.push(stream.pos); } else if (stream.eat(125 )) { if (!stack.length) { stream.pos--; break; } stack.pop(); } else { stream.pos++; } } if (stack.length) { stream.pos = stack.pop(); throw stream.error(`Expecting }`); } return stream.current(); } function literal$1(scanner, short) { const start = scanner.pos; if (scanner.eat(isIdentPrefix)) { scanner.eatWhile(start ? isKeyword : isLiteral); } else if (scanner.eat(isAlphaWord)) { scanner.eatWhile(short ? isLiteral : isKeyword); } else { scanner.eat(46 ); scanner.eatWhile(isLiteral); } if (start !== scanner.pos) { scanner.start = start; return createLiteral(scanner, scanner.start = start); } } function createLiteral(scanner, start = scanner.start, end = scanner.pos) { return { type: 'Literal', value: scanner.substring(start, end), start, end }; } function numberValue(scanner) { const start = scanner.pos; if (consumeNumber(scanner)) { scanner.start = start; const rawValue = scanner.current(); scanner.start = scanner.pos; scanner.eat(37 ) || scanner.eatWhile(isAlphaWord); return { type: 'NumberValue', value: Number(rawValue), rawValue, unit: scanner.current(), start, end: scanner.pos }; } } function stringValue(scanner) { const ch = scanner.peek(); const start = scanner.pos; let finished = false; if (isQuote$3(ch)) { scanner.pos++; while (!scanner.eof()) { if (scanner.eat(ch)) { finished = true; break; } else { scanner.pos++; } } scanner.start = start; return { type: 'StringValue', value: scanner.substring(start + 1, scanner.pos - (finished ? 1 : 0)), quote: ch === 39 ? 'single' : 'double', start, end: scanner.pos }; } } function colorValue(scanner) { const start = scanner.pos; if (scanner.eat(35 )) { const valueStart = scanner.pos; let color = ''; let alpha = ''; if (scanner.eatWhile(isHex)) { color = scanner.substring(valueStart, scanner.pos); alpha = colorAlpha(scanner); } else if (scanner.eat(116 )) { color = '0'; alpha = colorAlpha(scanner) || '0'; } else { alpha = colorAlpha(scanner); } if (color || alpha || scanner.eof()) { const { r, g, b, a } = parseColor(color, alpha); return { type: 'ColorValue', r, g, b, a, raw: scanner.substring(start + 1, scanner.pos), start, end: scanner.pos }; } else { return createLiteral(scanner, start); } } scanner.pos = start; } function colorAlpha(scanner) { const start = scanner.pos; if (scanner.eat(46 )) { scanner.start = start; if (scanner.eatWhile(isNumber$1)) { return scanner.current(); } return '1'; } return ''; } function whiteSpace(scanner) { const start = scanner.pos; if (scanner.eatWhile(isSpace)) { return { type: 'WhiteSpace', start, end: scanner.pos }; } } function bracket(scanner) { const ch = scanner.peek(); if (isBracket(ch)) { return { type: 'Bracket', open: ch === 40 , start: scanner.pos++, end: scanner.pos }; } } function operator(scanner) { const op = operatorType(scanner.peek()); if (op) { return { type: 'Operator', operator: op, start: scanner.pos++, end: scanner.pos }; } } function consumeNumber(stream) { const start = stream.pos; stream.eat(45 ); const afterNegative = stream.pos; const hasDecimal = stream.eatWhile(isNumber$1); const prevPos = stream.pos; if (stream.eat(46 )) { const hasFloat = stream.eatWhile(isNumber$1); if (!hasDecimal && !hasFloat) { stream.pos = prevPos; } } if (stream.pos === afterNegative) { stream.pos = start; } return stream.pos !== start; } function isIdentPrefix(code) { return code === 64 || code === 36 ; } function operatorType(ch) { return (ch === 43 && "+" ) || (ch === 33 && "!" ) || (ch === 44 && "," ) || (ch === 58 && ":" ) || (ch === 45 && "-" ) || void 0; } function isHex(code) { return isNumber$1(code) || isAlpha$1(code, 65, 70); } function isKeyword(code) { return isAlphaNumericWord(code) || code === 45 ; } function isBracket(code) { return code === 40 || code === 41 ; } function isLiteral(code) { return isAlphaWord(code) || code === 37 || code === 47 ; } function parseColor(value, alpha) { let r = '0'; let g = '0'; let b = '0'; let a = Number(alpha != null && alpha !== '' ? alpha : 1); if (value === 't') { a = 0; } else { switch (value.length) { case 0: break; case 1: r = g = b = value + value; break; case 2: r = g = b = value; break; case 3: r = value[0] + value[0]; g = value[1] + value[1]; b = value[2] + value[2]; break; default: value += value; r = value.slice(0, 2); g = value.slice(2, 4); b = value.slice(4, 6); } } return { r: parseInt(r, 16), g: parseInt(g, 16), b: parseInt(b, 16), a }; } function shouldConsumeDashAfter(token) { return token.type === 'ColorValue' || (token.type === 'NumberValue' && !token.unit); } function mergeTokens(scanner, tokens) { let start = 0; let end = 0; while (tokens.length) { const token = last(tokens); if (token.type === 'Literal' || token.type === 'NumberValue') { start = token.start; if (!end) { end = token.end; } tokens.pop(); } else { break; } } if (start !== end) { tokens.push(createLiteral(scanner, start, end)); } } function last(arr) { return arr[arr.length - 1]; } function tokenScanner(tokens) { return { tokens, start: 0, pos: 0, size: tokens.length }; } function peek$2(scanner) { return scanner.tokens[scanner.pos]; } function readable(scanner) { return scanner.pos < scanner.size; } function consume$1(scanner, test) { if (test(peek$2(scanner))) { scanner.pos++; return true; } return false; } function error(scanner, message, token = peek$2(scanner)) { if (token && token.start != null) { message += ` at ${token.start}`; } const err = new Error(message); err['pos'] = token && token.start; return err; } function parser(tokens, options = {}) { const scanner = tokenScanner(tokens); const result = []; let property; while (readable(scanner)) { if (property = consumeProperty(scanner, options)) { result.push(property); } else if (!consume$1(scanner, isSiblingOperator)) { throw error(scanner, 'Unexpected token'); } } return result; } function consumeProperty(scanner, options) { let name; let important = false; let valueFragment; const value = []; const token = peek$2(scanner); const valueMode = !!options.value; if (!valueMode && isLiteral$1(token) && !isFunctionStart(scanner)) { scanner.pos++; name = token.value; consume$1(scanner, isValueDelimiter); } if (valueMode) { consume$1(scanner, isWhiteSpace$1); } while (readable(scanner)) { if (consume$1(scanner, isImportant)) { important = true; } else if (valueFragment = consumeValue(scanner, valueMode)) { value.push(valueFragment); } else if (!consume$1(scanner, isFragmentDelimiter)) { break; } } if (name || value.length || important) { return { name, value, important }; } } function consumeValue(scanner, inArgument) { const result = []; let token; let args; while (readable(scanner)) { token = peek$2(scanner); if (isValue(token)) { scanner.pos++; if (isLiteral$1(token) && (args = consumeArguments(scanner))) { result.push({ type: 'FunctionCall', name: token.value, arguments: args }); } else { result.push(token); } } else if (isValueDelimiter(token) || (inArgument && isWhiteSpace$1(token))) { scanner.pos++; } else { break; } } return result.length ? { type: 'CSSValue', value: result } : void 0; } function consumeArguments(scanner) { const start = scanner.pos; if (consume$1(scanner, isOpenBracket$1)) { const args = []; let value; while (readable(scanner) && !consume$1(scanner, isCloseBracket$1)) { if (value = consumeValue(scanner, true)) { args.push(value); } else if (!consume$1(scanner, isWhiteSpace$1) && !consume$1(scanner, isArgumentDelimiter)) { throw error(scanner, 'Unexpected token'); } } scanner.start = start; return args; } } function isLiteral$1(token) { return token && token.type === 'Literal'; } function isBracket$1(token, open) { return token && token.type === 'Bracket' && (open == null || token.open === open); } function isOpenBracket$1(token) { return isBracket$1(token, true); } function isCloseBracket$1(token) { return isBracket$1(token, false); } function isWhiteSpace$1(token) { return token && token.type === 'WhiteSpace'; } function isOperator(token, operator) { return token && token.type === 'Operator' && (!operator || token.operator === operator); } function isSiblingOperator(token) { return isOperator(token, "+" ); } function isArgumentDelimiter(token) { return isOperator(token, "," ); } function isFragmentDelimiter(token) { return isArgumentDelimiter(token); } function isImportant(token) { return isOperator(token, "!" ); } function isValue(token) { return token.type === 'StringValue' || token.type === 'ColorValue' || token.type === 'NumberValue' || token.type === 'Literal' || token.type === 'Field'; } function isValueDelimiter(token) { return isOperator(token, ":" ) || isOperator(token, "-" ); } function isFunctionStart(scanner) { const t1 = scanner.tokens[scanner.pos]; const t2 = scanner.tokens[scanner.pos + 1]; return t1 && t2 && isLiteral$1(t1) && t2.type === 'Bracket'; } function parse$2(abbr, options) { try { const tokens = typeof abbr === 'string' ? tokenize(abbr, options && options.value) : abbr; return parser(tokens, options); } catch (err) { if (err instanceof ScannerError && typeof abbr === 'string') { err.message += `\n${abbr}\n${'-'.repeat(err.pos)}^`; } throw err; } } function mergeAttributes(node, config) { if (!node.attributes) { return; } const attributes = []; const lookup = {}; for (const attr of node.attributes) { if (attr.name) { const attrName = attr.name; if (attrName in lookup) { const prev = lookup[attrName]; if (attrName === 'class') { prev.value = mergeValue(prev.value, attr.value, ' '); } else { mergeDeclarations(prev, attr, config); } } else { attributes.push(lookup[attrName] = Object.assign({}, attr)); } } else { attributes.push(attr); } } node.attributes = attributes; } function mergeValue(prev, next, glue) { if (prev && next) { if (prev.length && glue) { append(prev, glue); } for (const t of next) { append(prev, t); } return prev; } const result = prev || next; return result && result.slice(); } function mergeDeclarations(dest, src, config) { dest.name = src.name; if (!config.options['output.reverseAttributes']) { dest.value = src.value; } if (!dest.implied) { dest.implied = src.implied; } if (!dest.boolean) { dest.boolean = src.boolean; } if (dest.valueType !== 'expression') { dest.valueType = src.valueType; } return dest; } function append(tokens, value) { const lastIx = tokens.length - 1; if (typeof tokens[lastIx] === 'string' && typeof value === 'string') { tokens[lastIx] += value; } else { tokens.push(value); } } function walk$2(node, fn, state) { const ancestors = [node]; const callback = (ctx) => { fn(ctx, ancestors, state); ancestors.push(ctx); ctx.children.forEach(callback); ancestors.pop(); }; node.children.forEach(callback); } function findDeepest(node) { let parent; while (node.children.length) { parent = node; node = node.children[node.children.length - 1]; } return { parent, node }; } function isNode(node) { return node.type === 'AbbreviationNode'; } function resolveSnippets(abbr, config) { const stack = []; const reversed = config.options['output.reverseAttributes']; const resolve = (child) => { const snippet = child.name && config.snippets[child.name]; if (!snippet || stack.includes(snippet)) { return null; } const snippetAbbr = parseAbbreviation$1(snippet, config); stack.push(snippet); walkResolve(snippetAbbr, resolve); stack.pop(); for (const topNode of snippetAbbr.children) { if (child.attributes) { const from = topNode.attributes || []; const to = child.attributes || []; topNode.attributes = reversed ? to.concat(from) : from.concat(to); } mergeNodes(child, topNode); } return snippetAbbr; }; walkResolve(abbr, resolve); return abbr; } function walkResolve(node, resolve, config) { let children = []; for (const child of node.children) { const resolved = resolve(child); if (resolved) { children = children.concat(resolved.children); const deepest = findDeepest(resolved); if (isNode(deepest.node)) { deepest.node.children = deepest.node.children.concat(walkResolve(child, resolve)); } } else { children.push(child); child.children = walkResolve(child, resolve); } } return node.children = children; } function mergeNodes(from, to) { if (from.selfClosing) { to.selfClosing = true; } if (from.value != null) { to.value = from.value; } if (from.repeat) { to.repeat = from.repeat; } } function createOutputStream(options, level = 0) { return { options, value: '', level, offset: 0, line: 0, column: 0 }; } function push(stream, text) { const processText = stream.options['output.text']; _push(stream, processText(text, stream.offset, stream.line, stream.column)); } function pushString(stream, value) { const lines = splitByLines(value); for (let i = 0, il = lines.length - 1; i <= il; i++) { push(stream, lines[i]); if (i !== il) { pushNewline(stream, true); } } } function pushNewline(stream, indent) { const baseIndent = stream.options['output.baseIndent']; const newline = stream.options['output.newline']; push(stream, newline + baseIndent); stream.line++; stream.column = baseIndent.length; if (indent) { pushIndent(stream, indent === true ? stream.level : indent); } } function pushIndent(stream, size = stream.level) { const indent = stream.options['output.indent']; push(stream, indent.repeat(Math.max(size, 0))); } function pushField(stream, index, placeholder) { const field = stream.options['output.field']; _push(stream, field(index, placeholder, stream.offset, stream.line, stream.column)); } function tagName(name, config) { return strCase(name, config.options['output.tagCase']); } function attrName(name, config) { return strCase(name, config.options['output.attributeCase']); } function attrQuote(attr, config, isOpen) { if (attr.valueType === 'expression') { return isOpen ? '{' : '}'; } return config.options['output.attributeQuotes'] === 'single' ? '\'' : '"'; } function isBooleanAttribute(attr, config) { return attr.boolean || config.options['output.booleanAttributes'].includes((attr.name || '').toLowerCase()); } function selfClose(config) { switch (config.options['output.selfClosingStyle']) { case 'xhtml': return ' /'; case 'xml': return '/'; default: return ''; } } function isInline(node, config) { if (typeof node === 'string') { return config.options.inlineElements.includes(node.toLowerCase()); } return node.name ? isInline(node.name, config) : Boolean(node.value && !node.attributes); } function splitByLines(text) { return text.split(/\r\n|\r|\n/g); } function _push(stream, text) { stream.value += text; stream.offset += text.length; stream.column += text.length; } function strCase(str, type) { if (type) { return type === 'upper' ? str.toUpperCase() : str.toLowerCase(); } return str; } const elementMap = { p: 'span', ul: 'li', ol: 'li', table: 'tr', tr: 'td', tbody: 'tr', thead: 'tr', tfoot: 'tr', colgroup: 'col', select: 'option', optgroup: 'option', audio: 'source', video: 'source', object: 'param', map: 'area' }; function implicitTag(node, ancestors, config) { if (!node.name && node.attributes) { resolveImplicitTag(node, ancestors, config); } } function resolveImplicitTag(node, ancestors, config) { const parent = getParentElement(ancestors); const contextName = config.context ? config.context.name : ''; const parentName = lowercase(parent ? parent.name : contextName); node.name = elementMap[parentName] || (isInline(parentName, config) ? 'span' : 'div'); } function lowercase(str) { return (str || '').toLowerCase(); } function getParentElement(ancestors) { for (let i = ancestors.length - 1; i >= 0; i--) { const elem = ancestors[i]; if (isNode(elem)) { return elem; } } } var latin = { "common": ["lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipisicing", "elit"], "words": ["exercitationem", "perferendis", "perspiciatis", "laborum", "eveniet", "sunt", "iure", "nam", "nobis", "eum", "cum", "officiis", "excepturi", "odio", "consectetur", "quasi", "aut", "quisquam", "vel", "eligendi", "itaque", "non", "odit", "tempore", "quaerat", "dignissimos", "facilis", "neque", "nihil", "expedita", "vitae", "vero", "ipsum", "nisi", "animi", "cumque", "pariatur", "velit", "modi", "natus", "iusto", "eaque", "sequi", "illo", "sed", "ex", "et", "voluptatibus", "tempora", "veritatis", "ratione", "assumenda", "incidunt", "nostrum", "placeat", "aliquid", "fuga", "provident", "praesentium", "rem", "necessitatibus", "suscipit", "adipisci", "quidem", "possimus", "voluptas", "debitis", "sint", "accusantium", "unde", "sapiente", "voluptate", "qui", "aspernatur", "laudantium", "soluta", "amet", "quo", "aliquam", "saepe", "culpa", "libero", "ipsa", "dicta", "reiciendis", "nesciunt", "doloribus", "autem", "impedit", "minima", "maiores", "repudiandae", "ipsam", "obcaecati", "ullam", "enim", "totam", "delectus", "ducimus", "quis", "voluptates", "dolores", "molestiae", "harum", "dolorem", "quia", "voluptatem", "molestias", "magni", "distinctio", "omnis", "illum", "dolorum", "voluptatum", "ea", "quas", "quam", "corporis", "quae", "blanditiis", "atque", "deserunt", "laboriosam", "earum", "consequuntur", "hic", "cupiditate", "quibusdam", "accusamus", "ut", "rerum", "error", "minus", "eius", "ab", "ad", "nemo", "fugit", "officia", "at", "in", "id", "quos", "reprehenderit", "numquam", "iste", "fugiat", "sit", "inventore", "beatae", "repellendus", "magnam", "recusandae", "quod", "explicabo", "doloremque", "aperiam", "consequatur", "asperiores", "commodi", "optio", "dolor", "labore", "temporibus", "repellat", "veniam", "architecto", "est", "esse", "mollitia", "nulla", "a", "similique", "eos", "alias", "dolore", "tenetur", "deleniti", "porro", "facere", "maxime", "corrupti"] }; var ru = { "common": ["далеко-далеко", "за", "словесными", "горами", "в стране", "гласных", "и согласных", "живут", "рыбные", "тексты"], "words": ["вдали", "от всех", "они", "буквенных", "домах", "на берегу", "семантика", "большого", "языкового", "океана", "маленький", "ручеек", "даль", "журчит", "по всей", "обеспечивает", "ее","всеми", "необходимыми", "правилами", "эта", "парадигматическая", "страна", "которой", "жаренные", "предложения", "залетают", "прямо", "рот", "даже", "всемогущая", "пунктуация", "не", "имеет", "власти", "над", "рыбными", "текстами", "ведущими", "безорфографичный", "образ", "жизни", "однажды", "одна", "маленькая", "строчка","рыбного", "текста", "имени", "lorem", "ipsum", "решила", "выйти", "большой", "мир", "грамматики", "великий", "оксмокс", "предупреждал", "о", "злых", "запятых", "диких", "знаках", "вопроса", "коварных", "точках", "запятой", "но", "текст", "дал", "сбить", "себя", "толку", "он", "собрал", "семь", "своих", "заглавных", "букв", "подпоясал", "инициал", "за", "пояс", "пустился", "дорогу", "взобравшись", "первую", "вершину", "курсивных", "гор", "бросил", "последний", "взгляд", "назад", "силуэт", "своего", "родного", "города", "буквоград", "заголовок", "деревни", "алфавит", "подзаголовок", "своего", "переулка", "грустный", "реторический", "вопрос", "скатился", "его", "щеке", "продолжил", "свой", "путь", "дороге", "встретил", "рукопись", "она", "предупредила", "моей", "все", "переписывается", "несколько", "раз", "единственное", "что", "меня", "осталось", "это", "приставка", "возвращайся", "ты", "лучше", "свою", "безопасную", "страну", "послушавшись", "рукописи", "наш", "продолжил", "свой", "путь", "вскоре", "ему", "повстречался", "коварный", "составитель", "рекламных", "текстов", "напоивший", "языком", "речью", "заманивший", "свое", "агентство", "которое", "использовало", "снова", "снова", "своих", "проектах", "если", "переписали", "то", "живет", "там", "до", "сих", "пор"] }; var sp = { "common": ["mujer", "uno", "dolor", "más", "de", "poder", "mismo", "si"], "words": ["ejercicio", "preferencia", "perspicacia", "laboral", "paño", "suntuoso", "molde", "namibia", "planeador", "mirar", "demás", "oficinista", "excepción", "odio", "consecuencia", "casi", "auto", "chicharra", "velo", "elixir", "ataque", "no", "odio", "temporal", "cuórum", "dignísimo", "facilismo", "letra", "nihilista", "expedición", "alma", "alveolar", "aparte", "león", "animal", "como", "paria", "belleza", "modo", "natividad", "justo", "ataque", "séquito", "pillo", "sed", "ex", "y", "voluminoso", "temporalidad", "verdades", "racional", "asunción", "incidente", "marejada", "placenta", "amanecer", "fuga", "previsor", "presentación", "lejos", "necesariamente", "sospechoso", "adiposidad", "quindío", "pócima", "voluble", "débito", "sintió", "accesorio", "falda", "sapiencia", "volutas", "queso", "permacultura", "laudo", "soluciones", "entero", "pan", "litro", "tonelada", "culpa", "libertario", "mosca", "dictado", "reincidente", "nascimiento", "dolor", "escolar", "impedimento", "mínima", "mayores", "repugnante", "dulce", "obcecado", "montaña", "enigma", "total", "deletéreo", "décima", "cábala", "fotografía", "dolores", "molesto", "olvido", "paciencia", "resiliencia", "voluntad", "molestias", "magnífico", "distinción", "ovni", "marejada", "cerro", "torre", "y", "abogada", "manantial", "corporal", "agua", "crepúsculo", "ataque", "desierto", "laboriosamente", "angustia", "afortunado", "alma", "encefalograma", "materialidad", "cosas", "o", "renuncia", "error", "menos", "conejo", "abadía", "analfabeto", "remo", "fugacidad", "oficio", "en", "almácigo", "vos", "pan", "represión", "números", "triste", "refugiado", "trote", "inventor", "corchea", "repelente", "magma", "recusado", "patrón", "explícito", "paloma", "síndrome", "inmune", "autoinmune", "comodidad", "ley", "vietnamita", "demonio", "tasmania", "repeler", "apéndice", "arquitecto", "columna", "yugo", "computador", "mula", "a", "propósito", "fantasía", "alias", "rayo", "tenedor", "deleznable", "ventana", "cara", "anemia", "corrupto"] }; const vocabularies = { ru, sp, latin }; const reLorem = /^lorem([a-z]*)(\d*)(-\d*)?$/i; function lorem(node, ancestors, config) { let m; if (node.name && (m = node.name.match(reLorem))) { const db = vocabularies[m[1]] || vocabularies.latin; const minWordCount = m[2] ? Math.max(1, Number(m[2])) : 30; const maxWordCount = m[3] ? Math.max(minWordCount, Number(m[3].slice(1))) : minWordCount; const wordCount = rand(minWordCount, maxWordCount); const repeat = node.repeat || findRepeater(ancestors); node.name = node.attributes = void 0; node.value = [paragraph(db, wordCount, !repeat || repeat.value === 0)]; if (node.repeat && ancestors.length > 1) { resolveImplicitTag(node, ancestors, config); } } } function rand(from, to) { return Math.floor(Math.random() * (to - from) + from); } function sample(arr, count) { const len = arr.length; const iterations = Math.min(len, count); const result = []; while (result.length < iterations) { const str = arr[rand(0, len)]; if (!result.includes(str)) { result.push(str); } } return result; } function choice(val) { return val[rand(0, val.length - 1)]; } function sentence(words, end) { if (words.length) { words = [capitalize(words[0])].concat(words.slice(1)); } return words.join(' ') + (end || choice('?!...')); } function capitalize(word) { return word[0].toUpperCase() + word.slice(1); } function insertCommas(words) { if (words.length < 2) { return words; } words = words.slice(); const len = words.length; const hasComma = /,$/; let totalCommas = 0; if (len > 3 && len <= 6) { totalCommas = rand(0, 1); } else if (len > 6 && len <= 12) { totalCommas = rand(0, 2); } else { totalCommas = rand(1, 4); } for (let i = 0, pos; i < totalCommas; i++) { pos = rand(0, len - 2); if (!hasComma.test(words[pos])) { words[pos] += ','; } } return words; } function paragraph(dict, wordCount, startWithCommon) { const result = []; let totalWords = 0; let words; if (startWithCommon && dict.common) { words = dict.common.slice(0, wordCount); totalWords += words.length; result.push(sentence(insertCommas(words), '.')); } while (totalWords < wordCount) { words = sample(dict.words, Math.min(rand(2, 30), wordCount - totalWords)); totalWords += words.length; result.push(sentence(insertCommas(words))); } return result.join(' '); } function findRepeater(ancestors) { for (let i = ancestors.length - 1; i >= 0; i--) { const element = ancestors[i]; if (element.type === 'AbbreviationNode' && element.repeat) { return element.repeat; } } } function jsx(node) { if (node.attributes) { node.attributes.forEach(rename); } } function rename(attr) { if (attr.name === 'class') { attr.name = 'className'; } else if (attr.name === 'for') { attr.name = 'htmlFor'; } } function xsl(node) { if (matchesName(node.name) && node.attributes && (node.children.length || node.value)) { node.attributes = node.attributes.filter(isAllowed); } } function isAllowed(attr) { return attr.name !== 'select'; } function matchesName(name) { return name === 'xsl:variable' || name === 'xsl:with-param'; } const reElement = /^(-+)([a-z0-9]+[a-z0-9-]*)/i; const reModifier = /^(_+)([a-z0-9]+[a-z0-9-_]*)/i; const blockCandidates1 = (className) => /^[a-z]\-/i.test(className); const blockCandidates2 = (className) => /^[a-z]/i.test(className); function bem(node, ancestors, config) { expandClassNames(node); expandShortNotation(node, ancestors, config); } function expandClassNames(node) { const data = getBEMData(node); const classNames = []; for (const cl of data.classNames) { const ix = cl.indexOf('_'); if (ix > 0 && !cl.startsWith('-')) { classNames.push(cl.slice(0, ix)); classNames.push(cl.slice(ix)); } else { classNames.push(cl); } } if (classNames.length) { data.classNames = classNames.filter(uniqueClass); data.block = findBlockName(data.classNames); updateClass(node, data.classNames.join(' ')); } } function expandShortNotation(node, ancestors, config) { const data = getBEMData(node); const classNames = []; const { options } = config; const path = ancestors.slice(1).concat(node); for (let cl of data.classNames) { let prefix = ''; let m; const originalClass = cl; if (m = cl.match(reElement)) { prefix = getBlockName(path, m[1].length, config.context) + options['bem.element'] + m[2]; classNames.push(prefix); cl = cl.slice(m[0].length); } if (m = cl.match(reModifier)) { if (!prefix) { prefix = getBlockName(path, m[1].length); classNames.push(prefix); } classNames.push(`${prefix}${options['bem.modifier']}${m[2]}`); cl = cl.slice(m[0].length); } if (cl === originalClass) { classNames.push(originalClass); } } const arrClassNames = classNames.filter(uniqueClass); if (arrClassNames.length) { updateClass(node, arrClassNames.join(' ')); } } function getBEMData(node) { if (!node._bem) { let classValue = ''; if (node.attributes) { for (const attr of node.attributes) { if (attr.name === 'class' && attr.value) { classValue = stringifyValue(attr.value); break; } } } node._bem = parseBEM(classValue); } return node._bem; } function getBEMDataFromContext(context) { if (!context._bem) { context._bem = parseBEM(context.attributes && context.attributes.class || ''); } return context._bem; } function parseBEM(classValue) { const classNames = classValue ? classValue.split(/\s+/) : []; return { classNames, block: findBlockName(classNames) }; } function getBlockName(ancestors, depth = 0, context) { const maxParentIx = 0; let parentIx = Math.max(ancestors.length - depth, maxParentIx); do { const parent = ancestors[parentIx]; if (parent) { const data = getBEMData(parent); if (data.block) { return data.block; } } } while (maxParentIx < parentIx--); if (context) { const data = getBEMDataFromContext(context); if (data.block) { return data.block; } } return ''; } function findBlockName(classNames) { return find(classNames, blockCandidates1) || find(classNames, blockCandidates2) || void 0; } function find(classNames, filter) { for (const cl of classNames) { if (reElement.test(cl) || reModifier.test(cl)) { break; } if (filter(cl)) { return cl; } } } function updateClass(node, value) { for (const attr of node.attributes) { if (attr.name === 'class') { attr.value = [value]; break; } } } function stringifyValue(value) { let result = ''; for (const t of value) { result += typeof t === 'string' ? t : t.name; } return result; } function uniqueClass(item, ix, arr) { return !!item && arr.indexOf(item) === ix; } function walk$1$1(abbr, visitor, state) { const callback = (ctx, index, items) => { const { parent, current } = state; state.parent = current; state.current = ctx; visitor(ctx, index, items, state, next); state.current = current; state.parent = parent; }; const next = (node, index, items) => { state.ancestors.push(state.current); callback(node, index, items); state.ancestors.pop(); }; abbr.children.forEach(callback); } function createWalkState(config) { return { // @ts-ignore: Will set value in iterator current: null, parent: void 0, ancestors: [], config, field: 1, out: createOutputStream(config.options) }; } const caret = [{ type: 'Field', index: 0, name: '' }]; function isSnippet(node) { return node ? !node.name && !node.attributes : false; } function isInlineElement(node, config) { return node ? isInline(node, config) : false; } function isField(token) { return typeof token === 'object' && token.type === 'Field'; } function pushTokens(tokens, state) { const { out } = state; let largestIndex = -1; for (const t of tokens) { if (typeof t === 'string') { pushString(out, t); } else { pushField(out, state.field + t.index, t.name); if (t.index > largestIndex) { largestIndex = t.index; } } } if (largestIndex !== -1) { state.field += largestIndex + 1; } } function splitByLines$1(tokens) { const result = []; let line = []; for (const t of tokens) { if (typeof t === 'string') { const lines = t.split(/\r\n?|\n/g); line.push(lines.shift() || ''); while (lines.length) { result.push(line); line = [lines.shift() || '']; } } else { line.push(t); } } line.length && result.push(line); return result; } function shouldOutputAttribute(attr) { return !attr.implied || attr.valueType !== 'raw' || (!!attr.value && attr.value.length > 0); } function template(text) { const tokens = []; const scanner = { pos: 0, text }; let placeholder; let offset = scanner.pos; let pos = scanner.pos; while (scanner.pos < scanner.text.length) { pos = scanner.pos; if (placeholder = consumePlaceholder(scanner)) { if (offset !== scanner.pos) { tokens.push(text.slice(offset, pos)); } tokens.push(placeholder); offset = scanner.pos; } else { scanner.pos++; } } if (offset !== scanner.pos) { tokens.push(text.slice(offset)); } return tokens; } function consumePlaceholder(scanner) { if (peek(scanner) === 91 ) { const start = ++scanner.pos; let namePos = start; let afterPos = start; let stack = 1; while (scanner.pos < scanner.text.length) { const code = peek(scanner); if (isTokenStart(code)) { namePos = scanner.pos; while (isToken(peek(scanner))) { scanner.pos++; } afterPos = scanner.pos; } else { if (code === 91 ) { stack++; } else if (code === 93 ) { if (--stack === 0) { return { before: scanner.text.slice(start, namePos), after: scanner.text.slice(afterPos, scanner.pos++), name: scanner.text.slice(namePos, afterPos) }; } } scanner.pos++; } } } } function peek(scanner, pos = scanner.pos) { return scanner.text.charCodeAt(pos); } function isTokenStart(code) { return code >= 65 && code <= 90; } function isToken(code) { return isTokenStart(code) || (code > 47 && code < 58) || code === 95 || code === 45 ; } function createCommentState(config) { const { options } = config; return { enabled: options['comment.enabled'], trigger: options['comment.trigger'], before: options['comment.before'] ? template(options['comment.before']) : void 0, after: options['comment.after'] ? template(options['comment.after']) : void 0 }; } function commentNodeBefore(node, state) { if (shouldComment(node, state) && state.comment.before) { output(node, state.comment.before, state); } } function commentNodeAfter(node, state) { if (shouldComment(node, state) && state.comment.after) { output(node, state.comment.after, state); } } function shouldComment(node, state) { const { comment } = state; if (!comment.enabled || !comment.trigger || !node.name || !node.attributes) { return false; } for (const attr of node.attributes) { if (attr.name && comment.trigger.includes(attr.name)) { return true; } } return false; } function output(node, tokens, state) { const attrs = {}; const { out } = state; for (const attr of node.attributes) { if (attr.name && attr.value) { attrs[attr.name.toUpperCase()] = attr.value; } } for (const token of tokens) { if (typeof token === 'string') { pushString(out, token); } else if (attrs[token.name]) { pushString(out, token.before); pushTokens(attrs[token.name], state); pushString(out, token.after); } } } const htmlTagRegex = /^<([\w\-:]+)[\s>]/; function html(abbr, config) { const state = createWalkState(config); state.comment = createCommentState(config); walk$1$1(abbr, element, state); return state.out.value; } function element(node, index, items, state, next) { const { out, config } = state; const format = shouldFormat(node, index, items, state); const level = getIndent(state); out.level += level; format && pushNewline(out, true); if (node.name) { const name = tagName(node.name, config); commentNodeBefore(node, state); pushString(out, `<${name}`); if (node.attributes) { for (const attr of node.attributes) { if (shouldOutputAttribute(attr)) { pushAttribute(attr, state); } } } if (node.selfClosing && !node.children.length && !node.value) { pushString(out, `${selfClose(config)}>`); } else { pushString(out, '>'); if (!pushSnippet(node, state, next)) { if (node.value) { const innerFormat = node.value.some(hasNewline) || startsWithBlockTag(node.value, config); innerFormat && pushNewline(state.out, ++out.level); pushTokens(node.value, state); innerFormat && pushNewline(state.out, --out.level); } node.children.forEach(next); if (!node.value && !node.children.length) { const innerFormat = config.options['output.formatLeafNode'] || config.options['output.formatForce'].includes(node.name); innerFormat && pushNewline(state.out, ++out.level); pushTokens(caret, state); innerFormat && pushNewline(state.out, --out.level); } } pushString(out, `</${name}>`); commentNodeAfter(node, state); } } else if (!pushSnippet(node, state, next) && node.value) { pushTokens(node.value, state); node.children.forEach(next); } if (format && index === items.length - 1 && state.parent) { const offset = isSnippet(state.parent) ? 0 : 1; pushNewline(out, out.level - offset); } out.level -= level; } function pushAttribute(attr, state) { const { out, config } = state; if (attr.name) { const name = attrName(attr.name, config); const lQuote = attrQuote(attr, config, true); const rQuote = attrQuote(attr, config); let value = attr.value; if (isBooleanAttribute(attr, config) && !value) { if (!config.options['output.compactBoolean']) { value = [name]; } } else if (!value) { value = caret; } pushString(out, ' ' + name); if (value) { pushString(out, '=' + lQuote); pushTokens(value, state); pushString(out, rQuote); } else if (config.options['output.selfClosingStyle'] !== 'html') { pushString(out, '=' + lQuote + rQuote); } } } function pushSnippet(node, state, next) { if (node.value && node.children.length) { const fieldIx = node.value.findIndex(isField); if (fieldIx !== -1) { pushTokens(node.value.slice(0, fieldIx), state); const line = state.out.line; let pos = fieldIx + 1; node.children.forEach(next); if (state.out.line !== line && typeof node.value[pos] === 'string') { pushString(state.out, node.value[pos++].trimLeft()); } pushTokens(node.value.slice(pos), state); return true; } } return false; } function shouldFormat(node, index, items, state) { const { config, parent } = state; if (!config.options['output.format']) { return false; } if (index === 0 && !parent) { return false; } if (parent && isSnippet(parent) && items.length === 1) { return false; } if (isSnippet(node)) { const format = isSnippet(items[index - 1]) || isSnippet(items[index + 1]) || node.value.some(hasNewline) || (node.value.some(isField) && node.children.length); if (format) { return true; } } if (isInline(node, config)) { if (index === 0) { for (let i = 0; i < items.length; i++) { if (!isInline(items[i], config)) { return true; } } } else if (!isInline(items[index - 1], config)) { return true; } if (config.options['output.inlineBreak']) { let adjacentInline = 1; let before = index; let after = index; while (isInlineElement(items[--before], config)) { adjacentInline++; } while (isInlineElement(items[++after], config)) { adjacentInline++; } if (adjacentInline >= config.options['output.inlineBreak']) { return true; } } for (let i = 0, il = node.children.length; i < il; i++) { if (shouldFormat(node.children[i], i, node.children, state)) { return true; } } return false; } return true; } function getIndent(state) { const { config, parent } = state; if (!parent || isSnippet(parent) || (parent.name && config.options['output.formatSkip'].includes(parent.name))) { return 0; } return 1; } function hasNewline(value) { return typeof value === 'string' && /\r|\n/.test(value); } function startsWithBlockTag(value, config) { if (value.length && typeof value[0] === 'string') { const matches = htmlTagRegex.exec(value[0]); if ((matches === null || matches === void 0 ? void 0 : matches.length) && !config.options['inlineElements'].includes(matches[1].toLowerCase())) { return true; } } return false; } function indentFormat(abbr, config, options) { const state = createWalkState(config); state.options = options || {}; walk$1$1(abbr, element$1, state); return state.out.value; } function element$1(node, index, items, state, next) { const { out, options } = state; const { primary, secondary } = collectAttributes(node); const level = state.parent ? 1 : 0; out.level += level; if (shouldFormat$1(node, index, items, state)) { pushNewline(out, true); } if (node.name && (node.name !== 'div' || !primary.length)) { pushString(out, (options.beforeName || '') + node.name + (options.afterName || '')); } pushPrimaryAttributes(primary, state); pushSecondaryAttributes(secondary.filter(shouldOutputAttribute), state); if (node.selfClosing && !node.value && !node.children.length) { if (state.options.selfClose) { pushString(out, state.options.selfClose); } } else { pushValue(node, state); node.children.forEach(next); } out.level -= level; } function collectAttributes(node) { const primary = []; const secondary = []; if (node.attributes) { for (const attr of node.attributes) { if (isPrimaryAttribute(attr)) { primary.push(attr); } else { secondary.push(attr); } } } return { primary, secondary }; } function pushPrimaryAttributes(attrs, state) { for (const attr of attrs) { if (attr.value) { if (attr.name === 'class') { pushString(state.out, '.'); const tokens = attr.value.map(t => typeof t === 'string' ? t.replace(/\s+/g, '.') : t); pushTokens(tokens, state); } else { pushString(state.out, '#'); pushTokens(attr.value, state); } } } } function pushSecondaryAttributes(attrs, state) { if (attrs.length) { const { out, config, options } = state; options.beforeAttribute && pushString(out, options.beforeAttribute); for (let i = 0; i < attrs.length; i++) { const attr = attrs[i]; pushString(out, attrName(attr.name || '', config)); if (isBooleanAttribute(attr, config) && !attr.value) { if (!config.options['output.compactBoolean'] && options.booleanValue) { pushString(out, '=' + options.booleanValue); } } else { pushString(out, '=' + attrQuote(attr, config, true)); pushTokens(attr.value || caret, state); pushString(out, attrQuote(attr, config)); } if (i !== attrs.length - 1 && options.glueAttribute) { pushString(out, options.glueAttribute); } } options.afterAttribute && pushString(out, options.afterAttribute); } } function pushValue(node, state) { if (!node.value && node.children.length) { return; } const value = node.value || caret; const lines = splitByLines$1(value); const { out, options } = state; if (lines.length === 1) { if (node.name || node.attributes) { push(out, ' '); } pushTokens(value, state); } else { const lineLengths = []; let maxLength = 0; for (const line of lines) { const len = valueLength(line); lineLengths.push(len); if (len > maxLength) { maxLength = len; } } out.level++; for (let i = 0; i < lines.length; i++) { pushNewline(out, true); options.beforeTextLine && push(out, options.beforeTextLine); pushTokens(lines[i], state); if (options.afterTextLine) { push(out, ' '.repeat(maxLength - lineLengths[i])); push(out, options.afterTextLine); } } out.level--; } } function isPrimaryAttribute(attr) { return attr.name === 'class' || attr.name === 'id'; } function valueLength(tokens) { let len = 0; for (const token of tokens) { len += typeof token === 'string' ? token.length : token.name.length; } return len; } function shouldFormat$1(node, index, items, state) { if (!state.parent && index === 0) { return false; } return !isSnippet(node); } function haml(abbr, config) { return indentFormat(abbr, config, { beforeName: '%', beforeAttribute: '(', afterAttribute: ')', glueAttribute: ' ', afterTextLine: ' |', booleanValue: 'true', selfClose: '/' }); } function slim(abbr, config) { return indentFormat(abbr, config, { beforeAttribute: ' ', glueAttribute: ' ', beforeTextLine: '| ', selfClose: '/' }); } function pug(abbr, config) { return indentFormat(abbr, config, { beforeAttribute: '(', afterAttribute: ')', glueAttribute: ', ', beforeTextLine: '| ', selfClose: config.options['output.selfClosingStyle'] === 'xml' ? '/' : '' }); } const formatters = { html, haml, slim, pug }; function parse(abbr, config) { let oldTextValue; if (typeof abbr === 'string') { let parseOpt = config; if (config.options['jsx.enabled']) { parseOpt = Object.assign(Object.assign({}, parseOpt), { jsx: true }); } if (config.options['markup.href']) { parseOpt = Object.assign(Object.assign({}, parseOpt), { href: true }); } abbr = parseAbbreviation$1(abbr, parseOpt); oldTextValue = config.text; config.text = undefined; } abbr = resolveSnippets(abbr, config); walk$2(abbr, transform$1, config); config.text = oldTextValue !== null && oldTextValue !== void 0 ? oldTextValue : config.text; return abbr; } function stringify(abbr, config) { const formatter = formatters[config.syntax] || html; return formatter(abbr, config); } function transform$1(node, ancestors, config) { implicitTag(node, ancestors, config); mergeAttributes(node, config); lorem(node, ancestors, config); if (config.syntax === 'xsl') { xsl(node); } if (config.options['jsx.enabled']) { jsx(node); } if (config.options['bem.enabled']) { bem(node, ancestors, config); } } const reProperty = /^([a-z-]+)(?:\s*:\s*([^\n\r;]+?);*)?$/; const opt = { value: true }; function createSnippet(key, value) { const m = value.match(reProperty); if (m) { const keywords = {}; const parsed = m[2] ? m[2].split('|').map(parseValue) : []; for (const item of parsed) { for (const cssVal of item) { collectKeywords(cssVal, keywords); } } return { type: "Property" , key, property: m[1], value: parsed, keywords, dependencies: [] }; } return { type: "Raw" , key, value }; } function nest(snippets) { snippets = snippets.slice().sort(snippetsSort); const stack = []; let prev; for (const cur of snippets.filter(isProperty)) { while (stack.length) { prev = stack[stack.length - 1]; if (cur.property.startsWith(prev.property) && cur.property.charCodeAt(prev.property.length) === 45 ) { prev.dependencies.push(cur); stack.push(cur); break; } stack.pop(); } if (!stack.length) { stack.push(cur); } } return snippets; } function snippetsSort(a, b) { if (a.key === b.key) { return 0; } return a.key < b.key ? -1 : 1; } function parseValue(value) { return parse$2(value.trim(), opt)[0].value; } function isProperty(snippet) { return snippet.type === "Property" ; } function collectKeywords(cssVal, dest) { for (const v of cssVal.value) { if (v.type === 'Literal') { dest[v.value] = v; } else if (v.type === 'FunctionCall') { dest[v.name] = v; } else if (v.type === 'Field') { const value = v.name.trim(); if (value) { dest[value] = { type: 'Literal', value }; } } } } function scoreMatch(str1, str2, partialMatch = false) { str1 = str1.toLowerCase(); str2 = str2.toLowerCase(); if (str1 === str2) { return 1; } if (!str1 || !str2 || str1.charCodeAt(0) !== str2.charCodeAt(0)) { return 0; } const str1Len = str1.length; const str2Len = str2.length; if (!partialMatch && str1Len > str2Len) { return 0; } const minLength = Math.min(str1Len, str2Len); const maxLength = Math.max(str1Len, str2Len); let i = 1; let j = 1; let score = maxLength; let ch1 = 0; let ch2 = 0; let found = false; let acronym = false; while (i < str1Len) { ch1 = str1.charCodeAt(i); found = false; acronym = false; while (j < str2Len) { ch2 = str2.charCodeAt(j); if (ch1 === ch2) { found = true; score += maxLength - (acronym ? i : j); break; } acronym = ch2 === 45 ; j++; } if (!found) { if (!partialMatch) { return 0; } break; } i++; } const matchRatio = i / maxLength; const delta = maxLength - minLength; const maxScore = sum(maxLength) - sum(delta); return (score * matchRatio) / maxScore; } function sum(n) { return n * (n + 1) / 2; } function color(token, shortHex) { if (!token.r && !token.g && !token.b && !token.a) { return 'transparent'; } else if (token.a === 1) { return asHex(token, shortHex); } return asRGB(token); } function asHex(token, short) { const fn = (short && isShortHex(token.r) && isShortHex(token.g) && isShortHex(token.b)) ? toShortHex : toHex; return '#' + fn(token.r) + fn(token.g) + fn(token.b); } function asRGB(token) { const values = [token.r, token.g, token.b]; if (token.a !== 1) { values.push(frac(token.a, 8)); } return `${values.length === 3 ? 'rgb' : 'rgba'}(${values.join(', ')})`; } function frac(num, digits = 4) { return num.toFixed(digits).replace(/\.?0+$/, ''); } function isShortHex(hex) { return !(hex % 17); } function toShortHex(num) { return (num >> 4).toString(16); } function toHex(num) { return pad(num.toString(16), 2); } function pad(value, len) { while (value.length < len) { value = '0' + value; } return value; } function css(abbr, config) { var _a; const out = createOutputStream(config.options); const format = config.options['output.format']; if (((_a = config.context) === null || _a === void 0 ? void 0 : _a.name) === "@@section" ) { abbr = abbr.filter(node => node.snippet); } for (let i = 0; i < abbr.length; i++) { if (format && i !== 0) { pushNewline(out, true); } property(abbr[i], out, config); } return out.value; } function property(node, out, config) { const isJSON = config.options['stylesheet.json']; if (node.name) { const name = isJSON ? toCamelCase(node.name) : node.name; pushString(out, name + config.options['stylesheet.between']); if (node.value.length) { propertyValue(node, out, config); } else { pushField(out, 0, ''); } if (isJSON) { push(out, ','); } else { outputImportant(node, out, true); push(out, config.options['stylesheet.after']); } } else { for (const cssVal of node.value) { for (const v of cssVal.value) { outputToken(v, out, config); } } outputImportant(node, out, node.value.length > 0); } } function propertyValue(node, out, config) { const isJSON = config.options['stylesheet.json']; const num = isJSON ? getSingleNumeric(node) : null; if (num && (!num.unit || num.unit === 'px')) { push(out, String(num.value)); } else { const quote = getQuote(config); isJSON && push(out, quote); for (let i = 0; i < node.value.length; i++) { if (i !== 0) { push(out, ', '); } outputValue(node.value[i], out, config); } isJSON && push(out, quote); } } function outputImportant(node, out, separator) { if (node.important) { if (separator) { push(out, ' '); } push(out, '!important'); } } function outputValue(value, out, config) { for (let i = 0, prevEnd = -1; i < value.value.length; i++) { const token = value.value[i]; if (i !== 0 && (token.type !== 'Field' || token.start !== prevEnd)) { push(out, ' '); } outputToken(token, out, config); prevEnd = token['end']; } } function outputToken(token, out, config) { if (token.type === 'ColorValue') { push(out, color(token, config.options['stylesheet.shortHex'])); } else if (token.type === 'Literal') { pushString(out, token.value); } else if (token.type === 'NumberValue') { pushString(out, frac(token.value, 4) + token.unit); } else if (token.type === 'StringValue') { const quote = token.quote === 'double' ? '"' : '\''; pushString(out, quote + token.value + quote); } else if (token.type === 'Field') { pushField(out, token.index, token.name); } else if (token.type === 'FunctionCall') { push(out, token.name + '('); for (let i = 0; i < token.arguments.length; i++) { if (i) { push(out, ', '); } outputValue(token.arguments[i], out, config); } push(out, ')'); } } function getSingleNumeric(node) { if (node.value.length === 1) { const cssVal = node.value[0]; if (cssVal.value.length === 1 && cssVal.value[0].type === 'NumberValue') { return cssVal.value[0]; } } } function toCamelCase(str) { return str.replace(/\-(\w)/g, (_, letter) => letter.toUpperCase()); } function getQuote(config) { return config.options['stylesheet.jsonDoubleQuotes'] ? '"' : '\''; } const gradientName = 'lg'; function parse$1(abbr, config) { var _a; const snippets = ((_a = config.cache) === null || _a === void 0 ? void 0 : _a.stylesheetSnippets) || convertSnippets(config.snippets); if (config.cache) { config.cache.stylesheetSnippets = snippets; } if (typeof abbr === 'string') { abbr = parse$2(abbr, { value: isValueScope(config) }); } const filteredSnippets = getSnippetsForScope(snippets, config); for (const node of abbr) { resolveNode(node, filteredSnippets, config); } return abbr; } function convertSnippets(snippets) { const result = []; for (const key of Object.keys(snippets)) { result.push(createSnippet(key, snippets[key])); } return nest(result); } function resolveNode(node, snippets, config) { if (!resolveGradient(node, config)) { const score = config.options['stylesheet.fuzzySearchMinScore']; if (isValueScope(config)) { const propName = config.context.name; const snippet = snippets.find(s => s.type === "Property" && s.property === propName); resolveValueKeywords(node, config, snippet, score); node.snippet = snippet; } else if (node.name) { const snippet = findBestMatch(node.name, snippets, score, true); node.snippet = snippet; if (snippet) { if (snippet.type === "Property" ) { resolveAsProperty(node, snippet, config); } else { resolveAsSnippet(node, snippet); } } } } if (node.name || config.context) { resolveNumericValue(node, config); } return node; } function resolveGradient(node, config) { let gradientFn = null; const cssVal = node.value.length === 1 ? node.value[0] : null; if (cssVal && cssVal.value.length === 1) { const v = cssVal.value[0]; if (v.type === 'FunctionCall' && v.name === gradientName) { gradientFn = v; } } if (gradientFn || node.name === gradientName) { if (!gradientFn) { gradientFn = { type: 'FunctionCall', name: 'linear-gradient', arguments: [cssValue(field(0, ''))] }; } else { gradientFn = Object.assign(Object.assign({}, gradientFn), { name: 'linear-gradient' }); } if (!config.context) { node.name = 'background-image'; } node.value = [cssValue(gradientFn)]; return true; } return false; } function resolveAsProperty(node, snippet, config) { const abbr = node.name; const inlineValue = getUnmatchedPart(abbr, snippet.key); if (inlineValue) { if (node.value.length) { return node; } const kw = resolveKeyword(inlineValue, config, snippet); if (!kw) { return node; } node.value.push(cssValue(kw)); } node.name = snippet.property; if (node.value.length) { resolveValueKeywords(node, config, snippet); } else if (snippet.value.length) { const defaultValue = snippet.value[0]; node.value = snippet.value.length === 1 || defaultValue.some(hasField) ? defaultValue : defaultValue.map(n => wrapWithField(n, config)); } return node; } function resolveValueKeywords(node, config, snippet, minScore) { for (const cssVal of node.value) { const value = []; for (const token of cssVal.value) { if (token.type === 'Literal') { value.push(resolveKeyword(token.value, config, snippet, minScore) || token); } else if (token.type === 'FunctionCall') { const match = resolveKeyword(token.name, config, snippet, minScore); if (match && match.type === 'FunctionCall') { value.push(Object.assign(Object.assign({}, match), { arguments: token.arguments.concat(match.arguments.slice(token.arguments.length)) })); } else { value.push(token); } } else { value.push(token); } } cssVal.value = value; } } function resolveAsSnippet(node, snippet) { let offset = 0; let m; const reField = /\$\{(\d+)(:[^}]+)?\}/g; const inputValue = node.value[0]; const outputValue = []; while (m = reField.exec(snippet.value)) { if (offset !== m.index) { outputValue.push(literal(snippet.value.slice(offset, m.index))); } offset = m.index + m[0].length; if (inputValue && inputValue.value.length) { outputValue.push(inputValue.value.shift()); } else { outputValue.push(field(Number(m[1]), m[2] ? m[2].slice(1) : '')); } } const tail = snippet.value.slice(offset); if (tail) { outputValue.push(literal(tail)); } node.name = void 0; node.value = [cssValue(...outputValue)]; return node; } function findBestMatch(abbr, items, minScore = 0, partialMatch = false) { let matchedItem = null; let maxScore = 0; for (const item of items) { const score = scoreMatch(abbr, getScoringPart(item), partialMatch); if (score === 1) { return item; } if (score && score >= maxScore) { maxScore = score; matchedItem = item; } } return maxScore >= minScore ? matchedItem : null; } function getScoringPart(item) { return typeof item === 'string' ? item : item.key; } function getUnmatchedPart(abbr, str) { for (let i = 0, lastPos = 0; i < abbr.length; i++) { lastPos = str.indexOf(abbr[i], lastPos); if (lastPos === -1) { return abbr.slice(i); } lastPos++; } return ''; } function resolveKeyword(kw, config, snippet, minScore) { let ref; if (snippet) { if (ref = findBestMatch(kw, Object.keys(snippet.keywords), minScore)) { return snippet.keywords[ref]; } for (const dep of snippet.dependencies) { if (ref = findBestMatch(kw, Object.keys(dep.keywords), minScore)) { return dep.keywords[ref]; } } } if (ref = findBestMatch(kw, config.options['stylesheet.keywords'], minScore)) { return literal(ref); } return null; } function resolveNumericValue(node, config) { const aliases = config.options['stylesheet.unitAliases']; const unitless = config.options['stylesheet.unitless']; for (const v of node.value) { for (const t of v.value) { if (t.type === 'NumberValue') { if (t.unit) { t.unit = aliases[t.unit] || t.unit; } else if (t.value !== 0 && !unitless.includes(node.name)) { t.unit = t.rawValue.includes('.') ? config.options['stylesheet.floatUnit'] : config.options['stylesheet.intUnit']; } } } } } function cssValue(...args) { return { type: 'CSSValue', value: args }; } function literal(value) { return { type: 'Literal', value }; } function field(index, name) { return { type: 'Field', index, name }; } function hasField(value) { for (const v of value.value) { if (v.type === 'Field' || (v.type === 'FunctionCall' && v.arguments.some(hasField))) { return true; } } return false; } function wrapWithField(node, config, state = { index: 1 }) { let value = []; for (const v of node.value) { switch (v.type) { case 'ColorValue': value.push(field(state.index++, color(v, config.options['stylesheet.shortHex']))); break; case 'Literal': value.push(field(state.index++, v.value)); break; case 'NumberValue': value.push(field(state.index++, `${v.value}${v.unit}`)); break; case 'StringValue': const q = v.quote === 'single' ? '\'' : '"'; value.push(field(state.index++, q + v.value + q)); break; case 'FunctionCall': value.push(field(state.index++, v.name), literal('(')); for (let i = 0, il = v.arguments.length; i < il; i++) { value = value.concat(wrapWithField(v.arguments[i], config, state).value); if (i !== il - 1) { value.push(literal(', ')); } } value.push(literal(')')); break; default: value.push(v); } } return Object.assign(Object.assign({}, node), { value }); } function isValueScope(config) { if (config.context) { return config.context.name === "@@value" || !config.context.name.startsWith('@@'); } return false; } function getSnippetsForScope(snippets, config) { if (config.context) { if (config.context.name === "@@section" ) { return snippets.filter(s => s.type === "Raw" ); } if (config.context.name === "@@property" ) { return snippets.filter(s => s.type === "Property" ); } } return snippets; } var markupSnippets = { "a": "a[href]", "a:blank": "a[href='http://${0}' target='_blank' rel='noopener noreferrer']", "a:link": "a[href='http://${0}']", "a:mail": "a[href='mailto:${0}']", "a:tel": "a[href='tel:+${0}']", "abbr": "abbr[title]", "acr|acronym": "acronym[title]", "base": "base[href]/", "basefont": "basefont/", "br": "br/", "frame": "frame/", "hr": "hr/", "bdo": "bdo[dir]", "bdo:r": "bdo[dir=rtl]", "bdo:l": "bdo[dir=ltr]", "col": "col/", "link": "link[rel=stylesheet href]/", "link:css": "link[href='${1:style}.css']", "link:print": "link[href='${1:print}.css' media=print]", "link:favicon": "link[rel='shortcut icon' type=image/x-icon href='${1:favicon.ico}']", "link:mf|link:manifest": "link[rel='manifest' href='${1:manifest.json}']", "link:touch": "link[rel=apple-touch-icon href='${1:favicon.png}']", "link:rss": "link[rel=alternate type=application/rss+xml title=RSS href='${1:rss.xml}']", "link:atom": "link[rel=alternate type=application/atom+xml title=Atom href='${1:atom.xml}']", "link:im|link:import": "link[rel=import href='${1:component}.html']", "meta": "meta/", "meta:utf": "meta[http-equiv=Content-Type content='text/html;charset=UTF-8']", "meta:vp": "meta[name=viewport content='width=${1:device-width}, initial-scale=${2:1.0}']", "meta:compat": "meta[http-equiv=X-UA-Compatible content='${1:IE=7}']", "meta:edge": "meta:compat[content='${1:ie=edge}']", "meta:redirect": "meta[http-equiv=refresh content='0; url=${1:http://example.com}']", "meta:kw": "meta[name=keywords content]", "meta:desc": "meta[name=description content]", "style": "style", "script": "script", "script:src": "script[src]", "img": "img[src alt]/", "img:s|img:srcset": "img[srcset src alt]", "img:z|img:sizes": "img[sizes srcset src alt]", "picture": "picture", "src|source": "source/", "src:sc|source:src": "source[src type]", "src:s|source:srcset": "source[srcset]", "src:t|source:type": "source[srcset type='${1:image/}']", "src:z|source:sizes": "source[sizes srcset]", "src:m|source:media": "source[media='(${1:min-width: })' srcset]", "src:mt|source:media:type": "source:media[type='${2:image/}']", "src:mz|source:media:sizes": "source:media[sizes srcset]", "src:zt|source:sizes:type": "source[sizes srcset type='${1:image/}']", "iframe": "iframe[src frameborder=0]", "embed": "embed[src type]/", "object": "object[data type]", "param": "param[name value]/", "map": "map[name]", "area": "area[shape coords href alt]/", "area:d": "area[shape=default]", "area:c": "area[shape=circle]", "area:r": "area[shape=rect]", "area:p": "area[shape=poly]", "form": "form[action]", "form:get": "form[method=get]", "form:post": "form[method=post]", "label": "label[for]", "input": "input[type=${1:text}]/", "inp": "input[name=${1} id=${1}]", "input:h|input:hidden": "input[type=hidden name]", "input:t|input:text": "inp[type=text]", "input:search": "inp[type=search]", "input:email": "inp[type=email]", "input:url": "inp[type=url]", "input:p|input:password": "inp[type=password]", "input:datetime": "inp[type=datetime]", "input:date": "inp[type=date]", "input:datetime-local": "inp[type=datetime-local]", "input:month": "inp[type=month]", "input:week": "inp[type=week]", "input:time": "inp[type=time]", "input:tel": "inp[type=tel]", "input:number": "inp[type=number]", "input:color": "inp[type=color]", "input:c|input:checkbox": "inp[type=checkbox]", "input:r|input:radio": "inp[type=radio]", "input:range": "inp[type=range]", "input:f|input:file": "inp[type=file]", "input:s|input:submit": "input[type=submit value]", "input:i|input:image": "input[type=image src alt]", "input:b|input:btn|input:button": "input[type=button value]", "input:reset": "input:button[type=reset]", "isindex": "isindex/", "select": "select[name=${1} id=${1}]", "select:d|select:disabled": "select[disabled.]", "opt|option": "option[value]", "textarea": "textarea[name=${1} id=${1} cols=${2:30} rows=${3:10}]", "marquee": "marquee[behavior direction]", "menu:c|menu:context": "menu[type=context]", "menu:t|menu:toolbar": "menu[type=toolbar]", "video": "video[src]", "audio": "audio[src]", "html:xml": "html[xmlns=http://www.w3.org/1999/xhtml]", "keygen": "keygen/", "command": "command/", "btn:s|button:s|button:submit" : "button[type=submit]", "btn:r|button:r|button:reset" : "button[type=reset]", "btn:d|button:d|button:disabled" : "button[disabled.]", "fst:d|fset:d|fieldset:d|fieldset:disabled" : "fieldset[disabled.]", "bq": "blockquote", "fig": "figure", "figc": "figcaption", "pic": "picture", "ifr": "iframe", "emb": "embed", "obj": "object", "cap": "caption", "colg": "colgroup", "fst": "fieldset", "btn": "button", "optg": "optgroup", "tarea": "textarea", "leg": "legend", "sect": "section", "art": "article", "hdr": "header", "ftr": "footer", "adr": "address", "dlg": "dialog", "str": "strong", "prog": "progress", "mn": "main", "tem": "template", "fset": "fieldset", "datag": "datagrid", "datal": "datalist", "kg": "keygen", "out": "output", "det": "details", "sum": "summary", "cmd": "command", "ri:d|ri:dpr": "img:s", "ri:v|ri:viewport": "img:z", "ri:a|ri:art": "pic>src:m+img", "ri:t|ri:type": "pic>src:t+img", "!!!": "{<!DOCTYPE html>}", "doc": "html[lang=${lang}]>(head>meta[charset=${charset}]+meta[http-equiv='X-UA-Compatible'][content='IE=edge']+meta:vp+title{${1:Document}})+body", "!|html:5": "!!!+doc", "c": "{<!-- ${0} -->}", "cc:ie": "{<!--[if IE]>${0}<![endif]-->}", "cc:noie": "{<!--[if !IE]><!-->${0}<!--<![endif]-->}" }; var stylesheetSnippets = { "@f": "@font-face {\n\tfont-family: ${1};\n\tsrc: url(${2});\n}", "@ff": "@font-face {\n\tfont-family: '${1:FontName}';\n\tsrc: url('${2:FileName}.eot');\n\tsrc: url('${2:FileName}.eot?#iefix') format('embedded-opentype'),\n\t\t url('${2:FileName}.woff') format('woff'),\n\t\t url('${2:FileName}.ttf') format('truetype'),\n\t\t url('${2:FileName}.svg#${1:FontName}') format('svg');\n\tfont-style: ${3:normal};\n\tfont-weight: ${4:normal};\n}", "@i|@import": "@import url(${0});", "@kf": "@keyframes ${1:identifier} {\n\t${2}\n}", "@m|@media": "@media ${1:screen} {\n\t${0}\n}", "ac": "align-content:start|end|flex-start|flex-end|center|space-between|space-around|stretch|space-evenly", "ai": "align-items:start|end|flex-start|flex-end|center|baseline|stretch", "anim": "animation:${1:name} ${2:duration} ${3:timing-function} ${4:delay} ${5:iteration-count} ${6:direction} ${7:fill-mode}", "animdel": "animation-delay:time", "animdir": "animation-direction:normal|reverse|alternate|alternate-reverse", "animdur": "animation-duration:${1:0}s", "animfm": "animation-fill-mode:both|forwards|backwards", "animic": "animation-iteration-count:1|infinite", "animn": "animation-name", "animps": "animation-play-state:running|paused", "animtf": "animation-timing-function:linear|ease|ease-in|ease-out|ease-in-out|cubic-bezier(${1:0.1}, ${2:0.7}, ${3:1.0}, ${3:0.1})", "ap": "appearance:none", "as": "align-self:start|end|auto|flex-start|flex-end|center|baseline|stretch", "b": "bottom", "bd": "border:${1:1px} ${2:solid} ${3:#000}", "bdb": "border-bottom:${1:1px} ${2:solid} ${3:#000}", "bdbc": "border-bottom-color:${1:#000}", "bdbi": "border-bottom-image:url(${0})", "bdbk": "border-break:close", "bdbli": "border-bottom-left-image:url(${0})|continue", "bdblrs": "border-bottom-left-radius", "bdbri": "border-bottom-right-image:url(${0})|continue", "bdbrrs": "border-bottom-right-radius", "bdbs": "border-bottom-style", "bdbw": "border-bottom-width", "bdc": "border-color:${1:#000}", "bdci": "border-corner-image:url(${0})|continue", "bdcl": "border-collapse:collapse|separate", "bdf": "border-fit:repeat|clip|scale|stretch|overwrite|overflow|space", "bdi": "border-image:url(${0})", "bdl": "border-left:${1:1px} ${2:solid} ${3:#000}", "bdlc": "border-left-color:${1:#000}", "bdlen": "border-length", "bdli": "border-left-image:url(${0})", "bdls": "border-left-style", "bdlw": "border-left-width", "bdr": "border-right:${1:1px} ${2:solid} ${3:#000}", "bdrc": "border-right-color:${1:#000}", "bdri": "border-right-image:url(${0})", "bdrs": "border-radius", "bdrst": "border-right-style", "bdrw": "border-right-width", "bds": "border-style:none|hidden|dotted|dashed|solid|double|dot-dash|dot-dot-dash|wave|groove|ridge|inset|outset", "bdsp": "border-spacing", "bdt": "border-top:${1:1px} ${2:solid} ${3:#000}", "bdtc": "border-top-color:${1:#000}", "bdti": "border-top-image:url(${0})", "bdtli": "border-top-left-image:url(${0})|continue", "bdtlrs": "border-top-left-radius", "bdtri": "border-top-right-image:url(${0})|continue", "bdtrrs": "border-top-right-radius", "bdts": "border-top-style", "bdtw": "border-top-width", "bdw": "border-width", "bfv": "backface-visibility:hidden|visible", "bg": "background:${1:#000}", "bga": "background-attachment:fixed|scroll", "bgbk": "background-break:bounding-box|each-box|continuous", "bgc": "background-color:#${1:fff}", "bgcp": "background-clip:padding-box|border-box|content-box|no-clip", "bgi": "background-image:url(${0})", "bgo": "background-origin:padding-box|border-box|content-box", "bgp": "background-position:${1:0} ${2:0}", "bgpx": "background-position-x", "bgpy": "background-position-y", "bgr": "background-repeat:no-repeat|repeat-x|repeat-y|space|round", "bgsz": "background-size:contain|cover", "bxsh": "box-shadow:${1:inset }${2:hoff} ${3:voff} ${4:blur} ${5:#000}|none", "bxsz": "box-sizing:border-box|content-box|border-box", "c": "color:${1:#000}", "cr": "color:rgb(${1:0}, ${2:0}, ${3:0})", "cra": "color:rgba(${1:0}, ${2:0}, ${3:0}, ${4:.5})", "cl": "clear:both|left|right|none", "cm": "/* ${0} */", "cnt": "content:'${0}'|normal|open-quote|no-open-quote|close-quote|no-close-quote|attr(${0})|counter(${0})|counters(${0})", "coi": "counter-increment", "colm": "columns", "colmc": "column-count", "colmf": "column-fill", "colmg": "column-gap", "colmr": "column-rule", "colmrc": "column-rule-color", "colmrs": "column-rule-style", "colmrw": "column-rule-width", "colms": "column-span", "colmw": "column-width", "cor": "counter-reset", "cp": "clip:auto|rect(${1:top} ${2:right} ${3:bottom} ${4:left})", "cps": "caption-side:top|bottom", "cur": "cursor:pointer|auto|default|crosshair|hand|help|move|pointer|text", "d": "display:block|none|flex|inline-flex|inline|inline-block|grid|inline-grid|subgrid|list-item|run-in|compact|table|inline-table|table-caption|table-column|table-column-group|table-header-group|table-footer-group|table-row|table-row-group|table-cell|ruby|ruby-base|ruby-base-group|ruby-text|ruby-text-group", "ec": "empty-cells:show|hide", "f": "font:${1:1em} ${2:sans-serif}", "fd": "font-display:auto|block|swap|fallback|optional", "fef": "font-effect:none|engrave|emboss|outline", "fem": "font-emphasize", "femp": "font-emphasize-position:before|after", "fems": "font-emphasize-style:none|accent|dot|circle|disc", "ff": "font-family:serif|sans-serif|cursive|fantasy|monospace", "fft": "font-family:\"Times New Roman\", Times, Baskerville, Georgia, serif", "ffa": "font-family:Arial, \"Helvetica Neue\", Helvetica, sans-serif", "ffv": "font-family:Verdana, Geneva, sans-serif", "fl": "float:left|right|none", "fs": "font-style:italic|normal|oblique", "fsm": "font-smoothing:antialiased|subpixel-antialiased|none", "fst": "font-stretch:normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded", "fv": "font-variant:normal|small-caps", "fvs": "font-variation-settings:normal|inherit|initial|unset", "fw": "font-weight:normal|bold|bolder|lighter", "fx": "flex", "fxb": "flex-basis:fill|max-content|min-content|fit-content|content", "fxd": "flex-direction:row|row-reverse|column|column-reverse", "fxf": "flex-flow", "fxg": "flex-grow", "fxsh": "flex-shrink", "fxw": "flex-wrap:nowrap|wrap|wrap-reverse", "fsz": "font-size", "fsza": "font-size-adjust", "gtc": "grid-template-columns:repeat(${0})|minmax()", "gtr": "grid-template-rows:repeat(${0})|minmax()", "gta": "grid-template-areas", "gt": "grid-template", "gg": "grid-gap", "gcg": "grid-column-gap", "grg": "grid-row-gap", "gac": "grid-auto-columns:auto|minmax()", "gar": "grid-auto-rows:auto|minmax()", "gaf": "grid-auto-flow:row|column|dense|inherit|initial|unset", "gd": "grid", "gc": "grid-column", "gcs": "grid-column-start", "gce": "grid-column-end", "gr": "grid-row", "grs": "grid-row-start", "gre": "grid-row-end", "ga": "grid-area", "h": "height", "jc": "justify-content:start|end|stretch|flex-start|flex-end|center|space-between|space-around|space-evenly", "ji": "justify-items:start|end|center|stretch", "js": "justify-self:start|end|center|stretch", "l": "left", "lg": "background-image:linear-gradient(${1})", "lh": "line-height", "lis": "list-style", "lisi": "list-style-image", "lisp": "list-style-position:inside|outside", "list": "list-style-type:disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman", "lts": "letter-spacing:normal", "m": "margin", "mah": "max-height", "mar": "max-resolution", "maw": "max-width", "mb": "margin-bottom", "mih": "min-height", "mir": "min-resolution", "miw": "min-width", "ml": "margin-left", "mr": "margin-right", "mt": "margin-top", "ol": "outline", "olc": "outline-color:${1:#000}|invert", "olo": "outline-offset", "ols": "outline-style:none|dotted|dashed|solid|double|groove|ridge|inset|outset", "olw": "outline-width|thin|medium|thick", "op|opa": "opacity", "ord": "order", "ori": "orientation:landscape|portrait", "orp": "orphans", "ov": "overflow:hidden|visible|hidden|scroll|auto", "ovs": "overflow-style:scrollbar|auto|scrollbar|panner|move|marquee", "ovx": "overflow-x:hidden|visible|hidden|scroll|auto", "ovy": "overflow-y:hidden|visible|hidden|scroll|auto", "p": "padding", "pb": "padding-bottom", "pgba": "page-break-after:auto|always|left|right", "pgbb": "page-break-before:auto|always|left|right", "pgbi": "page-break-inside:auto|avoid", "pl": "padding-left", "pos": "position:relative|absolute|relative|fixed|static", "pr": "padding-right", "pt": "padding-top", "q": "quotes", "qen": "quotes:'\\201C' '\\201D' '\\2018' '\\2019'", "qru": "quotes:'\\00AB' '\\00BB' '\\201E' '\\201C'", "r": "right", "rsz": "resize:none|both|horizontal|vertical", "t": "top", "ta": "text-align:left|center|right|justify", "tal": "text-align-last:left|center|right", "tbl": "table-layout:fixed", "td": "text-decoration:none|underline|overline|line-through", "te": "text-emphasis:none|accent|dot|circle|disc|before|after", "th": "text-height:auto|font-size|text-size|max-size", "ti": "text-indent", "tj": "text-justify:auto|inter-word|inter-ideograph|inter-cluster|distribute|kashida|tibetan", "to": "text-outline:${1:0} ${2:0} ${3:#000}", "tov": "text-overflow:ellipsis|clip", "tr": "text-replace", "trf": "transform:${1}|skewX(${1:angle})|skewY(${1:angle})|scale(${1:x}, ${2:y})|scaleX(${1:x})|scaleY(${1:y})|scaleZ(${1:z})|scale3d(${1:x}, ${2:y}, ${3:z})|rotate(${1:angle})|rotateX(${1:angle})|rotateY(${1:angle})|rotateZ(${1:angle})|translate(${1:x}, ${2:y})|translateX(${1:x})|translateY(${1:y})|translateZ(${1:z})|translate3d(${1:tx}, ${2:ty}, ${3:tz})", "trfo": "transform-origin", "trfs": "transform-style:preserve-3d", "trs": "transition:${1:prop} ${2:time}", "trsde": "transition-delay:${1:time}", "trsdu": "transition-duration:${1:time}", "trsp": "transition-property:${1:prop}", "trstf": "transition-timing-function:${1:fn}", "tsh": "text-shadow:${1:hoff} ${2:voff} ${3:blur} ${4:#000}", "tt": "text-transform:uppercase|lowercase|capitalize|none", "tw": "text-wrap:none|normal|unrestricted|suppress", "us": "user-select:none", "v": "visibility:hidden|visible|collapse", "va": "vertical-align:top|super|text-top|middle|baseline|bottom|text-bottom|sub", "w": "width", "whs": "white-space:nowrap|pre|pre-wrap|pre-line|normal", "whsc": "white-space-collapse:normal|keep-all|loose|break-strict|break-all", "wid": "widows", "wm": "writing-mode:lr-tb|lr-tb|lr-bt|rl-tb|rl-bt|tb-rl|tb-lr|bt-lr|bt-rl", "wob": "word-break:normal|keep-all|break-all", "wos": "word-spacing", "wow": "word-wrap:none|unrestricted|suppress|break-word|normal", "z": "z-index", "zom": "zoom:1" }; var xslSnippets = { "tm|tmatch": "xsl:template[match mode]", "tn|tname": "xsl:template[name]", "call": "xsl:call-template[name]", "ap": "xsl:apply-templates[select mode]", "api": "xsl:apply-imports", "imp": "xsl:import[href]", "inc": "xsl:include[href]", "ch": "xsl:choose", "wh|xsl:when": "xsl:when[test]", "ot": "xsl:otherwise", "if": "xsl:if[test]", "par": "xsl:param[name]", "pare": "xsl:param[name select]", "var": "xsl:variable[name]", "vare": "xsl:variable[name select]", "wp": "xsl:with-param[name select]", "key": "xsl:key[name match use]", "elem": "xsl:element[name]", "attr": "xsl:attribute[name]", "attrs": "xsl:attribute-set[name]", "cp": "xsl:copy[select]", "co": "xsl:copy-of[select]", "val": "xsl:value-of[select]", "for|each": "xsl:for-each[select]", "tex": "xsl:text", "com": "xsl:comment", "msg": "xsl:message[terminate=no]", "fall": "xsl:fallback", "num": "xsl:number[value]", "nam": "namespace-alias[stylesheet-prefix result-prefix]", "pres": "xsl:preserve-space[elements]", "strip": "xsl:strip-space[elements]", "proc": "xsl:processing-instruction[name]", "sort": "xsl:sort[select order]", "choose": "xsl:choose>xsl:when+xsl:otherwise", "xsl": "!!!+xsl:stylesheet[version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform]>{\n|}", "!!!": "{<?xml version=\"1.0\" encoding=\"UTF-8\"?>}" }; var pugSnippets = { "!!!": "{doctype html}" }; var variables = { "lang": "en", "locale": "en-US", "charset": "UTF-8", "indentation": "\t", "newline": "\n" }; const defaultSyntaxes = { markup: 'html', stylesheet: 'css' }; const defaultOptions = { 'inlineElements': [ 'a', 'abbr', 'acronym', 'applet', 'b', 'basefont', 'bdo', 'big', 'br', 'button', 'cite', 'code', 'del', 'dfn', 'em', 'font', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'map', 'object', 'q', 's', 'samp', 'select', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'textarea', 'tt', 'u', 'var' ], 'output.indent': '\t', 'output.baseIndent': '', 'output.newline': '\n', 'output.tagCase': '', 'output.attributeCase': '', 'output.attributeQuotes': 'double', 'output.format': true, 'output.formatLeafNode': false, 'output.formatSkip': ['html'], 'output.formatForce': ['body'], 'output.inlineBreak': 3, 'output.compactBoolean': false, 'output.booleanAttributes': [ 'contenteditable', 'seamless', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'defer', 'disabled', 'formnovalidate', 'hidden', 'ismap', 'loop', 'multiple', 'muted', 'novalidate', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch' ], 'output.reverseAttributes': false, 'output.selfClosingStyle': 'html', 'output.field': (index, placeholder) => placeholder, 'output.text': text => text, 'markup.href': true, 'comment.enabled': false, 'comment.trigger': ['id', 'class'], 'comment.before': '', 'comment.after': '\n<!-- /[#ID][.CLASS] -->', 'bem.enabled': false, 'bem.element': '__', 'bem.modifier': '_', 'jsx.enabled': false, 'stylesheet.keywords': ['auto', 'inherit', 'unset', 'none'], 'stylesheet.unitless': ['z-index', 'line-height', 'opacity', 'font-weight', 'zoom', 'flex', 'flex-grow', 'flex-shrink'], 'stylesheet.shortHex': true, 'stylesheet.between': ': ', 'stylesheet.after': ';', 'stylesheet.intUnit': 'px', 'stylesheet.floatUnit': 'em', 'stylesheet.unitAliases': { e: 'em', p: '%', x: 'ex', r: 'rem' }, 'stylesheet.json': false, 'stylesheet.jsonDoubleQuotes': false, 'stylesheet.fuzzySearchMinScore': 0 }; const defaultConfig = { type: 'markup', syntax: 'html', variables, snippets: {}, options: defaultOptions }; const syntaxConfig = { markup: { snippets: parseSnippets$1(markupSnippets), }, xhtml: { options: { 'output.selfClosingStyle': 'xhtml' } }, xml: { options: { 'output.selfClosingStyle': 'xml' } }, xsl: { snippets: parseSnippets$1(xslSnippets), options: { 'output.selfClosingStyle': 'xml' } }, jsx: { options: { 'jsx.enabled': true } }, pug: { snippets: parseSnippets$1(pugSnippets) }, stylesheet: { snippets: parseSnippets$1(stylesheetSnippets) }, sass: { options: { 'stylesheet.after': '' } }, stylus: { options: { 'stylesheet.between': ' ', 'stylesheet.after': '', } } }; function parseSnippets$1(snippets) { const result = {}; Object.keys(snippets).forEach(k => { for (const name of k.split('|')) { result[name] = snippets[k]; } }); return result; } function resolveConfig(config = {}, globals = {}) { const type = config.type || 'markup'; const syntax = config.syntax || defaultSyntaxes[type]; return Object.assign(Object.assign(Object.assign({}, defaultConfig), config), { type, syntax, variables: mergedData(type, syntax, 'variables', config, globals), snippets: mergedData(type, syntax, 'snippets', config, globals), options: mergedData(type, syntax, 'options', config, globals) }); } function mergedData(type, syntax, key, config, globals = {}) { const typeDefaults = syntaxConfig[type]; const typeOverride = globals[type]; const syntaxDefaults = syntaxConfig[syntax]; const syntaxOverride = globals[syntax]; return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultConfig[key]), (typeDefaults && typeDefaults[key])), (syntaxDefaults && syntaxDefaults[key])), (typeOverride && typeOverride[key])), (syntaxOverride && syntaxOverride[key])), config[key]); } function backwardScanner(text, start = 0) { return { text, start, pos: text.length }; } function sol(scanner) { return scanner.pos === scanner.start; } function peek$1(scanner, offset = 0) { return scanner.text.charCodeAt(scanner.pos - 1 + offset); } function previous(scanner) { if (!sol(scanner)) { return scanner.text.charCodeAt(--scanner.pos); } } function consume(scanner, match) { if (sol(scanner)) { return false; } const ok = typeof match === 'function' ? match(peek$1(scanner)) : match === peek$1(scanner); if (ok) { scanner.pos--; } return !!ok; } function consumeWhile(scanner, match) { const start = scanner.pos; while (consume(scanner, match)) { } return scanner.pos < start; } function isQuote$1(c) { return c === 39 || c === 34 ; } function consumeQuoted(scanner) { const start = scanner.pos; const quote = previous(scanner); if (isQuote$1(quote)) { while (!sol(scanner)) { if (previous(scanner) === quote && peek$1(scanner) !== 92 ) { return true; } } } scanner.pos = start; return false; } const bracePairs = { [91 ]: 93 , [40 ]: 41 , [123 ]: 125 , }; function isHtml(scanner) { const start = scanner.pos; if (!consume(scanner, 62 )) { return false; } let ok = false; consume(scanner, 47 ); while (!sol(scanner)) { consumeWhile(scanner, isWhiteSpace); if (consumeIdent(scanner)) { if (consume(scanner, 47 )) { ok = consume(scanner, 60 ); break; } else if (consume(scanner, 60 )) { ok = true; break; } else if (consume(scanner, isWhiteSpace)) { continue; } else if (consume(scanner, 61 )) { if (consumeIdent(scanner)) { continue; } break; } else if (consumeAttributeWithUnquotedValue(scanner)) { ok = true; break; } break; } if (consumeAttribute(scanner)) { continue; } break; } scanner.pos = start; return ok; } function consumeAttribute(scanner) { return consumeAttributeWithQuotedValue(scanner) || consumeAttributeWithUnquotedValue(scanner); } function consumeAttributeWithQuotedValue(scanner) { const start = scanner.pos; if (consumeQuoted(scanner) && consume(scanner, 61 ) && consumeIdent(scanner)) { return true; } scanner.pos = start; return false; } function consumeAttributeWithUnquotedValue(scanner) { const start = scanner.pos; const stack = []; while (!sol(scanner)) { const ch = peek$1(scanner); if (isCloseBracket(ch)) { stack.push(ch); } else if (isOpenBracket(ch)) { if (stack.pop() !== bracePairs[ch]) { break; } } else if (!isUnquotedValue(ch)) { break; } scanner.pos--; } if (start !== scanner.pos && consume(scanner, 61 ) && consumeIdent(scanner)) { return true; } scanner.pos = start; return false; } function consumeIdent(scanner) { return consumeWhile(scanner, isIdent); } function isIdent(ch) { return ch === 58 || ch === 45 || isAlpha(ch) || isNumber(ch); } function isAlpha(ch) { ch &= ~32; return ch >= 65 && ch <= 90; } function isNumber(ch) { return ch > 47 && ch < 58; } function isWhiteSpace(ch) { return ch === 32 || ch === 9 ; } function isUnquotedValue(ch) { return !isNaN(ch) && ch !== 61 && !isWhiteSpace(ch) && !isQuote$1(ch); } function isOpenBracket(ch) { return ch === 123 || ch === 40 || ch === 91 ; } function isCloseBracket(ch) { return ch === 125 || ch === 41 || ch === 93 ; } const code = (ch) => ch.charCodeAt(0); const specialChars = '#.*:$-_!@%^+>/'.split('').map(code); const defaultOptions$1 = { type: 'markup', lookAhead: true, prefix: '' }; function extractAbbreviation$1(line, pos = line.length, options = {}) { const opt = Object.assign(Object.assign({}, defaultOptions$1), options); pos = Math.min(line.length, Math.max(0, pos == null ? line.length : pos)); if (opt.lookAhead) { pos = offsetPastAutoClosed(line, pos, opt); } let ch; const start = getStartOffset(line, pos, opt.prefix || ''); if (start === -1) { return void 0; } const scanner = backwardScanner(line, start); scanner.pos = pos; const stack = []; while (!sol(scanner)) { ch = peek$1(scanner); if (stack.includes(125 )) { if (ch === 125 ) { stack.push(ch); scanner.pos--; continue; } if (ch !== 123 ) { scanner.pos--; continue; } } if (isCloseBrace(ch, opt.type)) { stack.push(ch); } else if (isOpenBrace(ch, opt.type)) { if (stack.pop() !== bracePairs[ch]) { break; } } else if (stack.includes(93 ) || stack.includes(125 )) { scanner.pos--; continue; } else if (isHtml(scanner) || !isAbbreviation(ch)) { break; } scanner.pos--; } if (!stack.length && scanner.pos !== pos) { const abbreviation = line.slice(scanner.pos, pos).replace(/^[*+>^]+/, ''); return { abbreviation, location: pos - abbreviation.length, start: options.prefix ? start - options.prefix.length : pos - abbreviation.length, end: pos }; } } function offsetPastAutoClosed(line, pos, options) { if (isQuote$1(line.charCodeAt(pos))) { pos++; } while (isCloseBrace(line.charCodeAt(pos), options.type)) { pos++; } return pos; } function getStartOffset(line, pos, prefix) { if (!prefix) { return 0; } const scanner = backwardScanner(line); const compiledPrefix = prefix.split('').map(code); scanner.pos = pos; let result; while (!sol(scanner)) { if (consumePair(scanner, 93 , 91 ) || consumePair(scanner, 125 , 123 )) { continue; } result = scanner.pos; if (consumeArray(scanner, compiledPrefix)) { return result; } scanner.pos--; } return -1; } function consumePair(scanner, close, open) { const start = scanner.pos; if (consume(scanner, close)) { while (!sol(scanner)) { if (consume(scanner, open)) { return true; } scanner.pos--; } } scanner.pos = start; return false; } function consumeArray(scanner, arr) { const start = scanner.pos; let consumed = false; for (let i = arr.length - 1; i >= 0 && !sol(scanner); i--) { if (!consume(scanner, arr[i])) { break; } consumed = i === 0; } if (!consumed) { scanner.pos = start; } return consumed; } function isAbbreviation(ch) { return (ch > 64 && ch < 91) || (ch > 96 && ch < 123) || (ch > 47 && ch < 58) || specialChars.includes(ch); } function isOpenBrace(ch, syntax) { return ch === 40 || (syntax === 'markup' && (ch === 91 || ch === 123 )); } function isCloseBrace(ch, syntax) { return ch === 41 || (syntax === 'markup' && (ch === 93 || ch === 125 )); } function expandAbbreviation$1(abbr, config) { const resolvedConfig = resolveConfig(config); return resolvedConfig.type === 'stylesheet' ? stylesheet(abbr, resolvedConfig) : markup(abbr, resolvedConfig); } function markup(abbr, config) { return stringify(parse(abbr, config), config); } function stylesheet(abbr, config) { return css(parse$1(abbr, config), config); } function parseSnippets(snippets) { const result = {}; Object.keys(snippets).forEach(k => { for (const name of k.split('|')) { result[name] = snippets[k]; } }); return result; } const syntaxes = { markup: ['html', 'xml', 'xsl', 'jsx', 'js', 'pug', 'slim', 'haml'], stylesheet: ['css', 'sass', 'scss', 'less', 'sss', 'stylus'] }; var __awaiter$4 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const localize$b = main$3.loadMessageBundle(); const snippetKeyCache = new Map(); let markupSnippetKeys; const stylesheetCustomSnippetsKeyCache = new Map(); const htmlAbbreviationStartRegex = /^[a-z,A-Z,!,(,[,#,\.\{]/; const jsxAbbreviationStartRegex = /^[a-z,A-Z,!,(,[,#,\.]/; const cssAbbreviationRegex = /^-?[a-z,A-Z,!,@,#]/; const htmlAbbreviationRegex = /[a-z,A-Z\.]/; const commonlyUsedTags = [...htmlData.tags, 'lorem']; const bemFilterSuffix = 'bem'; const filterDelimitor = '|'; const trimFilterSuffix = 't'; const commentFilterSuffix = 'c'; const maxFilters = 3; function doComplete(document, position, syntax, emmetConfig) { var _a, _b, _c; if (emmetConfig.showExpandedAbbreviation === 'never' || !getEmmetMode(syntax, emmetConfig.excludeLanguages)) { return; } const isStyleSheetRes = isStyleSheet(syntax); if (!isStyleSheetRes) { if (!snippetKeyCache.has(syntax)) { const registry = (_a = customSnippetsRegistry[syntax]) !== null && _a !== void 0 ? _a : getDefaultSnippets(syntax); snippetKeyCache.set(syntax, Object.keys(registry)); } markupSnippetKeys = (_b = snippetKeyCache.get(syntax)) !== null && _b !== void 0 ? _b : []; } const extractOptions = { lookAhead: !isStyleSheetRes, type: isStyleSheetRes ? 'stylesheet' : 'markup' }; const extractedValue = extractAbbreviation(document, position, extractOptions); if (!extractedValue) { return; } const { abbreviationRange, abbreviation, filter } = extractedValue; const currentLineTillPosition = getCurrentLine(document, position).substr(0, position.character); const currentWord = getCurrentWord$1(currentLineTillPosition); if (currentWord === abbreviation && currentLineTillPosition.endsWith(`<${abbreviation}`) && syntaxes.markup.includes(syntax)) { return; } const expandOptions = getExpandOptions(syntax, emmetConfig, filter); let expandedText = ""; let expandedAbbr; let completionItems = []; const createExpandedAbbr = (syntax, abbr) => { if (!isAbbreviationValid(syntax, abbreviation)) { return; } try { expandedText = expandAbbreviation$1(abbr, expandOptions); if (isStyleSheetRes && '!important'.startsWith(abbr)) { expandedText = '!important'; } } catch (e) { } if (!expandedText || isExpandedTextNoise(syntax, abbr, expandedText, expandOptions.options)) { return; } expandedAbbr = CompletionItem.create(abbr); expandedAbbr.textEdit = TextEdit.replace(abbreviationRange, escapeNonTabStopDollar(addFinalTabStop(expandedText))); expandedAbbr.documentation = replaceTabStopsWithCursors(expandedText); expandedAbbr.insertTextFormat = InsertTextFormat.Snippet; expandedAbbr.detail = localize$b('Emmet abbreviation', "Emmet Abbreviation"); expandedAbbr.label = abbreviation; expandedAbbr.label += filter ? '|' + filter.replace(',', '|') : ""; completionItems = [expandedAbbr]; }; if (isStyleSheet(syntax)) { createExpandedAbbr(syntax, abbreviation); if (abbreviation.length > 4 && cssData$1.properties.find(x => x.startsWith(abbreviation))) { return CompletionList.create([], true); } if (expandedAbbr && expandedText.length) { expandedAbbr.textEdit = TextEdit.replace(abbreviationRange, escapeNonTabStopDollar(addFinalTabStop(expandedText))); expandedAbbr.documentation = replaceTabStopsWithCursors(expandedText); expandedAbbr.label = removeTabStops(expandedText); expandedAbbr.filterText = abbreviation; const stylesheetCustomSnippetsKeys = stylesheetCustomSnippetsKeyCache.has(syntax) ? stylesheetCustomSnippetsKeyCache.get(syntax) : stylesheetCustomSnippetsKeyCache.get('css'); completionItems = makeSnippetSuggestion(stylesheetCustomSnippetsKeys !== null && stylesheetCustomSnippetsKeys !== void 0 ? stylesheetCustomSnippetsKeys : [], abbreviation, abbreviation, abbreviationRange, expandOptions, 'Emmet Custom Snippet', false); if (!completionItems.find(x => { var _a, _b, _c; return ((_a = x.textEdit) === null || _a === void 0 ? void 0 : _a.newText) && ((_b = x.textEdit) === null || _b === void 0 ? void 0 : _b.newText) === ((_c = expandedAbbr === null || expandedAbbr === void 0 ? void 0 : expandedAbbr.textEdit) === null || _c === void 0 ? void 0 : _c.newText); })) { const abbrRegex = new RegExp('.*' + abbreviation.split('').map(x => (x === '$' || x === '+') ? '\\' + x : x).join('.*') + '.*', 'i'); if (/\d/.test(abbreviation) || abbrRegex.test(expandedAbbr.label)) { completionItems.push(expandedAbbr); } } } } else { createExpandedAbbr(syntax, abbreviation); let tagToFindMoreSuggestionsFor = abbreviation; const newTagMatches = abbreviation.match(/(>|\+)([\w:-]+)$/); if (newTagMatches && newTagMatches.length === 3) { tagToFindMoreSuggestionsFor = newTagMatches[2]; } if (syntax !== 'xml') { const commonlyUsedTagSuggestions = makeSnippetSuggestion(commonlyUsedTags, tagToFindMoreSuggestionsFor, abbreviation, abbreviationRange, expandOptions, 'Emmet Abbreviation'); completionItems = completionItems.concat(commonlyUsedTagSuggestions); } if (emmetConfig.showAbbreviationSuggestions === true) { const abbreviationSuggestions = makeSnippetSuggestion(markupSnippetKeys.filter(x => !commonlyUsedTags.includes(x)), tagToFindMoreSuggestionsFor, abbreviation, abbreviationRange, expandOptions, 'Emmet Abbreviation'); if (expandedAbbr && abbreviationSuggestions.length > 0 && tagToFindMoreSuggestionsFor !== abbreviation) { expandedAbbr.sortText = '0' + expandedAbbr.label; abbreviationSuggestions.forEach(item => { item.filterText = abbreviation; item.sortText = '9' + abbreviation; }); } completionItems = completionItems.concat(abbreviationSuggestions); } if (syntax === 'html' && completionItems.length >= 2 && abbreviation.includes(":") && ((_c = expandedAbbr === null || expandedAbbr === void 0 ? void 0 : expandedAbbr.textEdit) === null || _c === void 0 ? void 0 : _c.newText) === `<${abbreviation}>\${0}</${abbreviation}>`) { completionItems = completionItems.filter(item => item.label !== abbreviation); } } if (emmetConfig.showSuggestionsAsSnippets === true) { completionItems.forEach(x => x.kind = CompletionItemKind.Snippet); } return completionItems.length ? CompletionList.create(completionItems, true) : undefined; } function makeSnippetSuggestion(snippetKeys, prefix, abbreviation, abbreviationRange, expandOptions, snippetDetail, skipFullMatch = true) { if (!prefix || !snippetKeys) { return []; } const snippetCompletions = []; snippetKeys.forEach(snippetKey => { if (!snippetKey.startsWith(prefix.toLowerCase()) || (skipFullMatch && snippetKey === prefix.toLowerCase())) { return; } const currentAbbr = abbreviation + snippetKey.substr(prefix.length); let expandedAbbr; try { expandedAbbr = expandAbbreviation$1(currentAbbr, expandOptions); } catch (e) { } if (!expandedAbbr) { return; } const item = CompletionItem.create(prefix + snippetKey.substr(prefix.length)); item.documentation = replaceTabStopsWithCursors(expandedAbbr); item.detail = snippetDetail; item.textEdit = TextEdit.replace(abbreviationRange, escapeNonTabStopDollar(addFinalTabStop(expandedAbbr))); item.insertTextFormat = InsertTextFormat.Snippet; snippetCompletions.push(item); }); return snippetCompletions; } function getCurrentWord$1(currentLineTillPosition) { if (currentLineTillPosition) { const matches = currentLineTillPosition.match(/[\w,:,-,\.]*$/); if (matches) { return matches[0]; } } } function replaceTabStopsWithCursors(expandedWord) { return expandedWord.replace(/([^\\])\$\{\d+\}/g, '$1|').replace(/\$\{\d+:([^\}]+)\}/g, '$1'); } function removeTabStops(expandedWord) { return expandedWord.replace(/([^\\])\$\{\d+\}/g, '$1').replace(/\$\{\d+:([^\}]+)\}/g, '$1'); } function escapeNonTabStopDollar(text) { return text ? text.replace(/([^\\])(\$)([^\{])/g, '$1\\$2$3') : text; } function addFinalTabStop(text) { if (!text || !text.trim()) { return text; } let maxTabStop = -1; let maxTabStopRanges = []; let foundLastStop = false; let replaceWithLastStop = false; let i = 0; const n = text.length; try { while (i < n && !foundLastStop) { if (text[i++] != '$' || text[i++] != '{') { continue; } let numberStart = -1; let numberEnd = -1; while (i < n && /\d/.test(text[i])) { numberStart = numberStart < 0 ? i : numberStart; numberEnd = i + 1; i++; } if (numberStart === -1 || numberEnd === -1 || i >= n || (text[i] != '}' && text[i] != ':')) { continue; } const currentTabStop = text.substring(numberStart, numberEnd); foundLastStop = currentTabStop === '0'; if (foundLastStop) { break; } let foundPlaceholder = false; if (text[i++] == ':') { while (i < n) { if (text[i] == '}') { foundPlaceholder = true; break; } i++; } } if (Number(currentTabStop) > Number(maxTabStop)) { maxTabStop = Number(currentTabStop); maxTabStopRanges = [{ numberStart, numberEnd }]; replaceWithLastStop = !foundPlaceholder; } else if (Number(currentTabStop) === maxTabStop) { maxTabStopRanges.push({ numberStart, numberEnd }); } } } catch (e) { } if (replaceWithLastStop && !foundLastStop) { for (let i = 0; i < maxTabStopRanges.length; i++) { const rangeStart = maxTabStopRanges[i].numberStart; const rangeEnd = maxTabStopRanges[i].numberEnd; text = text.substr(0, rangeStart) + '0' + text.substr(rangeEnd); } } return text; } function getCurrentLine(document, position) { const offset = document.offsetAt(position); const text = document.getText(); let start = 0; let end = text.length; for (let i = offset - 1; i >= 0; i--) { if (text[i] === '\n') { start = i + 1; break; } } for (let i = offset; i < text.length; i++) { if (text[i] === '\n') { end = i; break; } } return text.substring(start, end); } let customSnippetsRegistry = {}; let variablesFromFile = {}; let profilesFromFile = {}; const emmetSnippetField = (index, placeholder) => `\${${index}${placeholder ? ':' + placeholder : ''}}`; function isStyleSheet(syntax) { return syntaxes.stylesheet.includes(syntax); } function getSyntaxType(syntax) { return isStyleSheet(syntax) ? 'stylesheet' : 'markup'; } function getDefaultSyntax(syntax) { return isStyleSheet(syntax) ? 'css' : 'html'; } function getDefaultSnippets(syntax) { const syntaxType = getSyntaxType(syntax); const emptyUserConfig = { type: syntaxType, syntax }; const resolvedConfig = resolveConfig(emptyUserConfig); return syntax === 'xml' ? {} : resolvedConfig.snippets; } function getFilters(text, pos) { let filter; for (let i = 0; i < maxFilters; i++) { if (text.endsWith(`${filterDelimitor}${bemFilterSuffix}`, pos)) { pos -= bemFilterSuffix.length + 1; filter = filter ? bemFilterSuffix + ',' + filter : bemFilterSuffix; } else if (text.endsWith(`${filterDelimitor}${commentFilterSuffix}`, pos)) { pos -= commentFilterSuffix.length + 1; filter = filter ? commentFilterSuffix + ',' + filter : commentFilterSuffix; } else if (text.endsWith(`${filterDelimitor}${trimFilterSuffix}`, pos)) { pos -= trimFilterSuffix.length + 1; filter = filter ? trimFilterSuffix + ',' + filter : trimFilterSuffix; } else { break; } } return { pos: pos, filter: filter }; } function extractAbbreviation(document, position, options) { const currentLine = getCurrentLine(document, position); const currentLineTillPosition = currentLine.substr(0, position.character); const { pos, filter } = getFilters(currentLineTillPosition, position.character); const lengthOccupiedByFilter = filter ? filter.length + 1 : 0; const result = extractAbbreviation$1(currentLine, pos, options); if (!result) { return; } const rangeToReplace = Range.create(position.line, result.location, position.line, result.location + result.abbreviation.length + lengthOccupiedByFilter); return { abbreviationRange: rangeToReplace, abbreviation: result.abbreviation, filter }; } function extractAbbreviationFromText(text, syntax) { if (!text) { return; } const { pos, filter } = getFilters(text, text.length); const extractOptions = (isStyleSheet(syntax) || syntax === 'stylesheet') ? { syntax: 'stylesheet', lookAhead: false } : { lookAhead: true }; const result = extractAbbreviation$1(text, pos, extractOptions); if (!result) { return; } return { abbreviation: result.abbreviation, filter }; } function isAbbreviationValid(syntax, abbreviation) { if (!abbreviation) { return false; } if (isStyleSheet(syntax)) { if (abbreviation.includes('#')) { if (abbreviation.startsWith('#')) { const hexColorRegex = /^#[\d,a-f,A-F]{1,6}$/; return hexColorRegex.test(abbreviation); } else if (commonlyUsedTags.includes(abbreviation.substring(0, abbreviation.indexOf('#')))) { return false; } } return cssAbbreviationRegex.test(abbreviation); } if (abbreviation.startsWith('!')) { return !/[^!]/.test(abbreviation); } if ((/\(/.test(abbreviation) || /\)/.test(abbreviation)) && !/\{[^\}\{]*[\(\)]+[^\}\{]*\}(?:[>\+\*\^]|$)/.test(abbreviation) && !/\(.*\)[>\+\*\^]/.test(abbreviation) && !/[>\+\*\^]\(.*\)/.test(abbreviation)) { return false; } if (syntax === 'jsx') { return (jsxAbbreviationStartRegex.test(abbreviation) && htmlAbbreviationRegex.test(abbreviation)); } return (htmlAbbreviationStartRegex.test(abbreviation) && htmlAbbreviationRegex.test(abbreviation)); } function isExpandedTextNoise(syntax, abbreviation, expandedText, options) { var _a, _b; if (isStyleSheet(syntax) && options) { const between = (_a = options['stylesheet.between']) !== null && _a !== void 0 ? _a : ': '; const after = (_b = options['stylesheet.after']) !== null && _b !== void 0 ? _b : ';'; let endPrefixIndex = abbreviation.indexOf(between[0], Math.max(abbreviation.length - between.length, 0)); endPrefixIndex = endPrefixIndex >= 0 ? endPrefixIndex : abbreviation.length; const abbr = abbreviation.substring(0, endPrefixIndex); return expandedText === `${abbr}${between}\${0}${after}` || expandedText.replace(/\s/g, '') === abbreviation.replace(/\s/g, '') + after; } if (syntax === 'xml' && commonlyUsedTags.some(tag => tag.startsWith(abbreviation.toLowerCase()))) { return true; } if (commonlyUsedTags.includes(abbreviation.toLowerCase()) || markupSnippetKeys.includes(abbreviation)) { return false; } if (/[-,:]/.test(abbreviation) && !/--|::/.test(abbreviation) && !abbreviation.endsWith(':')) { return false; } if (abbreviation === '.') { return false; } const dotMatches = abbreviation.match(/^([a-z,A-Z,\d]*)\.$/); if (dotMatches) { if (dotMatches[1] && htmlData.tags.includes(dotMatches[1])) { return false; } return true; } if (syntax === 'jsx' && /^([A-Z][A-Za-z0-9]*)+$/.test(abbreviation)) { return false; } return (expandedText.toLowerCase() === `<${abbreviation.toLowerCase()}>\${1}</${abbreviation.toLowerCase()}>`); } function getExpandOptions(syntax, emmetConfig, filter) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; emmetConfig = emmetConfig !== null && emmetConfig !== void 0 ? emmetConfig : {}; emmetConfig['preferences'] = (_a = emmetConfig['preferences']) !== null && _a !== void 0 ? _a : {}; const preferences = emmetConfig['preferences']; const stylesheetSyntax = isStyleSheet(syntax) ? syntax : 'css'; const profile = getProfile(syntax, (_b = emmetConfig['syntaxProfiles']) !== null && _b !== void 0 ? _b : {}); const filtersFromProfile = (profile && profile['filters']) ? profile['filters'].split(',') : []; const trimmedFilters = filtersFromProfile.map(filterFromProfile => filterFromProfile.trim()); const bemEnabled = (filter && filter.split(',').some(x => x.trim() === 'bem')) || trimmedFilters.includes('bem'); const commentEnabled = (filter && filter.split(',').some(x => x.trim() === 'c')) || trimmedFilters.includes('c'); const formatters = getFormatters(syntax, emmetConfig['preferences']); const unitAliases = ((formatters === null || formatters === void 0 ? void 0 : formatters.stylesheet) && formatters.stylesheet['unitAliases']) || {}; const defaultVSCodeOptions = { 'output.formatSkip': ['html'], 'output.formatForce': ['body'], 'output.inlineBreak': 0, 'output.compactBoolean': false, 'output.reverseAttributes': false, 'output.field': emmetSnippetField, 'markup.href': true, 'comment.enabled': false, 'comment.trigger': ['id', 'class'], 'comment.before': '', 'comment.after': '\n<!-- /[#ID][.CLASS] -->', 'bem.enabled': false, 'bem.element': '__', 'bem.modifier': '_', 'jsx.enabled': syntax === 'jsx', 'stylesheet.shortHex': true, 'stylesheet.between': syntax === 'stylus' ? ' ' : ': ', 'stylesheet.after': (syntax === 'sass' || syntax === 'stylus') ? '' : ';', 'stylesheet.intUnit': 'px', 'stylesheet.floatUnit': 'em', 'stylesheet.unitAliases': { e: 'em', p: '%', x: 'ex', r: 'rem' }, 'stylesheet.fuzzySearchMinScore': 0.3, }; const userPreferenceOptions = { 'output.tagCase': profile['tagCase'], 'output.attributeCase': profile['attributeCase'], 'output.attributeQuotes': profile['attributeQuotes'], 'output.format': (_c = profile['format']) !== null && _c !== void 0 ? _c : true, 'output.formatSkip': preferences['format.noIndentTags'], 'output.formatForce': preferences['format.forceIndentationForTags'], 'output.inlineBreak': (_d = profile['inlineBreak']) !== null && _d !== void 0 ? _d : preferences['output.inlineBreak'], 'output.compactBoolean': (_e = profile['compactBooleanAttributes']) !== null && _e !== void 0 ? _e : preferences['profile.allowCompactBoolean'], 'output.reverseAttributes': preferences['output.reverseAttributes'], 'output.selfClosingStyle': (_g = (_f = profile['selfClosingStyle']) !== null && _f !== void 0 ? _f : preferences['output.selfClosingStyle']) !== null && _g !== void 0 ? _g : getClosingStyle(syntax), 'output.field': emmetSnippetField, 'comment.enabled': commentEnabled, 'comment.trigger': preferences['filter.commentTrigger'], 'comment.before': preferences['filter.commentBefore'], 'comment.after': preferences['filter.commentAfter'], 'bem.enabled': bemEnabled, 'bem.element': (_h = preferences['bem.elementSeparator']) !== null && _h !== void 0 ? _h : '__', 'bem.modifier': (_j = preferences['bem.modifierSeparator']) !== null && _j !== void 0 ? _j : '_', 'jsx.enabled': syntax === 'jsx', 'stylesheet.shortHex': preferences['css.color.short'], 'stylesheet.between': preferences[`${stylesheetSyntax}.valueSeparator`], 'stylesheet.after': preferences[`${stylesheetSyntax}.propertyEnd`], 'stylesheet.intUnit': preferences['css.intUnit'], 'stylesheet.floatUnit': preferences['css.floatUnit'], 'stylesheet.unitAliases': unitAliases, 'stylesheet.fuzzySearchMinScore': preferences['css.fuzzySearchMinScore'], }; const combinedOptions = {}; [...Object.keys(defaultVSCodeOptions), ...Object.keys(userPreferenceOptions)].forEach(key => { var _a; const castKey = key; combinedOptions[castKey] = (_a = userPreferenceOptions[castKey]) !== null && _a !== void 0 ? _a : defaultVSCodeOptions[castKey]; }); const mergedAliases = Object.assign(Object.assign({}, defaultVSCodeOptions['stylesheet.unitAliases']), userPreferenceOptions['stylesheet.unitAliases']); combinedOptions['stylesheet.unitAliases'] = mergedAliases; const type = getSyntaxType(syntax); const variables = getVariables(emmetConfig['variables']); const baseSyntax = getDefaultSyntax(syntax); const snippets = (type === 'stylesheet') ? ((_k = customSnippetsRegistry[syntax]) !== null && _k !== void 0 ? _k : customSnippetsRegistry[baseSyntax]) : customSnippetsRegistry[syntax]; return { type, options: combinedOptions, variables, snippets, syntax, text: undefined, maxRepeat: 1000, }; } function getClosingStyle(syntax) { switch (syntax) { case 'xhtml': return 'xhtml'; case 'xml': return 'xml'; case 'xsl': return 'xml'; case 'jsx': return 'xhtml'; default: return 'html'; } } function parseAbbreviation(abbreviation, options) { const resolvedOptions = resolveConfig(options); return (options.type === 'stylesheet') ? parse$1(abbreviation, resolvedOptions) : parse(abbreviation, resolvedOptions); } function expandAbbreviation(abbreviation, config) { let expandedText; const resolvedConfig = resolveConfig(config); if (config.type === 'stylesheet') { if (typeof abbreviation === 'string') { expandedText = expandAbbreviation$1(abbreviation, resolvedConfig); } else { expandedText = css(abbreviation, resolvedConfig); } } else { if (typeof abbreviation === 'string') { expandedText = expandAbbreviation$1(abbreviation, resolvedConfig); } else { expandedText = stringify(abbreviation, resolvedConfig); } } return escapeNonTabStopDollar(addFinalTabStop(expandedText)); } function getProfile(syntax, profilesFromSettings) { if (!profilesFromSettings) { profilesFromSettings = {}; } const profilesConfig = Object.assign({}, profilesFromFile, profilesFromSettings); const options = profilesConfig[syntax]; if (!options || typeof options === 'string') { if (options === 'xhtml') { return { selfClosingStyle: 'xhtml' }; } return {}; } const newOptions = {}; for (const key in options) { switch (key) { case 'tag_case': newOptions['tagCase'] = (options[key] === 'lower' || options[key] === 'upper') ? options[key] : ''; break; case 'attr_case': newOptions['attributeCase'] = (options[key] === 'lower' || options[key] === 'upper') ? options[key] : ''; break; case 'attr_quotes': newOptions['attributeQuotes'] = options[key]; break; case 'tag_nl': newOptions['format'] = (options[key] === true || options[key] === false) ? options[key] : true; break; case 'inline_break': newOptions['inlineBreak'] = options[key]; break; case 'self_closing_tag': if (options[key] === true) { newOptions['selfClosingStyle'] = 'xml'; break; } if (options[key] === false) { newOptions['selfClosingStyle'] = 'html'; break; } newOptions['selfClosingStyle'] = options[key]; break; case 'compact_bool': newOptions['compactBooleanAttributes'] = options[key]; break; default: newOptions[key] = options[key]; break; } } return newOptions; } function getVariables(variablesFromSettings) { if (!variablesFromSettings) { return variablesFromFile; } return Object.assign({}, variablesFromFile, variablesFromSettings); } function getFormatters(syntax, preferences) { if (!preferences || typeof preferences !== 'object') { return {}; } if (!isStyleSheet(syntax)) { const commentFormatter = {}; for (const key in preferences) { switch (key) { case 'filter.commentAfter': commentFormatter['after'] = preferences[key]; break; case 'filter.commentBefore': commentFormatter['before'] = preferences[key]; break; case 'filter.commentTrigger': commentFormatter['trigger'] = preferences[key]; break; } } return { comment: commentFormatter }; } let fuzzySearchMinScore = typeof (preferences === null || preferences === void 0 ? void 0 : preferences['css.fuzzySearchMinScore']) === 'number' ? preferences['css.fuzzySearchMinScore'] : 0.3; if (fuzzySearchMinScore > 1) { fuzzySearchMinScore = 1; } else if (fuzzySearchMinScore < 0) { fuzzySearchMinScore = 0; } const stylesheetFormatter = { 'fuzzySearchMinScore': fuzzySearchMinScore }; for (const key in preferences) { switch (key) { case 'css.floatUnit': stylesheetFormatter['floatUnit'] = preferences[key]; break; case 'css.intUnit': stylesheetFormatter['intUnit'] = preferences[key]; break; case 'css.unitAliases': const unitAliases = {}; preferences[key].split(',').forEach((alias) => { if (!alias || !alias.trim() || !alias.includes(':')) { return; } const aliasName = alias.substr(0, alias.indexOf(':')); const aliasValue = alias.substr(aliasName.length + 1); if (!aliasName.trim() || !aliasValue) { return; } unitAliases[aliasName.trim()] = aliasValue; }); stylesheetFormatter['unitAliases'] = unitAliases; break; case `${syntax}.valueSeparator`: stylesheetFormatter['between'] = preferences[key]; break; case `${syntax}.propertyEnd`: stylesheetFormatter['after'] = preferences[key]; break; } } return { stylesheet: stylesheetFormatter }; } function updateExtensionsPath(emmetExtensionsPathSetting, fs, workspaceFolderPath, homeDir) { return __awaiter$4(this, void 0, void 0, function* () { resetSettingsFromFile(); if (!emmetExtensionsPathSetting.length) { return; } let emmetExtensionsPathUri; for (let emmetExtensionsPath of emmetExtensionsPathSetting) { if (emmetExtensionsPath) { emmetExtensionsPath = emmetExtensionsPath.trim(); } if (emmetExtensionsPath.length && emmetExtensionsPath[0] === '~') { if (homeDir) { emmetExtensionsPathUri = joinPath$1(homeDir, emmetExtensionsPath.substr(1)); } } else if (!isAbsolutePath(emmetExtensionsPath)) { if (workspaceFolderPath) { emmetExtensionsPathUri = joinPath$1(workspaceFolderPath, emmetExtensionsPath); } } else { emmetExtensionsPathUri = URI.file(emmetExtensionsPath); } try { if (!emmetExtensionsPathUri || (yield fs.stat(emmetExtensionsPathUri)).type !== FileType$1.Directory) { continue; } } catch (e) { continue; } const snippetsPath = joinPath$1(emmetExtensionsPathUri, 'snippets.json'); const profilesPath = joinPath$1(emmetExtensionsPathUri, 'syntaxProfiles.json'); let snippetsDataStr = ""; try { const snippetsData = yield fs.readFile(snippetsPath); snippetsDataStr = new util_1.TextDecoder().decode(snippetsData); } catch (e) { } if (snippetsDataStr.length) { try { const snippetsJson = tryParseFile(snippetsPath, snippetsDataStr); if (snippetsJson['variables']) { updateVariables(snippetsJson['variables']); } updateSnippets(snippetsJson); } catch (e) { resetSettingsFromFile(); throw e; } } let profilesDataStr = ""; try { const profilesData = yield fs.readFile(profilesPath); profilesDataStr = new util_1.TextDecoder().decode(profilesData); } catch (e) { } if (profilesDataStr.length) { try { const profilesJson = tryParseFile(profilesPath, profilesDataStr); updateProfiles(profilesJson); } catch (e) { resetSettingsFromFile(); throw e; } } } }); } function tryParseFile(strPath, dataStr) { let errors = []; const json = parse$3(dataStr, errors); if (errors.length) { throw new Error(`Found error ${printParseErrorCode(errors[0].error)} while parsing the file ${strPath} at offset ${errors[0].offset}`); } return json; } function updateVariables(varsJson) { if (typeof varsJson === 'object' && varsJson) { variablesFromFile = Object.assign({}, variablesFromFile, varsJson); } else { throw new Error(localize$b("emmetInvalidVariables", "Invalid emmet.variables field. See https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration for a valid example.")); } } function updateProfiles(profileJson) { if (typeof profileJson === 'object' && profileJson) { profilesFromFile = Object.assign({}, profilesFromFile, profileJson); } else { throw new Error(localize$b("emmetInvalidProfiles", "Invalid syntax profile. See https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration for a valid example.")); } } function updateSnippets(snippetsJson) { if (typeof snippetsJson === 'object' && snippetsJson) { Object.keys(snippetsJson).forEach(syntax => { if (!snippetsJson[syntax]['snippets']) { return; } const baseSyntax = getDefaultSyntax(syntax); let customSnippets = snippetsJson[syntax]['snippets']; if (snippetsJson[baseSyntax] && snippetsJson[baseSyntax]['snippets'] && baseSyntax !== syntax) { customSnippets = Object.assign({}, snippetsJson[baseSyntax]['snippets'], snippetsJson[syntax]['snippets']); } if (!isStyleSheet(syntax)) { for (const snippetKey in customSnippets) { if (customSnippets.hasOwnProperty(snippetKey) && customSnippets[snippetKey].startsWith('<') && customSnippets[snippetKey].endsWith('>')) { customSnippets[snippetKey] = `{${customSnippets[snippetKey]}}`; } } } else { const prevSnippetKeys = stylesheetCustomSnippetsKeyCache.get(syntax); const mergedSnippetKeys = Object.assign([], prevSnippetKeys, Object.keys(customSnippets)); stylesheetCustomSnippetsKeyCache.set(syntax, mergedSnippetKeys); } const prevSnippetsRegistry = customSnippetsRegistry[syntax]; const newSnippets = parseSnippets(customSnippets); const mergedSnippets = Object.assign({}, prevSnippetsRegistry, newSnippets); const mergedSnippetKeys = Object.keys(mergedSnippets); customSnippetsRegistry[syntax] = mergedSnippets; snippetKeyCache.set(syntax, mergedSnippetKeys); }); } else { throw new Error(localize$b("emmetInvalidSnippets", "Invalid snippets file. See https://code.visualstudio.com/docs/editor/emmet#_using-custom-emmet-snippets for a valid example.")); } } function resetSettingsFromFile() { customSnippetsRegistry = {}; snippetKeyCache.clear(); stylesheetCustomSnippetsKeyCache.clear(); profilesFromFile = {}; variablesFromFile = {}; } function getEmmetMode(language, excludedLanguages = []) { if (!language || excludedLanguages.includes(language)) { return; } if (/\b(typescriptreact|javascriptreact|jsx-tags)\b/.test(language)) { return 'jsx'; } if (language === 'sass-indented') { return 'sass'; } if (language === 'jade') { return 'pug'; } if (syntaxes.markup.includes(language) || syntaxes.stylesheet.includes(language)) { return language; } } var emmetHelper = /*#__PURE__*/Object.freeze({ __proto__: null, get FileType () { return FileType$1; }, doComplete: doComplete, emmetSnippetField: emmetSnippetField, isStyleSheet: isStyleSheet, getSyntaxType: getSyntaxType, getDefaultSyntax: getDefaultSyntax, getDefaultSnippets: getDefaultSnippets, extractAbbreviation: extractAbbreviation, extractAbbreviationFromText: extractAbbreviationFromText, isAbbreviationValid: isAbbreviationValid, getExpandOptions: getExpandOptions, parseAbbreviation: parseAbbreviation, expandAbbreviation: expandAbbreviation, updateExtensionsPath: updateExtensionsPath, getEmmetMode: getEmmetMode }); var TokenType; (function (TokenType) { TokenType[TokenType["Ident"] = 0] = "Ident"; TokenType[TokenType["AtKeyword"] = 1] = "AtKeyword"; TokenType[TokenType["String"] = 2] = "String"; TokenType[TokenType["BadString"] = 3] = "BadString"; TokenType[TokenType["UnquotedString"] = 4] = "UnquotedString"; TokenType[TokenType["Hash"] = 5] = "Hash"; TokenType[TokenType["Num"] = 6] = "Num"; TokenType[TokenType["Percentage"] = 7] = "Percentage"; TokenType[TokenType["Dimension"] = 8] = "Dimension"; TokenType[TokenType["UnicodeRange"] = 9] = "UnicodeRange"; TokenType[TokenType["CDO"] = 10] = "CDO"; TokenType[TokenType["CDC"] = 11] = "CDC"; TokenType[TokenType["Colon"] = 12] = "Colon"; TokenType[TokenType["SemiColon"] = 13] = "SemiColon"; TokenType[TokenType["CurlyL"] = 14] = "CurlyL"; TokenType[TokenType["CurlyR"] = 15] = "CurlyR"; TokenType[TokenType["ParenthesisL"] = 16] = "ParenthesisL"; TokenType[TokenType["ParenthesisR"] = 17] = "ParenthesisR"; TokenType[TokenType["BracketL"] = 18] = "BracketL"; TokenType[TokenType["BracketR"] = 19] = "BracketR"; TokenType[TokenType["Whitespace"] = 20] = "Whitespace"; TokenType[TokenType["Includes"] = 21] = "Includes"; TokenType[TokenType["Dashmatch"] = 22] = "Dashmatch"; TokenType[TokenType["SubstringOperator"] = 23] = "SubstringOperator"; TokenType[TokenType["PrefixOperator"] = 24] = "PrefixOperator"; TokenType[TokenType["SuffixOperator"] = 25] = "SuffixOperator"; TokenType[TokenType["Delim"] = 26] = "Delim"; TokenType[TokenType["EMS"] = 27] = "EMS"; TokenType[TokenType["EXS"] = 28] = "EXS"; TokenType[TokenType["Length"] = 29] = "Length"; TokenType[TokenType["Angle"] = 30] = "Angle"; TokenType[TokenType["Time"] = 31] = "Time"; TokenType[TokenType["Freq"] = 32] = "Freq"; TokenType[TokenType["Exclamation"] = 33] = "Exclamation"; TokenType[TokenType["Resolution"] = 34] = "Resolution"; TokenType[TokenType["Comma"] = 35] = "Comma"; TokenType[TokenType["Charset"] = 36] = "Charset"; TokenType[TokenType["EscapedJavaScript"] = 37] = "EscapedJavaScript"; TokenType[TokenType["BadEscapedJavaScript"] = 38] = "BadEscapedJavaScript"; TokenType[TokenType["Comment"] = 39] = "Comment"; TokenType[TokenType["SingleLineComment"] = 40] = "SingleLineComment"; TokenType[TokenType["EOF"] = 41] = "EOF"; TokenType[TokenType["CustomToken"] = 42] = "CustomToken"; })(TokenType || (TokenType = {})); var MultiLineStream = (function () { function MultiLineStream(source) { this.source = source; this.len = source.length; this.position = 0; } MultiLineStream.prototype.substring = function (from, to) { if (to === void 0) { to = this.position; } return this.source.substring(from, to); }; MultiLineStream.prototype.eos = function () { return this.len <= this.position; }; MultiLineStream.prototype.pos = function () { return this.position; }; MultiLineStream.prototype.goBackTo = function (pos) { this.position = pos; }; MultiLineStream.prototype.goBack = function (n) { this.position -= n; }; MultiLineStream.prototype.advance = function (n) { this.position += n; }; MultiLineStream.prototype.nextChar = function () { return this.source.charCodeAt(this.position++) || 0; }; MultiLineStream.prototype.peekChar = function (n) { if (n === void 0) { n = 0; } return this.source.charCodeAt(this.position + n) || 0; }; MultiLineStream.prototype.lookbackChar = function (n) { if (n === void 0) { n = 0; } return this.source.charCodeAt(this.position - n) || 0; }; MultiLineStream.prototype.advanceIfChar = function (ch) { if (ch === this.source.charCodeAt(this.position)) { this.position++; return true; } return false; }; MultiLineStream.prototype.advanceIfChars = function (ch) { if (this.position + ch.length > this.source.length) { return false; } var i = 0; for (; i < ch.length; i++) { if (this.source.charCodeAt(this.position + i) !== ch[i]) { return false; } } this.advance(i); return true; }; MultiLineStream.prototype.advanceWhileChar = function (condition) { var posNow = this.position; while (this.position < this.len && condition(this.source.charCodeAt(this.position))) { this.position++; } return this.position - posNow; }; return MultiLineStream; }()); var _a = 'a'.charCodeAt(0); var _f = 'f'.charCodeAt(0); var _z = 'z'.charCodeAt(0); var _A = 'A'.charCodeAt(0); var _F = 'F'.charCodeAt(0); var _Z = 'Z'.charCodeAt(0); var _0$1 = '0'.charCodeAt(0); var _9$1 = '9'.charCodeAt(0); var _TLD = '~'.charCodeAt(0); var _HAT = '^'.charCodeAt(0); var _EQS$1 = '='.charCodeAt(0); var _PIP = '|'.charCodeAt(0); var _MIN = '-'.charCodeAt(0); var _USC = '_'.charCodeAt(0); var _PRC = '%'.charCodeAt(0); var _MUL = '*'.charCodeAt(0); var _LPA = '('.charCodeAt(0); var _RPA = ')'.charCodeAt(0); var _LAN$1 = '<'.charCodeAt(0); var _RAN$1 = '>'.charCodeAt(0); var _ATS = '@'.charCodeAt(0); var _HSH$1 = '#'.charCodeAt(0); var _DLR$1 = '$'.charCodeAt(0); var _BSL = '\\'.charCodeAt(0); var _FSL$2 = '/'.charCodeAt(0); var _NWL$2 = '\n'.charCodeAt(0); var _CAR$2 = '\r'.charCodeAt(0); var _LFD$2 = '\f'.charCodeAt(0); var _DQO = '"'.charCodeAt(0); var _SQO = '\''.charCodeAt(0); var _WSP = ' '.charCodeAt(0); var _TAB = '\t'.charCodeAt(0); var _SEM = ';'.charCodeAt(0); var _COL = ':'.charCodeAt(0); var _CUL$1 = '{'.charCodeAt(0); var _CUR = '}'.charCodeAt(0); var _BRL = '['.charCodeAt(0); var _BRR = ']'.charCodeAt(0); var _CMA = ','.charCodeAt(0); var _DOT$2 = '.'.charCodeAt(0); var _BNG$1 = '!'.charCodeAt(0); var staticTokenTable = {}; staticTokenTable[_SEM] = TokenType.SemiColon; staticTokenTable[_COL] = TokenType.Colon; staticTokenTable[_CUL$1] = TokenType.CurlyL; staticTokenTable[_CUR] = TokenType.CurlyR; staticTokenTable[_BRR] = TokenType.BracketR; staticTokenTable[_BRL] = TokenType.BracketL; staticTokenTable[_LPA] = TokenType.ParenthesisL; staticTokenTable[_RPA] = TokenType.ParenthesisR; staticTokenTable[_CMA] = TokenType.Comma; var staticUnitTable = {}; staticUnitTable['em'] = TokenType.EMS; staticUnitTable['ex'] = TokenType.EXS; staticUnitTable['px'] = TokenType.Length; staticUnitTable['cm'] = TokenType.Length; staticUnitTable['mm'] = TokenType.Length; staticUnitTable['in'] = TokenType.Length; staticUnitTable['pt'] = TokenType.Length; staticUnitTable['pc'] = TokenType.Length; staticUnitTable['deg'] = TokenType.Angle; staticUnitTable['rad'] = TokenType.Angle; staticUnitTable['grad'] = TokenType.Angle; staticUnitTable['ms'] = TokenType.Time; staticUnitTable['s'] = TokenType.Time; staticUnitTable['hz'] = TokenType.Freq; staticUnitTable['khz'] = TokenType.Freq; staticUnitTable['%'] = TokenType.Percentage; staticUnitTable['fr'] = TokenType.Percentage; staticUnitTable['dpi'] = TokenType.Resolution; staticUnitTable['dpcm'] = TokenType.Resolution; var Scanner = (function () { function Scanner() { this.stream = new MultiLineStream(''); this.ignoreComment = true; this.ignoreWhitespace = true; this.inURL = false; } Scanner.prototype.setSource = function (input) { this.stream = new MultiLineStream(input); }; Scanner.prototype.finishToken = function (offset, type, text) { return { offset: offset, len: this.stream.pos() - offset, type: type, text: text || this.stream.substring(offset) }; }; Scanner.prototype.substring = function (offset, len) { return this.stream.substring(offset, offset + len); }; Scanner.prototype.pos = function () { return this.stream.pos(); }; Scanner.prototype.goBackTo = function (pos) { this.stream.goBackTo(pos); }; Scanner.prototype.scanUnquotedString = function () { var offset = this.stream.pos(); var content = []; if (this._unquotedString(content)) { return this.finishToken(offset, TokenType.UnquotedString, content.join('')); } return null; }; Scanner.prototype.scan = function () { var triviaToken = this.trivia(); if (triviaToken !== null) { return triviaToken; } var offset = this.stream.pos(); if (this.stream.eos()) { return this.finishToken(offset, TokenType.EOF); } return this.scanNext(offset); }; Scanner.prototype.scanNext = function (offset) { if (this.stream.advanceIfChars([_LAN$1, _BNG$1, _MIN, _MIN])) { return this.finishToken(offset, TokenType.CDO); } if (this.stream.advanceIfChars([_MIN, _MIN, _RAN$1])) { return this.finishToken(offset, TokenType.CDC); } var content = []; if (this.ident(content)) { return this.finishToken(offset, TokenType.Ident, content.join('')); } if (this.stream.advanceIfChar(_ATS)) { content = ['@']; if (this._name(content)) { var keywordText = content.join(''); if (keywordText === '@charset') { return this.finishToken(offset, TokenType.Charset, keywordText); } return this.finishToken(offset, TokenType.AtKeyword, keywordText); } else { return this.finishToken(offset, TokenType.Delim); } } if (this.stream.advanceIfChar(_HSH$1)) { content = ['#']; if (this._name(content)) { return this.finishToken(offset, TokenType.Hash, content.join('')); } else { return this.finishToken(offset, TokenType.Delim); } } if (this.stream.advanceIfChar(_BNG$1)) { return this.finishToken(offset, TokenType.Exclamation); } if (this._number()) { var pos = this.stream.pos(); content = [this.stream.substring(offset, pos)]; if (this.stream.advanceIfChar(_PRC)) { return this.finishToken(offset, TokenType.Percentage); } else if (this.ident(content)) { var dim = this.stream.substring(pos).toLowerCase(); var tokenType_1 = staticUnitTable[dim]; if (typeof tokenType_1 !== 'undefined') { return this.finishToken(offset, tokenType_1, content.join('')); } else { return this.finishToken(offset, TokenType.Dimension, content.join('')); } } return this.finishToken(offset, TokenType.Num); } content = []; var tokenType = this._string(content); if (tokenType !== null) { return this.finishToken(offset, tokenType, content.join('')); } tokenType = staticTokenTable[this.stream.peekChar()]; if (typeof tokenType !== 'undefined') { this.stream.advance(1); return this.finishToken(offset, tokenType); } if (this.stream.peekChar(0) === _TLD && this.stream.peekChar(1) === _EQS$1) { this.stream.advance(2); return this.finishToken(offset, TokenType.Includes); } if (this.stream.peekChar(0) === _PIP && this.stream.peekChar(1) === _EQS$1) { this.stream.advance(2); return this.finishToken(offset, TokenType.Dashmatch); } if (this.stream.peekChar(0) === _MUL && this.stream.peekChar(1) === _EQS$1) { this.stream.advance(2); return this.finishToken(offset, TokenType.SubstringOperator); } if (this.stream.peekChar(0) === _HAT && this.stream.peekChar(1) === _EQS$1) { this.stream.advance(2); return this.finishToken(offset, TokenType.PrefixOperator); } if (this.stream.peekChar(0) === _DLR$1 && this.stream.peekChar(1) === _EQS$1) { this.stream.advance(2); return this.finishToken(offset, TokenType.SuffixOperator); } this.stream.nextChar(); return this.finishToken(offset, TokenType.Delim); }; Scanner.prototype.trivia = function () { while (true) { var offset = this.stream.pos(); if (this._whitespace()) { if (!this.ignoreWhitespace) { return this.finishToken(offset, TokenType.Whitespace); } } else if (this.comment()) { if (!this.ignoreComment) { return this.finishToken(offset, TokenType.Comment); } } else { return null; } } }; Scanner.prototype.comment = function () { if (this.stream.advanceIfChars([_FSL$2, _MUL])) { var success_1 = false, hot_1 = false; this.stream.advanceWhileChar(function (ch) { if (hot_1 && ch === _FSL$2) { success_1 = true; return false; } hot_1 = ch === _MUL; return true; }); if (success_1) { this.stream.advance(1); } return true; } return false; }; Scanner.prototype._number = function () { var npeek = 0, ch; if (this.stream.peekChar() === _DOT$2) { npeek = 1; } ch = this.stream.peekChar(npeek); if (ch >= _0$1 && ch <= _9$1) { this.stream.advance(npeek + 1); this.stream.advanceWhileChar(function (ch) { return ch >= _0$1 && ch <= _9$1 || npeek === 0 && ch === _DOT$2; }); return true; } return false; }; Scanner.prototype._newline = function (result) { var ch = this.stream.peekChar(); switch (ch) { case _CAR$2: case _LFD$2: case _NWL$2: this.stream.advance(1); result.push(String.fromCharCode(ch)); if (ch === _CAR$2 && this.stream.advanceIfChar(_NWL$2)) { result.push('\n'); } return true; } return false; }; Scanner.prototype._escape = function (result, includeNewLines) { var ch = this.stream.peekChar(); if (ch === _BSL) { this.stream.advance(1); ch = this.stream.peekChar(); var hexNumCount = 0; while (hexNumCount < 6 && (ch >= _0$1 && ch <= _9$1 || ch >= _a && ch <= _f || ch >= _A && ch <= _F)) { this.stream.advance(1); ch = this.stream.peekChar(); hexNumCount++; } if (hexNumCount > 0) { try { var hexVal = parseInt(this.stream.substring(this.stream.pos() - hexNumCount), 16); if (hexVal) { result.push(String.fromCharCode(hexVal)); } } catch (e) { } if (ch === _WSP || ch === _TAB) { this.stream.advance(1); } else { this._newline([]); } return true; } if (ch !== _CAR$2 && ch !== _LFD$2 && ch !== _NWL$2) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } else if (includeNewLines) { return this._newline(result); } } return false; }; Scanner.prototype._stringChar = function (closeQuote, result) { var ch = this.stream.peekChar(); if (ch !== 0 && ch !== closeQuote && ch !== _BSL && ch !== _CAR$2 && ch !== _LFD$2 && ch !== _NWL$2) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; }; Scanner.prototype._string = function (result) { if (this.stream.peekChar() === _SQO || this.stream.peekChar() === _DQO) { var closeQuote = this.stream.nextChar(); result.push(String.fromCharCode(closeQuote)); while (this._stringChar(closeQuote, result) || this._escape(result, true)) { } if (this.stream.peekChar() === closeQuote) { this.stream.nextChar(); result.push(String.fromCharCode(closeQuote)); return TokenType.String; } else { return TokenType.BadString; } } return null; }; Scanner.prototype._unquotedChar = function (result) { var ch = this.stream.peekChar(); if (ch !== 0 && ch !== _BSL && ch !== _SQO && ch !== _DQO && ch !== _LPA && ch !== _RPA && ch !== _WSP && ch !== _TAB && ch !== _NWL$2 && ch !== _LFD$2 && ch !== _CAR$2) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; }; Scanner.prototype._unquotedString = function (result) { var hasContent = false; while (this._unquotedChar(result) || this._escape(result)) { hasContent = true; } return hasContent; }; Scanner.prototype._whitespace = function () { var n = this.stream.advanceWhileChar(function (ch) { return ch === _WSP || ch === _TAB || ch === _NWL$2 || ch === _LFD$2 || ch === _CAR$2; }); return n > 0; }; Scanner.prototype._name = function (result) { var matched = false; while (this._identChar(result) || this._escape(result)) { matched = true; } return matched; }; Scanner.prototype.ident = function (result) { var pos = this.stream.pos(); var hasMinus = this._minus(result); if (hasMinus) { if (this._minus(result) || this._identFirstChar(result) || this._escape(result)) { while (this._identChar(result) || this._escape(result)) { } return true; } } else if (this._identFirstChar(result) || this._escape(result)) { while (this._identChar(result) || this._escape(result)) { } return true; } this.stream.goBackTo(pos); return false; }; Scanner.prototype._identFirstChar = function (result) { var ch = this.stream.peekChar(); if (ch === _USC || ch >= _a && ch <= _z || ch >= _A && ch <= _Z || ch >= 0x80 && ch <= 0xFFFF) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; }; Scanner.prototype._minus = function (result) { var ch = this.stream.peekChar(); if (ch === _MIN) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; }; Scanner.prototype._identChar = function (result) { var ch = this.stream.peekChar(); if (ch === _USC || ch === _MIN || ch >= _a && ch <= _z || ch >= _A && ch <= _Z || ch >= _0$1 && ch <= _9$1 || ch >= 0x80 && ch <= 0xFFFF) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; }; return Scanner; }()); function startsWith(haystack, needle) { if (haystack.length < needle.length) { return false; } for (var i = 0; i < needle.length; i++) { if (haystack[i] !== needle[i]) { return false; } } return true; } function endsWith(haystack, needle) { var diff = haystack.length - needle.length; if (diff > 0) { return haystack.lastIndexOf(needle) === diff; } else if (diff === 0) { return haystack === needle; } else { return false; } } function difference(first, second, maxLenDelta) { if (maxLenDelta === void 0) { maxLenDelta = 4; } var lengthDifference = Math.abs(first.length - second.length); if (lengthDifference > maxLenDelta) { return 0; } var LCS = []; var zeroArray = []; var i, j; for (i = 0; i < second.length + 1; ++i) { zeroArray.push(0); } for (i = 0; i < first.length + 1; ++i) { LCS.push(zeroArray); } for (i = 1; i < first.length + 1; ++i) { for (j = 1; j < second.length + 1; ++j) { if (first[i - 1] === second[j - 1]) { LCS[i][j] = LCS[i - 1][j - 1] + 1; } else { LCS[i][j] = Math.max(LCS[i - 1][j], LCS[i][j - 1]); } } } return LCS[first.length][second.length] - Math.sqrt(lengthDifference); } function getLimitedString(str, ellipsis) { if (ellipsis === void 0) { ellipsis = true; } if (!str) { return ''; } if (str.length < 140) { return str; } return str.slice(0, 140) + (ellipsis ? '\u2026' : ''); } function trim(str, regexp) { var m = regexp.exec(str); if (m && m[0].length) { return str.substr(0, str.length - m[0].length); } return str; } var __extends$9 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var NodeType; (function (NodeType) { NodeType[NodeType["Undefined"] = 0] = "Undefined"; NodeType[NodeType["Identifier"] = 1] = "Identifier"; NodeType[NodeType["Stylesheet"] = 2] = "Stylesheet"; NodeType[NodeType["Ruleset"] = 3] = "Ruleset"; NodeType[NodeType["Selector"] = 4] = "Selector"; NodeType[NodeType["SimpleSelector"] = 5] = "SimpleSelector"; NodeType[NodeType["SelectorInterpolation"] = 6] = "SelectorInterpolation"; NodeType[NodeType["SelectorCombinator"] = 7] = "SelectorCombinator"; NodeType[NodeType["SelectorCombinatorParent"] = 8] = "SelectorCombinatorParent"; NodeType[NodeType["SelectorCombinatorSibling"] = 9] = "SelectorCombinatorSibling"; NodeType[NodeType["SelectorCombinatorAllSiblings"] = 10] = "SelectorCombinatorAllSiblings"; NodeType[NodeType["SelectorCombinatorShadowPiercingDescendant"] = 11] = "SelectorCombinatorShadowPiercingDescendant"; NodeType[NodeType["Page"] = 12] = "Page"; NodeType[NodeType["PageBoxMarginBox"] = 13] = "PageBoxMarginBox"; NodeType[NodeType["ClassSelector"] = 14] = "ClassSelector"; NodeType[NodeType["IdentifierSelector"] = 15] = "IdentifierSelector"; NodeType[NodeType["ElementNameSelector"] = 16] = "ElementNameSelector"; NodeType[NodeType["PseudoSelector"] = 17] = "PseudoSelector"; NodeType[NodeType["AttributeSelector"] = 18] = "AttributeSelector"; NodeType[NodeType["Declaration"] = 19] = "Declaration"; NodeType[NodeType["Declarations"] = 20] = "Declarations"; NodeType[NodeType["Property"] = 21] = "Property"; NodeType[NodeType["Expression"] = 22] = "Expression"; NodeType[NodeType["BinaryExpression"] = 23] = "BinaryExpression"; NodeType[NodeType["Term"] = 24] = "Term"; NodeType[NodeType["Operator"] = 25] = "Operator"; NodeType[NodeType["Value"] = 26] = "Value"; NodeType[NodeType["StringLiteral"] = 27] = "StringLiteral"; NodeType[NodeType["URILiteral"] = 28] = "URILiteral"; NodeType[NodeType["EscapedValue"] = 29] = "EscapedValue"; NodeType[NodeType["Function"] = 30] = "Function"; NodeType[NodeType["NumericValue"] = 31] = "NumericValue"; NodeType[NodeType["HexColorValue"] = 32] = "HexColorValue"; NodeType[NodeType["RatioValue"] = 33] = "RatioValue"; NodeType[NodeType["MixinDeclaration"] = 34] = "MixinDeclaration"; NodeType[NodeType["MixinReference"] = 35] = "MixinReference"; NodeType[NodeType["VariableName"] = 36] = "VariableName"; NodeType[NodeType["VariableDeclaration"] = 37] = "VariableDeclaration"; NodeType[NodeType["Prio"] = 38] = "Prio"; NodeType[NodeType["Interpolation"] = 39] = "Interpolation"; NodeType[NodeType["NestedProperties"] = 40] = "NestedProperties"; NodeType[NodeType["ExtendsReference"] = 41] = "ExtendsReference"; NodeType[NodeType["SelectorPlaceholder"] = 42] = "SelectorPlaceholder"; NodeType[NodeType["Debug"] = 43] = "Debug"; NodeType[NodeType["If"] = 44] = "If"; NodeType[NodeType["Else"] = 45] = "Else"; NodeType[NodeType["For"] = 46] = "For"; NodeType[NodeType["Each"] = 47] = "Each"; NodeType[NodeType["While"] = 48] = "While"; NodeType[NodeType["MixinContentReference"] = 49] = "MixinContentReference"; NodeType[NodeType["MixinContentDeclaration"] = 50] = "MixinContentDeclaration"; NodeType[NodeType["Media"] = 51] = "Media"; NodeType[NodeType["Keyframe"] = 52] = "Keyframe"; NodeType[NodeType["FontFace"] = 53] = "FontFace"; NodeType[NodeType["Import"] = 54] = "Import"; NodeType[NodeType["Namespace"] = 55] = "Namespace"; NodeType[NodeType["Invocation"] = 56] = "Invocation"; NodeType[NodeType["FunctionDeclaration"] = 57] = "FunctionDeclaration"; NodeType[NodeType["ReturnStatement"] = 58] = "ReturnStatement"; NodeType[NodeType["MediaQuery"] = 59] = "MediaQuery"; NodeType[NodeType["MediaCondition"] = 60] = "MediaCondition"; NodeType[NodeType["MediaFeature"] = 61] = "MediaFeature"; NodeType[NodeType["FunctionParameter"] = 62] = "FunctionParameter"; NodeType[NodeType["FunctionArgument"] = 63] = "FunctionArgument"; NodeType[NodeType["KeyframeSelector"] = 64] = "KeyframeSelector"; NodeType[NodeType["ViewPort"] = 65] = "ViewPort"; NodeType[NodeType["Document"] = 66] = "Document"; NodeType[NodeType["AtApplyRule"] = 67] = "AtApplyRule"; NodeType[NodeType["CustomPropertyDeclaration"] = 68] = "CustomPropertyDeclaration"; NodeType[NodeType["CustomPropertySet"] = 69] = "CustomPropertySet"; NodeType[NodeType["ListEntry"] = 70] = "ListEntry"; NodeType[NodeType["Supports"] = 71] = "Supports"; NodeType[NodeType["SupportsCondition"] = 72] = "SupportsCondition"; NodeType[NodeType["NamespacePrefix"] = 73] = "NamespacePrefix"; NodeType[NodeType["GridLine"] = 74] = "GridLine"; NodeType[NodeType["Plugin"] = 75] = "Plugin"; NodeType[NodeType["UnknownAtRule"] = 76] = "UnknownAtRule"; NodeType[NodeType["Use"] = 77] = "Use"; NodeType[NodeType["ModuleConfiguration"] = 78] = "ModuleConfiguration"; NodeType[NodeType["Forward"] = 79] = "Forward"; NodeType[NodeType["ForwardVisibility"] = 80] = "ForwardVisibility"; NodeType[NodeType["Module"] = 81] = "Module"; })(NodeType || (NodeType = {})); var ReferenceType; (function (ReferenceType) { ReferenceType[ReferenceType["Mixin"] = 0] = "Mixin"; ReferenceType[ReferenceType["Rule"] = 1] = "Rule"; ReferenceType[ReferenceType["Variable"] = 2] = "Variable"; ReferenceType[ReferenceType["Function"] = 3] = "Function"; ReferenceType[ReferenceType["Keyframe"] = 4] = "Keyframe"; ReferenceType[ReferenceType["Unknown"] = 5] = "Unknown"; ReferenceType[ReferenceType["Module"] = 6] = "Module"; ReferenceType[ReferenceType["Forward"] = 7] = "Forward"; ReferenceType[ReferenceType["ForwardVisibility"] = 8] = "ForwardVisibility"; })(ReferenceType || (ReferenceType = {})); function getNodeAtOffset(node, offset) { var candidate = null; if (!node || offset < node.offset || offset > node.end) { return null; } node.accept(function (node) { if (node.offset === -1 && node.length === -1) { return true; } if (node.offset <= offset && node.end >= offset) { if (!candidate) { candidate = node; } else if (node.length <= candidate.length) { candidate = node; } return true; } return false; }); return candidate; } function getNodePath(node, offset) { var candidate = getNodeAtOffset(node, offset); var path = []; while (candidate) { path.unshift(candidate); candidate = candidate.parent; } return path; } function getParentDeclaration(node) { var decl = node.findParent(NodeType.Declaration); var value = decl && decl.getValue(); if (value && value.encloses(node)) { return decl; } return null; } var Node = (function () { function Node(offset, len, nodeType) { if (offset === void 0) { offset = -1; } if (len === void 0) { len = -1; } this.parent = null; this.offset = offset; this.length = len; if (nodeType) { this.nodeType = nodeType; } } Object.defineProperty(Node.prototype, "end", { get: function () { return this.offset + this.length; }, enumerable: false, configurable: true }); Object.defineProperty(Node.prototype, "type", { get: function () { return this.nodeType || NodeType.Undefined; }, set: function (type) { this.nodeType = type; }, enumerable: false, configurable: true }); Node.prototype.getTextProvider = function () { var node = this; while (node && !node.textProvider) { node = node.parent; } if (node) { return node.textProvider; } return function () { return 'unknown'; }; }; Node.prototype.getText = function () { return this.getTextProvider()(this.offset, this.length); }; Node.prototype.matches = function (str) { return this.length === str.length && this.getTextProvider()(this.offset, this.length) === str; }; Node.prototype.startsWith = function (str) { return this.length >= str.length && this.getTextProvider()(this.offset, str.length) === str; }; Node.prototype.endsWith = function (str) { return this.length >= str.length && this.getTextProvider()(this.end - str.length, str.length) === str; }; Node.prototype.accept = function (visitor) { if (visitor(this) && this.children) { for (var _i = 0, _a = this.children; _i < _a.length; _i++) { var child = _a[_i]; child.accept(visitor); } } }; Node.prototype.acceptVisitor = function (visitor) { this.accept(visitor.visitNode.bind(visitor)); }; Node.prototype.adoptChild = function (node, index) { if (index === void 0) { index = -1; } if (node.parent && node.parent.children) { var idx = node.parent.children.indexOf(node); if (idx >= 0) { node.parent.children.splice(idx, 1); } } node.parent = this; var children = this.children; if (!children) { children = this.children = []; } if (index !== -1) { children.splice(index, 0, node); } else { children.push(node); } return node; }; Node.prototype.attachTo = function (parent, index) { if (index === void 0) { index = -1; } if (parent) { parent.adoptChild(this, index); } return this; }; Node.prototype.collectIssues = function (results) { if (this.issues) { results.push.apply(results, this.issues); } }; Node.prototype.addIssue = function (issue) { if (!this.issues) { this.issues = []; } this.issues.push(issue); }; Node.prototype.hasIssue = function (rule) { return Array.isArray(this.issues) && this.issues.some(function (i) { return i.getRule() === rule; }); }; Node.prototype.isErroneous = function (recursive) { if (recursive === void 0) { recursive = false; } if (this.issues && this.issues.length > 0) { return true; } return recursive && Array.isArray(this.children) && this.children.some(function (c) { return c.isErroneous(true); }); }; Node.prototype.setNode = function (field, node, index) { if (index === void 0) { index = -1; } if (node) { node.attachTo(this, index); this[field] = node; return true; } return false; }; Node.prototype.addChild = function (node) { if (node) { if (!this.children) { this.children = []; } node.attachTo(this); this.updateOffsetAndLength(node); return true; } return false; }; Node.prototype.updateOffsetAndLength = function (node) { if (node.offset < this.offset || this.offset === -1) { this.offset = node.offset; } var nodeEnd = node.end; if ((nodeEnd > this.end) || this.length === -1) { this.length = nodeEnd - this.offset; } }; Node.prototype.hasChildren = function () { return !!this.children && this.children.length > 0; }; Node.prototype.getChildren = function () { return this.children ? this.children.slice(0) : []; }; Node.prototype.getChild = function (index) { if (this.children && index < this.children.length) { return this.children[index]; } return null; }; Node.prototype.addChildren = function (nodes) { for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { var node = nodes_1[_i]; this.addChild(node); } }; Node.prototype.findFirstChildBeforeOffset = function (offset) { if (this.children) { var current = null; for (var i = this.children.length - 1; i >= 0; i--) { current = this.children[i]; if (current.offset <= offset) { return current; } } } return null; }; Node.prototype.findChildAtOffset = function (offset, goDeep) { var current = this.findFirstChildBeforeOffset(offset); if (current && current.end >= offset) { if (goDeep) { return current.findChildAtOffset(offset, true) || current; } return current; } return null; }; Node.prototype.encloses = function (candidate) { return this.offset <= candidate.offset && this.offset + this.length >= candidate.offset + candidate.length; }; Node.prototype.getParent = function () { var result = this.parent; while (result instanceof Nodelist) { result = result.parent; } return result; }; Node.prototype.findParent = function (type) { var result = this; while (result && result.type !== type) { result = result.parent; } return result; }; Node.prototype.findAParent = function () { var types = []; for (var _i = 0; _i < arguments.length; _i++) { types[_i] = arguments[_i]; } var result = this; while (result && !types.some(function (t) { return result.type === t; })) { result = result.parent; } return result; }; Node.prototype.setData = function (key, value) { if (!this.options) { this.options = {}; } this.options[key] = value; }; Node.prototype.getData = function (key) { if (!this.options || !this.options.hasOwnProperty(key)) { return null; } return this.options[key]; }; return Node; }()); var Nodelist = (function (_super) { __extends$9(Nodelist, _super); function Nodelist(parent, index) { if (index === void 0) { index = -1; } var _this = _super.call(this, -1, -1) || this; _this.attachTo(parent, index); _this.offset = -1; _this.length = -1; return _this; } return Nodelist; }(Node)); var Identifier = (function (_super) { __extends$9(Identifier, _super); function Identifier(offset, length) { var _this = _super.call(this, offset, length) || this; _this.isCustomProperty = false; return _this; } Object.defineProperty(Identifier.prototype, "type", { get: function () { return NodeType.Identifier; }, enumerable: false, configurable: true }); Identifier.prototype.containsInterpolation = function () { return this.hasChildren(); }; return Identifier; }(Node)); var Stylesheet = (function (_super) { __extends$9(Stylesheet, _super); function Stylesheet(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Stylesheet.prototype, "type", { get: function () { return NodeType.Stylesheet; }, enumerable: false, configurable: true }); return Stylesheet; }(Node)); var Declarations = (function (_super) { __extends$9(Declarations, _super); function Declarations(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Declarations.prototype, "type", { get: function () { return NodeType.Declarations; }, enumerable: false, configurable: true }); return Declarations; }(Node)); var BodyDeclaration = (function (_super) { __extends$9(BodyDeclaration, _super); function BodyDeclaration(offset, length) { return _super.call(this, offset, length) || this; } BodyDeclaration.prototype.getDeclarations = function () { return this.declarations; }; BodyDeclaration.prototype.setDeclarations = function (decls) { return this.setNode('declarations', decls); }; return BodyDeclaration; }(Node)); var RuleSet = (function (_super) { __extends$9(RuleSet, _super); function RuleSet(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(RuleSet.prototype, "type", { get: function () { return NodeType.Ruleset; }, enumerable: false, configurable: true }); RuleSet.prototype.getSelectors = function () { if (!this.selectors) { this.selectors = new Nodelist(this); } return this.selectors; }; RuleSet.prototype.isNested = function () { return !!this.parent && this.parent.findParent(NodeType.Declarations) !== null; }; return RuleSet; }(BodyDeclaration)); var Selector = (function (_super) { __extends$9(Selector, _super); function Selector(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Selector.prototype, "type", { get: function () { return NodeType.Selector; }, enumerable: false, configurable: true }); return Selector; }(Node)); var SimpleSelector = (function (_super) { __extends$9(SimpleSelector, _super); function SimpleSelector(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(SimpleSelector.prototype, "type", { get: function () { return NodeType.SimpleSelector; }, enumerable: false, configurable: true }); return SimpleSelector; }(Node)); ((function (_super) { __extends$9(AtApplyRule, _super); function AtApplyRule(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(AtApplyRule.prototype, "type", { get: function () { return NodeType.AtApplyRule; }, enumerable: false, configurable: true }); AtApplyRule.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; AtApplyRule.prototype.getIdentifier = function () { return this.identifier; }; AtApplyRule.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; return AtApplyRule; })(Node)); var AbstractDeclaration = (function (_super) { __extends$9(AbstractDeclaration, _super); function AbstractDeclaration(offset, length) { return _super.call(this, offset, length) || this; } return AbstractDeclaration; }(Node)); var CustomPropertySet = (function (_super) { __extends$9(CustomPropertySet, _super); function CustomPropertySet(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(CustomPropertySet.prototype, "type", { get: function () { return NodeType.CustomPropertySet; }, enumerable: false, configurable: true }); return CustomPropertySet; }(BodyDeclaration)); var Declaration = (function (_super) { __extends$9(Declaration, _super); function Declaration(offset, length) { var _this = _super.call(this, offset, length) || this; _this.property = null; return _this; } Object.defineProperty(Declaration.prototype, "type", { get: function () { return NodeType.Declaration; }, enumerable: false, configurable: true }); Declaration.prototype.setProperty = function (node) { return this.setNode('property', node); }; Declaration.prototype.getProperty = function () { return this.property; }; Declaration.prototype.getFullPropertyName = function () { var propertyName = this.property ? this.property.getName() : 'unknown'; if (this.parent instanceof Declarations && this.parent.getParent() instanceof NestedProperties) { var parentDecl = this.parent.getParent().getParent(); if (parentDecl instanceof Declaration) { return parentDecl.getFullPropertyName() + propertyName; } } return propertyName; }; Declaration.prototype.getNonPrefixedPropertyName = function () { var propertyName = this.getFullPropertyName(); if (propertyName && propertyName.charAt(0) === '-') { var vendorPrefixEnd = propertyName.indexOf('-', 1); if (vendorPrefixEnd !== -1) { return propertyName.substring(vendorPrefixEnd + 1); } } return propertyName; }; Declaration.prototype.setValue = function (value) { return this.setNode('value', value); }; Declaration.prototype.getValue = function () { return this.value; }; Declaration.prototype.setNestedProperties = function (value) { return this.setNode('nestedProperties', value); }; Declaration.prototype.getNestedProperties = function () { return this.nestedProperties; }; return Declaration; }(AbstractDeclaration)); var CustomPropertyDeclaration = (function (_super) { __extends$9(CustomPropertyDeclaration, _super); function CustomPropertyDeclaration(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(CustomPropertyDeclaration.prototype, "type", { get: function () { return NodeType.CustomPropertyDeclaration; }, enumerable: false, configurable: true }); CustomPropertyDeclaration.prototype.setPropertySet = function (value) { return this.setNode('propertySet', value); }; CustomPropertyDeclaration.prototype.getPropertySet = function () { return this.propertySet; }; return CustomPropertyDeclaration; }(Declaration)); var Property = (function (_super) { __extends$9(Property, _super); function Property(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Property.prototype, "type", { get: function () { return NodeType.Property; }, enumerable: false, configurable: true }); Property.prototype.setIdentifier = function (value) { return this.setNode('identifier', value); }; Property.prototype.getIdentifier = function () { return this.identifier; }; Property.prototype.getName = function () { return trim(this.getText(), /[_\+]+$/); }; Property.prototype.isCustomProperty = function () { return !!this.identifier && this.identifier.isCustomProperty; }; return Property; }(Node)); var Invocation = (function (_super) { __extends$9(Invocation, _super); function Invocation(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Invocation.prototype, "type", { get: function () { return NodeType.Invocation; }, enumerable: false, configurable: true }); Invocation.prototype.getArguments = function () { if (!this.arguments) { this.arguments = new Nodelist(this); } return this.arguments; }; return Invocation; }(Node)); var Function$1 = (function (_super) { __extends$9(Function, _super); function Function(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Function.prototype, "type", { get: function () { return NodeType.Function; }, enumerable: false, configurable: true }); Function.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; Function.prototype.getIdentifier = function () { return this.identifier; }; Function.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; return Function; }(Invocation)); var FunctionParameter = (function (_super) { __extends$9(FunctionParameter, _super); function FunctionParameter(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(FunctionParameter.prototype, "type", { get: function () { return NodeType.FunctionParameter; }, enumerable: false, configurable: true }); FunctionParameter.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; FunctionParameter.prototype.getIdentifier = function () { return this.identifier; }; FunctionParameter.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; FunctionParameter.prototype.setDefaultValue = function (node) { return this.setNode('defaultValue', node, 0); }; FunctionParameter.prototype.getDefaultValue = function () { return this.defaultValue; }; return FunctionParameter; }(Node)); var FunctionArgument = (function (_super) { __extends$9(FunctionArgument, _super); function FunctionArgument(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(FunctionArgument.prototype, "type", { get: function () { return NodeType.FunctionArgument; }, enumerable: false, configurable: true }); FunctionArgument.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; FunctionArgument.prototype.getIdentifier = function () { return this.identifier; }; FunctionArgument.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; FunctionArgument.prototype.setValue = function (node) { return this.setNode('value', node, 0); }; FunctionArgument.prototype.getValue = function () { return this.value; }; return FunctionArgument; }(Node)); var IfStatement = (function (_super) { __extends$9(IfStatement, _super); function IfStatement(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(IfStatement.prototype, "type", { get: function () { return NodeType.If; }, enumerable: false, configurable: true }); IfStatement.prototype.setExpression = function (node) { return this.setNode('expression', node, 0); }; IfStatement.prototype.setElseClause = function (elseClause) { return this.setNode('elseClause', elseClause); }; return IfStatement; }(BodyDeclaration)); var ForStatement = (function (_super) { __extends$9(ForStatement, _super); function ForStatement(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(ForStatement.prototype, "type", { get: function () { return NodeType.For; }, enumerable: false, configurable: true }); ForStatement.prototype.setVariable = function (node) { return this.setNode('variable', node, 0); }; return ForStatement; }(BodyDeclaration)); var EachStatement = (function (_super) { __extends$9(EachStatement, _super); function EachStatement(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(EachStatement.prototype, "type", { get: function () { return NodeType.Each; }, enumerable: false, configurable: true }); EachStatement.prototype.getVariables = function () { if (!this.variables) { this.variables = new Nodelist(this); } return this.variables; }; return EachStatement; }(BodyDeclaration)); var WhileStatement = (function (_super) { __extends$9(WhileStatement, _super); function WhileStatement(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(WhileStatement.prototype, "type", { get: function () { return NodeType.While; }, enumerable: false, configurable: true }); return WhileStatement; }(BodyDeclaration)); var ElseStatement = (function (_super) { __extends$9(ElseStatement, _super); function ElseStatement(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(ElseStatement.prototype, "type", { get: function () { return NodeType.Else; }, enumerable: false, configurable: true }); return ElseStatement; }(BodyDeclaration)); var FunctionDeclaration = (function (_super) { __extends$9(FunctionDeclaration, _super); function FunctionDeclaration(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(FunctionDeclaration.prototype, "type", { get: function () { return NodeType.FunctionDeclaration; }, enumerable: false, configurable: true }); FunctionDeclaration.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; FunctionDeclaration.prototype.getIdentifier = function () { return this.identifier; }; FunctionDeclaration.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; FunctionDeclaration.prototype.getParameters = function () { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; }; return FunctionDeclaration; }(BodyDeclaration)); var ViewPort = (function (_super) { __extends$9(ViewPort, _super); function ViewPort(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(ViewPort.prototype, "type", { get: function () { return NodeType.ViewPort; }, enumerable: false, configurable: true }); return ViewPort; }(BodyDeclaration)); var FontFace = (function (_super) { __extends$9(FontFace, _super); function FontFace(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(FontFace.prototype, "type", { get: function () { return NodeType.FontFace; }, enumerable: false, configurable: true }); return FontFace; }(BodyDeclaration)); var NestedProperties = (function (_super) { __extends$9(NestedProperties, _super); function NestedProperties(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(NestedProperties.prototype, "type", { get: function () { return NodeType.NestedProperties; }, enumerable: false, configurable: true }); return NestedProperties; }(BodyDeclaration)); var Keyframe = (function (_super) { __extends$9(Keyframe, _super); function Keyframe(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Keyframe.prototype, "type", { get: function () { return NodeType.Keyframe; }, enumerable: false, configurable: true }); Keyframe.prototype.setKeyword = function (keyword) { return this.setNode('keyword', keyword, 0); }; Keyframe.prototype.getKeyword = function () { return this.keyword; }; Keyframe.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; Keyframe.prototype.getIdentifier = function () { return this.identifier; }; Keyframe.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; return Keyframe; }(BodyDeclaration)); var KeyframeSelector = (function (_super) { __extends$9(KeyframeSelector, _super); function KeyframeSelector(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(KeyframeSelector.prototype, "type", { get: function () { return NodeType.KeyframeSelector; }, enumerable: false, configurable: true }); return KeyframeSelector; }(BodyDeclaration)); var Import = (function (_super) { __extends$9(Import, _super); function Import(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Import.prototype, "type", { get: function () { return NodeType.Import; }, enumerable: false, configurable: true }); Import.prototype.setMedialist = function (node) { if (node) { node.attachTo(this); return true; } return false; }; return Import; }(Node)); var Use = (function (_super) { __extends$9(Use, _super); function Use() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(Use.prototype, "type", { get: function () { return NodeType.Use; }, enumerable: false, configurable: true }); Use.prototype.getParameters = function () { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; }; Use.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; Use.prototype.getIdentifier = function () { return this.identifier; }; return Use; }(Node)); var ModuleConfiguration = (function (_super) { __extends$9(ModuleConfiguration, _super); function ModuleConfiguration() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(ModuleConfiguration.prototype, "type", { get: function () { return NodeType.ModuleConfiguration; }, enumerable: false, configurable: true }); ModuleConfiguration.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; ModuleConfiguration.prototype.getIdentifier = function () { return this.identifier; }; ModuleConfiguration.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; ModuleConfiguration.prototype.setValue = function (node) { return this.setNode('value', node, 0); }; ModuleConfiguration.prototype.getValue = function () { return this.value; }; return ModuleConfiguration; }(Node)); var Forward = (function (_super) { __extends$9(Forward, _super); function Forward() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(Forward.prototype, "type", { get: function () { return NodeType.Forward; }, enumerable: false, configurable: true }); Forward.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; Forward.prototype.getIdentifier = function () { return this.identifier; }; Forward.prototype.getMembers = function () { if (!this.members) { this.members = new Nodelist(this); } return this.members; }; Forward.prototype.getParameters = function () { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; }; return Forward; }(Node)); var ForwardVisibility = (function (_super) { __extends$9(ForwardVisibility, _super); function ForwardVisibility() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(ForwardVisibility.prototype, "type", { get: function () { return NodeType.ForwardVisibility; }, enumerable: false, configurable: true }); ForwardVisibility.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; ForwardVisibility.prototype.getIdentifier = function () { return this.identifier; }; return ForwardVisibility; }(Node)); var Namespace = (function (_super) { __extends$9(Namespace, _super); function Namespace(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Namespace.prototype, "type", { get: function () { return NodeType.Namespace; }, enumerable: false, configurable: true }); return Namespace; }(Node)); var Media = (function (_super) { __extends$9(Media, _super); function Media(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Media.prototype, "type", { get: function () { return NodeType.Media; }, enumerable: false, configurable: true }); return Media; }(BodyDeclaration)); var Supports = (function (_super) { __extends$9(Supports, _super); function Supports(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Supports.prototype, "type", { get: function () { return NodeType.Supports; }, enumerable: false, configurable: true }); return Supports; }(BodyDeclaration)); var Document = (function (_super) { __extends$9(Document, _super); function Document(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Document.prototype, "type", { get: function () { return NodeType.Document; }, enumerable: false, configurable: true }); return Document; }(BodyDeclaration)); var Medialist = (function (_super) { __extends$9(Medialist, _super); function Medialist(offset, length) { return _super.call(this, offset, length) || this; } Medialist.prototype.getMediums = function () { if (!this.mediums) { this.mediums = new Nodelist(this); } return this.mediums; }; return Medialist; }(Node)); var MediaQuery = (function (_super) { __extends$9(MediaQuery, _super); function MediaQuery(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MediaQuery.prototype, "type", { get: function () { return NodeType.MediaQuery; }, enumerable: false, configurable: true }); return MediaQuery; }(Node)); var MediaCondition = (function (_super) { __extends$9(MediaCondition, _super); function MediaCondition(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MediaCondition.prototype, "type", { get: function () { return NodeType.MediaCondition; }, enumerable: false, configurable: true }); return MediaCondition; }(Node)); var MediaFeature = (function (_super) { __extends$9(MediaFeature, _super); function MediaFeature(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MediaFeature.prototype, "type", { get: function () { return NodeType.MediaFeature; }, enumerable: false, configurable: true }); return MediaFeature; }(Node)); var SupportsCondition = (function (_super) { __extends$9(SupportsCondition, _super); function SupportsCondition(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(SupportsCondition.prototype, "type", { get: function () { return NodeType.SupportsCondition; }, enumerable: false, configurable: true }); return SupportsCondition; }(Node)); var Page = (function (_super) { __extends$9(Page, _super); function Page(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Page.prototype, "type", { get: function () { return NodeType.Page; }, enumerable: false, configurable: true }); return Page; }(BodyDeclaration)); var PageBoxMarginBox = (function (_super) { __extends$9(PageBoxMarginBox, _super); function PageBoxMarginBox(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(PageBoxMarginBox.prototype, "type", { get: function () { return NodeType.PageBoxMarginBox; }, enumerable: false, configurable: true }); return PageBoxMarginBox; }(BodyDeclaration)); var Expression = (function (_super) { __extends$9(Expression, _super); function Expression(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Expression.prototype, "type", { get: function () { return NodeType.Expression; }, enumerable: false, configurable: true }); return Expression; }(Node)); var BinaryExpression = (function (_super) { __extends$9(BinaryExpression, _super); function BinaryExpression(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(BinaryExpression.prototype, "type", { get: function () { return NodeType.BinaryExpression; }, enumerable: false, configurable: true }); BinaryExpression.prototype.setLeft = function (left) { return this.setNode('left', left); }; BinaryExpression.prototype.getLeft = function () { return this.left; }; BinaryExpression.prototype.setRight = function (right) { return this.setNode('right', right); }; BinaryExpression.prototype.getRight = function () { return this.right; }; BinaryExpression.prototype.setOperator = function (value) { return this.setNode('operator', value); }; BinaryExpression.prototype.getOperator = function () { return this.operator; }; return BinaryExpression; }(Node)); var Term = (function (_super) { __extends$9(Term, _super); function Term(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Term.prototype, "type", { get: function () { return NodeType.Term; }, enumerable: false, configurable: true }); Term.prototype.setOperator = function (value) { return this.setNode('operator', value); }; Term.prototype.getOperator = function () { return this.operator; }; Term.prototype.setExpression = function (value) { return this.setNode('expression', value); }; Term.prototype.getExpression = function () { return this.expression; }; return Term; }(Node)); var AttributeSelector = (function (_super) { __extends$9(AttributeSelector, _super); function AttributeSelector(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(AttributeSelector.prototype, "type", { get: function () { return NodeType.AttributeSelector; }, enumerable: false, configurable: true }); AttributeSelector.prototype.setNamespacePrefix = function (value) { return this.setNode('namespacePrefix', value); }; AttributeSelector.prototype.getNamespacePrefix = function () { return this.namespacePrefix; }; AttributeSelector.prototype.setIdentifier = function (value) { return this.setNode('identifier', value); }; AttributeSelector.prototype.getIdentifier = function () { return this.identifier; }; AttributeSelector.prototype.setOperator = function (operator) { return this.setNode('operator', operator); }; AttributeSelector.prototype.getOperator = function () { return this.operator; }; AttributeSelector.prototype.setValue = function (value) { return this.setNode('value', value); }; AttributeSelector.prototype.getValue = function () { return this.value; }; return AttributeSelector; }(Node)); ((function (_super) { __extends$9(Operator, _super); function Operator(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Operator.prototype, "type", { get: function () { return NodeType.Operator; }, enumerable: false, configurable: true }); return Operator; })(Node)); var HexColorValue = (function (_super) { __extends$9(HexColorValue, _super); function HexColorValue(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(HexColorValue.prototype, "type", { get: function () { return NodeType.HexColorValue; }, enumerable: false, configurable: true }); return HexColorValue; }(Node)); var RatioValue = (function (_super) { __extends$9(RatioValue, _super); function RatioValue(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(RatioValue.prototype, "type", { get: function () { return NodeType.RatioValue; }, enumerable: false, configurable: true }); return RatioValue; }(Node)); var _dot = '.'.charCodeAt(0), _0 = '0'.charCodeAt(0), _9 = '9'.charCodeAt(0); var NumericValue = (function (_super) { __extends$9(NumericValue, _super); function NumericValue(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(NumericValue.prototype, "type", { get: function () { return NodeType.NumericValue; }, enumerable: false, configurable: true }); NumericValue.prototype.getValue = function () { var raw = this.getText(); var unitIdx = 0; var code; for (var i = 0, len = raw.length; i < len; i++) { code = raw.charCodeAt(i); if (!(_0 <= code && code <= _9 || code === _dot)) { break; } unitIdx += 1; } return { value: raw.substring(0, unitIdx), unit: unitIdx < raw.length ? raw.substring(unitIdx) : undefined }; }; return NumericValue; }(Node)); var VariableDeclaration = (function (_super) { __extends$9(VariableDeclaration, _super); function VariableDeclaration(offset, length) { var _this = _super.call(this, offset, length) || this; _this.variable = null; _this.value = null; _this.needsSemicolon = true; return _this; } Object.defineProperty(VariableDeclaration.prototype, "type", { get: function () { return NodeType.VariableDeclaration; }, enumerable: false, configurable: true }); VariableDeclaration.prototype.setVariable = function (node) { if (node) { node.attachTo(this); this.variable = node; return true; } return false; }; VariableDeclaration.prototype.getVariable = function () { return this.variable; }; VariableDeclaration.prototype.getName = function () { return this.variable ? this.variable.getName() : ''; }; VariableDeclaration.prototype.setValue = function (node) { if (node) { node.attachTo(this); this.value = node; return true; } return false; }; VariableDeclaration.prototype.getValue = function () { return this.value; }; return VariableDeclaration; }(AbstractDeclaration)); var Interpolation = (function (_super) { __extends$9(Interpolation, _super); function Interpolation(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Interpolation.prototype, "type", { get: function () { return NodeType.Interpolation; }, enumerable: false, configurable: true }); return Interpolation; }(Node)); var Variable = (function (_super) { __extends$9(Variable, _super); function Variable(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Variable.prototype, "type", { get: function () { return NodeType.VariableName; }, enumerable: false, configurable: true }); Variable.prototype.getName = function () { return this.getText(); }; return Variable; }(Node)); var ExtendsReference = (function (_super) { __extends$9(ExtendsReference, _super); function ExtendsReference(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(ExtendsReference.prototype, "type", { get: function () { return NodeType.ExtendsReference; }, enumerable: false, configurable: true }); ExtendsReference.prototype.getSelectors = function () { if (!this.selectors) { this.selectors = new Nodelist(this); } return this.selectors; }; return ExtendsReference; }(Node)); var MixinContentReference = (function (_super) { __extends$9(MixinContentReference, _super); function MixinContentReference(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MixinContentReference.prototype, "type", { get: function () { return NodeType.MixinContentReference; }, enumerable: false, configurable: true }); MixinContentReference.prototype.getArguments = function () { if (!this.arguments) { this.arguments = new Nodelist(this); } return this.arguments; }; return MixinContentReference; }(Node)); var MixinContentDeclaration = (function (_super) { __extends$9(MixinContentDeclaration, _super); function MixinContentDeclaration(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MixinContentDeclaration.prototype, "type", { get: function () { return NodeType.MixinContentReference; }, enumerable: false, configurable: true }); MixinContentDeclaration.prototype.getParameters = function () { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; }; return MixinContentDeclaration; }(BodyDeclaration)); var MixinReference = (function (_super) { __extends$9(MixinReference, _super); function MixinReference(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MixinReference.prototype, "type", { get: function () { return NodeType.MixinReference; }, enumerable: false, configurable: true }); MixinReference.prototype.getNamespaces = function () { if (!this.namespaces) { this.namespaces = new Nodelist(this); } return this.namespaces; }; MixinReference.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; MixinReference.prototype.getIdentifier = function () { return this.identifier; }; MixinReference.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; MixinReference.prototype.getArguments = function () { if (!this.arguments) { this.arguments = new Nodelist(this); } return this.arguments; }; MixinReference.prototype.setContent = function (node) { return this.setNode('content', node); }; MixinReference.prototype.getContent = function () { return this.content; }; return MixinReference; }(Node)); var MixinDeclaration = (function (_super) { __extends$9(MixinDeclaration, _super); function MixinDeclaration(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MixinDeclaration.prototype, "type", { get: function () { return NodeType.MixinDeclaration; }, enumerable: false, configurable: true }); MixinDeclaration.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; MixinDeclaration.prototype.getIdentifier = function () { return this.identifier; }; MixinDeclaration.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; MixinDeclaration.prototype.getParameters = function () { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; }; MixinDeclaration.prototype.setGuard = function (node) { if (node) { node.attachTo(this); this.guard = node; } return false; }; return MixinDeclaration; }(BodyDeclaration)); var UnknownAtRule = (function (_super) { __extends$9(UnknownAtRule, _super); function UnknownAtRule(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(UnknownAtRule.prototype, "type", { get: function () { return NodeType.UnknownAtRule; }, enumerable: false, configurable: true }); UnknownAtRule.prototype.setAtRuleName = function (atRuleName) { this.atRuleName = atRuleName; }; UnknownAtRule.prototype.getAtRuleName = function () { return this.atRuleName; }; return UnknownAtRule; }(BodyDeclaration)); var ListEntry = (function (_super) { __extends$9(ListEntry, _super); function ListEntry() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(ListEntry.prototype, "type", { get: function () { return NodeType.ListEntry; }, enumerable: false, configurable: true }); ListEntry.prototype.setKey = function (node) { return this.setNode('key', node, 0); }; ListEntry.prototype.setValue = function (node) { return this.setNode('value', node, 1); }; return ListEntry; }(Node)); var LessGuard = (function (_super) { __extends$9(LessGuard, _super); function LessGuard() { return _super !== null && _super.apply(this, arguments) || this; } LessGuard.prototype.getConditions = function () { if (!this.conditions) { this.conditions = new Nodelist(this); } return this.conditions; }; return LessGuard; }(Node)); var GuardCondition = (function (_super) { __extends$9(GuardCondition, _super); function GuardCondition() { return _super !== null && _super.apply(this, arguments) || this; } GuardCondition.prototype.setVariable = function (node) { return this.setNode('variable', node); }; return GuardCondition; }(Node)); var Module = (function (_super) { __extends$9(Module, _super); function Module() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(Module.prototype, "type", { get: function () { return NodeType.Module; }, enumerable: false, configurable: true }); Module.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; Module.prototype.getIdentifier = function () { return this.identifier; }; return Module; }(Node)); var Level; (function (Level) { Level[Level["Ignore"] = 1] = "Ignore"; Level[Level["Warning"] = 2] = "Warning"; Level[Level["Error"] = 4] = "Error"; })(Level || (Level = {})); var Marker = (function () { function Marker(node, rule, level, message, offset, length) { if (offset === void 0) { offset = node.offset; } if (length === void 0) { length = node.length; } this.node = node; this.rule = rule; this.level = level; this.message = message || rule.message; this.offset = offset; this.length = length; } Marker.prototype.getRule = function () { return this.rule; }; Marker.prototype.getLevel = function () { return this.level; }; Marker.prototype.getOffset = function () { return this.offset; }; Marker.prototype.getLength = function () { return this.length; }; Marker.prototype.getNode = function () { return this.node; }; Marker.prototype.getMessage = function () { return this.message; }; return Marker; }()); var ParseErrorCollector = (function () { function ParseErrorCollector() { this.entries = []; } ParseErrorCollector.entries = function (node) { var visitor = new ParseErrorCollector(); node.acceptVisitor(visitor); return visitor.entries; }; ParseErrorCollector.prototype.visitNode = function (node) { if (node.isErroneous()) { node.collectIssues(this.entries); } return true; }; return ParseErrorCollector; }()); var localize$a = main$3.loadMessageBundle(); var CSSIssueType = (function () { function CSSIssueType(id, message) { this.id = id; this.message = message; } return CSSIssueType; }()); var ParseError = { NumberExpected: new CSSIssueType('css-numberexpected', localize$a('expected.number', "number expected")), ConditionExpected: new CSSIssueType('css-conditionexpected', localize$a('expected.condt', "condition expected")), RuleOrSelectorExpected: new CSSIssueType('css-ruleorselectorexpected', localize$a('expected.ruleorselector', "at-rule or selector expected")), DotExpected: new CSSIssueType('css-dotexpected', localize$a('expected.dot', "dot expected")), ColonExpected: new CSSIssueType('css-colonexpected', localize$a('expected.colon', "colon expected")), SemiColonExpected: new CSSIssueType('css-semicolonexpected', localize$a('expected.semicolon', "semi-colon expected")), TermExpected: new CSSIssueType('css-termexpected', localize$a('expected.term', "term expected")), ExpressionExpected: new CSSIssueType('css-expressionexpected', localize$a('expected.expression', "expression expected")), OperatorExpected: new CSSIssueType('css-operatorexpected', localize$a('expected.operator', "operator expected")), IdentifierExpected: new CSSIssueType('css-identifierexpected', localize$a('expected.ident', "identifier expected")), PercentageExpected: new CSSIssueType('css-percentageexpected', localize$a('expected.percentage', "percentage expected")), URIOrStringExpected: new CSSIssueType('css-uriorstringexpected', localize$a('expected.uriorstring', "uri or string expected")), URIExpected: new CSSIssueType('css-uriexpected', localize$a('expected.uri', "URI expected")), VariableNameExpected: new CSSIssueType('css-varnameexpected', localize$a('expected.varname', "variable name expected")), VariableValueExpected: new CSSIssueType('css-varvalueexpected', localize$a('expected.varvalue', "variable value expected")), PropertyValueExpected: new CSSIssueType('css-propertyvalueexpected', localize$a('expected.propvalue', "property value expected")), LeftCurlyExpected: new CSSIssueType('css-lcurlyexpected', localize$a('expected.lcurly', "{ expected")), RightCurlyExpected: new CSSIssueType('css-rcurlyexpected', localize$a('expected.rcurly', "} expected")), LeftSquareBracketExpected: new CSSIssueType('css-rbracketexpected', localize$a('expected.lsquare', "[ expected")), RightSquareBracketExpected: new CSSIssueType('css-lbracketexpected', localize$a('expected.rsquare', "] expected")), LeftParenthesisExpected: new CSSIssueType('css-lparentexpected', localize$a('expected.lparen', "( expected")), RightParenthesisExpected: new CSSIssueType('css-rparentexpected', localize$a('expected.rparent', ") expected")), CommaExpected: new CSSIssueType('css-commaexpected', localize$a('expected.comma', "comma expected")), PageDirectiveOrDeclarationExpected: new CSSIssueType('css-pagedirordeclexpected', localize$a('expected.pagedirordecl', "page directive or declaraton expected")), UnknownAtRule: new CSSIssueType('css-unknownatrule', localize$a('unknown.atrule', "at-rule unknown")), UnknownKeyword: new CSSIssueType('css-unknownkeyword', localize$a('unknown.keyword', "unknown keyword")), SelectorExpected: new CSSIssueType('css-selectorexpected', localize$a('expected.selector', "selector expected")), StringLiteralExpected: new CSSIssueType('css-stringliteralexpected', localize$a('expected.stringliteral', "string literal expected")), WhitespaceExpected: new CSSIssueType('css-whitespaceexpected', localize$a('expected.whitespace', "whitespace expected")), MediaQueryExpected: new CSSIssueType('css-mediaqueryexpected', localize$a('expected.mediaquery', "media query expected")), IdentifierOrWildcardExpected: new CSSIssueType('css-idorwildcardexpected', localize$a('expected.idorwildcard', "identifier or wildcard expected")), WildcardExpected: new CSSIssueType('css-wildcardexpected', localize$a('expected.wildcard', "wildcard expected")), IdentifierOrVariableExpected: new CSSIssueType('css-idorvarexpected', localize$a('expected.idorvar', "identifier or variable expected")), }; var ClientCapabilities; (function (ClientCapabilities) { ClientCapabilities.LATEST = { textDocument: { completion: { completionItem: { documentationFormat: [MarkupKind.Markdown, MarkupKind.PlainText] } }, hover: { contentFormat: [MarkupKind.Markdown, MarkupKind.PlainText] } } }; })(ClientCapabilities || (ClientCapabilities = {})); var FileType; (function (FileType) { FileType[FileType["Unknown"] = 0] = "Unknown"; FileType[FileType["File"] = 1] = "File"; FileType[FileType["Directory"] = 2] = "Directory"; FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink"; })(FileType || (FileType = {})); var browserNames = { E: 'Edge', FF: 'Firefox', S: 'Safari', C: 'Chrome', IE: 'IE', O: 'Opera' }; function getEntryStatus(status) { switch (status) { case 'experimental': return '⚠️ Property is experimental. Be cautious when using it.️\n\n'; case 'nonstandard': return '🚨️ Property is nonstandard. Avoid using it.\n\n'; case 'obsolete': return '🚨️️️ Property is obsolete. Avoid using it.\n\n'; default: return ''; } } function getEntryDescription(entry, doesSupportMarkdown, settings) { var result; if (doesSupportMarkdown) { result = { kind: 'markdown', value: getEntryMarkdownDescription(entry, settings) }; } else { result = { kind: 'plaintext', value: getEntryStringDescription(entry, settings) }; } if (result.value === '') { return undefined; } return result; } function textToMarkedString(text) { text = text.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); return text.replace(/</g, '<').replace(/>/g, '>'); } function getEntryStringDescription(entry, settings) { if (!entry.description || entry.description === '') { return ''; } if (typeof entry.description !== 'string') { return entry.description.value; } var result = ''; if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) { if (entry.status) { result += getEntryStatus(entry.status); } result += entry.description; var browserLabel = getBrowserLabel(entry.browsers); if (browserLabel) { result += '\n(' + browserLabel + ')'; } if ('syntax' in entry) { result += "\n\nSyntax: ".concat(entry.syntax); } } if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) { if (result.length > 0) { result += '\n\n'; } result += entry.references.map(function (r) { return "".concat(r.name, ": ").concat(r.url); }).join(' | '); } return result; } function getEntryMarkdownDescription(entry, settings) { if (!entry.description || entry.description === '') { return ''; } var result = ''; if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) { if (entry.status) { result += getEntryStatus(entry.status); } if (typeof entry.description === 'string') { result += textToMarkedString(entry.description); } else { result += entry.description.kind === MarkupKind.Markdown ? entry.description.value : textToMarkedString(entry.description.value); } var browserLabel = getBrowserLabel(entry.browsers); if (browserLabel) { result += '\n\n(' + textToMarkedString(browserLabel) + ')'; } if ('syntax' in entry && entry.syntax) { result += "\n\nSyntax: ".concat(textToMarkedString(entry.syntax)); } } if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) { if (result.length > 0) { result += '\n\n'; } result += entry.references.map(function (r) { return "[".concat(r.name, "](").concat(r.url, ")"); }).join(' | '); } return result; } function getBrowserLabel(browsers) { if (browsers === void 0) { browsers = []; } if (browsers.length === 0) { return null; } return browsers .map(function (b) { var result = ''; var matches = b.match(/([A-Z]+)(\d+)?/); var name = matches[1]; var version = matches[2]; if (name in browserNames) { result += browserNames[name]; } if (version) { result += ' ' + version; } return result; }) .join(', '); } var localize$9 = main$3.loadMessageBundle(); var colorFunctions = [ { func: 'rgb($red, $green, $blue)', desc: localize$9('css.builtin.rgb', 'Creates a Color from red, green, and blue values.') }, { func: 'rgba($red, $green, $blue, $alpha)', desc: localize$9('css.builtin.rgba', 'Creates a Color from red, green, blue, and alpha values.') }, { func: 'hsl($hue, $saturation, $lightness)', desc: localize$9('css.builtin.hsl', 'Creates a Color from hue, saturation, and lightness values.') }, { func: 'hsla($hue, $saturation, $lightness, $alpha)', desc: localize$9('css.builtin.hsla', 'Creates a Color from hue, saturation, lightness, and alpha values.') }, { func: 'hwb($hue $white $black)', desc: localize$9('css.builtin.hwb', 'Creates a Color from hue, white and black.') } ]; var colors = { aliceblue: '#f0f8ff', antiquewhite: '#faebd7', aqua: '#00ffff', aquamarine: '#7fffd4', azure: '#f0ffff', beige: '#f5f5dc', bisque: '#ffe4c4', black: '#000000', blanchedalmond: '#ffebcd', blue: '#0000ff', blueviolet: '#8a2be2', brown: '#a52a2a', burlywood: '#deb887', cadetblue: '#5f9ea0', chartreuse: '#7fff00', chocolate: '#d2691e', coral: '#ff7f50', cornflowerblue: '#6495ed', cornsilk: '#fff8dc', crimson: '#dc143c', cyan: '#00ffff', darkblue: '#00008b', darkcyan: '#008b8b', darkgoldenrod: '#b8860b', darkgray: '#a9a9a9', darkgrey: '#a9a9a9', darkgreen: '#006400', darkkhaki: '#bdb76b', darkmagenta: '#8b008b', darkolivegreen: '#556b2f', darkorange: '#ff8c00', darkorchid: '#9932cc', darkred: '#8b0000', darksalmon: '#e9967a', darkseagreen: '#8fbc8f', darkslateblue: '#483d8b', darkslategray: '#2f4f4f', darkslategrey: '#2f4f4f', darkturquoise: '#00ced1', darkviolet: '#9400d3', deeppink: '#ff1493', deepskyblue: '#00bfff', dimgray: '#696969', dimgrey: '#696969', dodgerblue: '#1e90ff', firebrick: '#b22222', floralwhite: '#fffaf0', forestgreen: '#228b22', fuchsia: '#ff00ff', gainsboro: '#dcdcdc', ghostwhite: '#f8f8ff', gold: '#ffd700', goldenrod: '#daa520', gray: '#808080', grey: '#808080', green: '#008000', greenyellow: '#adff2f', honeydew: '#f0fff0', hotpink: '#ff69b4', indianred: '#cd5c5c', indigo: '#4b0082', ivory: '#fffff0', khaki: '#f0e68c', lavender: '#e6e6fa', lavenderblush: '#fff0f5', lawngreen: '#7cfc00', lemonchiffon: '#fffacd', lightblue: '#add8e6', lightcoral: '#f08080', lightcyan: '#e0ffff', lightgoldenrodyellow: '#fafad2', lightgray: '#d3d3d3', lightgrey: '#d3d3d3', lightgreen: '#90ee90', lightpink: '#ffb6c1', lightsalmon: '#ffa07a', lightseagreen: '#20b2aa', lightskyblue: '#87cefa', lightslategray: '#778899', lightslategrey: '#778899', lightsteelblue: '#b0c4de', lightyellow: '#ffffe0', lime: '#00ff00', limegreen: '#32cd32', linen: '#faf0e6', magenta: '#ff00ff', maroon: '#800000', mediumaquamarine: '#66cdaa', mediumblue: '#0000cd', mediumorchid: '#ba55d3', mediumpurple: '#9370d8', mediumseagreen: '#3cb371', mediumslateblue: '#7b68ee', mediumspringgreen: '#00fa9a', mediumturquoise: '#48d1cc', mediumvioletred: '#c71585', midnightblue: '#191970', mintcream: '#f5fffa', mistyrose: '#ffe4e1', moccasin: '#ffe4b5', navajowhite: '#ffdead', navy: '#000080', oldlace: '#fdf5e6', olive: '#808000', olivedrab: '#6b8e23', orange: '#ffa500', orangered: '#ff4500', orchid: '#da70d6', palegoldenrod: '#eee8aa', palegreen: '#98fb98', paleturquoise: '#afeeee', palevioletred: '#d87093', papayawhip: '#ffefd5', peachpuff: '#ffdab9', peru: '#cd853f', pink: '#ffc0cb', plum: '#dda0dd', powderblue: '#b0e0e6', purple: '#800080', red: '#ff0000', rebeccapurple: '#663399', rosybrown: '#bc8f8f', royalblue: '#4169e1', saddlebrown: '#8b4513', salmon: '#fa8072', sandybrown: '#f4a460', seagreen: '#2e8b57', seashell: '#fff5ee', sienna: '#a0522d', silver: '#c0c0c0', skyblue: '#87ceeb', slateblue: '#6a5acd', slategray: '#708090', slategrey: '#708090', snow: '#fffafa', springgreen: '#00ff7f', steelblue: '#4682b4', tan: '#d2b48c', teal: '#008080', thistle: '#d8bfd8', tomato: '#ff6347', turquoise: '#40e0d0', violet: '#ee82ee', wheat: '#f5deb3', white: '#ffffff', whitesmoke: '#f5f5f5', yellow: '#ffff00', yellowgreen: '#9acd32' }; var colorKeywords = { 'currentColor': 'The value of the \'color\' property. The computed value of the \'currentColor\' keyword is the computed value of the \'color\' property. If the \'currentColor\' keyword is set on the \'color\' property itself, it is treated as \'color:inherit\' at parse time.', 'transparent': 'Fully transparent. This keyword can be considered a shorthand for rgba(0,0,0,0) which is its computed value.', }; function getNumericValue(node, factor) { var val = node.getText(); var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(%?)$/); if (m) { if (m[2]) { factor = 100.0; } var result = parseFloat(m[1]) / factor; if (result >= 0 && result <= 1) { return result; } } throw new Error(); } function getAngle(node) { var val = node.getText(); var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(deg|rad|grad|turn)?$/); if (m) { switch (m[2]) { case 'deg': return parseFloat(val) % 360; case 'rad': return (parseFloat(val) * 180 / Math.PI) % 360; case 'grad': return (parseFloat(val) * 0.9) % 360; case 'turn': return (parseFloat(val) * 360) % 360; default: if ('undefined' === typeof m[2]) { return parseFloat(val) % 360; } } } throw new Error(); } function isColorConstructor(node) { var name = node.getName(); if (!name) { return false; } return /^(rgb|rgba|hsl|hsla|hwb)$/gi.test(name); } var Digit0 = 48; var Digit9 = 57; var A = 65; var a = 97; var f = 102; function hexDigit(charCode) { if (charCode < Digit0) { return 0; } if (charCode <= Digit9) { return charCode - Digit0; } if (charCode < a) { charCode += (a - A); } if (charCode >= a && charCode <= f) { return charCode - a + 10; } return 0; } function colorFromHex(text) { if (text[0] !== '#') { return null; } switch (text.length) { case 4: return { red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0, green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0, blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0, alpha: 1 }; case 5: return { red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0, green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0, blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0, alpha: (hexDigit(text.charCodeAt(4)) * 0x11) / 255.0, }; case 7: return { red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0, green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0, blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0, alpha: 1 }; case 9: return { red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0, green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0, blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0, alpha: (hexDigit(text.charCodeAt(7)) * 0x10 + hexDigit(text.charCodeAt(8))) / 255.0 }; } return null; } function colorFromHSL(hue, sat, light, alpha) { if (alpha === void 0) { alpha = 1.0; } hue = hue / 60.0; if (sat === 0) { return { red: light, green: light, blue: light, alpha: alpha }; } else { var hueToRgb = function (t1, t2, hue) { while (hue < 0) { hue += 6; } while (hue >= 6) { hue -= 6; } if (hue < 1) { return (t2 - t1) * hue + t1; } if (hue < 3) { return t2; } if (hue < 4) { return (t2 - t1) * (4 - hue) + t1; } return t1; }; var t2 = light <= 0.5 ? (light * (sat + 1)) : (light + sat - (light * sat)); var t1 = light * 2 - t2; return { red: hueToRgb(t1, t2, hue + 2), green: hueToRgb(t1, t2, hue), blue: hueToRgb(t1, t2, hue - 2), alpha: alpha }; } } function hslFromColor(rgba) { var r = rgba.red; var g = rgba.green; var b = rgba.blue; var a = rgba.alpha; var max = Math.max(r, g, b); var min = Math.min(r, g, b); var h = 0; var s = 0; var l = (min + max) / 2; var chroma = max - min; if (chroma > 0) { s = Math.min((l <= 0.5 ? chroma / (2 * l) : chroma / (2 - (2 * l))), 1); switch (max) { case r: h = (g - b) / chroma + (g < b ? 6 : 0); break; case g: h = (b - r) / chroma + 2; break; case b: h = (r - g) / chroma + 4; break; } h *= 60; h = Math.round(h); } return { h: h, s: s, l: l, a: a }; } function colorFromHWB(hue, white, black, alpha) { if (alpha === void 0) { alpha = 1.0; } if (white + black >= 1) { var gray = white / (white + black); return { red: gray, green: gray, blue: gray, alpha: alpha }; } var rgb = colorFromHSL(hue, 1, 0.5, alpha); var red = rgb.red; red *= (1 - white - black); red += white; var green = rgb.green; green *= (1 - white - black); green += white; var blue = rgb.blue; blue *= (1 - white - black); blue += white; return { red: red, green: green, blue: blue, alpha: alpha }; } function hwbFromColor(rgba) { var hsl = hslFromColor(rgba); var white = Math.min(rgba.red, rgba.green, rgba.blue); var black = 1 - Math.max(rgba.red, rgba.green, rgba.blue); return { h: hsl.h, w: white, b: black, a: hsl.a }; } function getColorValue(node) { if (node.type === NodeType.HexColorValue) { var text = node.getText(); return colorFromHex(text); } else if (node.type === NodeType.Function) { var functionNode = node; var name = functionNode.getName(); var colorValues = functionNode.getArguments().getChildren(); if (colorValues.length === 1) { var functionArg = colorValues[0].getChildren(); if (functionArg.length === 1 && functionArg[0].type === NodeType.Expression) { colorValues = functionArg[0].getChildren(); if (colorValues.length === 3) { var lastValue = colorValues[2]; if (lastValue instanceof BinaryExpression) { var left = lastValue.getLeft(), right = lastValue.getRight(), operator = lastValue.getOperator(); if (left && right && operator && operator.matches('/')) { colorValues = [colorValues[0], colorValues[1], left, right]; } } } } } if (!name || colorValues.length < 3 || colorValues.length > 4) { return null; } try { var alpha = colorValues.length === 4 ? getNumericValue(colorValues[3], 1) : 1; if (name === 'rgb' || name === 'rgba') { return { red: getNumericValue(colorValues[0], 255.0), green: getNumericValue(colorValues[1], 255.0), blue: getNumericValue(colorValues[2], 255.0), alpha: alpha }; } else if (name === 'hsl' || name === 'hsla') { var h = getAngle(colorValues[0]); var s = getNumericValue(colorValues[1], 100.0); var l = getNumericValue(colorValues[2], 100.0); return colorFromHSL(h, s, l, alpha); } else if (name === 'hwb') { var h = getAngle(colorValues[0]); var w = getNumericValue(colorValues[1], 100.0); var b = getNumericValue(colorValues[2], 100.0); return colorFromHWB(h, w, b, alpha); } } catch (e) { return null; } } else if (node.type === NodeType.Identifier) { if (node.parent && node.parent.type !== NodeType.Term) { return null; } var term = node.parent; if (term && term.parent && term.parent.type === NodeType.BinaryExpression) { var expression = term.parent; if (expression.parent && expression.parent.type === NodeType.ListEntry && expression.parent.key === expression) { return null; } } var candidateColor = node.getText().toLowerCase(); if (candidateColor === 'none') { return null; } var colorHex = colors[candidateColor]; if (colorHex) { return colorFromHex(colorHex); } } return null; } var positionKeywords = { 'bottom': 'Computes to ‘100%’ for the vertical position if one or two values are given, otherwise specifies the bottom edge as the origin for the next offset.', 'center': 'Computes to ‘50%’ (‘left 50%’) for the horizontal position if the horizontal position is not otherwise specified, or ‘50%’ (‘top 50%’) for the vertical position if it is.', 'left': 'Computes to ‘0%’ for the horizontal position if one or two values are given, otherwise specifies the left edge as the origin for the next offset.', 'right': 'Computes to ‘100%’ for the horizontal position if one or two values are given, otherwise specifies the right edge as the origin for the next offset.', 'top': 'Computes to ‘0%’ for the vertical position if one or two values are given, otherwise specifies the top edge as the origin for the next offset.' }; var repeatStyleKeywords = { 'no-repeat': 'Placed once and not repeated in this direction.', 'repeat': 'Repeated in this direction as often as needed to cover the background painting area.', 'repeat-x': 'Computes to ‘repeat no-repeat’.', 'repeat-y': 'Computes to ‘no-repeat repeat’.', 'round': 'Repeated as often as will fit within the background positioning area. If it doesn’t fit a whole number of times, it is rescaled so that it does.', 'space': 'Repeated as often as will fit within the background positioning area without being clipped and then the images are spaced out to fill the area.' }; var lineStyleKeywords = { 'dashed': 'A series of square-ended dashes.', 'dotted': 'A series of round dots.', 'double': 'Two parallel solid lines with some space between them.', 'groove': 'Looks as if it were carved in the canvas.', 'hidden': 'Same as ‘none’, but has different behavior in the border conflict resolution rules for border-collapsed tables.', 'inset': 'Looks as if the content on the inside of the border is sunken into the canvas.', 'none': 'No border. Color and width are ignored.', 'outset': 'Looks as if the content on the inside of the border is coming out of the canvas.', 'ridge': 'Looks as if it were coming out of the canvas.', 'solid': 'A single line segment.' }; var lineWidthKeywords = ['medium', 'thick', 'thin']; var boxKeywords = { 'border-box': 'The background is painted within (clipped to) the border box.', 'content-box': 'The background is painted within (clipped to) the content box.', 'padding-box': 'The background is painted within (clipped to) the padding box.' }; var geometryBoxKeywords = { 'margin-box': 'Uses the margin box as reference box.', 'fill-box': 'Uses the object bounding box as reference box.', 'stroke-box': 'Uses the stroke bounding box as reference box.', 'view-box': 'Uses the nearest SVG viewport as reference box.' }; var cssWideKeywords = { 'initial': 'Represents the value specified as the property’s initial value.', 'inherit': 'Represents the computed value of the property on the element’s parent.', 'unset': 'Acts as either `inherit` or `initial`, depending on whether the property is inherited or not.' }; var cssWideFunctions = { 'var()': 'Evaluates the value of a custom variable.', 'calc()': 'Evaluates an mathematical expression. The following operators can be used: + - * /.' }; var imageFunctions = { 'url()': 'Reference an image file by URL', 'image()': 'Provide image fallbacks and annotations.', '-webkit-image-set()': 'Provide multiple resolutions. Remember to use unprefixed image-set() in addition.', 'image-set()': 'Provide multiple resolutions of an image and const the UA decide which is most appropriate in a given situation.', '-moz-element()': 'Use an element in the document as an image. Remember to use unprefixed element() in addition.', 'element()': 'Use an element in the document as an image.', 'cross-fade()': 'Indicates the two images to be combined and how far along in the transition the combination is.', '-webkit-gradient()': 'Deprecated. Use modern linear-gradient() or radial-gradient() instead.', '-webkit-linear-gradient()': 'Linear gradient. Remember to use unprefixed version in addition.', '-moz-linear-gradient()': 'Linear gradient. Remember to use unprefixed version in addition.', '-o-linear-gradient()': 'Linear gradient. Remember to use unprefixed version in addition.', 'linear-gradient()': 'A linear gradient is created by specifying a straight gradient line, and then several colors placed along that line.', '-webkit-repeating-linear-gradient()': 'Repeating Linear gradient. Remember to use unprefixed version in addition.', '-moz-repeating-linear-gradient()': 'Repeating Linear gradient. Remember to use unprefixed version in addition.', '-o-repeating-linear-gradient()': 'Repeating Linear gradient. Remember to use unprefixed version in addition.', 'repeating-linear-gradient()': 'Same as linear-gradient, except the color-stops are repeated infinitely in both directions, with their positions shifted by multiples of the difference between the last specified color-stop’s position and the first specified color-stop’s position.', '-webkit-radial-gradient()': 'Radial gradient. Remember to use unprefixed version in addition.', '-moz-radial-gradient()': 'Radial gradient. Remember to use unprefixed version in addition.', 'radial-gradient()': 'Colors emerge from a single point and smoothly spread outward in a circular or elliptical shape.', '-webkit-repeating-radial-gradient()': 'Repeating radial gradient. Remember to use unprefixed version in addition.', '-moz-repeating-radial-gradient()': 'Repeating radial gradient. Remember to use unprefixed version in addition.', 'repeating-radial-gradient()': 'Same as radial-gradient, except the color-stops are repeated infinitely in both directions, with their positions shifted by multiples of the difference between the last specified color-stop’s position and the first specified color-stop’s position.' }; var transitionTimingFunctions = { 'ease': 'Equivalent to cubic-bezier(0.25, 0.1, 0.25, 1.0).', 'ease-in': 'Equivalent to cubic-bezier(0.42, 0, 1.0, 1.0).', 'ease-in-out': 'Equivalent to cubic-bezier(0.42, 0, 0.58, 1.0).', 'ease-out': 'Equivalent to cubic-bezier(0, 0, 0.58, 1.0).', 'linear': 'Equivalent to cubic-bezier(0.0, 0.0, 1.0, 1.0).', 'step-end': 'Equivalent to steps(1, end).', 'step-start': 'Equivalent to steps(1, start).', 'steps()': 'The first parameter specifies the number of intervals in the function. The second parameter, which is optional, is either the value “start” or “end”.', 'cubic-bezier()': 'Specifies a cubic-bezier curve. The four values specify points P1 and P2 of the curve as (x1, y1, x2, y2).', 'cubic-bezier(0.6, -0.28, 0.735, 0.045)': 'Ease-in Back. Overshoots.', 'cubic-bezier(0.68, -0.55, 0.265, 1.55)': 'Ease-in-out Back. Overshoots.', 'cubic-bezier(0.175, 0.885, 0.32, 1.275)': 'Ease-out Back. Overshoots.', 'cubic-bezier(0.6, 0.04, 0.98, 0.335)': 'Ease-in Circular. Based on half circle.', 'cubic-bezier(0.785, 0.135, 0.15, 0.86)': 'Ease-in-out Circular. Based on half circle.', 'cubic-bezier(0.075, 0.82, 0.165, 1)': 'Ease-out Circular. Based on half circle.', 'cubic-bezier(0.55, 0.055, 0.675, 0.19)': 'Ease-in Cubic. Based on power of three.', 'cubic-bezier(0.645, 0.045, 0.355, 1)': 'Ease-in-out Cubic. Based on power of three.', 'cubic-bezier(0.215, 0.610, 0.355, 1)': 'Ease-out Cubic. Based on power of three.', 'cubic-bezier(0.95, 0.05, 0.795, 0.035)': 'Ease-in Exponential. Based on two to the power ten.', 'cubic-bezier(1, 0, 0, 1)': 'Ease-in-out Exponential. Based on two to the power ten.', 'cubic-bezier(0.19, 1, 0.22, 1)': 'Ease-out Exponential. Based on two to the power ten.', 'cubic-bezier(0.47, 0, 0.745, 0.715)': 'Ease-in Sine.', 'cubic-bezier(0.445, 0.05, 0.55, 0.95)': 'Ease-in-out Sine.', 'cubic-bezier(0.39, 0.575, 0.565, 1)': 'Ease-out Sine.', 'cubic-bezier(0.55, 0.085, 0.68, 0.53)': 'Ease-in Quadratic. Based on power of two.', 'cubic-bezier(0.455, 0.03, 0.515, 0.955)': 'Ease-in-out Quadratic. Based on power of two.', 'cubic-bezier(0.25, 0.46, 0.45, 0.94)': 'Ease-out Quadratic. Based on power of two.', 'cubic-bezier(0.895, 0.03, 0.685, 0.22)': 'Ease-in Quartic. Based on power of four.', 'cubic-bezier(0.77, 0, 0.175, 1)': 'Ease-in-out Quartic. Based on power of four.', 'cubic-bezier(0.165, 0.84, 0.44, 1)': 'Ease-out Quartic. Based on power of four.', 'cubic-bezier(0.755, 0.05, 0.855, 0.06)': 'Ease-in Quintic. Based on power of five.', 'cubic-bezier(0.86, 0, 0.07, 1)': 'Ease-in-out Quintic. Based on power of five.', 'cubic-bezier(0.23, 1, 0.320, 1)': 'Ease-out Quintic. Based on power of five.' }; var basicShapeFunctions = { 'circle()': 'Defines a circle.', 'ellipse()': 'Defines an ellipse.', 'inset()': 'Defines an inset rectangle.', 'polygon()': 'Defines a polygon.' }; var units = { 'length': ['em', 'rem', 'ex', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vw', 'vh', 'vmin', 'vmax'], 'angle': ['deg', 'rad', 'grad', 'turn'], 'time': ['ms', 's'], 'frequency': ['Hz', 'kHz'], 'resolution': ['dpi', 'dpcm', 'dppx'], 'percentage': ['%', 'fr'] }; var html5Tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rb', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'const', 'video', 'wbr']; var svgElements = ['circle', 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'foreignObject', 'g', 'hatch', 'hatchpath', 'image', 'line', 'linearGradient', 'marker', 'mask', 'mesh', 'meshpatch', 'meshrow', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'set', 'solidcolor', 'stop', 'svg', 'switch', 'symbol', 'text', 'textPath', 'tspan', 'use', 'view']; var pageBoxDirectives = [ '@bottom-center', '@bottom-left', '@bottom-left-corner', '@bottom-right', '@bottom-right-corner', '@left-bottom', '@left-middle', '@left-top', '@right-bottom', '@right-middle', '@right-top', '@top-center', '@top-left', '@top-left-corner', '@top-right', '@top-right-corner' ]; function values(obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); } function isDefined(obj) { return typeof obj !== 'undefined'; } var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; var Parser = (function () { function Parser(scnr) { if (scnr === void 0) { scnr = new Scanner(); } this.keyframeRegex = /^@(\-(webkit|ms|moz|o)\-)?keyframes$/i; this.scanner = scnr; this.token = { type: TokenType.EOF, offset: -1, len: 0, text: '' }; this.prevToken = undefined; } Parser.prototype.peekIdent = function (text) { return TokenType.Ident === this.token.type && text.length === this.token.text.length && text === this.token.text.toLowerCase(); }; Parser.prototype.peekKeyword = function (text) { return TokenType.AtKeyword === this.token.type && text.length === this.token.text.length && text === this.token.text.toLowerCase(); }; Parser.prototype.peekDelim = function (text) { return TokenType.Delim === this.token.type && text === this.token.text; }; Parser.prototype.peek = function (type) { return type === this.token.type; }; Parser.prototype.peekOne = function () { var types = []; for (var _i = 0; _i < arguments.length; _i++) { types[_i] = arguments[_i]; } return types.indexOf(this.token.type) !== -1; }; Parser.prototype.peekRegExp = function (type, regEx) { if (type !== this.token.type) { return false; } return regEx.test(this.token.text); }; Parser.prototype.hasWhitespace = function () { return !!this.prevToken && (this.prevToken.offset + this.prevToken.len !== this.token.offset); }; Parser.prototype.consumeToken = function () { this.prevToken = this.token; this.token = this.scanner.scan(); }; Parser.prototype.mark = function () { return { prev: this.prevToken, curr: this.token, pos: this.scanner.pos() }; }; Parser.prototype.restoreAtMark = function (mark) { this.prevToken = mark.prev; this.token = mark.curr; this.scanner.goBackTo(mark.pos); }; Parser.prototype.try = function (func) { var pos = this.mark(); var node = func(); if (!node) { this.restoreAtMark(pos); return null; } return node; }; Parser.prototype.acceptOneKeyword = function (keywords) { if (TokenType.AtKeyword === this.token.type) { for (var _i = 0, keywords_1 = keywords; _i < keywords_1.length; _i++) { var keyword = keywords_1[_i]; if (keyword.length === this.token.text.length && keyword === this.token.text.toLowerCase()) { this.consumeToken(); return true; } } } return false; }; Parser.prototype.accept = function (type) { if (type === this.token.type) { this.consumeToken(); return true; } return false; }; Parser.prototype.acceptIdent = function (text) { if (this.peekIdent(text)) { this.consumeToken(); return true; } return false; }; Parser.prototype.acceptKeyword = function (text) { if (this.peekKeyword(text)) { this.consumeToken(); return true; } return false; }; Parser.prototype.acceptDelim = function (text) { if (this.peekDelim(text)) { this.consumeToken(); return true; } return false; }; Parser.prototype.acceptRegexp = function (regEx) { if (regEx.test(this.token.text)) { this.consumeToken(); return true; } return false; }; Parser.prototype._parseRegexp = function (regEx) { var node = this.createNode(NodeType.Identifier); do { } while (this.acceptRegexp(regEx)); return this.finish(node); }; Parser.prototype.acceptUnquotedString = function () { var pos = this.scanner.pos(); this.scanner.goBackTo(this.token.offset); var unquoted = this.scanner.scanUnquotedString(); if (unquoted) { this.token = unquoted; this.consumeToken(); return true; } this.scanner.goBackTo(pos); return false; }; Parser.prototype.resync = function (resyncTokens, resyncStopTokens) { while (true) { if (resyncTokens && resyncTokens.indexOf(this.token.type) !== -1) { this.consumeToken(); return true; } else if (resyncStopTokens && resyncStopTokens.indexOf(this.token.type) !== -1) { return true; } else { if (this.token.type === TokenType.EOF) { return false; } this.token = this.scanner.scan(); } } }; Parser.prototype.createNode = function (nodeType) { return new Node(this.token.offset, this.token.len, nodeType); }; Parser.prototype.create = function (ctor) { return new ctor(this.token.offset, this.token.len); }; Parser.prototype.finish = function (node, error, resyncTokens, resyncStopTokens) { if (!(node instanceof Nodelist)) { if (error) { this.markError(node, error, resyncTokens, resyncStopTokens); } if (this.prevToken) { var prevEnd = this.prevToken.offset + this.prevToken.len; node.length = prevEnd > node.offset ? prevEnd - node.offset : 0; } } return node; }; Parser.prototype.markError = function (node, error, resyncTokens, resyncStopTokens) { if (this.token !== this.lastErrorToken) { node.addIssue(new Marker(node, error, Level.Error, undefined, this.token.offset, this.token.len)); this.lastErrorToken = this.token; } if (resyncTokens || resyncStopTokens) { this.resync(resyncTokens, resyncStopTokens); } }; Parser.prototype.parseStylesheet = function (textDocument) { var versionId = textDocument.version; var text = textDocument.getText(); var textProvider = function (offset, length) { if (textDocument.version !== versionId) { throw new Error('Underlying model has changed, AST is no longer valid'); } return text.substr(offset, length); }; return this.internalParse(text, this._parseStylesheet, textProvider); }; Parser.prototype.internalParse = function (input, parseFunc, textProvider) { this.scanner.setSource(input); this.token = this.scanner.scan(); var node = parseFunc.bind(this)(); if (node) { if (textProvider) { node.textProvider = textProvider; } else { node.textProvider = function (offset, length) { return input.substr(offset, length); }; } } return node; }; Parser.prototype._parseStylesheet = function () { var node = this.create(Stylesheet); while (node.addChild(this._parseStylesheetStart())) { } var inRecovery = false; do { var hasMatch = false; do { hasMatch = false; var statement = this._parseStylesheetStatement(); if (statement) { node.addChild(statement); hasMatch = true; inRecovery = false; if (!this.peek(TokenType.EOF) && this._needsSemicolonAfter(statement) && !this.accept(TokenType.SemiColon)) { this.markError(node, ParseError.SemiColonExpected); } } while (this.accept(TokenType.SemiColon) || this.accept(TokenType.CDO) || this.accept(TokenType.CDC)) { hasMatch = true; inRecovery = false; } } while (hasMatch); if (this.peek(TokenType.EOF)) { break; } if (!inRecovery) { if (this.peek(TokenType.AtKeyword)) { this.markError(node, ParseError.UnknownAtRule); } else { this.markError(node, ParseError.RuleOrSelectorExpected); } inRecovery = true; } this.consumeToken(); } while (!this.peek(TokenType.EOF)); return this.finish(node); }; Parser.prototype._parseStylesheetStart = function () { return this._parseCharset(); }; Parser.prototype._parseStylesheetStatement = function (isNested) { if (isNested === void 0) { isNested = false; } if (this.peek(TokenType.AtKeyword)) { return this._parseStylesheetAtStatement(isNested); } return this._parseRuleset(isNested); }; Parser.prototype._parseStylesheetAtStatement = function (isNested) { if (isNested === void 0) { isNested = false; } return this._parseImport() || this._parseMedia(isNested) || this._parsePage() || this._parseFontFace() || this._parseKeyframe() || this._parseSupports(isNested) || this._parseViewPort() || this._parseNamespace() || this._parseDocument() || this._parseUnknownAtRule(); }; Parser.prototype._tryParseRuleset = function (isNested) { var mark = this.mark(); if (this._parseSelector(isNested)) { while (this.accept(TokenType.Comma) && this._parseSelector(isNested)) { } if (this.accept(TokenType.CurlyL)) { this.restoreAtMark(mark); return this._parseRuleset(isNested); } } this.restoreAtMark(mark); return null; }; Parser.prototype._parseRuleset = function (isNested) { if (isNested === void 0) { isNested = false; } var node = this.create(RuleSet); var selectors = node.getSelectors(); if (!selectors.addChild(this._parseSelector(isNested))) { return null; } while (this.accept(TokenType.Comma)) { if (!selectors.addChild(this._parseSelector(isNested))) { return this.finish(node, ParseError.SelectorExpected); } } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); }; Parser.prototype._parseRuleSetDeclarationAtStatement = function () { return this._parseUnknownAtRule(); }; Parser.prototype._parseRuleSetDeclaration = function () { if (this.peek(TokenType.AtKeyword)) { return this._parseRuleSetDeclarationAtStatement(); } return this._parseDeclaration(); }; Parser.prototype._needsSemicolonAfter = function (node) { switch (node.type) { case NodeType.Keyframe: case NodeType.ViewPort: case NodeType.Media: case NodeType.Ruleset: case NodeType.Namespace: case NodeType.If: case NodeType.For: case NodeType.Each: case NodeType.While: case NodeType.MixinDeclaration: case NodeType.FunctionDeclaration: case NodeType.MixinContentDeclaration: return false; case NodeType.ExtendsReference: case NodeType.MixinContentReference: case NodeType.ReturnStatement: case NodeType.MediaQuery: case NodeType.Debug: case NodeType.Import: case NodeType.AtApplyRule: case NodeType.CustomPropertyDeclaration: return true; case NodeType.VariableDeclaration: return node.needsSemicolon; case NodeType.MixinReference: return !node.getContent(); case NodeType.Declaration: return !node.getNestedProperties(); } return false; }; Parser.prototype._parseDeclarations = function (parseDeclaration) { var node = this.create(Declarations); if (!this.accept(TokenType.CurlyL)) { return null; } var decl = parseDeclaration(); while (node.addChild(decl)) { if (this.peek(TokenType.CurlyR)) { break; } if (this._needsSemicolonAfter(decl) && !this.accept(TokenType.SemiColon)) { return this.finish(node, ParseError.SemiColonExpected, [TokenType.SemiColon, TokenType.CurlyR]); } if (decl && this.prevToken && this.prevToken.type === TokenType.SemiColon) { decl.semicolonPosition = this.prevToken.offset; } while (this.accept(TokenType.SemiColon)) { } decl = parseDeclaration(); } if (!this.accept(TokenType.CurlyR)) { return this.finish(node, ParseError.RightCurlyExpected, [TokenType.CurlyR, TokenType.SemiColon]); } return this.finish(node); }; Parser.prototype._parseBody = function (node, parseDeclaration) { if (!node.setDeclarations(this._parseDeclarations(parseDeclaration))) { return this.finish(node, ParseError.LeftCurlyExpected, [TokenType.CurlyR, TokenType.SemiColon]); } return this.finish(node); }; Parser.prototype._parseSelector = function (isNested) { var node = this.create(Selector); var hasContent = false; if (isNested) { hasContent = node.addChild(this._parseCombinator()); } while (node.addChild(this._parseSimpleSelector())) { hasContent = true; node.addChild(this._parseCombinator()); } return hasContent ? this.finish(node) : null; }; Parser.prototype._parseDeclaration = function (stopTokens) { var custonProperty = this._tryParseCustomPropertyDeclaration(stopTokens); if (custonProperty) { return custonProperty; } var node = this.create(Declaration); if (!node.setProperty(this._parseProperty())) { return null; } if (!this.accept(TokenType.Colon)) { return this.finish(node, ParseError.ColonExpected, [TokenType.Colon], stopTokens || [TokenType.SemiColon]); } if (this.prevToken) { node.colonPosition = this.prevToken.offset; } if (!node.setValue(this._parseExpr())) { return this.finish(node, ParseError.PropertyValueExpected); } node.addChild(this._parsePrio()); if (this.peek(TokenType.SemiColon)) { node.semicolonPosition = this.token.offset; } return this.finish(node); }; Parser.prototype._tryParseCustomPropertyDeclaration = function (stopTokens) { if (!this.peekRegExp(TokenType.Ident, /^--/)) { return null; } var node = this.create(CustomPropertyDeclaration); if (!node.setProperty(this._parseProperty())) { return null; } if (!this.accept(TokenType.Colon)) { return this.finish(node, ParseError.ColonExpected, [TokenType.Colon]); } if (this.prevToken) { node.colonPosition = this.prevToken.offset; } var mark = this.mark(); if (this.peek(TokenType.CurlyL)) { var propertySet = this.create(CustomPropertySet); var declarations = this._parseDeclarations(this._parseRuleSetDeclaration.bind(this)); if (propertySet.setDeclarations(declarations) && !declarations.isErroneous(true)) { propertySet.addChild(this._parsePrio()); if (this.peek(TokenType.SemiColon)) { this.finish(propertySet); node.setPropertySet(propertySet); node.semicolonPosition = this.token.offset; return this.finish(node); } } this.restoreAtMark(mark); } var expression = this._parseExpr(); if (expression && !expression.isErroneous(true)) { this._parsePrio(); if (this.peekOne.apply(this, __spreadArray$1(__spreadArray$1([], (stopTokens || []), false), [TokenType.SemiColon, TokenType.EOF], false))) { node.setValue(expression); if (this.peek(TokenType.SemiColon)) { node.semicolonPosition = this.token.offset; } return this.finish(node); } } this.restoreAtMark(mark); node.addChild(this._parseCustomPropertyValue(stopTokens)); node.addChild(this._parsePrio()); if (isDefined(node.colonPosition) && this.token.offset === node.colonPosition + 1) { return this.finish(node, ParseError.PropertyValueExpected); } return this.finish(node); }; Parser.prototype._parseCustomPropertyValue = function (stopTokens) { var _this = this; if (stopTokens === void 0) { stopTokens = [TokenType.CurlyR]; } var node = this.create(Node); var isTopLevel = function () { return curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 0; }; var onStopToken = function () { return stopTokens.indexOf(_this.token.type) !== -1; }; var curlyDepth = 0; var parensDepth = 0; var bracketsDepth = 0; done: while (true) { switch (this.token.type) { case TokenType.SemiColon: if (isTopLevel()) { break done; } break; case TokenType.Exclamation: if (isTopLevel()) { break done; } break; case TokenType.CurlyL: curlyDepth++; break; case TokenType.CurlyR: curlyDepth--; if (curlyDepth < 0) { if (onStopToken() && parensDepth === 0 && bracketsDepth === 0) { break done; } return this.finish(node, ParseError.LeftCurlyExpected); } break; case TokenType.ParenthesisL: parensDepth++; break; case TokenType.ParenthesisR: parensDepth--; if (parensDepth < 0) { if (onStopToken() && bracketsDepth === 0 && curlyDepth === 0) { break done; } return this.finish(node, ParseError.LeftParenthesisExpected); } break; case TokenType.BracketL: bracketsDepth++; break; case TokenType.BracketR: bracketsDepth--; if (bracketsDepth < 0) { return this.finish(node, ParseError.LeftSquareBracketExpected); } break; case TokenType.BadString: break done; case TokenType.EOF: var error = ParseError.RightCurlyExpected; if (bracketsDepth > 0) { error = ParseError.RightSquareBracketExpected; } else if (parensDepth > 0) { error = ParseError.RightParenthesisExpected; } return this.finish(node, error); } this.consumeToken(); } return this.finish(node); }; Parser.prototype._tryToParseDeclaration = function (stopTokens) { var mark = this.mark(); if (this._parseProperty() && this.accept(TokenType.Colon)) { this.restoreAtMark(mark); return this._parseDeclaration(stopTokens); } this.restoreAtMark(mark); return null; }; Parser.prototype._parseProperty = function () { var node = this.create(Property); var mark = this.mark(); if (this.acceptDelim('*') || this.acceptDelim('_')) { if (this.hasWhitespace()) { this.restoreAtMark(mark); return null; } } if (node.setIdentifier(this._parsePropertyIdentifier())) { return this.finish(node); } return null; }; Parser.prototype._parsePropertyIdentifier = function () { return this._parseIdent(); }; Parser.prototype._parseCharset = function () { if (!this.peek(TokenType.Charset)) { return null; } var node = this.create(Node); this.consumeToken(); if (!this.accept(TokenType.String)) { return this.finish(node, ParseError.IdentifierExpected); } if (!this.accept(TokenType.SemiColon)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); }; Parser.prototype._parseImport = function () { if (!this.peekKeyword('@import')) { return null; } var node = this.create(Import); this.consumeToken(); if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.URIOrStringExpected); } if (!this.peek(TokenType.SemiColon) && !this.peek(TokenType.EOF)) { node.setMedialist(this._parseMediaQueryList()); } return this.finish(node); }; Parser.prototype._parseNamespace = function () { if (!this.peekKeyword('@namespace')) { return null; } var node = this.create(Namespace); this.consumeToken(); if (!node.addChild(this._parseURILiteral())) { node.addChild(this._parseIdent()); if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.URIExpected, [TokenType.SemiColon]); } } if (!this.accept(TokenType.SemiColon)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); }; Parser.prototype._parseFontFace = function () { if (!this.peekKeyword('@font-face')) { return null; } var node = this.create(FontFace); this.consumeToken(); return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); }; Parser.prototype._parseViewPort = function () { if (!this.peekKeyword('@-ms-viewport') && !this.peekKeyword('@-o-viewport') && !this.peekKeyword('@viewport')) { return null; } var node = this.create(ViewPort); this.consumeToken(); return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); }; Parser.prototype._parseKeyframe = function () { if (!this.peekRegExp(TokenType.AtKeyword, this.keyframeRegex)) { return null; } var node = this.create(Keyframe); var atNode = this.create(Node); this.consumeToken(); node.setKeyword(this.finish(atNode)); if (atNode.matches('@-ms-keyframes')) { this.markError(atNode, ParseError.UnknownKeyword); } if (!node.setIdentifier(this._parseKeyframeIdent())) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]); } return this._parseBody(node, this._parseKeyframeSelector.bind(this)); }; Parser.prototype._parseKeyframeIdent = function () { return this._parseIdent([ReferenceType.Keyframe]); }; Parser.prototype._parseKeyframeSelector = function () { var node = this.create(KeyframeSelector); if (!node.addChild(this._parseIdent()) && !this.accept(TokenType.Percentage)) { return null; } while (this.accept(TokenType.Comma)) { if (!node.addChild(this._parseIdent()) && !this.accept(TokenType.Percentage)) { return this.finish(node, ParseError.PercentageExpected); } } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); }; Parser.prototype._tryParseKeyframeSelector = function () { var node = this.create(KeyframeSelector); var pos = this.mark(); if (!node.addChild(this._parseIdent()) && !this.accept(TokenType.Percentage)) { return null; } while (this.accept(TokenType.Comma)) { if (!node.addChild(this._parseIdent()) && !this.accept(TokenType.Percentage)) { this.restoreAtMark(pos); return null; } } if (!this.peek(TokenType.CurlyL)) { this.restoreAtMark(pos); return null; } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); }; Parser.prototype._parseSupports = function (isNested) { if (isNested === void 0) { isNested = false; } if (!this.peekKeyword('@supports')) { return null; } var node = this.create(Supports); this.consumeToken(); node.addChild(this._parseSupportsCondition()); return this._parseBody(node, this._parseSupportsDeclaration.bind(this, isNested)); }; Parser.prototype._parseSupportsDeclaration = function (isNested) { if (isNested === void 0) { isNested = false; } if (isNested) { return this._tryParseRuleset(true) || this._tryToParseDeclaration() || this._parseStylesheetStatement(true); } return this._parseStylesheetStatement(false); }; Parser.prototype._parseSupportsCondition = function () { var node = this.create(SupportsCondition); if (this.acceptIdent('not')) { node.addChild(this._parseSupportsConditionInParens()); } else { node.addChild(this._parseSupportsConditionInParens()); if (this.peekRegExp(TokenType.Ident, /^(and|or)$/i)) { var text = this.token.text.toLowerCase(); while (this.acceptIdent(text)) { node.addChild(this._parseSupportsConditionInParens()); } } } return this.finish(node); }; Parser.prototype._parseSupportsConditionInParens = function () { var node = this.create(SupportsCondition); if (this.accept(TokenType.ParenthesisL)) { if (this.prevToken) { node.lParent = this.prevToken.offset; } if (!node.addChild(this._tryToParseDeclaration([TokenType.ParenthesisR]))) { if (!this._parseSupportsCondition()) { return this.finish(node, ParseError.ConditionExpected); } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.ParenthesisR], []); } if (this.prevToken) { node.rParent = this.prevToken.offset; } return this.finish(node); } else if (this.peek(TokenType.Ident)) { var pos = this.mark(); this.consumeToken(); if (!this.hasWhitespace() && this.accept(TokenType.ParenthesisL)) { var openParentCount = 1; while (this.token.type !== TokenType.EOF && openParentCount !== 0) { if (this.token.type === TokenType.ParenthesisL) { openParentCount++; } else if (this.token.type === TokenType.ParenthesisR) { openParentCount--; } this.consumeToken(); } return this.finish(node); } else { this.restoreAtMark(pos); } } return this.finish(node, ParseError.LeftParenthesisExpected, [], [TokenType.ParenthesisL]); }; Parser.prototype._parseMediaDeclaration = function (isNested) { if (isNested === void 0) { isNested = false; } if (isNested) { return this._tryParseRuleset(true) || this._tryToParseDeclaration() || this._parseStylesheetStatement(true); } return this._parseStylesheetStatement(false); }; Parser.prototype._parseMedia = function (isNested) { if (isNested === void 0) { isNested = false; } if (!this.peekKeyword('@media')) { return null; } var node = this.create(Media); this.consumeToken(); if (!node.addChild(this._parseMediaQueryList())) { return this.finish(node, ParseError.MediaQueryExpected); } return this._parseBody(node, this._parseMediaDeclaration.bind(this, isNested)); }; Parser.prototype._parseMediaQueryList = function () { var node = this.create(Medialist); if (!node.addChild(this._parseMediaQuery())) { return this.finish(node, ParseError.MediaQueryExpected); } while (this.accept(TokenType.Comma)) { if (!node.addChild(this._parseMediaQuery())) { return this.finish(node, ParseError.MediaQueryExpected); } } return this.finish(node); }; Parser.prototype._parseMediaQuery = function () { var node = this.create(MediaQuery); var pos = this.mark(); this.acceptIdent('not'); if (!this.peek(TokenType.ParenthesisL)) { if (this.acceptIdent('only')) ; if (!node.addChild(this._parseIdent())) { return null; } if (this.acceptIdent('and')) { node.addChild(this._parseMediaCondition()); } } else { this.restoreAtMark(pos); node.addChild(this._parseMediaCondition()); } return this.finish(node); }; Parser.prototype._parseRatio = function () { var pos = this.mark(); var node = this.create(RatioValue); if (!this._parseNumeric()) { return null; } if (!this.acceptDelim('/')) { this.restoreAtMark(pos); return null; } if (!this._parseNumeric()) { return this.finish(node, ParseError.NumberExpected); } return this.finish(node); }; Parser.prototype._parseMediaCondition = function () { var node = this.create(MediaCondition); this.acceptIdent('not'); var parseExpression = true; while (parseExpression) { if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [], [TokenType.CurlyL]); } if (this.peek(TokenType.ParenthesisL) || this.peekIdent('not')) { node.addChild(this._parseMediaCondition()); } else { node.addChild(this._parseMediaFeature()); } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [], [TokenType.CurlyL]); } parseExpression = this.acceptIdent('and') || this.acceptIdent('or'); } return this.finish(node); }; Parser.prototype._parseMediaFeature = function () { var _this = this; var resyncStopToken = [TokenType.ParenthesisR]; var node = this.create(MediaFeature); var parseRangeOperator = function () { if (_this.acceptDelim('<') || _this.acceptDelim('>')) { if (!_this.hasWhitespace()) { _this.acceptDelim('='); } return true; } else if (_this.acceptDelim('=')) { return true; } return false; }; if (node.addChild(this._parseMediaFeatureName())) { if (this.accept(TokenType.Colon)) { if (!node.addChild(this._parseMediaFeatureValue())) { return this.finish(node, ParseError.TermExpected, [], resyncStopToken); } } else if (parseRangeOperator()) { if (!node.addChild(this._parseMediaFeatureValue())) { return this.finish(node, ParseError.TermExpected, [], resyncStopToken); } if (parseRangeOperator()) { if (!node.addChild(this._parseMediaFeatureValue())) { return this.finish(node, ParseError.TermExpected, [], resyncStopToken); } } } else ; } else if (node.addChild(this._parseMediaFeatureValue())) { if (!parseRangeOperator()) { return this.finish(node, ParseError.OperatorExpected, [], resyncStopToken); } if (!node.addChild(this._parseMediaFeatureName())) { return this.finish(node, ParseError.IdentifierExpected, [], resyncStopToken); } if (parseRangeOperator()) { if (!node.addChild(this._parseMediaFeatureValue())) { return this.finish(node, ParseError.TermExpected, [], resyncStopToken); } } } else { return this.finish(node, ParseError.IdentifierExpected, [], resyncStopToken); } return this.finish(node); }; Parser.prototype._parseMediaFeatureName = function () { return this._parseIdent(); }; Parser.prototype._parseMediaFeatureValue = function () { return this._parseRatio() || this._parseTermExpression(); }; Parser.prototype._parseMedium = function () { var node = this.create(Node); if (node.addChild(this._parseIdent())) { return this.finish(node); } else { return null; } }; Parser.prototype._parsePageDeclaration = function () { return this._parsePageMarginBox() || this._parseRuleSetDeclaration(); }; Parser.prototype._parsePage = function () { if (!this.peekKeyword('@page')) { return null; } var node = this.create(Page); this.consumeToken(); if (node.addChild(this._parsePageSelector())) { while (this.accept(TokenType.Comma)) { if (!node.addChild(this._parsePageSelector())) { return this.finish(node, ParseError.IdentifierExpected); } } } return this._parseBody(node, this._parsePageDeclaration.bind(this)); }; Parser.prototype._parsePageMarginBox = function () { if (!this.peek(TokenType.AtKeyword)) { return null; } var node = this.create(PageBoxMarginBox); if (!this.acceptOneKeyword(pageBoxDirectives)) { this.markError(node, ParseError.UnknownAtRule, [], [TokenType.CurlyL]); } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); }; Parser.prototype._parsePageSelector = function () { if (!this.peek(TokenType.Ident) && !this.peek(TokenType.Colon)) { return null; } var node = this.create(Node); node.addChild(this._parseIdent()); if (this.accept(TokenType.Colon)) { if (!node.addChild(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); } } return this.finish(node); }; Parser.prototype._parseDocument = function () { if (!this.peekKeyword('@-moz-document')) { return null; } var node = this.create(Document); this.consumeToken(); this.resync([], [TokenType.CurlyL]); return this._parseBody(node, this._parseStylesheetStatement.bind(this)); }; Parser.prototype._parseUnknownAtRule = function () { if (!this.peek(TokenType.AtKeyword)) { return null; } var node = this.create(UnknownAtRule); node.addChild(this._parseUnknownAtRuleName()); var isTopLevel = function () { return curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 0; }; var curlyLCount = 0; var curlyDepth = 0; var parensDepth = 0; var bracketsDepth = 0; done: while (true) { switch (this.token.type) { case TokenType.SemiColon: if (isTopLevel()) { break done; } break; case TokenType.EOF: if (curlyDepth > 0) { return this.finish(node, ParseError.RightCurlyExpected); } else if (bracketsDepth > 0) { return this.finish(node, ParseError.RightSquareBracketExpected); } else if (parensDepth > 0) { return this.finish(node, ParseError.RightParenthesisExpected); } else { return this.finish(node); } case TokenType.CurlyL: curlyLCount++; curlyDepth++; break; case TokenType.CurlyR: curlyDepth--; if (curlyLCount > 0 && curlyDepth === 0) { this.consumeToken(); if (bracketsDepth > 0) { return this.finish(node, ParseError.RightSquareBracketExpected); } else if (parensDepth > 0) { return this.finish(node, ParseError.RightParenthesisExpected); } break done; } if (curlyDepth < 0) { if (parensDepth === 0 && bracketsDepth === 0) { break done; } return this.finish(node, ParseError.LeftCurlyExpected); } break; case TokenType.ParenthesisL: parensDepth++; break; case TokenType.ParenthesisR: parensDepth--; if (parensDepth < 0) { return this.finish(node, ParseError.LeftParenthesisExpected); } break; case TokenType.BracketL: bracketsDepth++; break; case TokenType.BracketR: bracketsDepth--; if (bracketsDepth < 0) { return this.finish(node, ParseError.LeftSquareBracketExpected); } break; } this.consumeToken(); } return node; }; Parser.prototype._parseUnknownAtRuleName = function () { var node = this.create(Node); if (this.accept(TokenType.AtKeyword)) { return this.finish(node); } return node; }; Parser.prototype._parseOperator = function () { if (this.peekDelim('/') || this.peekDelim('*') || this.peekDelim('+') || this.peekDelim('-') || this.peek(TokenType.Dashmatch) || this.peek(TokenType.Includes) || this.peek(TokenType.SubstringOperator) || this.peek(TokenType.PrefixOperator) || this.peek(TokenType.SuffixOperator) || this.peekDelim('=')) { var node = this.createNode(NodeType.Operator); this.consumeToken(); return this.finish(node); } else { return null; } }; Parser.prototype._parseUnaryOperator = function () { if (!this.peekDelim('+') && !this.peekDelim('-')) { return null; } var node = this.create(Node); this.consumeToken(); return this.finish(node); }; Parser.prototype._parseCombinator = function () { if (this.peekDelim('>')) { var node = this.create(Node); this.consumeToken(); var mark = this.mark(); if (!this.hasWhitespace() && this.acceptDelim('>')) { if (!this.hasWhitespace() && this.acceptDelim('>')) { node.type = NodeType.SelectorCombinatorShadowPiercingDescendant; return this.finish(node); } this.restoreAtMark(mark); } node.type = NodeType.SelectorCombinatorParent; return this.finish(node); } else if (this.peekDelim('+')) { var node = this.create(Node); this.consumeToken(); node.type = NodeType.SelectorCombinatorSibling; return this.finish(node); } else if (this.peekDelim('~')) { var node = this.create(Node); this.consumeToken(); node.type = NodeType.SelectorCombinatorAllSiblings; return this.finish(node); } else if (this.peekDelim('/')) { var node = this.create(Node); this.consumeToken(); var mark = this.mark(); if (!this.hasWhitespace() && this.acceptIdent('deep') && !this.hasWhitespace() && this.acceptDelim('/')) { node.type = NodeType.SelectorCombinatorShadowPiercingDescendant; return this.finish(node); } this.restoreAtMark(mark); } return null; }; Parser.prototype._parseSimpleSelector = function () { var node = this.create(SimpleSelector); var c = 0; if (node.addChild(this._parseElementName())) { c++; } while ((c === 0 || !this.hasWhitespace()) && node.addChild(this._parseSimpleSelectorBody())) { c++; } return c > 0 ? this.finish(node) : null; }; Parser.prototype._parseSimpleSelectorBody = function () { return this._parsePseudo() || this._parseHash() || this._parseClass() || this._parseAttrib(); }; Parser.prototype._parseSelectorIdent = function () { return this._parseIdent(); }; Parser.prototype._parseHash = function () { if (!this.peek(TokenType.Hash) && !this.peekDelim('#')) { return null; } var node = this.createNode(NodeType.IdentifierSelector); if (this.acceptDelim('#')) { if (this.hasWhitespace() || !node.addChild(this._parseSelectorIdent())) { return this.finish(node, ParseError.IdentifierExpected); } } else { this.consumeToken(); } return this.finish(node); }; Parser.prototype._parseClass = function () { if (!this.peekDelim('.')) { return null; } var node = this.createNode(NodeType.ClassSelector); this.consumeToken(); if (this.hasWhitespace() || !node.addChild(this._parseSelectorIdent())) { return this.finish(node, ParseError.IdentifierExpected); } return this.finish(node); }; Parser.prototype._parseElementName = function () { var pos = this.mark(); var node = this.createNode(NodeType.ElementNameSelector); node.addChild(this._parseNamespacePrefix()); if (!node.addChild(this._parseSelectorIdent()) && !this.acceptDelim('*')) { this.restoreAtMark(pos); return null; } return this.finish(node); }; Parser.prototype._parseNamespacePrefix = function () { var pos = this.mark(); var node = this.createNode(NodeType.NamespacePrefix); if (!node.addChild(this._parseIdent()) && !this.acceptDelim('*')) ; if (!this.acceptDelim('|')) { this.restoreAtMark(pos); return null; } return this.finish(node); }; Parser.prototype._parseAttrib = function () { if (!this.peek(TokenType.BracketL)) { return null; } var node = this.create(AttributeSelector); this.consumeToken(); node.setNamespacePrefix(this._parseNamespacePrefix()); if (!node.setIdentifier(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); } if (node.setOperator(this._parseOperator())) { node.setValue(this._parseBinaryExpr()); this.acceptIdent('i'); this.acceptIdent('s'); } if (!this.accept(TokenType.BracketR)) { return this.finish(node, ParseError.RightSquareBracketExpected); } return this.finish(node); }; Parser.prototype._parsePseudo = function () { var _this = this; var node = this._tryParsePseudoIdentifier(); if (node) { if (!this.hasWhitespace() && this.accept(TokenType.ParenthesisL)) { var tryAsSelector = function () { var selectors = _this.create(Node); if (!selectors.addChild(_this._parseSelector(false))) { return null; } while (_this.accept(TokenType.Comma) && selectors.addChild(_this._parseSelector(false))) { } if (_this.peek(TokenType.ParenthesisR)) { return _this.finish(selectors); } return null; }; node.addChild(this.try(tryAsSelector) || this._parseBinaryExpr()); if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } } return this.finish(node); } return null; }; Parser.prototype._tryParsePseudoIdentifier = function () { if (!this.peek(TokenType.Colon)) { return null; } var pos = this.mark(); var node = this.createNode(NodeType.PseudoSelector); this.consumeToken(); if (this.hasWhitespace()) { this.restoreAtMark(pos); return null; } this.accept(TokenType.Colon); if (this.hasWhitespace() || !node.addChild(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); } return this.finish(node); }; Parser.prototype._tryParsePrio = function () { var mark = this.mark(); var prio = this._parsePrio(); if (prio) { return prio; } this.restoreAtMark(mark); return null; }; Parser.prototype._parsePrio = function () { if (!this.peek(TokenType.Exclamation)) { return null; } var node = this.createNode(NodeType.Prio); if (this.accept(TokenType.Exclamation) && this.acceptIdent('important')) { return this.finish(node); } return null; }; Parser.prototype._parseExpr = function (stopOnComma) { if (stopOnComma === void 0) { stopOnComma = false; } var node = this.create(Expression); if (!node.addChild(this._parseBinaryExpr())) { return null; } while (true) { if (this.peek(TokenType.Comma)) { if (stopOnComma) { return this.finish(node); } this.consumeToken(); } if (!node.addChild(this._parseBinaryExpr())) { break; } } return this.finish(node); }; Parser.prototype._parseNamedLine = function () { if (!this.peek(TokenType.BracketL)) { return null; } var node = this.createNode(NodeType.GridLine); this.consumeToken(); while (node.addChild(this._parseIdent())) { } if (!this.accept(TokenType.BracketR)) { return this.finish(node, ParseError.RightSquareBracketExpected); } return this.finish(node); }; Parser.prototype._parseBinaryExpr = function (preparsedLeft, preparsedOper) { var node = this.create(BinaryExpression); if (!node.setLeft((preparsedLeft || this._parseTerm()))) { return null; } if (!node.setOperator(preparsedOper || this._parseOperator())) { return this.finish(node); } if (!node.setRight(this._parseTerm())) { return this.finish(node, ParseError.TermExpected); } node = this.finish(node); var operator = this._parseOperator(); if (operator) { node = this._parseBinaryExpr(node, operator); } return this.finish(node); }; Parser.prototype._parseTerm = function () { var node = this.create(Term); node.setOperator(this._parseUnaryOperator()); if (node.setExpression(this._parseTermExpression())) { return this.finish(node); } return null; }; Parser.prototype._parseTermExpression = function () { return this._parseURILiteral() || this._parseFunction() || this._parseIdent() || this._parseStringLiteral() || this._parseNumeric() || this._parseHexColor() || this._parseOperation() || this._parseNamedLine(); }; Parser.prototype._parseOperation = function () { if (!this.peek(TokenType.ParenthesisL)) { return null; } var node = this.create(Node); this.consumeToken(); node.addChild(this._parseExpr()); if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); }; Parser.prototype._parseNumeric = function () { if (this.peek(TokenType.Num) || this.peek(TokenType.Percentage) || this.peek(TokenType.Resolution) || this.peek(TokenType.Length) || this.peek(TokenType.EMS) || this.peek(TokenType.EXS) || this.peek(TokenType.Angle) || this.peek(TokenType.Time) || this.peek(TokenType.Dimension) || this.peek(TokenType.Freq)) { var node = this.create(NumericValue); this.consumeToken(); return this.finish(node); } return null; }; Parser.prototype._parseStringLiteral = function () { if (!this.peek(TokenType.String) && !this.peek(TokenType.BadString)) { return null; } var node = this.createNode(NodeType.StringLiteral); this.consumeToken(); return this.finish(node); }; Parser.prototype._parseURILiteral = function () { if (!this.peekRegExp(TokenType.Ident, /^url(-prefix)?$/i)) { return null; } var pos = this.mark(); var node = this.createNode(NodeType.URILiteral); this.accept(TokenType.Ident); if (this.hasWhitespace() || !this.peek(TokenType.ParenthesisL)) { this.restoreAtMark(pos); return null; } this.scanner.inURL = true; this.consumeToken(); node.addChild(this._parseURLArgument()); this.scanner.inURL = false; if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); }; Parser.prototype._parseURLArgument = function () { var node = this.create(Node); if (!this.accept(TokenType.String) && !this.accept(TokenType.BadString) && !this.acceptUnquotedString()) { return null; } return this.finish(node); }; Parser.prototype._parseIdent = function (referenceTypes) { if (!this.peek(TokenType.Ident)) { return null; } var node = this.create(Identifier); if (referenceTypes) { node.referenceTypes = referenceTypes; } node.isCustomProperty = this.peekRegExp(TokenType.Ident, /^--/); this.consumeToken(); return this.finish(node); }; Parser.prototype._parseFunction = function () { var pos = this.mark(); var node = this.create(Function$1); if (!node.setIdentifier(this._parseFunctionIdentifier())) { return null; } if (this.hasWhitespace() || !this.accept(TokenType.ParenthesisL)) { this.restoreAtMark(pos); return null; } if (node.getArguments().addChild(this._parseFunctionArgument())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseFunctionArgument())) { this.markError(node, ParseError.ExpressionExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); }; Parser.prototype._parseFunctionIdentifier = function () { if (!this.peek(TokenType.Ident)) { return null; } var node = this.create(Identifier); node.referenceTypes = [ReferenceType.Function]; if (this.acceptIdent('progid')) { if (this.accept(TokenType.Colon)) { while (this.accept(TokenType.Ident) && this.acceptDelim('.')) { } } return this.finish(node); } this.consumeToken(); return this.finish(node); }; Parser.prototype._parseFunctionArgument = function () { var node = this.create(FunctionArgument); if (node.setValue(this._parseExpr(true))) { return this.finish(node); } return null; }; Parser.prototype._parseHexColor = function () { if (this.peekRegExp(TokenType.Hash, /^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/g)) { var node = this.create(HexColorValue); this.consumeToken(); return this.finish(node); } else { return null; } }; return Parser; }()); function findFirst(array, p) { var low = 0, high = array.length; if (high === 0) { return 0; } while (low < high) { var mid = Math.floor((low + high) / 2); if (p(array[mid])) { high = mid; } else { low = mid + 1; } } return low; } function includes(array, item) { return array.indexOf(item) !== -1; } function union() { var arrays = []; for (var _i = 0; _i < arguments.length; _i++) { arrays[_i] = arguments[_i]; } var result = []; for (var _a = 0, arrays_1 = arrays; _a < arrays_1.length; _a++) { var array = arrays_1[_a]; for (var _b = 0, array_1 = array; _b < array_1.length; _b++) { var item = array_1[_b]; if (!includes(result, item)) { result.push(item); } } } return result; } var __extends$8 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var Scope$1 = (function () { function Scope(offset, length) { this.offset = offset; this.length = length; this.symbols = []; this.parent = null; this.children = []; } Scope.prototype.addChild = function (scope) { this.children.push(scope); scope.setParent(this); }; Scope.prototype.setParent = function (scope) { this.parent = scope; }; Scope.prototype.findScope = function (offset, length) { if (length === void 0) { length = 0; } if (this.offset <= offset && this.offset + this.length > offset + length || this.offset === offset && this.length === length) { return this.findInScope(offset, length); } return null; }; Scope.prototype.findInScope = function (offset, length) { if (length === void 0) { length = 0; } var end = offset + length; var idx = findFirst(this.children, function (s) { return s.offset > end; }); if (idx === 0) { return this; } var res = this.children[idx - 1]; if (res.offset <= offset && res.offset + res.length >= offset + length) { return res.findInScope(offset, length); } return this; }; Scope.prototype.addSymbol = function (symbol) { this.symbols.push(symbol); }; Scope.prototype.getSymbol = function (name, type) { for (var index = 0; index < this.symbols.length; index++) { var symbol = this.symbols[index]; if (symbol.name === name && symbol.type === type) { return symbol; } } return null; }; Scope.prototype.getSymbols = function () { return this.symbols; }; return Scope; }()); var GlobalScope = (function (_super) { __extends$8(GlobalScope, _super); function GlobalScope() { return _super.call(this, 0, Number.MAX_VALUE) || this; } return GlobalScope; }(Scope$1)); var Symbol$1 = (function () { function Symbol(name, value, node, type) { this.name = name; this.value = value; this.node = node; this.type = type; } return Symbol; }()); var ScopeBuilder = (function () { function ScopeBuilder(scope) { this.scope = scope; } ScopeBuilder.prototype.addSymbol = function (node, name, value, type) { if (node.offset !== -1) { var current = this.scope.findScope(node.offset, node.length); if (current) { current.addSymbol(new Symbol$1(name, value, node, type)); } } }; ScopeBuilder.prototype.addScope = function (node) { if (node.offset !== -1) { var current = this.scope.findScope(node.offset, node.length); if (current && (current.offset !== node.offset || current.length !== node.length)) { var newScope = new Scope$1(node.offset, node.length); current.addChild(newScope); return newScope; } return current; } return null; }; ScopeBuilder.prototype.addSymbolToChildScope = function (scopeNode, node, name, value, type) { if (scopeNode && scopeNode.offset !== -1) { var current = this.addScope(scopeNode); if (current) { current.addSymbol(new Symbol$1(name, value, node, type)); } } }; ScopeBuilder.prototype.visitNode = function (node) { switch (node.type) { case NodeType.Keyframe: this.addSymbol(node, node.getName(), void 0, ReferenceType.Keyframe); return true; case NodeType.CustomPropertyDeclaration: return this.visitCustomPropertyDeclarationNode(node); case NodeType.VariableDeclaration: return this.visitVariableDeclarationNode(node); case NodeType.Ruleset: return this.visitRuleSet(node); case NodeType.MixinDeclaration: this.addSymbol(node, node.getName(), void 0, ReferenceType.Mixin); return true; case NodeType.FunctionDeclaration: this.addSymbol(node, node.getName(), void 0, ReferenceType.Function); return true; case NodeType.FunctionParameter: { return this.visitFunctionParameterNode(node); } case NodeType.Declarations: this.addScope(node); return true; case NodeType.For: var forNode = node; var scopeNode = forNode.getDeclarations(); if (scopeNode && forNode.variable) { this.addSymbolToChildScope(scopeNode, forNode.variable, forNode.variable.getName(), void 0, ReferenceType.Variable); } return true; case NodeType.Each: { var eachNode = node; var scopeNode_1 = eachNode.getDeclarations(); if (scopeNode_1) { var variables = eachNode.getVariables().getChildren(); for (var _i = 0, variables_1 = variables; _i < variables_1.length; _i++) { var variable = variables_1[_i]; this.addSymbolToChildScope(scopeNode_1, variable, variable.getName(), void 0, ReferenceType.Variable); } } return true; } } return true; }; ScopeBuilder.prototype.visitRuleSet = function (node) { var current = this.scope.findScope(node.offset, node.length); if (current) { for (var _i = 0, _a = node.getSelectors().getChildren(); _i < _a.length; _i++) { var child = _a[_i]; if (child instanceof Selector) { if (child.getChildren().length === 1) { current.addSymbol(new Symbol$1(child.getChild(0).getText(), void 0, child, ReferenceType.Rule)); } } } } return true; }; ScopeBuilder.prototype.visitVariableDeclarationNode = function (node) { var value = node.getValue() ? node.getValue().getText() : void 0; this.addSymbol(node, node.getName(), value, ReferenceType.Variable); return true; }; ScopeBuilder.prototype.visitFunctionParameterNode = function (node) { var scopeNode = node.getParent().getDeclarations(); if (scopeNode) { var valueNode = node.getDefaultValue(); var value = valueNode ? valueNode.getText() : void 0; this.addSymbolToChildScope(scopeNode, node, node.getName(), value, ReferenceType.Variable); } return true; }; ScopeBuilder.prototype.visitCustomPropertyDeclarationNode = function (node) { var value = node.getValue() ? node.getValue().getText() : ''; this.addCSSVariable(node.getProperty(), node.getProperty().getName(), value, ReferenceType.Variable); return true; }; ScopeBuilder.prototype.addCSSVariable = function (node, name, value, type) { if (node.offset !== -1) { this.scope.addSymbol(new Symbol$1(name, value, node, type)); } }; return ScopeBuilder; }()); var Symbols = (function () { function Symbols(node) { this.global = new GlobalScope(); node.acceptVisitor(new ScopeBuilder(this.global)); } Symbols.prototype.findSymbolsAtOffset = function (offset, referenceType) { var scope = this.global.findScope(offset, 0); var result = []; var names = {}; while (scope) { var symbols = scope.getSymbols(); for (var i = 0; i < symbols.length; i++) { var symbol = symbols[i]; if (symbol.type === referenceType && !names[symbol.name]) { result.push(symbol); names[symbol.name] = true; } } scope = scope.parent; } return result; }; Symbols.prototype.internalFindSymbol = function (node, referenceTypes) { var scopeNode = node; if (node.parent instanceof FunctionParameter && node.parent.getParent() instanceof BodyDeclaration) { scopeNode = node.parent.getParent().getDeclarations(); } if (node.parent instanceof FunctionArgument && node.parent.getParent() instanceof Function$1) { var funcId = node.parent.getParent().getIdentifier(); if (funcId) { var functionSymbol = this.internalFindSymbol(funcId, [ReferenceType.Function]); if (functionSymbol) { scopeNode = functionSymbol.node.getDeclarations(); } } } if (!scopeNode) { return null; } var name = node.getText(); var scope = this.global.findScope(scopeNode.offset, scopeNode.length); while (scope) { for (var index = 0; index < referenceTypes.length; index++) { var type = referenceTypes[index]; var symbol = scope.getSymbol(name, type); if (symbol) { return symbol; } } scope = scope.parent; } return null; }; Symbols.prototype.evaluateReferenceTypes = function (node) { if (node instanceof Identifier) { var referenceTypes = node.referenceTypes; if (referenceTypes) { return referenceTypes; } else { if (node.isCustomProperty) { return [ReferenceType.Variable]; } var decl = getParentDeclaration(node); if (decl) { var propertyName = decl.getNonPrefixedPropertyName(); if ((propertyName === 'animation' || propertyName === 'animation-name') && decl.getValue() && decl.getValue().offset === node.offset) { return [ReferenceType.Keyframe]; } } } } else if (node instanceof Variable) { return [ReferenceType.Variable]; } var selector = node.findAParent(NodeType.Selector, NodeType.ExtendsReference); if (selector) { return [ReferenceType.Rule]; } return null; }; Symbols.prototype.findSymbolFromNode = function (node) { if (!node) { return null; } while (node.type === NodeType.Interpolation) { node = node.getParent(); } var referenceTypes = this.evaluateReferenceTypes(node); if (referenceTypes) { return this.internalFindSymbol(node, referenceTypes); } return null; }; Symbols.prototype.matchesSymbol = function (node, symbol) { if (!node) { return false; } while (node.type === NodeType.Interpolation) { node = node.getParent(); } if (!node.matches(symbol.name)) { return false; } var referenceTypes = this.evaluateReferenceTypes(node); if (!referenceTypes || referenceTypes.indexOf(symbol.type) === -1) { return false; } var nodeSymbol = this.internalFindSymbol(node, referenceTypes); return nodeSymbol === symbol; }; Symbols.prototype.findSymbol = function (name, type, offset) { var scope = this.global.findScope(offset); while (scope) { var symbol = scope.getSymbol(name, type); if (symbol) { return symbol; } scope = scope.parent; } return null; }; return Symbols; }()); var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; function dirname(uriString) { return Utils.dirname(URI$1.parse(uriString)).toString(); } function joinPath(uriString) { var paths = []; for (var _i = 1; _i < arguments.length; _i++) { paths[_i - 1] = arguments[_i]; } return Utils.joinPath.apply(Utils, __spreadArray([URI$1.parse(uriString)], paths, false)).toString(); } var __awaiter$3 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator$3 = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var PathCompletionParticipant = (function () { function PathCompletionParticipant(readDirectory) { this.readDirectory = readDirectory; this.literalCompletions = []; this.importCompletions = []; } PathCompletionParticipant.prototype.onCssURILiteralValue = function (context) { this.literalCompletions.push(context); }; PathCompletionParticipant.prototype.onCssImportPath = function (context) { this.importCompletions.push(context); }; PathCompletionParticipant.prototype.computeCompletions = function (document, documentContext) { return __awaiter$3(this, void 0, void 0, function () { var result, _i, _a, literalCompletion, uriValue, fullValue, items, _b, items_1, item, _c, _d, importCompletion, pathValue, fullValue, suggestions, _e, suggestions_1, item; return __generator$3(this, function (_f) { switch (_f.label) { case 0: result = { items: [], isIncomplete: false }; _i = 0, _a = this.literalCompletions; _f.label = 1; case 1: if (!(_i < _a.length)) return [3 , 5]; literalCompletion = _a[_i]; uriValue = literalCompletion.uriValue; fullValue = stripQuotes(uriValue); if (!(fullValue === '.' || fullValue === '..')) return [3 , 2]; result.isIncomplete = true; return [3 , 4]; case 2: return [4 , this.providePathSuggestions(uriValue, literalCompletion.position, literalCompletion.range, document, documentContext)]; case 3: items = _f.sent(); for (_b = 0, items_1 = items; _b < items_1.length; _b++) { item = items_1[_b]; result.items.push(item); } _f.label = 4; case 4: _i++; return [3 , 1]; case 5: _c = 0, _d = this.importCompletions; _f.label = 6; case 6: if (!(_c < _d.length)) return [3 , 10]; importCompletion = _d[_c]; pathValue = importCompletion.pathValue; fullValue = stripQuotes(pathValue); if (!(fullValue === '.' || fullValue === '..')) return [3 , 7]; result.isIncomplete = true; return [3 , 9]; case 7: return [4 , this.providePathSuggestions(pathValue, importCompletion.position, importCompletion.range, document, documentContext)]; case 8: suggestions = _f.sent(); if (document.languageId === 'scss') { suggestions.forEach(function (s) { if (startsWith(s.label, '_') && endsWith(s.label, '.scss')) { if (s.textEdit) { s.textEdit.newText = s.label.slice(1, -5); } else { s.label = s.label.slice(1, -5); } } }); } for (_e = 0, suggestions_1 = suggestions; _e < suggestions_1.length; _e++) { item = suggestions_1[_e]; result.items.push(item); } _f.label = 9; case 9: _c++; return [3 , 6]; case 10: return [2 , result]; } }); }); }; PathCompletionParticipant.prototype.providePathSuggestions = function (pathValue, position, range, document, documentContext) { return __awaiter$3(this, void 0, void 0, function () { var fullValue, isValueQuoted, valueBeforeCursor, currentDocUri, fullValueRange, replaceRange, valueBeforeLastSlash, parentDir, result, infos, _i, infos_1, _a, name, type; return __generator$3(this, function (_b) { switch (_b.label) { case 0: fullValue = stripQuotes(pathValue); isValueQuoted = startsWith(pathValue, "'") || startsWith(pathValue, "\""); valueBeforeCursor = isValueQuoted ? fullValue.slice(0, position.character - (range.start.character + 1)) : fullValue.slice(0, position.character - range.start.character); currentDocUri = document.uri; fullValueRange = isValueQuoted ? shiftRange(range, 1, -1) : range; replaceRange = pathToReplaceRange(valueBeforeCursor, fullValue, fullValueRange); valueBeforeLastSlash = valueBeforeCursor.substring(0, valueBeforeCursor.lastIndexOf('/') + 1); parentDir = documentContext.resolveReference(valueBeforeLastSlash || '.', currentDocUri); if (!parentDir) return [3 , 4]; _b.label = 1; case 1: _b.trys.push([1, 3, , 4]); result = []; return [4 , this.readDirectory(parentDir)]; case 2: infos = _b.sent(); for (_i = 0, infos_1 = infos; _i < infos_1.length; _i++) { _a = infos_1[_i], name = _a[0], type = _a[1]; if (name.charCodeAt(0) !== CharCode_dot && (type === FileType.Directory || joinPath(parentDir, name) !== currentDocUri)) { result.push(createCompletionItem(name, type === FileType.Directory, replaceRange)); } } return [2 , result]; case 3: _b.sent(); return [3 , 4]; case 4: return [2 , []]; } }); }); }; return PathCompletionParticipant; }()); var CharCode_dot = '.'.charCodeAt(0); function stripQuotes(fullValue) { if (startsWith(fullValue, "'") || startsWith(fullValue, "\"")) { return fullValue.slice(1, -1); } else { return fullValue; } } function pathToReplaceRange(valueBeforeCursor, fullValue, fullValueRange) { var replaceRange; var lastIndexOfSlash = valueBeforeCursor.lastIndexOf('/'); if (lastIndexOfSlash === -1) { replaceRange = fullValueRange; } else { var valueAfterLastSlash = fullValue.slice(lastIndexOfSlash + 1); var startPos = shiftPosition(fullValueRange.end, -valueAfterLastSlash.length); var whitespaceIndex = valueAfterLastSlash.indexOf(' '); var endPos = void 0; if (whitespaceIndex !== -1) { endPos = shiftPosition(startPos, whitespaceIndex); } else { endPos = fullValueRange.end; } replaceRange = Range.create(startPos, endPos); } return replaceRange; } function createCompletionItem(name, isDir, replaceRange) { if (isDir) { name = name + '/'; return { label: escapePath(name), kind: CompletionItemKind.Folder, textEdit: TextEdit.replace(replaceRange, escapePath(name)), command: { title: 'Suggest', command: 'editor.action.triggerSuggest' } }; } else { return { label: escapePath(name), kind: CompletionItemKind.File, textEdit: TextEdit.replace(replaceRange, escapePath(name)) }; } } function escapePath(p) { return p.replace(/(\s|\(|\)|,|"|')/g, '\\$1'); } function shiftPosition(pos, offset) { return Position.create(pos.line, pos.character + offset); } function shiftRange(range, startOffset, endOffset) { var start = shiftPosition(range.start, startOffset); var end = shiftPosition(range.end, endOffset); return Range.create(start, end); } var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator$2 = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var localize$8 = main$3.loadMessageBundle(); var SnippetFormat = InsertTextFormat.Snippet; var retriggerCommand = { title: 'Suggest', command: 'editor.action.triggerSuggest' }; var SortTexts; (function (SortTexts) { SortTexts["Enums"] = " "; SortTexts["Normal"] = "d"; SortTexts["VendorPrefixed"] = "x"; SortTexts["Term"] = "y"; SortTexts["Variable"] = "z"; })(SortTexts || (SortTexts = {})); var CSSCompletion = (function () { function CSSCompletion(variablePrefix, lsOptions, cssDataManager) { if (variablePrefix === void 0) { variablePrefix = null; } this.variablePrefix = variablePrefix; this.lsOptions = lsOptions; this.cssDataManager = cssDataManager; this.completionParticipants = []; } CSSCompletion.prototype.configure = function (settings) { this.defaultSettings = settings; }; CSSCompletion.prototype.getSymbolContext = function () { if (!this.symbolContext) { this.symbolContext = new Symbols(this.styleSheet); } return this.symbolContext; }; CSSCompletion.prototype.setCompletionParticipants = function (registeredCompletionParticipants) { this.completionParticipants = registeredCompletionParticipants || []; }; CSSCompletion.prototype.doComplete2 = function (document, position, styleSheet, documentContext, completionSettings) { if (completionSettings === void 0) { completionSettings = this.defaultSettings; } return __awaiter$2(this, void 0, void 0, function () { var participant, contributedParticipants, result, pathCompletionResult; return __generator$2(this, function (_a) { switch (_a.label) { case 0: if (!this.lsOptions.fileSystemProvider || !this.lsOptions.fileSystemProvider.readDirectory) { return [2 , this.doComplete(document, position, styleSheet, completionSettings)]; } participant = new PathCompletionParticipant(this.lsOptions.fileSystemProvider.readDirectory); contributedParticipants = this.completionParticipants; this.completionParticipants = [participant].concat(contributedParticipants); result = this.doComplete(document, position, styleSheet, completionSettings); _a.label = 1; case 1: _a.trys.push([1, , 3, 4]); return [4 , participant.computeCompletions(document, documentContext)]; case 2: pathCompletionResult = _a.sent(); return [2 , { isIncomplete: result.isIncomplete || pathCompletionResult.isIncomplete, items: pathCompletionResult.items.concat(result.items) }]; case 3: this.completionParticipants = contributedParticipants; return [7 ]; case 4: return [2 ]; } }); }); }; CSSCompletion.prototype.doComplete = function (document, position, styleSheet, documentSettings) { this.offset = document.offsetAt(position); this.position = position; this.currentWord = getCurrentWord(document, this.offset); this.defaultReplaceRange = Range.create(Position.create(this.position.line, this.position.character - this.currentWord.length), this.position); this.textDocument = document; this.styleSheet = styleSheet; this.documentSettings = documentSettings; try { var result = { isIncomplete: false, items: [] }; this.nodePath = getNodePath(this.styleSheet, this.offset); for (var i = this.nodePath.length - 1; i >= 0; i--) { var node = this.nodePath[i]; if (node instanceof Property) { this.getCompletionsForDeclarationProperty(node.getParent(), result); } else if (node instanceof Expression) { if (node.parent instanceof Interpolation) { this.getVariableProposals(null, result); } else { this.getCompletionsForExpression(node, result); } } else if (node instanceof SimpleSelector) { var parentRef = node.findAParent(NodeType.ExtendsReference, NodeType.Ruleset); if (parentRef) { if (parentRef.type === NodeType.ExtendsReference) { this.getCompletionsForExtendsReference(parentRef, node, result); } else { var parentRuleSet = parentRef; this.getCompletionsForSelector(parentRuleSet, parentRuleSet && parentRuleSet.isNested(), result); } } } else if (node instanceof FunctionArgument) { this.getCompletionsForFunctionArgument(node, node.getParent(), result); } else if (node instanceof Declarations) { this.getCompletionsForDeclarations(node, result); } else if (node instanceof VariableDeclaration) { this.getCompletionsForVariableDeclaration(node, result); } else if (node instanceof RuleSet) { this.getCompletionsForRuleSet(node, result); } else if (node instanceof Interpolation) { this.getCompletionsForInterpolation(node, result); } else if (node instanceof FunctionDeclaration) { this.getCompletionsForFunctionDeclaration(node, result); } else if (node instanceof MixinReference) { this.getCompletionsForMixinReference(node, result); } else if (node instanceof Function$1) { this.getCompletionsForFunctionArgument(null, node, result); } else if (node instanceof Supports) { this.getCompletionsForSupports(node, result); } else if (node instanceof SupportsCondition) { this.getCompletionsForSupportsCondition(node, result); } else if (node instanceof ExtendsReference) { this.getCompletionsForExtendsReference(node, null, result); } else if (node.type === NodeType.URILiteral) { this.getCompletionForUriLiteralValue(node, result); } else if (node.parent === null) { this.getCompletionForTopLevel(result); } else if (node.type === NodeType.StringLiteral && this.isImportPathParent(node.parent.type)) { this.getCompletionForImportPath(node, result); } else { continue; } if (result.items.length > 0 || this.offset > node.offset) { return this.finalize(result); } } this.getCompletionsForStylesheet(result); if (result.items.length === 0) { if (this.variablePrefix && this.currentWord.indexOf(this.variablePrefix) === 0) { this.getVariableProposals(null, result); } } return this.finalize(result); } finally { this.position = null; this.currentWord = null; this.textDocument = null; this.styleSheet = null; this.symbolContext = null; this.defaultReplaceRange = null; this.nodePath = null; } }; CSSCompletion.prototype.isImportPathParent = function (type) { return type === NodeType.Import; }; CSSCompletion.prototype.finalize = function (result) { return result; }; CSSCompletion.prototype.findInNodePath = function () { var types = []; for (var _i = 0; _i < arguments.length; _i++) { types[_i] = arguments[_i]; } for (var i = this.nodePath.length - 1; i >= 0; i--) { var node = this.nodePath[i]; if (types.indexOf(node.type) !== -1) { return node; } } return null; }; CSSCompletion.prototype.getCompletionsForDeclarationProperty = function (declaration, result) { return this.getPropertyProposals(declaration, result); }; CSSCompletion.prototype.getPropertyProposals = function (declaration, result) { var _this = this; var triggerPropertyValueCompletion = this.isTriggerPropertyValueCompletionEnabled; var completePropertyWithSemicolon = this.isCompletePropertyWithSemicolonEnabled; var properties = this.cssDataManager.getProperties(); properties.forEach(function (entry) { var range; var insertText; var retrigger = false; if (declaration) { range = _this.getCompletionRange(declaration.getProperty()); insertText = entry.name; if (!isDefined(declaration.colonPosition)) { insertText += ': '; retrigger = true; } } else { range = _this.getCompletionRange(null); insertText = entry.name + ': '; retrigger = true; } if (!declaration && completePropertyWithSemicolon) { insertText += '$0;'; } if (declaration && !declaration.semicolonPosition) { if (completePropertyWithSemicolon && _this.offset >= _this.textDocument.offsetAt(range.end)) { insertText += '$0;'; } } var item = { label: entry.name, documentation: getEntryDescription(entry, _this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [CompletionItemTag.Deprecated] : [], textEdit: TextEdit.replace(range, insertText), insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Property }; if (!entry.restrictions) { retrigger = false; } if (triggerPropertyValueCompletion && retrigger) { item.command = retriggerCommand; } var relevance = typeof entry.relevance === 'number' ? Math.min(Math.max(entry.relevance, 0), 99) : 50; var sortTextSuffix = (255 - relevance).toString(16); var sortTextPrefix = startsWith(entry.name, '-') ? SortTexts.VendorPrefixed : SortTexts.Normal; item.sortText = sortTextPrefix + '_' + sortTextSuffix; result.items.push(item); }); this.completionParticipants.forEach(function (participant) { if (participant.onCssProperty) { participant.onCssProperty({ propertyName: _this.currentWord, range: _this.defaultReplaceRange }); } }); return result; }; Object.defineProperty(CSSCompletion.prototype, "isTriggerPropertyValueCompletionEnabled", { get: function () { var _a, _b; return (_b = (_a = this.documentSettings) === null || _a === void 0 ? void 0 : _a.triggerPropertyValueCompletion) !== null && _b !== void 0 ? _b : true; }, enumerable: false, configurable: true }); Object.defineProperty(CSSCompletion.prototype, "isCompletePropertyWithSemicolonEnabled", { get: function () { var _a, _b; return (_b = (_a = this.documentSettings) === null || _a === void 0 ? void 0 : _a.completePropertyWithSemicolon) !== null && _b !== void 0 ? _b : true; }, enumerable: false, configurable: true }); CSSCompletion.prototype.getCompletionsForDeclarationValue = function (node, result) { var _this = this; var propertyName = node.getFullPropertyName(); var entry = this.cssDataManager.getProperty(propertyName); var existingNode = node.getValue() || null; while (existingNode && existingNode.hasChildren()) { existingNode = existingNode.findChildAtOffset(this.offset, false); } this.completionParticipants.forEach(function (participant) { if (participant.onCssPropertyValue) { participant.onCssPropertyValue({ propertyName: propertyName, propertyValue: _this.currentWord, range: _this.getCompletionRange(existingNode) }); } }); if (entry) { if (entry.restrictions) { for (var _i = 0, _a = entry.restrictions; _i < _a.length; _i++) { var restriction = _a[_i]; switch (restriction) { case 'color': this.getColorProposals(entry, existingNode, result); break; case 'position': this.getPositionProposals(entry, existingNode, result); break; case 'repeat': this.getRepeatStyleProposals(entry, existingNode, result); break; case 'line-style': this.getLineStyleProposals(entry, existingNode, result); break; case 'line-width': this.getLineWidthProposals(entry, existingNode, result); break; case 'geometry-box': this.getGeometryBoxProposals(entry, existingNode, result); break; case 'box': this.getBoxProposals(entry, existingNode, result); break; case 'image': this.getImageProposals(entry, existingNode, result); break; case 'timing-function': this.getTimingFunctionProposals(entry, existingNode, result); break; case 'shape': this.getBasicShapeProposals(entry, existingNode, result); break; } } } this.getValueEnumProposals(entry, existingNode, result); this.getCSSWideKeywordProposals(entry, existingNode, result); this.getUnitProposals(entry, existingNode, result); } else { var existingValues = collectValues(this.styleSheet, node); for (var _b = 0, _c = existingValues.getEntries(); _b < _c.length; _b++) { var existingValue = _c[_b]; result.items.push({ label: existingValue, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), existingValue), kind: CompletionItemKind.Value }); } } this.getVariableProposals(existingNode, result); this.getTermProposals(entry, existingNode, result); return result; }; CSSCompletion.prototype.getValueEnumProposals = function (entry, existingNode, result) { if (entry.values) { for (var _i = 0, _a = entry.values; _i < _a.length; _i++) { var value = _a[_i]; var insertString = value.name; var insertTextFormat = void 0; if (endsWith(insertString, ')')) { var from = insertString.lastIndexOf('('); if (from !== -1) { insertString = insertString.substr(0, from) + '($1)'; insertTextFormat = SnippetFormat; } } var sortText = SortTexts.Enums; if (startsWith(value.name, '-')) { sortText += SortTexts.VendorPrefixed; } var item = { label: value.name, documentation: getEntryDescription(value, this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [CompletionItemTag.Deprecated] : [], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertString), sortText: sortText, kind: CompletionItemKind.Value, insertTextFormat: insertTextFormat }; result.items.push(item); } } return result; }; CSSCompletion.prototype.getCSSWideKeywordProposals = function (entry, existingNode, result) { for (var keywords in cssWideKeywords) { result.items.push({ label: keywords, documentation: cssWideKeywords[keywords], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), keywords), kind: CompletionItemKind.Value }); } for (var func in cssWideFunctions) { var insertText = moveCursorInsideParenthesis(func); result.items.push({ label: func, documentation: cssWideFunctions[func], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Function, insertTextFormat: SnippetFormat, command: startsWith(func, 'var') ? retriggerCommand : undefined }); } return result; }; CSSCompletion.prototype.getCompletionsForInterpolation = function (node, result) { if (this.offset >= node.offset + 2) { this.getVariableProposals(null, result); } return result; }; CSSCompletion.prototype.getVariableProposals = function (existingNode, result) { var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, ReferenceType.Variable); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; var insertText = startsWith(symbol.name, '--') ? "var(".concat(symbol.name, ")") : symbol.name; var completionItem = { label: symbol.name, documentation: symbol.value ? getLimitedString(symbol.value) : symbol.value, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Variable, sortText: SortTexts.Variable }; if (typeof completionItem.documentation === 'string' && isColorString(completionItem.documentation)) { completionItem.kind = CompletionItemKind.Color; } if (symbol.node.type === NodeType.FunctionParameter) { var mixinNode = (symbol.node.getParent()); if (mixinNode.type === NodeType.MixinDeclaration) { completionItem.detail = localize$8('completion.argument', 'argument from \'{0}\'', mixinNode.getName()); } } result.items.push(completionItem); } return result; }; CSSCompletion.prototype.getVariableProposalsForCSSVarFunction = function (result) { var allReferencedVariables = new Set$1(); this.styleSheet.acceptVisitor(new VariableCollector(allReferencedVariables, this.offset)); var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, ReferenceType.Variable); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; if (startsWith(symbol.name, '--')) { var completionItem = { label: symbol.name, documentation: symbol.value ? getLimitedString(symbol.value) : symbol.value, textEdit: TextEdit.replace(this.getCompletionRange(null), symbol.name), kind: CompletionItemKind.Variable }; if (typeof completionItem.documentation === 'string' && isColorString(completionItem.documentation)) { completionItem.kind = CompletionItemKind.Color; } result.items.push(completionItem); } allReferencedVariables.remove(symbol.name); } for (var _a = 0, _b = allReferencedVariables.getEntries(); _a < _b.length; _a++) { var name = _b[_a]; if (startsWith(name, '--')) { var completionItem = { label: name, textEdit: TextEdit.replace(this.getCompletionRange(null), name), kind: CompletionItemKind.Variable }; result.items.push(completionItem); } } return result; }; CSSCompletion.prototype.getUnitProposals = function (entry, existingNode, result) { var currentWord = '0'; if (this.currentWord.length > 0) { var numMatch = this.currentWord.match(/^-?\d[\.\d+]*/); if (numMatch) { currentWord = numMatch[0]; result.isIncomplete = currentWord.length === this.currentWord.length; } } else if (this.currentWord.length === 0) { result.isIncomplete = true; } if (existingNode && existingNode.parent && existingNode.parent.type === NodeType.Term) { existingNode = existingNode.getParent(); } if (entry.restrictions) { for (var _i = 0, _a = entry.restrictions; _i < _a.length; _i++) { var restriction = _a[_i]; var units$1 = units[restriction]; if (units$1) { for (var _b = 0, units_1 = units$1; _b < units_1.length; _b++) { var unit = units_1[_b]; var insertText = currentWord + unit; result.items.push({ label: insertText, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Unit }); } } } } return result; }; CSSCompletion.prototype.getCompletionRange = function (existingNode) { if (existingNode && existingNode.offset <= this.offset && this.offset <= existingNode.end) { var end = existingNode.end !== -1 ? this.textDocument.positionAt(existingNode.end) : this.position; var start = this.textDocument.positionAt(existingNode.offset); if (start.line === end.line) { return Range.create(start, end); } } return this.defaultReplaceRange; }; CSSCompletion.prototype.getColorProposals = function (entry, existingNode, result) { for (var color in colors) { result.items.push({ label: color, documentation: colors[color], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), color), kind: CompletionItemKind.Color }); } for (var color in colorKeywords) { result.items.push({ label: color, documentation: colorKeywords[color], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), color), kind: CompletionItemKind.Value }); } var colorValues = new Set$1(); this.styleSheet.acceptVisitor(new ColorValueCollector(colorValues, this.offset)); for (var _i = 0, _a = colorValues.getEntries(); _i < _a.length; _i++) { var color = _a[_i]; result.items.push({ label: color, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), color), kind: CompletionItemKind.Color }); } var _loop_1 = function (p) { var tabStop = 1; var replaceFunction = function (_match, p1) { return '${' + tabStop++ + ':' + p1 + '}'; }; var insertText = p.func.replace(/\[?\$(\w+)\]?/g, replaceFunction); result.items.push({ label: p.func.substr(0, p.func.indexOf('(')), detail: p.func, documentation: p.desc, textEdit: TextEdit.replace(this_1.getCompletionRange(existingNode), insertText), insertTextFormat: SnippetFormat, kind: CompletionItemKind.Function }); }; var this_1 = this; for (var _b = 0, _c = colorFunctions; _b < _c.length; _b++) { var p = _c[_b]; _loop_1(p); } return result; }; CSSCompletion.prototype.getPositionProposals = function (entry, existingNode, result) { for (var position in positionKeywords) { result.items.push({ label: position, documentation: positionKeywords[position], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), position), kind: CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getRepeatStyleProposals = function (entry, existingNode, result) { for (var repeat in repeatStyleKeywords) { result.items.push({ label: repeat, documentation: repeatStyleKeywords[repeat], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), repeat), kind: CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getLineStyleProposals = function (entry, existingNode, result) { for (var lineStyle in lineStyleKeywords) { result.items.push({ label: lineStyle, documentation: lineStyleKeywords[lineStyle], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), lineStyle), kind: CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getLineWidthProposals = function (entry, existingNode, result) { for (var _i = 0, _a = lineWidthKeywords; _i < _a.length; _i++) { var lineWidth = _a[_i]; result.items.push({ label: lineWidth, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), lineWidth), kind: CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getGeometryBoxProposals = function (entry, existingNode, result) { for (var box in geometryBoxKeywords) { result.items.push({ label: box, documentation: geometryBoxKeywords[box], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), box), kind: CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getBoxProposals = function (entry, existingNode, result) { for (var box in boxKeywords) { result.items.push({ label: box, documentation: boxKeywords[box], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), box), kind: CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getImageProposals = function (entry, existingNode, result) { for (var image in imageFunctions) { var insertText = moveCursorInsideParenthesis(image); result.items.push({ label: image, documentation: imageFunctions[image], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Function, insertTextFormat: image !== insertText ? SnippetFormat : void 0 }); } return result; }; CSSCompletion.prototype.getTimingFunctionProposals = function (entry, existingNode, result) { for (var timing in transitionTimingFunctions) { var insertText = moveCursorInsideParenthesis(timing); result.items.push({ label: timing, documentation: transitionTimingFunctions[timing], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Function, insertTextFormat: timing !== insertText ? SnippetFormat : void 0 }); } return result; }; CSSCompletion.prototype.getBasicShapeProposals = function (entry, existingNode, result) { for (var shape in basicShapeFunctions) { var insertText = moveCursorInsideParenthesis(shape); result.items.push({ label: shape, documentation: basicShapeFunctions[shape], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Function, insertTextFormat: shape !== insertText ? SnippetFormat : void 0 }); } return result; }; CSSCompletion.prototype.getCompletionsForStylesheet = function (result) { var node = this.styleSheet.findFirstChildBeforeOffset(this.offset); if (!node) { return this.getCompletionForTopLevel(result); } if (node instanceof RuleSet) { return this.getCompletionsForRuleSet(node, result); } if (node instanceof Supports) { return this.getCompletionsForSupports(node, result); } return result; }; CSSCompletion.prototype.getCompletionForTopLevel = function (result) { var _this = this; this.cssDataManager.getAtDirectives().forEach(function (entry) { result.items.push({ label: entry.name, textEdit: TextEdit.replace(_this.getCompletionRange(null), entry.name), documentation: getEntryDescription(entry, _this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [CompletionItemTag.Deprecated] : [], kind: CompletionItemKind.Keyword }); }); this.getCompletionsForSelector(null, false, result); return result; }; CSSCompletion.prototype.getCompletionsForRuleSet = function (ruleSet, result) { var declarations = ruleSet.getDeclarations(); var isAfter = declarations && declarations.endsWith('}') && this.offset >= declarations.end; if (isAfter) { return this.getCompletionForTopLevel(result); } var isInSelectors = !declarations || this.offset <= declarations.offset; if (isInSelectors) { return this.getCompletionsForSelector(ruleSet, ruleSet.isNested(), result); } return this.getCompletionsForDeclarations(ruleSet.getDeclarations(), result); }; CSSCompletion.prototype.getCompletionsForSelector = function (ruleSet, isNested, result) { var _this = this; var existingNode = this.findInNodePath(NodeType.PseudoSelector, NodeType.IdentifierSelector, NodeType.ClassSelector, NodeType.ElementNameSelector); if (!existingNode && this.hasCharacterAtPosition(this.offset - this.currentWord.length - 1, ':')) { this.currentWord = ':' + this.currentWord; if (this.hasCharacterAtPosition(this.offset - this.currentWord.length - 1, ':')) { this.currentWord = ':' + this.currentWord; } this.defaultReplaceRange = Range.create(Position.create(this.position.line, this.position.character - this.currentWord.length), this.position); } var pseudoClasses = this.cssDataManager.getPseudoClasses(); pseudoClasses.forEach(function (entry) { var insertText = moveCursorInsideParenthesis(entry.name); var item = { label: entry.name, textEdit: TextEdit.replace(_this.getCompletionRange(existingNode), insertText), documentation: getEntryDescription(entry, _this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [CompletionItemTag.Deprecated] : [], kind: CompletionItemKind.Function, insertTextFormat: entry.name !== insertText ? SnippetFormat : void 0 }; if (startsWith(entry.name, ':-')) { item.sortText = SortTexts.VendorPrefixed; } result.items.push(item); }); var pseudoElements = this.cssDataManager.getPseudoElements(); pseudoElements.forEach(function (entry) { var insertText = moveCursorInsideParenthesis(entry.name); var item = { label: entry.name, textEdit: TextEdit.replace(_this.getCompletionRange(existingNode), insertText), documentation: getEntryDescription(entry, _this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [CompletionItemTag.Deprecated] : [], kind: CompletionItemKind.Function, insertTextFormat: entry.name !== insertText ? SnippetFormat : void 0 }; if (startsWith(entry.name, '::-')) { item.sortText = SortTexts.VendorPrefixed; } result.items.push(item); }); if (!isNested) { for (var _i = 0, _a = html5Tags; _i < _a.length; _i++) { var entry = _a[_i]; result.items.push({ label: entry, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), entry), kind: CompletionItemKind.Keyword }); } for (var _b = 0, _c = svgElements; _b < _c.length; _b++) { var entry = _c[_b]; result.items.push({ label: entry, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), entry), kind: CompletionItemKind.Keyword }); } } var visited = {}; visited[this.currentWord] = true; var docText = this.textDocument.getText(); this.styleSheet.accept(function (n) { if (n.type === NodeType.SimpleSelector && n.length > 0) { var selector = docText.substr(n.offset, n.length); if (selector.charAt(0) === '.' && !visited[selector]) { visited[selector] = true; result.items.push({ label: selector, textEdit: TextEdit.replace(_this.getCompletionRange(existingNode), selector), kind: CompletionItemKind.Keyword }); } return false; } return true; }); if (ruleSet && ruleSet.isNested()) { var selector = ruleSet.getSelectors().findFirstChildBeforeOffset(this.offset); if (selector && ruleSet.getSelectors().getChildren().indexOf(selector) === 0) { this.getPropertyProposals(null, result); } } return result; }; CSSCompletion.prototype.getCompletionsForDeclarations = function (declarations, result) { if (!declarations || this.offset === declarations.offset) { return result; } var node = declarations.findFirstChildBeforeOffset(this.offset); if (!node) { return this.getCompletionsForDeclarationProperty(null, result); } if (node instanceof AbstractDeclaration) { var declaration = node; if (!isDefined(declaration.colonPosition) || this.offset <= declaration.colonPosition) { return this.getCompletionsForDeclarationProperty(declaration, result); } else if ((isDefined(declaration.semicolonPosition) && declaration.semicolonPosition < this.offset)) { if (this.offset === declaration.semicolonPosition + 1) { return result; } return this.getCompletionsForDeclarationProperty(null, result); } if (declaration instanceof Declaration) { return this.getCompletionsForDeclarationValue(declaration, result); } } else if (node instanceof ExtendsReference) { this.getCompletionsForExtendsReference(node, null, result); } else if (this.currentWord && this.currentWord[0] === '@') { this.getCompletionsForDeclarationProperty(null, result); } else if (node instanceof RuleSet) { this.getCompletionsForDeclarationProperty(null, result); } return result; }; CSSCompletion.prototype.getCompletionsForVariableDeclaration = function (declaration, result) { if (this.offset && isDefined(declaration.colonPosition) && this.offset > declaration.colonPosition) { this.getVariableProposals(declaration.getValue(), result); } return result; }; CSSCompletion.prototype.getCompletionsForExpression = function (expression, result) { var parent = expression.getParent(); if (parent instanceof FunctionArgument) { this.getCompletionsForFunctionArgument(parent, parent.getParent(), result); return result; } var declaration = expression.findParent(NodeType.Declaration); if (!declaration) { this.getTermProposals(undefined, null, result); return result; } var node = expression.findChildAtOffset(this.offset, true); if (!node) { return this.getCompletionsForDeclarationValue(declaration, result); } if (node instanceof NumericValue || node instanceof Identifier) { return this.getCompletionsForDeclarationValue(declaration, result); } return result; }; CSSCompletion.prototype.getCompletionsForFunctionArgument = function (arg, func, result) { var identifier = func.getIdentifier(); if (identifier && identifier.matches('var')) { if (!func.getArguments().hasChildren() || func.getArguments().getChild(0) === arg) { this.getVariableProposalsForCSSVarFunction(result); } } return result; }; CSSCompletion.prototype.getCompletionsForFunctionDeclaration = function (decl, result) { var declarations = decl.getDeclarations(); if (declarations && this.offset > declarations.offset && this.offset < declarations.end) { this.getTermProposals(undefined, null, result); } return result; }; CSSCompletion.prototype.getCompletionsForMixinReference = function (ref, result) { var _this = this; var allMixins = this.getSymbolContext().findSymbolsAtOffset(this.offset, ReferenceType.Mixin); for (var _i = 0, allMixins_1 = allMixins; _i < allMixins_1.length; _i++) { var mixinSymbol = allMixins_1[_i]; if (mixinSymbol.node instanceof MixinDeclaration) { result.items.push(this.makeTermProposal(mixinSymbol, mixinSymbol.node.getParameters(), null)); } } var identifierNode = ref.getIdentifier() || null; this.completionParticipants.forEach(function (participant) { if (participant.onCssMixinReference) { participant.onCssMixinReference({ mixinName: _this.currentWord, range: _this.getCompletionRange(identifierNode) }); } }); return result; }; CSSCompletion.prototype.getTermProposals = function (entry, existingNode, result) { var allFunctions = this.getSymbolContext().findSymbolsAtOffset(this.offset, ReferenceType.Function); for (var _i = 0, allFunctions_1 = allFunctions; _i < allFunctions_1.length; _i++) { var functionSymbol = allFunctions_1[_i]; if (functionSymbol.node instanceof FunctionDeclaration) { result.items.push(this.makeTermProposal(functionSymbol, functionSymbol.node.getParameters(), existingNode)); } } return result; }; CSSCompletion.prototype.makeTermProposal = function (symbol, parameters, existingNode) { symbol.node; var params = parameters.getChildren().map(function (c) { return (c instanceof FunctionParameter) ? c.getName() : c.getText(); }); var insertText = symbol.name + '(' + params.map(function (p, index) { return '${' + (index + 1) + ':' + p + '}'; }).join(', ') + ')'; return { label: symbol.name, detail: symbol.name + '(' + params.join(', ') + ')', textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), insertTextFormat: SnippetFormat, kind: CompletionItemKind.Function, sortText: SortTexts.Term }; }; CSSCompletion.prototype.getCompletionsForSupportsCondition = function (supportsCondition, result) { var child = supportsCondition.findFirstChildBeforeOffset(this.offset); if (child) { if (child instanceof Declaration) { if (!isDefined(child.colonPosition) || this.offset <= child.colonPosition) { return this.getCompletionsForDeclarationProperty(child, result); } else { return this.getCompletionsForDeclarationValue(child, result); } } else if (child instanceof SupportsCondition) { return this.getCompletionsForSupportsCondition(child, result); } } if (isDefined(supportsCondition.lParent) && this.offset > supportsCondition.lParent && (!isDefined(supportsCondition.rParent) || this.offset <= supportsCondition.rParent)) { return this.getCompletionsForDeclarationProperty(null, result); } return result; }; CSSCompletion.prototype.getCompletionsForSupports = function (supports, result) { var declarations = supports.getDeclarations(); var inInCondition = !declarations || this.offset <= declarations.offset; if (inInCondition) { var child = supports.findFirstChildBeforeOffset(this.offset); if (child instanceof SupportsCondition) { return this.getCompletionsForSupportsCondition(child, result); } return result; } return this.getCompletionForTopLevel(result); }; CSSCompletion.prototype.getCompletionsForExtendsReference = function (extendsRef, existingNode, result) { return result; }; CSSCompletion.prototype.getCompletionForUriLiteralValue = function (uriLiteralNode, result) { var uriValue; var position; var range; if (!uriLiteralNode.hasChildren()) { uriValue = ''; position = this.position; var emptyURIValuePosition = this.textDocument.positionAt(uriLiteralNode.offset + 'url('.length); range = Range.create(emptyURIValuePosition, emptyURIValuePosition); } else { var uriValueNode = uriLiteralNode.getChild(0); uriValue = uriValueNode.getText(); position = this.position; range = this.getCompletionRange(uriValueNode); } this.completionParticipants.forEach(function (participant) { if (participant.onCssURILiteralValue) { participant.onCssURILiteralValue({ uriValue: uriValue, position: position, range: range }); } }); return result; }; CSSCompletion.prototype.getCompletionForImportPath = function (importPathNode, result) { var _this = this; this.completionParticipants.forEach(function (participant) { if (participant.onCssImportPath) { participant.onCssImportPath({ pathValue: importPathNode.getText(), position: _this.position, range: _this.getCompletionRange(importPathNode) }); } }); return result; }; CSSCompletion.prototype.hasCharacterAtPosition = function (offset, char) { var text = this.textDocument.getText(); return (offset >= 0 && offset < text.length) && text.charAt(offset) === char; }; CSSCompletion.prototype.doesSupportMarkdown = function () { var _a, _b, _c; if (!isDefined(this.supportsMarkdown)) { if (!isDefined(this.lsOptions.clientCapabilities)) { this.supportsMarkdown = true; return this.supportsMarkdown; } var documentationFormat = (_c = (_b = (_a = this.lsOptions.clientCapabilities.textDocument) === null || _a === void 0 ? void 0 : _a.completion) === null || _b === void 0 ? void 0 : _b.completionItem) === null || _c === void 0 ? void 0 : _c.documentationFormat; this.supportsMarkdown = Array.isArray(documentationFormat) && documentationFormat.indexOf(MarkupKind.Markdown) !== -1; } return this.supportsMarkdown; }; return CSSCompletion; }()); function isDeprecated(entry) { if (entry.status && (entry.status === 'nonstandard' || entry.status === 'obsolete')) { return true; } return false; } var Set$1 = (function () { function Set() { this.entries = {}; } Set.prototype.add = function (entry) { this.entries[entry] = true; }; Set.prototype.remove = function (entry) { delete this.entries[entry]; }; Set.prototype.getEntries = function () { return Object.keys(this.entries); }; return Set; }()); function moveCursorInsideParenthesis(text) { return text.replace(/\(\)$/, "($1)"); } function collectValues(styleSheet, declaration) { var fullPropertyName = declaration.getFullPropertyName(); var entries = new Set$1(); function visitValue(node) { if (node instanceof Identifier || node instanceof NumericValue || node instanceof HexColorValue) { entries.add(node.getText()); } return true; } function matchesProperty(decl) { var propertyName = decl.getFullPropertyName(); return fullPropertyName === propertyName; } function vistNode(node) { if (node instanceof Declaration && node !== declaration) { if (matchesProperty(node)) { var value = node.getValue(); if (value) { value.accept(visitValue); } } } return true; } styleSheet.accept(vistNode); return entries; } var ColorValueCollector = (function () { function ColorValueCollector(entries, currentOffset) { this.entries = entries; this.currentOffset = currentOffset; } ColorValueCollector.prototype.visitNode = function (node) { if (node instanceof HexColorValue || (node instanceof Function$1 && isColorConstructor(node))) { if (this.currentOffset < node.offset || node.end < this.currentOffset) { this.entries.add(node.getText()); } } return true; }; return ColorValueCollector; }()); var VariableCollector = (function () { function VariableCollector(entries, currentOffset) { this.entries = entries; this.currentOffset = currentOffset; } VariableCollector.prototype.visitNode = function (node) { if (node instanceof Identifier && node.isCustomProperty) { if (this.currentOffset < node.offset || node.end < this.currentOffset) { this.entries.add(node.getText()); } } return true; }; return VariableCollector; }()); function getCurrentWord(document, offset) { var i = offset - 1; var text = document.getText(); while (i >= 0 && ' \t\n\r":{[()]},*>+'.indexOf(text.charAt(i)) === -1) { i--; } return text.substring(i + 1, offset); } function isColorString(s) { return (s.toLowerCase() in colors) || /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(s); } var __extends$7 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var localize$7 = main$3.loadMessageBundle(); var Element$2 = (function () { function Element() { this.parent = null; this.children = null; this.attributes = null; } Element.prototype.findAttribute = function (name) { if (this.attributes) { for (var _i = 0, _a = this.attributes; _i < _a.length; _i++) { var attribute = _a[_i]; if (attribute.name === name) { return attribute.value; } } } return null; }; Element.prototype.addChild = function (child) { if (child instanceof Element) { child.parent = this; } if (!this.children) { this.children = []; } this.children.push(child); }; Element.prototype.append = function (text) { if (this.attributes) { var last = this.attributes[this.attributes.length - 1]; last.value = last.value + text; } }; Element.prototype.prepend = function (text) { if (this.attributes) { var first = this.attributes[0]; first.value = text + first.value; } }; Element.prototype.findRoot = function () { var curr = this; while (curr.parent && !(curr.parent instanceof RootElement)) { curr = curr.parent; } return curr; }; Element.prototype.removeChild = function (child) { if (this.children) { var index = this.children.indexOf(child); if (index !== -1) { this.children.splice(index, 1); return true; } } return false; }; Element.prototype.addAttr = function (name, value) { if (!this.attributes) { this.attributes = []; } for (var _i = 0, _a = this.attributes; _i < _a.length; _i++) { var attribute = _a[_i]; if (attribute.name === name) { attribute.value += ' ' + value; return; } } this.attributes.push({ name: name, value: value }); }; Element.prototype.clone = function (cloneChildren) { if (cloneChildren === void 0) { cloneChildren = true; } var elem = new Element(); if (this.attributes) { elem.attributes = []; for (var _i = 0, _a = this.attributes; _i < _a.length; _i++) { var attribute = _a[_i]; elem.addAttr(attribute.name, attribute.value); } } if (cloneChildren && this.children) { elem.children = []; for (var index = 0; index < this.children.length; index++) { elem.addChild(this.children[index].clone()); } } return elem; }; Element.prototype.cloneWithParent = function () { var clone = this.clone(false); if (this.parent && !(this.parent instanceof RootElement)) { var parentClone = this.parent.cloneWithParent(); parentClone.addChild(clone); } return clone; }; return Element; }()); var RootElement = (function (_super) { __extends$7(RootElement, _super); function RootElement() { return _super !== null && _super.apply(this, arguments) || this; } return RootElement; }(Element$2)); var LabelElement = (function (_super) { __extends$7(LabelElement, _super); function LabelElement(label) { var _this = _super.call(this) || this; _this.addAttr('name', label); return _this; } return LabelElement; }(Element$2)); var MarkedStringPrinter = (function () { function MarkedStringPrinter(quote) { this.quote = quote; this.result = []; } MarkedStringPrinter.prototype.print = function (element) { this.result = []; if (element instanceof RootElement) { if (element.children) { this.doPrint(element.children, 0); } } else { this.doPrint([element], 0); } var value = this.result.join('\n'); return [{ language: 'html', value: value }]; }; MarkedStringPrinter.prototype.doPrint = function (elements, indent) { for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var element = elements_1[_i]; this.doPrintElement(element, indent); if (element.children) { this.doPrint(element.children, indent + 1); } } }; MarkedStringPrinter.prototype.writeLine = function (level, content) { var indent = new Array(level + 1).join(' '); this.result.push(indent + content); }; MarkedStringPrinter.prototype.doPrintElement = function (element, indent) { var name = element.findAttribute('name'); if (element instanceof LabelElement || name === '\u2026') { this.writeLine(indent, name); return; } var content = ['<']; if (name) { content.push(name); } else { content.push('element'); } if (element.attributes) { for (var _i = 0, _a = element.attributes; _i < _a.length; _i++) { var attr = _a[_i]; if (attr.name !== 'name') { content.push(' '); content.push(attr.name); var value = attr.value; if (value) { content.push('='); content.push(quotes.ensure(value, this.quote)); } } } } content.push('>'); this.writeLine(indent, content.join('')); }; return MarkedStringPrinter; }()); var quotes; (function (quotes) { function ensure(value, which) { return which + remove(value) + which; } quotes.ensure = ensure; function remove(value) { var match = value.match(/^['"](.*)["']$/); if (match) { return match[1]; } return value; } quotes.remove = remove; })(quotes || (quotes = {})); var Specificity = (function () { function Specificity() { this.id = 0; this.attr = 0; this.tag = 0; } return Specificity; }()); function toElement(node, parentElement) { var result = new Element$2(); for (var _i = 0, _a = node.getChildren(); _i < _a.length; _i++) { var child = _a[_i]; switch (child.type) { case NodeType.SelectorCombinator: if (parentElement) { var segments = child.getText().split('&'); if (segments.length === 1) { result.addAttr('name', segments[0]); break; } result = parentElement.cloneWithParent(); if (segments[0]) { var root = result.findRoot(); root.prepend(segments[0]); } for (var i = 1; i < segments.length; i++) { if (i > 1) { var clone = parentElement.cloneWithParent(); result.addChild(clone.findRoot()); result = clone; } result.append(segments[i]); } } break; case NodeType.SelectorPlaceholder: if (child.matches('@at-root')) { return result; } case NodeType.ElementNameSelector: var text = child.getText(); result.addAttr('name', text === '*' ? 'element' : unescape$1(text)); break; case NodeType.ClassSelector: result.addAttr('class', unescape$1(child.getText().substring(1))); break; case NodeType.IdentifierSelector: result.addAttr('id', unescape$1(child.getText().substring(1))); break; case NodeType.MixinDeclaration: result.addAttr('class', child.getName()); break; case NodeType.PseudoSelector: result.addAttr(unescape$1(child.getText()), ''); break; case NodeType.AttributeSelector: var selector = child; var identifier = selector.getIdentifier(); if (identifier) { var expression = selector.getValue(); var operator = selector.getOperator(); var value = void 0; if (expression && operator) { switch (unescape$1(operator.getText())) { case '|=': value = "".concat(quotes.remove(unescape$1(expression.getText())), "-\u2026"); break; case '^=': value = "".concat(quotes.remove(unescape$1(expression.getText())), "\u2026"); break; case '$=': value = "\u2026".concat(quotes.remove(unescape$1(expression.getText()))); break; case '~=': value = " \u2026 ".concat(quotes.remove(unescape$1(expression.getText())), " \u2026 "); break; case '*=': value = "\u2026".concat(quotes.remove(unescape$1(expression.getText())), "\u2026"); break; default: value = quotes.remove(unescape$1(expression.getText())); break; } } result.addAttr(unescape$1(identifier.getText()), value); } break; } } return result; } function unescape$1(content) { var scanner = new Scanner(); scanner.setSource(content); var token = scanner.scanUnquotedString(); if (token) { return token.text; } return content; } var SelectorPrinting = (function () { function SelectorPrinting(cssDataManager) { this.cssDataManager = cssDataManager; } SelectorPrinting.prototype.selectorToMarkedString = function (node) { var root = selectorToElement(node); if (root) { var markedStrings = new MarkedStringPrinter('"').print(root); markedStrings.push(this.selectorToSpecificityMarkedString(node)); return markedStrings; } else { return []; } }; SelectorPrinting.prototype.simpleSelectorToMarkedString = function (node) { var element = toElement(node); var markedStrings = new MarkedStringPrinter('"').print(element); markedStrings.push(this.selectorToSpecificityMarkedString(node)); return markedStrings; }; SelectorPrinting.prototype.isPseudoElementIdentifier = function (text) { var match = text.match(/^::?([\w-]+)/); if (!match) { return false; } return !!this.cssDataManager.getPseudoElement("::" + match[1]); }; SelectorPrinting.prototype.selectorToSpecificityMarkedString = function (node) { var _this = this; var calculateScore = function (node) { var specificity = new Specificity(); elementLoop: for (var _i = 0, _a = node.getChildren(); _i < _a.length; _i++) { var element = _a[_i]; switch (element.type) { case NodeType.IdentifierSelector: specificity.id++; break; case NodeType.ClassSelector: case NodeType.AttributeSelector: specificity.attr++; break; case NodeType.ElementNameSelector: if (element.matches("*")) { break; } specificity.tag++; break; case NodeType.PseudoSelector: var text = element.getText(); if (_this.isPseudoElementIdentifier(text)) { specificity.tag++; break; } if (text.match(/^:where/i)) { continue elementLoop; } if (text.match(/^:(not|has|is)/i) && element.getChildren().length > 0) { var mostSpecificListItem = new Specificity(); for (var _b = 0, _c = element.getChildren(); _b < _c.length; _b++) { var containerElement = _c[_b]; if (containerElement.type === NodeType.Undefined) { containerElement.getChildren(); } for (var _d = 0, _e = containerElement.getChildren(); _d < _e.length; _d++) { var childElement = _e[_d]; var itemSpecificity = calculateScore(childElement); if (itemSpecificity.id > mostSpecificListItem.id) { mostSpecificListItem = itemSpecificity; continue; } else if (itemSpecificity.id < mostSpecificListItem.id) { continue; } if (itemSpecificity.attr > mostSpecificListItem.attr) { mostSpecificListItem = itemSpecificity; continue; } else if (itemSpecificity.attr < mostSpecificListItem.attr) { continue; } if (itemSpecificity.tag > mostSpecificListItem.tag) { mostSpecificListItem = itemSpecificity; continue; } } } specificity.id += mostSpecificListItem.id; specificity.attr += mostSpecificListItem.attr; specificity.tag += mostSpecificListItem.tag; continue elementLoop; } specificity.attr++; break; } if (element.getChildren().length > 0) { var itemSpecificity = calculateScore(element); specificity.id += itemSpecificity.id; specificity.attr += itemSpecificity.attr; specificity.tag += itemSpecificity.tag; } } return specificity; }; var specificity = calculateScore(node); return localize$7('specificity', "[Selector Specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity): ({0}, {1}, {2})", specificity.id, specificity.attr, specificity.tag); }; return SelectorPrinting; }()); var SelectorElementBuilder = (function () { function SelectorElementBuilder(element) { this.prev = null; this.element = element; } SelectorElementBuilder.prototype.processSelector = function (selector) { var parentElement = null; if (!(this.element instanceof RootElement)) { if (selector.getChildren().some(function (c) { return c.hasChildren() && c.getChild(0).type === NodeType.SelectorCombinator; })) { var curr = this.element.findRoot(); if (curr.parent instanceof RootElement) { parentElement = this.element; this.element = curr.parent; this.element.removeChild(curr); this.prev = null; } } } for (var _i = 0, _a = selector.getChildren(); _i < _a.length; _i++) { var selectorChild = _a[_i]; if (selectorChild instanceof SimpleSelector) { if (this.prev instanceof SimpleSelector) { var labelElement = new LabelElement('\u2026'); this.element.addChild(labelElement); this.element = labelElement; } else if (this.prev && (this.prev.matches('+') || this.prev.matches('~')) && this.element.parent) { this.element = this.element.parent; } if (this.prev && this.prev.matches('~')) { this.element.addChild(new LabelElement('\u22EE')); } var thisElement = toElement(selectorChild, parentElement); var root = thisElement.findRoot(); this.element.addChild(root); this.element = thisElement; } if (selectorChild instanceof SimpleSelector || selectorChild.type === NodeType.SelectorCombinatorParent || selectorChild.type === NodeType.SelectorCombinatorShadowPiercingDescendant || selectorChild.type === NodeType.SelectorCombinatorSibling || selectorChild.type === NodeType.SelectorCombinatorAllSiblings) { this.prev = selectorChild; } } }; return SelectorElementBuilder; }()); function isNewSelectorContext(node) { switch (node.type) { case NodeType.MixinDeclaration: case NodeType.Stylesheet: return true; } return false; } function selectorToElement(node) { if (node.matches('@at-root')) { return null; } var root = new RootElement(); var parentRuleSets = []; var ruleSet = node.getParent(); if (ruleSet instanceof RuleSet) { var parent = ruleSet.getParent(); while (parent && !isNewSelectorContext(parent)) { if (parent instanceof RuleSet) { if (parent.getSelectors().matches('@at-root')) { break; } parentRuleSets.push(parent); } parent = parent.getParent(); } } var builder = new SelectorElementBuilder(root); for (var i = parentRuleSets.length - 1; i >= 0; i--) { var selector = parentRuleSets[i].getSelectors().getChild(0); if (selector) { builder.processSelector(selector); } } builder.processSelector(node); return root; } var CSSHover = (function () { function CSSHover(clientCapabilities, cssDataManager) { this.clientCapabilities = clientCapabilities; this.cssDataManager = cssDataManager; this.selectorPrinting = new SelectorPrinting(cssDataManager); } CSSHover.prototype.configure = function (settings) { this.defaultSettings = settings; }; CSSHover.prototype.doHover = function (document, position, stylesheet, settings) { if (settings === void 0) { settings = this.defaultSettings; } function getRange(node) { return Range.create(document.positionAt(node.offset), document.positionAt(node.end)); } var offset = document.offsetAt(position); var nodepath = getNodePath(stylesheet, offset); var hover = null; for (var i = 0; i < nodepath.length; i++) { var node = nodepath[i]; if (node instanceof Selector) { hover = { contents: this.selectorPrinting.selectorToMarkedString(node), range: getRange(node) }; break; } if (node instanceof SimpleSelector) { if (!startsWith(node.getText(), '@')) { hover = { contents: this.selectorPrinting.simpleSelectorToMarkedString(node), range: getRange(node) }; } break; } if (node instanceof Declaration) { var propertyName = node.getFullPropertyName(); var entry = this.cssDataManager.getProperty(propertyName); if (entry) { var contents = getEntryDescription(entry, this.doesSupportMarkdown(), settings); if (contents) { hover = { contents: contents, range: getRange(node) }; } else { hover = null; } } continue; } if (node instanceof UnknownAtRule) { var atRuleName = node.getText(); var entry = this.cssDataManager.getAtDirective(atRuleName); if (entry) { var contents = getEntryDescription(entry, this.doesSupportMarkdown(), settings); if (contents) { hover = { contents: contents, range: getRange(node) }; } else { hover = null; } } continue; } if (node instanceof Node && node.type === NodeType.PseudoSelector) { var selectorName = node.getText(); var entry = selectorName.slice(0, 2) === '::' ? this.cssDataManager.getPseudoElement(selectorName) : this.cssDataManager.getPseudoClass(selectorName); if (entry) { var contents = getEntryDescription(entry, this.doesSupportMarkdown(), settings); if (contents) { hover = { contents: contents, range: getRange(node) }; } else { hover = null; } } continue; } } if (hover) { hover.contents = this.convertContents(hover.contents); } return hover; }; CSSHover.prototype.convertContents = function (contents) { if (!this.doesSupportMarkdown()) { if (typeof contents === 'string') { return contents; } else if ('kind' in contents) { return { kind: 'plaintext', value: contents.value }; } else if (Array.isArray(contents)) { return contents.map(function (c) { return typeof c === 'string' ? c : c.value; }); } else { return contents.value; } } return contents; }; CSSHover.prototype.doesSupportMarkdown = function () { if (!isDefined(this.supportsMarkdown)) { if (!isDefined(this.clientCapabilities)) { this.supportsMarkdown = true; return this.supportsMarkdown; } var hover = this.clientCapabilities.textDocument && this.clientCapabilities.textDocument.hover; this.supportsMarkdown = hover && hover.contentFormat && Array.isArray(hover.contentFormat) && hover.contentFormat.indexOf(MarkupKind.Markdown) !== -1; } return this.supportsMarkdown; }; return CSSHover; }()); var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator$1 = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var localize$6 = main$3.loadMessageBundle(); var startsWithSchemeRegex = /^\w+:\/\//; var startsWithData = /^data:/; var CSSNavigation = (function () { function CSSNavigation(fileSystemProvider, resolveModuleReferences) { this.fileSystemProvider = fileSystemProvider; this.resolveModuleReferences = resolveModuleReferences; } CSSNavigation.prototype.findDefinition = function (document, position, stylesheet) { var symbols = new Symbols(stylesheet); var offset = document.offsetAt(position); var node = getNodeAtOffset(stylesheet, offset); if (!node) { return null; } var symbol = symbols.findSymbolFromNode(node); if (!symbol) { return null; } return { uri: document.uri, range: getRange(symbol.node, document) }; }; CSSNavigation.prototype.findReferences = function (document, position, stylesheet) { var highlights = this.findDocumentHighlights(document, position, stylesheet); return highlights.map(function (h) { return { uri: document.uri, range: h.range }; }); }; CSSNavigation.prototype.findDocumentHighlights = function (document, position, stylesheet) { var result = []; var offset = document.offsetAt(position); var node = getNodeAtOffset(stylesheet, offset); if (!node || node.type === NodeType.Stylesheet || node.type === NodeType.Declarations) { return result; } if (node.type === NodeType.Identifier && node.parent && node.parent.type === NodeType.ClassSelector) { node = node.parent; } var symbols = new Symbols(stylesheet); var symbol = symbols.findSymbolFromNode(node); var name = node.getText(); stylesheet.accept(function (candidate) { if (symbol) { if (symbols.matchesSymbol(candidate, symbol)) { result.push({ kind: getHighlightKind(candidate), range: getRange(candidate, document) }); return false; } } else if (node && node.type === candidate.type && candidate.matches(name)) { result.push({ kind: getHighlightKind(candidate), range: getRange(candidate, document) }); } return true; }); return result; }; CSSNavigation.prototype.isRawStringDocumentLinkNode = function (node) { return node.type === NodeType.Import; }; CSSNavigation.prototype.findDocumentLinks = function (document, stylesheet, documentContext) { var linkData = this.findUnresolvedLinks(document, stylesheet); var resolvedLinks = []; for (var _i = 0, linkData_1 = linkData; _i < linkData_1.length; _i++) { var data = linkData_1[_i]; var link = data.link; var target = link.target; if (!target || startsWithData.test(target)) ; else if (startsWithSchemeRegex.test(target)) { resolvedLinks.push(link); } else { var resolved = documentContext.resolveReference(target, document.uri); if (resolved) { link.target = resolved; } resolvedLinks.push(link); } } return resolvedLinks; }; CSSNavigation.prototype.findDocumentLinks2 = function (document, stylesheet, documentContext) { return __awaiter$1(this, void 0, void 0, function () { var linkData, resolvedLinks, _i, linkData_2, data, link, target, resolvedTarget; return __generator$1(this, function (_a) { switch (_a.label) { case 0: linkData = this.findUnresolvedLinks(document, stylesheet); resolvedLinks = []; _i = 0, linkData_2 = linkData; _a.label = 1; case 1: if (!(_i < linkData_2.length)) return [3 , 6]; data = linkData_2[_i]; link = data.link; target = link.target; if (!(!target || startsWithData.test(target))) return [3 , 2]; return [3 , 5]; case 2: if (!startsWithSchemeRegex.test(target)) return [3 , 3]; resolvedLinks.push(link); return [3 , 5]; case 3: return [4 , this.resolveRelativeReference(target, document.uri, documentContext, data.isRawLink)]; case 4: resolvedTarget = _a.sent(); if (resolvedTarget !== undefined) { link.target = resolvedTarget; resolvedLinks.push(link); } _a.label = 5; case 5: _i++; return [3 , 1]; case 6: return [2 , resolvedLinks]; } }); }); }; CSSNavigation.prototype.findUnresolvedLinks = function (document, stylesheet) { var _this = this; var result = []; var collect = function (uriStringNode) { var rawUri = uriStringNode.getText(); var range = getRange(uriStringNode, document); if (range.start.line === range.end.line && range.start.character === range.end.character) { return; } if (startsWith(rawUri, "'") || startsWith(rawUri, "\"")) { rawUri = rawUri.slice(1, -1); } var isRawLink = uriStringNode.parent ? _this.isRawStringDocumentLinkNode(uriStringNode.parent) : false; result.push({ link: { target: rawUri, range: range }, isRawLink: isRawLink }); }; stylesheet.accept(function (candidate) { if (candidate.type === NodeType.URILiteral) { var first = candidate.getChild(0); if (first) { collect(first); } return false; } if (candidate.parent && _this.isRawStringDocumentLinkNode(candidate.parent)) { var rawText = candidate.getText(); if (startsWith(rawText, "'") || startsWith(rawText, "\"")) { collect(candidate); } return false; } return true; }); return result; }; CSSNavigation.prototype.findDocumentSymbols = function (document, stylesheet) { var result = []; stylesheet.accept(function (node) { var entry = { name: null, kind: SymbolKind.Class, location: null }; var locationNode = node; if (node instanceof Selector) { entry.name = node.getText(); locationNode = node.findAParent(NodeType.Ruleset, NodeType.ExtendsReference); if (locationNode) { entry.location = Location.create(document.uri, getRange(locationNode, document)); result.push(entry); } return false; } else if (node instanceof VariableDeclaration) { entry.name = node.getName(); entry.kind = SymbolKind.Variable; } else if (node instanceof MixinDeclaration) { entry.name = node.getName(); entry.kind = SymbolKind.Method; } else if (node instanceof FunctionDeclaration) { entry.name = node.getName(); entry.kind = SymbolKind.Function; } else if (node instanceof Keyframe) { entry.name = localize$6('literal.keyframes', "@keyframes {0}", node.getName()); } else if (node instanceof FontFace) { entry.name = localize$6('literal.fontface', "@font-face"); } else if (node instanceof Media) { var mediaList = node.getChild(0); if (mediaList instanceof Medialist) { entry.name = '@media ' + mediaList.getText(); entry.kind = SymbolKind.Module; } } if (entry.name) { entry.location = Location.create(document.uri, getRange(locationNode, document)); result.push(entry); } return true; }); return result; }; CSSNavigation.prototype.findDocumentColors = function (document, stylesheet) { var result = []; stylesheet.accept(function (node) { var colorInfo = getColorInformation(node, document); if (colorInfo) { result.push(colorInfo); } return true; }); return result; }; CSSNavigation.prototype.getColorPresentations = function (document, stylesheet, color, range) { var result = []; var red256 = Math.round(color.red * 255), green256 = Math.round(color.green * 255), blue256 = Math.round(color.blue * 255); var label; if (color.alpha === 1) { label = "rgb(".concat(red256, ", ").concat(green256, ", ").concat(blue256, ")"); } else { label = "rgba(".concat(red256, ", ").concat(green256, ", ").concat(blue256, ", ").concat(color.alpha, ")"); } result.push({ label: label, textEdit: TextEdit.replace(range, label) }); if (color.alpha === 1) { label = "#".concat(toTwoDigitHex(red256)).concat(toTwoDigitHex(green256)).concat(toTwoDigitHex(blue256)); } else { label = "#".concat(toTwoDigitHex(red256)).concat(toTwoDigitHex(green256)).concat(toTwoDigitHex(blue256)).concat(toTwoDigitHex(Math.round(color.alpha * 255))); } result.push({ label: label, textEdit: TextEdit.replace(range, label) }); var hsl = hslFromColor(color); if (hsl.a === 1) { label = "hsl(".concat(hsl.h, ", ").concat(Math.round(hsl.s * 100), "%, ").concat(Math.round(hsl.l * 100), "%)"); } else { label = "hsla(".concat(hsl.h, ", ").concat(Math.round(hsl.s * 100), "%, ").concat(Math.round(hsl.l * 100), "%, ").concat(hsl.a, ")"); } result.push({ label: label, textEdit: TextEdit.replace(range, label) }); var hwb = hwbFromColor(color); if (hwb.a === 1) { label = "hwb(".concat(hwb.h, " ").concat(Math.round(hwb.w * 100), "% ").concat(Math.round(hwb.b * 100), "%)"); } else { label = "hwb(".concat(hwb.h, " ").concat(Math.round(hwb.w * 100), "% ").concat(Math.round(hwb.b * 100), "% / ").concat(hwb.a, ")"); } result.push({ label: label, textEdit: TextEdit.replace(range, label) }); return result; }; CSSNavigation.prototype.doRename = function (document, position, newName, stylesheet) { var _a; var highlights = this.findDocumentHighlights(document, position, stylesheet); var edits = highlights.map(function (h) { return TextEdit.replace(h.range, newName); }); return { changes: (_a = {}, _a[document.uri] = edits, _a) }; }; CSSNavigation.prototype.resolveModuleReference = function (ref, documentUri, documentContext) { return __awaiter$1(this, void 0, void 0, function () { var moduleName, rootFolderUri, documentFolderUri, modulePath, pathWithinModule; return __generator$1(this, function (_a) { switch (_a.label) { case 0: if (!startsWith(documentUri, 'file://')) return [3 , 2]; moduleName = getModuleNameFromPath(ref); rootFolderUri = documentContext.resolveReference('/', documentUri); documentFolderUri = dirname(documentUri); return [4 , this.resolvePathToModule(moduleName, documentFolderUri, rootFolderUri)]; case 1: modulePath = _a.sent(); if (modulePath) { pathWithinModule = ref.substring(moduleName.length + 1); return [2 , joinPath(modulePath, pathWithinModule)]; } _a.label = 2; case 2: return [2 , undefined]; } }); }); }; CSSNavigation.prototype.resolveRelativeReference = function (ref, documentUri, documentContext, isRawLink) { return __awaiter$1(this, void 0, void 0, function () { var relativeReference, _a; return __generator$1(this, function (_b) { switch (_b.label) { case 0: relativeReference = documentContext.resolveReference(ref, documentUri); if (!(ref[0] === '~' && ref[1] !== '/' && this.fileSystemProvider)) return [3 , 2]; ref = ref.substring(1); return [4 , this.resolveModuleReference(ref, documentUri, documentContext)]; case 1: return [2 , (_b.sent()) || relativeReference]; case 2: if (!this.resolveModuleReferences) return [3 , 7]; _a = relativeReference; if (!_a) return [3 , 4]; return [4 , this.fileExists(relativeReference)]; case 3: _a = (_b.sent()); _b.label = 4; case 4: if (!_a) return [3 , 5]; return [2 , relativeReference]; case 5: return [4 , this.resolveModuleReference(ref, documentUri, documentContext)]; case 6: return [2 , (_b.sent()) || relativeReference]; case 7: return [2 , relativeReference]; } }); }); }; CSSNavigation.prototype.resolvePathToModule = function (_moduleName, documentFolderUri, rootFolderUri) { return __awaiter$1(this, void 0, void 0, function () { var packPath; return __generator$1(this, function (_a) { switch (_a.label) { case 0: packPath = joinPath(documentFolderUri, 'node_modules', _moduleName, 'package.json'); return [4 , this.fileExists(packPath)]; case 1: if (_a.sent()) { return [2 , dirname(packPath)]; } else if (rootFolderUri && documentFolderUri.startsWith(rootFolderUri) && (documentFolderUri.length !== rootFolderUri.length)) { return [2 , this.resolvePathToModule(_moduleName, dirname(documentFolderUri), rootFolderUri)]; } return [2 , undefined]; } }); }); }; CSSNavigation.prototype.fileExists = function (uri) { return __awaiter$1(this, void 0, void 0, function () { var stat; return __generator$1(this, function (_a) { switch (_a.label) { case 0: if (!this.fileSystemProvider) { return [2 , false]; } _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); return [4 , this.fileSystemProvider.stat(uri)]; case 2: stat = _a.sent(); if (stat.type === FileType.Unknown && stat.size === -1) { return [2 , false]; } return [2 , true]; case 3: _a.sent(); return [2 , false]; case 4: return [2 ]; } }); }); }; return CSSNavigation; }()); function getColorInformation(node, document) { var color = getColorValue(node); if (color) { var range = getRange(node, document); return { color: color, range: range }; } return null; } function getRange(node, document) { return Range.create(document.positionAt(node.offset), document.positionAt(node.end)); } function getHighlightKind(node) { if (node.type === NodeType.Selector) { return DocumentHighlightKind.Write; } if (node instanceof Identifier) { if (node.parent && node.parent instanceof Property) { if (node.isCustomProperty) { return DocumentHighlightKind.Write; } } } if (node.parent) { switch (node.parent.type) { case NodeType.FunctionDeclaration: case NodeType.MixinDeclaration: case NodeType.Keyframe: case NodeType.VariableDeclaration: case NodeType.FunctionParameter: return DocumentHighlightKind.Write; } } return DocumentHighlightKind.Read; } function toTwoDigitHex(n) { var r = n.toString(16); return r.length !== 2 ? '0' + r : r; } function getModuleNameFromPath(path) { if (path[0] === '@') { return path.substring(0, path.indexOf('/', path.indexOf('/') + 1)); } return path.substring(0, path.indexOf('/')); } var localize$5 = main$3.loadMessageBundle(); var Warning = Level.Warning; var Error$1 = Level.Error; var Ignore = Level.Ignore; var Rule = (function () { function Rule(id, message, defaultValue) { this.id = id; this.message = message; this.defaultValue = defaultValue; } return Rule; }()); var Setting = (function () { function Setting(id, message, defaultValue) { this.id = id; this.message = message; this.defaultValue = defaultValue; } return Setting; }()); var Rules = { AllVendorPrefixes: new Rule('compatibleVendorPrefixes', localize$5('rule.vendorprefixes.all', "When using a vendor-specific prefix make sure to also include all other vendor-specific properties"), Ignore), IncludeStandardPropertyWhenUsingVendorPrefix: new Rule('vendorPrefix', localize$5('rule.standardvendorprefix.all', "When using a vendor-specific prefix also include the standard property"), Warning), DuplicateDeclarations: new Rule('duplicateProperties', localize$5('rule.duplicateDeclarations', "Do not use duplicate style definitions"), Ignore), EmptyRuleSet: new Rule('emptyRules', localize$5('rule.emptyRuleSets', "Do not use empty rulesets"), Warning), ImportStatemement: new Rule('importStatement', localize$5('rule.importDirective', "Import statements do not load in parallel"), Ignore), BewareOfBoxModelSize: new Rule('boxModel', localize$5('rule.bewareOfBoxModelSize', "Do not use width or height when using padding or border"), Ignore), UniversalSelector: new Rule('universalSelector', localize$5('rule.universalSelector', "The universal selector (*) is known to be slow"), Ignore), ZeroWithUnit: new Rule('zeroUnits', localize$5('rule.zeroWidthUnit', "No unit for zero needed"), Ignore), RequiredPropertiesForFontFace: new Rule('fontFaceProperties', localize$5('rule.fontFaceProperties', "@font-face rule must define 'src' and 'font-family' properties"), Warning), HexColorLength: new Rule('hexColorLength', localize$5('rule.hexColor', "Hex colors must consist of three, four, six or eight hex numbers"), Error$1), ArgsInColorFunction: new Rule('argumentsInColorFunction', localize$5('rule.colorFunction', "Invalid number of parameters"), Error$1), UnknownProperty: new Rule('unknownProperties', localize$5('rule.unknownProperty', "Unknown property."), Warning), UnknownAtRules: new Rule('unknownAtRules', localize$5('rule.unknownAtRules', "Unknown at-rule."), Warning), IEStarHack: new Rule('ieHack', localize$5('rule.ieHack', "IE hacks are only necessary when supporting IE7 and older"), Ignore), UnknownVendorSpecificProperty: new Rule('unknownVendorSpecificProperties', localize$5('rule.unknownVendorSpecificProperty', "Unknown vendor specific property."), Ignore), PropertyIgnoredDueToDisplay: new Rule('propertyIgnoredDueToDisplay', localize$5('rule.propertyIgnoredDueToDisplay', "Property is ignored due to the display."), Warning), AvoidImportant: new Rule('important', localize$5('rule.avoidImportant', "Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored."), Ignore), AvoidFloat: new Rule('float', localize$5('rule.avoidFloat', "Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes."), Ignore), AvoidIdSelector: new Rule('idSelector', localize$5('rule.avoidIdSelector', "Selectors should not contain IDs because these rules are too tightly coupled with the HTML."), Ignore), }; var Settings = { ValidProperties: new Setting('validProperties', localize$5('rule.validProperties', "A list of properties that are not validated against the `unknownProperties` rule."), []) }; var LintConfigurationSettings = (function () { function LintConfigurationSettings(conf) { if (conf === void 0) { conf = {}; } this.conf = conf; } LintConfigurationSettings.prototype.getRule = function (rule) { if (this.conf.hasOwnProperty(rule.id)) { var level = toLevel(this.conf[rule.id]); if (level) { return level; } } return rule.defaultValue; }; LintConfigurationSettings.prototype.getSetting = function (setting) { return this.conf[setting.id]; }; return LintConfigurationSettings; }()); function toLevel(level) { switch (level) { case 'ignore': return Level.Ignore; case 'warning': return Level.Warning; case 'error': return Level.Error; } return null; } var localize$4 = main$3.loadMessageBundle(); var CSSCodeActions = (function () { function CSSCodeActions(cssDataManager) { this.cssDataManager = cssDataManager; } CSSCodeActions.prototype.doCodeActions = function (document, range, context, stylesheet) { return this.doCodeActions2(document, range, context, stylesheet).map(function (ca) { var textDocumentEdit = ca.edit && ca.edit.documentChanges && ca.edit.documentChanges[0]; return Command.create(ca.title, '_css.applyCodeAction', document.uri, document.version, textDocumentEdit && textDocumentEdit.edits); }); }; CSSCodeActions.prototype.doCodeActions2 = function (document, range, context, stylesheet) { var result = []; if (context.diagnostics) { for (var _i = 0, _a = context.diagnostics; _i < _a.length; _i++) { var diagnostic = _a[_i]; this.appendFixesForMarker(document, stylesheet, diagnostic, result); } } return result; }; CSSCodeActions.prototype.getFixesForUnknownProperty = function (document, property, marker, result) { var propertyName = property.getName(); var candidates = []; this.cssDataManager.getProperties().forEach(function (p) { var score = difference(propertyName, p.name); if (score >= propertyName.length / 2 ) { candidates.push({ property: p.name, score: score }); } }); candidates.sort(function (a, b) { return b.score - a.score || a.property.localeCompare(b.property); }); var maxActions = 3; for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { var candidate = candidates_1[_i]; var propertyName_1 = candidate.property; var title = localize$4('css.codeaction.rename', "Rename to '{0}'", propertyName_1); var edit = TextEdit.replace(marker.range, propertyName_1); var documentIdentifier = VersionedTextDocumentIdentifier.create(document.uri, document.version); var workspaceEdit = { documentChanges: [TextDocumentEdit.create(documentIdentifier, [edit])] }; var codeAction = CodeAction.create(title, workspaceEdit, CodeActionKind.QuickFix); codeAction.diagnostics = [marker]; result.push(codeAction); if (--maxActions <= 0) { return; } } }; CSSCodeActions.prototype.appendFixesForMarker = function (document, stylesheet, marker, result) { if (marker.code !== Rules.UnknownProperty.id) { return; } var offset = document.offsetAt(marker.range.start); var end = document.offsetAt(marker.range.end); var nodepath = getNodePath(stylesheet, offset); for (var i = nodepath.length - 1; i >= 0; i--) { var node = nodepath[i]; if (node instanceof Declaration) { var property = node.getProperty(); if (property && property.offset === offset && property.end === end) { this.getFixesForUnknownProperty(document, property, marker, result); return; } } } }; return CSSCodeActions; }()); var Element$1 = (function () { function Element(decl) { this.fullPropertyName = decl.getFullPropertyName().toLowerCase(); this.node = decl; } return Element; }()); function setSide(model, side, value, property) { var state = model[side]; state.value = value; if (value) { if (!includes(state.properties, property)) { state.properties.push(property); } } } function setAllSides(model, value, property) { setSide(model, 'top', value, property); setSide(model, 'right', value, property); setSide(model, 'bottom', value, property); setSide(model, 'left', value, property); } function updateModelWithValue(model, side, value, property) { if (side === 'top' || side === 'right' || side === 'bottom' || side === 'left') { setSide(model, side, value, property); } else { setAllSides(model, value, property); } } function updateModelWithList(model, values, property) { switch (values.length) { case 1: updateModelWithValue(model, undefined, values[0], property); break; case 2: updateModelWithValue(model, 'top', values[0], property); updateModelWithValue(model, 'bottom', values[0], property); updateModelWithValue(model, 'right', values[1], property); updateModelWithValue(model, 'left', values[1], property); break; case 3: updateModelWithValue(model, 'top', values[0], property); updateModelWithValue(model, 'right', values[1], property); updateModelWithValue(model, 'left', values[1], property); updateModelWithValue(model, 'bottom', values[2], property); break; case 4: updateModelWithValue(model, 'top', values[0], property); updateModelWithValue(model, 'right', values[1], property); updateModelWithValue(model, 'bottom', values[2], property); updateModelWithValue(model, 'left', values[3], property); break; } } function matches(value, candidates) { for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { var candidate = candidates_1[_i]; if (value.matches(candidate)) { return true; } } return false; } function checkLineWidth(value, allowsKeywords) { if (allowsKeywords === void 0) { allowsKeywords = true; } if (allowsKeywords && matches(value, ['initial', 'unset'])) { return false; } return parseFloat(value.getText()) !== 0; } function checkLineWidthList(nodes, allowsKeywords) { if (allowsKeywords === void 0) { allowsKeywords = true; } return nodes.map(function (node) { return checkLineWidth(node, allowsKeywords); }); } function checkLineStyle(valueNode, allowsKeywords) { if (allowsKeywords === void 0) { allowsKeywords = true; } if (matches(valueNode, ['none', 'hidden'])) { return false; } if (allowsKeywords && matches(valueNode, ['initial', 'unset'])) { return false; } return true; } function checkLineStyleList(nodes, allowsKeywords) { if (allowsKeywords === void 0) { allowsKeywords = true; } return nodes.map(function (node) { return checkLineStyle(node, allowsKeywords); }); } function checkBorderShorthand(node) { var children = node.getChildren(); if (children.length === 1) { var value = children[0]; return checkLineWidth(value) && checkLineStyle(value); } for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { var child = children_1[_i]; var value = child; if (!checkLineWidth(value, false) || !checkLineStyle(value, false)) { return false; } } return true; } function calculateBoxModel(propertyTable) { var model = { top: { value: false, properties: [] }, right: { value: false, properties: [] }, bottom: { value: false, properties: [] }, left: { value: false, properties: [] }, }; for (var _i = 0, propertyTable_1 = propertyTable; _i < propertyTable_1.length; _i++) { var property = propertyTable_1[_i]; var value = property.node.value; if (typeof value === 'undefined') { continue; } switch (property.fullPropertyName) { case 'box-sizing': return { top: { value: false, properties: [] }, right: { value: false, properties: [] }, bottom: { value: false, properties: [] }, left: { value: false, properties: [] }, }; case 'width': model.width = property; break; case 'height': model.height = property; break; default: var segments = property.fullPropertyName.split('-'); switch (segments[0]) { case 'border': switch (segments[1]) { case undefined: case 'top': case 'right': case 'bottom': case 'left': switch (segments[2]) { case undefined: updateModelWithValue(model, segments[1], checkBorderShorthand(value), property); break; case 'width': updateModelWithValue(model, segments[1], checkLineWidth(value, false), property); break; case 'style': updateModelWithValue(model, segments[1], checkLineStyle(value, true), property); break; } break; case 'width': updateModelWithList(model, checkLineWidthList(value.getChildren(), false), property); break; case 'style': updateModelWithList(model, checkLineStyleList(value.getChildren(), true), property); break; } break; case 'padding': if (segments.length === 1) { updateModelWithList(model, checkLineWidthList(value.getChildren(), true), property); } else { updateModelWithValue(model, segments[1], checkLineWidth(value, true), property); } break; } break; } } return model; } var localize$3 = main$3.loadMessageBundle(); var NodesByRootMap = (function () { function NodesByRootMap() { this.data = {}; } NodesByRootMap.prototype.add = function (root, name, node) { var entry = this.data[root]; if (!entry) { entry = { nodes: [], names: [] }; this.data[root] = entry; } entry.names.push(name); if (node) { entry.nodes.push(node); } }; return NodesByRootMap; }()); var LintVisitor = (function () { function LintVisitor(document, settings, cssDataManager) { var _this = this; this.cssDataManager = cssDataManager; this.warnings = []; this.settings = settings; this.documentText = document.getText(); this.keyframes = new NodesByRootMap(); this.validProperties = {}; var properties = settings.getSetting(Settings.ValidProperties); if (Array.isArray(properties)) { properties.forEach(function (p) { if (typeof p === 'string') { var name = p.trim().toLowerCase(); if (name.length) { _this.validProperties[name] = true; } } }); } } LintVisitor.entries = function (node, document, settings, cssDataManager, entryFilter) { var visitor = new LintVisitor(document, settings, cssDataManager); node.acceptVisitor(visitor); visitor.completeValidations(); return visitor.getEntries(entryFilter); }; LintVisitor.prototype.isValidPropertyDeclaration = function (element) { var propertyName = element.fullPropertyName; return this.validProperties[propertyName]; }; LintVisitor.prototype.fetch = function (input, s) { var elements = []; for (var _i = 0, input_1 = input; _i < input_1.length; _i++) { var curr = input_1[_i]; if (curr.fullPropertyName === s) { elements.push(curr); } } return elements; }; LintVisitor.prototype.fetchWithValue = function (input, s, v) { var elements = []; for (var _i = 0, input_2 = input; _i < input_2.length; _i++) { var inputElement = input_2[_i]; if (inputElement.fullPropertyName === s) { var expression = inputElement.node.getValue(); if (expression && this.findValueInExpression(expression, v)) { elements.push(inputElement); } } } return elements; }; LintVisitor.prototype.findValueInExpression = function (expression, v) { var found = false; expression.accept(function (node) { if (node.type === NodeType.Identifier && node.matches(v)) { found = true; } return !found; }); return found; }; LintVisitor.prototype.getEntries = function (filter) { if (filter === void 0) { filter = (Level.Warning | Level.Error); } return this.warnings.filter(function (entry) { return (entry.getLevel() & filter) !== 0; }); }; LintVisitor.prototype.addEntry = function (node, rule, details) { var entry = new Marker(node, rule, this.settings.getRule(rule), details); this.warnings.push(entry); }; LintVisitor.prototype.getMissingNames = function (expected, actual) { var expectedClone = expected.slice(0); for (var i = 0; i < actual.length; i++) { var k = expectedClone.indexOf(actual[i]); if (k !== -1) { expectedClone[k] = null; } } var result = null; for (var i = 0; i < expectedClone.length; i++) { var curr = expectedClone[i]; if (curr) { if (result === null) { result = localize$3('namelist.single', "'{0}'", curr); } else { result = localize$3('namelist.concatenated', "{0}, '{1}'", result, curr); } } } return result; }; LintVisitor.prototype.visitNode = function (node) { switch (node.type) { case NodeType.UnknownAtRule: return this.visitUnknownAtRule(node); case NodeType.Keyframe: return this.visitKeyframe(node); case NodeType.FontFace: return this.visitFontFace(node); case NodeType.Ruleset: return this.visitRuleSet(node); case NodeType.SimpleSelector: return this.visitSimpleSelector(node); case NodeType.Function: return this.visitFunction(node); case NodeType.NumericValue: return this.visitNumericValue(node); case NodeType.Import: return this.visitImport(node); case NodeType.HexColorValue: return this.visitHexColorValue(node); case NodeType.Prio: return this.visitPrio(node); case NodeType.IdentifierSelector: return this.visitIdentifierSelector(node); } return true; }; LintVisitor.prototype.completeValidations = function () { this.validateKeyframes(); }; LintVisitor.prototype.visitUnknownAtRule = function (node) { var atRuleName = node.getChild(0); if (!atRuleName) { return false; } var atDirective = this.cssDataManager.getAtDirective(atRuleName.getText()); if (atDirective) { return false; } this.addEntry(atRuleName, Rules.UnknownAtRules, "Unknown at rule ".concat(atRuleName.getText())); return true; }; LintVisitor.prototype.visitKeyframe = function (node) { var keyword = node.getKeyword(); if (!keyword) { return false; } var text = keyword.getText(); this.keyframes.add(node.getName(), text, (text !== '@keyframes') ? keyword : null); return true; }; LintVisitor.prototype.validateKeyframes = function () { var expected = ['@-webkit-keyframes', '@-moz-keyframes', '@-o-keyframes']; for (var name in this.keyframes.data) { var actual = this.keyframes.data[name].names; var needsStandard = (actual.indexOf('@keyframes') === -1); if (!needsStandard && actual.length === 1) { continue; } var missingVendorSpecific = this.getMissingNames(expected, actual); if (missingVendorSpecific || needsStandard) { for (var _i = 0, _a = this.keyframes.data[name].nodes; _i < _a.length; _i++) { var node = _a[_i]; if (needsStandard) { var message = localize$3('keyframes.standardrule.missing', "Always define standard rule '@keyframes' when defining keyframes."); this.addEntry(node, Rules.IncludeStandardPropertyWhenUsingVendorPrefix, message); } if (missingVendorSpecific) { var message = localize$3('keyframes.vendorspecific.missing', "Always include all vendor specific rules: Missing: {0}", missingVendorSpecific); this.addEntry(node, Rules.AllVendorPrefixes, message); } } } } return true; }; LintVisitor.prototype.visitSimpleSelector = function (node) { var firstChar = this.documentText.charAt(node.offset); if (node.length === 1 && firstChar === '*') { this.addEntry(node, Rules.UniversalSelector); } return true; }; LintVisitor.prototype.visitIdentifierSelector = function (node) { this.addEntry(node, Rules.AvoidIdSelector); return true; }; LintVisitor.prototype.visitImport = function (node) { this.addEntry(node, Rules.ImportStatemement); return true; }; LintVisitor.prototype.visitRuleSet = function (node) { var declarations = node.getDeclarations(); if (!declarations) { return false; } if (!declarations.hasChildren()) { this.addEntry(node.getSelectors(), Rules.EmptyRuleSet); } var propertyTable = []; for (var _i = 0, _a = declarations.getChildren(); _i < _a.length; _i++) { var element = _a[_i]; if (element instanceof Declaration) { propertyTable.push(new Element$1(element)); } } var boxModel = calculateBoxModel(propertyTable); if (boxModel.width) { var properties = []; if (boxModel.right.value) { properties = union(properties, boxModel.right.properties); } if (boxModel.left.value) { properties = union(properties, boxModel.left.properties); } if (properties.length !== 0) { for (var _b = 0, properties_1 = properties; _b < properties_1.length; _b++) { var item = properties_1[_b]; this.addEntry(item.node, Rules.BewareOfBoxModelSize); } this.addEntry(boxModel.width.node, Rules.BewareOfBoxModelSize); } } if (boxModel.height) { var properties = []; if (boxModel.top.value) { properties = union(properties, boxModel.top.properties); } if (boxModel.bottom.value) { properties = union(properties, boxModel.bottom.properties); } if (properties.length !== 0) { for (var _c = 0, properties_2 = properties; _c < properties_2.length; _c++) { var item = properties_2[_c]; this.addEntry(item.node, Rules.BewareOfBoxModelSize); } this.addEntry(boxModel.height.node, Rules.BewareOfBoxModelSize); } } var displayElems = this.fetchWithValue(propertyTable, 'display', 'inline-block'); if (displayElems.length > 0) { var elem = this.fetch(propertyTable, 'float'); for (var index = 0; index < elem.length; index++) { var node_1 = elem[index].node; var value = node_1.getValue(); if (value && !value.matches('none')) { this.addEntry(node_1, Rules.PropertyIgnoredDueToDisplay, localize$3('rule.propertyIgnoredDueToDisplayInlineBlock', "inline-block is ignored due to the float. If 'float' has a value other than 'none', the box is floated and 'display' is treated as 'block'")); } } } displayElems = this.fetchWithValue(propertyTable, 'display', 'block'); if (displayElems.length > 0) { var elem = this.fetch(propertyTable, 'vertical-align'); for (var index = 0; index < elem.length; index++) { this.addEntry(elem[index].node, Rules.PropertyIgnoredDueToDisplay, localize$3('rule.propertyIgnoredDueToDisplayBlock', "Property is ignored due to the display. With 'display: block', vertical-align should not be used.")); } } var elements = this.fetch(propertyTable, 'float'); for (var index = 0; index < elements.length; index++) { var element = elements[index]; if (!this.isValidPropertyDeclaration(element)) { this.addEntry(element.node, Rules.AvoidFloat); } } for (var i = 0; i < propertyTable.length; i++) { var element = propertyTable[i]; if (element.fullPropertyName !== 'background' && !this.validProperties[element.fullPropertyName]) { var value = element.node.getValue(); if (value && this.documentText.charAt(value.offset) !== '-') { var elements_1 = this.fetch(propertyTable, element.fullPropertyName); if (elements_1.length > 1) { for (var k = 0; k < elements_1.length; k++) { var value_1 = elements_1[k].node.getValue(); if (value_1 && this.documentText.charAt(value_1.offset) !== '-' && elements_1[k] !== element) { this.addEntry(element.node, Rules.DuplicateDeclarations); } } } } } } var isExportBlock = node.getSelectors().matches(":export"); if (!isExportBlock) { var propertiesBySuffix = new NodesByRootMap(); var containsUnknowns = false; for (var _d = 0, propertyTable_1 = propertyTable; _d < propertyTable_1.length; _d++) { var element = propertyTable_1[_d]; var decl = element.node; if (this.isCSSDeclaration(decl)) { var name = element.fullPropertyName; var firstChar = name.charAt(0); if (firstChar === '-') { if (name.charAt(1) !== '-') { if (!this.cssDataManager.isKnownProperty(name) && !this.validProperties[name]) { this.addEntry(decl.getProperty(), Rules.UnknownVendorSpecificProperty); } var nonPrefixedName = decl.getNonPrefixedPropertyName(); propertiesBySuffix.add(nonPrefixedName, name, decl.getProperty()); } } else { var fullName = name; if (firstChar === '*' || firstChar === '_') { this.addEntry(decl.getProperty(), Rules.IEStarHack); name = name.substr(1); } if (!this.cssDataManager.isKnownProperty(fullName) && !this.cssDataManager.isKnownProperty(name)) { if (!this.validProperties[name]) { this.addEntry(decl.getProperty(), Rules.UnknownProperty, localize$3('property.unknownproperty.detailed', "Unknown property: '{0}'", decl.getFullPropertyName())); } } propertiesBySuffix.add(name, name, null); } } else { containsUnknowns = true; } } if (!containsUnknowns) { for (var suffix in propertiesBySuffix.data) { var entry = propertiesBySuffix.data[suffix]; var actual = entry.names; var needsStandard = this.cssDataManager.isStandardProperty(suffix) && (actual.indexOf(suffix) === -1); if (!needsStandard && actual.length === 1) { continue; } var expected = []; for (var i = 0, len = LintVisitor.prefixes.length; i < len; i++) { var prefix = LintVisitor.prefixes[i]; if (this.cssDataManager.isStandardProperty(prefix + suffix)) { expected.push(prefix + suffix); } } var missingVendorSpecific = this.getMissingNames(expected, actual); if (missingVendorSpecific || needsStandard) { for (var _e = 0, _f = entry.nodes; _e < _f.length; _e++) { var node_2 = _f[_e]; if (needsStandard) { var message = localize$3('property.standard.missing', "Also define the standard property '{0}' for compatibility", suffix); this.addEntry(node_2, Rules.IncludeStandardPropertyWhenUsingVendorPrefix, message); } if (missingVendorSpecific) { var message = localize$3('property.vendorspecific.missing', "Always include all vendor specific properties: Missing: {0}", missingVendorSpecific); this.addEntry(node_2, Rules.AllVendorPrefixes, message); } } } } } } return true; }; LintVisitor.prototype.visitPrio = function (node) { this.addEntry(node, Rules.AvoidImportant); return true; }; LintVisitor.prototype.visitNumericValue = function (node) { var funcDecl = node.findParent(NodeType.Function); if (funcDecl && funcDecl.getName() === 'calc') { return true; } var decl = node.findParent(NodeType.Declaration); if (decl) { var declValue = decl.getValue(); if (declValue) { var value = node.getValue(); if (!value.unit || units.length.indexOf(value.unit.toLowerCase()) === -1) { return true; } if (parseFloat(value.value) === 0.0 && !!value.unit && !this.validProperties[decl.getFullPropertyName()]) { this.addEntry(node, Rules.ZeroWithUnit); } } } return true; }; LintVisitor.prototype.visitFontFace = function (node) { var declarations = node.getDeclarations(); if (!declarations) { return false; } var definesSrc = false, definesFontFamily = false; var containsUnknowns = false; for (var _i = 0, _a = declarations.getChildren(); _i < _a.length; _i++) { var node_3 = _a[_i]; if (this.isCSSDeclaration(node_3)) { var name = node_3.getProperty().getName().toLowerCase(); if (name === 'src') { definesSrc = true; } if (name === 'font-family') { definesFontFamily = true; } } else { containsUnknowns = true; } } if (!containsUnknowns && (!definesSrc || !definesFontFamily)) { this.addEntry(node, Rules.RequiredPropertiesForFontFace); } return true; }; LintVisitor.prototype.isCSSDeclaration = function (node) { if (node instanceof Declaration) { if (!node.getValue()) { return false; } var property = node.getProperty(); if (!property) { return false; } var identifier = property.getIdentifier(); if (!identifier || identifier.containsInterpolation()) { return false; } return true; } return false; }; LintVisitor.prototype.visitHexColorValue = function (node) { var length = node.length; if (length !== 9 && length !== 7 && length !== 5 && length !== 4) { this.addEntry(node, Rules.HexColorLength); } return false; }; LintVisitor.prototype.visitFunction = function (node) { var fnName = node.getName().toLowerCase(); var expectedAttrCount = -1; var actualAttrCount = 0; switch (fnName) { case 'rgb(': case 'hsl(': expectedAttrCount = 3; break; case 'rgba(': case 'hsla(': expectedAttrCount = 4; break; } if (expectedAttrCount !== -1) { node.getArguments().accept(function (n) { if (n instanceof BinaryExpression) { actualAttrCount += 1; return false; } return true; }); if (actualAttrCount !== expectedAttrCount) { this.addEntry(node, Rules.ArgsInColorFunction); } } return true; }; LintVisitor.prefixes = [ '-ms-', '-moz-', '-o-', '-webkit-', ]; return LintVisitor; }()); var CSSValidation = (function () { function CSSValidation(cssDataManager) { this.cssDataManager = cssDataManager; } CSSValidation.prototype.configure = function (settings) { this.settings = settings; }; CSSValidation.prototype.doValidation = function (document, stylesheet, settings) { if (settings === void 0) { settings = this.settings; } if (settings && settings.validate === false) { return []; } var entries = []; entries.push.apply(entries, ParseErrorCollector.entries(stylesheet)); entries.push.apply(entries, LintVisitor.entries(stylesheet, document, new LintConfigurationSettings(settings && settings.lint), this.cssDataManager)); var ruleIds = []; for (var r in Rules) { ruleIds.push(Rules[r].id); } function toDiagnostic(marker) { var range = Range.create(document.positionAt(marker.getOffset()), document.positionAt(marker.getOffset() + marker.getLength())); var source = document.languageId; return { code: marker.getRule().id, source: source, message: marker.getMessage(), severity: marker.getLevel() === Level.Warning ? DiagnosticSeverity.Warning : DiagnosticSeverity.Error, range: range }; } return entries.filter(function (entry) { return entry.getLevel() !== Level.Ignore; }).map(toDiagnostic); }; return CSSValidation; }()); var __extends$6 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var _FSL$1 = '/'.charCodeAt(0); var _NWL$1 = '\n'.charCodeAt(0); var _CAR$1 = '\r'.charCodeAt(0); var _LFD$1 = '\f'.charCodeAt(0); var _DLR = '$'.charCodeAt(0); var _HSH = '#'.charCodeAt(0); var _CUL = '{'.charCodeAt(0); var _EQS = '='.charCodeAt(0); var _BNG = '!'.charCodeAt(0); var _LAN = '<'.charCodeAt(0); var _RAN = '>'.charCodeAt(0); var _DOT$1 = '.'.charCodeAt(0); var customTokenValue$1 = TokenType.CustomToken; var VariableName = customTokenValue$1++; var InterpolationFunction = customTokenValue$1++; customTokenValue$1++; var EqualsOperator = customTokenValue$1++; var NotEqualsOperator = customTokenValue$1++; var GreaterEqualsOperator = customTokenValue$1++; var SmallerEqualsOperator = customTokenValue$1++; var Ellipsis$1 = customTokenValue$1++; customTokenValue$1++; var SCSSScanner = (function (_super) { __extends$6(SCSSScanner, _super); function SCSSScanner() { return _super !== null && _super.apply(this, arguments) || this; } SCSSScanner.prototype.scanNext = function (offset) { if (this.stream.advanceIfChar(_DLR)) { var content = ['$']; if (this.ident(content)) { return this.finishToken(offset, VariableName, content.join('')); } else { this.stream.goBackTo(offset); } } if (this.stream.advanceIfChars([_HSH, _CUL])) { return this.finishToken(offset, InterpolationFunction); } if (this.stream.advanceIfChars([_EQS, _EQS])) { return this.finishToken(offset, EqualsOperator); } if (this.stream.advanceIfChars([_BNG, _EQS])) { return this.finishToken(offset, NotEqualsOperator); } if (this.stream.advanceIfChar(_LAN)) { if (this.stream.advanceIfChar(_EQS)) { return this.finishToken(offset, SmallerEqualsOperator); } return this.finishToken(offset, TokenType.Delim); } if (this.stream.advanceIfChar(_RAN)) { if (this.stream.advanceIfChar(_EQS)) { return this.finishToken(offset, GreaterEqualsOperator); } return this.finishToken(offset, TokenType.Delim); } if (this.stream.advanceIfChars([_DOT$1, _DOT$1, _DOT$1])) { return this.finishToken(offset, Ellipsis$1); } return _super.prototype.scanNext.call(this, offset); }; SCSSScanner.prototype.comment = function () { if (_super.prototype.comment.call(this)) { return true; } if (!this.inURL && this.stream.advanceIfChars([_FSL$1, _FSL$1])) { this.stream.advanceWhileChar(function (ch) { switch (ch) { case _NWL$1: case _CAR$1: case _LFD$1: return false; default: return true; } }); return true; } else { return false; } }; return SCSSScanner; }(Scanner)); var localize$2 = main$3.loadMessageBundle(); var SCSSIssueType = (function () { function SCSSIssueType(id, message) { this.id = id; this.message = message; } return SCSSIssueType; }()); var SCSSParseError = { FromExpected: new SCSSIssueType('scss-fromexpected', localize$2('expected.from', "'from' expected")), ThroughOrToExpected: new SCSSIssueType('scss-throughexpected', localize$2('expected.through', "'through' or 'to' expected")), InExpected: new SCSSIssueType('scss-fromexpected', localize$2('expected.in', "'in' expected")), }; var __extends$5 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SCSSParser = (function (_super) { __extends$5(SCSSParser, _super); function SCSSParser() { return _super.call(this, new SCSSScanner()) || this; } SCSSParser.prototype._parseStylesheetStatement = function (isNested) { if (isNested === void 0) { isNested = false; } if (this.peek(TokenType.AtKeyword)) { return this._parseWarnAndDebug() || this._parseControlStatement() || this._parseMixinDeclaration() || this._parseMixinContent() || this._parseMixinReference() || this._parseFunctionDeclaration() || this._parseForward() || this._parseUse() || this._parseRuleset(isNested) || _super.prototype._parseStylesheetAtStatement.call(this, isNested); } return this._parseRuleset(true) || this._parseVariableDeclaration(); }; SCSSParser.prototype._parseImport = function () { if (!this.peekKeyword('@import')) { return null; } var node = this.create(Import); this.consumeToken(); if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.URIOrStringExpected); } while (this.accept(TokenType.Comma)) { if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.URIOrStringExpected); } } if (!this.peek(TokenType.SemiColon) && !this.peek(TokenType.EOF)) { node.setMedialist(this._parseMediaQueryList()); } return this.finish(node); }; SCSSParser.prototype._parseVariableDeclaration = function (panic) { if (panic === void 0) { panic = []; } if (!this.peek(VariableName)) { return null; } var node = this.create(VariableDeclaration); if (!node.setVariable(this._parseVariable())) { return null; } if (!this.accept(TokenType.Colon)) { return this.finish(node, ParseError.ColonExpected); } if (this.prevToken) { node.colonPosition = this.prevToken.offset; } if (!node.setValue(this._parseExpr())) { return this.finish(node, ParseError.VariableValueExpected, [], panic); } while (this.peek(TokenType.Exclamation)) { if (node.addChild(this._tryParsePrio())) ; else { this.consumeToken(); if (!this.peekRegExp(TokenType.Ident, /^(default|global)$/)) { return this.finish(node, ParseError.UnknownKeyword); } this.consumeToken(); } } if (this.peek(TokenType.SemiColon)) { node.semicolonPosition = this.token.offset; } return this.finish(node); }; SCSSParser.prototype._parseMediaCondition = function () { return this._parseInterpolation() || _super.prototype._parseMediaCondition.call(this); }; SCSSParser.prototype._parseMediaFeatureName = function () { return this._parseModuleMember() || this._parseFunction() || this._parseIdent() || this._parseVariable(); }; SCSSParser.prototype._parseKeyframeSelector = function () { return this._tryParseKeyframeSelector() || this._parseControlStatement(this._parseKeyframeSelector.bind(this)) || this._parseVariableDeclaration() || this._parseMixinContent(); }; SCSSParser.prototype._parseVariable = function () { if (!this.peek(VariableName)) { return null; } var node = this.create(Variable); this.consumeToken(); return node; }; SCSSParser.prototype._parseModuleMember = function () { var pos = this.mark(); var node = this.create(Module); if (!node.setIdentifier(this._parseIdent([ReferenceType.Module]))) { return null; } if (this.hasWhitespace() || !this.acceptDelim('.') || this.hasWhitespace()) { this.restoreAtMark(pos); return null; } if (!node.addChild(this._parseVariable() || this._parseFunction())) { return this.finish(node, ParseError.IdentifierOrVariableExpected); } return node; }; SCSSParser.prototype._parseIdent = function (referenceTypes) { var _this = this; if (!this.peek(TokenType.Ident) && !this.peek(InterpolationFunction) && !this.peekDelim('-')) { return null; } var node = this.create(Identifier); node.referenceTypes = referenceTypes; node.isCustomProperty = this.peekRegExp(TokenType.Ident, /^--/); var hasContent = false; var indentInterpolation = function () { var pos = _this.mark(); if (_this.acceptDelim('-')) { if (!_this.hasWhitespace()) { _this.acceptDelim('-'); } if (_this.hasWhitespace()) { _this.restoreAtMark(pos); return null; } } return _this._parseInterpolation(); }; while (this.accept(TokenType.Ident) || node.addChild(indentInterpolation()) || (hasContent && this.acceptRegexp(/^[\w-]/))) { hasContent = true; if (this.hasWhitespace()) { break; } } return hasContent ? this.finish(node) : null; }; SCSSParser.prototype._parseTermExpression = function () { return this._parseModuleMember() || this._parseVariable() || this._parseSelectorCombinator() || _super.prototype._parseTermExpression.call(this); }; SCSSParser.prototype._parseInterpolation = function () { if (this.peek(InterpolationFunction)) { var node = this.create(Interpolation); this.consumeToken(); if (!node.addChild(this._parseExpr()) && !this._parseSelectorCombinator()) { if (this.accept(TokenType.CurlyR)) { return this.finish(node); } return this.finish(node, ParseError.ExpressionExpected); } if (!this.accept(TokenType.CurlyR)) { return this.finish(node, ParseError.RightCurlyExpected); } return this.finish(node); } return null; }; SCSSParser.prototype._parseOperator = function () { if (this.peek(EqualsOperator) || this.peek(NotEqualsOperator) || this.peek(GreaterEqualsOperator) || this.peek(SmallerEqualsOperator) || this.peekDelim('>') || this.peekDelim('<') || this.peekIdent('and') || this.peekIdent('or') || this.peekDelim('%')) { var node = this.createNode(NodeType.Operator); this.consumeToken(); return this.finish(node); } return _super.prototype._parseOperator.call(this); }; SCSSParser.prototype._parseUnaryOperator = function () { if (this.peekIdent('not')) { var node = this.create(Node); this.consumeToken(); return this.finish(node); } return _super.prototype._parseUnaryOperator.call(this); }; SCSSParser.prototype._parseRuleSetDeclaration = function () { if (this.peek(TokenType.AtKeyword)) { return this._parseKeyframe() || this._parseImport() || this._parseMedia(true) || this._parseFontFace() || this._parseWarnAndDebug() || this._parseControlStatement() || this._parseFunctionDeclaration() || this._parseExtends() || this._parseMixinReference() || this._parseMixinContent() || this._parseMixinDeclaration() || this._parseRuleset(true) || this._parseSupports(true) || _super.prototype._parseRuleSetDeclarationAtStatement.call(this); } return this._parseVariableDeclaration() || this._tryParseRuleset(true) || _super.prototype._parseRuleSetDeclaration.call(this); }; SCSSParser.prototype._parseDeclaration = function (stopTokens) { var custonProperty = this._tryParseCustomPropertyDeclaration(stopTokens); if (custonProperty) { return custonProperty; } var node = this.create(Declaration); if (!node.setProperty(this._parseProperty())) { return null; } if (!this.accept(TokenType.Colon)) { return this.finish(node, ParseError.ColonExpected, [TokenType.Colon], stopTokens || [TokenType.SemiColon]); } if (this.prevToken) { node.colonPosition = this.prevToken.offset; } var hasContent = false; if (node.setValue(this._parseExpr())) { hasContent = true; node.addChild(this._parsePrio()); } if (this.peek(TokenType.CurlyL)) { node.setNestedProperties(this._parseNestedProperties()); } else { if (!hasContent) { return this.finish(node, ParseError.PropertyValueExpected); } } if (this.peek(TokenType.SemiColon)) { node.semicolonPosition = this.token.offset; } return this.finish(node); }; SCSSParser.prototype._parseNestedProperties = function () { var node = this.create(NestedProperties); return this._parseBody(node, this._parseDeclaration.bind(this)); }; SCSSParser.prototype._parseExtends = function () { if (this.peekKeyword('@extend')) { var node = this.create(ExtendsReference); this.consumeToken(); if (!node.getSelectors().addChild(this._parseSimpleSelector())) { return this.finish(node, ParseError.SelectorExpected); } while (this.accept(TokenType.Comma)) { node.getSelectors().addChild(this._parseSimpleSelector()); } if (this.accept(TokenType.Exclamation)) { if (!this.acceptIdent('optional')) { return this.finish(node, ParseError.UnknownKeyword); } } return this.finish(node); } return null; }; SCSSParser.prototype._parseSimpleSelectorBody = function () { return this._parseSelectorCombinator() || this._parseSelectorPlaceholder() || _super.prototype._parseSimpleSelectorBody.call(this); }; SCSSParser.prototype._parseSelectorCombinator = function () { if (this.peekDelim('&')) { var node = this.createNode(NodeType.SelectorCombinator); this.consumeToken(); while (!this.hasWhitespace() && (this.acceptDelim('-') || this.accept(TokenType.Num) || this.accept(TokenType.Dimension) || node.addChild(this._parseIdent()) || this.acceptDelim('&'))) { } return this.finish(node); } return null; }; SCSSParser.prototype._parseSelectorPlaceholder = function () { if (this.peekDelim('%')) { var node = this.createNode(NodeType.SelectorPlaceholder); this.consumeToken(); this._parseIdent(); return this.finish(node); } else if (this.peekKeyword('@at-root')) { var node = this.createNode(NodeType.SelectorPlaceholder); this.consumeToken(); return this.finish(node); } return null; }; SCSSParser.prototype._parseElementName = function () { var pos = this.mark(); var node = _super.prototype._parseElementName.call(this); if (node && !this.hasWhitespace() && this.peek(TokenType.ParenthesisL)) { this.restoreAtMark(pos); return null; } return node; }; SCSSParser.prototype._tryParsePseudoIdentifier = function () { return this._parseInterpolation() || _super.prototype._tryParsePseudoIdentifier.call(this); }; SCSSParser.prototype._parseWarnAndDebug = function () { if (!this.peekKeyword('@debug') && !this.peekKeyword('@warn') && !this.peekKeyword('@error')) { return null; } var node = this.createNode(NodeType.Debug); this.consumeToken(); node.addChild(this._parseExpr()); return this.finish(node); }; SCSSParser.prototype._parseControlStatement = function (parseStatement) { if (parseStatement === void 0) { parseStatement = this._parseRuleSetDeclaration.bind(this); } if (!this.peek(TokenType.AtKeyword)) { return null; } return this._parseIfStatement(parseStatement) || this._parseForStatement(parseStatement) || this._parseEachStatement(parseStatement) || this._parseWhileStatement(parseStatement); }; SCSSParser.prototype._parseIfStatement = function (parseStatement) { if (!this.peekKeyword('@if')) { return null; } return this._internalParseIfStatement(parseStatement); }; SCSSParser.prototype._internalParseIfStatement = function (parseStatement) { var node = this.create(IfStatement); this.consumeToken(); if (!node.setExpression(this._parseExpr(true))) { return this.finish(node, ParseError.ExpressionExpected); } this._parseBody(node, parseStatement); if (this.acceptKeyword('@else')) { if (this.peekIdent('if')) { node.setElseClause(this._internalParseIfStatement(parseStatement)); } else if (this.peek(TokenType.CurlyL)) { var elseNode = this.create(ElseStatement); this._parseBody(elseNode, parseStatement); node.setElseClause(elseNode); } } return this.finish(node); }; SCSSParser.prototype._parseForStatement = function (parseStatement) { if (!this.peekKeyword('@for')) { return null; } var node = this.create(ForStatement); this.consumeToken(); if (!node.setVariable(this._parseVariable())) { return this.finish(node, ParseError.VariableNameExpected, [TokenType.CurlyR]); } if (!this.acceptIdent('from')) { return this.finish(node, SCSSParseError.FromExpected, [TokenType.CurlyR]); } if (!node.addChild(this._parseBinaryExpr())) { return this.finish(node, ParseError.ExpressionExpected, [TokenType.CurlyR]); } if (!this.acceptIdent('to') && !this.acceptIdent('through')) { return this.finish(node, SCSSParseError.ThroughOrToExpected, [TokenType.CurlyR]); } if (!node.addChild(this._parseBinaryExpr())) { return this.finish(node, ParseError.ExpressionExpected, [TokenType.CurlyR]); } return this._parseBody(node, parseStatement); }; SCSSParser.prototype._parseEachStatement = function (parseStatement) { if (!this.peekKeyword('@each')) { return null; } var node = this.create(EachStatement); this.consumeToken(); var variables = node.getVariables(); if (!variables.addChild(this._parseVariable())) { return this.finish(node, ParseError.VariableNameExpected, [TokenType.CurlyR]); } while (this.accept(TokenType.Comma)) { if (!variables.addChild(this._parseVariable())) { return this.finish(node, ParseError.VariableNameExpected, [TokenType.CurlyR]); } } this.finish(variables); if (!this.acceptIdent('in')) { return this.finish(node, SCSSParseError.InExpected, [TokenType.CurlyR]); } if (!node.addChild(this._parseExpr())) { return this.finish(node, ParseError.ExpressionExpected, [TokenType.CurlyR]); } return this._parseBody(node, parseStatement); }; SCSSParser.prototype._parseWhileStatement = function (parseStatement) { if (!this.peekKeyword('@while')) { return null; } var node = this.create(WhileStatement); this.consumeToken(); if (!node.addChild(this._parseBinaryExpr())) { return this.finish(node, ParseError.ExpressionExpected, [TokenType.CurlyR]); } return this._parseBody(node, parseStatement); }; SCSSParser.prototype._parseFunctionBodyDeclaration = function () { return this._parseVariableDeclaration() || this._parseReturnStatement() || this._parseWarnAndDebug() || this._parseControlStatement(this._parseFunctionBodyDeclaration.bind(this)); }; SCSSParser.prototype._parseFunctionDeclaration = function () { if (!this.peekKeyword('@function')) { return null; } var node = this.create(FunctionDeclaration); this.consumeToken(); if (!node.setIdentifier(this._parseIdent([ReferenceType.Function]))) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]); } if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [TokenType.CurlyR]); } if (node.getParameters().addChild(this._parseParameterDeclaration())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseParameterDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.CurlyR]); } return this._parseBody(node, this._parseFunctionBodyDeclaration.bind(this)); }; SCSSParser.prototype._parseReturnStatement = function () { if (!this.peekKeyword('@return')) { return null; } var node = this.createNode(NodeType.ReturnStatement); this.consumeToken(); if (!node.addChild(this._parseExpr())) { return this.finish(node, ParseError.ExpressionExpected); } return this.finish(node); }; SCSSParser.prototype._parseMixinDeclaration = function () { if (!this.peekKeyword('@mixin')) { return null; } var node = this.create(MixinDeclaration); this.consumeToken(); if (!node.setIdentifier(this._parseIdent([ReferenceType.Mixin]))) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]); } if (this.accept(TokenType.ParenthesisL)) { if (node.getParameters().addChild(this._parseParameterDeclaration())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseParameterDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.CurlyR]); } } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); }; SCSSParser.prototype._parseParameterDeclaration = function () { var node = this.create(FunctionParameter); if (!node.setIdentifier(this._parseVariable())) { return null; } if (this.accept(Ellipsis$1)) ; if (this.accept(TokenType.Colon)) { if (!node.setDefaultValue(this._parseExpr(true))) { return this.finish(node, ParseError.VariableValueExpected, [], [TokenType.Comma, TokenType.ParenthesisR]); } } return this.finish(node); }; SCSSParser.prototype._parseMixinContent = function () { if (!this.peekKeyword('@content')) { return null; } var node = this.create(MixinContentReference); this.consumeToken(); if (this.accept(TokenType.ParenthesisL)) { if (node.getArguments().addChild(this._parseFunctionArgument())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseFunctionArgument())) { return this.finish(node, ParseError.ExpressionExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } } return this.finish(node); }; SCSSParser.prototype._parseMixinReference = function () { if (!this.peekKeyword('@include')) { return null; } var node = this.create(MixinReference); this.consumeToken(); var firstIdent = this._parseIdent([ReferenceType.Mixin]); if (!node.setIdentifier(firstIdent)) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]); } if (!this.hasWhitespace() && this.acceptDelim('.') && !this.hasWhitespace()) { var secondIdent = this._parseIdent([ReferenceType.Mixin]); if (!secondIdent) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]); } var moduleToken = this.create(Module); firstIdent.referenceTypes = [ReferenceType.Module]; moduleToken.setIdentifier(firstIdent); node.setIdentifier(secondIdent); node.addChild(moduleToken); } if (this.accept(TokenType.ParenthesisL)) { if (node.getArguments().addChild(this._parseFunctionArgument())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseFunctionArgument())) { return this.finish(node, ParseError.ExpressionExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } } if (this.peekIdent('using') || this.peek(TokenType.CurlyL)) { node.setContent(this._parseMixinContentDeclaration()); } return this.finish(node); }; SCSSParser.prototype._parseMixinContentDeclaration = function () { var node = this.create(MixinContentDeclaration); if (this.acceptIdent('using')) { if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [TokenType.CurlyL]); } if (node.getParameters().addChild(this._parseParameterDeclaration())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseParameterDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.CurlyL]); } } if (this.peek(TokenType.CurlyL)) { this._parseBody(node, this._parseMixinReferenceBodyStatement.bind(this)); } return this.finish(node); }; SCSSParser.prototype._parseMixinReferenceBodyStatement = function () { return this._tryParseKeyframeSelector() || this._parseRuleSetDeclaration(); }; SCSSParser.prototype._parseFunctionArgument = function () { var node = this.create(FunctionArgument); var pos = this.mark(); var argument = this._parseVariable(); if (argument) { if (!this.accept(TokenType.Colon)) { if (this.accept(Ellipsis$1)) { node.setValue(argument); return this.finish(node); } else { this.restoreAtMark(pos); } } else { node.setIdentifier(argument); } } if (node.setValue(this._parseExpr(true))) { this.accept(Ellipsis$1); node.addChild(this._parsePrio()); return this.finish(node); } else if (node.setValue(this._tryParsePrio())) { return this.finish(node); } return null; }; SCSSParser.prototype._parseURLArgument = function () { var pos = this.mark(); var node = _super.prototype._parseURLArgument.call(this); if (!node || !this.peek(TokenType.ParenthesisR)) { this.restoreAtMark(pos); var node_1 = this.create(Node); node_1.addChild(this._parseBinaryExpr()); return this.finish(node_1); } return node; }; SCSSParser.prototype._parseOperation = function () { if (!this.peek(TokenType.ParenthesisL)) { return null; } var node = this.create(Node); this.consumeToken(); while (node.addChild(this._parseListElement())) { this.accept(TokenType.Comma); } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); }; SCSSParser.prototype._parseListElement = function () { var node = this.create(ListEntry); var child = this._parseBinaryExpr(); if (!child) { return null; } if (this.accept(TokenType.Colon)) { node.setKey(child); if (!node.setValue(this._parseBinaryExpr())) { return this.finish(node, ParseError.ExpressionExpected); } } else { node.setValue(child); } return this.finish(node); }; SCSSParser.prototype._parseUse = function () { if (!this.peekKeyword('@use')) { return null; } var node = this.create(Use); this.consumeToken(); if (!node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.StringLiteralExpected); } if (!this.peek(TokenType.SemiColon) && !this.peek(TokenType.EOF)) { if (!this.peekRegExp(TokenType.Ident, /as|with/)) { return this.finish(node, ParseError.UnknownKeyword); } if (this.acceptIdent('as') && (!node.setIdentifier(this._parseIdent([ReferenceType.Module])) && !this.acceptDelim('*'))) { return this.finish(node, ParseError.IdentifierOrWildcardExpected); } if (this.acceptIdent('with')) { if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [TokenType.ParenthesisR]); } if (!node.getParameters().addChild(this._parseModuleConfigDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseModuleConfigDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } } } if (!this.accept(TokenType.SemiColon) && !this.accept(TokenType.EOF)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); }; SCSSParser.prototype._parseModuleConfigDeclaration = function () { var node = this.create(ModuleConfiguration); if (!node.setIdentifier(this._parseVariable())) { return null; } if (!this.accept(TokenType.Colon) || !node.setValue(this._parseExpr(true))) { return this.finish(node, ParseError.VariableValueExpected, [], [TokenType.Comma, TokenType.ParenthesisR]); } if (this.accept(TokenType.Exclamation)) { if (this.hasWhitespace() || !this.acceptIdent('default')) { return this.finish(node, ParseError.UnknownKeyword); } } return this.finish(node); }; SCSSParser.prototype._parseForward = function () { if (!this.peekKeyword('@forward')) { return null; } var node = this.create(Forward); this.consumeToken(); if (!node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.StringLiteralExpected); } if (this.acceptIdent('with')) { if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [TokenType.ParenthesisR]); } if (!node.getParameters().addChild(this._parseModuleConfigDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseModuleConfigDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } } if (!this.peek(TokenType.SemiColon) && !this.peek(TokenType.EOF)) { if (!this.peekRegExp(TokenType.Ident, /as|hide|show/)) { return this.finish(node, ParseError.UnknownKeyword); } if (this.acceptIdent('as')) { var identifier = this._parseIdent([ReferenceType.Forward]); if (!node.setIdentifier(identifier)) { return this.finish(node, ParseError.IdentifierExpected); } if (this.hasWhitespace() || !this.acceptDelim('*')) { return this.finish(node, ParseError.WildcardExpected); } } if (this.peekIdent('hide') || this.peekIdent('show')) { if (!node.addChild(this._parseForwardVisibility())) { return this.finish(node, ParseError.IdentifierOrVariableExpected); } } } if (!this.accept(TokenType.SemiColon) && !this.accept(TokenType.EOF)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); }; SCSSParser.prototype._parseForwardVisibility = function () { var node = this.create(ForwardVisibility); node.setIdentifier(this._parseIdent()); while (node.addChild(this._parseVariable() || this._parseIdent())) { this.accept(TokenType.Comma); } return node.getChildren().length > 1 ? node : null; }; SCSSParser.prototype._parseSupportsCondition = function () { return this._parseInterpolation() || _super.prototype._parseSupportsCondition.call(this); }; return SCSSParser; }(Parser)); var __extends$4 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var localize$1 = main$3.loadMessageBundle(); var SCSSCompletion = (function (_super) { __extends$4(SCSSCompletion, _super); function SCSSCompletion(lsServiceOptions, cssDataManager) { var _this = _super.call(this, '$', lsServiceOptions, cssDataManager) || this; addReferencesToDocumentation(SCSSCompletion.scssModuleLoaders); addReferencesToDocumentation(SCSSCompletion.scssModuleBuiltIns); return _this; } SCSSCompletion.prototype.isImportPathParent = function (type) { return type === NodeType.Forward || type === NodeType.Use || _super.prototype.isImportPathParent.call(this, type); }; SCSSCompletion.prototype.getCompletionForImportPath = function (importPathNode, result) { var parentType = importPathNode.getParent().type; if (parentType === NodeType.Forward || parentType === NodeType.Use) { for (var _i = 0, _a = SCSSCompletion.scssModuleBuiltIns; _i < _a.length; _i++) { var p = _a[_i]; var item = { label: p.label, documentation: p.documentation, textEdit: TextEdit.replace(this.getCompletionRange(importPathNode), "'".concat(p.label, "'")), kind: CompletionItemKind.Module }; result.items.push(item); } } return _super.prototype.getCompletionForImportPath.call(this, importPathNode, result); }; SCSSCompletion.prototype.createReplaceFunction = function () { var tabStopCounter = 1; return function (_match, p1) { return '\\' + p1 + ': ${' + tabStopCounter++ + ':' + (SCSSCompletion.variableDefaults[p1] || '') + '}'; }; }; SCSSCompletion.prototype.createFunctionProposals = function (proposals, existingNode, sortToEnd, result) { for (var _i = 0, proposals_1 = proposals; _i < proposals_1.length; _i++) { var p = proposals_1[_i]; var insertText = p.func.replace(/\[?(\$\w+)\]?/g, this.createReplaceFunction()); var label = p.func.substr(0, p.func.indexOf('(')); var item = { label: label, detail: p.func, documentation: p.desc, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Function }; if (sortToEnd) { item.sortText = 'z'; } result.items.push(item); } return result; }; SCSSCompletion.prototype.getCompletionsForSelector = function (ruleSet, isNested, result) { this.createFunctionProposals(SCSSCompletion.selectorFuncs, null, true, result); return _super.prototype.getCompletionsForSelector.call(this, ruleSet, isNested, result); }; SCSSCompletion.prototype.getTermProposals = function (entry, existingNode, result) { var functions = SCSSCompletion.builtInFuncs; if (entry) { functions = functions.filter(function (f) { return !f.type || !entry.restrictions || entry.restrictions.indexOf(f.type) !== -1; }); } this.createFunctionProposals(functions, existingNode, true, result); return _super.prototype.getTermProposals.call(this, entry, existingNode, result); }; SCSSCompletion.prototype.getColorProposals = function (entry, existingNode, result) { this.createFunctionProposals(SCSSCompletion.colorProposals, existingNode, false, result); return _super.prototype.getColorProposals.call(this, entry, existingNode, result); }; SCSSCompletion.prototype.getCompletionsForDeclarationProperty = function (declaration, result) { this.getCompletionForAtDirectives(result); this.getCompletionsForSelector(null, true, result); return _super.prototype.getCompletionsForDeclarationProperty.call(this, declaration, result); }; SCSSCompletion.prototype.getCompletionsForExtendsReference = function (_extendsRef, existingNode, result) { var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, ReferenceType.Rule); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; var suggest = { label: symbol.name, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), symbol.name), kind: CompletionItemKind.Function, }; result.items.push(suggest); } return result; }; SCSSCompletion.prototype.getCompletionForAtDirectives = function (result) { var _a; (_a = result.items).push.apply(_a, SCSSCompletion.scssAtDirectives); return result; }; SCSSCompletion.prototype.getCompletionForTopLevel = function (result) { this.getCompletionForAtDirectives(result); this.getCompletionForModuleLoaders(result); _super.prototype.getCompletionForTopLevel.call(this, result); return result; }; SCSSCompletion.prototype.getCompletionForModuleLoaders = function (result) { var _a; (_a = result.items).push.apply(_a, SCSSCompletion.scssModuleLoaders); return result; }; SCSSCompletion.variableDefaults = { '$red': '1', '$green': '2', '$blue': '3', '$alpha': '1.0', '$color': '#000000', '$weight': '0.5', '$hue': '0', '$saturation': '0%', '$lightness': '0%', '$degrees': '0', '$amount': '0', '$string': '""', '$substring': '"s"', '$number': '0', '$limit': '1' }; SCSSCompletion.colorProposals = [ { func: 'red($color)', desc: localize$1('scss.builtin.red', 'Gets the red component of a color.') }, { func: 'green($color)', desc: localize$1('scss.builtin.green', 'Gets the green component of a color.') }, { func: 'blue($color)', desc: localize$1('scss.builtin.blue', 'Gets the blue component of a color.') }, { func: 'mix($color, $color, [$weight])', desc: localize$1('scss.builtin.mix', 'Mixes two colors together.') }, { func: 'hue($color)', desc: localize$1('scss.builtin.hue', 'Gets the hue component of a color.') }, { func: 'saturation($color)', desc: localize$1('scss.builtin.saturation', 'Gets the saturation component of a color.') }, { func: 'lightness($color)', desc: localize$1('scss.builtin.lightness', 'Gets the lightness component of a color.') }, { func: 'adjust-hue($color, $degrees)', desc: localize$1('scss.builtin.adjust-hue', 'Changes the hue of a color.') }, { func: 'lighten($color, $amount)', desc: localize$1('scss.builtin.lighten', 'Makes a color lighter.') }, { func: 'darken($color, $amount)', desc: localize$1('scss.builtin.darken', 'Makes a color darker.') }, { func: 'saturate($color, $amount)', desc: localize$1('scss.builtin.saturate', 'Makes a color more saturated.') }, { func: 'desaturate($color, $amount)', desc: localize$1('scss.builtin.desaturate', 'Makes a color less saturated.') }, { func: 'grayscale($color)', desc: localize$1('scss.builtin.grayscale', 'Converts a color to grayscale.') }, { func: 'complement($color)', desc: localize$1('scss.builtin.complement', 'Returns the complement of a color.') }, { func: 'invert($color)', desc: localize$1('scss.builtin.invert', 'Returns the inverse of a color.') }, { func: 'alpha($color)', desc: localize$1('scss.builtin.alpha', 'Gets the opacity component of a color.') }, { func: 'opacity($color)', desc: 'Gets the alpha component (opacity) of a color.' }, { func: 'rgba($color, $alpha)', desc: localize$1('scss.builtin.rgba', 'Changes the alpha component for a color.') }, { func: 'opacify($color, $amount)', desc: localize$1('scss.builtin.opacify', 'Makes a color more opaque.') }, { func: 'fade-in($color, $amount)', desc: localize$1('scss.builtin.fade-in', 'Makes a color more opaque.') }, { func: 'transparentize($color, $amount)', desc: localize$1('scss.builtin.transparentize', 'Makes a color more transparent.') }, { func: 'fade-out($color, $amount)', desc: localize$1('scss.builtin.fade-out', 'Makes a color more transparent.') }, { func: 'adjust-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])', desc: localize$1('scss.builtin.adjust-color', 'Increases or decreases one or more components of a color.') }, { func: 'scale-color($color, [$red], [$green], [$blue], [$saturation], [$lightness], [$alpha])', desc: localize$1('scss.builtin.scale-color', 'Fluidly scales one or more properties of a color.') }, { func: 'change-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])', desc: localize$1('scss.builtin.change-color', 'Changes one or more properties of a color.') }, { func: 'ie-hex-str($color)', desc: localize$1('scss.builtin.ie-hex-str', 'Converts a color into the format understood by IE filters.') } ]; SCSSCompletion.selectorFuncs = [ { func: 'selector-nest($selectors…)', desc: localize$1('scss.builtin.selector-nest', 'Nests selector beneath one another like they would be nested in the stylesheet.') }, { func: 'selector-append($selectors…)', desc: localize$1('scss.builtin.selector-append', 'Appends selectors to one another without spaces in between.') }, { func: 'selector-extend($selector, $extendee, $extender)', desc: localize$1('scss.builtin.selector-extend', 'Extends $extendee with $extender within $selector.') }, { func: 'selector-replace($selector, $original, $replacement)', desc: localize$1('scss.builtin.selector-replace', 'Replaces $original with $replacement within $selector.') }, { func: 'selector-unify($selector1, $selector2)', desc: localize$1('scss.builtin.selector-unify', 'Unifies two selectors to produce a selector that matches elements matched by both.') }, { func: 'is-superselector($super, $sub)', desc: localize$1('scss.builtin.is-superselector', 'Returns whether $super matches all the elements $sub does, and possibly more.') }, { func: 'simple-selectors($selector)', desc: localize$1('scss.builtin.simple-selectors', 'Returns the simple selectors that comprise a compound selector.') }, { func: 'selector-parse($selector)', desc: localize$1('scss.builtin.selector-parse', 'Parses a selector into the format returned by &.') } ]; SCSSCompletion.builtInFuncs = [ { func: 'unquote($string)', desc: localize$1('scss.builtin.unquote', 'Removes quotes from a string.') }, { func: 'quote($string)', desc: localize$1('scss.builtin.quote', 'Adds quotes to a string.') }, { func: 'str-length($string)', desc: localize$1('scss.builtin.str-length', 'Returns the number of characters in a string.') }, { func: 'str-insert($string, $insert, $index)', desc: localize$1('scss.builtin.str-insert', 'Inserts $insert into $string at $index.') }, { func: 'str-index($string, $substring)', desc: localize$1('scss.builtin.str-index', 'Returns the index of the first occurance of $substring in $string.') }, { func: 'str-slice($string, $start-at, [$end-at])', desc: localize$1('scss.builtin.str-slice', 'Extracts a substring from $string.') }, { func: 'to-upper-case($string)', desc: localize$1('scss.builtin.to-upper-case', 'Converts a string to upper case.') }, { func: 'to-lower-case($string)', desc: localize$1('scss.builtin.to-lower-case', 'Converts a string to lower case.') }, { func: 'percentage($number)', desc: localize$1('scss.builtin.percentage', 'Converts a unitless number to a percentage.'), type: 'percentage' }, { func: 'round($number)', desc: localize$1('scss.builtin.round', 'Rounds a number to the nearest whole number.') }, { func: 'ceil($number)', desc: localize$1('scss.builtin.ceil', 'Rounds a number up to the next whole number.') }, { func: 'floor($number)', desc: localize$1('scss.builtin.floor', 'Rounds a number down to the previous whole number.') }, { func: 'abs($number)', desc: localize$1('scss.builtin.abs', 'Returns the absolute value of a number.') }, { func: 'min($numbers)', desc: localize$1('scss.builtin.min', 'Finds the minimum of several numbers.') }, { func: 'max($numbers)', desc: localize$1('scss.builtin.max', 'Finds the maximum of several numbers.') }, { func: 'random([$limit])', desc: localize$1('scss.builtin.random', 'Returns a random number.') }, { func: 'length($list)', desc: localize$1('scss.builtin.length', 'Returns the length of a list.') }, { func: 'nth($list, $n)', desc: localize$1('scss.builtin.nth', 'Returns a specific item in a list.') }, { func: 'set-nth($list, $n, $value)', desc: localize$1('scss.builtin.set-nth', 'Replaces the nth item in a list.') }, { func: 'join($list1, $list2, [$separator])', desc: localize$1('scss.builtin.join', 'Joins together two lists into one.') }, { func: 'append($list1, $val, [$separator])', desc: localize$1('scss.builtin.append', 'Appends a single value onto the end of a list.') }, { func: 'zip($lists)', desc: localize$1('scss.builtin.zip', 'Combines several lists into a single multidimensional list.') }, { func: 'index($list, $value)', desc: localize$1('scss.builtin.index', 'Returns the position of a value within a list.') }, { func: 'list-separator(#list)', desc: localize$1('scss.builtin.list-separator', 'Returns the separator of a list.') }, { func: 'map-get($map, $key)', desc: localize$1('scss.builtin.map-get', 'Returns the value in a map associated with a given key.') }, { func: 'map-merge($map1, $map2)', desc: localize$1('scss.builtin.map-merge', 'Merges two maps together into a new map.') }, { func: 'map-remove($map, $keys)', desc: localize$1('scss.builtin.map-remove', 'Returns a new map with keys removed.') }, { func: 'map-keys($map)', desc: localize$1('scss.builtin.map-keys', 'Returns a list of all keys in a map.') }, { func: 'map-values($map)', desc: localize$1('scss.builtin.map-values', 'Returns a list of all values in a map.') }, { func: 'map-has-key($map, $key)', desc: localize$1('scss.builtin.map-has-key', 'Returns whether a map has a value associated with a given key.') }, { func: 'keywords($args)', desc: localize$1('scss.builtin.keywords', 'Returns the keywords passed to a function that takes variable arguments.') }, { func: 'feature-exists($feature)', desc: localize$1('scss.builtin.feature-exists', 'Returns whether a feature exists in the current Sass runtime.') }, { func: 'variable-exists($name)', desc: localize$1('scss.builtin.variable-exists', 'Returns whether a variable with the given name exists in the current scope.') }, { func: 'global-variable-exists($name)', desc: localize$1('scss.builtin.global-variable-exists', 'Returns whether a variable with the given name exists in the global scope.') }, { func: 'function-exists($name)', desc: localize$1('scss.builtin.function-exists', 'Returns whether a function with the given name exists.') }, { func: 'mixin-exists($name)', desc: localize$1('scss.builtin.mixin-exists', 'Returns whether a mixin with the given name exists.') }, { func: 'inspect($value)', desc: localize$1('scss.builtin.inspect', 'Returns the string representation of a value as it would be represented in Sass.') }, { func: 'type-of($value)', desc: localize$1('scss.builtin.type-of', 'Returns the type of a value.') }, { func: 'unit($number)', desc: localize$1('scss.builtin.unit', 'Returns the unit(s) associated with a number.') }, { func: 'unitless($number)', desc: localize$1('scss.builtin.unitless', 'Returns whether a number has units.') }, { func: 'comparable($number1, $number2)', desc: localize$1('scss.builtin.comparable', 'Returns whether two numbers can be added, subtracted, or compared.') }, { func: 'call($name, $args…)', desc: localize$1('scss.builtin.call', 'Dynamically calls a Sass function.') } ]; SCSSCompletion.scssAtDirectives = [ { label: "@extend", documentation: localize$1("scss.builtin.@extend", "Inherits the styles of another selector."), kind: CompletionItemKind.Keyword }, { label: "@at-root", documentation: localize$1("scss.builtin.@at-root", "Causes one or more rules to be emitted at the root of the document."), kind: CompletionItemKind.Keyword }, { label: "@debug", documentation: localize$1("scss.builtin.@debug", "Prints the value of an expression to the standard error output stream. Useful for debugging complicated Sass files."), kind: CompletionItemKind.Keyword }, { label: "@warn", documentation: localize$1("scss.builtin.@warn", "Prints the value of an expression to the standard error output stream. Useful for libraries that need to warn users of deprecations or recovering from minor mixin usage mistakes. Warnings can be turned off with the `--quiet` command-line option or the `:quiet` Sass option."), kind: CompletionItemKind.Keyword }, { label: "@error", documentation: localize$1("scss.builtin.@error", "Throws the value of an expression as a fatal error with stack trace. Useful for validating arguments to mixins and functions."), kind: CompletionItemKind.Keyword }, { label: "@if", documentation: localize$1("scss.builtin.@if", "Includes the body if the expression does not evaluate to `false` or `null`."), insertText: "@if ${1:expr} {\n\t$0\n}", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@for", documentation: localize$1("scss.builtin.@for", "For loop that repeatedly outputs a set of styles for each `$var` in the `from/through` or `from/to` clause."), insertText: "@for \\$${1:var} from ${2:start} ${3|to,through|} ${4:end} {\n\t$0\n}", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@each", documentation: localize$1("scss.builtin.@each", "Each loop that sets `$var` to each item in the list or map, then outputs the styles it contains using that value of `$var`."), insertText: "@each \\$${1:var} in ${2:list} {\n\t$0\n}", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@while", documentation: localize$1("scss.builtin.@while", "While loop that takes an expression and repeatedly outputs the nested styles until the statement evaluates to `false`."), insertText: "@while ${1:condition} {\n\t$0\n}", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@mixin", documentation: localize$1("scss.builtin.@mixin", "Defines styles that can be re-used throughout the stylesheet with `@include`."), insertText: "@mixin ${1:name} {\n\t$0\n}", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@include", documentation: localize$1("scss.builtin.@include", "Includes the styles defined by another mixin into the current rule."), kind: CompletionItemKind.Keyword }, { label: "@function", documentation: localize$1("scss.builtin.@function", "Defines complex operations that can be re-used throughout stylesheets."), kind: CompletionItemKind.Keyword } ]; SCSSCompletion.scssModuleLoaders = [ { label: "@use", documentation: localize$1("scss.builtin.@use", "Loads mixins, functions, and variables from other Sass stylesheets as 'modules', and combines CSS from multiple stylesheets together."), references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/at-rules/use' }], insertText: "@use $0;", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@forward", documentation: localize$1("scss.builtin.@forward", "Loads a Sass stylesheet and makes its mixins, functions, and variables available when this stylesheet is loaded with the @use rule."), references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/at-rules/forward' }], insertText: "@forward $0;", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, ]; SCSSCompletion.scssModuleBuiltIns = [ { label: 'sass:math', documentation: localize$1('scss.builtin.sass:math', 'Provides functions that operate on numbers.'), references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/math' }] }, { label: 'sass:string', documentation: localize$1('scss.builtin.sass:string', 'Makes it easy to combine, search, or split apart strings.'), references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/string' }] }, { label: 'sass:color', documentation: localize$1('scss.builtin.sass:color', 'Generates new colors based on existing ones, making it easy to build color themes.'), references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/color' }] }, { label: 'sass:list', documentation: localize$1('scss.builtin.sass:list', 'Lets you access and modify values in lists.'), references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/list' }] }, { label: 'sass:map', documentation: localize$1('scss.builtin.sass:map', 'Makes it possible to look up the value associated with a key in a map, and much more.'), references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/map' }] }, { label: 'sass:selector', documentation: localize$1('scss.builtin.sass:selector', 'Provides access to Sass’s powerful selector engine.'), references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/selector' }] }, { label: 'sass:meta', documentation: localize$1('scss.builtin.sass:meta', 'Exposes the details of Sass’s inner workings.'), references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/modules/meta' }] }, ]; return SCSSCompletion; }(CSSCompletion)); function addReferencesToDocumentation(items) { items.forEach(function (i) { if (i.documentation && i.references && i.references.length > 0) { var markdownDoc = typeof i.documentation === 'string' ? { kind: 'markdown', value: i.documentation } : { kind: 'markdown', value: i.documentation.value }; markdownDoc.value += '\n\n'; markdownDoc.value += i.references .map(function (r) { return "[".concat(r.name, "](").concat(r.url, ")"); }) .join(' | '); i.documentation = markdownDoc; } }); } var __extends$3 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var _FSL = '/'.charCodeAt(0); var _NWL = '\n'.charCodeAt(0); var _CAR = '\r'.charCodeAt(0); var _LFD = '\f'.charCodeAt(0); var _TIC = '`'.charCodeAt(0); var _DOT = '.'.charCodeAt(0); var customTokenValue = TokenType.CustomToken; var Ellipsis = customTokenValue++; var LESSScanner = (function (_super) { __extends$3(LESSScanner, _super); function LESSScanner() { return _super !== null && _super.apply(this, arguments) || this; } LESSScanner.prototype.scanNext = function (offset) { var tokenType = this.escapedJavaScript(); if (tokenType !== null) { return this.finishToken(offset, tokenType); } if (this.stream.advanceIfChars([_DOT, _DOT, _DOT])) { return this.finishToken(offset, Ellipsis); } return _super.prototype.scanNext.call(this, offset); }; LESSScanner.prototype.comment = function () { if (_super.prototype.comment.call(this)) { return true; } if (!this.inURL && this.stream.advanceIfChars([_FSL, _FSL])) { this.stream.advanceWhileChar(function (ch) { switch (ch) { case _NWL: case _CAR: case _LFD: return false; default: return true; } }); return true; } else { return false; } }; LESSScanner.prototype.escapedJavaScript = function () { var ch = this.stream.peekChar(); if (ch === _TIC) { this.stream.advance(1); this.stream.advanceWhileChar(function (ch) { return ch !== _TIC; }); return this.stream.advanceIfChar(_TIC) ? TokenType.EscapedJavaScript : TokenType.BadEscapedJavaScript; } return null; }; return LESSScanner; }(Scanner)); var __extends$2 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var LESSParser = (function (_super) { __extends$2(LESSParser, _super); function LESSParser() { return _super.call(this, new LESSScanner()) || this; } LESSParser.prototype._parseStylesheetStatement = function (isNested) { if (isNested === void 0) { isNested = false; } if (this.peek(TokenType.AtKeyword)) { return this._parseVariableDeclaration() || this._parsePlugin() || _super.prototype._parseStylesheetAtStatement.call(this, isNested); } return this._tryParseMixinDeclaration() || this._tryParseMixinReference() || this._parseFunction() || this._parseRuleset(true); }; LESSParser.prototype._parseImport = function () { if (!this.peekKeyword('@import') && !this.peekKeyword('@import-once') ) { return null; } var node = this.create(Import); this.consumeToken(); if (this.accept(TokenType.ParenthesisL)) { if (!this.accept(TokenType.Ident)) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.SemiColon]); } do { if (!this.accept(TokenType.Comma)) { break; } } while (this.accept(TokenType.Ident)); if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.SemiColon]); } } if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.URIOrStringExpected, [TokenType.SemiColon]); } if (!this.peek(TokenType.SemiColon) && !this.peek(TokenType.EOF)) { node.setMedialist(this._parseMediaQueryList()); } return this.finish(node); }; LESSParser.prototype._parsePlugin = function () { if (!this.peekKeyword('@plugin')) { return null; } var node = this.createNode(NodeType.Plugin); this.consumeToken(); if (!node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.StringLiteralExpected); } if (!this.accept(TokenType.SemiColon)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); }; LESSParser.prototype._parseMediaQuery = function () { var node = _super.prototype._parseMediaQuery.call(this); if (!node) { var node_1 = this.create(MediaQuery); if (node_1.addChild(this._parseVariable())) { return this.finish(node_1); } return null; } return node; }; LESSParser.prototype._parseMediaDeclaration = function (isNested) { if (isNested === void 0) { isNested = false; } return this._tryParseRuleset(isNested) || this._tryToParseDeclaration() || this._tryParseMixinDeclaration() || this._tryParseMixinReference() || this._parseDetachedRuleSetMixin() || this._parseStylesheetStatement(isNested); }; LESSParser.prototype._parseMediaFeatureName = function () { return this._parseIdent() || this._parseVariable(); }; LESSParser.prototype._parseVariableDeclaration = function (panic) { if (panic === void 0) { panic = []; } var node = this.create(VariableDeclaration); var mark = this.mark(); if (!node.setVariable(this._parseVariable(true))) { return null; } if (this.accept(TokenType.Colon)) { if (this.prevToken) { node.colonPosition = this.prevToken.offset; } if (node.setValue(this._parseDetachedRuleSet())) { node.needsSemicolon = false; } else if (!node.setValue(this._parseExpr())) { return this.finish(node, ParseError.VariableValueExpected, [], panic); } node.addChild(this._parsePrio()); } else { this.restoreAtMark(mark); return null; } if (this.peek(TokenType.SemiColon)) { node.semicolonPosition = this.token.offset; } return this.finish(node); }; LESSParser.prototype._parseDetachedRuleSet = function () { var mark = this.mark(); if (this.peekDelim('#') || this.peekDelim('.')) { this.consumeToken(); if (!this.hasWhitespace() && this.accept(TokenType.ParenthesisL)) { var node = this.create(MixinDeclaration); if (node.getParameters().addChild(this._parseMixinParameter())) { while (this.accept(TokenType.Comma) || this.accept(TokenType.SemiColon)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseMixinParameter())) { this.markError(node, ParseError.IdentifierExpected, [], [TokenType.ParenthesisR]); } } } if (!this.accept(TokenType.ParenthesisR)) { this.restoreAtMark(mark); return null; } } else { this.restoreAtMark(mark); return null; } } if (!this.peek(TokenType.CurlyL)) { return null; } var content = this.create(BodyDeclaration); this._parseBody(content, this._parseDetachedRuleSetBody.bind(this)); return this.finish(content); }; LESSParser.prototype._parseDetachedRuleSetBody = function () { return this._tryParseKeyframeSelector() || this._parseRuleSetDeclaration(); }; LESSParser.prototype._addLookupChildren = function (node) { if (!node.addChild(this._parseLookupValue())) { return false; } var expectsValue = false; while (true) { if (this.peek(TokenType.BracketL)) { expectsValue = true; } if (!node.addChild(this._parseLookupValue())) { break; } expectsValue = false; } return !expectsValue; }; LESSParser.prototype._parseLookupValue = function () { var node = this.create(Node); var mark = this.mark(); if (!this.accept(TokenType.BracketL)) { this.restoreAtMark(mark); return null; } if (((node.addChild(this._parseVariable(false, true)) || node.addChild(this._parsePropertyIdentifier())) && this.accept(TokenType.BracketR)) || this.accept(TokenType.BracketR)) { return node; } this.restoreAtMark(mark); return null; }; LESSParser.prototype._parseVariable = function (declaration, insideLookup) { if (declaration === void 0) { declaration = false; } if (insideLookup === void 0) { insideLookup = false; } var isPropertyReference = !declaration && this.peekDelim('$'); if (!this.peekDelim('@') && !isPropertyReference && !this.peek(TokenType.AtKeyword)) { return null; } var node = this.create(Variable); var mark = this.mark(); while (this.acceptDelim('@') || (!declaration && this.acceptDelim('$'))) { if (this.hasWhitespace()) { this.restoreAtMark(mark); return null; } } if (!this.accept(TokenType.AtKeyword) && !this.accept(TokenType.Ident)) { this.restoreAtMark(mark); return null; } if (!insideLookup && this.peek(TokenType.BracketL)) { if (!this._addLookupChildren(node)) { this.restoreAtMark(mark); return null; } } return node; }; LESSParser.prototype._parseTermExpression = function () { return this._parseVariable() || this._parseEscaped() || _super.prototype._parseTermExpression.call(this) || this._tryParseMixinReference(false); }; LESSParser.prototype._parseEscaped = function () { if (this.peek(TokenType.EscapedJavaScript) || this.peek(TokenType.BadEscapedJavaScript)) { var node = this.createNode(NodeType.EscapedValue); this.consumeToken(); return this.finish(node); } if (this.peekDelim('~')) { var node = this.createNode(NodeType.EscapedValue); this.consumeToken(); if (this.accept(TokenType.String) || this.accept(TokenType.EscapedJavaScript)) { return this.finish(node); } else { return this.finish(node, ParseError.TermExpected); } } return null; }; LESSParser.prototype._parseOperator = function () { var node = this._parseGuardOperator(); if (node) { return node; } else { return _super.prototype._parseOperator.call(this); } }; LESSParser.prototype._parseGuardOperator = function () { if (this.peekDelim('>')) { var node = this.createNode(NodeType.Operator); this.consumeToken(); this.acceptDelim('='); return node; } else if (this.peekDelim('=')) { var node = this.createNode(NodeType.Operator); this.consumeToken(); this.acceptDelim('<'); return node; } else if (this.peekDelim('<')) { var node = this.createNode(NodeType.Operator); this.consumeToken(); this.acceptDelim('='); return node; } return null; }; LESSParser.prototype._parseRuleSetDeclaration = function () { if (this.peek(TokenType.AtKeyword)) { return this._parseKeyframe() || this._parseMedia(true) || this._parseImport() || this._parseSupports(true) || this._parseDetachedRuleSetMixin() || this._parseVariableDeclaration() || _super.prototype._parseRuleSetDeclarationAtStatement.call(this); } return this._tryParseMixinDeclaration() || this._tryParseRuleset(true) || this._tryParseMixinReference() || this._parseFunction() || this._parseExtend() || _super.prototype._parseRuleSetDeclaration.call(this); }; LESSParser.prototype._parseKeyframeIdent = function () { return this._parseIdent([ReferenceType.Keyframe]) || this._parseVariable(); }; LESSParser.prototype._parseKeyframeSelector = function () { return this._parseDetachedRuleSetMixin() || _super.prototype._parseKeyframeSelector.call(this); }; LESSParser.prototype._parseSimpleSelectorBody = function () { return this._parseSelectorCombinator() || _super.prototype._parseSimpleSelectorBody.call(this); }; LESSParser.prototype._parseSelector = function (isNested) { var node = this.create(Selector); var hasContent = false; if (isNested) { hasContent = node.addChild(this._parseCombinator()); } while (node.addChild(this._parseSimpleSelector())) { hasContent = true; var mark = this.mark(); if (node.addChild(this._parseGuard()) && this.peek(TokenType.CurlyL)) { break; } this.restoreAtMark(mark); node.addChild(this._parseCombinator()); } return hasContent ? this.finish(node) : null; }; LESSParser.prototype._parseSelectorCombinator = function () { if (this.peekDelim('&')) { var node = this.createNode(NodeType.SelectorCombinator); this.consumeToken(); while (!this.hasWhitespace() && (this.acceptDelim('-') || this.accept(TokenType.Num) || this.accept(TokenType.Dimension) || node.addChild(this._parseIdent()) || this.acceptDelim('&'))) { } return this.finish(node); } return null; }; LESSParser.prototype._parseSelectorIdent = function () { if (!this.peekInterpolatedIdent()) { return null; } var node = this.createNode(NodeType.SelectorInterpolation); var hasContent = this._acceptInterpolatedIdent(node); return hasContent ? this.finish(node) : null; }; LESSParser.prototype._parsePropertyIdentifier = function (inLookup) { if (inLookup === void 0) { inLookup = false; } var propertyRegex = /^[\w-]+/; if (!this.peekInterpolatedIdent() && !this.peekRegExp(this.token.type, propertyRegex)) { return null; } var mark = this.mark(); var node = this.create(Identifier); node.isCustomProperty = this.acceptDelim('-') && this.acceptDelim('-'); var childAdded = false; if (!inLookup) { if (node.isCustomProperty) { childAdded = this._acceptInterpolatedIdent(node); } else { childAdded = this._acceptInterpolatedIdent(node, propertyRegex); } } else { if (node.isCustomProperty) { childAdded = node.addChild(this._parseIdent()); } else { childAdded = node.addChild(this._parseRegexp(propertyRegex)); } } if (!childAdded) { this.restoreAtMark(mark); return null; } if (!inLookup && !this.hasWhitespace()) { this.acceptDelim('+'); if (!this.hasWhitespace()) { this.acceptIdent('_'); } } return this.finish(node); }; LESSParser.prototype.peekInterpolatedIdent = function () { return this.peek(TokenType.Ident) || this.peekDelim('@') || this.peekDelim('$') || this.peekDelim('-'); }; LESSParser.prototype._acceptInterpolatedIdent = function (node, identRegex) { var _this = this; var hasContent = false; var indentInterpolation = function () { var pos = _this.mark(); if (_this.acceptDelim('-')) { if (!_this.hasWhitespace()) { _this.acceptDelim('-'); } if (_this.hasWhitespace()) { _this.restoreAtMark(pos); return null; } } return _this._parseInterpolation(); }; var accept = identRegex ? function () { return _this.acceptRegexp(identRegex); } : function () { return _this.accept(TokenType.Ident); }; while (accept() || node.addChild(this._parseInterpolation() || this.try(indentInterpolation))) { hasContent = true; if (this.hasWhitespace()) { break; } } return hasContent; }; LESSParser.prototype._parseInterpolation = function () { var mark = this.mark(); if (this.peekDelim('@') || this.peekDelim('$')) { var node = this.createNode(NodeType.Interpolation); this.consumeToken(); if (this.hasWhitespace() || !this.accept(TokenType.CurlyL)) { this.restoreAtMark(mark); return null; } if (!node.addChild(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); } if (!this.accept(TokenType.CurlyR)) { return this.finish(node, ParseError.RightCurlyExpected); } return this.finish(node); } return null; }; LESSParser.prototype._tryParseMixinDeclaration = function () { var mark = this.mark(); var node = this.create(MixinDeclaration); if (!node.setIdentifier(this._parseMixinDeclarationIdentifier()) || !this.accept(TokenType.ParenthesisL)) { this.restoreAtMark(mark); return null; } if (node.getParameters().addChild(this._parseMixinParameter())) { while (this.accept(TokenType.Comma) || this.accept(TokenType.SemiColon)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseMixinParameter())) { this.markError(node, ParseError.IdentifierExpected, [], [TokenType.ParenthesisR]); } } } if (!this.accept(TokenType.ParenthesisR)) { this.restoreAtMark(mark); return null; } node.setGuard(this._parseGuard()); if (!this.peek(TokenType.CurlyL)) { this.restoreAtMark(mark); return null; } return this._parseBody(node, this._parseMixInBodyDeclaration.bind(this)); }; LESSParser.prototype._parseMixInBodyDeclaration = function () { return this._parseFontFace() || this._parseRuleSetDeclaration(); }; LESSParser.prototype._parseMixinDeclarationIdentifier = function () { var identifier; if (this.peekDelim('#') || this.peekDelim('.')) { identifier = this.create(Identifier); this.consumeToken(); if (this.hasWhitespace() || !identifier.addChild(this._parseIdent())) { return null; } } else if (this.peek(TokenType.Hash)) { identifier = this.create(Identifier); this.consumeToken(); } else { return null; } identifier.referenceTypes = [ReferenceType.Mixin]; return this.finish(identifier); }; LESSParser.prototype._parsePseudo = function () { if (!this.peek(TokenType.Colon)) { return null; } var mark = this.mark(); var node = this.create(ExtendsReference); this.consumeToken(); if (this.acceptIdent('extend')) { return this._completeExtends(node); } this.restoreAtMark(mark); return _super.prototype._parsePseudo.call(this); }; LESSParser.prototype._parseExtend = function () { if (!this.peekDelim('&')) { return null; } var mark = this.mark(); var node = this.create(ExtendsReference); this.consumeToken(); if (this.hasWhitespace() || !this.accept(TokenType.Colon) || !this.acceptIdent('extend')) { this.restoreAtMark(mark); return null; } return this._completeExtends(node); }; LESSParser.prototype._completeExtends = function (node) { if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected); } var selectors = node.getSelectors(); if (!selectors.addChild(this._parseSelector(true))) { return this.finish(node, ParseError.SelectorExpected); } while (this.accept(TokenType.Comma)) { if (!selectors.addChild(this._parseSelector(true))) { return this.finish(node, ParseError.SelectorExpected); } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); }; LESSParser.prototype._parseDetachedRuleSetMixin = function () { if (!this.peek(TokenType.AtKeyword)) { return null; } var mark = this.mark(); var node = this.create(MixinReference); if (node.addChild(this._parseVariable(true)) && (this.hasWhitespace() || !this.accept(TokenType.ParenthesisL))) { this.restoreAtMark(mark); return null; } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); }; LESSParser.prototype._tryParseMixinReference = function (atRoot) { if (atRoot === void 0) { atRoot = true; } var mark = this.mark(); var node = this.create(MixinReference); var identifier = this._parseMixinDeclarationIdentifier(); while (identifier) { this.acceptDelim('>'); var nextId = this._parseMixinDeclarationIdentifier(); if (nextId) { node.getNamespaces().addChild(identifier); identifier = nextId; } else { break; } } if (!node.setIdentifier(identifier)) { this.restoreAtMark(mark); return null; } var hasArguments = false; if (this.accept(TokenType.ParenthesisL)) { hasArguments = true; if (node.getArguments().addChild(this._parseMixinArgument())) { while (this.accept(TokenType.Comma) || this.accept(TokenType.SemiColon)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseMixinArgument())) { return this.finish(node, ParseError.ExpressionExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } identifier.referenceTypes = [ReferenceType.Mixin]; } else { identifier.referenceTypes = [ReferenceType.Mixin, ReferenceType.Rule]; } if (this.peek(TokenType.BracketL)) { if (!atRoot) { this._addLookupChildren(node); } } else { node.addChild(this._parsePrio()); } if (!hasArguments && !this.peek(TokenType.SemiColon) && !this.peek(TokenType.CurlyR) && !this.peek(TokenType.EOF)) { this.restoreAtMark(mark); return null; } return this.finish(node); }; LESSParser.prototype._parseMixinArgument = function () { var node = this.create(FunctionArgument); var pos = this.mark(); var argument = this._parseVariable(); if (argument) { if (!this.accept(TokenType.Colon)) { this.restoreAtMark(pos); } else { node.setIdentifier(argument); } } if (node.setValue(this._parseDetachedRuleSet() || this._parseExpr(true))) { return this.finish(node); } this.restoreAtMark(pos); return null; }; LESSParser.prototype._parseMixinParameter = function () { var node = this.create(FunctionParameter); if (this.peekKeyword('@rest')) { var restNode = this.create(Node); this.consumeToken(); if (!this.accept(Ellipsis)) { return this.finish(node, ParseError.DotExpected, [], [TokenType.Comma, TokenType.ParenthesisR]); } node.setIdentifier(this.finish(restNode)); return this.finish(node); } if (this.peek(Ellipsis)) { var varargsNode = this.create(Node); this.consumeToken(); node.setIdentifier(this.finish(varargsNode)); return this.finish(node); } var hasContent = false; if (node.setIdentifier(this._parseVariable())) { this.accept(TokenType.Colon); hasContent = true; } if (!node.setDefaultValue(this._parseDetachedRuleSet() || this._parseExpr(true)) && !hasContent) { return null; } return this.finish(node); }; LESSParser.prototype._parseGuard = function () { if (!this.peekIdent('when')) { return null; } var node = this.create(LessGuard); this.consumeToken(); node.isNegated = this.acceptIdent('not'); if (!node.getConditions().addChild(this._parseGuardCondition())) { return this.finish(node, ParseError.ConditionExpected); } while (this.acceptIdent('and') || this.accept(TokenType.Comma)) { if (!node.getConditions().addChild(this._parseGuardCondition())) { return this.finish(node, ParseError.ConditionExpected); } } return this.finish(node); }; LESSParser.prototype._parseGuardCondition = function () { if (!this.peek(TokenType.ParenthesisL)) { return null; } var node = this.create(GuardCondition); this.consumeToken(); if (!node.addChild(this._parseExpr())) ; if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); }; LESSParser.prototype._parseFunction = function () { var pos = this.mark(); var node = this.create(Function$1); if (!node.setIdentifier(this._parseFunctionIdentifier())) { return null; } if (this.hasWhitespace() || !this.accept(TokenType.ParenthesisL)) { this.restoreAtMark(pos); return null; } if (node.getArguments().addChild(this._parseMixinArgument())) { while (this.accept(TokenType.Comma) || this.accept(TokenType.SemiColon)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseMixinArgument())) { return this.finish(node, ParseError.ExpressionExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); }; LESSParser.prototype._parseFunctionIdentifier = function () { if (this.peekDelim('%')) { var node = this.create(Identifier); node.referenceTypes = [ReferenceType.Function]; this.consumeToken(); return this.finish(node); } return _super.prototype._parseFunctionIdentifier.call(this); }; LESSParser.prototype._parseURLArgument = function () { var pos = this.mark(); var node = _super.prototype._parseURLArgument.call(this); if (!node || !this.peek(TokenType.ParenthesisR)) { this.restoreAtMark(pos); var node_2 = this.create(Node); node_2.addChild(this._parseBinaryExpr()); return this.finish(node_2); } return node; }; return LESSParser; }(Parser)); var __extends$1 = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var localize = main$3.loadMessageBundle(); var LESSCompletion = (function (_super) { __extends$1(LESSCompletion, _super); function LESSCompletion(lsOptions, cssDataManager) { return _super.call(this, '@', lsOptions, cssDataManager) || this; } LESSCompletion.prototype.createFunctionProposals = function (proposals, existingNode, sortToEnd, result) { for (var _i = 0, proposals_1 = proposals; _i < proposals_1.length; _i++) { var p = proposals_1[_i]; var item = { label: p.name, detail: p.example, documentation: p.description, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), p.name + '($0)'), insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Function }; if (sortToEnd) { item.sortText = 'z'; } result.items.push(item); } return result; }; LESSCompletion.prototype.getTermProposals = function (entry, existingNode, result) { var functions = LESSCompletion.builtInProposals; if (entry) { functions = functions.filter(function (f) { return !f.type || !entry.restrictions || entry.restrictions.indexOf(f.type) !== -1; }); } this.createFunctionProposals(functions, existingNode, true, result); return _super.prototype.getTermProposals.call(this, entry, existingNode, result); }; LESSCompletion.prototype.getColorProposals = function (entry, existingNode, result) { this.createFunctionProposals(LESSCompletion.colorProposals, existingNode, false, result); return _super.prototype.getColorProposals.call(this, entry, existingNode, result); }; LESSCompletion.prototype.getCompletionsForDeclarationProperty = function (declaration, result) { this.getCompletionsForSelector(null, true, result); return _super.prototype.getCompletionsForDeclarationProperty.call(this, declaration, result); }; LESSCompletion.builtInProposals = [ { 'name': 'if', 'example': 'if(condition, trueValue [, falseValue]);', 'description': localize('less.builtin.if', 'returns one of two values depending on a condition.') }, { 'name': 'boolean', 'example': 'boolean(condition);', 'description': localize('less.builtin.boolean', '"store" a boolean test for later evaluation in a guard or if().') }, { 'name': 'length', 'example': 'length(@list);', 'description': localize('less.builtin.length', 'returns the number of elements in a value list') }, { 'name': 'extract', 'example': 'extract(@list, index);', 'description': localize('less.builtin.extract', 'returns a value at the specified position in the list') }, { 'name': 'range', 'example': 'range([start, ] end [, step]);', 'description': localize('less.builtin.range', 'generate a list spanning a range of values') }, { 'name': 'each', 'example': 'each(@list, ruleset);', 'description': localize('less.builtin.each', 'bind the evaluation of a ruleset to each member of a list.') }, { 'name': 'escape', 'example': 'escape(@string);', 'description': localize('less.builtin.escape', 'URL encodes a string') }, { 'name': 'e', 'example': 'e(@string);', 'description': localize('less.builtin.e', 'escape string content') }, { 'name': 'replace', 'example': 'replace(@string, @pattern, @replacement[, @flags]);', 'description': localize('less.builtin.replace', 'string replace') }, { 'name': 'unit', 'example': 'unit(@dimension, [@unit: \'\']);', 'description': localize('less.builtin.unit', 'remove or change the unit of a dimension') }, { 'name': 'color', 'example': 'color(@string);', 'description': localize('less.builtin.color', 'parses a string to a color'), 'type': 'color' }, { 'name': 'convert', 'example': 'convert(@value, unit);', 'description': localize('less.builtin.convert', 'converts numbers from one type into another') }, { 'name': 'data-uri', 'example': 'data-uri([mimetype,] url);', 'description': localize('less.builtin.data-uri', 'inlines a resource and falls back to `url()`'), 'type': 'url' }, { 'name': 'abs', 'description': localize('less.builtin.abs', 'absolute value of a number'), 'example': 'abs(number);' }, { 'name': 'acos', 'description': localize('less.builtin.acos', 'arccosine - inverse of cosine function'), 'example': 'acos(number);' }, { 'name': 'asin', 'description': localize('less.builtin.asin', 'arcsine - inverse of sine function'), 'example': 'asin(number);' }, { 'name': 'ceil', 'example': 'ceil(@number);', 'description': localize('less.builtin.ceil', 'rounds up to an integer') }, { 'name': 'cos', 'description': localize('less.builtin.cos', 'cosine function'), 'example': 'cos(number);' }, { 'name': 'floor', 'description': localize('less.builtin.floor', 'rounds down to an integer'), 'example': 'floor(@number);' }, { 'name': 'percentage', 'description': localize('less.builtin.percentage', 'converts to a %, e.g. 0.5 > 50%'), 'example': 'percentage(@number);', 'type': 'percentage' }, { 'name': 'round', 'description': localize('less.builtin.round', 'rounds a number to a number of places'), 'example': 'round(number, [places: 0]);' }, { 'name': 'sqrt', 'description': localize('less.builtin.sqrt', 'calculates square root of a number'), 'example': 'sqrt(number);' }, { 'name': 'sin', 'description': localize('less.builtin.sin', 'sine function'), 'example': 'sin(number);' }, { 'name': 'tan', 'description': localize('less.builtin.tan', 'tangent function'), 'example': 'tan(number);' }, { 'name': 'atan', 'description': localize('less.builtin.atan', 'arctangent - inverse of tangent function'), 'example': 'atan(number);' }, { 'name': 'pi', 'description': localize('less.builtin.pi', 'returns pi'), 'example': 'pi();' }, { 'name': 'pow', 'description': localize('less.builtin.pow', 'first argument raised to the power of the second argument'), 'example': 'pow(@base, @exponent);' }, { 'name': 'mod', 'description': localize('less.builtin.mod', 'first argument modulus second argument'), 'example': 'mod(number, number);' }, { 'name': 'min', 'description': localize('less.builtin.min', 'returns the lowest of one or more values'), 'example': 'min(@x, @y);' }, { 'name': 'max', 'description': localize('less.builtin.max', 'returns the lowest of one or more values'), 'example': 'max(@x, @y);' } ]; LESSCompletion.colorProposals = [ { 'name': 'argb', 'example': 'argb(@color);', 'description': localize('less.builtin.argb', 'creates a #AARRGGBB') }, { 'name': 'hsl', 'example': 'hsl(@hue, @saturation, @lightness);', 'description': localize('less.builtin.hsl', 'creates a color') }, { 'name': 'hsla', 'example': 'hsla(@hue, @saturation, @lightness, @alpha);', 'description': localize('less.builtin.hsla', 'creates a color') }, { 'name': 'hsv', 'example': 'hsv(@hue, @saturation, @value);', 'description': localize('less.builtin.hsv', 'creates a color') }, { 'name': 'hsva', 'example': 'hsva(@hue, @saturation, @value, @alpha);', 'description': localize('less.builtin.hsva', 'creates a color') }, { 'name': 'hue', 'example': 'hue(@color);', 'description': localize('less.builtin.hue', 'returns the `hue` channel of `@color` in the HSL space') }, { 'name': 'saturation', 'example': 'saturation(@color);', 'description': localize('less.builtin.saturation', 'returns the `saturation` channel of `@color` in the HSL space') }, { 'name': 'lightness', 'example': 'lightness(@color);', 'description': localize('less.builtin.lightness', 'returns the `lightness` channel of `@color` in the HSL space') }, { 'name': 'hsvhue', 'example': 'hsvhue(@color);', 'description': localize('less.builtin.hsvhue', 'returns the `hue` channel of `@color` in the HSV space') }, { 'name': 'hsvsaturation', 'example': 'hsvsaturation(@color);', 'description': localize('less.builtin.hsvsaturation', 'returns the `saturation` channel of `@color` in the HSV space') }, { 'name': 'hsvvalue', 'example': 'hsvvalue(@color);', 'description': localize('less.builtin.hsvvalue', 'returns the `value` channel of `@color` in the HSV space') }, { 'name': 'red', 'example': 'red(@color);', 'description': localize('less.builtin.red', 'returns the `red` channel of `@color`') }, { 'name': 'green', 'example': 'green(@color);', 'description': localize('less.builtin.green', 'returns the `green` channel of `@color`') }, { 'name': 'blue', 'example': 'blue(@color);', 'description': localize('less.builtin.blue', 'returns the `blue` channel of `@color`') }, { 'name': 'alpha', 'example': 'alpha(@color);', 'description': localize('less.builtin.alpha', 'returns the `alpha` channel of `@color`') }, { 'name': 'luma', 'example': 'luma(@color);', 'description': localize('less.builtin.luma', 'returns the `luma` value (perceptual brightness) of `@color`') }, { 'name': 'saturate', 'example': 'saturate(@color, 10%);', 'description': localize('less.builtin.saturate', 'return `@color` 10% points more saturated') }, { 'name': 'desaturate', 'example': 'desaturate(@color, 10%);', 'description': localize('less.builtin.desaturate', 'return `@color` 10% points less saturated') }, { 'name': 'lighten', 'example': 'lighten(@color, 10%);', 'description': localize('less.builtin.lighten', 'return `@color` 10% points lighter') }, { 'name': 'darken', 'example': 'darken(@color, 10%);', 'description': localize('less.builtin.darken', 'return `@color` 10% points darker') }, { 'name': 'fadein', 'example': 'fadein(@color, 10%);', 'description': localize('less.builtin.fadein', 'return `@color` 10% points less transparent') }, { 'name': 'fadeout', 'example': 'fadeout(@color, 10%);', 'description': localize('less.builtin.fadeout', 'return `@color` 10% points more transparent') }, { 'name': 'fade', 'example': 'fade(@color, 50%);', 'description': localize('less.builtin.fade', 'return `@color` with 50% transparency') }, { 'name': 'spin', 'example': 'spin(@color, 10);', 'description': localize('less.builtin.spin', 'return `@color` with a 10 degree larger in hue') }, { 'name': 'mix', 'example': 'mix(@color1, @color2, [@weight: 50%]);', 'description': localize('less.builtin.mix', 'return a mix of `@color1` and `@color2`') }, { 'name': 'greyscale', 'example': 'greyscale(@color);', 'description': localize('less.builtin.greyscale', 'returns a grey, 100% desaturated color'), }, { 'name': 'contrast', 'example': 'contrast(@color1, [@darkcolor: black], [@lightcolor: white], [@threshold: 43%]);', 'description': localize('less.builtin.contrast', 'return `@darkcolor` if `@color1 is> 43% luma` otherwise return `@lightcolor`, see notes') }, { 'name': 'multiply', 'example': 'multiply(@color1, @color2);' }, { 'name': 'screen', 'example': 'screen(@color1, @color2);' }, { 'name': 'overlay', 'example': 'overlay(@color1, @color2);' }, { 'name': 'softlight', 'example': 'softlight(@color1, @color2);' }, { 'name': 'hardlight', 'example': 'hardlight(@color1, @color2);' }, { 'name': 'difference', 'example': 'difference(@color1, @color2);' }, { 'name': 'exclusion', 'example': 'exclusion(@color1, @color2);' }, { 'name': 'average', 'example': 'average(@color1, @color2);' }, { 'name': 'negation', 'example': 'negation(@color1, @color2);' } ]; return LESSCompletion; }(CSSCompletion)); function getFoldingRanges(document, context) { var ranges = computeFoldingRanges(document); return limitFoldingRanges(ranges, context); } function computeFoldingRanges(document) { function getStartLine(t) { return document.positionAt(t.offset).line; } function getEndLine(t) { return document.positionAt(t.offset + t.len).line; } function getScanner() { switch (document.languageId) { case 'scss': return new SCSSScanner(); case 'less': return new LESSScanner(); default: return new Scanner(); } } function tokenToRange(t, kind) { var startLine = getStartLine(t); var endLine = getEndLine(t); if (startLine !== endLine) { return { startLine: startLine, endLine: endLine, kind: kind }; } else { return null; } } var ranges = []; var delimiterStack = []; var scanner = getScanner(); scanner.ignoreComment = false; scanner.setSource(document.getText()); var token = scanner.scan(); var prevToken = null; var _loop_1 = function () { switch (token.type) { case TokenType.CurlyL: case InterpolationFunction: { delimiterStack.push({ line: getStartLine(token), type: 'brace', isStart: true }); break; } case TokenType.CurlyR: { if (delimiterStack.length !== 0) { var prevDelimiter = popPrevStartDelimiterOfType(delimiterStack, 'brace'); if (!prevDelimiter) { break; } var endLine = getEndLine(token); if (prevDelimiter.type === 'brace') { if (prevToken && getEndLine(prevToken) !== endLine) { endLine--; } if (prevDelimiter.line !== endLine) { ranges.push({ startLine: prevDelimiter.line, endLine: endLine, kind: undefined }); } } } break; } case TokenType.Comment: { var commentRegionMarkerToDelimiter_1 = function (marker) { if (marker === '#region') { return { line: getStartLine(token), type: 'comment', isStart: true }; } else { return { line: getEndLine(token), type: 'comment', isStart: false }; } }; var getCurrDelimiter = function (token) { var matches = token.text.match(/^\s*\/\*\s*(#region|#endregion)\b\s*(.*?)\s*\*\//); if (matches) { return commentRegionMarkerToDelimiter_1(matches[1]); } else if (document.languageId === 'scss' || document.languageId === 'less') { var matches_1 = token.text.match(/^\s*\/\/\s*(#region|#endregion)\b\s*(.*?)\s*/); if (matches_1) { return commentRegionMarkerToDelimiter_1(matches_1[1]); } } return null; }; var currDelimiter = getCurrDelimiter(token); if (currDelimiter) { if (currDelimiter.isStart) { delimiterStack.push(currDelimiter); } else { var prevDelimiter = popPrevStartDelimiterOfType(delimiterStack, 'comment'); if (!prevDelimiter) { break; } if (prevDelimiter.type === 'comment') { if (prevDelimiter.line !== currDelimiter.line) { ranges.push({ startLine: prevDelimiter.line, endLine: currDelimiter.line, kind: 'region' }); } } } } else { var range = tokenToRange(token, 'comment'); if (range) { ranges.push(range); } } break; } } prevToken = token; token = scanner.scan(); }; while (token.type !== TokenType.EOF) { _loop_1(); } return ranges; } function popPrevStartDelimiterOfType(stack, type) { if (stack.length === 0) { return null; } for (var i = stack.length - 1; i >= 0; i--) { if (stack[i].type === type && stack[i].isStart) { return stack.splice(i, 1)[0]; } } return null; } function limitFoldingRanges(ranges, context) { var maxRanges = context && context.rangeLimit || Number.MAX_VALUE; var sortedRanges = ranges.sort(function (r1, r2) { var diff = r1.startLine - r2.startLine; if (diff === 0) { diff = r1.endLine - r2.endLine; } return diff; }); var validRanges = []; var prevEndLine = -1; sortedRanges.forEach(function (r) { if (!(r.startLine < prevEndLine && prevEndLine < r.endLine)) { validRanges.push(r); prevEndLine = r.endLine; } }); if (validRanges.length < maxRanges) { return validRanges; } else { return validRanges.slice(0, maxRanges); } } var cssData = { "version": 1.1, "properties": [ { "name": "additive-symbols", "browsers": [ "FF33" ], "syntax": "[ <integer> && <symbol> ]#", "relevance": 50, "description": "@counter-style descriptor. Specifies the symbols used by the marker-construction algorithm specified by the system descriptor. Needs to be specified if the counter system is 'additive'.", "restrictions": [ "integer", "string", "image", "identifier" ] }, { "name": "align-content", "values": [ { "name": "center", "description": "Lines are packed toward the center of the flex container." }, { "name": "flex-end", "description": "Lines are packed toward the end of the flex container." }, { "name": "flex-start", "description": "Lines are packed toward the start of the flex container." }, { "name": "space-around", "description": "Lines are evenly distributed in the flex container, with half-size spaces on either end." }, { "name": "space-between", "description": "Lines are evenly distributed in the flex container." }, { "name": "stretch", "description": "Lines stretch to take up the remaining space." } ], "syntax": "normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>", "relevance": 62, "description": "Aligns a flex container’s lines within the flex container when there is extra space in the cross-axis, similar to how 'justify-content' aligns individual items within the main-axis.", "restrictions": [ "enum" ] }, { "name": "align-items", "values": [ { "name": "baseline", "description": "If the flex item’s inline axis is the same as the cross axis, this value is identical to 'flex-start'. Otherwise, it participates in baseline alignment." }, { "name": "center", "description": "The flex item’s margin box is centered in the cross axis within the line." }, { "name": "flex-end", "description": "The cross-end margin edge of the flex item is placed flush with the cross-end edge of the line." }, { "name": "flex-start", "description": "The cross-start margin edge of the flex item is placed flush with the cross-start edge of the line." }, { "name": "stretch", "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." } ], "syntax": "normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ]", "relevance": 86, "description": "Aligns flex items along the cross axis of the current line of the flex container.", "restrictions": [ "enum" ] }, { "name": "justify-items", "values": [ { "name": "auto" }, { "name": "normal" }, { "name": "end" }, { "name": "start" }, { "name": "flex-end", "description": "\"Flex items are packed toward the end of the line.\"" }, { "name": "flex-start", "description": "\"Flex items are packed toward the start of the line.\"" }, { "name": "self-end", "description": "The item is packed flush to the edge of the alignment container of the end side of the item, in the appropriate axis." }, { "name": "self-start", "description": "The item is packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis.." }, { "name": "center", "description": "The items are packed flush to each other toward the center of the of the alignment container." }, { "name": "left" }, { "name": "right" }, { "name": "baseline" }, { "name": "first baseline" }, { "name": "last baseline" }, { "name": "stretch", "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." }, { "name": "save" }, { "name": "unsave" }, { "name": "legacy" } ], "syntax": "normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | legacy | legacy && [ left | right | center ]", "relevance": 53, "description": "Defines the default justify-self for all items of the box, giving them the default way of justifying each box along the appropriate axis", "restrictions": [ "enum" ] }, { "name": "justify-self", "values": [ { "name": "auto" }, { "name": "normal" }, { "name": "end" }, { "name": "start" }, { "name": "flex-end", "description": "\"Flex items are packed toward the end of the line.\"" }, { "name": "flex-start", "description": "\"Flex items are packed toward the start of the line.\"" }, { "name": "self-end", "description": "The item is packed flush to the edge of the alignment container of the end side of the item, in the appropriate axis." }, { "name": "self-start", "description": "The item is packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis.." }, { "name": "center", "description": "The items are packed flush to each other toward the center of the of the alignment container." }, { "name": "left" }, { "name": "right" }, { "name": "baseline" }, { "name": "first baseline" }, { "name": "last baseline" }, { "name": "stretch", "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." }, { "name": "save" }, { "name": "unsave" } ], "syntax": "auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ]", "relevance": 53, "description": "Defines the way of justifying a box inside its container along the appropriate axis.", "restrictions": [ "enum" ] }, { "name": "align-self", "values": [ { "name": "auto", "description": "Computes to the value of 'align-items' on the element’s parent, or 'stretch' if the element has no parent. On absolutely positioned elements, it computes to itself." }, { "name": "baseline", "description": "If the flex item’s inline axis is the same as the cross axis, this value is identical to 'flex-start'. Otherwise, it participates in baseline alignment." }, { "name": "center", "description": "The flex item’s margin box is centered in the cross axis within the line." }, { "name": "flex-end", "description": "The cross-end margin edge of the flex item is placed flush with the cross-end edge of the line." }, { "name": "flex-start", "description": "The cross-start margin edge of the flex item is placed flush with the cross-start edge of the line." }, { "name": "stretch", "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." } ], "syntax": "auto | normal | stretch | <baseline-position> | <overflow-position>? <self-position>", "relevance": 72, "description": "Allows the default alignment along the cross axis to be overridden for individual flex items.", "restrictions": [ "enum" ] }, { "name": "all", "browsers": [ "E79", "FF27", "S9.1", "C37", "O24" ], "values": [], "syntax": "initial | inherit | unset | revert", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/all" } ], "description": "Shorthand that resets all properties except 'direction' and 'unicode-bidi'.", "restrictions": [ "enum" ] }, { "name": "alt", "browsers": [ "S9" ], "values": [], "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/alt" } ], "description": "Provides alternative text for assistive technology to replace the generated content of a ::before or ::after element.", "restrictions": [ "string", "enum" ] }, { "name": "animation", "values": [ { "name": "alternate", "description": "The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction." }, { "name": "alternate-reverse", "description": "The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction." }, { "name": "backwards", "description": "The beginning property value (as defined in the first @keyframes at-rule) is applied before the animation is displayed, during the period defined by 'animation-delay'." }, { "name": "both", "description": "Both forwards and backwards fill modes are applied." }, { "name": "forwards", "description": "The final property value (as defined in the last @keyframes at-rule) is maintained after the animation completes." }, { "name": "infinite", "description": "Causes the animation to repeat forever." }, { "name": "none", "description": "No animation is performed" }, { "name": "normal", "description": "Normal playback." }, { "name": "reverse", "description": "All iterations of the animation are played in the reverse direction from the way they were specified." } ], "syntax": "<single-animation>#", "relevance": 82, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/animation" } ], "description": "Shorthand property combines six of the animation properties into a single property.", "restrictions": [ "time", "timing-function", "enum", "identifier", "number" ] }, { "name": "animation-delay", "syntax": "<time>#", "relevance": 63, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/animation-delay" } ], "description": "Defines when the animation will start.", "restrictions": [ "time" ] }, { "name": "animation-direction", "values": [ { "name": "alternate", "description": "The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction." }, { "name": "alternate-reverse", "description": "The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction." }, { "name": "normal", "description": "Normal playback." }, { "name": "reverse", "description": "All iterations of the animation are played in the reverse direction from the way they were specified." } ], "syntax": "<single-animation-direction>#", "relevance": 56, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/animation-direction" } ], "description": "Defines whether or not the animation should play in reverse on alternate cycles.", "restrictions": [ "enum" ] }, { "name": "animation-duration", "syntax": "<time>#", "relevance": 70, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/animation-duration" } ], "description": "Defines the length of time that an animation takes to complete one cycle.", "restrictions": [ "time" ] }, { "name": "animation-fill-mode", "values": [ { "name": "backwards", "description": "The beginning property value (as defined in the first @keyframes at-rule) is applied before the animation is displayed, during the period defined by 'animation-delay'." }, { "name": "both", "description": "Both forwards and backwards fill modes are applied." }, { "name": "forwards", "description": "The final property value (as defined in the last @keyframes at-rule) is maintained after the animation completes." }, { "name": "none", "description": "There is no change to the property value between the time the animation is applied and the time the animation begins playing or after the animation completes." } ], "syntax": "<single-animation-fill-mode>#", "relevance": 63, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode" } ], "description": "Defines what values are applied by the animation outside the time it is executing.", "restrictions": [ "enum" ] }, { "name": "animation-iteration-count", "values": [ { "name": "infinite", "description": "Causes the animation to repeat forever." } ], "syntax": "<single-animation-iteration-count>#", "relevance": 60, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count" } ], "description": "Defines the number of times an animation cycle is played. The default value is one, meaning the animation will play from beginning to end once.", "restrictions": [ "number", "enum" ] }, { "name": "animation-name", "values": [ { "name": "none", "description": "No animation is performed" } ], "syntax": "[ none | <keyframes-name> ]#", "relevance": 70, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/animation-name" } ], "description": "Defines a list of animations that apply. Each name is used to select the keyframe at-rule that provides the property values for the animation.", "restrictions": [ "identifier", "enum" ] }, { "name": "animation-play-state", "values": [ { "name": "paused", "description": "A running animation will be paused." }, { "name": "running", "description": "Resume playback of a paused animation." } ], "syntax": "<single-animation-play-state>#", "relevance": 54, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/animation-play-state" } ], "description": "Defines whether the animation is running or paused.", "restrictions": [ "enum" ] }, { "name": "animation-timing-function", "syntax": "<easing-function>#", "relevance": 70, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/animation-timing-function" } ], "description": "Describes how the animation will progress over one cycle of its duration.", "restrictions": [ "timing-function" ] }, { "name": "backface-visibility", "values": [ { "name": "hidden", "description": "Back side is hidden." }, { "name": "visible", "description": "Back side is visible." } ], "syntax": "visible | hidden", "relevance": 59, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/backface-visibility" } ], "description": "Determines whether or not the 'back' side of a transformed element is visible when facing the viewer. With an identity transform, the front side of an element faces the viewer.", "restrictions": [ "enum" ] }, { "name": "background", "values": [ { "name": "fixed", "description": "The background is fixed with regard to the viewport. In paged media where there is no viewport, a 'fixed' background is fixed with respect to the page box and therefore replicated on every page." }, { "name": "local", "description": "The background is fixed with regard to the element's contents: if the element has a scrolling mechanism, the background scrolls with the element's contents." }, { "name": "none", "description": "A value of 'none' counts as an image layer but draws nothing." }, { "name": "scroll", "description": "The background is fixed with regard to the element itself and does not scroll with its contents. (It is effectively attached to the element's border.)" } ], "syntax": "[ <bg-layer> , ]* <final-bg-layer>", "relevance": 93, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background" } ], "description": "Shorthand property for setting most background properties at the same place in the style sheet.", "restrictions": [ "enum", "image", "color", "position", "length", "repeat", "percentage", "box" ] }, { "name": "background-attachment", "values": [ { "name": "fixed", "description": "The background is fixed with regard to the viewport. In paged media where there is no viewport, a 'fixed' background is fixed with respect to the page box and therefore replicated on every page." }, { "name": "local", "description": "The background is fixed with regard to the element’s contents: if the element has a scrolling mechanism, the background scrolls with the element’s contents." }, { "name": "scroll", "description": "The background is fixed with regard to the element itself and does not scroll with its contents. (It is effectively attached to the element’s border.)" } ], "syntax": "<attachment>#", "relevance": 54, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-attachment" } ], "description": "Specifies whether the background images are fixed with regard to the viewport ('fixed') or scroll along with the element ('scroll') or its contents ('local').", "restrictions": [ "enum" ] }, { "name": "background-blend-mode", "browsers": [ "E79", "FF30", "S8", "C35", "O22" ], "values": [ { "name": "normal", "description": "Default attribute which specifies no blending" }, { "name": "multiply", "description": "The source color is multiplied by the destination color and replaces the destination." }, { "name": "screen", "description": "Multiplies the complements of the backdrop and source color values, then complements the result." }, { "name": "overlay", "description": "Multiplies or screens the colors, depending on the backdrop color value." }, { "name": "darken", "description": "Selects the darker of the backdrop and source colors." }, { "name": "lighten", "description": "Selects the lighter of the backdrop and source colors." }, { "name": "color-dodge", "description": "Brightens the backdrop color to reflect the source color." }, { "name": "color-burn", "description": "Darkens the backdrop color to reflect the source color." }, { "name": "hard-light", "description": "Multiplies or screens the colors, depending on the source color value." }, { "name": "soft-light", "description": "Darkens or lightens the colors, depending on the source color value." }, { "name": "difference", "description": "Subtracts the darker of the two constituent colors from the lighter color.." }, { "name": "exclusion", "description": "Produces an effect similar to that of the Difference mode but lower in contrast." }, { "name": "hue", "browsers": [ "E79", "FF30", "S8", "C35", "O22" ], "description": "Creates a color with the hue of the source color and the saturation and luminosity of the backdrop color." }, { "name": "saturation", "browsers": [ "E79", "FF30", "S8", "C35", "O22" ], "description": "Creates a color with the saturation of the source color and the hue and luminosity of the backdrop color." }, { "name": "color", "browsers": [ "E79", "FF30", "S8", "C35", "O22" ], "description": "Creates a color with the hue and saturation of the source color and the luminosity of the backdrop color." }, { "name": "luminosity", "browsers": [ "E79", "FF30", "S8", "C35", "O22" ], "description": "Creates a color with the luminosity of the source color and the hue and saturation of the backdrop color." } ], "syntax": "<blend-mode>#", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-blend-mode" } ], "description": "Defines the blending mode of each background layer.", "restrictions": [ "enum" ] }, { "name": "background-clip", "syntax": "<box>#", "relevance": 68, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-clip" } ], "description": "Determines the background painting area.", "restrictions": [ "box" ] }, { "name": "background-color", "syntax": "<color>", "relevance": 94, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-color" } ], "description": "Sets the background color of an element.", "restrictions": [ "color" ] }, { "name": "background-image", "values": [ { "name": "none", "description": "Counts as an image layer but draws nothing." } ], "syntax": "<bg-image>#", "relevance": 89, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-image" } ], "description": "Sets the background image(s) of an element.", "restrictions": [ "image", "enum" ] }, { "name": "background-origin", "syntax": "<box>#", "relevance": 54, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-origin" } ], "description": "For elements rendered as a single box, specifies the background positioning area. For elements rendered as multiple boxes (e.g., inline boxes on several lines, boxes on several pages) specifies which boxes 'box-decoration-break' operates on to determine the background positioning area(s).", "restrictions": [ "box" ] }, { "name": "background-position", "syntax": "<bg-position>#", "relevance": 88, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-position" } ], "description": "Specifies the initial position of the background image(s) (after any resizing) within their corresponding background positioning area.", "restrictions": [ "position", "length", "percentage" ] }, { "name": "background-position-x", "values": [ { "name": "center", "description": "Equivalent to '50%' ('left 50%') for the horizontal position if the horizontal position is not otherwise specified, or '50%' ('top 50%') for the vertical position if it is." }, { "name": "left", "description": "Equivalent to '0%' for the horizontal position if one or two values are given, otherwise specifies the left edge as the origin for the next offset." }, { "name": "right", "description": "Equivalent to '100%' for the horizontal position if one or two values are given, otherwise specifies the right edge as the origin for the next offset." } ], "status": "experimental", "syntax": "[ center | [ [ left | right | x-start | x-end ]? <length-percentage>? ]! ]#", "relevance": 54, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-position-x" } ], "description": "If background images have been specified, this property specifies their initial position (after any resizing) within their corresponding background positioning area.", "restrictions": [ "length", "percentage" ] }, { "name": "background-position-y", "values": [ { "name": "bottom", "description": "Equivalent to '100%' for the vertical position if one or two values are given, otherwise specifies the bottom edge as the origin for the next offset." }, { "name": "center", "description": "Equivalent to '50%' ('left 50%') for the horizontal position if the horizontal position is not otherwise specified, or '50%' ('top 50%') for the vertical position if it is." }, { "name": "top", "description": "Equivalent to '0%' for the vertical position if one or two values are given, otherwise specifies the top edge as the origin for the next offset." } ], "status": "experimental", "syntax": "[ center | [ [ top | bottom | y-start | y-end ]? <length-percentage>? ]! ]#", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-position-y" } ], "description": "If background images have been specified, this property specifies their initial position (after any resizing) within their corresponding background positioning area.", "restrictions": [ "length", "percentage" ] }, { "name": "background-repeat", "values": [], "syntax": "<repeat-style>#", "relevance": 86, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-repeat" } ], "description": "Specifies how background images are tiled after they have been sized and positioned.", "restrictions": [ "repeat" ] }, { "name": "background-size", "values": [ { "name": "auto", "description": "Resolved by using the image’s intrinsic ratio and the size of the other dimension, or failing that, using the image’s intrinsic size, or failing that, treating it as 100%." }, { "name": "contain", "description": "Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area." }, { "name": "cover", "description": "Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area." } ], "syntax": "<bg-size>#", "relevance": 86, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/background-size" } ], "description": "Specifies the size of the background images.", "restrictions": [ "length", "percentage" ] }, { "name": "behavior", "browsers": [ "IE6" ], "relevance": 50, "description": "IE only. Used to extend behaviors of the browser.", "restrictions": [ "url" ] }, { "name": "block-size", "browsers": [ "E79", "FF41", "S12.1", "C57", "O44" ], "values": [ { "name": "auto", "description": "Depends on the values of other properties." } ], "syntax": "<'width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/block-size" } ], "description": "Size of an element in the direction opposite that of the direction specified by 'writing-mode'.", "restrictions": [ "length", "percentage" ] }, { "name": "border", "syntax": "<line-width> || <line-style> || <color>", "relevance": 96, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border" } ], "description": "Shorthand property for setting border width, style, and color.", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "border-block-end", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-width'> || <'border-top-style'> || <color>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-end" } ], "description": "Logical 'border-bottom'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "border-block-start", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-width'> || <'border-top-style'> || <color>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-start" } ], "description": "Logical 'border-top'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "border-block-end-color", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-color'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-end-color" } ], "description": "Logical 'border-bottom-color'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "color" ] }, { "name": "border-block-start-color", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-color'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-start-color" } ], "description": "Logical 'border-top-color'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "color" ] }, { "name": "border-block-end-style", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-style'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-end-style" } ], "description": "Logical 'border-bottom-style'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "line-style" ] }, { "name": "border-block-start-style", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-style'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-start-style" } ], "description": "Logical 'border-top-style'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "line-style" ] }, { "name": "border-block-end-width", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-end-width" } ], "description": "Logical 'border-bottom-width'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "line-width" ] }, { "name": "border-block-start-width", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-start-width" } ], "description": "Logical 'border-top-width'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "line-width" ] }, { "name": "border-bottom", "syntax": "<line-width> || <line-style> || <color>", "relevance": 89, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-bottom" } ], "description": "Shorthand property for setting border width, style and color.", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "border-bottom-color", "syntax": "<'border-top-color'>", "relevance": 71, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-bottom-color" } ], "description": "Sets the color of the bottom border.", "restrictions": [ "color" ] }, { "name": "border-bottom-left-radius", "syntax": "<length-percentage>{1,2}", "relevance": 75, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius" } ], "description": "Defines the radii of the bottom left outer border edge.", "restrictions": [ "length", "percentage" ] }, { "name": "border-bottom-right-radius", "syntax": "<length-percentage>{1,2}", "relevance": 74, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius" } ], "description": "Defines the radii of the bottom right outer border edge.", "restrictions": [ "length", "percentage" ] }, { "name": "border-bottom-style", "syntax": "<line-style>", "relevance": 58, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-bottom-style" } ], "description": "Sets the style of the bottom border.", "restrictions": [ "line-style" ] }, { "name": "border-bottom-width", "syntax": "<line-width>", "relevance": 62, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-bottom-width" } ], "description": "Sets the thickness of the bottom border.", "restrictions": [ "length", "line-width" ] }, { "name": "border-collapse", "values": [ { "name": "collapse", "description": "Selects the collapsing borders model." }, { "name": "separate", "description": "Selects the separated borders border model." } ], "syntax": "collapse | separate", "relevance": 74, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-collapse" } ], "description": "Selects a table's border model.", "restrictions": [ "enum" ] }, { "name": "border-color", "values": [], "syntax": "<color>{1,4}", "relevance": 87, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-color" } ], "description": "The color of the border around all four edges of an element.", "restrictions": [ "color" ] }, { "name": "border-image", "values": [ { "name": "auto", "description": "If 'auto' is specified then the border image width is the intrinsic width or height (whichever is applicable) of the corresponding image slice. If the image does not have the required intrinsic dimension then the corresponding border-width is used instead." }, { "name": "fill", "description": "Causes the middle part of the border-image to be preserved." }, { "name": "none", "description": "Use the border styles." }, { "name": "repeat", "description": "The image is tiled (repeated) to fill the area." }, { "name": "round", "description": "The image is tiled (repeated) to fill the area. If it does not fill the area with a whole number of tiles, the image is rescaled so that it does." }, { "name": "space", "description": "The image is tiled (repeated) to fill the area. If it does not fill the area with a whole number of tiles, the extra space is distributed around the tiles." }, { "name": "stretch", "description": "The image is stretched to fill the area." }, { "name": "url()" } ], "syntax": "<'border-image-source'> || <'border-image-slice'> [ / <'border-image-width'> | / <'border-image-width'>? / <'border-image-outset'> ]? || <'border-image-repeat'>", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-image" } ], "description": "Shorthand property for setting 'border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset' and 'border-image-repeat'. Omitted values are set to their initial values.", "restrictions": [ "length", "percentage", "number", "url", "enum" ] }, { "name": "border-image-outset", "syntax": "[ <length> | <number> ]{1,4}", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-image-outset" } ], "description": "The values specify the amount by which the border image area extends beyond the border box on the top, right, bottom, and left sides respectively. If the fourth value is absent, it is the same as the second. If the third one is also absent, it is the same as the first. If the second one is also absent, it is the same as the first. Numbers represent multiples of the corresponding border-width.", "restrictions": [ "length", "number" ] }, { "name": "border-image-repeat", "values": [ { "name": "repeat", "description": "The image is tiled (repeated) to fill the area." }, { "name": "round", "description": "The image is tiled (repeated) to fill the area. If it does not fill the area with a whole number of tiles, the image is rescaled so that it does." }, { "name": "space", "description": "The image is tiled (repeated) to fill the area. If it does not fill the area with a whole number of tiles, the extra space is distributed around the tiles." }, { "name": "stretch", "description": "The image is stretched to fill the area." } ], "syntax": "[ stretch | repeat | round | space ]{1,2}", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-image-repeat" } ], "description": "Specifies how the images for the sides and the middle part of the border image are scaled and tiled. If the second keyword is absent, it is assumed to be the same as the first.", "restrictions": [ "enum" ] }, { "name": "border-image-slice", "values": [ { "name": "fill", "description": "Causes the middle part of the border-image to be preserved." } ], "syntax": "<number-percentage>{1,4} && fill?", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-image-slice" } ], "description": "Specifies inward offsets from the top, right, bottom, and left edges of the image, dividing it into nine regions: four corners, four edges and a middle.", "restrictions": [ "number", "percentage" ] }, { "name": "border-image-source", "values": [ { "name": "none", "description": "Use the border styles." } ], "syntax": "none | <image>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-image-source" } ], "description": "Specifies an image to use instead of the border styles given by the 'border-style' properties and as an additional background layer for the element. If the value is 'none' or if the image cannot be displayed, the border styles will be used.", "restrictions": [ "image" ] }, { "name": "border-image-width", "values": [ { "name": "auto", "description": "The border image width is the intrinsic width or height (whichever is applicable) of the corresponding image slice. If the image does not have the required intrinsic dimension then the corresponding border-width is used instead." } ], "syntax": "[ <length-percentage> | <number> | auto ]{1,4}", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-image-width" } ], "description": "The four values of 'border-image-width' specify offsets that are used to divide the border image area into nine parts. They represent inward distances from the top, right, bottom, and left sides of the area, respectively.", "restrictions": [ "length", "percentage", "number" ] }, { "name": "border-inline-end", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-width'> || <'border-top-style'> || <color>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-end" } ], "description": "Logical 'border-right'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "border-inline-start", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-width'> || <'border-top-style'> || <color>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-start" } ], "description": "Logical 'border-left'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "border-inline-end-color", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-color'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-color" } ], "description": "Logical 'border-right-color'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "color" ] }, { "name": "border-inline-start-color", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-color'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-color" } ], "description": "Logical 'border-left-color'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "color" ] }, { "name": "border-inline-end-style", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-style'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-style" } ], "description": "Logical 'border-right-style'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "line-style" ] }, { "name": "border-inline-start-style", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-style'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-style" } ], "description": "Logical 'border-left-style'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "line-style" ] }, { "name": "border-inline-end-width", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-end-width" } ], "description": "Logical 'border-right-width'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "line-width" ] }, { "name": "border-inline-start-width", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'border-top-width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-start-width" } ], "description": "Logical 'border-left-width'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "line-width" ] }, { "name": "border-left", "syntax": "<line-width> || <line-style> || <color>", "relevance": 83, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-left" } ], "description": "Shorthand property for setting border width, style and color", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "border-left-color", "syntax": "<color>", "relevance": 65, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-left-color" } ], "description": "Sets the color of the left border.", "restrictions": [ "color" ] }, { "name": "border-left-style", "syntax": "<line-style>", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-left-style" } ], "description": "Sets the style of the left border.", "restrictions": [ "line-style" ] }, { "name": "border-left-width", "syntax": "<line-width>", "relevance": 58, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-left-width" } ], "description": "Sets the thickness of the left border.", "restrictions": [ "length", "line-width" ] }, { "name": "border-radius", "syntax": "<length-percentage>{1,4} [ / <length-percentage>{1,4} ]?", "relevance": 92, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-radius" } ], "description": "Defines the radii of the outer border edge.", "restrictions": [ "length", "percentage" ] }, { "name": "border-right", "syntax": "<line-width> || <line-style> || <color>", "relevance": 81, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-right" } ], "description": "Shorthand property for setting border width, style and color", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "border-right-color", "syntax": "<color>", "relevance": 64, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-right-color" } ], "description": "Sets the color of the right border.", "restrictions": [ "color" ] }, { "name": "border-right-style", "syntax": "<line-style>", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-right-style" } ], "description": "Sets the style of the right border.", "restrictions": [ "line-style" ] }, { "name": "border-right-width", "syntax": "<line-width>", "relevance": 59, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-right-width" } ], "description": "Sets the thickness of the right border.", "restrictions": [ "length", "line-width" ] }, { "name": "border-spacing", "syntax": "<length> <length>?", "relevance": 68, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-spacing" } ], "description": "The lengths specify the distance that separates adjoining cell borders. If one length is specified, it gives both the horizontal and vertical spacing. If two are specified, the first gives the horizontal spacing and the second the vertical spacing. Lengths may not be negative.", "restrictions": [ "length" ] }, { "name": "border-style", "values": [], "syntax": "<line-style>{1,4}", "relevance": 81, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-style" } ], "description": "The style of the border around edges of an element.", "restrictions": [ "line-style" ] }, { "name": "border-top", "syntax": "<line-width> || <line-style> || <color>", "relevance": 88, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-top" } ], "description": "Shorthand property for setting border width, style and color", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "border-top-color", "syntax": "<color>", "relevance": 72, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-top-color" } ], "description": "Sets the color of the top border.", "restrictions": [ "color" ] }, { "name": "border-top-left-radius", "syntax": "<length-percentage>{1,2}", "relevance": 75, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius" } ], "description": "Defines the radii of the top left outer border edge.", "restrictions": [ "length", "percentage" ] }, { "name": "border-top-right-radius", "syntax": "<length-percentage>{1,2}", "relevance": 75, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius" } ], "description": "Defines the radii of the top right outer border edge.", "restrictions": [ "length", "percentage" ] }, { "name": "border-top-style", "syntax": "<line-style>", "relevance": 58, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-top-style" } ], "description": "Sets the style of the top border.", "restrictions": [ "line-style" ] }, { "name": "border-top-width", "syntax": "<line-width>", "relevance": 61, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-top-width" } ], "description": "Sets the thickness of the top border.", "restrictions": [ "length", "line-width" ] }, { "name": "border-width", "values": [], "syntax": "<line-width>{1,4}", "relevance": 82, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-width" } ], "description": "Shorthand that sets the four 'border-*-width' properties. If it has four values, they set top, right, bottom and left in that order. If left is missing, it is the same as right; if bottom is missing, it is the same as top; if right is missing, it is the same as top.", "restrictions": [ "length", "line-width" ] }, { "name": "bottom", "values": [ { "name": "auto", "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well" } ], "syntax": "<length> | <percentage> | auto", "relevance": 91, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/bottom" } ], "description": "Specifies how far an absolutely positioned box's bottom margin edge is offset above the bottom edge of the box's 'containing block'.", "restrictions": [ "length", "percentage" ] }, { "name": "box-decoration-break", "browsers": [ "E79", "FF32", "S7", "C22", "O15" ], "values": [ { "name": "clone", "description": "Each box is independently wrapped with the border and padding." }, { "name": "slice", "description": "The effect is as though the element were rendered with no breaks present, and then sliced by the breaks afterward." } ], "syntax": "slice | clone", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-decoration-break" } ], "description": "Specifies whether individual boxes are treated as broken pieces of one continuous box, or whether each box is individually wrapped with the border and padding.", "restrictions": [ "enum" ] }, { "name": "box-shadow", "values": [ { "name": "inset", "description": "Changes the drop shadow from an outer shadow (one that shadows the box onto the canvas, as if it were lifted above the canvas) to an inner shadow (one that shadows the canvas onto the box, as if the box were cut out of the canvas and shifted behind it)." }, { "name": "none", "description": "No shadow." } ], "syntax": "none | <shadow>#", "relevance": 90, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-shadow" } ], "description": "Attaches one or more drop-shadows to the box. The property is a comma-separated list of shadows, each specified by 2-4 length values, an optional color, and an optional 'inset' keyword. Omitted lengths are 0; omitted colors are a user agent chosen color.", "restrictions": [ "length", "color", "enum" ] }, { "name": "box-sizing", "values": [ { "name": "border-box", "description": "The specified width and height (and respective min/max properties) on this element determine the border box of the element." }, { "name": "content-box", "description": "Behavior of width and height as specified by CSS2.1. The specified width and height (and respective min/max properties) apply to the width and height respectively of the content box of the element." } ], "syntax": "content-box | border-box", "relevance": 93, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-sizing" } ], "description": "Specifies the behavior of the 'width' and 'height' properties.", "restrictions": [ "enum" ] }, { "name": "break-after", "values": [ { "name": "always", "description": "Always force a page break before/after the generated box." }, { "name": "auto", "description": "Neither force nor forbid a page/column break before/after the principal box." }, { "name": "avoid", "description": "Avoid a break before/after the principal box." }, { "name": "avoid-column", "description": "Avoid a column break before/after the principal box." }, { "name": "avoid-page", "description": "Avoid a page break before/after the principal box." }, { "name": "column", "description": "Always force a column break before/after the principal box." }, { "name": "left", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a left page." }, { "name": "page", "description": "Always force a page break before/after the principal box." }, { "name": "right", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a right page." } ], "syntax": "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region", "relevance": 50, "description": "Describes the page/column/region break behavior after the generated box.", "restrictions": [ "enum" ] }, { "name": "break-before", "values": [ { "name": "always", "description": "Always force a page break before/after the generated box." }, { "name": "auto", "description": "Neither force nor forbid a page/column break before/after the principal box." }, { "name": "avoid", "description": "Avoid a break before/after the principal box." }, { "name": "avoid-column", "description": "Avoid a column break before/after the principal box." }, { "name": "avoid-page", "description": "Avoid a page break before/after the principal box." }, { "name": "column", "description": "Always force a column break before/after the principal box." }, { "name": "left", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a left page." }, { "name": "page", "description": "Always force a page break before/after the principal box." }, { "name": "right", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a right page." } ], "syntax": "auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region", "relevance": 50, "description": "Describes the page/column/region break behavior before the generated box.", "restrictions": [ "enum" ] }, { "name": "break-inside", "values": [ { "name": "auto", "description": "Impose no additional breaking constraints within the box." }, { "name": "avoid", "description": "Avoid breaks within the box." }, { "name": "avoid-column", "description": "Avoid a column break within the box." }, { "name": "avoid-page", "description": "Avoid a page break within the box." } ], "syntax": "auto | avoid | avoid-page | avoid-column | avoid-region", "relevance": 51, "description": "Describes the page/column/region break behavior inside the principal box.", "restrictions": [ "enum" ] }, { "name": "caption-side", "values": [ { "name": "bottom", "description": "Positions the caption box below the table box." }, { "name": "top", "description": "Positions the caption box above the table box." } ], "syntax": "top | bottom | block-start | block-end | inline-start | inline-end", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/caption-side" } ], "description": "Specifies the position of the caption box with respect to the table box.", "restrictions": [ "enum" ] }, { "name": "caret-color", "browsers": [ "E79", "FF53", "S11.1", "C57", "O44" ], "values": [ { "name": "auto", "description": "The user agent selects an appropriate color for the caret. This is generally currentcolor, but the user agent may choose a different color to ensure good visibility and contrast with the surrounding content, taking into account the value of currentcolor, the background, shadows, and other factors." } ], "syntax": "auto | <color>", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/caret-color" } ], "description": "Controls the color of the text insertion indicator.", "restrictions": [ "color", "enum" ] }, { "name": "clear", "values": [ { "name": "both", "description": "The clearance of the generated box is set to the amount necessary to place the top border edge below the bottom outer edge of any right-floating and left-floating boxes that resulted from elements earlier in the source document." }, { "name": "left", "description": "The clearance of the generated box is set to the amount necessary to place the top border edge below the bottom outer edge of any left-floating boxes that resulted from elements earlier in the source document." }, { "name": "none", "description": "No constraint on the box's position with respect to floats." }, { "name": "right", "description": "The clearance of the generated box is set to the amount necessary to place the top border edge below the bottom outer edge of any right-floating boxes that resulted from elements earlier in the source document." } ], "syntax": "none | left | right | both | inline-start | inline-end", "relevance": 85, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/clear" } ], "description": "Indicates which sides of an element's box(es) may not be adjacent to an earlier floating box. The 'clear' property does not consider floats inside the element itself or in other block formatting contexts.", "restrictions": [ "enum" ] }, { "name": "clip", "values": [ { "name": "auto", "description": "The element does not clip." }, { "name": "rect()", "description": "Specifies offsets from the edges of the border box." } ], "syntax": "<shape> | auto", "relevance": 74, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/clip" } ], "description": "Deprecated. Use the 'clip-path' property when support allows. Defines the visible portion of an element’s box.", "restrictions": [ "enum" ] }, { "name": "clip-path", "values": [ { "name": "none", "description": "No clipping path gets created." }, { "name": "url()", "description": "References a <clipPath> element to create a clipping path." } ], "syntax": "<clip-source> | [ <basic-shape> || <geometry-box> ] | none", "relevance": 57, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/clip-path" } ], "description": "Specifies a clipping path where everything inside the path is visible and everything outside is clipped out.", "restrictions": [ "url", "shape", "geometry-box", "enum" ] }, { "name": "clip-rule", "browsers": [ "E", "C5", "FF3", "IE10", "O9", "S6" ], "values": [ { "name": "evenodd", "description": "Determines the ‘insideness’ of a point on the canvas by drawing a ray from that point to infinity in any direction and counting the number of path segments from the given shape that the ray crosses." }, { "name": "nonzero", "description": "Determines the ‘insideness’ of a point on the canvas by drawing a ray from that point to infinity in any direction and then examining the places where a segment of the shape crosses the ray." } ], "relevance": 50, "description": "Indicates the algorithm which is to be used to determine what parts of the canvas are included inside the shape.", "restrictions": [ "enum" ] }, { "name": "color", "syntax": "<color>", "relevance": 95, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/color" } ], "description": "Sets the color of an element's text", "restrictions": [ "color" ] }, { "name": "color-interpolation-filters", "browsers": [ "E", "C5", "FF3", "IE10", "O9", "S6" ], "values": [ { "name": "auto", "description": "Color operations are not required to occur in a particular color space." }, { "name": "linearRGB", "description": "Color operations should occur in the linearized RGB color space." }, { "name": "sRGB", "description": "Color operations should occur in the sRGB color space." } ], "relevance": 50, "description": "Specifies the color space for imaging operations performed via filter effects.", "restrictions": [ "enum" ] }, { "name": "column-count", "values": [ { "name": "auto", "description": "Determines the number of columns by the 'column-width' property and the element width." } ], "syntax": "<integer> | auto", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/column-count" } ], "description": "Describes the optimal number of columns into which the content of the element will be flowed.", "restrictions": [ "integer", "enum" ] }, { "name": "column-fill", "values": [ { "name": "auto", "description": "Fills columns sequentially." }, { "name": "balance", "description": "Balance content equally between columns, if possible." } ], "syntax": "auto | balance | balance-all", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/column-fill" } ], "description": "In continuous media, this property will only be consulted if the length of columns has been constrained. Otherwise, columns will automatically be balanced.", "restrictions": [ "enum" ] }, { "name": "column-gap", "values": [ { "name": "normal", "description": "User agent specific and typically equivalent to 1em." } ], "syntax": "normal | <length-percentage>", "relevance": 55, "description": "Sets the gap between columns. If there is a column rule between columns, it will appear in the middle of the gap.", "restrictions": [ "length", "enum" ] }, { "name": "column-rule", "syntax": "<'column-rule-width'> || <'column-rule-style'> || <'column-rule-color'>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/column-rule" } ], "description": "Shorthand for setting 'column-rule-width', 'column-rule-style', and 'column-rule-color' at the same place in the style sheet. Omitted values are set to their initial values.", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "column-rule-color", "syntax": "<color>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/column-rule-color" } ], "description": "Sets the color of the column rule", "restrictions": [ "color" ] }, { "name": "column-rule-style", "syntax": "<'border-style'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/column-rule-style" } ], "description": "Sets the style of the rule between columns of an element.", "restrictions": [ "line-style" ] }, { "name": "column-rule-width", "syntax": "<'border-width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/column-rule-width" } ], "description": "Sets the width of the rule between columns. Negative values are not allowed.", "restrictions": [ "length", "line-width" ] }, { "name": "columns", "values": [ { "name": "auto", "description": "The width depends on the values of other properties." } ], "syntax": "<'column-width'> || <'column-count'>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/columns" } ], "description": "A shorthand property which sets both 'column-width' and 'column-count'.", "restrictions": [ "length", "integer", "enum" ] }, { "name": "column-span", "values": [ { "name": "all", "description": "The element spans across all columns. Content in the normal flow that appears before the element is automatically balanced across all columns before the element appear." }, { "name": "none", "description": "The element does not span multiple columns." } ], "syntax": "none | all", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/column-span" } ], "description": "Describes the page/column break behavior after the generated box.", "restrictions": [ "enum" ] }, { "name": "column-width", "values": [ { "name": "auto", "description": "The width depends on the values of other properties." } ], "syntax": "<length> | auto", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/column-width" } ], "description": "Describes the width of columns in multicol elements.", "restrictions": [ "length", "enum" ] }, { "name": "contain", "browsers": [ "E79", "FF69", "C52", "O40" ], "values": [ { "name": "none", "description": "Indicates that the property has no effect." }, { "name": "strict", "description": "Turns on all forms of containment for the element." }, { "name": "content", "description": "All containment rules except size are applied to the element." }, { "name": "size", "description": "For properties that can have effects on more than just an element and its descendants, those effects don't escape the containing element." }, { "name": "layout", "description": "Turns on layout containment for the element." }, { "name": "style", "description": "Turns on style containment for the element." }, { "name": "paint", "description": "Turns on paint containment for the element." } ], "syntax": "none | strict | content | [ size || layout || style || paint ]", "relevance": 58, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/contain" } ], "description": "Indicates that an element and its contents are, as much as possible, independent of the rest of the document tree.", "restrictions": [ "enum" ] }, { "name": "content", "values": [ { "name": "attr()", "description": "The attr(n) function returns as a string the value of attribute n for the subject of the selector." }, { "name": "counter(name)", "description": "Counters are denoted by identifiers (see the 'counter-increment' and 'counter-reset' properties)." }, { "name": "icon", "description": "The (pseudo-)element is replaced in its entirety by the resource referenced by its 'icon' property, and treated as a replaced element." }, { "name": "none", "description": "On elements, this inhibits the children of the element from being rendered as children of this element, as if the element was empty. On pseudo-elements it causes the pseudo-element to have no content." }, { "name": "normal", "description": "See http://www.w3.org/TR/css3-content/#content for computation rules." }, { "name": "url()" } ], "syntax": "normal | none | [ <content-replacement> | <content-list> ] [/ [ <string> | <counter> ]+ ]?", "relevance": 90, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/content" } ], "description": "Determines which page-based occurrence of a given element is applied to a counter or string value.", "restrictions": [ "string", "url" ] }, { "name": "counter-increment", "values": [ { "name": "none", "description": "This element does not alter the value of any counters." } ], "syntax": "[ <counter-name> <integer>? ]+ | none", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/counter-increment" } ], "description": "Manipulate the value of existing counters.", "restrictions": [ "identifier", "integer" ] }, { "name": "counter-reset", "values": [ { "name": "none", "description": "The counter is not modified." } ], "syntax": "[ <counter-name> <integer>? | <reversed-counter-name> <integer>? ]+ | none", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/counter-reset" } ], "description": "Property accepts one or more names of counters (identifiers), each one optionally followed by an integer. The integer gives the value that the counter is set to on each occurrence of the element.", "restrictions": [ "identifier", "integer" ] }, { "name": "cursor", "values": [ { "name": "alias", "description": "Indicates an alias of/shortcut to something is to be created. Often rendered as an arrow with a small curved arrow next to it." }, { "name": "all-scroll", "description": "Indicates that the something can be scrolled in any direction. Often rendered as arrows pointing up, down, left, and right with a dot in the middle." }, { "name": "auto", "description": "The UA determines the cursor to display based on the current context." }, { "name": "cell", "description": "Indicates that a cell or set of cells may be selected. Often rendered as a thick plus-sign with a dot in the middle." }, { "name": "col-resize", "description": "Indicates that the item/column can be resized horizontally. Often rendered as arrows pointing left and right with a vertical bar separating them." }, { "name": "context-menu", "description": "A context menu is available for the object under the cursor. Often rendered as an arrow with a small menu-like graphic next to it." }, { "name": "copy", "description": "Indicates something is to be copied. Often rendered as an arrow with a small plus sign next to it." }, { "name": "crosshair", "description": "A simple crosshair (e.g., short line segments resembling a '+' sign). Often used to indicate a two dimensional bitmap selection mode." }, { "name": "default", "description": "The platform-dependent default cursor. Often rendered as an arrow." }, { "name": "e-resize", "description": "Indicates that east edge is to be moved." }, { "name": "ew-resize", "description": "Indicates a bidirectional east-west resize cursor." }, { "name": "grab", "description": "Indicates that something can be grabbed." }, { "name": "grabbing", "description": "Indicates that something is being grabbed." }, { "name": "help", "description": "Help is available for the object under the cursor. Often rendered as a question mark or a balloon." }, { "name": "move", "description": "Indicates something is to be moved." }, { "name": "-moz-grab", "description": "Indicates that something can be grabbed." }, { "name": "-moz-grabbing", "description": "Indicates that something is being grabbed." }, { "name": "-moz-zoom-in", "description": "Indicates that something can be zoomed (magnified) in." }, { "name": "-moz-zoom-out", "description": "Indicates that something can be zoomed (magnified) out." }, { "name": "ne-resize", "description": "Indicates that movement starts from north-east corner." }, { "name": "nesw-resize", "description": "Indicates a bidirectional north-east/south-west cursor." }, { "name": "no-drop", "description": "Indicates that the dragged item cannot be dropped at the current cursor location. Often rendered as a hand or pointer with a small circle with a line through it." }, { "name": "none", "description": "No cursor is rendered for the element." }, { "name": "not-allowed", "description": "Indicates that the requested action will not be carried out. Often rendered as a circle with a line through it." }, { "name": "n-resize", "description": "Indicates that north edge is to be moved." }, { "name": "ns-resize", "description": "Indicates a bidirectional north-south cursor." }, { "name": "nw-resize", "description": "Indicates that movement starts from north-west corner." }, { "name": "nwse-resize", "description": "Indicates a bidirectional north-west/south-east cursor." }, { "name": "pointer", "description": "The cursor is a pointer that indicates a link." }, { "name": "progress", "description": "A progress indicator. The program is performing some processing, but is different from 'wait' in that the user may still interact with the program. Often rendered as a spinning beach ball, or an arrow with a watch or hourglass." }, { "name": "row-resize", "description": "Indicates that the item/row can be resized vertically. Often rendered as arrows pointing up and down with a horizontal bar separating them." }, { "name": "se-resize", "description": "Indicates that movement starts from south-east corner." }, { "name": "s-resize", "description": "Indicates that south edge is to be moved." }, { "name": "sw-resize", "description": "Indicates that movement starts from south-west corner." }, { "name": "text", "description": "Indicates text that may be selected. Often rendered as a vertical I-beam." }, { "name": "vertical-text", "description": "Indicates vertical-text that may be selected. Often rendered as a horizontal I-beam." }, { "name": "wait", "description": "Indicates that the program is busy and the user should wait. Often rendered as a watch or hourglass." }, { "name": "-webkit-grab", "description": "Indicates that something can be grabbed." }, { "name": "-webkit-grabbing", "description": "Indicates that something is being grabbed." }, { "name": "-webkit-zoom-in", "description": "Indicates that something can be zoomed (magnified) in." }, { "name": "-webkit-zoom-out", "description": "Indicates that something can be zoomed (magnified) out." }, { "name": "w-resize", "description": "Indicates that west edge is to be moved." }, { "name": "zoom-in", "description": "Indicates that something can be zoomed (magnified) in." }, { "name": "zoom-out", "description": "Indicates that something can be zoomed (magnified) out." } ], "syntax": "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing ] ]", "relevance": 92, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/cursor" } ], "description": "Allows control over cursor appearance in an element", "restrictions": [ "url", "number", "enum" ] }, { "name": "direction", "values": [ { "name": "ltr", "description": "Left-to-right direction." }, { "name": "rtl", "description": "Right-to-left direction." } ], "syntax": "ltr | rtl", "relevance": 70, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/direction" } ], "description": "Specifies the inline base direction or directionality of any bidi paragraph, embedding, isolate, or override established by the box. Note: for HTML content use the 'dir' attribute and 'bdo' element rather than this property.", "restrictions": [ "enum" ] }, { "name": "display", "values": [ { "name": "block", "description": "The element generates a block-level box" }, { "name": "contents", "description": "The element itself does not generate any boxes, but its children and pseudo-elements still generate boxes as normal." }, { "name": "flex", "description": "The element generates a principal flex container box and establishes a flex formatting context." }, { "name": "flexbox", "description": "The element lays out its contents using flow layout (block-and-inline layout). Standardized as 'flex'." }, { "name": "flow-root", "description": "The element generates a block container box, and lays out its contents using flow layout." }, { "name": "grid", "description": "The element generates a principal grid container box, and establishes a grid formatting context." }, { "name": "inline", "description": "The element generates an inline-level box." }, { "name": "inline-block", "description": "A block box, which itself is flowed as a single inline box, similar to a replaced element. The inside of an inline-block is formatted as a block box, and the box itself is formatted as an inline box." }, { "name": "inline-flex", "description": "Inline-level flex container." }, { "name": "inline-flexbox", "description": "Inline-level flex container. Standardized as 'inline-flex'" }, { "name": "inline-table", "description": "Inline-level table wrapper box containing table box." }, { "name": "list-item", "description": "One or more block boxes and one marker box." }, { "name": "-moz-box", "description": "The element lays out its contents using flow layout (block-and-inline layout). Standardized as 'flex'." }, { "name": "-moz-deck" }, { "name": "-moz-grid" }, { "name": "-moz-grid-group" }, { "name": "-moz-grid-line" }, { "name": "-moz-groupbox" }, { "name": "-moz-inline-box", "description": "Inline-level flex container. Standardized as 'inline-flex'" }, { "name": "-moz-inline-grid" }, { "name": "-moz-inline-stack" }, { "name": "-moz-marker" }, { "name": "-moz-popup" }, { "name": "-moz-stack" }, { "name": "-ms-flexbox", "description": "The element lays out its contents using flow layout (block-and-inline layout). Standardized as 'flex'." }, { "name": "-ms-grid", "description": "The element generates a principal grid container box, and establishes a grid formatting context." }, { "name": "-ms-inline-flexbox", "description": "Inline-level flex container. Standardized as 'inline-flex'" }, { "name": "-ms-inline-grid", "description": "Inline-level grid container." }, { "name": "none", "description": "The element and its descendants generates no boxes." }, { "name": "ruby", "description": "The element generates a principal ruby container box, and establishes a ruby formatting context." }, { "name": "ruby-base" }, { "name": "ruby-base-container" }, { "name": "ruby-text" }, { "name": "ruby-text-container" }, { "name": "run-in", "description": "The element generates a run-in box. Run-in elements act like inlines or blocks, depending on the surrounding elements." }, { "name": "table", "description": "The element generates a principal table wrapper box containing an additionally-generated table box, and establishes a table formatting context." }, { "name": "table-caption" }, { "name": "table-cell" }, { "name": "table-column" }, { "name": "table-column-group" }, { "name": "table-footer-group" }, { "name": "table-header-group" }, { "name": "table-row" }, { "name": "table-row-group" }, { "name": "-webkit-box", "description": "The element lays out its contents using flow layout (block-and-inline layout). Standardized as 'flex'." }, { "name": "-webkit-flex", "description": "The element lays out its contents using flow layout (block-and-inline layout)." }, { "name": "-webkit-inline-box", "description": "Inline-level flex container. Standardized as 'inline-flex'" }, { "name": "-webkit-inline-flex", "description": "Inline-level flex container." } ], "syntax": "[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>", "relevance": 96, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/display" } ], "description": "In combination with 'float' and 'position', determines the type of box or boxes that are generated for an element.", "restrictions": [ "enum" ] }, { "name": "empty-cells", "values": [ { "name": "hide", "description": "No borders or backgrounds are drawn around/behind empty cells." }, { "name": "-moz-show-background" }, { "name": "show", "description": "Borders and backgrounds are drawn around/behind empty cells (like normal cells)." } ], "syntax": "show | hide", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/empty-cells" } ], "description": "In the separated borders model, this property controls the rendering of borders and backgrounds around cells that have no visible content.", "restrictions": [ "enum" ] }, { "name": "enable-background", "values": [ { "name": "accumulate", "description": "If the ancestor container element has a property of new, then all graphics elements within the current container are rendered both on the parent's background image and onto the target." }, { "name": "new", "description": "Create a new background image canvas. All children of the current container element can access the background, and they will be rendered onto both the parent's background image canvas in addition to the target device." } ], "relevance": 50, "description": "Deprecated. Use 'isolation' property instead when support allows. Specifies how the accumulation of the background image is managed.", "restrictions": [ "integer", "length", "percentage", "enum" ] }, { "name": "fallback", "browsers": [ "FF33" ], "syntax": "<counter-style-name>", "relevance": 50, "description": "@counter-style descriptor. Specifies a fallback counter style to be used when the current counter style can’t create a representation for a given counter value.", "restrictions": [ "identifier" ] }, { "name": "fill", "values": [ { "name": "url()", "description": "A URL reference to a paint server element, which is an element that defines a paint server: ‘hatch’, ‘linearGradient’, ‘mesh’, ‘pattern’, ‘radialGradient’ and ‘solidcolor’." }, { "name": "none", "description": "No paint is applied in this layer." } ], "relevance": 77, "description": "Paints the interior of the given graphical element.", "restrictions": [ "color", "enum", "url" ] }, { "name": "fill-opacity", "relevance": 52, "description": "Specifies the opacity of the painting operation used to paint the interior the current object.", "restrictions": [ "number(0-1)" ] }, { "name": "fill-rule", "values": [ { "name": "evenodd", "description": "Determines the ‘insideness’ of a point on the canvas by drawing a ray from that point to infinity in any direction and counting the number of path segments from the given shape that the ray crosses." }, { "name": "nonzero", "description": "Determines the ‘insideness’ of a point on the canvas by drawing a ray from that point to infinity in any direction and then examining the places where a segment of the shape crosses the ray." } ], "relevance": 50, "description": "Indicates the algorithm (or winding rule) which is to be used to determine what parts of the canvas are included inside the shape.", "restrictions": [ "enum" ] }, { "name": "filter", "browsers": [ "E12", "FF35", "S9.1", "C53", "O40" ], "values": [ { "name": "none", "description": "No filter effects are applied." }, { "name": "blur()", "description": "Applies a Gaussian blur to the input image." }, { "name": "brightness()", "description": "Applies a linear multiplier to input image, making it appear more or less bright." }, { "name": "contrast()", "description": "Adjusts the contrast of the input." }, { "name": "drop-shadow()", "description": "Applies a drop shadow effect to the input image." }, { "name": "grayscale()", "description": "Converts the input image to grayscale." }, { "name": "hue-rotate()", "description": "Applies a hue rotation on the input image. " }, { "name": "invert()", "description": "Inverts the samples in the input image." }, { "name": "opacity()", "description": "Applies transparency to the samples in the input image." }, { "name": "saturate()", "description": "Saturates the input image." }, { "name": "sepia()", "description": "Converts the input image to sepia." }, { "name": "url()", "browsers": [ "E12", "FF35", "S9.1", "C53", "O40" ], "description": "A filter reference to a <filter> element." } ], "syntax": "none | <filter-function-list>", "relevance": 66, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/filter" } ], "description": "Processes an element’s rendering before it is displayed in the document, by applying one or more filter effects.", "restrictions": [ "enum", "url" ] }, { "name": "flex", "values": [ { "name": "auto", "description": "Retrieves the value of the main size property as the used 'flex-basis'." }, { "name": "content", "description": "Indicates automatic sizing, based on the flex item’s content." }, { "name": "none", "description": "Expands to '0 0 auto'." } ], "syntax": "none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]", "relevance": 80, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/flex" } ], "description": "Specifies the components of a flexible length: the flex grow factor and flex shrink factor, and the flex basis.", "restrictions": [ "length", "number", "percentage" ] }, { "name": "flex-basis", "values": [ { "name": "auto", "description": "Retrieves the value of the main size property as the used 'flex-basis'." }, { "name": "content", "description": "Indicates automatic sizing, based on the flex item’s content." } ], "syntax": "content | <'width'>", "relevance": 65, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/flex-basis" } ], "description": "Sets the flex basis.", "restrictions": [ "length", "number", "percentage" ] }, { "name": "flex-direction", "values": [ { "name": "column", "description": "The flex container’s main axis has the same orientation as the block axis of the current writing mode." }, { "name": "column-reverse", "description": "Same as 'column', except the main-start and main-end directions are swapped." }, { "name": "row", "description": "The flex container’s main axis has the same orientation as the inline axis of the current writing mode." }, { "name": "row-reverse", "description": "Same as 'row', except the main-start and main-end directions are swapped." } ], "syntax": "row | row-reverse | column | column-reverse", "relevance": 83, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/flex-direction" } ], "description": "Specifies how flex items are placed in the flex container, by setting the direction of the flex container’s main axis.", "restrictions": [ "enum" ] }, { "name": "flex-flow", "values": [ { "name": "column", "description": "The flex container’s main axis has the same orientation as the block axis of the current writing mode." }, { "name": "column-reverse", "description": "Same as 'column', except the main-start and main-end directions are swapped." }, { "name": "nowrap", "description": "The flex container is single-line." }, { "name": "row", "description": "The flex container’s main axis has the same orientation as the inline axis of the current writing mode." }, { "name": "row-reverse", "description": "Same as 'row', except the main-start and main-end directions are swapped." }, { "name": "wrap", "description": "The flexbox is multi-line." }, { "name": "wrap-reverse", "description": "Same as 'wrap', except the cross-start and cross-end directions are swapped." } ], "syntax": "<'flex-direction'> || <'flex-wrap'>", "relevance": 61, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/flex-flow" } ], "description": "Specifies how flexbox items are placed in the flexbox.", "restrictions": [ "enum" ] }, { "name": "flex-grow", "syntax": "<number>", "relevance": 75, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/flex-grow" } ], "description": "Sets the flex grow factor. Negative numbers are invalid.", "restrictions": [ "number" ] }, { "name": "flex-shrink", "syntax": "<number>", "relevance": 74, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/flex-shrink" } ], "description": "Sets the flex shrink factor. Negative numbers are invalid.", "restrictions": [ "number" ] }, { "name": "flex-wrap", "values": [ { "name": "nowrap", "description": "The flex container is single-line." }, { "name": "wrap", "description": "The flexbox is multi-line." }, { "name": "wrap-reverse", "description": "Same as 'wrap', except the cross-start and cross-end directions are swapped." } ], "syntax": "nowrap | wrap | wrap-reverse", "relevance": 79, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/flex-wrap" } ], "description": "Controls whether the flex container is single-line or multi-line, and the direction of the cross-axis, which determines the direction new lines are stacked in.", "restrictions": [ "enum" ] }, { "name": "float", "values": [ { "name": "inline-end", "description": "A keyword indicating that the element must float on the end side of its containing block. That is the right side with ltr scripts, and the left side with rtl scripts." }, { "name": "inline-start", "description": "A keyword indicating that the element must float on the start side of its containing block. That is the left side with ltr scripts, and the right side with rtl scripts." }, { "name": "left", "description": "The element generates a block box that is floated to the left. Content flows on the right side of the box, starting at the top (subject to the 'clear' property)." }, { "name": "none", "description": "The box is not floated." }, { "name": "right", "description": "Similar to 'left', except the box is floated to the right, and content flows on the left side of the box, starting at the top." } ], "syntax": "left | right | none | inline-start | inline-end", "relevance": 91, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/float" } ], "description": "Specifies how a box should be floated. It may be set for any element, but only applies to elements that generate boxes that are not absolutely positioned.", "restrictions": [ "enum" ] }, { "name": "flood-color", "browsers": [ "E", "C5", "FF3", "IE10", "O9", "S6" ], "relevance": 50, "description": "Indicates what color to use to flood the current filter primitive subregion.", "restrictions": [ "color" ] }, { "name": "flood-opacity", "browsers": [ "E", "C5", "FF3", "IE10", "O9", "S6" ], "relevance": 50, "description": "Indicates what opacity to use to flood the current filter primitive subregion.", "restrictions": [ "number(0-1)", "percentage" ] }, { "name": "font", "values": [ { "name": "100", "description": "Thin" }, { "name": "200", "description": "Extra Light (Ultra Light)" }, { "name": "300", "description": "Light" }, { "name": "400", "description": "Normal" }, { "name": "500", "description": "Medium" }, { "name": "600", "description": "Semi Bold (Demi Bold)" }, { "name": "700", "description": "Bold" }, { "name": "800", "description": "Extra Bold (Ultra Bold)" }, { "name": "900", "description": "Black (Heavy)" }, { "name": "bold", "description": "Same as 700" }, { "name": "bolder", "description": "Specifies the weight of the face bolder than the inherited value." }, { "name": "caption", "description": "The font used for captioned controls (e.g., buttons, drop-downs, etc.)." }, { "name": "icon", "description": "The font used to label icons." }, { "name": "italic", "description": "Selects a font that is labeled 'italic', or, if that is not available, one labeled 'oblique'." }, { "name": "large" }, { "name": "larger" }, { "name": "lighter", "description": "Specifies the weight of the face lighter than the inherited value." }, { "name": "medium" }, { "name": "menu", "description": "The font used in menus (e.g., dropdown menus and menu lists)." }, { "name": "message-box", "description": "The font used in dialog boxes." }, { "name": "normal", "description": "Specifies a face that is not labeled as a small-caps font." }, { "name": "oblique", "description": "Selects a font that is labeled 'oblique'." }, { "name": "small" }, { "name": "small-caps", "description": "Specifies a font that is labeled as a small-caps font. If a genuine small-caps font is not available, user agents should simulate a small-caps font." }, { "name": "small-caption", "description": "The font used for labeling small controls." }, { "name": "smaller" }, { "name": "status-bar", "description": "The font used in window status bars." }, { "name": "x-large" }, { "name": "x-small" }, { "name": "xx-large" }, { "name": "xx-small" } ], "syntax": "[ [ <'font-style'> || <font-variant-css21> || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar", "relevance": 84, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font" } ], "description": "Shorthand property for setting 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', and 'font-family', at the same place in the style sheet. The syntax of this property is based on a traditional typographical shorthand notation to set multiple properties related to fonts.", "restrictions": [ "font" ] }, { "name": "font-family", "values": [ { "name": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif" }, { "name": "Arial, Helvetica, sans-serif" }, { "name": "Cambria, Cochin, Georgia, Times, 'Times New Roman', serif" }, { "name": "'Courier New', Courier, monospace" }, { "name": "cursive" }, { "name": "fantasy" }, { "name": "'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif" }, { "name": "Georgia, 'Times New Roman', Times, serif" }, { "name": "'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif" }, { "name": "Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif" }, { "name": "'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif" }, { "name": "monospace" }, { "name": "sans-serif" }, { "name": "'Segoe UI', Tahoma, Geneva, Verdana, sans-serif" }, { "name": "serif" }, { "name": "'Times New Roman', Times, serif" }, { "name": "'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif" }, { "name": "Verdana, Geneva, Tahoma, sans-serif" } ], "syntax": "<family-name>", "relevance": 94, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-family" } ], "description": "Specifies a prioritized list of font family names or generic family names. A user agent iterates through the list of family names until it matches an available font that contains a glyph for the character to be rendered.", "restrictions": [ "font" ] }, { "name": "font-feature-settings", "values": [ { "name": "\"aalt\"", "description": "Access All Alternates." }, { "name": "\"abvf\"", "description": "Above-base Forms. Required in Khmer script." }, { "name": "\"abvm\"", "description": "Above-base Mark Positioning. Required in Indic scripts." }, { "name": "\"abvs\"", "description": "Above-base Substitutions. Required in Indic scripts." }, { "name": "\"afrc\"", "description": "Alternative Fractions." }, { "name": "\"akhn\"", "description": "Akhand. Required in most Indic scripts." }, { "name": "\"blwf\"", "description": "Below-base Form. Required in a number of Indic scripts." }, { "name": "\"blwm\"", "description": "Below-base Mark Positioning. Required in Indic scripts." }, { "name": "\"blws\"", "description": "Below-base Substitutions. Required in Indic scripts." }, { "name": "\"calt\"", "description": "Contextual Alternates." }, { "name": "\"case\"", "description": "Case-Sensitive Forms. Applies only to European scripts; particularly prominent in Spanish-language setting." }, { "name": "\"ccmp\"", "description": "Glyph Composition/Decomposition." }, { "name": "\"cfar\"", "description": "Conjunct Form After Ro. Required in Khmer scripts." }, { "name": "\"cjct\"", "description": "Conjunct Forms. Required in Indic scripts that show similarity to Devanagari." }, { "name": "\"clig\"", "description": "Contextual Ligatures." }, { "name": "\"cpct\"", "description": "Centered CJK Punctuation. Used primarily in Chinese fonts." }, { "name": "\"cpsp\"", "description": "Capital Spacing. Should not be used in connecting scripts (e.g. most Arabic)." }, { "name": "\"cswh\"", "description": "Contextual Swash." }, { "name": "\"curs\"", "description": "Cursive Positioning. Can be used in any cursive script." }, { "name": "\"c2pc\"", "description": "Petite Capitals From Capitals. Applies only to bicameral scripts." }, { "name": "\"c2sc\"", "description": "Small Capitals From Capitals. Applies only to bicameral scripts." }, { "name": "\"dist\"", "description": "Distances. Required in Indic scripts." }, { "name": "\"dlig\"", "description": "Discretionary ligatures." }, { "name": "\"dnom\"", "description": "Denominators." }, { "name": "\"dtls\"", "description": "Dotless Forms. Applied to math formula layout." }, { "name": "\"expt\"", "description": "Expert Forms. Applies only to Japanese." }, { "name": "\"falt\"", "description": "Final Glyph on Line Alternates. Can be used in any cursive script." }, { "name": "\"fin2\"", "description": "Terminal Form #2. Used only with the Syriac script." }, { "name": "\"fin3\"", "description": "Terminal Form #3. Used only with the Syriac script." }, { "name": "\"fina\"", "description": "Terminal Forms. Can be used in any alphabetic script." }, { "name": "\"flac\"", "description": "Flattened ascent forms. Applied to math formula layout." }, { "name": "\"frac\"", "description": "Fractions." }, { "name": "\"fwid\"", "description": "Full Widths. Applies to any script which can use monospaced forms." }, { "name": "\"half\"", "description": "Half Forms. Required in Indic scripts that show similarity to Devanagari." }, { "name": "\"haln\"", "description": "Halant Forms. Required in Indic scripts." }, { "name": "\"halt\"", "description": "Alternate Half Widths. Used only in CJKV fonts." }, { "name": "\"hist\"", "description": "Historical Forms." }, { "name": "\"hkna\"", "description": "Horizontal Kana Alternates. Applies only to fonts that support kana (hiragana and katakana)." }, { "name": "\"hlig\"", "description": "Historical Ligatures." }, { "name": "\"hngl\"", "description": "Hangul. Korean only." }, { "name": "\"hojo\"", "description": "Hojo Kanji Forms (JIS X 0212-1990 Kanji Forms). Used only with Kanji script." }, { "name": "\"hwid\"", "description": "Half Widths. Generally used only in CJKV fonts." }, { "name": "\"init\"", "description": "Initial Forms. Can be used in any alphabetic script." }, { "name": "\"isol\"", "description": "Isolated Forms. Can be used in any cursive script." }, { "name": "\"ital\"", "description": "Italics. Applies mostly to Latin; note that many non-Latin fonts contain Latin as well." }, { "name": "\"jalt\"", "description": "Justification Alternates. Can be used in any cursive script." }, { "name": "\"jp78\"", "description": "JIS78 Forms. Applies only to Japanese." }, { "name": "\"jp83\"", "description": "JIS83 Forms. Applies only to Japanese." }, { "name": "\"jp90\"", "description": "JIS90 Forms. Applies only to Japanese." }, { "name": "\"jp04\"", "description": "JIS2004 Forms. Applies only to Japanese." }, { "name": "\"kern\"", "description": "Kerning." }, { "name": "\"lfbd\"", "description": "Left Bounds." }, { "name": "\"liga\"", "description": "Standard Ligatures." }, { "name": "\"ljmo\"", "description": "Leading Jamo Forms. Required for Hangul script when Ancient Hangul writing system is supported." }, { "name": "\"lnum\"", "description": "Lining Figures." }, { "name": "\"locl\"", "description": "Localized Forms." }, { "name": "\"ltra\"", "description": "Left-to-right glyph alternates." }, { "name": "\"ltrm\"", "description": "Left-to-right mirrored forms." }, { "name": "\"mark\"", "description": "Mark Positioning." }, { "name": "\"med2\"", "description": "Medial Form #2. Used only with the Syriac script." }, { "name": "\"medi\"", "description": "Medial Forms." }, { "name": "\"mgrk\"", "description": "Mathematical Greek." }, { "name": "\"mkmk\"", "description": "Mark to Mark Positioning." }, { "name": "\"nalt\"", "description": "Alternate Annotation Forms." }, { "name": "\"nlck\"", "description": "NLC Kanji Forms. Used only with Kanji script." }, { "name": "\"nukt\"", "description": "Nukta Forms. Required in Indic scripts.." }, { "name": "\"numr\"", "description": "Numerators." }, { "name": "\"onum\"", "description": "Oldstyle Figures." }, { "name": "\"opbd\"", "description": "Optical Bounds." }, { "name": "\"ordn\"", "description": "Ordinals. Applies mostly to Latin script." }, { "name": "\"ornm\"", "description": "Ornaments." }, { "name": "\"palt\"", "description": "Proportional Alternate Widths. Used mostly in CJKV fonts." }, { "name": "\"pcap\"", "description": "Petite Capitals." }, { "name": "\"pkna\"", "description": "Proportional Kana. Generally used only in Japanese fonts." }, { "name": "\"pnum\"", "description": "Proportional Figures." }, { "name": "\"pref\"", "description": "Pre-base Forms. Required in Khmer and Myanmar (Burmese) scripts and southern Indic scripts that may display a pre-base form of Ra." }, { "name": "\"pres\"", "description": "Pre-base Substitutions. Required in Indic scripts." }, { "name": "\"pstf\"", "description": "Post-base Forms. Required in scripts of south and southeast Asia that have post-base forms for consonants eg: Gurmukhi, Malayalam, Khmer." }, { "name": "\"psts\"", "description": "Post-base Substitutions." }, { "name": "\"pwid\"", "description": "Proportional Widths." }, { "name": "\"qwid\"", "description": "Quarter Widths. Generally used only in CJKV fonts." }, { "name": "\"rand\"", "description": "Randomize." }, { "name": "\"rclt\"", "description": "Required Contextual Alternates. May apply to any script, but is especially important for many styles of Arabic." }, { "name": "\"rlig\"", "description": "Required Ligatures. Applies to Arabic and Syriac. May apply to some other scripts." }, { "name": "\"rkrf\"", "description": "Rakar Forms. Required in Devanagari and Gujarati scripts." }, { "name": "\"rphf\"", "description": "Reph Form. Required in Indic scripts. E.g. Devanagari, Kannada." }, { "name": "\"rtbd\"", "description": "Right Bounds." }, { "name": "\"rtla\"", "description": "Right-to-left alternates." }, { "name": "\"rtlm\"", "description": "Right-to-left mirrored forms." }, { "name": "\"ruby\"", "description": "Ruby Notation Forms. Applies only to Japanese." }, { "name": "\"salt\"", "description": "Stylistic Alternates." }, { "name": "\"sinf\"", "description": "Scientific Inferiors." }, { "name": "\"size\"", "description": "Optical size." }, { "name": "\"smcp\"", "description": "Small Capitals. Applies only to bicameral scripts." }, { "name": "\"smpl\"", "description": "Simplified Forms. Applies only to Chinese and Japanese." }, { "name": "\"ssty\"", "description": "Math script style alternates." }, { "name": "\"stch\"", "description": "Stretching Glyph Decomposition." }, { "name": "\"subs\"", "description": "Subscript." }, { "name": "\"sups\"", "description": "Superscript." }, { "name": "\"swsh\"", "description": "Swash. Does not apply to ideographic scripts." }, { "name": "\"titl\"", "description": "Titling." }, { "name": "\"tjmo\"", "description": "Trailing Jamo Forms. Required for Hangul script when Ancient Hangul writing system is supported." }, { "name": "\"tnam\"", "description": "Traditional Name Forms. Applies only to Japanese." }, { "name": "\"tnum\"", "description": "Tabular Figures." }, { "name": "\"trad\"", "description": "Traditional Forms. Applies only to Chinese and Japanese." }, { "name": "\"twid\"", "description": "Third Widths. Generally used only in CJKV fonts." }, { "name": "\"unic\"", "description": "Unicase." }, { "name": "\"valt\"", "description": "Alternate Vertical Metrics. Applies only to scripts with vertical writing modes." }, { "name": "\"vatu\"", "description": "Vattu Variants. Used for Indic scripts. E.g. Devanagari." }, { "name": "\"vert\"", "description": "Vertical Alternates. Applies only to scripts with vertical writing modes." }, { "name": "\"vhal\"", "description": "Alternate Vertical Half Metrics. Used only in CJKV fonts." }, { "name": "\"vjmo\"", "description": "Vowel Jamo Forms. Required for Hangul script when Ancient Hangul writing system is supported." }, { "name": "\"vkna\"", "description": "Vertical Kana Alternates. Applies only to fonts that support kana (hiragana and katakana)." }, { "name": "\"vkrn\"", "description": "Vertical Kerning." }, { "name": "\"vpal\"", "description": "Proportional Alternate Vertical Metrics. Used mostly in CJKV fonts." }, { "name": "\"vrt2\"", "description": "Vertical Alternates and Rotation. Applies only to scripts with vertical writing modes." }, { "name": "\"zero\"", "description": "Slashed Zero." }, { "name": "normal", "description": "No change in glyph substitution or positioning occurs." }, { "name": "off", "description": "Disable feature." }, { "name": "on", "description": "Enable feature." } ], "syntax": "normal | <feature-tag-value>#", "relevance": 56, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-feature-settings" } ], "description": "Provides low-level control over OpenType font features. It is intended as a way of providing access to font features that are not widely used but are needed for a particular use case.", "restrictions": [ "string", "integer" ] }, { "name": "font-kerning", "browsers": [ "E79", "FF32", "S9", "C33", "O20" ], "values": [ { "name": "auto", "description": "Specifies that kerning is applied at the discretion of the user agent." }, { "name": "none", "description": "Specifies that kerning is not applied." }, { "name": "normal", "description": "Specifies that kerning is applied." } ], "syntax": "auto | normal | none", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-kerning" } ], "description": "Kerning is the contextual adjustment of inter-glyph spacing. This property controls metric kerning, kerning that utilizes adjustment data contained in the font.", "restrictions": [ "enum" ] }, { "name": "font-language-override", "browsers": [ "FF34" ], "values": [ { "name": "normal", "description": "Implies that when rendering with OpenType fonts the language of the document is used to infer the OpenType language system, used to select language specific features when rendering." } ], "syntax": "normal | <string>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-language-override" } ], "description": "The value of 'normal' implies that when rendering with OpenType fonts the language of the document is used to infer the OpenType language system, used to select language specific features when rendering.", "restrictions": [ "string" ] }, { "name": "font-size", "values": [ { "name": "large" }, { "name": "larger" }, { "name": "medium" }, { "name": "small" }, { "name": "smaller" }, { "name": "x-large" }, { "name": "x-small" }, { "name": "xx-large" }, { "name": "xx-small" } ], "syntax": "<absolute-size> | <relative-size> | <length-percentage>", "relevance": 95, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-size" } ], "description": "Indicates the desired height of glyphs from the font. For scalable fonts, the font-size is a scale factor applied to the EM unit of the font. (Note that certain glyphs may bleed outside their EM box.) For non-scalable fonts, the font-size is converted into absolute units and matched against the declared font-size of the font, using the same absolute coordinate space for both of the matched values.", "restrictions": [ "length", "percentage" ] }, { "name": "font-size-adjust", "browsers": [ "E79", "FF40", "C43", "O30" ], "values": [ { "name": "none", "description": "Do not preserve the font’s x-height." } ], "syntax": "none | [ ex-height | cap-height | ch-width | ic-width | ic-height ]? [ from-font | <number> ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-size-adjust" } ], "description": "Preserves the readability of text when font fallback occurs by adjusting the font-size so that the x-height is the same regardless of the font used.", "restrictions": [ "number" ] }, { "name": "font-stretch", "values": [ { "name": "condensed" }, { "name": "expanded" }, { "name": "extra-condensed" }, { "name": "extra-expanded" }, { "name": "narrower", "description": "Indicates a narrower value relative to the width of the parent element." }, { "name": "normal" }, { "name": "semi-condensed" }, { "name": "semi-expanded" }, { "name": "ultra-condensed" }, { "name": "ultra-expanded" }, { "name": "wider", "description": "Indicates a wider value relative to the width of the parent element." } ], "syntax": "<font-stretch-absolute>{1,2}", "relevance": 56, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-stretch" } ], "description": "Selects a normal, condensed, or expanded face from a font family.", "restrictions": [ "enum" ] }, { "name": "font-style", "values": [ { "name": "italic", "description": "Selects a font that is labeled as an 'italic' face, or an 'oblique' face if one is not" }, { "name": "normal", "description": "Selects a face that is classified as 'normal'." }, { "name": "oblique", "description": "Selects a font that is labeled as an 'oblique' face, or an 'italic' face if one is not." } ], "syntax": "normal | italic | oblique <angle>{0,2}", "relevance": 90, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-style" } ], "description": "Allows italic or oblique faces to be selected. Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face.", "restrictions": [ "enum" ] }, { "name": "font-synthesis", "browsers": [ "E97", "FF34", "S9", "C97", "O83" ], "values": [ { "name": "none", "description": "Disallow all synthetic faces." }, { "name": "style", "description": "Allow synthetic italic faces." }, { "name": "weight", "description": "Allow synthetic bold faces." } ], "syntax": "none | [ weight || style || small-caps ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-synthesis" } ], "description": "Controls whether user agents are allowed to synthesize bold or oblique font faces when a font family lacks bold or italic faces.", "restrictions": [ "enum" ] }, { "name": "font-variant", "values": [ { "name": "normal", "description": "Specifies a face that is not labeled as a small-caps font." }, { "name": "small-caps", "description": "Specifies a font that is labeled as a small-caps font. If a genuine small-caps font is not available, user agents should simulate a small-caps font." } ], "syntax": "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic(<feature-value-name>) || historical-forms || styleset(<feature-value-name>#) || character-variant(<feature-value-name>#) || swash(<feature-value-name>) || ornaments(<feature-value-name>) || annotation(<feature-value-name>) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]", "relevance": 65, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-variant" } ], "description": "Specifies variant representations of the font", "restrictions": [ "enum" ] }, { "name": "font-variant-alternates", "browsers": [ "FF34", "S9.1" ], "values": [ { "name": "annotation()", "description": "Enables display of alternate annotation forms." }, { "name": "character-variant()", "description": "Enables display of specific character variants." }, { "name": "historical-forms", "description": "Enables display of historical forms." }, { "name": "normal", "description": "None of the features are enabled." }, { "name": "ornaments()", "description": "Enables replacement of default glyphs with ornaments, if provided in the font." }, { "name": "styleset()", "description": "Enables display with stylistic sets." }, { "name": "stylistic()", "description": "Enables display of stylistic alternates." }, { "name": "swash()", "description": "Enables display of swash glyphs." } ], "syntax": "normal | [ stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-variant-alternates" } ], "description": "For any given character, fonts can provide a variety of alternate glyphs in addition to the default glyph for that character. This property provides control over the selection of these alternate glyphs.", "restrictions": [ "enum" ] }, { "name": "font-variant-caps", "browsers": [ "E79", "FF34", "S9.1", "C52", "O39" ], "values": [ { "name": "all-petite-caps", "description": "Enables display of petite capitals for both upper and lowercase letters." }, { "name": "all-small-caps", "description": "Enables display of small capitals for both upper and lowercase letters." }, { "name": "normal", "description": "None of the features are enabled." }, { "name": "petite-caps", "description": "Enables display of petite capitals." }, { "name": "small-caps", "description": "Enables display of small capitals. Small-caps glyphs typically use the form of uppercase letters but are reduced to the size of lowercase letters." }, { "name": "titling-caps", "description": "Enables display of titling capitals." }, { "name": "unicase", "description": "Enables display of mixture of small capitals for uppercase letters with normal lowercase letters." } ], "syntax": "normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-variant-caps" } ], "description": "Specifies control over capitalized forms.", "restrictions": [ "enum" ] }, { "name": "font-variant-east-asian", "browsers": [ "E79", "FF34", "S9.1", "C63", "O50" ], "values": [ { "name": "full-width", "description": "Enables rendering of full-width variants." }, { "name": "jis04", "description": "Enables rendering of JIS04 forms." }, { "name": "jis78", "description": "Enables rendering of JIS78 forms." }, { "name": "jis83", "description": "Enables rendering of JIS83 forms." }, { "name": "jis90", "description": "Enables rendering of JIS90 forms." }, { "name": "normal", "description": "None of the features are enabled." }, { "name": "proportional-width", "description": "Enables rendering of proportionally-spaced variants." }, { "name": "ruby", "description": "Enables display of ruby variant glyphs." }, { "name": "simplified", "description": "Enables rendering of simplified forms." }, { "name": "traditional", "description": "Enables rendering of traditional forms." } ], "syntax": "normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-variant-east-asian" } ], "description": "Allows control of glyph substitute and positioning in East Asian text.", "restrictions": [ "enum" ] }, { "name": "font-variant-ligatures", "browsers": [ "E79", "FF34", "S9.1", "C34", "O21" ], "values": [ { "name": "additional-ligatures", "description": "Enables display of additional ligatures." }, { "name": "common-ligatures", "description": "Enables display of common ligatures." }, { "name": "contextual", "browsers": [ "E79", "FF34", "S9.1", "C34", "O21" ], "description": "Enables display of contextual alternates." }, { "name": "discretionary-ligatures", "description": "Enables display of discretionary ligatures." }, { "name": "historical-ligatures", "description": "Enables display of historical ligatures." }, { "name": "no-additional-ligatures", "description": "Disables display of additional ligatures." }, { "name": "no-common-ligatures", "description": "Disables display of common ligatures." }, { "name": "no-contextual", "browsers": [ "E79", "FF34", "S9.1", "C34", "O21" ], "description": "Disables display of contextual alternates." }, { "name": "no-discretionary-ligatures", "description": "Disables display of discretionary ligatures." }, { "name": "no-historical-ligatures", "description": "Disables display of historical ligatures." }, { "name": "none", "browsers": [ "E79", "FF34", "S9.1", "C34", "O21" ], "description": "Disables all ligatures." }, { "name": "normal", "description": "Implies that the defaults set by the font are used." } ], "syntax": "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-variant-ligatures" } ], "description": "Specifies control over which ligatures are enabled or disabled. A value of ‘normal’ implies that the defaults set by the font are used.", "restrictions": [ "enum" ] }, { "name": "font-variant-numeric", "browsers": [ "E79", "FF34", "S9.1", "C52", "O39" ], "values": [ { "name": "diagonal-fractions", "description": "Enables display of lining diagonal fractions." }, { "name": "lining-nums", "description": "Enables display of lining numerals." }, { "name": "normal", "description": "None of the features are enabled." }, { "name": "oldstyle-nums", "description": "Enables display of old-style numerals." }, { "name": "ordinal", "description": "Enables display of letter forms used with ordinal numbers." }, { "name": "proportional-nums", "description": "Enables display of proportional numerals." }, { "name": "slashed-zero", "description": "Enables display of slashed zeros." }, { "name": "stacked-fractions", "description": "Enables display of lining stacked fractions." }, { "name": "tabular-nums", "description": "Enables display of tabular numerals." } ], "syntax": "normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-variant-numeric" } ], "description": "Specifies control over numerical forms.", "restrictions": [ "enum" ] }, { "name": "font-variant-position", "browsers": [ "FF34", "S9.1" ], "values": [ { "name": "normal", "description": "None of the features are enabled." }, { "name": "sub", "description": "Enables display of subscript variants (OpenType feature: subs)." }, { "name": "super", "description": "Enables display of superscript variants (OpenType feature: sups)." } ], "syntax": "normal | sub | super", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-variant-position" } ], "description": "Specifies the vertical position", "restrictions": [ "enum" ] }, { "name": "font-weight", "values": [ { "name": "100", "description": "Thin" }, { "name": "200", "description": "Extra Light (Ultra Light)" }, { "name": "300", "description": "Light" }, { "name": "400", "description": "Normal" }, { "name": "500", "description": "Medium" }, { "name": "600", "description": "Semi Bold (Demi Bold)" }, { "name": "700", "description": "Bold" }, { "name": "800", "description": "Extra Bold (Ultra Bold)" }, { "name": "900", "description": "Black (Heavy)" }, { "name": "bold", "description": "Same as 700" }, { "name": "bolder", "description": "Specifies the weight of the face bolder than the inherited value." }, { "name": "lighter", "description": "Specifies the weight of the face lighter than the inherited value." }, { "name": "normal", "description": "Same as 400" } ], "syntax": "<font-weight-absolute>{1,2}", "relevance": 94, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-weight" } ], "description": "Specifies weight of glyphs in the font, their degree of blackness or stroke thickness.", "restrictions": [ "enum" ] }, { "name": "glyph-orientation-horizontal", "relevance": 50, "description": "Controls glyph orientation when the inline-progression-direction is horizontal.", "restrictions": [ "angle", "number" ] }, { "name": "glyph-orientation-vertical", "values": [ { "name": "auto", "description": "Sets the orientation based on the fullwidth or non-fullwidth characters and the most common orientation." } ], "relevance": 50, "description": "Controls glyph orientation when the inline-progression-direction is vertical.", "restrictions": [ "angle", "number", "enum" ] }, { "name": "grid-area", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "values": [ { "name": "auto", "description": "The property contributes nothing to the grid item’s placement, indicating auto-placement, an automatic span, or a default span of one." }, { "name": "span", "description": "Contributes a grid span to the grid item’s placement such that the corresponding edge of the grid item’s grid area is N lines from its opposite edge." } ], "syntax": "<grid-line> [ / <grid-line> ]{0,3}", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-area" } ], "description": "Determine a grid item’s size and location within the grid by contributing a line, a span, or nothing (automatic) to its grid placement. Shorthand for 'grid-row-start', 'grid-column-start', 'grid-row-end', and 'grid-column-end'.", "restrictions": [ "identifier", "integer" ] }, { "name": "grid", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "syntax": "<'grid-template'> | <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid" } ], "description": "The grid CSS property is a shorthand property that sets all of the explicit grid properties ('grid-template-rows', 'grid-template-columns', and 'grid-template-areas'), and all the implicit grid properties ('grid-auto-rows', 'grid-auto-columns', and 'grid-auto-flow'), in a single declaration.", "restrictions": [ "identifier", "length", "percentage", "string", "enum" ] }, { "name": "grid-auto-columns", "values": [ { "name": "min-content", "description": "Represents the largest min-content contribution of the grid items occupying the grid track." }, { "name": "max-content", "description": "Represents the largest max-content contribution of the grid items occupying the grid track." }, { "name": "auto", "description": "As a maximum, identical to 'max-content'. As a minimum, represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track." }, { "name": "minmax()", "description": "Defines a size range greater than or equal to min and less than or equal to max." } ], "syntax": "<track-size>+", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-auto-columns" } ], "description": "Specifies the size of implicitly created columns.", "restrictions": [ "length", "percentage" ] }, { "name": "grid-auto-flow", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "values": [ { "name": "row", "description": "The auto-placement algorithm places items by filling each row in turn, adding new rows as necessary." }, { "name": "column", "description": "The auto-placement algorithm places items by filling each column in turn, adding new columns as necessary." }, { "name": "dense", "description": "If specified, the auto-placement algorithm uses a “dense” packing algorithm, which attempts to fill in holes earlier in the grid if smaller items come up later." } ], "syntax": "[ row | column ] || dense", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-auto-flow" } ], "description": "Controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid.", "restrictions": [ "enum" ] }, { "name": "grid-auto-rows", "values": [ { "name": "min-content", "description": "Represents the largest min-content contribution of the grid items occupying the grid track." }, { "name": "max-content", "description": "Represents the largest max-content contribution of the grid items occupying the grid track." }, { "name": "auto", "description": "As a maximum, identical to 'max-content'. As a minimum, represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track." }, { "name": "minmax()", "description": "Defines a size range greater than or equal to min and less than or equal to max." } ], "syntax": "<track-size>+", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-auto-rows" } ], "description": "Specifies the size of implicitly created rows.", "restrictions": [ "length", "percentage" ] }, { "name": "grid-column", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "values": [ { "name": "auto", "description": "The property contributes nothing to the grid item’s placement, indicating auto-placement, an automatic span, or a default span of one." }, { "name": "span", "description": "Contributes a grid span to the grid item’s placement such that the corresponding edge of the grid item’s grid area is N lines from its opposite edge." } ], "syntax": "<grid-line> [ / <grid-line> ]?", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-column" } ], "description": "Shorthand for 'grid-column-start' and 'grid-column-end'.", "restrictions": [ "identifier", "integer", "enum" ] }, { "name": "grid-column-end", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "values": [ { "name": "auto", "description": "The property contributes nothing to the grid item’s placement, indicating auto-placement, an automatic span, or a default span of one." }, { "name": "span", "description": "Contributes a grid span to the grid item’s placement such that the corresponding edge of the grid item’s grid area is N lines from its opposite edge." } ], "syntax": "<grid-line>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-column-end" } ], "description": "Determine a grid item’s size and location within the grid by contributing a line, a span, or nothing (automatic) to its grid placement.", "restrictions": [ "identifier", "integer", "enum" ] }, { "name": "grid-column-gap", "browsers": [ "FF52", "C57", "S10.1", "O44" ], "status": "obsolete", "syntax": "<length-percentage>", "relevance": 2, "description": "Specifies the gutters between grid columns. Replaced by 'column-gap' property.", "restrictions": [ "length" ] }, { "name": "grid-column-start", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "values": [ { "name": "auto", "description": "The property contributes nothing to the grid item’s placement, indicating auto-placement, an automatic span, or a default span of one." }, { "name": "span", "description": "Contributes a grid span to the grid item’s placement such that the corresponding edge of the grid item’s grid area is N lines from its opposite edge." } ], "syntax": "<grid-line>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-column-start" } ], "description": "Determine a grid item’s size and location within the grid by contributing a line, a span, or nothing (automatic) to its grid placement.", "restrictions": [ "identifier", "integer", "enum" ] }, { "name": "grid-gap", "browsers": [ "FF52", "C57", "S10.1", "O44" ], "status": "obsolete", "syntax": "<'grid-row-gap'> <'grid-column-gap'>?", "relevance": 3, "description": "Shorthand that specifies the gutters between grid columns and grid rows in one declaration. Replaced by 'gap' property.", "restrictions": [ "length" ] }, { "name": "grid-row", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "values": [ { "name": "auto", "description": "The property contributes nothing to the grid item’s placement, indicating auto-placement, an automatic span, or a default span of one." }, { "name": "span", "description": "Contributes a grid span to the grid item’s placement such that the corresponding edge of the grid item’s grid area is N lines from its opposite edge." } ], "syntax": "<grid-line> [ / <grid-line> ]?", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-row" } ], "description": "Shorthand for 'grid-row-start' and 'grid-row-end'.", "restrictions": [ "identifier", "integer", "enum" ] }, { "name": "grid-row-end", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "values": [ { "name": "auto", "description": "The property contributes nothing to the grid item’s placement, indicating auto-placement, an automatic span, or a default span of one." }, { "name": "span", "description": "Contributes a grid span to the grid item’s placement such that the corresponding edge of the grid item’s grid area is N lines from its opposite edge." } ], "syntax": "<grid-line>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-row-end" } ], "description": "Determine a grid item’s size and location within the grid by contributing a line, a span, or nothing (automatic) to its grid placement.", "restrictions": [ "identifier", "integer", "enum" ] }, { "name": "grid-row-gap", "browsers": [ "FF52", "C57", "S10.1", "O44" ], "status": "obsolete", "syntax": "<length-percentage>", "relevance": 1, "description": "Specifies the gutters between grid rows. Replaced by 'row-gap' property.", "restrictions": [ "length" ] }, { "name": "grid-row-start", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "values": [ { "name": "auto", "description": "The property contributes nothing to the grid item’s placement, indicating auto-placement, an automatic span, or a default span of one." }, { "name": "span", "description": "Contributes a grid span to the grid item’s placement such that the corresponding edge of the grid item’s grid area is N lines from its opposite edge." } ], "syntax": "<grid-line>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-row-start" } ], "description": "Determine a grid item’s size and location within the grid by contributing a line, a span, or nothing (automatic) to its grid placement.", "restrictions": [ "identifier", "integer", "enum" ] }, { "name": "grid-template", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "values": [ { "name": "none", "description": "Sets all three properties to their initial values." }, { "name": "min-content", "description": "Represents the largest min-content contribution of the grid items occupying the grid track." }, { "name": "max-content", "description": "Represents the largest max-content contribution of the grid items occupying the grid track." }, { "name": "auto", "description": "As a maximum, identical to 'max-content'. As a minimum, represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track." }, { "name": "subgrid", "description": "Sets 'grid-template-rows' and 'grid-template-columns' to 'subgrid', and 'grid-template-areas' to its initial value." }, { "name": "minmax()", "description": "Defines a size range greater than or equal to min and less than or equal to max." }, { "name": "repeat()", "description": "Represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form." } ], "syntax": "none | [ <'grid-template-rows'> / <'grid-template-columns'> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-template" } ], "description": "Shorthand for setting grid-template-columns, grid-template-rows, and grid-template-areas in a single declaration.", "restrictions": [ "identifier", "length", "percentage", "string", "enum" ] }, { "name": "grid-template-areas", "browsers": [ "E16", "FF52", "S10.1", "C57", "O44" ], "values": [ { "name": "none", "description": "The grid container doesn’t define any named grid areas." } ], "syntax": "none | <string>+", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-template-areas" } ], "description": "Specifies named grid areas, which are not associated with any particular grid item, but can be referenced from the grid-placement properties.", "restrictions": [ "string" ] }, { "name": "grid-template-columns", "values": [ { "name": "none", "description": "There is no explicit grid; any rows/columns will be implicitly generated." }, { "name": "min-content", "description": "Represents the largest min-content contribution of the grid items occupying the grid track." }, { "name": "max-content", "description": "Represents the largest max-content contribution of the grid items occupying the grid track." }, { "name": "auto", "description": "As a maximum, identical to 'max-content'. As a minimum, represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track." }, { "name": "subgrid", "description": "Indicates that the grid will align to its parent grid in that axis." }, { "name": "minmax()", "description": "Defines a size range greater than or equal to min and less than or equal to max." }, { "name": "repeat()", "description": "Represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form." } ], "syntax": "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?", "relevance": 58, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-template-columns" } ], "description": "specifies, as a space-separated track list, the line names and track sizing functions of the grid.", "restrictions": [ "identifier", "length", "percentage", "enum" ] }, { "name": "grid-template-rows", "values": [ { "name": "none", "description": "There is no explicit grid; any rows/columns will be implicitly generated." }, { "name": "min-content", "description": "Represents the largest min-content contribution of the grid items occupying the grid track." }, { "name": "max-content", "description": "Represents the largest max-content contribution of the grid items occupying the grid track." }, { "name": "auto", "description": "As a maximum, identical to 'max-content'. As a minimum, represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track." }, { "name": "subgrid", "description": "Indicates that the grid will align to its parent grid in that axis." }, { "name": "minmax()", "description": "Defines a size range greater than or equal to min and less than or equal to max." }, { "name": "repeat()", "description": "Represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form." } ], "syntax": "none | <track-list> | <auto-track-list> | subgrid <line-name-list>?", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/grid-template-rows" } ], "description": "specifies, as a space-separated track list, the line names and track sizing functions of the grid.", "restrictions": [ "identifier", "length", "percentage", "string", "enum" ] }, { "name": "height", "values": [ { "name": "auto", "description": "The height depends on the values of other properties." }, { "name": "fit-content", "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." }, { "name": "max-content", "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." }, { "name": "min-content", "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." } ], "syntax": "<viewport-length>{1,2}", "relevance": 96, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/height" } ], "description": "Specifies the height of the content area, padding area or border area (depending on 'box-sizing') of certain boxes.", "restrictions": [ "length", "percentage" ] }, { "name": "hyphens", "values": [ { "name": "auto", "description": "Conditional hyphenation characters inside a word, if present, take priority over automatic resources when determining hyphenation points within the word." }, { "name": "manual", "description": "Words are only broken at line breaks where there are characters inside the word that suggest line break opportunities" }, { "name": "none", "description": "Words are not broken at line breaks, even if characters inside the word suggest line break points." } ], "syntax": "none | manual | auto", "relevance": 55, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/hyphens" } ], "description": "Controls whether hyphenation is allowed to create more break opportunities within a line of text.", "restrictions": [ "enum" ] }, { "name": "image-orientation", "browsers": [ "E81", "FF26", "S13.1", "C81", "O67" ], "values": [ { "name": "flip", "description": "After rotating by the precededing angle, the image is flipped horizontally. Defaults to 0deg if the angle is ommitted." }, { "name": "from-image", "description": "If the image has an orientation specified in its metadata, such as EXIF, this value computes to the angle that the metadata specifies is necessary to correctly orient the image." } ], "syntax": "from-image | <angle> | [ <angle>? flip ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/image-orientation" } ], "description": "Specifies an orthogonal rotation to be applied to an image before it is laid out.", "restrictions": [ "angle" ] }, { "name": "image-rendering", "browsers": [ "E79", "FF3.6", "S6", "C13", "O15" ], "values": [ { "name": "auto", "description": "The image should be scaled with an algorithm that maximizes the appearance of the image." }, { "name": "crisp-edges", "description": "The image must be scaled with an algorithm that preserves contrast and edges in the image, and which does not smooth colors or introduce blur to the image in the process." }, { "name": "-moz-crisp-edges", "browsers": [ "E79", "FF3.6", "S6", "C13", "O15" ] }, { "name": "optimizeQuality", "description": "Deprecated." }, { "name": "optimizeSpeed", "description": "Deprecated." }, { "name": "pixelated", "description": "When scaling the image up, the 'nearest neighbor' or similar algorithm must be used, so that the image appears to be simply composed of very large pixels." } ], "syntax": "auto | crisp-edges | pixelated", "relevance": 55, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/image-rendering" } ], "description": "Provides a hint to the user-agent about what aspects of an image are most important to preserve when the image is scaled, to aid the user-agent in the choice of an appropriate scaling algorithm.", "restrictions": [ "enum" ] }, { "name": "ime-mode", "browsers": [ "E12", "FF3", "IE5" ], "values": [ { "name": "active", "description": "The input method editor is initially active; text entry is performed using it unless the user specifically dismisses it." }, { "name": "auto", "description": "No change is made to the current input method editor state. This is the default." }, { "name": "disabled", "description": "The input method editor is disabled and may not be activated by the user." }, { "name": "inactive", "description": "The input method editor is initially inactive, but the user may activate it if they wish." }, { "name": "normal", "description": "The IME state should be normal; this value can be used in a user style sheet to override the page setting." } ], "status": "obsolete", "syntax": "auto | normal | active | inactive | disabled", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/ime-mode" } ], "description": "Controls the state of the input method editor for text fields.", "restrictions": [ "enum" ] }, { "name": "inline-size", "browsers": [ "E79", "FF41", "S12.1", "C57", "O44" ], "values": [ { "name": "auto", "description": "Depends on the values of other properties." } ], "syntax": "<'width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/inline-size" } ], "description": "Size of an element in the direction specified by 'writing-mode'.", "restrictions": [ "length", "percentage" ] }, { "name": "isolation", "browsers": [ "E79", "FF36", "S8", "C41", "O30" ], "values": [ { "name": "auto", "description": "Elements are not isolated unless an operation is applied that causes the creation of a stacking context." }, { "name": "isolate", "description": "In CSS will turn the element into a stacking context." } ], "syntax": "auto | isolate", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/isolation" } ], "description": "In CSS setting to 'isolate' will turn the element into a stacking context. In SVG, it defines whether an element is isolated or not.", "restrictions": [ "enum" ] }, { "name": "justify-content", "values": [ { "name": "center", "description": "Flex items are packed toward the center of the line." }, { "name": "start", "description": "The items are packed flush to each other toward the start edge of the alignment container in the main axis." }, { "name": "end", "description": "The items are packed flush to each other toward the end edge of the alignment container in the main axis." }, { "name": "left", "description": "The items are packed flush to each other toward the left edge of the alignment container in the main axis." }, { "name": "right", "description": "The items are packed flush to each other toward the right edge of the alignment container in the main axis." }, { "name": "safe", "description": "If the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were start." }, { "name": "unsafe", "description": "Regardless of the relative sizes of the item and alignment container, the given alignment value is honored." }, { "name": "stretch", "description": "If the combined size of the alignment subjects is less than the size of the alignment container, any auto-sized alignment subjects have their size increased equally (not proportionally), while still respecting the constraints imposed by max-height/max-width (or equivalent functionality), so that the combined size exactly fills the alignment container." }, { "name": "space-evenly", "description": "The items are evenly distributed within the alignment container along the main axis." }, { "name": "flex-end", "description": "Flex items are packed toward the end of the line." }, { "name": "flex-start", "description": "Flex items are packed toward the start of the line." }, { "name": "space-around", "description": "Flex items are evenly distributed in the line, with half-size spaces on either end." }, { "name": "space-between", "description": "Flex items are evenly distributed in the line." }, { "name": "baseline", "description": "Specifies participation in first-baseline alignment." }, { "name": "first baseline", "description": "Specifies participation in first-baseline alignment." }, { "name": "last baseline", "description": "Specifies participation in last-baseline alignment." } ], "syntax": "normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]", "relevance": 86, "description": "Aligns flex items along the main axis of the current line of the flex container.", "restrictions": [ "enum" ] }, { "name": "kerning", "values": [ { "name": "auto", "description": "Indicates that the user agent should adjust inter-glyph spacing based on kerning tables that are included in the font that will be used." } ], "relevance": 50, "description": "Indicates whether the user agent should adjust inter-glyph spacing based on kerning tables that are included in the relevant font or instead disable auto-kerning and set inter-character spacing to a specific length.", "restrictions": [ "length", "enum" ] }, { "name": "left", "values": [ { "name": "auto", "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well" } ], "syntax": "<length> | <percentage> | auto", "relevance": 95, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/left" } ], "description": "Specifies how far an absolutely positioned box's left margin edge is offset to the right of the left edge of the box's 'containing block'.", "restrictions": [ "length", "percentage" ] }, { "name": "letter-spacing", "values": [ { "name": "normal", "description": "The spacing is the normal spacing for the current font. It is typically zero-length." } ], "syntax": "normal | <length>", "relevance": 82, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/letter-spacing" } ], "description": "Specifies the minimum, maximum, and optimal spacing between grapheme clusters.", "restrictions": [ "length" ] }, { "name": "lighting-color", "browsers": [ "E", "C5", "FF3", "IE10", "O9", "S6" ], "relevance": 50, "description": "Defines the color of the light source for filter primitives 'feDiffuseLighting' and 'feSpecularLighting'.", "restrictions": [ "color" ] }, { "name": "line-break", "values": [ { "name": "auto", "description": "The UA determines the set of line-breaking restrictions to use for CJK scripts, and it may vary the restrictions based on the length of the line; e.g., use a less restrictive set of line-break rules for short lines." }, { "name": "loose", "description": "Breaks text using the least restrictive set of line-breaking rules. Typically used for short lines, such as in newspapers." }, { "name": "normal", "description": "Breaks text using the most common set of line-breaking rules." }, { "name": "strict", "description": "Breaks CJK scripts using a more restrictive set of line-breaking rules than 'normal'." } ], "syntax": "auto | loose | normal | strict | anywhere", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/line-break" } ], "description": "Specifies what set of line breaking restrictions are in effect within the element.", "restrictions": [ "enum" ] }, { "name": "line-height", "values": [ { "name": "normal", "description": "Tells user agents to set the computed value to a 'reasonable' value based on the font size of the element." } ], "syntax": "normal | <number> | <length> | <percentage>", "relevance": 93, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/line-height" } ], "description": "Determines the block-progression dimension of the text content area of an inline box.", "restrictions": [ "number", "length", "percentage" ] }, { "name": "list-style", "values": [ { "name": "armenian" }, { "name": "circle", "description": "A hollow circle." }, { "name": "decimal" }, { "name": "decimal-leading-zero" }, { "name": "disc", "description": "A filled circle." }, { "name": "georgian" }, { "name": "inside", "description": "The marker box is outside the principal block box, as described in the section on the ::marker pseudo-element below." }, { "name": "lower-alpha" }, { "name": "lower-greek" }, { "name": "lower-latin" }, { "name": "lower-roman" }, { "name": "none" }, { "name": "outside", "description": "The ::marker pseudo-element is an inline element placed immediately before all ::before pseudo-elements in the principal block box, after which the element's content flows." }, { "name": "square", "description": "A filled square." }, { "name": "symbols()", "description": "Allows a counter style to be defined inline." }, { "name": "upper-alpha" }, { "name": "upper-latin" }, { "name": "upper-roman" }, { "name": "url()" } ], "syntax": "<'list-style-type'> || <'list-style-position'> || <'list-style-image'>", "relevance": 86, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/list-style" } ], "description": "Shorthand for setting 'list-style-type', 'list-style-position' and 'list-style-image'", "restrictions": [ "image", "enum", "url" ] }, { "name": "list-style-image", "values": [ { "name": "none", "description": "The default contents of the of the list item’s marker are given by 'list-style-type' instead." } ], "syntax": "<image> | none", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/list-style-image" } ], "description": "Sets the image that will be used as the list item marker. When the image is available, it will replace the marker set with the 'list-style-type' marker.", "restrictions": [ "image" ] }, { "name": "list-style-position", "values": [ { "name": "inside", "description": "The marker box is outside the principal block box, as described in the section on the ::marker pseudo-element below." }, { "name": "outside", "description": "The ::marker pseudo-element is an inline element placed immediately before all ::before pseudo-elements in the principal block box, after which the element's content flows." } ], "syntax": "inside | outside", "relevance": 55, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/list-style-position" } ], "description": "Specifies the position of the '::marker' pseudo-element's box in the list item.", "restrictions": [ "enum" ] }, { "name": "list-style-type", "values": [ { "name": "armenian", "description": "Traditional uppercase Armenian numbering." }, { "name": "circle", "description": "A hollow circle." }, { "name": "decimal", "description": "Western decimal numbers." }, { "name": "decimal-leading-zero", "description": "Decimal numbers padded by initial zeros." }, { "name": "disc", "description": "A filled circle." }, { "name": "georgian", "description": "Traditional Georgian numbering." }, { "name": "lower-alpha", "description": "Lowercase ASCII letters." }, { "name": "lower-greek", "description": "Lowercase classical Greek." }, { "name": "lower-latin", "description": "Lowercase ASCII letters." }, { "name": "lower-roman", "description": "Lowercase ASCII Roman numerals." }, { "name": "none", "description": "No marker" }, { "name": "square", "description": "A filled square." }, { "name": "symbols()", "description": "Allows a counter style to be defined inline." }, { "name": "upper-alpha", "description": "Uppercase ASCII letters." }, { "name": "upper-latin", "description": "Uppercase ASCII letters." }, { "name": "upper-roman", "description": "Uppercase ASCII Roman numerals." } ], "syntax": "<counter-style> | <string> | none", "relevance": 75, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/list-style-type" } ], "description": "Used to construct the default contents of a list item’s marker", "restrictions": [ "enum", "string" ] }, { "name": "margin", "values": [ { "name": "auto" } ], "syntax": "[ <length> | <percentage> | auto ]{1,4}", "relevance": 96, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin" } ], "description": "Shorthand property to set values for the thickness of the margin area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. Negative values for margin properties are allowed, but there may be implementation-specific limits.", "restrictions": [ "length", "percentage" ] }, { "name": "margin-block-end", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "values": [ { "name": "auto" } ], "syntax": "<'margin-left'>", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-block-end" } ], "description": "Logical 'margin-bottom'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "margin-block-start", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "values": [ { "name": "auto" } ], "syntax": "<'margin-left'>", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-block-start" } ], "description": "Logical 'margin-top'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "margin-bottom", "values": [ { "name": "auto" } ], "syntax": "<length> | <percentage> | auto", "relevance": 92, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-bottom" } ], "description": "Shorthand property to set values for the thickness of the margin area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. Negative values for margin properties are allowed, but there may be implementation-specific limits..", "restrictions": [ "length", "percentage" ] }, { "name": "margin-inline-end", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "values": [ { "name": "auto" } ], "syntax": "<'margin-left'>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-inline-end" } ], "description": "Logical 'margin-right'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "margin-inline-start", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "values": [ { "name": "auto" } ], "syntax": "<'margin-left'>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-inline-start" } ], "description": "Logical 'margin-left'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "margin-left", "values": [ { "name": "auto" } ], "syntax": "<length> | <percentage> | auto", "relevance": 92, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-left" } ], "description": "Shorthand property to set values for the thickness of the margin area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. Negative values for margin properties are allowed, but there may be implementation-specific limits..", "restrictions": [ "length", "percentage" ] }, { "name": "margin-right", "values": [ { "name": "auto" } ], "syntax": "<length> | <percentage> | auto", "relevance": 91, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-right" } ], "description": "Shorthand property to set values for the thickness of the margin area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. Negative values for margin properties are allowed, but there may be implementation-specific limits..", "restrictions": [ "length", "percentage" ] }, { "name": "margin-top", "values": [ { "name": "auto" } ], "syntax": "<length> | <percentage> | auto", "relevance": 95, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-top" } ], "description": "Shorthand property to set values for the thickness of the margin area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. Negative values for margin properties are allowed, but there may be implementation-specific limits..", "restrictions": [ "length", "percentage" ] }, { "name": "marker", "values": [ { "name": "none", "description": "Indicates that no marker symbol will be drawn at the given vertex or vertices." }, { "name": "url()", "description": "Indicates that the <marker> element referenced will be used." } ], "relevance": 50, "description": "Specifies the marker symbol that shall be used for all points on the sets the value for all vertices on the given ‘path’ element or basic shape.", "restrictions": [ "url" ] }, { "name": "marker-end", "values": [ { "name": "none", "description": "Indicates that no marker symbol will be drawn at the given vertex or vertices." }, { "name": "url()", "description": "Indicates that the <marker> element referenced will be used." } ], "relevance": 50, "description": "Specifies the marker that will be drawn at the last vertices of the given markable element.", "restrictions": [ "url" ] }, { "name": "marker-mid", "values": [ { "name": "none", "description": "Indicates that no marker symbol will be drawn at the given vertex or vertices." }, { "name": "url()", "description": "Indicates that the <marker> element referenced will be used." } ], "relevance": 50, "description": "Specifies the marker that will be drawn at all vertices except the first and last.", "restrictions": [ "url" ] }, { "name": "marker-start", "values": [ { "name": "none", "description": "Indicates that no marker symbol will be drawn at the given vertex or vertices." }, { "name": "url()", "description": "Indicates that the <marker> element referenced will be used." } ], "relevance": 50, "description": "Specifies the marker that will be drawn at the first vertices of the given markable element.", "restrictions": [ "url" ] }, { "name": "mask-image", "browsers": [ "E79", "FF53", "S4", "C1", "O15" ], "values": [ { "name": "none", "description": "Counts as a transparent black image layer." }, { "name": "url()", "description": "Reference to a <mask element or to a CSS image." } ], "syntax": "<mask-reference>#", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-image" } ], "description": "Sets the mask layer image of an element.", "restrictions": [ "url", "image", "enum" ] }, { "name": "mask-mode", "browsers": [ "FF53" ], "values": [ { "name": "alpha", "description": "Alpha values of the mask layer image should be used as the mask values." }, { "name": "auto", "description": "Use alpha values if 'mask-image' is an image, luminance if a <mask> element or a CSS image." }, { "name": "luminance", "description": "Luminance values of the mask layer image should be used as the mask values." } ], "syntax": "<masking-mode>#", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-mode" } ], "description": "Indicates whether the mask layer image is treated as luminance mask or alpha mask.", "restrictions": [ "url", "image", "enum" ] }, { "name": "mask-origin", "browsers": [ "E79", "FF53", "S4", "C1", "O15" ], "syntax": "<geometry-box>#", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-origin" } ], "description": "Specifies the mask positioning area.", "restrictions": [ "geometry-box", "enum" ] }, { "name": "mask-position", "browsers": [ "E79", "FF53", "S3.1", "C1", "O15" ], "syntax": "<position>#", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-position" } ], "description": "Specifies how mask layer images are positioned.", "restrictions": [ "position", "length", "percentage" ] }, { "name": "mask-repeat", "browsers": [ "E79", "FF53", "S3.1", "C1", "O15" ], "syntax": "<repeat-style>#", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-repeat" } ], "description": "Specifies how mask layer images are tiled after they have been sized and positioned.", "restrictions": [ "repeat" ] }, { "name": "mask-size", "browsers": [ "E79", "FF53", "S4", "C4", "O15" ], "values": [ { "name": "auto", "description": "Resolved by using the image’s intrinsic ratio and the size of the other dimension, or failing that, using the image’s intrinsic size, or failing that, treating it as 100%." }, { "name": "contain", "description": "Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area." }, { "name": "cover", "description": "Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area." } ], "syntax": "<bg-size>#", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-size" } ], "description": "Specifies the size of the mask layer images.", "restrictions": [ "length", "percentage", "enum" ] }, { "name": "mask-type", "browsers": [ "E79", "FF35", "S7", "C24", "O15" ], "values": [ { "name": "alpha", "description": "Indicates that the alpha values of the mask should be used." }, { "name": "luminance", "description": "Indicates that the luminance values of the mask should be used." } ], "syntax": "luminance | alpha", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-type" } ], "description": "Defines whether the content of the <mask> element is treated as as luminance mask or alpha mask.", "restrictions": [ "enum" ] }, { "name": "max-block-size", "browsers": [ "E79", "FF41", "S12.1", "C57", "O44" ], "values": [ { "name": "none", "description": "No limit on the width of the box." } ], "syntax": "<'max-width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/max-block-size" } ], "description": "Maximum size of an element in the direction opposite that of the direction specified by 'writing-mode'.", "restrictions": [ "length", "percentage" ] }, { "name": "max-height", "values": [ { "name": "none", "description": "No limit on the height of the box." }, { "name": "fit-content", "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." }, { "name": "max-content", "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." }, { "name": "min-content", "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." } ], "syntax": "<viewport-length>", "relevance": 86, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/max-height" } ], "description": "Allows authors to constrain content height to a certain range.", "restrictions": [ "length", "percentage" ] }, { "name": "max-inline-size", "browsers": [ "E79", "FF41", "S12.1", "C57", "O44" ], "values": [ { "name": "none", "description": "No limit on the height of the box." } ], "syntax": "<'max-width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/max-inline-size" } ], "description": "Maximum size of an element in the direction specified by 'writing-mode'.", "restrictions": [ "length", "percentage" ] }, { "name": "max-width", "values": [ { "name": "none", "description": "No limit on the width of the box." }, { "name": "fit-content", "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." }, { "name": "max-content", "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." }, { "name": "min-content", "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." } ], "syntax": "<viewport-length>", "relevance": 91, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/max-width" } ], "description": "Allows authors to constrain content width to a certain range.", "restrictions": [ "length", "percentage" ] }, { "name": "min-block-size", "browsers": [ "E79", "FF41", "S12.1", "C57", "O44" ], "syntax": "<'min-width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/min-block-size" } ], "description": "Minimal size of an element in the direction opposite that of the direction specified by 'writing-mode'.", "restrictions": [ "length", "percentage" ] }, { "name": "min-height", "values": [ { "name": "auto" }, { "name": "fit-content", "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." }, { "name": "max-content", "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." }, { "name": "min-content", "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." } ], "syntax": "<viewport-length>", "relevance": 90, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/min-height" } ], "description": "Allows authors to constrain content height to a certain range.", "restrictions": [ "length", "percentage" ] }, { "name": "min-inline-size", "browsers": [ "E79", "FF41", "S12.1", "C57", "O44" ], "syntax": "<'min-width'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/min-inline-size" } ], "description": "Minimal size of an element in the direction specified by 'writing-mode'.", "restrictions": [ "length", "percentage" ] }, { "name": "min-width", "values": [ { "name": "auto" }, { "name": "fit-content", "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." }, { "name": "max-content", "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." }, { "name": "min-content", "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." } ], "syntax": "<viewport-length>", "relevance": 89, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/min-width" } ], "description": "Allows authors to constrain content width to a certain range.", "restrictions": [ "length", "percentage" ] }, { "name": "mix-blend-mode", "browsers": [ "E79", "FF32", "S8", "C41", "O28" ], "values": [ { "name": "normal", "description": "Default attribute which specifies no blending" }, { "name": "multiply", "description": "The source color is multiplied by the destination color and replaces the destination." }, { "name": "screen", "description": "Multiplies the complements of the backdrop and source color values, then complements the result." }, { "name": "overlay", "description": "Multiplies or screens the colors, depending on the backdrop color value." }, { "name": "darken", "description": "Selects the darker of the backdrop and source colors." }, { "name": "lighten", "description": "Selects the lighter of the backdrop and source colors." }, { "name": "color-dodge", "description": "Brightens the backdrop color to reflect the source color." }, { "name": "color-burn", "description": "Darkens the backdrop color to reflect the source color." }, { "name": "hard-light", "description": "Multiplies or screens the colors, depending on the source color value." }, { "name": "soft-light", "description": "Darkens or lightens the colors, depending on the source color value." }, { "name": "difference", "description": "Subtracts the darker of the two constituent colors from the lighter color.." }, { "name": "exclusion", "description": "Produces an effect similar to that of the Difference mode but lower in contrast." }, { "name": "hue", "browsers": [ "E79", "FF32", "S8", "C41", "O28" ], "description": "Creates a color with the hue of the source color and the saturation and luminosity of the backdrop color." }, { "name": "saturation", "browsers": [ "E79", "FF32", "S8", "C41", "O28" ], "description": "Creates a color with the saturation of the source color and the hue and luminosity of the backdrop color." }, { "name": "color", "browsers": [ "E79", "FF32", "S8", "C41", "O28" ], "description": "Creates a color with the hue and saturation of the source color and the luminosity of the backdrop color." }, { "name": "luminosity", "browsers": [ "E79", "FF32", "S8", "C41", "O28" ], "description": "Creates a color with the luminosity of the source color and the hue and saturation of the backdrop color." } ], "syntax": "<blend-mode>", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mix-blend-mode" } ], "description": "Defines the formula that must be used to mix the colors with the backdrop.", "restrictions": [ "enum" ] }, { "name": "motion", "browsers": [ "C46", "O33" ], "values": [ { "name": "none", "description": "No motion path gets created." }, { "name": "path()", "description": "Defines an SVG path as a string, with optional 'fill-rule' as the first argument." }, { "name": "auto", "description": "Indicates that the object is rotated by the angle of the direction of the motion path." }, { "name": "reverse", "description": "Indicates that the object is rotated by the angle of the direction of the motion path plus 180 degrees." } ], "relevance": 50, "description": "Shorthand property for setting 'motion-path', 'motion-offset' and 'motion-rotation'.", "restrictions": [ "url", "length", "percentage", "angle", "shape", "geometry-box", "enum" ] }, { "name": "motion-offset", "browsers": [ "C46", "O33" ], "relevance": 50, "description": "A distance that describes the position along the specified motion path.", "restrictions": [ "length", "percentage" ] }, { "name": "motion-path", "browsers": [ "C46", "O33" ], "values": [ { "name": "none", "description": "No motion path gets created." }, { "name": "path()", "description": "Defines an SVG path as a string, with optional 'fill-rule' as the first argument." } ], "relevance": 50, "description": "Specifies the motion path the element gets positioned at.", "restrictions": [ "url", "shape", "geometry-box", "enum" ] }, { "name": "motion-rotation", "browsers": [ "C46", "O33" ], "values": [ { "name": "auto", "description": "Indicates that the object is rotated by the angle of the direction of the motion path." }, { "name": "reverse", "description": "Indicates that the object is rotated by the angle of the direction of the motion path plus 180 degrees." } ], "relevance": 50, "description": "Defines the direction of the element while positioning along the motion path.", "restrictions": [ "angle" ] }, { "name": "-moz-animation", "browsers": [ "FF9" ], "values": [ { "name": "alternate", "description": "The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction." }, { "name": "alternate-reverse", "description": "The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction." }, { "name": "backwards", "description": "The beginning property value (as defined in the first @keyframes at-rule) is applied before the animation is displayed, during the period defined by 'animation-delay'." }, { "name": "both", "description": "Both forwards and backwards fill modes are applied." }, { "name": "forwards", "description": "The final property value (as defined in the last @keyframes at-rule) is maintained after the animation completes." }, { "name": "infinite", "description": "Causes the animation to repeat forever." }, { "name": "none", "description": "No animation is performed" }, { "name": "normal", "description": "Normal playback." }, { "name": "reverse", "description": "All iterations of the animation are played in the reverse direction from the way they were specified." } ], "relevance": 50, "description": "Shorthand property combines six of the animation properties into a single property.", "restrictions": [ "time", "enum", "timing-function", "identifier", "number" ] }, { "name": "-moz-animation-delay", "browsers": [ "FF9" ], "relevance": 50, "description": "Defines when the animation will start.", "restrictions": [ "time" ] }, { "name": "-moz-animation-direction", "browsers": [ "FF9" ], "values": [ { "name": "alternate", "description": "The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction." }, { "name": "alternate-reverse", "description": "The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction." }, { "name": "normal", "description": "Normal playback." }, { "name": "reverse", "description": "All iterations of the animation are played in the reverse direction from the way they were specified." } ], "relevance": 50, "description": "Defines whether or not the animation should play in reverse on alternate cycles.", "restrictions": [ "enum" ] }, { "name": "-moz-animation-duration", "browsers": [ "FF9" ], "relevance": 50, "description": "Defines the length of time that an animation takes to complete one cycle.", "restrictions": [ "time" ] }, { "name": "-moz-animation-iteration-count", "browsers": [ "FF9" ], "values": [ { "name": "infinite", "description": "Causes the animation to repeat forever." } ], "relevance": 50, "description": "Defines the number of times an animation cycle is played. The default value is one, meaning the animation will play from beginning to end once.", "restrictions": [ "number", "enum" ] }, { "name": "-moz-animation-name", "browsers": [ "FF9" ], "values": [ { "name": "none", "description": "No animation is performed" } ], "relevance": 50, "description": "Defines a list of animations that apply. Each name is used to select the keyframe at-rule that provides the property values for the animation.", "restrictions": [ "identifier", "enum" ] }, { "name": "-moz-animation-play-state", "browsers": [ "FF9" ], "values": [ { "name": "paused", "description": "A running animation will be paused." }, { "name": "running", "description": "Resume playback of a paused animation." } ], "relevance": 50, "description": "Defines whether the animation is running or paused.", "restrictions": [ "enum" ] }, { "name": "-moz-animation-timing-function", "browsers": [ "FF9" ], "relevance": 50, "description": "Describes how the animation will progress over one cycle of its duration. See the 'transition-timing-function'.", "restrictions": [ "timing-function" ] }, { "name": "-moz-appearance", "browsers": [ "FF1" ], "values": [ { "name": "button" }, { "name": "button-arrow-down" }, { "name": "button-arrow-next" }, { "name": "button-arrow-previous" }, { "name": "button-arrow-up" }, { "name": "button-bevel" }, { "name": "checkbox" }, { "name": "checkbox-container" }, { "name": "checkbox-label" }, { "name": "dialog" }, { "name": "groupbox" }, { "name": "listbox" }, { "name": "menuarrow" }, { "name": "menuimage" }, { "name": "menuitem" }, { "name": "menuitemtext" }, { "name": "menulist" }, { "name": "menulist-button" }, { "name": "menulist-text" }, { "name": "menulist-textfield" }, { "name": "menupopup" }, { "name": "menuradio" }, { "name": "menuseparator" }, { "name": "-moz-mac-unified-toolbar" }, { "name": "-moz-win-borderless-glass" }, { "name": "-moz-win-browsertabbar-toolbox" }, { "name": "-moz-win-communications-toolbox" }, { "name": "-moz-win-glass" }, { "name": "-moz-win-media-toolbox" }, { "name": "none" }, { "name": "progressbar" }, { "name": "progresschunk" }, { "name": "radio" }, { "name": "radio-container" }, { "name": "radio-label" }, { "name": "radiomenuitem" }, { "name": "resizer" }, { "name": "resizerpanel" }, { "name": "scrollbarbutton-down" }, { "name": "scrollbarbutton-left" }, { "name": "scrollbarbutton-right" }, { "name": "scrollbarbutton-up" }, { "name": "scrollbar-small" }, { "name": "scrollbartrack-horizontal" }, { "name": "scrollbartrack-vertical" }, { "name": "separator" }, { "name": "spinner" }, { "name": "spinner-downbutton" }, { "name": "spinner-textfield" }, { "name": "spinner-upbutton" }, { "name": "statusbar" }, { "name": "statusbarpanel" }, { "name": "tab" }, { "name": "tabpanels" }, { "name": "tab-scroll-arrow-back" }, { "name": "tab-scroll-arrow-forward" }, { "name": "textfield" }, { "name": "textfield-multiline" }, { "name": "toolbar" }, { "name": "toolbox" }, { "name": "tooltip" }, { "name": "treeheadercell" }, { "name": "treeheadersortarrow" }, { "name": "treeitem" }, { "name": "treetwistyopen" }, { "name": "treeview" }, { "name": "treewisty" }, { "name": "window" } ], "status": "nonstandard", "syntax": "none | button | button-arrow-down | button-arrow-next | button-arrow-previous | button-arrow-up | button-bevel | button-focus | caret | checkbox | checkbox-container | checkbox-label | checkmenuitem | dualbutton | groupbox | listbox | listitem | menuarrow | menubar | menucheckbox | menuimage | menuitem | menuitemtext | menulist | menulist-button | menulist-text | menulist-textfield | menupopup | menuradio | menuseparator | meterbar | meterchunk | progressbar | progressbar-vertical | progresschunk | progresschunk-vertical | radio | radio-container | radio-label | radiomenuitem | range | range-thumb | resizer | resizerpanel | scale-horizontal | scalethumbend | scalethumb-horizontal | scalethumbstart | scalethumbtick | scalethumb-vertical | scale-vertical | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | separator | sheet | spinner | spinner-downbutton | spinner-textfield | spinner-upbutton | splitter | statusbar | statusbarpanel | tab | tabpanel | tabpanels | tab-scroll-arrow-back | tab-scroll-arrow-forward | textfield | textfield-multiline | toolbar | toolbarbutton | toolbarbutton-dropdown | toolbargripper | toolbox | tooltip | treeheader | treeheadercell | treeheadersortarrow | treeitem | treeline | treetwisty | treetwistyopen | treeview | -moz-mac-unified-toolbar | -moz-win-borderless-glass | -moz-win-browsertabbar-toolbox | -moz-win-communicationstext | -moz-win-communications-toolbox | -moz-win-exclude-glass | -moz-win-glass | -moz-win-mediatext | -moz-win-media-toolbox | -moz-window-button-box | -moz-window-button-box-maximized | -moz-window-button-close | -moz-window-button-maximize | -moz-window-button-minimize | -moz-window-button-restore | -moz-window-frame-bottom | -moz-window-frame-left | -moz-window-frame-right | -moz-window-titlebar | -moz-window-titlebar-maximized", "relevance": 0, "description": "Used in Gecko (Firefox) to display an element using a platform-native styling based on the operating system's theme.", "restrictions": [ "enum" ] }, { "name": "-moz-backface-visibility", "browsers": [ "FF10" ], "values": [ { "name": "hidden" }, { "name": "visible" } ], "relevance": 50, "description": "Determines whether or not the 'back' side of a transformed element is visible when facing the viewer. With an identity transform, the front side of an element faces the viewer.", "restrictions": [ "enum" ] }, { "name": "-moz-background-clip", "browsers": [ "FF1-3.6" ], "values": [ { "name": "padding" } ], "relevance": 50, "description": "Determines the background painting area.", "restrictions": [ "box", "enum" ] }, { "name": "-moz-background-inline-policy", "browsers": [ "FF1" ], "values": [ { "name": "bounding-box" }, { "name": "continuous" }, { "name": "each-box" } ], "relevance": 50, "description": "In Gecko-based applications like Firefox, the -moz-background-inline-policy CSS property specifies how the background image of an inline element is determined when the content of the inline element wraps onto multiple lines. The choice of position has significant effects on repetition.", "restrictions": [ "enum" ] }, { "name": "-moz-background-origin", "browsers": [ "FF1" ], "relevance": 50, "description": "For elements rendered as a single box, specifies the background positioning area. For elements rendered as multiple boxes (e.g., inline boxes on several lines, boxes on several pages) specifies which boxes 'box-decoration-break' operates on to determine the background positioning area(s).", "restrictions": [ "box" ] }, { "name": "-moz-border-bottom-colors", "browsers": [ "FF1" ], "status": "nonstandard", "syntax": "<color>+ | none", "relevance": 0, "description": "Sets a list of colors for the bottom border.", "restrictions": [ "color" ] }, { "name": "-moz-border-image", "browsers": [ "FF3.6" ], "values": [ { "name": "auto", "description": "If 'auto' is specified then the border image width is the intrinsic width or height (whichever is applicable) of the corresponding image slice. If the image does not have the required intrinsic dimension then the corresponding border-width is used instead." }, { "name": "fill", "description": "Causes the middle part of the border-image to be preserved." }, { "name": "none" }, { "name": "repeat", "description": "The image is tiled (repeated) to fill the area." }, { "name": "round", "description": "The image is tiled (repeated) to fill the area. If it does not fill the area with a whole number of tiles, the image is rescaled so that it does." }, { "name": "space", "description": "The image is tiled (repeated) to fill the area. If it does not fill the area with a whole number of tiles, the extra space is distributed around the tiles." }, { "name": "stretch", "description": "The image is stretched to fill the area." }, { "name": "url()" } ], "relevance": 50, "description": "Shorthand property for setting 'border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset' and 'border-image-repeat'. Omitted values are set to their initial values.", "restrictions": [ "length", "percentage", "number", "url", "enum" ] }, { "name": "-moz-border-left-colors", "browsers": [ "FF1" ], "status": "nonstandard", "syntax": "<color>+ | none", "relevance": 0, "description": "Sets a list of colors for the bottom border.", "restrictions": [ "color" ] }, { "name": "-moz-border-right-colors", "browsers": [ "FF1" ], "status": "nonstandard", "syntax": "<color>+ | none", "relevance": 0, "description": "Sets a list of colors for the bottom border.", "restrictions": [ "color" ] }, { "name": "-moz-border-top-colors", "browsers": [ "FF1" ], "status": "nonstandard", "syntax": "<color>+ | none", "relevance": 0, "description": "Ske Firefox, -moz-border-bottom-colors sets a list of colors for the bottom border.", "restrictions": [ "color" ] }, { "name": "-moz-box-align", "browsers": [ "FF1" ], "values": [ { "name": "baseline", "description": "If this box orientation is inline-axis or horizontal, all children are placed with their baselines aligned, and extra space placed before or after as necessary. For block flows, the baseline of the first non-empty line box located within the element is used. For tables, the baseline of the first cell is used." }, { "name": "center", "description": "Any extra space is divided evenly, with half placed above the child and the other half placed after the child." }, { "name": "end", "description": "For normal direction boxes, the bottom edge of each child is placed along the bottom of the box. Extra space is placed above the element. For reverse direction boxes, the top edge of each child is placed along the top of the box. Extra space is placed below the element." }, { "name": "start", "description": "For normal direction boxes, the top edge of each child is placed along the top of the box. Extra space is placed below the element. For reverse direction boxes, the bottom edge of each child is placed along the bottom of the box. Extra space is placed above the element." }, { "name": "stretch", "description": "The height of each child is adjusted to that of the containing block." } ], "relevance": 50, "description": "Specifies how a XUL box aligns its contents across (perpendicular to) the direction of its layout. The effect of this is only visible if there is extra space in the box.", "restrictions": [ "enum" ] }, { "name": "-moz-box-direction", "browsers": [ "FF1" ], "values": [ { "name": "normal", "description": "A box with a computed value of horizontal for box-orient displays its children from left to right. A box with a computed value of vertical displays its children from top to bottom." }, { "name": "reverse", "description": "A box with a computed value of horizontal for box-orient displays its children from right to left. A box with a computed value of vertical displays its children from bottom to top." } ], "relevance": 50, "description": "Specifies whether a box lays out its contents normally (from the top or left edge), or in reverse (from the bottom or right edge).", "restrictions": [ "enum" ] }, { "name": "-moz-box-flex", "browsers": [ "FF1" ], "relevance": 50, "description": "Specifies how a box grows to fill the box that contains it, in the direction of the containing box's layout.", "restrictions": [ "number" ] }, { "name": "-moz-box-flexgroup", "browsers": [ "FF1" ], "relevance": 50, "description": "Flexible elements can be assigned to flex groups using the 'box-flex-group' property.", "restrictions": [ "integer" ] }, { "name": "-moz-box-ordinal-group", "browsers": [ "FF1" ], "relevance": 50, "description": "Indicates the ordinal group the element belongs to. Elements with a lower ordinal group are displayed before those with a higher ordinal group.", "restrictions": [ "integer" ] }, { "name": "-moz-box-orient", "browsers": [ "FF1" ], "values": [ { "name": "block-axis", "description": "Elements are oriented along the box's axis." }, { "name": "horizontal", "description": "The box displays its children from left to right in a horizontal line." }, { "name": "inline-axis", "description": "Elements are oriented vertically." }, { "name": "vertical", "description": "The box displays its children from stacked from top to bottom vertically." } ], "relevance": 50, "description": "In Mozilla applications, -moz-box-orient specifies whether a box lays out its contents horizontally or vertically.", "restrictions": [ "enum" ] }, { "name": "-moz-box-pack", "browsers": [ "FF1" ], "values": [ { "name": "center", "description": "The extra space is divided evenly, with half placed before the first child and the other half placed after the last child." }, { "name": "end", "description": "For normal direction boxes, the right edge of the last child is placed at the right side, with all extra space placed before the first child. For reverse direction boxes, the left edge of the first child is placed at the left side, with all extra space placed after the last child." }, { "name": "justify", "description": "The space is divided evenly in-between each child, with none of the extra space placed before the first child or after the last child. If there is only one child, treat the pack value as if it were start." }, { "name": "start", "description": "For normal direction boxes, the left edge of the first child is placed at the left side, with all extra space placed after the last child. For reverse direction boxes, the right edge of the last child is placed at the right side, with all extra space placed before the first child." } ], "relevance": 50, "description": "Specifies how a box packs its contents in the direction of its layout. The effect of this is only visible if there is extra space in the box.", "restrictions": [ "enum" ] }, { "name": "-moz-box-sizing", "browsers": [ "FF1" ], "values": [ { "name": "border-box", "description": "The specified width and height (and respective min/max properties) on this element determine the border box of the element." }, { "name": "content-box", "description": "Behavior of width and height as specified by CSS2.1. The specified width and height (and respective min/max properties) apply to the width and height respectively of the content box of the element." }, { "name": "padding-box", "description": "The specified width and height (and respective min/max properties) on this element determine the padding box of the element." } ], "relevance": 50, "description": "Box Model addition in CSS3.", "restrictions": [ "enum" ] }, { "name": "-moz-column-count", "browsers": [ "FF3.5" ], "values": [ { "name": "auto", "description": "Determines the number of columns by the 'column-width' property and the element width." } ], "relevance": 50, "description": "Describes the optimal number of columns into which the content of the element will be flowed.", "restrictions": [ "integer" ] }, { "name": "-moz-column-gap", "browsers": [ "FF3.5" ], "values": [ { "name": "normal", "description": "User agent specific and typically equivalent to 1em." } ], "relevance": 50, "description": "Sets the gap between columns. If there is a column rule between columns, it will appear in the middle of the gap.", "restrictions": [ "length" ] }, { "name": "-moz-column-rule", "browsers": [ "FF3.5" ], "relevance": 50, "description": "Shorthand for setting 'column-rule-width', 'column-rule-style', and 'column-rule-color' at the same place in the style sheet. Omitted values are set to their initial values.", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "-moz-column-rule-color", "browsers": [ "FF3.5" ], "relevance": 50, "description": "Sets the color of the column rule", "restrictions": [ "color" ] }, { "name": "-moz-column-rule-style", "browsers": [ "FF3.5" ], "relevance": 50, "description": "Sets the style of the rule between columns of an element.", "restrictions": [ "line-style" ] }, { "name": "-moz-column-rule-width", "browsers": [ "FF3.5" ], "relevance": 50, "description": "Sets the width of the rule between columns. Negative values are not allowed.", "restrictions": [ "length", "line-width" ] }, { "name": "-moz-columns", "browsers": [ "FF9" ], "values": [ { "name": "auto", "description": "The width depends on the values of other properties." } ], "relevance": 50, "description": "A shorthand property which sets both 'column-width' and 'column-count'.", "restrictions": [ "length", "integer" ] }, { "name": "-moz-column-width", "browsers": [ "FF3.5" ], "values": [ { "name": "auto", "description": "The width depends on the values of other properties." } ], "relevance": 50, "description": "This property describes the width of columns in multicol elements.", "restrictions": [ "length" ] }, { "name": "-moz-font-feature-settings", "browsers": [ "FF4" ], "values": [ { "name": "\"c2cs\"" }, { "name": "\"dlig\"" }, { "name": "\"kern\"" }, { "name": "\"liga\"" }, { "name": "\"lnum\"" }, { "name": "\"onum\"" }, { "name": "\"smcp\"" }, { "name": "\"swsh\"" }, { "name": "\"tnum\"" }, { "name": "normal", "description": "No change in glyph substitution or positioning occurs." }, { "name": "off", "browsers": [ "FF4" ] }, { "name": "on", "browsers": [ "FF4" ] } ], "relevance": 50, "description": "Provides low-level control over OpenType font features. It is intended as a way of providing access to font features that are not widely used but are needed for a particular use case.", "restrictions": [ "string", "integer" ] }, { "name": "-moz-hyphens", "browsers": [ "FF9" ], "values": [ { "name": "auto", "description": "Conditional hyphenation characters inside a word, if present, take priority over automatic resources when determining hyphenation points within the word." }, { "name": "manual", "description": "Words are only broken at line breaks where there are characters inside the word that suggest line break opportunities" }, { "name": "none", "description": "Words are not broken at line breaks, even if characters inside the word suggest line break points." } ], "relevance": 50, "description": "Controls whether hyphenation is allowed to create more break opportunities within a line of text.", "restrictions": [ "enum" ] }, { "name": "-moz-perspective", "browsers": [ "FF10" ], "values": [ { "name": "none", "description": "No perspective transform is applied." } ], "relevance": 50, "description": "Applies the same transform as the perspective(<number>) transform function, except that it applies only to the positioned or transformed children of the element, not to the transform on the element itself.", "restrictions": [ "length" ] }, { "name": "-moz-perspective-origin", "browsers": [ "FF10" ], "relevance": 50, "description": "Establishes the origin for the perspective property. It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element.", "restrictions": [ "position", "percentage", "length" ] }, { "name": "-moz-text-align-last", "browsers": [ "FF12" ], "values": [ { "name": "auto" }, { "name": "center", "description": "The inline contents are centered within the line box." }, { "name": "justify", "description": "The text is justified according to the method specified by the 'text-justify' property." }, { "name": "left", "description": "The inline contents are aligned to the left edge of the line box. In vertical text, 'left' aligns to the edge of the line box that would be the start edge for left-to-right text." }, { "name": "right", "description": "The inline contents are aligned to the right edge of the line box. In vertical text, 'right' aligns to the edge of the line box that would be the end edge for left-to-right text." } ], "relevance": 50, "description": "Describes how the last line of a block or a line right before a forced line break is aligned when 'text-align' is set to 'justify'.", "restrictions": [ "enum" ] }, { "name": "-moz-text-decoration-color", "browsers": [ "FF6" ], "relevance": 50, "description": "Specifies the color of text decoration (underlines overlines, and line-throughs) set on the element with text-decoration-line.", "restrictions": [ "color" ] }, { "name": "-moz-text-decoration-line", "browsers": [ "FF6" ], "values": [ { "name": "line-through", "description": "Each line of text has a line through the middle." }, { "name": "none", "description": "Neither produces nor inhibits text decoration." }, { "name": "overline", "description": "Each line of text has a line above it." }, { "name": "underline", "description": "Each line of text is underlined." } ], "relevance": 50, "description": "Specifies what line decorations, if any, are added to the element.", "restrictions": [ "enum" ] }, { "name": "-moz-text-decoration-style", "browsers": [ "FF6" ], "values": [ { "name": "dashed", "description": "Produces a dashed line style." }, { "name": "dotted", "description": "Produces a dotted line." }, { "name": "double", "description": "Produces a double line." }, { "name": "none", "description": "Produces no line." }, { "name": "solid", "description": "Produces a solid line." }, { "name": "wavy", "description": "Produces a wavy line." } ], "relevance": 50, "description": "Specifies the line style for underline, line-through and overline text decoration.", "restrictions": [ "enum" ] }, { "name": "-moz-text-size-adjust", "browsers": [ "FF" ], "values": [ { "name": "auto", "description": "Renderers must use the default size adjustment when displaying on a small device." }, { "name": "none", "description": "Renderers must not do size adjustment when displaying on a small device." } ], "relevance": 50, "description": "Specifies a size adjustment for displaying text content in mobile browsers.", "restrictions": [ "enum", "percentage" ] }, { "name": "-moz-transform", "browsers": [ "FF3.5" ], "values": [ { "name": "matrix()", "description": "Specifies a 2D transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix [a b c d e f]" }, { "name": "matrix3d()", "description": "Specifies a 3D transformation as a 4x4 homogeneous matrix of 16 values in column-major order." }, { "name": "none" }, { "name": "perspective", "description": "Specifies a perspective projection matrix." }, { "name": "rotate()", "description": "Specifies a 2D rotation by the angle specified in the parameter about the origin of the element, as defined by the transform-origin property." }, { "name": "rotate3d()", "description": "Specifies a clockwise 3D rotation by the angle specified in last parameter about the [x,y,z] direction vector described by the first 3 parameters." }, { "name": "rotateX('angle')", "description": "Specifies a clockwise rotation by the given angle about the X axis." }, { "name": "rotateY('angle')", "description": "Specifies a clockwise rotation by the given angle about the Y axis." }, { "name": "rotateZ('angle')", "description": "Specifies a clockwise rotation by the given angle about the Z axis." }, { "name": "scale()", "description": "Specifies a 2D scale operation by the [sx,sy] scaling vector described by the 2 parameters. If the second parameter is not provided, it is takes a value equal to the first." }, { "name": "scale3d()", "description": "Specifies a 3D scale operation by the [sx,sy,sz] scaling vector described by the 3 parameters." }, { "name": "scaleX()", "description": "Specifies a scale operation using the [sx,1] scaling vector, where sx is given as the parameter." }, { "name": "scaleY()", "description": "Specifies a scale operation using the [sy,1] scaling vector, where sy is given as the parameter." }, { "name": "scaleZ()", "description": "Specifies a scale operation using the [1,1,sz] scaling vector, where sz is given as the parameter." }, { "name": "skew()", "description": "Specifies a skew transformation along the X and Y axes. The first angle parameter specifies the skew on the X axis. The second angle parameter specifies the skew on the Y axis. If the second parameter is not given then a value of 0 is used for the Y angle (ie: no skew on the Y axis)." }, { "name": "skewX()", "description": "Specifies a skew transformation along the X axis by the given angle." }, { "name": "skewY()", "description": "Specifies a skew transformation along the Y axis by the given angle." }, { "name": "translate()", "description": "Specifies a 2D translation by the vector [tx, ty], where tx is the first translation-value parameter and ty is the optional second translation-value parameter." }, { "name": "translate3d()", "description": "Specifies a 3D translation by the vector [tx,ty,tz], with tx, ty and tz being the first, second and third translation-value parameters respectively." }, { "name": "translateX()", "description": "Specifies a translation by the given amount in the X direction." }, { "name": "translateY()", "description": "Specifies a translation by the given amount in the Y direction." }, { "name": "translateZ()", "description": "Specifies a translation by the given amount in the Z direction. Note that percentage values are not allowed in the translateZ translation-value, and if present are evaluated as 0." } ], "relevance": 50, "description": "A two-dimensional transformation is applied to an element through the 'transform' property. This property contains a list of transform functions similar to those allowed by SVG.", "restrictions": [ "enum" ] }, { "name": "-moz-transform-origin", "browsers": [ "FF3.5" ], "relevance": 50, "description": "Establishes the origin of transformation for an element.", "restrictions": [ "position", "length", "percentage" ] }, { "name": "-moz-transition", "browsers": [ "FF4" ], "values": [ { "name": "all", "description": "Every property that is able to undergo a transition will do so." }, { "name": "none", "description": "No property will transition." } ], "relevance": 50, "description": "Shorthand property combines four of the transition properties into a single property.", "restrictions": [ "time", "property", "timing-function", "enum" ] }, { "name": "-moz-transition-delay", "browsers": [ "FF4" ], "relevance": 50, "description": "Defines when the transition will start. It allows a transition to begin execution some period of time from when it is applied.", "restrictions": [ "time" ] }, { "name": "-moz-transition-duration", "browsers": [ "FF4" ], "relevance": 50, "description": "Specifies how long the transition from the old value to the new value should take.", "restrictions": [ "time" ] }, { "name": "-moz-transition-property", "browsers": [ "FF4" ], "values": [ { "name": "all", "description": "Every property that is able to undergo a transition will do so." }, { "name": "none", "description": "No property will transition." } ], "relevance": 50, "description": "Specifies the name of the CSS property to which the transition is applied.", "restrictions": [ "property" ] }, { "name": "-moz-transition-timing-function", "browsers": [ "FF4" ], "relevance": 50, "description": "Describes how the intermediate values used during a transition will be calculated.", "restrictions": [ "timing-function" ] }, { "name": "-moz-user-focus", "browsers": [ "FF1" ], "values": [ { "name": "ignore" }, { "name": "normal" } ], "status": "nonstandard", "syntax": "ignore | normal | select-after | select-before | select-menu | select-same | select-all | none", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-user-focus" } ], "description": "Used to indicate whether the element can have focus." }, { "name": "-moz-user-select", "browsers": [ "FF1.5" ], "values": [ { "name": "all" }, { "name": "element" }, { "name": "elements" }, { "name": "-moz-all" }, { "name": "-moz-none" }, { "name": "none" }, { "name": "text" }, { "name": "toggle" } ], "relevance": 50, "description": "Controls the appearance of selection.", "restrictions": [ "enum" ] }, { "name": "-ms-accelerator", "browsers": [ "E", "IE10" ], "values": [ { "name": "false", "description": "The element does not contain an accelerator key sequence." }, { "name": "true", "description": "The element contains an accelerator key sequence." } ], "status": "nonstandard", "syntax": "false | true", "relevance": 0, "description": "IE only. Has the ability to turn off its system underlines for accelerator keys until the ALT key is pressed", "restrictions": [ "enum" ] }, { "name": "-ms-behavior", "browsers": [ "IE8" ], "relevance": 50, "description": "IE only. Used to extend behaviors of the browser", "restrictions": [ "url" ] }, { "name": "-ms-block-progression", "browsers": [ "IE8" ], "values": [ { "name": "bt", "description": "Bottom-to-top block flow. Layout is horizontal." }, { "name": "lr", "description": "Left-to-right direction. The flow orientation is vertical." }, { "name": "rl", "description": "Right-to-left direction. The flow orientation is vertical." }, { "name": "tb", "description": "Top-to-bottom direction. The flow orientation is horizontal." } ], "status": "nonstandard", "syntax": "tb | rl | bt | lr", "relevance": 0, "description": "Sets the block-progression value and the flow orientation", "restrictions": [ "enum" ] }, { "name": "-ms-content-zoom-chaining", "browsers": [ "E", "IE10" ], "values": [ { "name": "chained", "description": "The nearest zoomable parent element begins zooming when the user hits a zoom limit during a manipulation. No bounce effect is shown." }, { "name": "none", "description": "A bounce effect is shown when the user hits a zoom limit during a manipulation." } ], "status": "nonstandard", "syntax": "none | chained", "relevance": 0, "description": "Specifies the zoom behavior that occurs when a user hits the zoom limit during a manipulation." }, { "name": "-ms-content-zooming", "browsers": [ "E", "IE10" ], "values": [ { "name": "none", "description": "The element is not zoomable." }, { "name": "zoom", "description": "The element is zoomable." } ], "status": "nonstandard", "syntax": "none | zoom", "relevance": 0, "description": "Specifies whether zooming is enabled.", "restrictions": [ "enum" ] }, { "name": "-ms-content-zoom-limit", "browsers": [ "E", "IE10" ], "status": "nonstandard", "syntax": "<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>", "relevance": 0, "description": "Shorthand property for the -ms-content-zoom-limit-min and -ms-content-zoom-limit-max properties.", "restrictions": [ "percentage" ] }, { "name": "-ms-content-zoom-limit-max", "browsers": [ "E", "IE10" ], "status": "nonstandard", "syntax": "<percentage>", "relevance": 0, "description": "Specifies the maximum zoom factor.", "restrictions": [ "percentage" ] }, { "name": "-ms-content-zoom-limit-min", "browsers": [ "E", "IE10" ], "status": "nonstandard", "syntax": "<percentage>", "relevance": 0, "description": "Specifies the minimum zoom factor.", "restrictions": [ "percentage" ] }, { "name": "-ms-content-zoom-snap", "browsers": [ "E", "IE10" ], "values": [ { "name": "mandatory", "description": "Indicates that the motion of the content after the contact is picked up is always adjusted so that it lands on a snap-point." }, { "name": "none", "description": "Indicates that zooming is unaffected by any defined snap-points." }, { "name": "proximity", "description": "Indicates that the motion of the content after the contact is picked up may be adjusted if the content would normally stop \"close enough\" to a snap-point." }, { "name": "snapInterval(100%, 100%)", "description": "Specifies where the snap-points will be placed." }, { "name": "snapList()", "description": "Specifies the position of individual snap-points as a comma-separated list of zoom factors." } ], "status": "nonstandard", "syntax": "<'-ms-content-zoom-snap-type'> || <'-ms-content-zoom-snap-points'>", "relevance": 0, "description": "Shorthand property for the -ms-content-zoom-snap-type and -ms-content-zoom-snap-points properties." }, { "name": "-ms-content-zoom-snap-points", "browsers": [ "E", "IE10" ], "values": [ { "name": "snapInterval(100%, 100%)", "description": "Specifies where the snap-points will be placed." }, { "name": "snapList()", "description": "Specifies the position of individual snap-points as a comma-separated list of zoom factors." } ], "status": "nonstandard", "syntax": "snapInterval( <percentage>, <percentage> ) | snapList( <percentage># )", "relevance": 0, "description": "Defines where zoom snap-points are located." }, { "name": "-ms-content-zoom-snap-type", "browsers": [ "E", "IE10" ], "values": [ { "name": "mandatory", "description": "Indicates that the motion of the content after the contact is picked up is always adjusted so that it lands on a snap-point." }, { "name": "none", "description": "Indicates that zooming is unaffected by any defined snap-points." }, { "name": "proximity", "description": "Indicates that the motion of the content after the contact is picked up may be adjusted if the content would normally stop \"close enough\" to a snap-point." } ], "status": "nonstandard", "syntax": "none | proximity | mandatory", "relevance": 0, "description": "Specifies how zooming is affected by defined snap-points.", "restrictions": [ "enum" ] }, { "name": "-ms-filter", "browsers": [ "IE8-9" ], "status": "nonstandard", "syntax": "<string>", "relevance": 0, "description": "IE only. Used to produce visual effects.", "restrictions": [ "string" ] }, { "name": "-ms-flex", "browsers": [ "IE10" ], "values": [ { "name": "auto", "description": "Retrieves the value of the main size property as the used 'flex-basis'." }, { "name": "none", "description": "Expands to '0 0 auto'." } ], "relevance": 50, "description": "specifies the parameters of a flexible length: the positive and negative flexibility, and the preferred size.", "restrictions": [ "length", "number", "percentage" ] }, { "name": "-ms-flex-align", "browsers": [ "IE10" ], "values": [ { "name": "baseline", "description": "If the flex item’s inline axis is the same as the cross axis, this value is identical to 'flex-start'. Otherwise, it participates in baseline alignment." }, { "name": "center", "description": "The flex item’s margin box is centered in the cross axis within the line." }, { "name": "end", "description": "The cross-end margin edge of the flex item is placed flush with the cross-end edge of the line." }, { "name": "start", "description": "The cross-start margin edge of the flexbox item is placed flush with the cross-start edge of the line." }, { "name": "stretch", "description": "If the cross size property of the flexbox item is anything other than 'auto', this value is identical to 'start'." } ], "relevance": 50, "description": "Aligns flex items along the cross axis of the current line of the flex container.", "restrictions": [ "enum" ] }, { "name": "-ms-flex-direction", "browsers": [ "IE10" ], "values": [ { "name": "column", "description": "The flex container’s main axis has the same orientation as the block axis of the current writing mode." }, { "name": "column-reverse", "description": "Same as 'column', except the main-start and main-end directions are swapped." }, { "name": "row", "description": "The flex container’s main axis has the same orientation as the inline axis of the current writing mode." }, { "name": "row-reverse", "description": "Same as 'row', except the main-start and main-end directions are swapped." } ], "relevance": 50, "description": "Specifies how flex items are placed in the flex container, by setting the direction of the flex container’s main axis.", "restrictions": [ "enum" ] }, { "name": "-ms-flex-flow", "browsers": [ "IE10" ], "values": [ { "name": "column", "description": "The flex container’s main axis has the same orientation as the block axis of the current writing mode." }, { "name": "column-reverse", "description": "Same as 'column', except the main-start and main-end directions are swapped." }, { "name": "nowrap", "description": "The flex container is single-line." }, { "name": "row", "description": "The flex container’s main axis has the same orientation as the inline axis of the current writing mode." }, { "name": "wrap", "description": "The flexbox is multi-line." }, { "name": "wrap-reverse", "description": "Same as 'wrap', except the cross-start and cross-end directions are swapped." } ], "relevance": 50, "description": "Specifies how flexbox items are placed in the flexbox.", "restrictions": [ "enum" ] }, { "name": "-ms-flex-item-align", "browsers": [ "IE10" ], "values": [ { "name": "auto", "description": "Computes to the value of 'align-items' on the element’s parent, or 'stretch' if the element has no parent. On absolutely positioned elements, it computes to itself." }, { "name": "baseline", "description": "If the flex item’s inline axis is the same as the cross axis, this value is identical to 'flex-start'. Otherwise, it participates in baseline alignment." }, { "name": "center", "description": "The flex item’s margin box is centered in the cross axis within the line." }, { "name": "end", "description": "The cross-end margin edge of the flex item is placed flush with the cross-end edge of the line." }, { "name": "start", "description": "The cross-start margin edge of the flex item is placed flush with the cross-start edge of the line." }, { "name": "stretch", "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." } ], "relevance": 50, "description": "Allows the default alignment along the cross axis to be overridden for individual flex items.", "restrictions": [ "enum" ] }, { "name": "-ms-flex-line-pack", "browsers": [ "IE10" ], "values": [ { "name": "center", "description": "Lines are packed toward the center of the flex container." }, { "name": "distribute", "description": "Lines are evenly distributed in the flex container, with half-size spaces on either end." }, { "name": "end", "description": "Lines are packed toward the end of the flex container." }, { "name": "justify", "description": "Lines are evenly distributed in the flex container." }, { "name": "start", "description": "Lines are packed toward the start of the flex container." }, { "name": "stretch", "description": "Lines stretch to take up the remaining space." } ], "relevance": 50, "description": "Aligns a flex container’s lines within the flex container when there is extra space in the cross-axis, similar to how 'justify-content' aligns individual items within the main-axis.", "restrictions": [ "enum" ] }, { "name": "-ms-flex-order", "browsers": [ "IE10" ], "relevance": 50, "description": "Controls the order in which children of a flex container appear within the flex container, by assigning them to ordinal groups.", "restrictions": [ "integer" ] }, { "name": "-ms-flex-pack", "browsers": [ "IE10" ], "values": [ { "name": "center", "description": "Flex items are packed toward the center of the line." }, { "name": "distribute", "description": "Flex items are evenly distributed in the line, with half-size spaces on either end." }, { "name": "end", "description": "Flex items are packed toward the end of the line." }, { "name": "justify", "description": "Flex items are evenly distributed in the line." }, { "name": "start", "description": "Flex items are packed toward the start of the line." } ], "relevance": 50, "description": "Aligns flex items along the main axis of the current line of the flex container.", "restrictions": [ "enum" ] }, { "name": "-ms-flex-wrap", "browsers": [ "IE10" ], "values": [ { "name": "nowrap", "description": "The flex container is single-line." }, { "name": "wrap", "description": "The flexbox is multi-line." }, { "name": "wrap-reverse", "description": "Same as 'wrap', except the cross-start and cross-end directions are swapped." } ], "relevance": 50, "description": "Controls whether the flex container is single-line or multi-line, and the direction of the cross-axis, which determines the direction new lines are stacked in.", "restrictions": [ "enum" ] }, { "name": "-ms-flow-from", "browsers": [ "E", "IE10" ], "values": [ { "name": "none", "description": "The block container is not a CSS Region." } ], "status": "nonstandard", "syntax": "[ none | <custom-ident> ]#", "relevance": 0, "description": "Makes a block container a region and associates it with a named flow.", "restrictions": [ "identifier" ] }, { "name": "-ms-flow-into", "browsers": [ "E", "IE10" ], "values": [ { "name": "none", "description": "The element is not moved to a named flow and normal CSS processing takes place." } ], "status": "nonstandard", "syntax": "[ none | <custom-ident> ]#", "relevance": 0, "description": "Places an element or its contents into a named flow.", "restrictions": [ "identifier" ] }, { "name": "-ms-grid-column", "browsers": [ "E12", "IE10" ], "values": [ { "name": "auto" }, { "name": "end" }, { "name": "start" } ], "relevance": 50, "description": "Used to place grid items and explicitly defined grid cells in the Grid.", "restrictions": [ "integer", "string", "enum" ] }, { "name": "-ms-grid-column-align", "browsers": [ "E12", "IE10" ], "values": [ { "name": "center", "description": "Places the center of the Grid Item's margin box at the center of the Grid Item's column." }, { "name": "end", "description": "Aligns the end edge of the Grid Item's margin box to the end edge of the Grid Item's column." }, { "name": "start", "description": "Aligns the starting edge of the Grid Item's margin box to the starting edge of the Grid Item's column." }, { "name": "stretch", "description": "Ensures that the Grid Item's margin box is equal to the size of the Grid Item's column." } ], "relevance": 50, "description": "Aligns the columns in a grid.", "restrictions": [ "enum" ] }, { "name": "-ms-grid-columns", "browsers": [ "E", "IE10" ], "status": "nonstandard", "syntax": "none | <track-list> | <auto-track-list>", "relevance": 0, "description": "Lays out the columns of the grid." }, { "name": "-ms-grid-column-span", "browsers": [ "E12", "IE10" ], "relevance": 50, "description": "Specifies the number of columns to span.", "restrictions": [ "integer" ] }, { "name": "-ms-grid-layer", "browsers": [ "E", "IE10" ], "relevance": 50, "description": "Grid-layer is similar in concept to z-index, but avoids overloading the meaning of the z-index property, which is applicable only to positioned elements.", "restrictions": [ "integer" ] }, { "name": "-ms-grid-row", "browsers": [ "E12", "IE10" ], "values": [ { "name": "auto" }, { "name": "end" }, { "name": "start" } ], "relevance": 50, "description": "grid-row is used to place grid items and explicitly defined grid cells in the Grid.", "restrictions": [ "integer", "string", "enum" ] }, { "name": "-ms-grid-row-align", "browsers": [ "E12", "IE10" ], "values": [ { "name": "center", "description": "Places the center of the Grid Item's margin box at the center of the Grid Item's row." }, { "name": "end", "description": "Aligns the end edge of the Grid Item's margin box to the end edge of the Grid Item's row." }, { "name": "start", "description": "Aligns the starting edge of the Grid Item's margin box to the starting edge of the Grid Item's row." }, { "name": "stretch", "description": "Ensures that the Grid Item's margin box is equal to the size of the Grid Item's row." } ], "relevance": 50, "description": "Aligns the rows in a grid.", "restrictions": [ "enum" ] }, { "name": "-ms-grid-rows", "browsers": [ "E", "IE10" ], "status": "nonstandard", "syntax": "none | <track-list> | <auto-track-list>", "relevance": 0, "description": "Lays out the columns of the grid." }, { "name": "-ms-grid-row-span", "browsers": [ "E12", "IE10" ], "relevance": 50, "description": "Specifies the number of rows to span.", "restrictions": [ "integer" ] }, { "name": "-ms-high-contrast-adjust", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto", "description": "Properties will be adjusted as applicable." }, { "name": "none", "description": "No adjustments will be applied." } ], "status": "nonstandard", "syntax": "auto | none", "relevance": 0, "description": "Specifies if properties should be adjusted in high contrast mode.", "restrictions": [ "enum" ] }, { "name": "-ms-hyphenate-limit-chars", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto", "description": "The user agent chooses a value that adapts to the current layout." } ], "status": "nonstandard", "syntax": "auto | <integer>{1,3}", "relevance": 0, "description": "Specifies the minimum number of characters in a hyphenated word.", "restrictions": [ "integer" ] }, { "name": "-ms-hyphenate-limit-lines", "browsers": [ "E", "IE10" ], "values": [ { "name": "no-limit", "description": "There is no limit." } ], "status": "nonstandard", "syntax": "no-limit | <integer>", "relevance": 0, "description": "Indicates the maximum number of successive hyphenated lines in an element.", "restrictions": [ "integer" ] }, { "name": "-ms-hyphenate-limit-zone", "browsers": [ "E", "IE10" ], "status": "nonstandard", "syntax": "<percentage> | <length>", "relevance": 0, "description": "Specifies the maximum amount of unfilled space (before justification) that may be left in the line box before hyphenation is triggered to pull part of a word from the next line back up into the current line.", "restrictions": [ "percentage", "length" ] }, { "name": "-ms-hyphens", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto", "description": "Conditional hyphenation characters inside a word, if present, take priority over automatic resources when determining hyphenation points within the word." }, { "name": "manual", "description": "Words are only broken at line breaks where there are characters inside the word that suggest line break opportunities" }, { "name": "none", "description": "Words are not broken at line breaks, even if characters inside the word suggest line break points." } ], "relevance": 50, "description": "Controls whether hyphenation is allowed to create more break opportunities within a line of text.", "restrictions": [ "enum" ] }, { "name": "-ms-ime-mode", "browsers": [ "IE10" ], "values": [ { "name": "active", "description": "The input method editor is initially active; text entry is performed using it unless the user specifically dismisses it." }, { "name": "auto", "description": "No change is made to the current input method editor state. This is the default." }, { "name": "disabled", "description": "The input method editor is disabled and may not be activated by the user." }, { "name": "inactive", "description": "The input method editor is initially inactive, but the user may activate it if they wish." }, { "name": "normal", "description": "The IME state should be normal; this value can be used in a user style sheet to override the page setting." } ], "relevance": 50, "description": "Controls the state of the input method editor for text fields.", "restrictions": [ "enum" ] }, { "name": "-ms-interpolation-mode", "browsers": [ "IE7" ], "values": [ { "name": "bicubic" }, { "name": "nearest-neighbor" } ], "relevance": 50, "description": "Gets or sets the interpolation (resampling) method used to stretch images.", "restrictions": [ "enum" ] }, { "name": "-ms-layout-grid", "browsers": [ "E", "IE10" ], "values": [ { "name": "char", "description": "Any of the range of character values available to the -ms-layout-grid-char property." }, { "name": "line", "description": "Any of the range of line values available to the -ms-layout-grid-line property." }, { "name": "mode", "description": "Any of the range of mode values available to the -ms-layout-grid-mode property." }, { "name": "type", "description": "Any of the range of type values available to the -ms-layout-grid-type property." } ], "relevance": 50, "description": "Sets or retrieves the composite document grid properties that specify the layout of text characters." }, { "name": "-ms-layout-grid-char", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto", "description": "Largest character in the font of the element is used to set the character grid." }, { "name": "none", "description": "Default. No character grid is set." } ], "relevance": 50, "description": "Sets or retrieves the size of the character grid used for rendering the text content of an element.", "restrictions": [ "enum", "length", "percentage" ] }, { "name": "-ms-layout-grid-line", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto", "description": "Largest character in the font of the element is used to set the character grid." }, { "name": "none", "description": "Default. No grid line is set." } ], "relevance": 50, "description": "Sets or retrieves the gridline value used for rendering the text content of an element.", "restrictions": [ "length" ] }, { "name": "-ms-layout-grid-mode", "browsers": [ "E", "IE10" ], "values": [ { "name": "both", "description": "Default. Both the char and line grid modes are enabled. This setting is necessary to fully enable the layout grid on an element." }, { "name": "char", "description": "Only a character grid is used. This is recommended for use with block-level elements, such as a blockquote, where the line grid is intended to be disabled." }, { "name": "line", "description": "Only a line grid is used. This is recommended for use with inline elements, such as a span, to disable the horizontal grid on runs of text that act as a single entity in the grid layout." }, { "name": "none", "description": "No grid is used." } ], "relevance": 50, "description": "Gets or sets whether the text layout grid uses two dimensions.", "restrictions": [ "enum" ] }, { "name": "-ms-layout-grid-type", "browsers": [ "E", "IE10" ], "values": [ { "name": "fixed", "description": "Grid used for monospaced layout. All noncursive characters are treated as equal; every character is centered within a single grid space by default." }, { "name": "loose", "description": "Default. Grid used for Japanese and Korean characters." }, { "name": "strict", "description": "Grid used for Chinese, as well as Japanese (Genko) and Korean characters. Only the ideographs, kanas, and wide characters are snapped to the grid." } ], "relevance": 50, "description": "Sets or retrieves the type of grid used for rendering the text content of an element.", "restrictions": [ "enum" ] }, { "name": "-ms-line-break", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto", "description": "The UA determines the set of line-breaking restrictions to use for CJK scripts, and it may vary the restrictions based on the length of the line; e.g., use a less restrictive set of line-break rules for short lines." }, { "name": "keep-all", "description": "Sequences of CJK characters can no longer break on implied break points. This option should only be used where the presence of word separator characters still creates line-breaking opportunities, as in Korean." }, { "name": "newspaper", "description": "Breaks CJK scripts using the least restrictive set of line-breaking rules. Typically used for short lines, such as in newspapers." }, { "name": "normal", "description": "Breaks CJK scripts using a normal set of line-breaking rules." }, { "name": "strict", "description": "Breaks CJK scripts using a more restrictive set of line-breaking rules than 'normal'." } ], "relevance": 50, "description": "Specifies what set of line breaking restrictions are in effect within the element.", "restrictions": [ "enum" ] }, { "name": "-ms-overflow-style", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto", "description": "No preference, UA should use the first scrolling method in the list that it supports." }, { "name": "-ms-autohiding-scrollbar", "description": "Indicates the element displays auto-hiding scrollbars during mouse interactions and panning indicators during touch and keyboard interactions." }, { "name": "none", "description": "Indicates the element does not display scrollbars or panning indicators, even when its content overflows." }, { "name": "scrollbar", "description": "Scrollbars are typically narrow strips inserted on one or two edges of an element and which often have arrows to click on and a \"thumb\" to drag up and down (or left and right) to move the contents of the element." } ], "status": "nonstandard", "syntax": "auto | none | scrollbar | -ms-autohiding-scrollbar", "relevance": 0, "description": "Specify whether content is clipped when it overflows the element's content area.", "restrictions": [ "enum" ] }, { "name": "-ms-perspective", "browsers": [ "IE10" ], "values": [ { "name": "none", "description": "No perspective transform is applied." } ], "relevance": 50, "description": "Applies the same transform as the perspective(<number>) transform function, except that it applies only to the positioned or transformed children of the element, not to the transform on the element itself.", "restrictions": [ "length" ] }, { "name": "-ms-perspective-origin", "browsers": [ "IE10" ], "relevance": 50, "description": "Establishes the origin for the perspective property. It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element.", "restrictions": [ "position", "percentage", "length" ] }, { "name": "-ms-perspective-origin-x", "browsers": [ "IE10" ], "relevance": 50, "description": "Establishes the origin for the perspective property. It effectively sets the X position at which the viewer appears to be looking at the children of the element.", "restrictions": [ "position", "percentage", "length" ] }, { "name": "-ms-perspective-origin-y", "browsers": [ "IE10" ], "relevance": 50, "description": "Establishes the origin for the perspective property. It effectively sets the Y position at which the viewer appears to be looking at the children of the element.", "restrictions": [ "position", "percentage", "length" ] }, { "name": "-ms-progress-appearance", "browsers": [ "IE10" ], "values": [ { "name": "bar" }, { "name": "ring" } ], "relevance": 50, "description": "Gets or sets a value that specifies whether a progress control displays as a bar or a ring.", "restrictions": [ "enum" ] }, { "name": "-ms-scrollbar-3dlight-color", "browsers": [ "IE8" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "description": "Determines the color of the top and left edges of the scroll box and scroll arrows of a scroll bar.", "restrictions": [ "color" ] }, { "name": "-ms-scrollbar-arrow-color", "browsers": [ "IE8" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "description": "Determines the color of the arrow elements of a scroll arrow.", "restrictions": [ "color" ] }, { "name": "-ms-scrollbar-base-color", "browsers": [ "IE8" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "description": "Determines the color of the main elements of a scroll bar, which include the scroll box, track, and scroll arrows.", "restrictions": [ "color" ] }, { "name": "-ms-scrollbar-darkshadow-color", "browsers": [ "IE8" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "description": "Determines the color of the gutter of a scroll bar.", "restrictions": [ "color" ] }, { "name": "-ms-scrollbar-face-color", "browsers": [ "IE8" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "description": "Determines the color of the scroll box and scroll arrows of a scroll bar.", "restrictions": [ "color" ] }, { "name": "-ms-scrollbar-highlight-color", "browsers": [ "IE8" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "description": "Determines the color of the top and left edges of the scroll box and scroll arrows of a scroll bar.", "restrictions": [ "color" ] }, { "name": "-ms-scrollbar-shadow-color", "browsers": [ "IE8" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "description": "Determines the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar.", "restrictions": [ "color" ] }, { "name": "-ms-scrollbar-track-color", "browsers": [ "IE5" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-track-color" } ], "description": "Determines the color of the track element of a scroll bar.", "restrictions": [ "color" ] }, { "name": "-ms-scroll-chaining", "browsers": [ "E", "IE10" ], "values": [ { "name": "chained" }, { "name": "none" } ], "status": "nonstandard", "syntax": "chained | none", "relevance": 0, "description": "Gets or sets a value that indicates the scrolling behavior that occurs when a user hits the content boundary during a manipulation.", "restrictions": [ "enum", "length" ] }, { "name": "-ms-scroll-limit", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto" } ], "status": "nonstandard", "syntax": "<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>", "relevance": 0, "description": "Gets or sets a shorthand value that sets values for the -ms-scroll-limit-x-min, -ms-scroll-limit-y-min, -ms-scroll-limit-x-max, and -ms-scroll-limit-y-max properties.", "restrictions": [ "length" ] }, { "name": "-ms-scroll-limit-x-max", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto" } ], "status": "nonstandard", "syntax": "auto | <length>", "relevance": 0, "description": "Gets or sets a value that specifies the maximum value for the scrollLeft property.", "restrictions": [ "length" ] }, { "name": "-ms-scroll-limit-x-min", "browsers": [ "E", "IE10" ], "status": "nonstandard", "syntax": "<length>", "relevance": 0, "description": "Gets or sets a value that specifies the minimum value for the scrollLeft property.", "restrictions": [ "length" ] }, { "name": "-ms-scroll-limit-y-max", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto" } ], "status": "nonstandard", "syntax": "auto | <length>", "relevance": 0, "description": "Gets or sets a value that specifies the maximum value for the scrollTop property.", "restrictions": [ "length" ] }, { "name": "-ms-scroll-limit-y-min", "browsers": [ "E", "IE10" ], "status": "nonstandard", "syntax": "<length>", "relevance": 0, "description": "Gets or sets a value that specifies the minimum value for the scrollTop property.", "restrictions": [ "length" ] }, { "name": "-ms-scroll-rails", "browsers": [ "E", "IE10" ], "values": [ { "name": "none" }, { "name": "railed" } ], "status": "nonstandard", "syntax": "none | railed", "relevance": 0, "description": "Gets or sets a value that indicates whether or not small motions perpendicular to the primary axis of motion will result in either changes to both the scrollTop and scrollLeft properties or a change to the primary axis (for instance, either the scrollTop or scrollLeft properties will change, but not both).", "restrictions": [ "enum", "length" ] }, { "name": "-ms-scroll-snap-points-x", "browsers": [ "E", "IE10" ], "values": [ { "name": "snapInterval(100%, 100%)" }, { "name": "snapList()" } ], "status": "nonstandard", "syntax": "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )", "relevance": 0, "description": "Gets or sets a value that defines where snap-points will be located along the x-axis.", "restrictions": [ "enum" ] }, { "name": "-ms-scroll-snap-points-y", "browsers": [ "E", "IE10" ], "values": [ { "name": "snapInterval(100%, 100%)" }, { "name": "snapList()" } ], "status": "nonstandard", "syntax": "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )", "relevance": 0, "description": "Gets or sets a value that defines where snap-points will be located along the y-axis.", "restrictions": [ "enum" ] }, { "name": "-ms-scroll-snap-type", "browsers": [ "E", "IE10" ], "values": [ { "name": "none", "description": "The visual viewport of this scroll container must ignore snap points, if any, when scrolled." }, { "name": "mandatory", "description": "The visual viewport of this scroll container is guaranteed to rest on a snap point when there are no active scrolling operations." }, { "name": "proximity", "description": "The visual viewport of this scroll container may come to rest on a snap point at the termination of a scroll at the discretion of the UA given the parameters of the scroll." } ], "status": "nonstandard", "syntax": "none | proximity | mandatory", "relevance": 0, "description": "Gets or sets a value that defines what type of snap-point should be used for the current element. There are two type of snap-points, with the primary difference being whether or not the user is guaranteed to always stop on a snap-point.", "restrictions": [ "enum" ] }, { "name": "-ms-scroll-snap-x", "browsers": [ "E", "IE10" ], "values": [ { "name": "mandatory" }, { "name": "none" }, { "name": "proximity" }, { "name": "snapInterval(100%, 100%)" }, { "name": "snapList()" } ], "status": "nonstandard", "syntax": "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>", "relevance": 0, "description": "Gets or sets a shorthand value that sets values for the -ms-scroll-snap-type and -ms-scroll-snap-points-x properties.", "restrictions": [ "enum" ] }, { "name": "-ms-scroll-snap-y", "browsers": [ "E", "IE10" ], "values": [ { "name": "mandatory" }, { "name": "none" }, { "name": "proximity" }, { "name": "snapInterval(100%, 100%)" }, { "name": "snapList()" } ], "status": "nonstandard", "syntax": "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>", "relevance": 0, "description": "Gets or sets a shorthand value that sets values for the -ms-scroll-snap-type and -ms-scroll-snap-points-y properties.", "restrictions": [ "enum" ] }, { "name": "-ms-scroll-translation", "browsers": [ "E", "IE10" ], "values": [ { "name": "none" }, { "name": "vertical-to-horizontal" } ], "status": "nonstandard", "syntax": "none | vertical-to-horizontal", "relevance": 0, "description": "Gets or sets a value that specifies whether vertical-to-horizontal scroll wheel translation occurs on the specified element.", "restrictions": [ "enum" ] }, { "name": "-ms-text-align-last", "browsers": [ "E", "IE8" ], "values": [ { "name": "auto" }, { "name": "center", "description": "The inline contents are centered within the line box." }, { "name": "justify", "description": "The text is justified according to the method specified by the 'text-justify' property." }, { "name": "left", "description": "The inline contents are aligned to the left edge of the line box. In vertical text, 'left' aligns to the edge of the line box that would be the start edge for left-to-right text." }, { "name": "right", "description": "The inline contents are aligned to the right edge of the line box. In vertical text, 'right' aligns to the edge of the line box that would be the end edge for left-to-right text." } ], "relevance": 50, "description": "Describes how the last line of a block or a line right before a forced line break is aligned when 'text-align' is set to 'justify'.", "restrictions": [ "enum" ] }, { "name": "-ms-text-autospace", "browsers": [ "E", "IE8" ], "values": [ { "name": "ideograph-alpha", "description": "Creates 1/4em extra spacing between runs of ideographic letters and non-ideographic letters, such as Latin-based, Cyrillic, Greek, Arabic or Hebrew." }, { "name": "ideograph-numeric", "description": "Creates 1/4em extra spacing between runs of ideographic letters and numeric glyphs." }, { "name": "ideograph-parenthesis", "description": "Creates extra spacing between normal (non wide) parenthesis and ideographs." }, { "name": "ideograph-space", "description": "Extends the width of the space character while surrounded by ideographs." }, { "name": "none", "description": "No extra space is created." }, { "name": "punctuation", "description": "Creates extra non-breaking spacing around punctuation as required by language-specific typographic conventions." } ], "status": "nonstandard", "syntax": "none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space", "relevance": 0, "description": "Determines whether or not a full-width punctuation mark character should be trimmed if it appears at the beginning of a line, so that its 'ink' lines up with the first glyph in the line above and below.", "restrictions": [ "enum" ] }, { "name": "-ms-text-combine-horizontal", "browsers": [ "E", "IE11" ], "values": [ { "name": "all", "description": "Attempt to typeset horizontally all consecutive characters within the box such that they take up the space of a single character within the vertical line box." }, { "name": "digits", "description": "Attempt to typeset horizontally each maximal sequence of consecutive ASCII digits (U+0030–U+0039) that has as many or fewer characters than the specified integer such that it takes up the space of a single character within the vertical line box." }, { "name": "none", "description": "No special processing." } ], "relevance": 50, "description": "This property specifies the combination of multiple characters into the space of a single character.", "restrictions": [ "enum", "integer" ] }, { "name": "-ms-text-justify", "browsers": [ "E", "IE8" ], "values": [ { "name": "auto", "description": "The UA determines the justification algorithm to follow, based on a balance between performance and adequate presentation quality." }, { "name": "distribute", "description": "Justification primarily changes spacing both at word separators and at grapheme cluster boundaries in all scripts except those in the connected and cursive groups. This value is sometimes used in e.g. Japanese, often with the 'text-align-last' property." }, { "name": "inter-cluster", "description": "Justification primarily changes spacing at word separators and at grapheme cluster boundaries in clustered scripts. This value is typically used for Southeast Asian scripts such as Thai." }, { "name": "inter-ideograph", "description": "Justification primarily changes spacing at word separators and at inter-graphemic boundaries in scripts that use no word spaces. This value is typically used for CJK languages." }, { "name": "inter-word", "description": "Justification primarily changes spacing at word separators. This value is typically used for languages that separate words using spaces, like English or (sometimes) Korean." }, { "name": "kashida", "description": "Justification primarily stretches Arabic and related scripts through the use of kashida or other calligraphic elongation." } ], "relevance": 50, "description": "Selects the justification algorithm used when 'text-align' is set to 'justify'. The property applies to block containers, but the UA may (but is not required to) also support it on inline elements.", "restrictions": [ "enum" ] }, { "name": "-ms-text-kashida-space", "browsers": [ "E", "IE10" ], "relevance": 50, "description": "Sets or retrieves the ratio of kashida expansion to white space expansion when justifying lines of text in the object.", "restrictions": [ "percentage" ] }, { "name": "-ms-text-overflow", "browsers": [ "IE10" ], "values": [ { "name": "clip", "description": "Clip inline content that overflows. Characters may be only partially rendered." }, { "name": "ellipsis", "description": "Render an ellipsis character (U+2026) to represent clipped inline content." } ], "relevance": 50, "description": "Text can overflow for example when it is prevented from wrapping", "restrictions": [ "enum" ] }, { "name": "-ms-text-size-adjust", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto", "description": "Renderers must use the default size adjustment when displaying on a small device." }, { "name": "none", "description": "Renderers must not do size adjustment when displaying on a small device." } ], "relevance": 50, "description": "Specifies a size adjustment for displaying text content in mobile browsers.", "restrictions": [ "enum", "percentage" ] }, { "name": "-ms-text-underline-position", "browsers": [ "E", "IE10" ], "values": [ { "name": "alphabetic", "description": "The underline is aligned with the alphabetic baseline. In this case the underline is likely to cross some descenders." }, { "name": "auto", "description": "The user agent may use any algorithm to determine the underline's position. In horizontal line layout, the underline should be aligned as for alphabetic. In vertical line layout, if the language is set to Japanese or Korean, the underline should be aligned as for over." }, { "name": "over", "description": "The underline is aligned with the 'top' (right in vertical writing) edge of the element's em-box. In this mode, an overline also switches sides." }, { "name": "under", "description": "The underline is aligned with the 'bottom' (left in vertical writing) edge of the element's em-box. In this case the underline usually does not cross the descenders. This is sometimes called 'accounting' underline." } ], "relevance": 50, "description": "Sets the position of an underline specified on the same element: it does not affect underlines specified by ancestor elements.This property is typically used in vertical writing contexts such as in Japanese documents where it often desired to have the underline appear 'over' (to the right of) the affected run of text", "restrictions": [ "enum" ] }, { "name": "-ms-touch-action", "browsers": [ "IE10" ], "values": [ { "name": "auto", "description": "The element is a passive element, with several exceptions." }, { "name": "double-tap-zoom", "description": "The element will zoom on double-tap." }, { "name": "manipulation", "description": "The element is a manipulation-causing element." }, { "name": "none", "description": "The element is a manipulation-blocking element." }, { "name": "pan-x", "description": "The element permits touch-driven panning on the horizontal axis. The touch pan is performed on the nearest ancestor with horizontally scrollable content." }, { "name": "pan-y", "description": "The element permits touch-driven panning on the vertical axis. The touch pan is performed on the nearest ancestor with vertically scrollable content." }, { "name": "pinch-zoom", "description": "The element permits pinch-zooming. The pinch-zoom is performed on the nearest ancestor with zoomable content." } ], "relevance": 50, "description": "Gets or sets a value that indicates whether and how a given region can be manipulated by the user.", "restrictions": [ "enum" ] }, { "name": "-ms-touch-select", "browsers": [ "E", "IE10" ], "values": [ { "name": "grippers", "description": "Grippers are always on." }, { "name": "none", "description": "Grippers are always off." } ], "status": "nonstandard", "syntax": "grippers | none", "relevance": 0, "description": "Gets or sets a value that toggles the 'gripper' visual elements that enable touch text selection.", "restrictions": [ "enum" ] }, { "name": "-ms-transform", "browsers": [ "IE9-9" ], "values": [ { "name": "matrix()", "description": "Specifies a 2D transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix [a b c d e f]" }, { "name": "matrix3d()", "description": "Specifies a 3D transformation as a 4x4 homogeneous matrix of 16 values in column-major order." }, { "name": "none" }, { "name": "rotate()", "description": "Specifies a 2D rotation by the angle specified in the parameter about the origin of the element, as defined by the transform-origin property." }, { "name": "rotate3d()", "description": "Specifies a clockwise 3D rotation by the angle specified in last parameter about the [x,y,z] direction vector described by the first 3 parameters." }, { "name": "rotateX('angle')", "description": "Specifies a clockwise rotation by the given angle about the X axis." }, { "name": "rotateY('angle')", "description": "Specifies a clockwise rotation by the given angle about the Y axis." }, { "name": "rotateZ('angle')", "description": "Specifies a clockwise rotation by the given angle about the Z axis." }, { "name": "scale()", "description": "Specifies a 2D scale operation by the [sx,sy] scaling vector described by the 2 parameters. If the second parameter is not provided, it is takes a value equal to the first." }, { "name": "scale3d()", "description": "Specifies a 3D scale operation by the [sx,sy,sz] scaling vector described by the 3 parameters." }, { "name": "scaleX()", "description": "Specifies a scale operation using the [sx,1] scaling vector, where sx is given as the parameter." }, { "name": "scaleY()", "description": "Specifies a scale operation using the [sy,1] scaling vector, where sy is given as the parameter." }, { "name": "scaleZ()", "description": "Specifies a scale operation using the [1,1,sz] scaling vector, where sz is given as the parameter." }, { "name": "skew()", "description": "Specifies a skew transformation along the X and Y axes. The first angle parameter specifies the skew on the X axis. The second angle parameter specifies the skew on the Y axis. If the second parameter is not given then a value of 0 is used for the Y angle (ie: no skew on the Y axis)." }, { "name": "skewX()", "description": "Specifies a skew transformation along the X axis by the given angle." }, { "name": "skewY()", "description": "Specifies a skew transformation along the Y axis by the given angle." }, { "name": "translate()", "description": "Specifies a 2D translation by the vector [tx, ty], where tx is the first translation-value parameter and ty is the optional second translation-value parameter." }, { "name": "translate3d()", "description": "Specifies a 3D translation by the vector [tx,ty,tz], with tx, ty and tz being the first, second and third translation-value parameters respectively." }, { "name": "translateX()", "description": "Specifies a translation by the given amount in the X direction." }, { "name": "translateY()", "description": "Specifies a translation by the given amount in the Y direction." }, { "name": "translateZ()", "description": "Specifies a translation by the given amount in the Z direction. Note that percentage values are not allowed in the translateZ translation-value, and if present are evaluated as 0." } ], "relevance": 50, "description": "A two-dimensional transformation is applied to an element through the 'transform' property. This property contains a list of transform functions similar to those allowed by SVG.", "restrictions": [ "enum" ] }, { "name": "-ms-transform-origin", "browsers": [ "IE9-9" ], "relevance": 50, "description": "Establishes the origin of transformation for an element.", "restrictions": [ "position", "length", "percentage" ] }, { "name": "-ms-transform-origin-x", "browsers": [ "IE10" ], "relevance": 50, "description": "The x coordinate of the origin for transforms applied to an element with respect to its border box.", "restrictions": [ "length", "percentage" ] }, { "name": "-ms-transform-origin-y", "browsers": [ "IE10" ], "relevance": 50, "description": "The y coordinate of the origin for transforms applied to an element with respect to its border box.", "restrictions": [ "length", "percentage" ] }, { "name": "-ms-transform-origin-z", "browsers": [ "IE10" ], "relevance": 50, "description": "The z coordinate of the origin for transforms applied to an element with respect to its border box.", "restrictions": [ "length", "percentage" ] }, { "name": "-ms-user-select", "browsers": [ "E", "IE10" ], "values": [ { "name": "element" }, { "name": "none" }, { "name": "text" } ], "status": "nonstandard", "syntax": "none | element | text", "relevance": 0, "description": "Controls the appearance of selection.", "restrictions": [ "enum" ] }, { "name": "-ms-word-break", "browsers": [ "IE8" ], "values": [ { "name": "break-all", "description": "Lines may break between any two grapheme clusters for non-CJK scripts." }, { "name": "keep-all", "description": "Block characters can no longer create implied break points." }, { "name": "normal", "description": "Breaks non-CJK scripts according to their own rules." } ], "relevance": 50, "description": "Specifies line break opportunities for non-CJK scripts.", "restrictions": [ "enum" ] }, { "name": "-ms-word-wrap", "browsers": [ "IE8" ], "values": [ { "name": "break-word", "description": "An unbreakable 'word' may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line." }, { "name": "normal", "description": "Lines may break only at allowed break points." } ], "relevance": 50, "description": "Specifies whether the UA may break within a word to prevent overflow when an otherwise-unbreakable string is too long to fit.", "restrictions": [ "enum" ] }, { "name": "-ms-wrap-flow", "browsers": [ "E", "IE10" ], "values": [ { "name": "auto", "description": "For floats an exclusion is created, for all other elements an exclusion is not created." }, { "name": "both", "description": "Inline flow content can flow on all sides of the exclusion." }, { "name": "clear", "description": "Inline flow content can only wrap on top and bottom of the exclusion and must leave the areas to the start and end edges of the exclusion box empty." }, { "name": "end", "description": "Inline flow content can wrap on the end side of the exclusion area but must leave the area to the start edge of the exclusion area empty." }, { "name": "maximum", "description": "Inline flow content can wrap on the side of the exclusion with the largest available space for the given line, and must leave the other side of the exclusion empty." }, { "name": "minimum", "description": "Inline flow content can flow around the edge of the exclusion with the smallest available space within the flow content’s containing block, and must leave the other edge of the exclusion empty." }, { "name": "start", "description": "Inline flow content can wrap on the start edge of the exclusion area but must leave the area to end edge of the exclusion area empty." } ], "status": "nonstandard", "syntax": "auto | both | start | end | maximum | clear", "relevance": 0, "description": "An element becomes an exclusion when its 'wrap-flow' property has a computed value other than 'auto'.", "restrictions": [ "enum" ] }, { "name": "-ms-wrap-margin", "browsers": [ "E", "IE10" ], "status": "nonstandard", "syntax": "<length>", "relevance": 0, "description": "Gets or sets a value that is used to offset the inner wrap shape from other shapes.", "restrictions": [ "length", "percentage" ] }, { "name": "-ms-wrap-through", "browsers": [ "E", "IE10" ], "values": [ { "name": "none", "description": "The exclusion element does not inherit its parent node's wrapping context. Its descendants are only subject to exclusion shapes defined inside the element." }, { "name": "wrap", "description": "The exclusion element inherits its parent node's wrapping context. Its descendant inline content wraps around exclusions defined outside the element." } ], "status": "nonstandard", "syntax": "wrap | none", "relevance": 0, "description": "Specifies if an element inherits its parent wrapping context. In other words if it is subject to the exclusions defined outside the element.", "restrictions": [ "enum" ] }, { "name": "-ms-writing-mode", "browsers": [ "IE8" ], "values": [ { "name": "bt-lr" }, { "name": "bt-rl" }, { "name": "lr-bt" }, { "name": "lr-tb" }, { "name": "rl-bt" }, { "name": "rl-tb" }, { "name": "tb-lr" }, { "name": "tb-rl" } ], "relevance": 50, "description": "Shorthand property for both 'direction' and 'block-progression'.", "restrictions": [ "enum" ] }, { "name": "-ms-zoom", "browsers": [ "IE8" ], "values": [ { "name": "normal" } ], "relevance": 50, "description": "Sets or retrieves the magnification scale of the object.", "restrictions": [ "enum", "integer", "number", "percentage" ] }, { "name": "-ms-zoom-animation", "browsers": [ "IE10" ], "values": [ { "name": "default" }, { "name": "none" } ], "relevance": 50, "description": "Gets or sets a value that indicates whether an animation is used when zooming.", "restrictions": [ "enum" ] }, { "name": "nav-down", "browsers": [ "O9.5" ], "values": [ { "name": "auto", "description": "The user agent automatically determines which element to navigate the focus to in response to directional navigational input." }, { "name": "current", "description": "Indicates that the user agent should target the frame that the element is in." }, { "name": "root", "description": "Indicates that the user agent should target the full window." } ], "relevance": 50, "description": "Provides an way to control directional focus navigation.", "restrictions": [ "enum", "identifier", "string" ] }, { "name": "nav-index", "browsers": [ "O9.5" ], "values": [ { "name": "auto", "description": "The element's sequential navigation order is assigned automatically by the user agent." } ], "relevance": 50, "description": "Provides an input-method-neutral way of specifying the sequential navigation order (also known as 'tabbing order').", "restrictions": [ "number" ] }, { "name": "nav-left", "browsers": [ "O9.5" ], "values": [ { "name": "auto", "description": "The user agent automatically determines which element to navigate the focus to in response to directional navigational input." }, { "name": "current", "description": "Indicates that the user agent should target the frame that the element is in." }, { "name": "root", "description": "Indicates that the user agent should target the full window." } ], "relevance": 50, "description": "Provides an way to control directional focus navigation.", "restrictions": [ "enum", "identifier", "string" ] }, { "name": "nav-right", "browsers": [ "O9.5" ], "values": [ { "name": "auto", "description": "The user agent automatically determines which element to navigate the focus to in response to directional navigational input." }, { "name": "current", "description": "Indicates that the user agent should target the frame that the element is in." }, { "name": "root", "description": "Indicates that the user agent should target the full window." } ], "relevance": 50, "description": "Provides an way to control directional focus navigation.", "restrictions": [ "enum", "identifier", "string" ] }, { "name": "nav-up", "browsers": [ "O9.5" ], "values": [ { "name": "auto", "description": "The user agent automatically determines which element to navigate the focus to in response to directional navigational input." }, { "name": "current", "description": "Indicates that the user agent should target the frame that the element is in." }, { "name": "root", "description": "Indicates that the user agent should target the full window." } ], "relevance": 50, "description": "Provides an way to control directional focus navigation.", "restrictions": [ "enum", "identifier", "string" ] }, { "name": "negative", "browsers": [ "FF33" ], "syntax": "<symbol> <symbol>?", "relevance": 50, "description": "@counter-style descriptor. Defines how to alter the representation when the counter value is negative.", "restrictions": [ "image", "identifier", "string" ] }, { "name": "-o-animation", "browsers": [ "O12" ], "values": [ { "name": "alternate", "description": "The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction." }, { "name": "alternate-reverse", "description": "The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction." }, { "name": "backwards", "description": "The beginning property value (as defined in the first @keyframes at-rule) is applied before the animation is displayed, during the period defined by 'animation-delay'." }, { "name": "both", "description": "Both forwards and backwards fill modes are applied." }, { "name": "forwards", "description": "The final property value (as defined in the last @keyframes at-rule) is maintained after the animation completes." }, { "name": "infinite", "description": "Causes the animation to repeat forever." }, { "name": "none", "description": "No animation is performed" }, { "name": "normal", "description": "Normal playback." }, { "name": "reverse", "description": "All iterations of the animation are played in the reverse direction from the way they were specified." } ], "relevance": 50, "description": "Shorthand property combines six of the animation properties into a single property.", "restrictions": [ "time", "enum", "timing-function", "identifier", "number" ] }, { "name": "-o-animation-delay", "browsers": [ "O12" ], "relevance": 50, "description": "Defines when the animation will start.", "restrictions": [ "time" ] }, { "name": "-o-animation-direction", "browsers": [ "O12" ], "values": [ { "name": "alternate", "description": "The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction." }, { "name": "alternate-reverse", "description": "The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction." }, { "name": "normal", "description": "Normal playback." }, { "name": "reverse", "description": "All iterations of the animation are played in the reverse direction from the way they were specified." } ], "relevance": 50, "description": "Defines whether or not the animation should play in reverse on alternate cycles.", "restrictions": [ "enum" ] }, { "name": "-o-animation-duration", "browsers": [ "O12" ], "relevance": 50, "description": "Defines the length of time that an animation takes to complete one cycle.", "restrictions": [ "time" ] }, { "name": "-o-animation-fill-mode", "browsers": [ "O12" ], "values": [ { "name": "backwards", "description": "The beginning property value (as defined in the first @keyframes at-rule) is applied before the animation is displayed, during the period defined by 'animation-delay'." }, { "name": "both", "description": "Both forwards and backwards fill modes are applied." }, { "name": "forwards", "description": "The final property value (as defined in the last @keyframes at-rule) is maintained after the animation completes." }, { "name": "none", "description": "There is no change to the property value between the time the animation is applied and the time the animation begins playing or after the animation completes." } ], "relevance": 50, "description": "Defines what values are applied by the animation outside the time it is executing.", "restrictions": [ "enum" ] }, { "name": "-o-animation-iteration-count", "browsers": [ "O12" ], "values": [ { "name": "infinite", "description": "Causes the animation to repeat forever." } ], "relevance": 50, "description": "Defines the number of times an animation cycle is played. The default value is one, meaning the animation will play from beginning to end once.", "restrictions": [ "number", "enum" ] }, { "name": "-o-animation-name", "browsers": [ "O12" ], "values": [ { "name": "none", "description": "No animation is performed" } ], "relevance": 50, "description": "Defines a list of animations that apply. Each name is used to select the keyframe at-rule that provides the property values for the animation.", "restrictions": [ "identifier", "enum" ] }, { "name": "-o-animation-play-state", "browsers": [ "O12" ], "values": [ { "name": "paused", "description": "A running animation will be paused." }, { "name": "running", "description": "Resume playback of a paused animation." } ], "relevance": 50, "description": "Defines whether the animation is running or paused.", "restrictions": [ "enum" ] }, { "name": "-o-animation-timing-function", "browsers": [ "O12" ], "relevance": 50, "description": "Describes how the animation will progress over one cycle of its duration. See the 'transition-timing-function'.", "restrictions": [ "timing-function" ] }, { "name": "object-fit", "browsers": [ "E79", "FF36", "S10", "C32", "O19" ], "values": [ { "name": "contain", "description": "The replaced content is sized to maintain its aspect ratio while fitting within the element’s content box: its concrete object size is resolved as a contain constraint against the element's used width and height." }, { "name": "cover", "description": "The replaced content is sized to maintain its aspect ratio while filling the element's entire content box: its concrete object size is resolved as a cover constraint against the element’s used width and height." }, { "name": "fill", "description": "The replaced content is sized to fill the element’s content box: the object's concrete object size is the element's used width and height." }, { "name": "none", "description": "The replaced content is not resized to fit inside the element's content box" }, { "name": "scale-down", "description": "Size the content as if ‘none’ or ‘contain’ were specified, whichever would result in a smaller concrete object size." } ], "syntax": "fill | contain | cover | none | scale-down", "relevance": 69, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/object-fit" } ], "description": "Specifies how the contents of a replaced element should be scaled relative to the box established by its used height and width.", "restrictions": [ "enum" ] }, { "name": "object-position", "browsers": [ "E79", "FF36", "S10", "C32", "O19" ], "syntax": "<position>", "relevance": 54, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/object-position" } ], "description": "Determines the alignment of the replaced element inside its box.", "restrictions": [ "position", "length", "percentage" ] }, { "name": "-o-border-image", "browsers": [ "O11.6" ], "values": [ { "name": "auto", "description": "If 'auto' is specified then the border image width is the intrinsic width or height (whichever is applicable) of the corresponding image slice. If the image does not have the required intrinsic dimension then the corresponding border-width is used instead." }, { "name": "fill", "description": "Causes the middle part of the border-image to be preserved." }, { "name": "none" }, { "name": "repeat", "description": "The image is tiled (repeated) to fill the area." }, { "name": "round", "description": "The image is tiled (repeated) to fill the area. If it does not fill the area with a whole number of tiles, the image is rescaled so that it does." }, { "name": "space", "description": "The image is tiled (repeated) to fill the area. If it does not fill the area with a whole number of tiles, the extra space is distributed around the tiles." }, { "name": "stretch", "description": "The image is stretched to fill the area." } ], "relevance": 50, "description": "Shorthand property for setting 'border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset' and 'border-image-repeat'. Omitted values are set to their initial values.", "restrictions": [ "length", "percentage", "number", "image", "enum" ] }, { "name": "-o-object-fit", "browsers": [ "O10.6" ], "values": [ { "name": "contain", "description": "The replaced content is sized to maintain its aspect ratio while fitting within the element’s content box: its concrete object size is resolved as a contain constraint against the element's used width and height." }, { "name": "cover", "description": "The replaced content is sized to maintain its aspect ratio while filling the element's entire content box: its concrete object size is resolved as a cover constraint against the element’s used width and height." }, { "name": "fill", "description": "The replaced content is sized to fill the element’s content box: the object's concrete object size is the element's used width and height." }, { "name": "none", "description": "The replaced content is not resized to fit inside the element's content box" }, { "name": "scale-down", "description": "Size the content as if ‘none’ or ‘contain’ were specified, whichever would result in a smaller concrete object size." } ], "relevance": 50, "description": "Specifies how the contents of a replaced element should be scaled relative to the box established by its used height and width.", "restrictions": [ "enum" ] }, { "name": "-o-object-position", "browsers": [ "O10.6" ], "relevance": 50, "description": "Determines the alignment of the replaced element inside its box.", "restrictions": [ "position", "length", "percentage" ] }, { "name": "opacity", "syntax": "<alpha-value>", "relevance": 94, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/opacity" } ], "description": "Opacity of an element's text, where 1 is opaque and 0 is entirely transparent.", "restrictions": [ "number(0-1)" ] }, { "name": "order", "syntax": "<integer>", "relevance": 64, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/order" } ], "description": "Controls the order in which children of a flex container appear within the flex container, by assigning them to ordinal groups.", "restrictions": [ "integer" ] }, { "name": "orphans", "browsers": [ "E12", "S1.3", "C25", "IE8", "O9.2" ], "syntax": "<integer>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/orphans" } ], "description": "Specifies the minimum number of line boxes in a block container that must be left in a fragment before a fragmentation break.", "restrictions": [ "integer" ] }, { "name": "-o-table-baseline", "browsers": [ "O9.6" ], "relevance": 50, "description": "Determines which row of a inline-table should be used as baseline of inline-table.", "restrictions": [ "integer" ] }, { "name": "-o-tab-size", "browsers": [ "O10.6" ], "relevance": 50, "description": "This property determines the width of the tab character (U+0009), in space characters (U+0020), when rendered.", "restrictions": [ "integer", "length" ] }, { "name": "-o-text-overflow", "browsers": [ "O10" ], "values": [ { "name": "clip", "description": "Clip inline content that overflows. Characters may be only partially rendered." }, { "name": "ellipsis", "description": "Render an ellipsis character (U+2026) to represent clipped inline content." } ], "relevance": 50, "description": "Text can overflow for example when it is prevented from wrapping", "restrictions": [ "enum" ] }, { "name": "-o-transform", "browsers": [ "O10.5" ], "values": [ { "name": "matrix()", "description": "Specifies a 2D transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix [a b c d e f]" }, { "name": "matrix3d()", "description": "Specifies a 3D transformation as a 4x4 homogeneous matrix of 16 values in column-major order." }, { "name": "none" }, { "name": "rotate()", "description": "Specifies a 2D rotation by the angle specified in the parameter about the origin of the element, as defined by the transform-origin property." }, { "name": "rotate3d()", "description": "Specifies a clockwise 3D rotation by the angle specified in last parameter about the [x,y,z] direction vector described by the first 3 parameters." }, { "name": "rotateX('angle')", "description": "Specifies a clockwise rotation by the given angle about the X axis." }, { "name": "rotateY('angle')", "description": "Specifies a clockwise rotation by the given angle about the Y axis." }, { "name": "rotateZ('angle')", "description": "Specifies a clockwise rotation by the given angle about the Z axis." }, { "name": "scale()", "description": "Specifies a 2D scale operation by the [sx,sy] scaling vector described by the 2 parameters. If the second parameter is not provided, it is takes a value equal to the first." }, { "name": "scale3d()", "description": "Specifies a 3D scale operation by the [sx,sy,sz] scaling vector described by the 3 parameters." }, { "name": "scaleX()", "description": "Specifies a scale operation using the [sx,1] scaling vector, where sx is given as the parameter." }, { "name": "scaleY()", "description": "Specifies a scale operation using the [sy,1] scaling vector, where sy is given as the parameter." }, { "name": "scaleZ()", "description": "Specifies a scale operation using the [1,1,sz] scaling vector, where sz is given as the parameter." }, { "name": "skew()", "description": "Specifies a skew transformation along the X and Y axes. The first angle parameter specifies the skew on the X axis. The second angle parameter specifies the skew on the Y axis. If the second parameter is not given then a value of 0 is used for the Y angle (ie: no skew on the Y axis)." }, { "name": "skewX()", "description": "Specifies a skew transformation along the X axis by the given angle." }, { "name": "skewY()", "description": "Specifies a skew transformation along the Y axis by the given angle." }, { "name": "translate()", "description": "Specifies a 2D translation by the vector [tx, ty], where tx is the first translation-value parameter and ty is the optional second translation-value parameter." }, { "name": "translate3d()", "description": "Specifies a 3D translation by the vector [tx,ty,tz], with tx, ty and tz being the first, second and third translation-value parameters respectively." }, { "name": "translateX()", "description": "Specifies a translation by the given amount in the X direction." }, { "name": "translateY()", "description": "Specifies a translation by the given amount in the Y direction." }, { "name": "translateZ()", "description": "Specifies a translation by the given amount in the Z direction. Note that percentage values are not allowed in the translateZ translation-value, and if present are evaluated as 0." } ], "relevance": 50, "description": "A two-dimensional transformation is applied to an element through the 'transform' property. This property contains a list of transform functions similar to those allowed by SVG.", "restrictions": [ "enum" ] }, { "name": "-o-transform-origin", "browsers": [ "O10.5" ], "relevance": 50, "description": "Establishes the origin of transformation for an element.", "restrictions": [ "positon", "length", "percentage" ] }, { "name": "-o-transition", "browsers": [ "O11.5" ], "values": [ { "name": "all", "description": "Every property that is able to undergo a transition will do so." }, { "name": "none", "description": "No property will transition." } ], "relevance": 50, "description": "Shorthand property combines four of the transition properties into a single property.", "restrictions": [ "time", "property", "timing-function", "enum" ] }, { "name": "-o-transition-delay", "browsers": [ "O11.5" ], "relevance": 50, "description": "Defines when the transition will start. It allows a transition to begin execution some period of time from when it is applied.", "restrictions": [ "time" ] }, { "name": "-o-transition-duration", "browsers": [ "O11.5" ], "relevance": 50, "description": "Specifies how long the transition from the old value to the new value should take.", "restrictions": [ "time" ] }, { "name": "-o-transition-property", "browsers": [ "O11.5" ], "values": [ { "name": "all", "description": "Every property that is able to undergo a transition will do so." }, { "name": "none", "description": "No property will transition." } ], "relevance": 50, "description": "Specifies the name of the CSS property to which the transition is applied.", "restrictions": [ "property" ] }, { "name": "-o-transition-timing-function", "browsers": [ "O11.5" ], "relevance": 50, "description": "Describes how the intermediate values used during a transition will be calculated.", "restrictions": [ "timing-function" ] }, { "name": "offset-block-end", "browsers": [ "FF41" ], "values": [ { "name": "auto", "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well." } ], "relevance": 50, "description": "Logical 'bottom'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "offset-block-start", "browsers": [ "FF41" ], "values": [ { "name": "auto", "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well." } ], "relevance": 50, "description": "Logical 'top'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "offset-inline-end", "browsers": [ "FF41" ], "values": [ { "name": "auto", "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well." } ], "relevance": 50, "description": "Logical 'right'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "offset-inline-start", "browsers": [ "FF41" ], "values": [ { "name": "auto", "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well." } ], "relevance": 50, "description": "Logical 'left'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "outline", "values": [ { "name": "auto", "description": "Permits the user agent to render a custom outline style, typically the default platform style." }, { "name": "invert", "description": "Performs a color inversion on the pixels on the screen." } ], "syntax": "[ <'outline-color'> || <'outline-style'> || <'outline-width'> ]", "relevance": 88, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/outline" } ], "description": "Shorthand property for 'outline-style', 'outline-width', and 'outline-color'.", "restrictions": [ "length", "line-width", "line-style", "color", "enum" ] }, { "name": "outline-color", "values": [ { "name": "invert", "description": "Performs a color inversion on the pixels on the screen." } ], "syntax": "<color> | invert", "relevance": 54, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/outline-color" } ], "description": "The color of the outline.", "restrictions": [ "enum", "color" ] }, { "name": "outline-offset", "browsers": [ "E15", "FF1.5", "S1.2", "C1", "O9.5" ], "syntax": "<length>", "relevance": 68, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/outline-offset" } ], "description": "Offset the outline and draw it beyond the border edge.", "restrictions": [ "length" ] }, { "name": "outline-style", "values": [ { "name": "auto", "description": "Permits the user agent to render a custom outline style, typically the default platform style." } ], "syntax": "auto | <'border-style'>", "relevance": 61, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/outline-style" } ], "description": "Style of the outline.", "restrictions": [ "line-style", "enum" ] }, { "name": "outline-width", "syntax": "<line-width>", "relevance": 61, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/outline-width" } ], "description": "Width of the outline.", "restrictions": [ "length", "line-width" ] }, { "name": "overflow", "values": [ { "name": "auto", "description": "The behavior of the 'auto' value is UA-dependent, but should cause a scrolling mechanism to be provided for overflowing boxes." }, { "name": "hidden", "description": "Content is clipped and no scrolling mechanism should be provided to view the content outside the clipping region." }, { "name": "-moz-hidden-unscrollable", "description": "Same as the standardized 'clip', except doesn’t establish a block formatting context." }, { "name": "scroll", "description": "Content is clipped and if the user agent uses a scrolling mechanism that is visible on the screen (such as a scroll bar or a panner), that mechanism should be displayed for a box whether or not any of its content is clipped." }, { "name": "visible", "description": "Content is not clipped, i.e., it may be rendered outside the content box." } ], "syntax": "[ visible | hidden | clip | scroll | auto ]{1,2}", "relevance": 93, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overflow" } ], "description": "Shorthand for setting 'overflow-x' and 'overflow-y'.", "restrictions": [ "enum" ] }, { "name": "overflow-wrap", "values": [ { "name": "break-word", "description": "An otherwise unbreakable sequence of characters may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line." }, { "name": "normal", "description": "Lines may break only at allowed break points." } ], "syntax": "normal | break-word | anywhere", "relevance": 64, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap" } ], "description": "Specifies whether the UA may break within a word to prevent overflow when an otherwise-unbreakable string is too long to fit within the line box.", "restrictions": [ "enum" ] }, { "name": "overflow-x", "values": [ { "name": "auto", "description": "The behavior of the 'auto' value is UA-dependent, but should cause a scrolling mechanism to be provided for overflowing boxes." }, { "name": "hidden", "description": "Content is clipped and no scrolling mechanism should be provided to view the content outside the clipping region." }, { "name": "scroll", "description": "Content is clipped and if the user agent uses a scrolling mechanism that is visible on the screen (such as a scroll bar or a panner), that mechanism should be displayed for a box whether or not any of its content is clipped." }, { "name": "visible", "description": "Content is not clipped, i.e., it may be rendered outside the content box." } ], "syntax": "visible | hidden | clip | scroll | auto", "relevance": 82, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overflow-x" } ], "description": "Specifies the handling of overflow in the horizontal direction.", "restrictions": [ "enum" ] }, { "name": "overflow-y", "values": [ { "name": "auto", "description": "The behavior of the 'auto' value is UA-dependent, but should cause a scrolling mechanism to be provided for overflowing boxes." }, { "name": "hidden", "description": "Content is clipped and no scrolling mechanism should be provided to view the content outside the clipping region." }, { "name": "scroll", "description": "Content is clipped and if the user agent uses a scrolling mechanism that is visible on the screen (such as a scroll bar or a panner), that mechanism should be displayed for a box whether or not any of its content is clipped." }, { "name": "visible", "description": "Content is not clipped, i.e., it may be rendered outside the content box." } ], "syntax": "visible | hidden | clip | scroll | auto", "relevance": 83, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overflow-y" } ], "description": "Specifies the handling of overflow in the vertical direction.", "restrictions": [ "enum" ] }, { "name": "pad", "browsers": [ "FF33" ], "syntax": "<integer> && <symbol>", "relevance": 50, "description": "@counter-style descriptor. Specifies a “fixed-width” counter style, where representations shorter than the pad value are padded with a particular <symbol>", "restrictions": [ "integer", "image", "string", "identifier" ] }, { "name": "padding", "values": [], "syntax": "[ <length> | <percentage> ]{1,4}", "relevance": 96, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding" } ], "description": "Shorthand property to set values for the thickness of the padding area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. The value may not be negative.", "restrictions": [ "length", "percentage" ] }, { "name": "padding-bottom", "syntax": "<length> | <percentage>", "relevance": 90, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding-bottom" } ], "description": "Shorthand property to set values for the thickness of the padding area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. The value may not be negative.", "restrictions": [ "length", "percentage" ] }, { "name": "padding-block-end", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'padding-left'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding-block-end" } ], "description": "Logical 'padding-bottom'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "padding-block-start", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'padding-left'>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding-block-start" } ], "description": "Logical 'padding-top'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "padding-inline-end", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'padding-left'>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding-inline-end" } ], "description": "Logical 'padding-right'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "padding-inline-start", "browsers": [ "E79", "FF41", "S12.1", "C69", "O56" ], "syntax": "<'padding-left'>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding-inline-start" } ], "description": "Logical 'padding-left'. Mapping depends on the parent element’s 'writing-mode', 'direction', and 'text-orientation'.", "restrictions": [ "length", "percentage" ] }, { "name": "padding-left", "syntax": "<length> | <percentage>", "relevance": 91, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding-left" } ], "description": "Shorthand property to set values for the thickness of the padding area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. The value may not be negative.", "restrictions": [ "length", "percentage" ] }, { "name": "padding-right", "syntax": "<length> | <percentage>", "relevance": 90, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding-right" } ], "description": "Shorthand property to set values for the thickness of the padding area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. The value may not be negative.", "restrictions": [ "length", "percentage" ] }, { "name": "padding-top", "syntax": "<length> | <percentage>", "relevance": 91, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding-top" } ], "description": "Shorthand property to set values for the thickness of the padding area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. The value may not be negative.", "restrictions": [ "length", "percentage" ] }, { "name": "page-break-after", "values": [ { "name": "always", "description": "Always force a page break after the generated box." }, { "name": "auto", "description": "Neither force nor forbid a page break after generated box." }, { "name": "avoid", "description": "Avoid a page break after the generated box." }, { "name": "left", "description": "Force one or two page breaks after the generated box so that the next page is formatted as a left page." }, { "name": "right", "description": "Force one or two page breaks after the generated box so that the next page is formatted as a right page." } ], "syntax": "auto | always | avoid | left | right | recto | verso", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/page-break-after" } ], "description": "Defines rules for page breaks after an element.", "restrictions": [ "enum" ] }, { "name": "page-break-before", "values": [ { "name": "always", "description": "Always force a page break before the generated box." }, { "name": "auto", "description": "Neither force nor forbid a page break before the generated box." }, { "name": "avoid", "description": "Avoid a page break before the generated box." }, { "name": "left", "description": "Force one or two page breaks before the generated box so that the next page is formatted as a left page." }, { "name": "right", "description": "Force one or two page breaks before the generated box so that the next page is formatted as a right page." } ], "syntax": "auto | always | avoid | left | right | recto | verso", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/page-break-before" } ], "description": "Defines rules for page breaks before an element.", "restrictions": [ "enum" ] }, { "name": "page-break-inside", "values": [ { "name": "auto", "description": "Neither force nor forbid a page break inside the generated box." }, { "name": "avoid", "description": "Avoid a page break inside the generated box." } ], "syntax": "auto | avoid", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/page-break-inside" } ], "description": "Defines rules for page breaks inside an element.", "restrictions": [ "enum" ] }, { "name": "paint-order", "browsers": [ "E17", "FF60", "S8", "C35", "O22" ], "values": [ { "name": "fill" }, { "name": "markers" }, { "name": "normal", "description": "The element is painted with the standard order of painting operations: the 'fill' is painted first, then its 'stroke' and finally its markers." }, { "name": "stroke" } ], "syntax": "normal | [ fill || stroke || markers ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/paint-order" } ], "description": "Controls the order that the three paint operations that shapes and text are rendered with: their fill, their stroke and any markers they might have.", "restrictions": [ "enum" ] }, { "name": "perspective", "values": [ { "name": "none", "description": "No perspective transform is applied." } ], "syntax": "none | <length>", "relevance": 55, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/perspective" } ], "description": "Applies the same transform as the perspective(<number>) transform function, except that it applies only to the positioned or transformed children of the element, not to the transform on the element itself.", "restrictions": [ "length", "enum" ] }, { "name": "perspective-origin", "syntax": "<position>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/perspective-origin" } ], "description": "Establishes the origin for the perspective property. It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element.", "restrictions": [ "position", "percentage", "length" ] }, { "name": "pointer-events", "values": [ { "name": "all", "description": "The given element can be the target element for pointer events whenever the pointer is over either the interior or the perimeter of the element." }, { "name": "fill", "description": "The given element can be the target element for pointer events whenever the pointer is over the interior of the element." }, { "name": "none", "description": "The given element does not receive pointer events." }, { "name": "painted", "description": "The given element can be the target element for pointer events when the pointer is over a \"painted\" area. " }, { "name": "stroke", "description": "The given element can be the target element for pointer events whenever the pointer is over the perimeter of the element." }, { "name": "visible", "description": "The given element can be the target element for pointer events when the ‘visibility’ property is set to visible and the pointer is over either the interior or the perimeter of the element." }, { "name": "visibleFill", "description": "The given element can be the target element for pointer events when the ‘visibility’ property is set to visible and when the pointer is over the interior of the element." }, { "name": "visiblePainted", "description": "The given element can be the target element for pointer events when the ‘visibility’ property is set to visible and when the pointer is over a ‘painted’ area." }, { "name": "visibleStroke", "description": "The given element can be the target element for pointer events when the ‘visibility’ property is set to visible and when the pointer is over the perimeter of the element." } ], "syntax": "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit", "relevance": 83, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/pointer-events" } ], "description": "Specifies under what circumstances a given element can be the target element for a pointer event.", "restrictions": [ "enum" ] }, { "name": "position", "values": [ { "name": "absolute", "description": "The box's position (and possibly size) is specified with the 'top', 'right', 'bottom', and 'left' properties. These properties specify offsets with respect to the box's 'containing block'." }, { "name": "fixed", "description": "The box's position is calculated according to the 'absolute' model, but in addition, the box is fixed with respect to some reference. As with the 'absolute' model, the box's margins do not collapse with any other margins." }, { "name": "-ms-page", "description": "The box's position is calculated according to the 'absolute' model." }, { "name": "relative", "description": "The box's position is calculated according to the normal flow (this is called the position in normal flow). Then the box is offset relative to its normal position." }, { "name": "static", "description": "The box is a normal box, laid out according to the normal flow. The 'top', 'right', 'bottom', and 'left' properties do not apply." }, { "name": "sticky", "description": "The box's position is calculated according to the normal flow. Then the box is offset relative to its flow root and containing block and in all cases, including table elements, does not affect the position of any following boxes." }, { "name": "-webkit-sticky", "description": "The box's position is calculated according to the normal flow. Then the box is offset relative to its flow root and containing block and in all cases, including table elements, does not affect the position of any following boxes." } ], "syntax": "static | relative | absolute | sticky | fixed", "relevance": 96, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/position" } ], "description": "The position CSS property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements.", "restrictions": [ "enum" ] }, { "name": "prefix", "browsers": [ "FF33" ], "syntax": "<symbol>", "relevance": 50, "description": "@counter-style descriptor. Specifies a <symbol> that is prepended to the marker representation.", "restrictions": [ "image", "string", "identifier" ] }, { "name": "quotes", "values": [ { "name": "none", "description": "The 'open-quote' and 'close-quote' values of the 'content' property produce no quotations marks, as if they were 'no-open-quote' and 'no-close-quote' respectively." } ], "syntax": "none | auto | [ <string> <string> ]+", "relevance": 54, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/quotes" } ], "description": "Specifies quotation marks for any number of embedded quotations.", "restrictions": [ "string" ] }, { "name": "range", "browsers": [ "FF33" ], "values": [ { "name": "auto", "description": "The range depends on the counter system." }, { "name": "infinite", "description": "If used as the first value in a range, it represents negative infinity; if used as the second value, it represents positive infinity." } ], "syntax": "[ [ <integer> | infinite ]{2} ]# | auto", "relevance": 50, "description": "@counter-style descriptor. Defines the ranges over which the counter style is defined.", "restrictions": [ "integer", "enum" ] }, { "name": "resize", "browsers": [ "E79", "FF4", "S3", "C1", "O12.1" ], "values": [ { "name": "both", "description": "The UA presents a bidirectional resizing mechanism to allow the user to adjust both the height and the width of the element." }, { "name": "horizontal", "description": "The UA presents a unidirectional horizontal resizing mechanism to allow the user to adjust only the width of the element." }, { "name": "none", "description": "The UA does not present a resizing mechanism on the element, and the user is given no direct manipulation mechanism to resize the element." }, { "name": "vertical", "description": "The UA presents a unidirectional vertical resizing mechanism to allow the user to adjust only the height of the element." } ], "syntax": "none | both | horizontal | vertical | block | inline", "relevance": 60, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/resize" } ], "description": "Specifies whether or not an element is resizable by the user, and if so, along which axis/axes.", "restrictions": [ "enum" ] }, { "name": "right", "values": [ { "name": "auto", "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well" } ], "syntax": "<length> | <percentage> | auto", "relevance": 92, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/right" } ], "description": "Specifies how far an absolutely positioned box's right margin edge is offset to the left of the right edge of the box's 'containing block'.", "restrictions": [ "length", "percentage" ] }, { "name": "ruby-align", "browsers": [ "FF38" ], "values": [ { "name": "auto", "browsers": [ "FF38" ], "description": "The user agent determines how the ruby contents are aligned. This is the initial value." }, { "name": "center", "description": "The ruby content is centered within its box." }, { "name": "distribute-letter", "browsers": [ "FF38" ], "description": "If the width of the ruby text is smaller than that of the base, then the ruby text contents are evenly distributed across the width of the base, with the first and last ruby text glyphs lining up with the corresponding first and last base glyphs. If the width of the ruby text is at least the width of the base, then the letters of the base are evenly distributed across the width of the ruby text." }, { "name": "distribute-space", "browsers": [ "FF38" ], "description": "If the width of the ruby text is smaller than that of the base, then the ruby text contents are evenly distributed across the width of the base, with a certain amount of white space preceding the first and following the last character in the ruby text. That amount of white space is normally equal to half the amount of inter-character space of the ruby text." }, { "name": "left", "description": "The ruby text content is aligned with the start edge of the base." }, { "name": "line-edge", "browsers": [ "FF38" ], "description": "If the ruby text is not adjacent to a line edge, it is aligned as in 'auto'. If it is adjacent to a line edge, then it is still aligned as in auto, but the side of the ruby text that touches the end of the line is lined up with the corresponding edge of the base." }, { "name": "right", "browsers": [ "FF38" ], "description": "The ruby text content is aligned with the end edge of the base." }, { "name": "start", "browsers": [ "FF38" ], "description": "The ruby text content is aligned with the start edge of the base." }, { "name": "space-between", "browsers": [ "FF38" ], "description": "The ruby content expands as defined for normal text justification (as defined by 'text-justify')," }, { "name": "space-around", "browsers": [ "FF38" ], "description": "As for 'space-between' except that there exists an extra justification opportunities whose space is distributed half before and half after the ruby content." } ], "status": "experimental", "syntax": "start | center | space-between | space-around", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/ruby-align" } ], "description": "Specifies how text is distributed within the various ruby boxes when their contents do not exactly fill their respective boxes.", "restrictions": [ "enum" ] }, { "name": "ruby-overhang", "browsers": [ "FF10", "IE5" ], "values": [ { "name": "auto", "description": "The ruby text can overhang text adjacent to the base on either side. This is the initial value." }, { "name": "end", "description": "The ruby text can overhang the text that follows it." }, { "name": "none", "description": "The ruby text cannot overhang any text adjacent to its base, only its own base." }, { "name": "start", "description": "The ruby text can overhang the text that precedes it." } ], "relevance": 50, "description": "Determines whether, and on which side, ruby text is allowed to partially overhang any adjacent text in addition to its own base, when the ruby text is wider than the ruby base.", "restrictions": [ "enum" ] }, { "name": "ruby-position", "browsers": [ "E84", "FF38", "S7", "C84", "O70" ], "values": [ { "name": "after", "description": "The ruby text appears after the base. This is a relatively rare setting used in ideographic East Asian writing systems, most easily found in educational text." }, { "name": "before", "description": "The ruby text appears before the base. This is the most common setting used in ideographic East Asian writing systems." }, { "name": "inline" }, { "name": "right", "description": "The ruby text appears on the right of the base. Unlike 'before' and 'after', this value is not relative to the text flow direction." } ], "status": "experimental", "syntax": "[ alternate || [ over | under ] ] | inter-character", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/ruby-position" } ], "description": "Used by the parent of elements with display: ruby-text to control the position of the ruby text with respect to its base.", "restrictions": [ "enum" ] }, { "name": "ruby-span", "browsers": [ "FF10" ], "values": [ { "name": "attr(x)", "description": "The value of attribute 'x' is a string value. The string value is evaluated as a <number> to determine the number of ruby base elements to be spanned by the annotation element." }, { "name": "none", "description": "No spanning. The computed value is '1'." } ], "relevance": 50, "description": "Determines whether, and on which side, ruby text is allowed to partially overhang any adjacent text in addition to its own base, when the ruby text is wider than the ruby base.", "restrictions": [ "enum" ] }, { "name": "scrollbar-3dlight-color", "browsers": [ "IE5" ], "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scrollbar-3dlight-color" } ], "description": "Determines the color of the top and left edges of the scroll box and scroll arrows of a scroll bar.", "restrictions": [ "color" ] }, { "name": "scrollbar-arrow-color", "browsers": [ "IE5" ], "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scrollbar-arrow-color" } ], "description": "Determines the color of the arrow elements of a scroll arrow.", "restrictions": [ "color" ] }, { "name": "scrollbar-base-color", "browsers": [ "IE5" ], "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scrollbar-base-color" } ], "description": "Determines the color of the main elements of a scroll bar, which include the scroll box, track, and scroll arrows.", "restrictions": [ "color" ] }, { "name": "scrollbar-darkshadow-color", "browsers": [ "IE5" ], "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scrollbar-darkshadow-color" } ], "description": "Determines the color of the gutter of a scroll bar.", "restrictions": [ "color" ] }, { "name": "scrollbar-face-color", "browsers": [ "IE5" ], "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scrollbar-face-color" } ], "description": "Determines the color of the scroll box and scroll arrows of a scroll bar.", "restrictions": [ "color" ] }, { "name": "scrollbar-highlight-color", "browsers": [ "IE5" ], "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scrollbar-highlight-color" } ], "description": "Determines the color of the top and left edges of the scroll box and scroll arrows of a scroll bar.", "restrictions": [ "color" ] }, { "name": "scrollbar-shadow-color", "browsers": [ "IE5" ], "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scrollbar-shadow-color" } ], "description": "Determines the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar.", "restrictions": [ "color" ] }, { "name": "scrollbar-track-color", "browsers": [ "IE6" ], "relevance": 50, "description": "Determines the color of the track element of a scroll bar.", "restrictions": [ "color" ] }, { "name": "scroll-behavior", "browsers": [ "E79", "FF36", "Spreview", "C61", "O48" ], "values": [ { "name": "auto", "description": "Scrolls in an instant fashion." }, { "name": "smooth", "description": "Scrolls in a smooth fashion using a user-agent-defined timing function and time period." } ], "syntax": "auto | smooth", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-behavior" } ], "description": "Specifies the scrolling behavior for a scrolling box, when scrolling happens due to navigation or CSSOM scrolling APIs.", "restrictions": [ "enum" ] }, { "name": "scroll-snap-coordinate", "browsers": [ "FF39" ], "values": [ { "name": "none", "description": "Specifies that this element does not contribute a snap point." } ], "status": "obsolete", "syntax": "none | <position>#", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-coordinate" } ], "description": "Defines the x and y coordinate within the element which will align with the nearest ancestor scroll container’s snap-destination for the respective axis.", "restrictions": [ "position", "length", "percentage", "enum" ] }, { "name": "scroll-snap-destination", "browsers": [ "FF39" ], "status": "obsolete", "syntax": "<position>", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-destination" } ], "description": "Define the x and y coordinate within the scroll container’s visual viewport which element snap points will align with.", "restrictions": [ "position", "length", "percentage" ] }, { "name": "scroll-snap-points-x", "browsers": [ "FF39", "S9" ], "values": [ { "name": "none", "description": "No snap points are defined by this scroll container." }, { "name": "repeat()", "description": "Defines an interval at which snap points are defined, starting from the container’s relevant start edge." } ], "status": "obsolete", "syntax": "none | repeat( <length-percentage> )", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-x" } ], "description": "Defines the positioning of snap points along the x axis of the scroll container it is applied to.", "restrictions": [ "enum" ] }, { "name": "scroll-snap-points-y", "browsers": [ "FF39", "S9" ], "values": [ { "name": "none", "description": "No snap points are defined by this scroll container." }, { "name": "repeat()", "description": "Defines an interval at which snap points are defined, starting from the container’s relevant start edge." } ], "status": "obsolete", "syntax": "none | repeat( <length-percentage> )", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-y" } ], "description": "Defines the positioning of snap points along the y axis of the scroll container it is applied to.", "restrictions": [ "enum" ] }, { "name": "scroll-snap-type", "values": [ { "name": "none", "description": "The visual viewport of this scroll container must ignore snap points, if any, when scrolled." }, { "name": "mandatory", "description": "The visual viewport of this scroll container is guaranteed to rest on a snap point when there are no active scrolling operations." }, { "name": "proximity", "description": "The visual viewport of this scroll container may come to rest on a snap point at the termination of a scroll at the discretion of the UA given the parameters of the scroll." } ], "syntax": "none | [ x | y | block | inline | both ] [ mandatory | proximity ]?", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type" } ], "description": "Defines how strictly snap points are enforced on the scroll container.", "restrictions": [ "enum" ] }, { "name": "shape-image-threshold", "browsers": [ "E79", "FF62", "S10.1", "C37", "O24" ], "syntax": "<alpha-value>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/shape-image-threshold" } ], "description": "Defines the alpha channel threshold used to extract the shape using an image. A value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque.", "restrictions": [ "number" ] }, { "name": "shape-margin", "browsers": [ "E79", "FF62", "S10.1", "C37", "O24" ], "syntax": "<length-percentage>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/shape-margin" } ], "description": "Adds a margin to a 'shape-outside'. This defines a new shape that is the smallest contour that includes all the points that are the 'shape-margin' distance outward in the perpendicular direction from a point on the underlying shape.", "restrictions": [ "url", "length", "percentage" ] }, { "name": "shape-outside", "browsers": [ "E79", "FF62", "S10.1", "C37", "O24" ], "values": [ { "name": "margin-box", "description": "The background is painted within (clipped to) the margin box." }, { "name": "none", "description": "The float area is unaffected." } ], "syntax": "none | [ <shape-box> || <basic-shape> ] | <image>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/shape-outside" } ], "description": "Specifies an orthogonal rotation to be applied to an image before it is laid out.", "restrictions": [ "image", "box", "shape", "enum" ] }, { "name": "shape-rendering", "values": [ { "name": "auto", "description": "Suppresses aural rendering." }, { "name": "crispEdges", "description": "Emphasize the contrast between clean edges of artwork over rendering speed and geometric precision." }, { "name": "geometricPrecision", "description": "Emphasize geometric precision over speed and crisp edges." }, { "name": "optimizeSpeed", "description": "Emphasize rendering speed over geometric precision and crisp edges." } ], "relevance": 50, "description": "Provides hints about what tradeoffs to make as it renders vector graphics elements such as <path> elements and basic shapes such as circles and rectangles.", "restrictions": [ "enum" ] }, { "name": "size", "browsers": [ "C", "O8" ], "syntax": "<length>{1,2} | auto | [ <page-size> || [ portrait | landscape ] ]", "relevance": 53, "description": "The size CSS at-rule descriptor, used with the @page at-rule, defines the size and orientation of the box which is used to represent a page. Most of the time, this size corresponds to the target size of the printed page if applicable.", "restrictions": [ "length" ] }, { "name": "src", "values": [ { "name": "url()", "description": "Reference font by URL" }, { "name": "format()", "description": "Optional hint describing the format of the font resource." }, { "name": "local()", "description": "Format-specific string that identifies a locally available copy of a given font." } ], "syntax": "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#", "relevance": 87, "description": "@font-face descriptor. Specifies the resource containing font data. It is required, whether the font is downloadable or locally installed.", "restrictions": [ "enum", "url", "identifier" ] }, { "name": "stop-color", "relevance": 51, "description": "Indicates what color to use at that gradient stop.", "restrictions": [ "color" ] }, { "name": "stop-opacity", "relevance": 50, "description": "Defines the opacity of a given gradient stop.", "restrictions": [ "number(0-1)" ] }, { "name": "stroke", "values": [ { "name": "url()", "description": "A URL reference to a paint server element, which is an element that defines a paint server: ‘hatch’, ‘linearGradient’, ‘mesh’, ‘pattern’, ‘radialGradient’ and ‘solidcolor’." }, { "name": "none", "description": "No paint is applied in this layer." } ], "relevance": 64, "description": "Paints along the outline of the given graphical element.", "restrictions": [ "color", "enum", "url" ] }, { "name": "stroke-dasharray", "values": [ { "name": "none", "description": "Indicates that no dashing is used." } ], "relevance": 58, "description": "Controls the pattern of dashes and gaps used to stroke paths.", "restrictions": [ "length", "percentage", "number", "enum" ] }, { "name": "stroke-dashoffset", "relevance": 58, "description": "Specifies the distance into the dash pattern to start the dash.", "restrictions": [ "percentage", "length" ] }, { "name": "stroke-linecap", "values": [ { "name": "butt", "description": "Indicates that the stroke for each subpath does not extend beyond its two endpoints." }, { "name": "round", "description": "Indicates that at each end of each subpath, the shape representing the stroke will be extended by a half circle with a radius equal to the stroke width." }, { "name": "square", "description": "Indicates that at the end of each subpath, the shape representing the stroke will be extended by a rectangle with the same width as the stroke width and whose length is half of the stroke width." } ], "relevance": 53, "description": "Specifies the shape to be used at the end of open subpaths when they are stroked.", "restrictions": [ "enum" ] }, { "name": "stroke-linejoin", "values": [ { "name": "bevel", "description": "Indicates that a bevelled corner is to be used to join path segments." }, { "name": "miter", "description": "Indicates that a sharp corner is to be used to join path segments." }, { "name": "round", "description": "Indicates that a round corner is to be used to join path segments." } ], "relevance": 50, "description": "Specifies the shape to be used at the corners of paths or basic shapes when they are stroked.", "restrictions": [ "enum" ] }, { "name": "stroke-miterlimit", "relevance": 50, "description": "When two line segments meet at a sharp angle and miter joins have been specified for 'stroke-linejoin', it is possible for the miter to extend far beyond the thickness of the line stroking the path.", "restrictions": [ "number" ] }, { "name": "stroke-opacity", "relevance": 52, "description": "Specifies the opacity of the painting operation used to stroke the current object.", "restrictions": [ "number(0-1)" ] }, { "name": "stroke-width", "relevance": 61, "description": "Specifies the width of the stroke on the current object.", "restrictions": [ "percentage", "length" ] }, { "name": "suffix", "browsers": [ "FF33" ], "syntax": "<symbol>", "relevance": 50, "description": "@counter-style descriptor. Specifies a <symbol> that is appended to the marker representation.", "restrictions": [ "image", "string", "identifier" ] }, { "name": "system", "browsers": [ "FF33" ], "values": [ { "name": "additive", "description": "Represents “sign-value” numbering systems, which, rather than using reusing digits in different positions to change their value, define additional digits with much larger values, so that the value of the number can be obtained by adding all the digits together." }, { "name": "alphabetic", "description": "Interprets the list of counter symbols as digits to an alphabetic numbering system, similar to the default lower-alpha counter style, which wraps from \"a\", \"b\", \"c\", to \"aa\", \"ab\", \"ac\"." }, { "name": "cyclic", "description": "Cycles repeatedly through its provided symbols, looping back to the beginning when it reaches the end of the list." }, { "name": "extends", "description": "Use the algorithm of another counter style, but alter other aspects." }, { "name": "fixed", "description": "Runs through its list of counter symbols once, then falls back." }, { "name": "numeric", "description": "interprets the list of counter symbols as digits to a \"place-value\" numbering system, similar to the default 'decimal' counter style." }, { "name": "symbolic", "description": "Cycles repeatedly through its provided symbols, doubling, tripling, etc. the symbols on each successive pass through the list." } ], "syntax": "cyclic | numeric | alphabetic | symbolic | additive | [ fixed <integer>? ] | [ extends <counter-style-name> ]", "relevance": 50, "description": "@counter-style descriptor. Specifies which algorithm will be used to construct the counter’s representation based on the counter value.", "restrictions": [ "enum", "integer" ] }, { "name": "symbols", "browsers": [ "FF33" ], "syntax": "<symbol>+", "relevance": 50, "description": "@counter-style descriptor. Specifies the symbols used by the marker-construction algorithm specified by the system descriptor.", "restrictions": [ "image", "string", "identifier" ] }, { "name": "table-layout", "values": [ { "name": "auto", "description": "Use any automatic table layout algorithm." }, { "name": "fixed", "description": "Use the fixed table layout algorithm." } ], "syntax": "auto | fixed", "relevance": 60, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/table-layout" } ], "description": "Controls the algorithm used to lay out the table cells, rows, and columns.", "restrictions": [ "enum" ] }, { "name": "tab-size", "browsers": [ "E79", "FF91", "S7", "C21", "O15" ], "syntax": "<integer> | <length>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/tab-size" } ], "description": "Determines the width of the tab character (U+0009), in space characters (U+0020), when rendered.", "restrictions": [ "integer", "length" ] }, { "name": "text-align", "values": [ { "name": "center", "description": "The inline contents are centered within the line box." }, { "name": "end", "description": "The inline contents are aligned to the end edge of the line box." }, { "name": "justify", "description": "The text is justified according to the method specified by the 'text-justify' property." }, { "name": "left", "description": "The inline contents are aligned to the left edge of the line box. In vertical text, 'left' aligns to the edge of the line box that would be the start edge for left-to-right text." }, { "name": "right", "description": "The inline contents are aligned to the right edge of the line box. In vertical text, 'right' aligns to the edge of the line box that would be the end edge for left-to-right text." }, { "name": "start", "description": "The inline contents are aligned to the start edge of the line box." } ], "syntax": "start | end | left | right | center | justify | match-parent", "relevance": 94, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-align" } ], "description": "Describes how inline contents of a block are horizontally aligned if the contents do not completely fill the line box.", "restrictions": [ "string" ] }, { "name": "text-align-last", "browsers": [ "E12", "FF49", "C47", "IE5.5", "O34" ], "values": [ { "name": "auto", "description": "Content on the affected line is aligned per 'text-align' unless 'text-align' is set to 'justify', in which case it is 'start-aligned'." }, { "name": "center", "description": "The inline contents are centered within the line box." }, { "name": "justify", "description": "The text is justified according to the method specified by the 'text-justify' property." }, { "name": "left", "description": "The inline contents are aligned to the left edge of the line box. In vertical text, 'left' aligns to the edge of the line box that would be the start edge for left-to-right text." }, { "name": "right", "description": "The inline contents are aligned to the right edge of the line box. In vertical text, 'right' aligns to the edge of the line box that would be the end edge for left-to-right text." } ], "syntax": "auto | start | end | left | right | center | justify", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-align-last" } ], "description": "Describes how the last line of a block or a line right before a forced line break is aligned when 'text-align' is set to 'justify'.", "restrictions": [ "enum" ] }, { "name": "text-anchor", "values": [ { "name": "end", "description": "The rendered characters are aligned such that the end of the resulting rendered text is at the initial current text position." }, { "name": "middle", "description": "The rendered characters are aligned such that the geometric middle of the resulting rendered text is at the initial current text position." }, { "name": "start", "description": "The rendered characters are aligned such that the start of the resulting rendered text is at the initial current text position." } ], "relevance": 50, "description": "Used to align (start-, middle- or end-alignment) a string of text relative to a given point.", "restrictions": [ "enum" ] }, { "name": "text-decoration", "values": [ { "name": "dashed", "description": "Produces a dashed line style." }, { "name": "dotted", "description": "Produces a dotted line." }, { "name": "double", "description": "Produces a double line." }, { "name": "line-through", "description": "Each line of text has a line through the middle." }, { "name": "none", "description": "Produces no line." }, { "name": "overline", "description": "Each line of text has a line above it." }, { "name": "solid", "description": "Produces a solid line." }, { "name": "underline", "description": "Each line of text is underlined." }, { "name": "wavy", "description": "Produces a wavy line." } ], "syntax": "<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> || <'text-decoration-thickness'>", "relevance": 92, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-decoration" } ], "description": "Decorations applied to font used for an element's text.", "restrictions": [ "enum", "color" ] }, { "name": "text-decoration-color", "browsers": [ "E79", "FF36", "S12.1", "C57", "O44" ], "syntax": "<color>", "relevance": 52, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-decoration-color" } ], "description": "Specifies the color of text decoration (underlines overlines, and line-throughs) set on the element with text-decoration-line.", "restrictions": [ "color" ] }, { "name": "text-decoration-line", "browsers": [ "E79", "FF36", "S12.1", "C57", "O44" ], "values": [ { "name": "line-through", "description": "Each line of text has a line through the middle." }, { "name": "none", "description": "Neither produces nor inhibits text decoration." }, { "name": "overline", "description": "Each line of text has a line above it." }, { "name": "underline", "description": "Each line of text is underlined." } ], "syntax": "none | [ underline || overline || line-through || blink ] | spelling-error | grammar-error", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-decoration-line" } ], "description": "Specifies what line decorations, if any, are added to the element.", "restrictions": [ "enum" ] }, { "name": "text-decoration-style", "browsers": [ "E79", "FF36", "S12.1", "C57", "O44" ], "values": [ { "name": "dashed", "description": "Produces a dashed line style." }, { "name": "dotted", "description": "Produces a dotted line." }, { "name": "double", "description": "Produces a double line." }, { "name": "none", "description": "Produces no line." }, { "name": "solid", "description": "Produces a solid line." }, { "name": "wavy", "description": "Produces a wavy line." } ], "syntax": "solid | double | dotted | dashed | wavy", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-decoration-style" } ], "description": "Specifies the line style for underline, line-through and overline text decoration.", "restrictions": [ "enum" ] }, { "name": "text-indent", "values": [], "syntax": "<length-percentage> && hanging? && each-line?", "relevance": 68, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-indent" } ], "description": "Specifies the indentation applied to lines of inline content in a block. The indentation only affects the first line of inline content in the block unless the 'hanging' keyword is specified, in which case it affects all lines except the first.", "restrictions": [ "percentage", "length" ] }, { "name": "text-justify", "browsers": [ "E12", "FF55", "C32", "IE11", "O19" ], "values": [ { "name": "auto", "description": "The UA determines the justification algorithm to follow, based on a balance between performance and adequate presentation quality." }, { "name": "distribute", "description": "Justification primarily changes spacing both at word separators and at grapheme cluster boundaries in all scripts except those in the connected and cursive groups. This value is sometimes used in e.g. Japanese, often with the 'text-align-last' property." }, { "name": "distribute-all-lines" }, { "name": "inter-cluster", "description": "Justification primarily changes spacing at word separators and at grapheme cluster boundaries in clustered scripts. This value is typically used for Southeast Asian scripts such as Thai." }, { "name": "inter-ideograph", "description": "Justification primarily changes spacing at word separators and at inter-graphemic boundaries in scripts that use no word spaces. This value is typically used for CJK languages." }, { "name": "inter-word", "description": "Justification primarily changes spacing at word separators. This value is typically used for languages that separate words using spaces, like English or (sometimes) Korean." }, { "name": "kashida", "description": "Justification primarily stretches Arabic and related scripts through the use of kashida or other calligraphic elongation." }, { "name": "newspaper" } ], "syntax": "auto | inter-character | inter-word | none", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-justify" } ], "description": "Selects the justification algorithm used when 'text-align' is set to 'justify'. The property applies to block containers, but the UA may (but is not required to) also support it on inline elements.", "restrictions": [ "enum" ] }, { "name": "text-orientation", "browsers": [ "E79", "FF41", "S14", "C48", "O35" ], "values": [ { "name": "sideways", "browsers": [ "E79", "FF41", "S14", "C48", "O35" ], "description": "This value is equivalent to 'sideways-right' in 'vertical-rl' writing mode and equivalent to 'sideways-left' in 'vertical-lr' writing mode." }, { "name": "sideways-right", "browsers": [ "E79", "FF41", "S14", "C48", "O35" ], "description": "In vertical writing modes, this causes text to be set as if in a horizontal layout, but rotated 90° clockwise." }, { "name": "upright", "description": "In vertical writing modes, characters from horizontal-only scripts are rendered upright, i.e. in their standard horizontal orientation." } ], "syntax": "mixed | upright | sideways", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-orientation" } ], "description": "Specifies the orientation of text within a line.", "restrictions": [ "enum" ] }, { "name": "text-overflow", "values": [ { "name": "clip", "description": "Clip inline content that overflows. Characters may be only partially rendered." }, { "name": "ellipsis", "description": "Render an ellipsis character (U+2026) to represent clipped inline content." } ], "syntax": "[ clip | ellipsis | <string> ]{1,2}", "relevance": 82, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-overflow" } ], "description": "Text can overflow for example when it is prevented from wrapping.", "restrictions": [ "enum", "string" ] }, { "name": "text-rendering", "browsers": [ "E79", "FF1", "S5", "C4", "O15" ], "values": [ { "name": "auto" }, { "name": "geometricPrecision", "description": "Indicates that the user agent shall emphasize geometric precision over legibility and rendering speed." }, { "name": "optimizeLegibility", "description": "Indicates that the user agent shall emphasize legibility over rendering speed and geometric precision." }, { "name": "optimizeSpeed", "description": "Indicates that the user agent shall emphasize rendering speed over legibility and geometric precision." } ], "syntax": "auto | optimizeSpeed | optimizeLegibility | geometricPrecision", "relevance": 68, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-rendering" } ], "description": "The creator of SVG content might want to provide a hint to the implementation about what tradeoffs to make as it renders text. The ‘text-rendering’ property provides these hints.", "restrictions": [ "enum" ] }, { "name": "text-shadow", "values": [ { "name": "none", "description": "No shadow." } ], "syntax": "none | <shadow-t>#", "relevance": 75, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-shadow" } ], "description": "Enables shadow effects to be applied to the text of the element.", "restrictions": [ "length", "color" ] }, { "name": "text-transform", "values": [ { "name": "capitalize", "description": "Puts the first typographic letter unit of each word in titlecase." }, { "name": "lowercase", "description": "Puts all letters in lowercase." }, { "name": "none", "description": "No effects." }, { "name": "uppercase", "description": "Puts all letters in uppercase." } ], "syntax": "none | capitalize | uppercase | lowercase | full-width | full-size-kana", "relevance": 86, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-transform" } ], "description": "Controls capitalization effects of an element’s text.", "restrictions": [ "enum" ] }, { "name": "text-underline-position", "values": [ { "name": "above" }, { "name": "auto", "description": "The user agent may use any algorithm to determine the underline’s position. In horizontal line layout, the underline should be aligned as for alphabetic. In vertical line layout, if the language is set to Japanese or Korean, the underline should be aligned as for over." }, { "name": "below", "description": "The underline is aligned with the under edge of the element’s content box." } ], "syntax": "auto | from-font | [ under || [ left | right ] ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-underline-position" } ], "description": "Sets the position of an underline specified on the same element: it does not affect underlines specified by ancestor elements. This property is typically used in vertical writing contexts such as in Japanese documents where it often desired to have the underline appear 'over' (to the right of) the affected run of text", "restrictions": [ "enum" ] }, { "name": "top", "values": [ { "name": "auto", "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well" } ], "syntax": "<length> | <percentage> | auto", "relevance": 95, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/top" } ], "description": "Specifies how far an absolutely positioned box's top margin edge is offset below the top edge of the box's 'containing block'.", "restrictions": [ "length", "percentage" ] }, { "name": "touch-action", "values": [ { "name": "auto", "description": "The user agent may determine any permitted touch behaviors for touches that begin on the element." }, { "name": "cross-slide-x" }, { "name": "cross-slide-y" }, { "name": "double-tap-zoom" }, { "name": "manipulation", "description": "The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming." }, { "name": "none", "description": "Touches that begin on the element must not trigger default touch behaviors." }, { "name": "pan-x", "description": "The user agent may consider touches that begin on the element only for the purposes of horizontally scrolling the element’s nearest ancestor with horizontally scrollable content." }, { "name": "pan-y", "description": "The user agent may consider touches that begin on the element only for the purposes of vertically scrolling the element’s nearest ancestor with vertically scrollable content." }, { "name": "pinch-zoom" } ], "syntax": "auto | none | [ [ pan-x | pan-left | pan-right ] || [ pan-y | pan-up | pan-down ] || pinch-zoom ] | manipulation", "relevance": 68, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/touch-action" } ], "description": "Determines whether touch input may trigger default behavior supplied by user agent.", "restrictions": [ "enum" ] }, { "name": "transform", "values": [ { "name": "matrix()", "description": "Specifies a 2D transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix [a b c d e f]" }, { "name": "matrix3d()", "description": "Specifies a 3D transformation as a 4x4 homogeneous matrix of 16 values in column-major order." }, { "name": "none" }, { "name": "perspective()", "description": "Specifies a perspective projection matrix." }, { "name": "rotate()", "description": "Specifies a 2D rotation by the angle specified in the parameter about the origin of the element, as defined by the transform-origin property." }, { "name": "rotate3d()", "description": "Specifies a clockwise 3D rotation by the angle specified in last parameter about the [x,y,z] direction vector described by the first 3 parameters." }, { "name": "rotateX('angle')", "description": "Specifies a clockwise rotation by the given angle about the X axis." }, { "name": "rotateY('angle')", "description": "Specifies a clockwise rotation by the given angle about the Y axis." }, { "name": "rotateZ('angle')", "description": "Specifies a clockwise rotation by the given angle about the Z axis." }, { "name": "scale()", "description": "Specifies a 2D scale operation by the [sx,sy] scaling vector described by the 2 parameters. If the second parameter is not provided, it is takes a value equal to the first." }, { "name": "scale3d()", "description": "Specifies a 3D scale operation by the [sx,sy,sz] scaling vector described by the 3 parameters." }, { "name": "scaleX()", "description": "Specifies a scale operation using the [sx,1] scaling vector, where sx is given as the parameter." }, { "name": "scaleY()", "description": "Specifies a scale operation using the [sy,1] scaling vector, where sy is given as the parameter." }, { "name": "scaleZ()", "description": "Specifies a scale operation using the [1,1,sz] scaling vector, where sz is given as the parameter." }, { "name": "skew()", "description": "Specifies a skew transformation along the X and Y axes. The first angle parameter specifies the skew on the X axis. The second angle parameter specifies the skew on the Y axis. If the second parameter is not given then a value of 0 is used for the Y angle (ie: no skew on the Y axis)." }, { "name": "skewX()", "description": "Specifies a skew transformation along the X axis by the given angle." }, { "name": "skewY()", "description": "Specifies a skew transformation along the Y axis by the given angle." }, { "name": "translate()", "description": "Specifies a 2D translation by the vector [tx, ty], where tx is the first translation-value parameter and ty is the optional second translation-value parameter." }, { "name": "translate3d()", "description": "Specifies a 3D translation by the vector [tx,ty,tz], with tx, ty and tz being the first, second and third translation-value parameters respectively." }, { "name": "translateX()", "description": "Specifies a translation by the given amount in the X direction." }, { "name": "translateY()", "description": "Specifies a translation by the given amount in the Y direction." }, { "name": "translateZ()", "description": "Specifies a translation by the given amount in the Z direction. Note that percentage values are not allowed in the translateZ translation-value, and if present are evaluated as 0." } ], "syntax": "none | <transform-list>", "relevance": 91, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/transform" } ], "description": "A two-dimensional transformation is applied to an element through the 'transform' property. This property contains a list of transform functions similar to those allowed by SVG.", "restrictions": [ "enum" ] }, { "name": "transform-origin", "syntax": "[ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?", "relevance": 77, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/transform-origin" } ], "description": "Establishes the origin of transformation for an element.", "restrictions": [ "position", "length", "percentage" ] }, { "name": "transform-style", "browsers": [ "E12", "FF16", "S9", "C36", "O23" ], "values": [ { "name": "flat", "description": "All children of this element are rendered flattened into the 2D plane of the element." }, { "name": "preserve-3d", "browsers": [ "E12", "FF16", "S9", "C36", "O23" ], "description": "Flattening is not performed, so children maintain their position in 3D space." } ], "syntax": "flat | preserve-3d", "relevance": 55, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/transform-style" } ], "description": "Defines how nested elements are rendered in 3D space.", "restrictions": [ "enum" ] }, { "name": "transition", "values": [ { "name": "all", "description": "Every property that is able to undergo a transition will do so." }, { "name": "none", "description": "No property will transition." } ], "syntax": "<single-transition>#", "relevance": 89, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/transition" } ], "description": "Shorthand property combines four of the transition properties into a single property.", "restrictions": [ "time", "property", "timing-function", "enum" ] }, { "name": "transition-delay", "syntax": "<time>#", "relevance": 63, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/transition-delay" } ], "description": "Defines when the transition will start. It allows a transition to begin execution some period of time from when it is applied.", "restrictions": [ "time" ] }, { "name": "transition-duration", "syntax": "<time>#", "relevance": 63, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/transition-duration" } ], "description": "Specifies how long the transition from the old value to the new value should take.", "restrictions": [ "time" ] }, { "name": "transition-property", "values": [ { "name": "all", "description": "Every property that is able to undergo a transition will do so." }, { "name": "none", "description": "No property will transition." } ], "syntax": "none | <single-transition-property>#", "relevance": 64, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/transition-property" } ], "description": "Specifies the name of the CSS property to which the transition is applied.", "restrictions": [ "property" ] }, { "name": "transition-timing-function", "syntax": "<easing-function>#", "relevance": 64, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/transition-timing-function" } ], "description": "Describes how the intermediate values used during a transition will be calculated.", "restrictions": [ "timing-function" ] }, { "name": "unicode-bidi", "values": [ { "name": "bidi-override", "description": "Inside the element, reordering is strictly in sequence according to the 'direction' property; the implicit part of the bidirectional algorithm is ignored." }, { "name": "embed", "description": "If the element is inline-level, this value opens an additional level of embedding with respect to the bidirectional algorithm. The direction of this embedding level is given by the 'direction' property." }, { "name": "isolate", "description": "The contents of the element are considered to be inside a separate, independent paragraph." }, { "name": "isolate-override", "description": "This combines the isolation behavior of 'isolate' with the directional override behavior of 'bidi-override'" }, { "name": "normal", "description": "The element does not open an additional level of embedding with respect to the bidirectional algorithm. For inline-level elements, implicit reordering works across element boundaries." }, { "name": "plaintext", "description": "For the purposes of the Unicode bidirectional algorithm, the base directionality of each bidi paragraph for which the element forms the containing block is determined not by the element's computed 'direction'." } ], "syntax": "normal | embed | isolate | bidi-override | isolate-override | plaintext", "relevance": 57, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/unicode-bidi" } ], "description": "The level of embedding with respect to the bidirectional algorithm.", "restrictions": [ "enum" ] }, { "name": "unicode-range", "values": [ { "name": "U+26", "description": "Ampersand." }, { "name": "U+20-24F, U+2B0-2FF, U+370-4FF, U+1E00-1EFF, U+2000-20CF, U+2100-23FF, U+2500-26FF, U+E000-F8FF, U+FB00–FB4F", "description": "WGL4 character set (Pan-European)." }, { "name": "U+20-17F, U+2B0-2FF, U+2000-206F, U+20A0-20CF, U+2100-21FF, U+2600-26FF", "description": "The Multilingual European Subset No. 1. Latin. Covers ~44 languages." }, { "name": "U+20-2FF, U+370-4FF, U+1E00-20CF, U+2100-23FF, U+2500-26FF, U+FB00-FB4F, U+FFF0-FFFD", "description": "The Multilingual European Subset No. 2. Latin, Greek, and Cyrillic. Covers ~128 language." }, { "name": "U+20-4FF, U+530-58F, U+10D0-10FF, U+1E00-23FF, U+2440-245F, U+2500-26FF, U+FB00-FB4F, U+FE20-FE2F, U+FFF0-FFFD", "description": "The Multilingual European Subset No. 3. Covers all characters belonging to European scripts." }, { "name": "U+00-7F", "description": "Basic Latin (ASCII)." }, { "name": "U+80-FF", "description": "Latin-1 Supplement. Accented characters for Western European languages, common punctuation characters, multiplication and division signs." }, { "name": "U+100-17F", "description": "Latin Extended-A. Accented characters for for Czech, Dutch, Polish, and Turkish." }, { "name": "U+180-24F", "description": "Latin Extended-B. Croatian, Slovenian, Romanian, Non-European and historic latin, Khoisan, Pinyin, Livonian, Sinology." }, { "name": "U+1E00-1EFF", "description": "Latin Extended Additional. Vietnamese, German captial sharp s, Medievalist, Latin general use." }, { "name": "U+250-2AF", "description": "International Phonetic Alphabet Extensions." }, { "name": "U+370-3FF", "description": "Greek and Coptic." }, { "name": "U+1F00-1FFF", "description": "Greek Extended. Accented characters for polytonic Greek." }, { "name": "U+400-4FF", "description": "Cyrillic." }, { "name": "U+500-52F", "description": "Cyrillic Supplement. Extra letters for Komi, Khanty, Chukchi, Mordvin, Kurdish, Aleut, Chuvash, Abkhaz, Azerbaijani, and Orok." }, { "name": "U+00-52F, U+1E00-1FFF, U+2200–22FF", "description": "Latin, Greek, Cyrillic, some punctuation and symbols." }, { "name": "U+530–58F", "description": "Armenian." }, { "name": "U+590–5FF", "description": "Hebrew." }, { "name": "U+600–6FF", "description": "Arabic." }, { "name": "U+750–77F", "description": "Arabic Supplement. Additional letters for African languages, Khowar, Torwali, Burushaski, and early Persian." }, { "name": "U+8A0–8FF", "description": "Arabic Extended-A. Additional letters for African languages, European and Central Asian languages, Rohingya, Tamazight, Arwi, and Koranic annotation signs." }, { "name": "U+700–74F", "description": "Syriac." }, { "name": "U+900–97F", "description": "Devanagari." }, { "name": "U+980–9FF", "description": "Bengali." }, { "name": "U+A00–A7F", "description": "Gurmukhi." }, { "name": "U+A80–AFF", "description": "Gujarati." }, { "name": "U+B00–B7F", "description": "Oriya." }, { "name": "U+B80–BFF", "description": "Tamil." }, { "name": "U+C00–C7F", "description": "Telugu." }, { "name": "U+C80–CFF", "description": "Kannada." }, { "name": "U+D00–D7F", "description": "Malayalam." }, { "name": "U+D80–DFF", "description": "Sinhala." }, { "name": "U+118A0–118FF", "description": "Warang Citi." }, { "name": "U+E00–E7F", "description": "Thai." }, { "name": "U+1A20–1AAF", "description": "Tai Tham." }, { "name": "U+AA80–AADF", "description": "Tai Viet." }, { "name": "U+E80–EFF", "description": "Lao." }, { "name": "U+F00–FFF", "description": "Tibetan." }, { "name": "U+1000–109F", "description": "Myanmar (Burmese)." }, { "name": "U+10A0–10FF", "description": "Georgian." }, { "name": "U+1200–137F", "description": "Ethiopic." }, { "name": "U+1380–139F", "description": "Ethiopic Supplement. Extra Syllables for Sebatbeit, and Tonal marks" }, { "name": "U+2D80–2DDF", "description": "Ethiopic Extended. Extra Syllables for Me'en, Blin, and Sebatbeit." }, { "name": "U+AB00–AB2F", "description": "Ethiopic Extended-A. Extra characters for Gamo-Gofa-Dawro, Basketo, and Gumuz." }, { "name": "U+1780–17FF", "description": "Khmer." }, { "name": "U+1800–18AF", "description": "Mongolian." }, { "name": "U+1B80–1BBF", "description": "Sundanese." }, { "name": "U+1CC0–1CCF", "description": "Sundanese Supplement. Punctuation." }, { "name": "U+4E00–9FD5", "description": "CJK (Chinese, Japanese, Korean) Unified Ideographs. Most common ideographs for modern Chinese and Japanese." }, { "name": "U+3400–4DB5", "description": "CJK Unified Ideographs Extension A. Rare ideographs." }, { "name": "U+2F00–2FDF", "description": "Kangxi Radicals." }, { "name": "U+2E80–2EFF", "description": "CJK Radicals Supplement. Alternative forms of Kangxi Radicals." }, { "name": "U+1100–11FF", "description": "Hangul Jamo." }, { "name": "U+AC00–D7AF", "description": "Hangul Syllables." }, { "name": "U+3040–309F", "description": "Hiragana." }, { "name": "U+30A0–30FF", "description": "Katakana." }, { "name": "U+A5, U+4E00-9FFF, U+30??, U+FF00-FF9F", "description": "Japanese Kanji, Hiragana and Katakana characters plus Yen/Yuan symbol." }, { "name": "U+A4D0–A4FF", "description": "Lisu." }, { "name": "U+A000–A48F", "description": "Yi Syllables." }, { "name": "U+A490–A4CF", "description": "Yi Radicals." }, { "name": "U+2000-206F", "description": "General Punctuation." }, { "name": "U+3000–303F", "description": "CJK Symbols and Punctuation." }, { "name": "U+2070–209F", "description": "Superscripts and Subscripts." }, { "name": "U+20A0–20CF", "description": "Currency Symbols." }, { "name": "U+2100–214F", "description": "Letterlike Symbols." }, { "name": "U+2150–218F", "description": "Number Forms." }, { "name": "U+2190–21FF", "description": "Arrows." }, { "name": "U+2200–22FF", "description": "Mathematical Operators." }, { "name": "U+2300–23FF", "description": "Miscellaneous Technical." }, { "name": "U+E000-F8FF", "description": "Private Use Area." }, { "name": "U+FB00–FB4F", "description": "Alphabetic Presentation Forms. Ligatures for latin, Armenian, and Hebrew." }, { "name": "U+FB50–FDFF", "description": "Arabic Presentation Forms-A. Contextual forms / ligatures for Persian, Urdu, Sindhi, Central Asian languages, etc, Arabic pedagogical symbols, word ligatures." }, { "name": "U+1F600–1F64F", "description": "Emoji: Emoticons." }, { "name": "U+2600–26FF", "description": "Emoji: Miscellaneous Symbols." }, { "name": "U+1F300–1F5FF", "description": "Emoji: Miscellaneous Symbols and Pictographs." }, { "name": "U+1F900–1F9FF", "description": "Emoji: Supplemental Symbols and Pictographs." }, { "name": "U+1F680–1F6FF", "description": "Emoji: Transport and Map Symbols." } ], "syntax": "<unicode-range>#", "relevance": 73, "description": "@font-face descriptor. Defines the set of Unicode codepoints that may be supported by the font face for which it is declared.", "restrictions": [ "unicode-range" ] }, { "name": "user-select", "values": [ { "name": "all", "description": "The content of the element must be selected atomically" }, { "name": "auto" }, { "name": "contain", "description": "UAs must not allow a selection which is started in this element to be extended outside of this element." }, { "name": "none", "description": "The UA must not allow selections to be started in this element." }, { "name": "text", "description": "The element imposes no constraint on the selection." } ], "syntax": "auto | text | none | contain | all", "relevance": 78, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/user-select" } ], "description": "Controls the appearance of selection.", "restrictions": [ "enum" ] }, { "name": "vertical-align", "values": [ { "name": "auto", "description": "Align the dominant baseline of the parent box with the equivalent, or heuristically reconstructed, baseline of the element inline box." }, { "name": "baseline", "description": "Align the 'alphabetic' baseline of the element with the 'alphabetic' baseline of the parent element." }, { "name": "bottom", "description": "Align the after edge of the extended inline box with the after-edge of the line box." }, { "name": "middle", "description": "Align the 'middle' baseline of the inline element with the middle baseline of the parent." }, { "name": "sub", "description": "Lower the baseline of the box to the proper position for subscripts of the parent's box. (This value has no effect on the font size of the element's text.)" }, { "name": "super", "description": "Raise the baseline of the box to the proper position for superscripts of the parent's box. (This value has no effect on the font size of the element's text.)" }, { "name": "text-bottom", "description": "Align the bottom of the box with the after-edge of the parent element's font." }, { "name": "text-top", "description": "Align the top of the box with the before-edge of the parent element's font." }, { "name": "top", "description": "Align the before edge of the extended inline box with the before-edge of the line box." }, { "name": "-webkit-baseline-middle" } ], "syntax": "baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length>", "relevance": 92, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/vertical-align" } ], "description": "Affects the vertical positioning of the inline boxes generated by an inline-level element inside a line box.", "restrictions": [ "percentage", "length" ] }, { "name": "visibility", "values": [ { "name": "collapse", "description": "Table-specific. If used on elements other than rows, row groups, columns, or column groups, 'collapse' has the same meaning as 'hidden'." }, { "name": "hidden", "description": "The generated box is invisible (fully transparent, nothing is drawn), but still affects layout." }, { "name": "visible", "description": "The generated box is visible." } ], "syntax": "visible | hidden | collapse", "relevance": 88, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/visibility" } ], "description": "Specifies whether the boxes generated by an element are rendered. Invisible boxes still affect layout (set the ‘display’ property to ‘none’ to suppress box generation altogether).", "restrictions": [ "enum" ] }, { "name": "-webkit-animation", "browsers": [ "C", "S5" ], "values": [ { "name": "alternate", "description": "The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction." }, { "name": "alternate-reverse", "description": "The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction." }, { "name": "backwards", "description": "The beginning property value (as defined in the first @keyframes at-rule) is applied before the animation is displayed, during the period defined by 'animation-delay'." }, { "name": "both", "description": "Both forwards and backwards fill modes are applied." }, { "name": "forwards", "description": "The final property value (as defined in the last @keyframes at-rule) is maintained after the animation completes." }, { "name": "infinite", "description": "Causes the animation to repeat forever." }, { "name": "none", "description": "No animation is performed" }, { "name": "normal", "description": "Normal playback." }, { "name": "reverse", "description": "All iterations of the animation are played in the reverse direction from the way they were specified." } ], "relevance": 50, "description": "Shorthand property combines six of the animation properties into a single property.", "restrictions": [ "time", "enum", "timing-function", "identifier", "number" ] }, { "name": "-webkit-animation-delay", "browsers": [ "C", "S5" ], "relevance": 50, "description": "Defines when the animation will start.", "restrictions": [ "time" ] }, { "name": "-webkit-animation-direction", "browsers": [ "C", "S5" ], "values": [ { "name": "alternate", "description": "The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction." }, { "name": "alternate-reverse", "description": "The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction." }, { "name": "normal", "description": "Normal playback." }, { "name": "reverse", "description": "All iterations of the animation are played in the reverse direction from the way they were specified." } ], "relevance": 50, "description": "Defines whether or not the animation should play in reverse on alternate cycles.", "restrictions": [ "enum" ] }, { "name": "-webkit-animation-duration", "browsers": [ "C", "S5" ], "relevance": 50, "description": "Defines the length of time that an animation takes to complete one cycle.", "restrictions": [ "time" ] }, { "name": "-webkit-animation-fill-mode", "browsers": [ "C", "S5" ], "values": [ { "name": "backwards", "description": "The beginning property value (as defined in the first @keyframes at-rule) is applied before the animation is displayed, during the period defined by 'animation-delay'." }, { "name": "both", "description": "Both forwards and backwards fill modes are applied." }, { "name": "forwards", "description": "The final property value (as defined in the last @keyframes at-rule) is maintained after the animation completes." }, { "name": "none", "description": "There is no change to the property value between the time the animation is applied and the time the animation begins playing or after the animation completes." } ], "relevance": 50, "description": "Defines what values are applied by the animation outside the time it is executing.", "restrictions": [ "enum" ] }, { "name": "-webkit-animation-iteration-count", "browsers": [ "C", "S5" ], "values": [ { "name": "infinite", "description": "Causes the animation to repeat forever." } ], "relevance": 50, "description": "Defines the number of times an animation cycle is played. The default value is one, meaning the animation will play from beginning to end once.", "restrictions": [ "number", "enum" ] }, { "name": "-webkit-animation-name", "browsers": [ "C", "S5" ], "values": [ { "name": "none", "description": "No animation is performed" } ], "relevance": 50, "description": "Defines a list of animations that apply. Each name is used to select the keyframe at-rule that provides the property values for the animation.", "restrictions": [ "identifier", "enum" ] }, { "name": "-webkit-animation-play-state", "browsers": [ "C", "S5" ], "values": [ { "name": "paused", "description": "A running animation will be paused." }, { "name": "running", "description": "Resume playback of a paused animation." } ], "relevance": 50, "description": "Defines whether the animation is running or paused.", "restrictions": [ "enum" ] }, { "name": "-webkit-animation-timing-function", "browsers": [ "C", "S5" ], "relevance": 50, "description": "Describes how the animation will progress over one cycle of its duration. See the 'transition-timing-function'.", "restrictions": [ "timing-function" ] }, { "name": "-webkit-appearance", "browsers": [ "C", "S3" ], "values": [ { "name": "button" }, { "name": "button-bevel" }, { "name": "caps-lock-indicator" }, { "name": "caret" }, { "name": "checkbox" }, { "name": "default-button" }, { "name": "listbox" }, { "name": "listitem" }, { "name": "media-fullscreen-button" }, { "name": "media-mute-button" }, { "name": "media-play-button" }, { "name": "media-seek-back-button" }, { "name": "media-seek-forward-button" }, { "name": "media-slider" }, { "name": "media-sliderthumb" }, { "name": "menulist" }, { "name": "menulist-button" }, { "name": "menulist-text" }, { "name": "menulist-textfield" }, { "name": "none" }, { "name": "push-button" }, { "name": "radio" }, { "name": "scrollbarbutton-down" }, { "name": "scrollbarbutton-left" }, { "name": "scrollbarbutton-right" }, { "name": "scrollbarbutton-up" }, { "name": "scrollbargripper-horizontal" }, { "name": "scrollbargripper-vertical" }, { "name": "scrollbarthumb-horizontal" }, { "name": "scrollbarthumb-vertical" }, { "name": "scrollbartrack-horizontal" }, { "name": "scrollbartrack-vertical" }, { "name": "searchfield" }, { "name": "searchfield-cancel-button" }, { "name": "searchfield-decoration" }, { "name": "searchfield-results-button" }, { "name": "searchfield-results-decoration" }, { "name": "slider-horizontal" }, { "name": "sliderthumb-horizontal" }, { "name": "sliderthumb-vertical" }, { "name": "slider-vertical" }, { "name": "square-button" }, { "name": "textarea" }, { "name": "textfield" } ], "status": "nonstandard", "syntax": "none | button | button-bevel | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button", "relevance": 0, "description": "Changes the appearance of buttons and other controls to resemble native controls.", "restrictions": [ "enum" ] }, { "name": "-webkit-backdrop-filter", "browsers": [ "S9" ], "values": [ { "name": "none", "description": "No filter effects are applied." }, { "name": "blur()", "description": "Applies a Gaussian blur to the input image." }, { "name": "brightness()", "description": "Applies a linear multiplier to input image, making it appear more or less bright." }, { "name": "contrast()", "description": "Adjusts the contrast of the input." }, { "name": "drop-shadow()", "description": "Applies a drop shadow effect to the input image." }, { "name": "grayscale()", "description": "Converts the input image to grayscale." }, { "name": "hue-rotate()", "description": "Applies a hue rotation on the input image. " }, { "name": "invert()", "description": "Inverts the samples in the input image." }, { "name": "opacity()", "description": "Applies transparency to the samples in the input image." }, { "name": "saturate()", "description": "Saturates the input image." }, { "name": "sepia()", "description": "Converts the input image to sepia." }, { "name": "url()", "description": "A filter reference to a <filter> element." } ], "relevance": 50, "description": "Applies a filter effect where the first filter in the list takes the element's background image as the input image.", "restrictions": [ "enum", "url" ] }, { "name": "-webkit-backface-visibility", "browsers": [ "C", "S5" ], "values": [ { "name": "hidden" }, { "name": "visible" } ], "relevance": 50, "description": "Determines whether or not the 'back' side of a transformed element is visible when facing the viewer. With an identity transform, the front side of an element faces the viewer.", "restrictions": [ "enum" ] }, { "name": "-webkit-background-clip", "browsers": [ "C", "S3" ], "relevance": 50, "description": "Determines the background painting area.", "restrictions": [ "box" ] }, { "name": "-webkit-background-composite", "browsers": [ "C", "S3" ], "values": [ { "name": "border" }, { "name": "padding" } ], "relevance": 50, "restrictions": [ "enum" ] }, { "name": "-webkit-background-origin", "browsers": [ "C", "S3" ], "relevance": 50, "description": "For elements rendered as a single box, specifies the background positioning area. For elements rendered as multiple boxes (e.g., inline boxes on several lines, boxes on several pages) specifies which boxes 'box-decoration-break' operates on to determine the background positioning area(s).", "restrictions": [ "box" ] }, { "name": "-webkit-border-image", "browsers": [ "C", "S5" ], "values": [ { "name": "auto", "description": "If 'auto' is specified then the border image width is the intrinsic width or height (whichever is applicable) of the corresponding image slice. If the image does not have the required intrinsic dimension then the corresponding border-width is used instead." }, { "name": "fill", "description": "Causes the middle part of the border-image to be preserved." }, { "name": "none" }, { "name": "repeat", "description": "The image is tiled (repeated) to fill the area." }, { "name": "round", "description": "The image is tiled (repeated) to fill the area. If it does not fill the area with a whole number of tiles, the image is rescaled so that it does." }, { "name": "space", "description": "The image is tiled (repeated) to fill the area. If it does not fill the area with a whole number of tiles, the extra space is distributed around the tiles." }, { "name": "stretch", "description": "The image is stretched to fill the area." }, { "name": "url()" } ], "relevance": 50, "description": "Shorthand property for setting 'border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset' and 'border-image-repeat'. Omitted values are set to their initial values.", "restrictions": [ "length", "percentage", "number", "url", "enum" ] }, { "name": "-webkit-box-align", "browsers": [ "C", "S3" ], "values": [ { "name": "baseline", "description": "If this box orientation is inline-axis or horizontal, all children are placed with their baselines aligned, and extra space placed before or after as necessary. For block flows, the baseline of the first non-empty line box located within the element is used. For tables, the baseline of the first cell is used." }, { "name": "center", "description": "Any extra space is divided evenly, with half placed above the child and the other half placed after the child." }, { "name": "end", "description": "For normal direction boxes, the bottom edge of each child is placed along the bottom of the box. Extra space is placed above the element. For reverse direction boxes, the top edge of each child is placed along the top of the box. Extra space is placed below the element." }, { "name": "start", "description": "For normal direction boxes, the top edge of each child is placed along the top of the box. Extra space is placed below the element. For reverse direction boxes, the bottom edge of each child is placed along the bottom of the box. Extra space is placed above the element." }, { "name": "stretch", "description": "The height of each child is adjusted to that of the containing block." } ], "relevance": 50, "description": "Specifies the alignment of nested elements within an outer flexible box element.", "restrictions": [ "enum" ] }, { "name": "-webkit-box-direction", "browsers": [ "C", "S3" ], "values": [ { "name": "normal", "description": "A box with a computed value of horizontal for box-orient displays its children from left to right. A box with a computed value of vertical displays its children from top to bottom." }, { "name": "reverse", "description": "A box with a computed value of horizontal for box-orient displays its children from right to left. A box with a computed value of vertical displays its children from bottom to top." } ], "relevance": 50, "description": "In webkit applications, -webkit-box-direction specifies whether a box lays out its contents normally (from the top or left edge), or in reverse (from the bottom or right edge).", "restrictions": [ "enum" ] }, { "name": "-webkit-box-flex", "browsers": [ "C", "S3" ], "relevance": 50, "description": "Specifies an element's flexibility.", "restrictions": [ "number" ] }, { "name": "-webkit-box-flex-group", "browsers": [ "C", "S3" ], "relevance": 50, "description": "Flexible elements can be assigned to flex groups using the 'box-flex-group' property.", "restrictions": [ "integer" ] }, { "name": "-webkit-box-ordinal-group", "browsers": [ "C", "S3" ], "relevance": 50, "description": "Indicates the ordinal group the element belongs to. Elements with a lower ordinal group are displayed before those with a higher ordinal group.", "restrictions": [ "integer" ] }, { "name": "-webkit-box-orient", "browsers": [ "C", "S3" ], "values": [ { "name": "block-axis", "description": "Elements are oriented along the box's axis." }, { "name": "horizontal", "description": "The box displays its children from left to right in a horizontal line." }, { "name": "inline-axis", "description": "Elements are oriented vertically." }, { "name": "vertical", "description": "The box displays its children from stacked from top to bottom vertically." } ], "relevance": 50, "description": "In webkit applications, -webkit-box-orient specifies whether a box lays out its contents horizontally or vertically.", "restrictions": [ "enum" ] }, { "name": "-webkit-box-pack", "browsers": [ "C", "S3" ], "values": [ { "name": "center", "description": "The extra space is divided evenly, with half placed before the first child and the other half placed after the last child." }, { "name": "end", "description": "For normal direction boxes, the right edge of the last child is placed at the right side, with all extra space placed before the first child. For reverse direction boxes, the left edge of the first child is placed at the left side, with all extra space placed after the last child." }, { "name": "justify", "description": "The space is divided evenly in-between each child, with none of the extra space placed before the first child or after the last child. If there is only one child, treat the pack value as if it were start." }, { "name": "start", "description": "For normal direction boxes, the left edge of the first child is placed at the left side, with all extra space placed after the last child. For reverse direction boxes, the right edge of the last child is placed at the right side, with all extra space placed before the first child." } ], "relevance": 50, "description": "Specifies alignment of child elements within the current element in the direction of orientation.", "restrictions": [ "enum" ] }, { "name": "-webkit-box-reflect", "browsers": [ "E79", "S4", "C4", "O15" ], "values": [ { "name": "above", "description": "The reflection appears above the border box." }, { "name": "below", "description": "The reflection appears below the border box." }, { "name": "left", "description": "The reflection appears to the left of the border box." }, { "name": "right", "description": "The reflection appears to the right of the border box." } ], "status": "nonstandard", "syntax": "[ above | below | right | left ]? <length>? <image>?", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-box-reflect" } ], "description": "Defines a reflection of a border box." }, { "name": "-webkit-box-sizing", "browsers": [ "C", "S3" ], "values": [ { "name": "border-box", "description": "The specified width and height (and respective min/max properties) on this element determine the border box of the element." }, { "name": "content-box", "description": "Behavior of width and height as specified by CSS2.1. The specified width and height (and respective min/max properties) apply to the width and height respectively of the content box of the element." } ], "relevance": 50, "description": "Box Model addition in CSS3.", "restrictions": [ "enum" ] }, { "name": "-webkit-break-after", "browsers": [ "S7" ], "values": [ { "name": "always", "description": "Always force a page break before/after the generated box." }, { "name": "auto", "description": "Neither force nor forbid a page/column break before/after the generated box." }, { "name": "avoid", "description": "Avoid a page/column break before/after the generated box." }, { "name": "avoid-column", "description": "Avoid a column break before/after the generated box." }, { "name": "avoid-page", "description": "Avoid a page break before/after the generated box." }, { "name": "avoid-region" }, { "name": "column", "description": "Always force a column break before/after the generated box." }, { "name": "left", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a left page." }, { "name": "page", "description": "Always force a page break before/after the generated box." }, { "name": "region" }, { "name": "right", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a right page." } ], "relevance": 50, "description": "Describes the page/column break behavior before the generated box.", "restrictions": [ "enum" ] }, { "name": "-webkit-break-before", "browsers": [ "S7" ], "values": [ { "name": "always", "description": "Always force a page break before/after the generated box." }, { "name": "auto", "description": "Neither force nor forbid a page/column break before/after the generated box." }, { "name": "avoid", "description": "Avoid a page/column break before/after the generated box." }, { "name": "avoid-column", "description": "Avoid a column break before/after the generated box." }, { "name": "avoid-page", "description": "Avoid a page break before/after the generated box." }, { "name": "avoid-region" }, { "name": "column", "description": "Always force a column break before/after the generated box." }, { "name": "left", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a left page." }, { "name": "page", "description": "Always force a page break before/after the generated box." }, { "name": "region" }, { "name": "right", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a right page." } ], "relevance": 50, "description": "Describes the page/column break behavior before the generated box.", "restrictions": [ "enum" ] }, { "name": "-webkit-break-inside", "browsers": [ "S7" ], "values": [ { "name": "auto", "description": "Neither force nor forbid a page/column break inside the generated box." }, { "name": "avoid", "description": "Avoid a page/column break inside the generated box." }, { "name": "avoid-column", "description": "Avoid a column break inside the generated box." }, { "name": "avoid-page", "description": "Avoid a page break inside the generated box." }, { "name": "avoid-region" } ], "relevance": 50, "description": "Describes the page/column break behavior inside the generated box.", "restrictions": [ "enum" ] }, { "name": "-webkit-column-break-after", "browsers": [ "C", "S3" ], "values": [ { "name": "always", "description": "Always force a page break before/after the generated box." }, { "name": "auto", "description": "Neither force nor forbid a page/column break before/after the generated box." }, { "name": "avoid", "description": "Avoid a page/column break before/after the generated box." }, { "name": "avoid-column", "description": "Avoid a column break before/after the generated box." }, { "name": "avoid-page", "description": "Avoid a page break before/after the generated box." }, { "name": "avoid-region" }, { "name": "column", "description": "Always force a column break before/after the generated box." }, { "name": "left", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a left page." }, { "name": "page", "description": "Always force a page break before/after the generated box." }, { "name": "region" }, { "name": "right", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a right page." } ], "relevance": 50, "description": "Describes the page/column break behavior before the generated box.", "restrictions": [ "enum" ] }, { "name": "-webkit-column-break-before", "browsers": [ "C", "S3" ], "values": [ { "name": "always", "description": "Always force a page break before/after the generated box." }, { "name": "auto", "description": "Neither force nor forbid a page/column break before/after the generated box." }, { "name": "avoid", "description": "Avoid a page/column break before/after the generated box." }, { "name": "avoid-column", "description": "Avoid a column break before/after the generated box." }, { "name": "avoid-page", "description": "Avoid a page break before/after the generated box." }, { "name": "avoid-region" }, { "name": "column", "description": "Always force a column break before/after the generated box." }, { "name": "left", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a left page." }, { "name": "page", "description": "Always force a page break before/after the generated box." }, { "name": "region" }, { "name": "right", "description": "Force one or two page breaks before/after the generated box so that the next page is formatted as a right page." } ], "relevance": 50, "description": "Describes the page/column break behavior before the generated box.", "restrictions": [ "enum" ] }, { "name": "-webkit-column-break-inside", "browsers": [ "C", "S3" ], "values": [ { "name": "auto", "description": "Neither force nor forbid a page/column break inside the generated box." }, { "name": "avoid", "description": "Avoid a page/column break inside the generated box." }, { "name": "avoid-column", "description": "Avoid a column break inside the generated box." }, { "name": "avoid-page", "description": "Avoid a page break inside the generated box." }, { "name": "avoid-region" } ], "relevance": 50, "description": "Describes the page/column break behavior inside the generated box.", "restrictions": [ "enum" ] }, { "name": "-webkit-column-count", "browsers": [ "C", "S3" ], "values": [ { "name": "auto", "description": "Determines the number of columns by the 'column-width' property and the element width." } ], "relevance": 50, "description": "Describes the optimal number of columns into which the content of the element will be flowed.", "restrictions": [ "integer" ] }, { "name": "-webkit-column-gap", "browsers": [ "C", "S3" ], "values": [ { "name": "normal", "description": "User agent specific and typically equivalent to 1em." } ], "relevance": 50, "description": "Sets the gap between columns. If there is a column rule between columns, it will appear in the middle of the gap.", "restrictions": [ "length" ] }, { "name": "-webkit-column-rule", "browsers": [ "C", "S3" ], "relevance": 50, "description": "This property is a shorthand for setting 'column-rule-width', 'column-rule-style', and 'column-rule-color' at the same place in the style sheet. Omitted values are set to their initial values.", "restrictions": [ "length", "line-width", "line-style", "color" ] }, { "name": "-webkit-column-rule-color", "browsers": [ "C", "S3" ], "relevance": 50, "description": "Sets the color of the column rule", "restrictions": [ "color" ] }, { "name": "-webkit-column-rule-style", "browsers": [ "C", "S3" ], "relevance": 50, "description": "Sets the style of the rule between columns of an element.", "restrictions": [ "line-style" ] }, { "name": "-webkit-column-rule-width", "browsers": [ "C", "S3" ], "relevance": 50, "description": "Sets the width of the rule between columns. Negative values are not allowed.", "restrictions": [ "length", "line-width" ] }, { "name": "-webkit-columns", "browsers": [ "C", "S3" ], "values": [ { "name": "auto", "description": "The width depends on the values of other properties." } ], "relevance": 50, "description": "A shorthand property which sets both 'column-width' and 'column-count'.", "restrictions": [ "length", "integer" ] }, { "name": "-webkit-column-span", "browsers": [ "C", "S3" ], "values": [ { "name": "all", "description": "The element spans across all columns. Content in the normal flow that appears before the element is automatically balanced across all columns before the element appear." }, { "name": "none", "description": "The element does not span multiple columns." } ], "relevance": 50, "description": "Describes the page/column break behavior after the generated box.", "restrictions": [ "enum" ] }, { "name": "-webkit-column-width", "browsers": [ "C", "S3" ], "values": [ { "name": "auto", "description": "The width depends on the values of other properties." } ], "relevance": 50, "description": "This property describes the width of columns in multicol elements.", "restrictions": [ "length" ] }, { "name": "-webkit-filter", "browsers": [ "C18", "O15", "S6" ], "values": [ { "name": "none", "description": "No filter effects are applied." }, { "name": "blur()", "description": "Applies a Gaussian blur to the input image." }, { "name": "brightness()", "description": "Applies a linear multiplier to input image, making it appear more or less bright." }, { "name": "contrast()", "description": "Adjusts the contrast of the input." }, { "name": "drop-shadow()", "description": "Applies a drop shadow effect to the input image." }, { "name": "grayscale()", "description": "Converts the input image to grayscale." }, { "name": "hue-rotate()", "description": "Applies a hue rotation on the input image. " }, { "name": "invert()", "description": "Inverts the samples in the input image." }, { "name": "opacity()", "description": "Applies transparency to the samples in the input image." }, { "name": "saturate()", "description": "Saturates the input image." }, { "name": "sepia()", "description": "Converts the input image to sepia." }, { "name": "url()", "description": "A filter reference to a <filter> element." } ], "relevance": 50, "description": "Processes an element’s rendering before it is displayed in the document, by applying one or more filter effects.", "restrictions": [ "enum", "url" ] }, { "name": "-webkit-flow-from", "browsers": [ "S6.1" ], "values": [ { "name": "none", "description": "The block container is not a CSS Region." } ], "relevance": 50, "description": "Makes a block container a region and associates it with a named flow.", "restrictions": [ "identifier" ] }, { "name": "-webkit-flow-into", "browsers": [ "S6.1" ], "values": [ { "name": "none", "description": "The element is not moved to a named flow and normal CSS processing takes place." } ], "relevance": 50, "description": "Places an element or its contents into a named flow.", "restrictions": [ "identifier" ] }, { "name": "-webkit-font-feature-settings", "browsers": [ "C16" ], "values": [ { "name": "\"c2cs\"" }, { "name": "\"dlig\"" }, { "name": "\"kern\"" }, { "name": "\"liga\"" }, { "name": "\"lnum\"" }, { "name": "\"onum\"" }, { "name": "\"smcp\"" }, { "name": "\"swsh\"" }, { "name": "\"tnum\"" }, { "name": "normal", "description": "No change in glyph substitution or positioning occurs." }, { "name": "off" }, { "name": "on" } ], "relevance": 50, "description": "This property provides low-level control over OpenType font features. It is intended as a way of providing access to font features that are not widely used but are needed for a particular use case.", "restrictions": [ "string", "integer" ] }, { "name": "-webkit-hyphens", "browsers": [ "S5.1" ], "values": [ { "name": "auto", "description": "Conditional hyphenation characters inside a word, if present, take priority over automatic resources when determining hyphenation points within the word." }, { "name": "manual", "description": "Words are only broken at line breaks where there are characters inside the word that suggest line break opportunities" }, { "name": "none", "description": "Words are not broken at line breaks, even if characters inside the word suggest line break points." } ], "relevance": 50, "description": "Controls whether hyphenation is allowed to create more break opportunities within a line of text.", "restrictions": [ "enum" ] }, { "name": "-webkit-line-break", "browsers": [ "C", "S3" ], "values": [ { "name": "after-white-space" }, { "name": "normal" } ], "relevance": 50, "description": "Specifies line-breaking rules for CJK (Chinese, Japanese, and Korean) text." }, { "name": "-webkit-margin-bottom-collapse", "browsers": [ "C", "S3" ], "values": [ { "name": "collapse" }, { "name": "discard" }, { "name": "separate" } ], "relevance": 50, "restrictions": [ "enum" ] }, { "name": "-webkit-margin-collapse", "browsers": [ "C", "S3" ], "values": [ { "name": "collapse" }, { "name": "discard" }, { "name": "separate" } ], "relevance": 50, "restrictions": [ "enum" ] }, { "name": "-webkit-margin-start", "browsers": [ "C", "S3" ], "values": [ { "name": "auto" } ], "relevance": 50, "restrictions": [ "percentage", "length" ] }, { "name": "-webkit-margin-top-collapse", "browsers": [ "C", "S3" ], "values": [ { "name": "collapse" }, { "name": "discard" }, { "name": "separate" } ], "relevance": 50, "restrictions": [ "enum" ] }, { "name": "-webkit-mask-clip", "browsers": [ "C", "O15", "S4" ], "status": "nonstandard", "syntax": "[ <box> | border | padding | content | text ]#", "relevance": 0, "description": "Determines the mask painting area, which determines the area that is affected by the mask.", "restrictions": [ "box" ] }, { "name": "-webkit-mask-image", "browsers": [ "C", "O15", "S4" ], "values": [ { "name": "none", "description": "Counts as a transparent black image layer." }, { "name": "url()", "description": "Reference to a <mask element or to a CSS image." } ], "status": "nonstandard", "syntax": "<mask-reference>#", "relevance": 0, "description": "Sets the mask layer image of an element.", "restrictions": [ "url", "image", "enum" ] }, { "name": "-webkit-mask-origin", "browsers": [ "C", "O15", "S4" ], "status": "nonstandard", "syntax": "[ <box> | border | padding | content ]#", "relevance": 0, "description": "Specifies the mask positioning area.", "restrictions": [ "box" ] }, { "name": "-webkit-mask-repeat", "browsers": [ "C", "O15", "S4" ], "status": "nonstandard", "syntax": "<repeat-style>#", "relevance": 0, "description": "Specifies how mask layer images are tiled after they have been sized and positioned.", "restrictions": [ "repeat" ] }, { "name": "-webkit-mask-size", "browsers": [ "C", "O15", "S4" ], "values": [ { "name": "auto", "description": "Resolved by using the image’s intrinsic ratio and the size of the other dimension, or failing that, using the image’s intrinsic size, or failing that, treating it as 100%." }, { "name": "contain", "description": "Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area." }, { "name": "cover", "description": "Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area." } ], "status": "nonstandard", "syntax": "<bg-size>#", "relevance": 0, "description": "Specifies the size of the mask layer images.", "restrictions": [ "length", "percentage", "enum" ] }, { "name": "-webkit-nbsp-mode", "browsers": [ "C", "S3" ], "values": [ { "name": "normal" }, { "name": "space" } ], "relevance": 50, "description": "Defines the behavior of nonbreaking spaces within text." }, { "name": "-webkit-overflow-scrolling", "browsers": [ "C", "S5" ], "values": [ { "name": "auto" }, { "name": "touch" } ], "status": "nonstandard", "syntax": "auto | touch", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-overflow-scrolling" } ], "description": "Specifies whether to use native-style scrolling in an overflow:scroll element." }, { "name": "-webkit-padding-start", "browsers": [ "C", "S3" ], "relevance": 50, "restrictions": [ "percentage", "length" ] }, { "name": "-webkit-perspective", "browsers": [ "C", "S4" ], "values": [ { "name": "none", "description": "No perspective transform is applied." } ], "relevance": 50, "description": "Applies the same transform as the perspective(<number>) transform function, except that it applies only to the positioned or transformed children of the element, not to the transform on the element itself.", "restrictions": [ "length" ] }, { "name": "-webkit-perspective-origin", "browsers": [ "C", "S4" ], "relevance": 50, "description": "Establishes the origin for the perspective property. It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element.", "restrictions": [ "position", "percentage", "length" ] }, { "name": "-webkit-region-fragment", "browsers": [ "S7" ], "values": [ { "name": "auto", "description": "Content flows as it would in a regular content box." }, { "name": "break", "description": "If the content fits within the CSS Region, then this property has no effect." } ], "relevance": 50, "description": "The 'region-fragment' property controls the behavior of the last region associated with a named flow.", "restrictions": [ "enum" ] }, { "name": "-webkit-tap-highlight-color", "browsers": [ "E12", "C16", "O15" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-tap-highlight-color" } ], "restrictions": [ "color" ] }, { "name": "-webkit-text-fill-color", "browsers": [ "E12", "FF49", "S3", "C1", "O15" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-fill-color" } ], "restrictions": [ "color" ] }, { "name": "-webkit-text-size-adjust", "browsers": [ "E", "C", "S3" ], "values": [ { "name": "auto", "description": "Renderers must use the default size adjustment when displaying on a small device." }, { "name": "none", "description": "Renderers must not do size adjustment when displaying on a small device." } ], "relevance": 50, "description": "Specifies a size adjustment for displaying text content in mobile browsers.", "restrictions": [ "percentage" ] }, { "name": "-webkit-text-stroke", "browsers": [ "E15", "FF49", "S3", "C4", "O15" ], "status": "nonstandard", "syntax": "<length> || <color>", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke" } ], "restrictions": [ "length", "line-width", "color", "percentage" ] }, { "name": "-webkit-text-stroke-color", "browsers": [ "E15", "FF49", "S3", "C1", "O15" ], "status": "nonstandard", "syntax": "<color>", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-color" } ], "restrictions": [ "color" ] }, { "name": "-webkit-text-stroke-width", "browsers": [ "E15", "FF49", "S3", "C1", "O15" ], "status": "nonstandard", "syntax": "<length>", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-width" } ], "restrictions": [ "length", "line-width", "percentage" ] }, { "name": "-webkit-touch-callout", "browsers": [ "S3" ], "values": [ { "name": "none" } ], "status": "nonstandard", "syntax": "default | none", "relevance": 0, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-touch-callout" } ], "restrictions": [ "enum" ] }, { "name": "-webkit-transform", "browsers": [ "C", "O12", "S3.1" ], "values": [ { "name": "matrix()", "description": "Specifies a 2D transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix [a b c d e f]" }, { "name": "matrix3d()", "description": "Specifies a 3D transformation as a 4x4 homogeneous matrix of 16 values in column-major order." }, { "name": "none" }, { "name": "perspective()", "description": "Specifies a perspective projection matrix." }, { "name": "rotate()", "description": "Specifies a 2D rotation by the angle specified in the parameter about the origin of the element, as defined by the transform-origin property." }, { "name": "rotate3d()", "description": "Specifies a clockwise 3D rotation by the angle specified in last parameter about the [x,y,z] direction vector described by the first 3 parameters." }, { "name": "rotateX('angle')", "description": "Specifies a clockwise rotation by the given angle about the X axis." }, { "name": "rotateY('angle')", "description": "Specifies a clockwise rotation by the given angle about the Y axis." }, { "name": "rotateZ('angle')", "description": "Specifies a clockwise rotation by the given angle about the Z axis." }, { "name": "scale()", "description": "Specifies a 2D scale operation by the [sx,sy] scaling vector described by the 2 parameters. If the second parameter is not provided, it is takes a value equal to the first." }, { "name": "scale3d()", "description": "Specifies a 3D scale operation by the [sx,sy,sz] scaling vector described by the 3 parameters." }, { "name": "scaleX()", "description": "Specifies a scale operation using the [sx,1] scaling vector, where sx is given as the parameter." }, { "name": "scaleY()", "description": "Specifies a scale operation using the [sy,1] scaling vector, where sy is given as the parameter." }, { "name": "scaleZ()", "description": "Specifies a scale operation using the [1,1,sz] scaling vector, where sz is given as the parameter." }, { "name": "skew()", "description": "Specifies a skew transformation along the X and Y axes. The first angle parameter specifies the skew on the X axis. The second angle parameter specifies the skew on the Y axis. If the second parameter is not given then a value of 0 is used for the Y angle (ie: no skew on the Y axis)." }, { "name": "skewX()", "description": "Specifies a skew transformation along the X axis by the given angle." }, { "name": "skewY()", "description": "Specifies a skew transformation along the Y axis by the given angle." }, { "name": "translate()", "description": "Specifies a 2D translation by the vector [tx, ty], where tx is the first translation-value parameter and ty is the optional second translation-value parameter." }, { "name": "translate3d()", "description": "Specifies a 3D translation by the vector [tx,ty,tz], with tx, ty and tz being the first, second and third translation-value parameters respectively." }, { "name": "translateX()", "description": "Specifies a translation by the given amount in the X direction." }, { "name": "translateY()", "description": "Specifies a translation by the given amount in the Y direction." }, { "name": "translateZ()", "description": "Specifies a translation by the given amount in the Z direction. Note that percentage values are not allowed in the translateZ translation-value, and if present are evaluated as 0." } ], "relevance": 50, "description": "A two-dimensional transformation is applied to an element through the 'transform' property. This property contains a list of transform functions similar to those allowed by SVG.", "restrictions": [ "enum" ] }, { "name": "-webkit-transform-origin", "browsers": [ "C", "O15", "S3.1" ], "relevance": 50, "description": "Establishes the origin of transformation for an element.", "restrictions": [ "position", "length", "percentage" ] }, { "name": "-webkit-transform-origin-x", "browsers": [ "C", "S3.1" ], "relevance": 50, "description": "The x coordinate of the origin for transforms applied to an element with respect to its border box.", "restrictions": [ "length", "percentage" ] }, { "name": "-webkit-transform-origin-y", "browsers": [ "C", "S3.1" ], "relevance": 50, "description": "The y coordinate of the origin for transforms applied to an element with respect to its border box.", "restrictions": [ "length", "percentage" ] }, { "name": "-webkit-transform-origin-z", "browsers": [ "C", "S4" ], "relevance": 50, "description": "The z coordinate of the origin for transforms applied to an element with respect to its border box.", "restrictions": [ "length", "percentage" ] }, { "name": "-webkit-transform-style", "browsers": [ "C", "S4" ], "values": [ { "name": "flat", "description": "All children of this element are rendered flattened into the 2D plane of the element." } ], "relevance": 50, "description": "Defines how nested elements are rendered in 3D space.", "restrictions": [ "enum" ] }, { "name": "-webkit-transition", "browsers": [ "C", "O12", "S5" ], "values": [ { "name": "all", "description": "Every property that is able to undergo a transition will do so." }, { "name": "none", "description": "No property will transition." } ], "relevance": 50, "description": "Shorthand property combines four of the transition properties into a single property.", "restrictions": [ "time", "property", "timing-function", "enum" ] }, { "name": "-webkit-transition-delay", "browsers": [ "C", "O12", "S5" ], "relevance": 50, "description": "Defines when the transition will start. It allows a transition to begin execution some period of time from when it is applied.", "restrictions": [ "time" ] }, { "name": "-webkit-transition-duration", "browsers": [ "C", "O12", "S5" ], "relevance": 50, "description": "Specifies how long the transition from the old value to the new value should take.", "restrictions": [ "time" ] }, { "name": "-webkit-transition-property", "browsers": [ "C", "O12", "S5" ], "values": [ { "name": "all", "description": "Every property that is able to undergo a transition will do so." }, { "name": "none", "description": "No property will transition." } ], "relevance": 50, "description": "Specifies the name of the CSS property to which the transition is applied.", "restrictions": [ "property" ] }, { "name": "-webkit-transition-timing-function", "browsers": [ "C", "O12", "S5" ], "relevance": 50, "description": "Describes how the intermediate values used during a transition will be calculated.", "restrictions": [ "timing-function" ] }, { "name": "-webkit-user-drag", "browsers": [ "S3" ], "values": [ { "name": "auto" }, { "name": "element" }, { "name": "none" } ], "relevance": 50, "restrictions": [ "enum" ] }, { "name": "-webkit-user-modify", "browsers": [ "C", "S3" ], "values": [ { "name": "read-only" }, { "name": "read-write" }, { "name": "read-write-plaintext-only" } ], "status": "nonstandard", "syntax": "read-only | read-write | read-write-plaintext-only", "relevance": 0, "description": "Determines whether a user can edit the content of an element.", "restrictions": [ "enum" ] }, { "name": "-webkit-user-select", "browsers": [ "C", "S3" ], "values": [ { "name": "auto" }, { "name": "none" }, { "name": "text" } ], "relevance": 50, "description": "Controls the appearance of selection.", "restrictions": [ "enum" ] }, { "name": "white-space", "values": [ { "name": "normal", "description": "Sets 'white-space-collapsing' to 'collapse' and 'text-wrap' to 'normal'." }, { "name": "nowrap", "description": "Sets 'white-space-collapsing' to 'collapse' and 'text-wrap' to 'none'." }, { "name": "pre", "description": "Sets 'white-space-collapsing' to 'preserve' and 'text-wrap' to 'none'." }, { "name": "pre-line", "description": "Sets 'white-space-collapsing' to 'preserve-breaks' and 'text-wrap' to 'normal'." }, { "name": "pre-wrap", "description": "Sets 'white-space-collapsing' to 'preserve' and 'text-wrap' to 'normal'." } ], "syntax": "normal | pre | nowrap | pre-wrap | pre-line | break-spaces", "relevance": 90, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/white-space" } ], "description": "Shorthand property for the 'white-space-collapsing' and 'text-wrap' properties.", "restrictions": [ "enum" ] }, { "name": "widows", "browsers": [ "E12", "S1.3", "C25", "IE8", "O9.2" ], "syntax": "<integer>", "relevance": 51, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/widows" } ], "description": "Specifies the minimum number of line boxes of a block container that must be left in a fragment after a break.", "restrictions": [ "integer" ] }, { "name": "width", "values": [ { "name": "auto", "description": "The width depends on the values of other properties." }, { "name": "fit-content", "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." }, { "name": "max-content", "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." }, { "name": "min-content", "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." } ], "syntax": "<viewport-length>{1,2}", "relevance": 96, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/width" } ], "description": "Specifies the width of the content area, padding area or border area (depending on 'box-sizing') of certain boxes.", "restrictions": [ "length", "percentage" ] }, { "name": "will-change", "browsers": [ "E79", "FF36", "S9.1", "C36", "O24" ], "values": [ { "name": "auto", "description": "Expresses no particular intent." }, { "name": "contents", "description": "Indicates that the author expects to animate or change something about the element’s contents in the near future." }, { "name": "scroll-position", "description": "Indicates that the author expects to animate or change the scroll position of the element in the near future." } ], "syntax": "auto | <animateable-feature>#", "relevance": 64, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/will-change" } ], "description": "Provides a rendering hint to the user agent, stating what kinds of changes the author expects to perform on the element.", "restrictions": [ "enum", "identifier" ] }, { "name": "word-break", "values": [ { "name": "break-all", "description": "Lines may break between any two grapheme clusters for non-CJK scripts." }, { "name": "keep-all", "description": "Block characters can no longer create implied break points." }, { "name": "normal", "description": "Breaks non-CJK scripts according to their own rules." } ], "syntax": "normal | break-all | keep-all | break-word", "relevance": 75, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/word-break" } ], "description": "Specifies line break opportunities for non-CJK scripts.", "restrictions": [ "enum" ] }, { "name": "word-spacing", "values": [ { "name": "normal", "description": "No additional spacing is applied. Computes to zero." } ], "syntax": "normal | <length>", "relevance": 57, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/word-spacing" } ], "description": "Specifies additional spacing between “words”.", "restrictions": [ "length", "percentage" ] }, { "name": "word-wrap", "values": [ { "name": "break-word", "description": "An otherwise unbreakable sequence of characters may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line." }, { "name": "normal", "description": "Lines may break only at allowed break points." } ], "syntax": "normal | break-word", "relevance": 78, "description": "Specifies whether the UA may break within a word to prevent overflow when an otherwise-unbreakable string is too long to fit.", "restrictions": [ "enum" ] }, { "name": "writing-mode", "values": [ { "name": "horizontal-tb", "description": "Top-to-bottom block flow direction. The writing mode is horizontal." }, { "name": "sideways-lr", "description": "Left-to-right block flow direction. The writing mode is vertical, while the typographic mode is horizontal." }, { "name": "sideways-rl", "description": "Right-to-left block flow direction. The writing mode is vertical, while the typographic mode is horizontal." }, { "name": "vertical-lr", "description": "Left-to-right block flow direction. The writing mode is vertical." }, { "name": "vertical-rl", "description": "Right-to-left block flow direction. The writing mode is vertical." } ], "syntax": "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/writing-mode" } ], "description": "This is a shorthand property for both 'direction' and 'block-progression'.", "restrictions": [ "enum" ] }, { "name": "z-index", "values": [ { "name": "auto", "description": "The stack level of the generated box in the current stacking context is 0. The box does not establish a new stacking context unless it is the root element." } ], "syntax": "auto | <integer>", "relevance": 92, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/z-index" } ], "description": "For a positioned box, the 'z-index' property specifies the stack level of the box in the current stacking context and whether the box establishes a local stacking context.", "restrictions": [ "integer" ] }, { "name": "zoom", "browsers": [ "E12", "S3.1", "C1", "IE5.5", "O15" ], "values": [ { "name": "normal" } ], "syntax": "auto | <number> | <percentage>", "relevance": 68, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/zoom" } ], "description": "Non-standard. Specifies the magnification scale of the object. See 'transform: scale()' for a standards-based alternative.", "restrictions": [ "enum", "integer", "number", "percentage" ] }, { "name": "-ms-ime-align", "status": "nonstandard", "syntax": "auto | after", "relevance": 0, "description": "Aligns the Input Method Editor (IME) candidate window box relative to the element on which the IME composition is active." }, { "name": "-moz-binding", "status": "nonstandard", "syntax": "<url> | none", "relevance": 0, "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-binding" } ], "description": "The -moz-binding CSS property is used by Mozilla-based applications to attach an XBL binding to a DOM element." }, { "name": "-moz-context-properties", "status": "nonstandard", "syntax": "none | [ fill | fill-opacity | stroke | stroke-opacity ]#", "relevance": 0, "browsers": [ "FF55" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-context-properties" } ], "description": "If you reference an SVG image in a webpage (such as with the <img> element or as a background image), the SVG image can coordinate with the embedding element (its context) to have the image adopt property values set on the embedding element. To do this the embedding element needs to list the properties that are to be made available to the image by listing them as values of the -moz-context-properties property, and the image needs to opt in to using those properties by using values such as the context-fill value.\n\nThis feature is available since Firefox 55, but is only currently supported with SVG images loaded via chrome:// or resource:// URLs. To experiment with the feature in SVG on the Web it is necessary to set the svg.context-properties.content.enabled pref to true." }, { "name": "-moz-float-edge", "status": "nonstandard", "syntax": "border-box | content-box | margin-box | padding-box", "relevance": 0, "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-float-edge" } ], "description": "The non-standard -moz-float-edge CSS property specifies whether the height and width properties of the element include the margin, border, or padding thickness." }, { "name": "-moz-force-broken-image-icon", "status": "nonstandard", "syntax": "0 | 1", "relevance": 0, "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-force-broken-image-icon" } ], "description": "The -moz-force-broken-image-icon extended CSS property can be used to force the broken image icon to be shown even when a broken image has an alt attribute." }, { "name": "-moz-image-region", "status": "nonstandard", "syntax": "<shape> | auto", "relevance": 0, "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-image-region" } ], "description": "For certain XUL elements and pseudo-elements that use an image from the list-style-image property, this property specifies a region of the image that is used in place of the whole image. This allows elements to use different pieces of the same image to improve performance." }, { "name": "-moz-orient", "status": "nonstandard", "syntax": "inline | block | horizontal | vertical", "relevance": 0, "browsers": [ "FF6" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-orient" } ], "description": "The -moz-orient CSS property specifies the orientation of the element to which it's applied." }, { "name": "-moz-outline-radius", "status": "nonstandard", "syntax": "<outline-radius>{1,4} [ / <outline-radius>{1,4} ]?", "relevance": 0, "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius" } ], "description": "In Mozilla applications like Firefox, the -moz-outline-radius CSS property can be used to give an element's outline rounded corners." }, { "name": "-moz-outline-radius-bottomleft", "status": "nonstandard", "syntax": "<outline-radius>", "relevance": 0, "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomleft" } ], "description": "In Mozilla applications, the -moz-outline-radius-bottomleft CSS property can be used to round the bottom-left corner of an element's outline." }, { "name": "-moz-outline-radius-bottomright", "status": "nonstandard", "syntax": "<outline-radius>", "relevance": 0, "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomright" } ], "description": "In Mozilla applications, the -moz-outline-radius-bottomright CSS property can be used to round the bottom-right corner of an element's outline." }, { "name": "-moz-outline-radius-topleft", "status": "nonstandard", "syntax": "<outline-radius>", "relevance": 0, "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topleft" } ], "description": "In Mozilla applications, the -moz-outline-radius-topleft CSS property can be used to round the top-left corner of an element's outline." }, { "name": "-moz-outline-radius-topright", "status": "nonstandard", "syntax": "<outline-radius>", "relevance": 0, "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topright" } ], "description": "In Mozilla applications, the -moz-outline-radius-topright CSS property can be used to round the top-right corner of an element's outline." }, { "name": "-moz-stack-sizing", "status": "nonstandard", "syntax": "ignore | stretch-to-fit", "relevance": 0, "description": "-moz-stack-sizing is an extended CSS property. Normally, a stack will change its size so that all of its child elements are completely visible. For example, moving a child of the stack far to the right will widen the stack so the child remains visible." }, { "name": "-moz-text-blink", "status": "nonstandard", "syntax": "none | blink", "relevance": 0, "description": "The -moz-text-blink non-standard Mozilla CSS extension specifies the blink mode." }, { "name": "-moz-user-input", "status": "nonstandard", "syntax": "auto | none | enabled | disabled", "relevance": 0, "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-moz-user-input" } ], "description": "In Mozilla applications, -moz-user-input determines if an element will accept user input." }, { "name": "-moz-user-modify", "status": "nonstandard", "syntax": "read-only | read-write | write-only", "relevance": 0, "description": "The -moz-user-modify property has no effect. It was originally planned to determine whether or not the content of an element can be edited by a user." }, { "name": "-moz-window-dragging", "status": "nonstandard", "syntax": "drag | no-drag", "relevance": 0, "description": "The -moz-window-dragging CSS property specifies whether a window is draggable or not. It only works in Chrome code, and only on Mac OS X." }, { "name": "-moz-window-shadow", "status": "nonstandard", "syntax": "default | menu | tooltip | sheet | none", "relevance": 0, "description": "The -moz-window-shadow CSS property specifies whether a window will have a shadow. It only works on Mac OS X." }, { "name": "-webkit-border-before", "status": "nonstandard", "syntax": "<'border-width'> || <'border-style'> || <color>", "relevance": 0, "browsers": [ "E79", "S5.1", "C8", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-border-before" } ], "description": "The -webkit-border-before CSS property is a shorthand property for setting the individual logical block start border property values in a single place in the style sheet." }, { "name": "-webkit-border-before-color", "status": "nonstandard", "syntax": "<color>", "relevance": 0, "description": "The -webkit-border-before-color CSS property sets the color of the individual logical block start border in a single place in the style sheet." }, { "name": "-webkit-border-before-style", "status": "nonstandard", "syntax": "<'border-style'>", "relevance": 0, "description": "The -webkit-border-before-style CSS property sets the style of the individual logical block start border in a single place in the style sheet." }, { "name": "-webkit-border-before-width", "status": "nonstandard", "syntax": "<'border-width'>", "relevance": 0, "description": "The -webkit-border-before-width CSS property sets the width of the individual logical block start border in a single place in the style sheet." }, { "name": "-webkit-line-clamp", "syntax": "none | <integer>", "relevance": 50, "browsers": [ "E17", "FF68", "S5", "C6", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-line-clamp" } ], "description": "The -webkit-line-clamp CSS property allows limiting of the contents of a block container to the specified number of lines." }, { "name": "-webkit-mask", "status": "nonstandard", "syntax": "[ <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || [ <box> | border | padding | content | text ] || [ <box> | border | padding | content ] ]#", "relevance": 0, "description": "The mask CSS property alters the visibility of an element by either partially or fully hiding it. This is accomplished by either masking or clipping the image at specific points." }, { "name": "-webkit-mask-attachment", "status": "nonstandard", "syntax": "<attachment>#", "relevance": 0, "browsers": [ "S4", "C1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-attachment" } ], "description": "If a -webkit-mask-image is specified, -webkit-mask-attachment determines whether the mask image's position is fixed within the viewport, or scrolls along with its containing block." }, { "name": "-webkit-mask-composite", "status": "nonstandard", "syntax": "<composite-style>#", "relevance": 0, "browsers": [ "E18", "FF53", "S3.1", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-composite" } ], "description": "The -webkit-mask-composite property specifies the manner in which multiple mask images applied to the same element are composited with one another. Mask images are composited in the opposite order that they are declared with the -webkit-mask-image property." }, { "name": "-webkit-mask-position", "status": "nonstandard", "syntax": "<position>#", "relevance": 0, "description": "The mask-position CSS property sets the initial position, relative to the mask position layer defined by mask-origin, for each defined mask image." }, { "name": "-webkit-mask-position-x", "status": "nonstandard", "syntax": "[ <length-percentage> | left | center | right ]#", "relevance": 0, "browsers": [ "E18", "FF49", "S3.1", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-x" } ], "description": "The -webkit-mask-position-x CSS property sets the initial horizontal position of a mask image." }, { "name": "-webkit-mask-position-y", "status": "nonstandard", "syntax": "[ <length-percentage> | top | center | bottom ]#", "relevance": 0, "browsers": [ "E18", "FF49", "S3.1", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-y" } ], "description": "The -webkit-mask-position-y CSS property sets the initial vertical position of a mask image." }, { "name": "-webkit-mask-repeat-x", "status": "nonstandard", "syntax": "repeat | no-repeat | space | round", "relevance": 0, "browsers": [ "E18", "S5", "C3", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-x" } ], "description": "The -webkit-mask-repeat-x property specifies whether and how a mask image is repeated (tiled) horizontally." }, { "name": "-webkit-mask-repeat-y", "status": "nonstandard", "syntax": "repeat | no-repeat | space | round", "relevance": 0, "browsers": [ "E18", "S5", "C3", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-y" } ], "description": "The -webkit-mask-repeat-y property specifies whether and how a mask image is repeated (tiled) vertically." }, { "name": "accent-color", "syntax": "auto | <color>", "relevance": 50, "browsers": [ "E93", "FF92", "Spreview", "C93", "O79" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/accent-color" } ], "description": "Sets the color of the elements accent" }, { "name": "align-tracks", "status": "experimental", "syntax": "[ normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position> ]#", "relevance": 50, "browsers": [ "FF77" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/align-tracks" } ], "description": "The align-tracks CSS property sets the alignment in the masonry axis for grid containers that have masonry in their block axis." }, { "name": "appearance", "status": "experimental", "syntax": "none | auto | textfield | menulist-button | <compat-auto>", "relevance": 62, "browsers": [ "E84", "FF80", "Spreview", "C84", "O70" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/appearance" } ], "description": "Changes the appearance of buttons and other controls to resemble native controls." }, { "name": "aspect-ratio", "status": "experimental", "syntax": "auto | <ratio>", "relevance": 53, "browsers": [ "E88", "FF89", "S15", "C88", "O74" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/aspect-ratio" } ], "description": "The aspect-ratio CSS property sets a preferred aspect ratio for the box, which will be used in the calculation of auto sizes and some other layout functions." }, { "name": "azimuth", "status": "obsolete", "syntax": "<angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards", "relevance": 0, "description": "In combination with elevation, the azimuth CSS property enables different audio sources to be positioned spatially for aural presentation. This is important in that it provides a natural way to tell several voices apart, as each can be positioned to originate at a different location on the sound stage. Stereo output produce a lateral sound stage, while binaural headphones and multi-speaker setups allow for a fully three-dimensional stage." }, { "name": "backdrop-filter", "syntax": "none | <filter-function-list>", "relevance": 53, "browsers": [ "E17", "FF70", "S9", "C76", "O63" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/backdrop-filter" } ], "description": "The backdrop-filter CSS property lets you apply graphical effects such as blurring or color shifting to the area behind an element. Because it applies to everything behind the element, to see the effect you must make the element or its background at least partially transparent." }, { "name": "border-block", "syntax": "<'border-top-width'> || <'border-top-style'> || <color>", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block" } ], "description": "The border-block CSS property is a shorthand property for setting the individual logical block border property values in a single place in the style sheet." }, { "name": "border-block-color", "syntax": "<'border-top-color'>{1,2}", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-color" } ], "description": "The border-block-color CSS property defines the color of the logical block borders of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "border-block-style", "syntax": "<'border-top-style'>", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-style" } ], "description": "The border-block-style CSS property defines the style of the logical block borders of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "border-block-width", "syntax": "<'border-top-width'>", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-block-width" } ], "description": "The border-block-width CSS property defines the width of the logical block borders of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "border-end-end-radius", "syntax": "<length-percentage>{1,2}", "relevance": 50, "browsers": [ "E89", "FF66", "S15", "C89", "O75" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-end-end-radius" } ], "description": "The border-end-end-radius CSS property defines a logical border radius on an element, which maps to a physical border radius that depends on on the element's writing-mode, direction, and text-orientation." }, { "name": "border-end-start-radius", "syntax": "<length-percentage>{1,2}", "relevance": 50, "browsers": [ "E89", "FF66", "S15", "C89", "O75" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-end-start-radius" } ], "description": "The border-end-start-radius CSS property defines a logical border radius on an element, which maps to a physical border radius depending on the element's writing-mode, direction, and text-orientation." }, { "name": "border-inline", "syntax": "<'border-top-width'> || <'border-top-style'> || <color>", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline" } ], "description": "The border-inline CSS property is a shorthand property for setting the individual logical inline border property values in a single place in the style sheet." }, { "name": "border-inline-color", "syntax": "<'border-top-color'>{1,2}", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-color" } ], "description": "The border-inline-color CSS property defines the color of the logical inline borders of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "border-inline-style", "syntax": "<'border-top-style'>", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-style" } ], "description": "The border-inline-style CSS property defines the style of the logical inline borders of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "border-inline-width", "syntax": "<'border-top-width'>", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-inline-width" } ], "description": "The border-inline-width CSS property defines the width of the logical inline borders of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "border-start-end-radius", "syntax": "<length-percentage>{1,2}", "relevance": 50, "browsers": [ "E89", "FF66", "S15", "C89", "O75" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-start-end-radius" } ], "description": "The border-start-end-radius CSS property defines a logical border radius on an element, which maps to a physical border radius depending on the element's writing-mode, direction, and text-orientation." }, { "name": "border-start-start-radius", "syntax": "<length-percentage>{1,2}", "relevance": 50, "browsers": [ "E89", "FF66", "S15", "C89", "O75" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/border-start-start-radius" } ], "description": "The border-start-start-radius CSS property defines a logical border radius on an element, which maps to a physical border radius that depends on the element's writing-mode, direction, and text-orientation." }, { "name": "box-align", "status": "nonstandard", "syntax": "start | center | end | baseline | stretch", "relevance": 0, "browsers": [ "E12", "FF1", "S3", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-align" } ], "description": "The box-align CSS property specifies how an element aligns its contents across its layout in a perpendicular direction. The effect of the property is only visible if there is extra space in the box." }, { "name": "box-direction", "status": "nonstandard", "syntax": "normal | reverse | inherit", "relevance": 0, "browsers": [ "E12", "FF1", "S3", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-direction" } ], "description": "The box-direction CSS property specifies whether a box lays out its contents normally (from the top or left edge), or in reverse (from the bottom or right edge)." }, { "name": "box-flex", "status": "nonstandard", "syntax": "<number>", "relevance": 0, "browsers": [ "E12", "FF1", "S3", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-flex" } ], "description": "The -moz-box-flex and -webkit-box-flex CSS properties specify how a -moz-box or -webkit-box grows to fill the box that contains it, in the direction of the containing box's layout." }, { "name": "box-flex-group", "status": "nonstandard", "syntax": "<integer>", "relevance": 0, "browsers": [ "S3", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-flex-group" } ], "description": "The box-flex-group CSS property assigns the flexbox's child elements to a flex group." }, { "name": "box-lines", "status": "nonstandard", "syntax": "single | multiple", "relevance": 0, "browsers": [ "S3", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-lines" } ], "description": "The box-lines CSS property determines whether the box may have a single or multiple lines (rows for horizontally oriented boxes, columns for vertically oriented boxes)." }, { "name": "box-ordinal-group", "status": "nonstandard", "syntax": "<integer>", "relevance": 0, "browsers": [ "E12", "FF1", "S3", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-ordinal-group" } ], "description": "The box-ordinal-group CSS property assigns the flexbox's child elements to an ordinal group." }, { "name": "box-orient", "status": "nonstandard", "syntax": "horizontal | vertical | inline-axis | block-axis | inherit", "relevance": 0, "browsers": [ "E12", "FF1", "S3", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-orient" } ], "description": "The box-orient CSS property specifies whether an element lays out its contents horizontally or vertically." }, { "name": "box-pack", "status": "nonstandard", "syntax": "start | center | end | justify", "relevance": 0, "browsers": [ "E12", "FF1", "S3", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/box-pack" } ], "description": "The -moz-box-pack and -webkit-box-pack CSS properties specify how a -moz-box or -webkit-box packs its contents in the direction of its layout. The effect of this is only visible if there is extra space in the box." }, { "name": "color-adjust", "syntax": "economy | exact", "relevance": 50, "browsers": [ "E79", "FF48", "S6", "C49", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/color-adjust" } ], "description": "The color-adjust property is a non-standard CSS extension that can be used to force printing of background colors and images in browsers based on the WebKit engine." }, { "name": "color-scheme", "syntax": "normal | [ light | dark | <custom-ident> ]+ && only?", "relevance": 51, "browsers": [ "E81", "FF96", "S13", "C81", "O68" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/color-scheme" } ], "description": "The color-scheme CSS property allows an element to indicate which color schemes it can comfortably be rendered in." }, { "name": "content-visibility", "syntax": "visible | auto | hidden", "relevance": 52, "browsers": [ "E85", "C85", "O71" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/content-visibility" } ], "description": "Controls whether or not an element renders its contents at all, along with forcing a strong set of containments, allowing user agents to potentially omit large swathes of layout and rendering work until it becomes needed." }, { "name": "counter-set", "syntax": "[ <counter-name> <integer>? ]+ | none", "relevance": 50, "browsers": [ "E85", "FF68", "C85", "O71" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/counter-set" } ], "description": "The counter-set CSS property sets a CSS counter to a given value. It manipulates the value of existing counters, and will only create new counters if there isn't already a counter of the given name on the element." }, { "name": "font-optical-sizing", "syntax": "auto | none", "relevance": 50, "browsers": [ "E17", "FF62", "S11", "C79", "O66" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-optical-sizing" } ], "description": "The font-optical-sizing CSS property allows developers to control whether browsers render text with slightly differing visual representations to optimize viewing at different sizes, or not. This only works for fonts that have an optical size variation axis." }, { "name": "font-variation-settings", "syntax": "normal | [ <string> <number> ]#", "relevance": 50, "browsers": [ "E17", "FF62", "S11", "C62", "O49" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-variation-settings" } ], "description": "The font-variation-settings CSS property provides low-level control over OpenType or TrueType font variations, by specifying the four letter axis names of the features you want to vary, along with their variation values." }, { "name": "font-smooth", "status": "nonstandard", "syntax": "auto | never | always | <absolute-size> | <length>", "relevance": 0, "browsers": [ "E79", "FF25", "S4", "C5", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/font-smooth" } ], "description": "The font-smooth CSS property controls the application of anti-aliasing when fonts are rendered." }, { "name": "forced-color-adjust", "status": "experimental", "syntax": "auto | none", "relevance": 51, "browsers": [ "E79", "C89", "IE10" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/forced-color-adjust" } ], "description": "Allows authors to opt certain elements out of forced colors mode. This then restores the control of those values to CSS" }, { "name": "gap", "syntax": "<'row-gap'> <'column-gap'>?", "relevance": 53, "browsers": [ "E84", "FF63", "S14.1", "C84", "O70" ], "description": "The gap CSS property is a shorthand property for row-gap and column-gap specifying the gutters between grid rows and columns." }, { "name": "hanging-punctuation", "syntax": "none | [ first || [ force-end | allow-end ] || last ]", "relevance": 50, "browsers": [ "S10" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/hanging-punctuation" } ], "description": "The hanging-punctuation CSS property specifies whether a punctuation mark should hang at the start or end of a line of text. Hanging punctuation may be placed outside the line box." }, { "name": "hyphenate-character", "syntax": "auto | <string>", "relevance": 50, "description": "A hyphenate character used at the end of a line." }, { "name": "image-resolution", "status": "experimental", "syntax": "[ from-image || <resolution> ] && snap?", "relevance": 50, "description": "The image-resolution property specifies the intrinsic resolution of all raster images used in or on the element. It affects both content images (e.g. replaced elements and generated content) and decorative images (such as background-image). The intrinsic resolution of an image is used to determine the image’s intrinsic dimensions." }, { "name": "initial-letter", "status": "experimental", "syntax": "normal | [ <number> <integer>? ]", "relevance": 50, "browsers": [ "S9" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/initial-letter" } ], "description": "The initial-letter CSS property specifies styling for dropped, raised, and sunken initial letters." }, { "name": "initial-letter-align", "status": "experimental", "syntax": "[ auto | alphabetic | hanging | ideographic ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/initial-letter-align" } ], "description": "The initial-letter-align CSS property specifies the alignment of initial letters within a paragraph." }, { "name": "input-security", "syntax": "auto | none", "relevance": 50, "description": "Enables or disables the obscuring a sensitive test input." }, { "name": "inset", "syntax": "<'top'>{1,4}", "relevance": 51, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/inset" } ], "description": "The inset CSS property defines the logical block and inline start and end offsets of an element, which map to physical offsets depending on the element's writing mode, directionality, and text orientation. It corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "inset-block", "syntax": "<'top'>{1,2}", "relevance": 50, "browsers": [ "E87", "FF63", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/inset-block" } ], "description": "The inset-block CSS property defines the logical block start and end offsets of an element, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. It corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "inset-block-end", "syntax": "<'top'>", "relevance": 50, "browsers": [ "E87", "FF63", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/inset-block-end" } ], "description": "The inset-block-end CSS property defines the logical block end offset of an element, which maps to a physical offset depending on the element's writing mode, directionality, and text orientation. It corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "inset-block-start", "syntax": "<'top'>", "relevance": 50, "browsers": [ "E87", "FF63", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/inset-block-start" } ], "description": "The inset-block-start CSS property defines the logical block start offset of an element, which maps to a physical offset depending on the element's writing mode, directionality, and text orientation. It corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "inset-inline", "syntax": "<'top'>{1,2}", "relevance": 50, "browsers": [ "E87", "FF63", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/inset-inline" } ], "description": "The inset-inline CSS property defines the logical block start and end offsets of an element, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. It corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "inset-inline-end", "syntax": "<'top'>", "relevance": 50, "browsers": [ "E87", "FF63", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/inset-inline-end" } ], "description": "The inset-inline-end CSS property defines the logical inline end inset of an element, which maps to a physical inset depending on the element's writing mode, directionality, and text orientation. It corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "inset-inline-start", "syntax": "<'top'>", "relevance": 50, "browsers": [ "E87", "FF63", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/inset-inline-start" } ], "description": "The inset-inline-start CSS property defines the logical inline start inset of an element, which maps to a physical offset depending on the element's writing mode, directionality, and text orientation. It corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation." }, { "name": "justify-tracks", "status": "experimental", "syntax": "[ normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ] ]#", "relevance": 50, "browsers": [ "FF77" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/justify-tracks" } ], "description": "The justify-tracks CSS property sets the alignment in the masonry axis for grid containers that have masonry in their inline axis" }, { "name": "line-clamp", "status": "experimental", "syntax": "none | <integer>", "relevance": 50, "description": "The line-clamp property allows limiting the contents of a block container to the specified number of lines; remaining content is fragmented away and neither rendered nor measured. Optionally, it also allows inserting content into the last line box to indicate the continuity of truncated/interrupted content." }, { "name": "line-height-step", "status": "experimental", "syntax": "<length>", "relevance": 50, "browsers": [ "E79", "C60", "O47" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/line-height-step" } ], "description": "The line-height-step CSS property defines the step units for line box heights. When the step unit is positive, line box heights are rounded up to the closest multiple of the unit. Negative values are invalid." }, { "name": "margin-block", "syntax": "<'margin-left'>{1,2}", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-block" } ], "description": "The margin-block CSS property defines the logical block start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation." }, { "name": "margin-inline", "syntax": "<'margin-left'>{1,2}", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-inline" } ], "description": "The margin-inline CSS property defines the logical inline start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation." }, { "name": "margin-trim", "status": "experimental", "syntax": "none | in-flow | all", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/margin-trim" } ], "description": "The margin-trim property allows the container to trim the margins of its children where they adjoin the container’s edges." }, { "name": "mask", "syntax": "<mask-layer>#", "relevance": 50, "browsers": [ "E79", "FF2", "S3.1", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask" } ], "description": "The mask CSS property alters the visibility of an element by either partially or fully hiding it. This is accomplished by either masking or clipping the image at specific points." }, { "name": "mask-border", "syntax": "<'mask-border-source'> || <'mask-border-slice'> [ / <'mask-border-width'>? [ / <'mask-border-outset'> ]? ]? || <'mask-border-repeat'> || <'mask-border-mode'>", "relevance": 50, "browsers": [ "E79", "S3.1", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-border" } ], "description": "The mask-border CSS property lets you create a mask along the edge of an element's border.\n\nThis property is a shorthand for mask-border-source, mask-border-slice, mask-border-width, mask-border-outset, mask-border-repeat, and mask-border-mode. As with all shorthand properties, any omitted sub-values will be set to their initial value." }, { "name": "mask-border-mode", "syntax": "luminance | alpha", "relevance": 50, "description": "The mask-border-mode CSS property specifies the blending mode used in a mask border." }, { "name": "mask-border-outset", "syntax": "[ <length> | <number> ]{1,4}", "relevance": 50, "browsers": [ "E79", "S3.1", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-border-outset" } ], "description": "The mask-border-outset CSS property specifies the distance by which an element's mask border is set out from its border box." }, { "name": "mask-border-repeat", "syntax": "[ stretch | repeat | round | space ]{1,2}", "relevance": 50, "browsers": [ "E79", "S3.1", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-border-repeat" } ], "description": "The mask-border-repeat CSS property defines how the edge regions of a source image are adjusted to fit the dimensions of an element's mask border." }, { "name": "mask-border-slice", "syntax": "<number-percentage>{1,4} fill?", "relevance": 50, "browsers": [ "E79", "S3.1", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-border-slice" } ], "description": "The mask-border-slice CSS property divides the image specified by mask-border-source into regions. These regions are used to form the components of an element's mask border." }, { "name": "mask-border-source", "syntax": "none | <image>", "relevance": 50, "browsers": [ "E79", "S3.1", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-border-source" } ], "description": "The mask-border-source CSS property specifies the source image used to create an element's mask border.\n\nThe mask-border-slice property is used to divide the source image into regions, which are then dynamically applied to the final mask border." }, { "name": "mask-border-width", "syntax": "[ <length-percentage> | <number> | auto ]{1,4}", "relevance": 50, "browsers": [ "E79", "S3.1", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-border-width" } ], "description": "The mask-border-width CSS property specifies the width of an element's mask border." }, { "name": "mask-clip", "syntax": "[ <geometry-box> | no-clip ]#", "relevance": 50, "browsers": [ "E79", "FF53", "S4", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-clip" } ], "description": "The mask-clip CSS property determines the area, which is affected by a mask. The painted content of an element must be restricted to this area." }, { "name": "mask-composite", "syntax": "<compositing-operator>#", "relevance": 50, "browsers": [ "E18", "FF53" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/mask-composite" } ], "description": "The mask-composite CSS property represents a compositing operation used on the current mask layer with the mask layers below it." }, { "name": "masonry-auto-flow", "status": "experimental", "syntax": "[ pack | next ] || [ definite-first | ordered ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/masonry-auto-flow" } ], "description": "The masonry-auto-flow CSS property modifies how items are placed when using masonry in CSS Grid Layout." }, { "name": "math-style", "syntax": "normal | compact", "relevance": 50, "browsers": [ "FF83", "S14.1", "C83" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/math-style" } ], "description": "The math-style property indicates whether MathML equations should render with normal or compact height." }, { "name": "max-lines", "status": "experimental", "syntax": "none | <integer>", "relevance": 50, "description": "The max-liens property forces a break after a set number of lines" }, { "name": "offset", "syntax": "[ <'offset-position'>? [ <'offset-path'> [ <'offset-distance'> || <'offset-rotate'> ]? ]? ]! [ / <'offset-anchor'> ]?", "relevance": 50, "browsers": [ "E79", "FF72", "C55", "O42" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/offset" } ], "description": "The offset CSS property is a shorthand property for animating an element along a defined path." }, { "name": "offset-anchor", "syntax": "auto | <position>", "relevance": 50, "browsers": [ "E79", "FF72", "C79" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/offset-anchor" } ], "description": "Defines an anchor point of the box positioned along the path. The anchor point specifies the point of the box which is to be considered as the point that is moved along the path." }, { "name": "offset-distance", "syntax": "<length-percentage>", "relevance": 50, "browsers": [ "E79", "FF72", "C55", "O42" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/offset-distance" } ], "description": "The offset-distance CSS property specifies a position along an offset-path." }, { "name": "offset-path", "syntax": "none | ray( [ <angle> && <size> && contain? ] ) | <path()> | <url> | [ <basic-shape> || <geometry-box> ]", "relevance": 50, "browsers": [ "E79", "FF72", "C55", "O45" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/offset-path" } ], "description": "The offset-path CSS property specifies the offset path where the element gets positioned. The exact element’s position on the offset path is determined by the offset-distance property. An offset path is either a specified path with one or multiple sub-paths or the geometry of a not-styled basic shape. Each shape or path must define an initial position for the computed value of \"0\" for offset-distance and an initial direction which specifies the rotation of the object to the initial position.\n\nIn this specification, a direction (or rotation) of 0 degrees is equivalent to the direction of the positive x-axis in the object’s local coordinate system. In other words, a rotation of 0 degree points to the right side of the UA if the object and its ancestors have no transformation applied." }, { "name": "offset-position", "status": "experimental", "syntax": "auto | <position>", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/offset-position" } ], "description": "Specifies the initial position of the offset path. If position is specified with static, offset-position would be ignored." }, { "name": "offset-rotate", "syntax": "[ auto | reverse ] || <angle>", "relevance": 50, "browsers": [ "E79", "FF72", "C56", "O43" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/offset-rotate" } ], "description": "The offset-rotate CSS property defines the direction of the element while positioning along the offset path." }, { "name": "overflow-anchor", "syntax": "auto | none", "relevance": 52, "browsers": [ "E79", "FF66", "C56", "O43" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overflow-anchor" } ], "description": "The overflow-anchor CSS property provides a way to opt out browser scroll anchoring behavior which adjusts scroll position to minimize content shifts." }, { "name": "overflow-block", "syntax": "visible | hidden | clip | scroll | auto", "relevance": 50, "browsers": [ "FF69" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overflow-block" } ], "description": "The overflow-block CSS media feature can be used to test how the output device handles content that overflows the initial containing block along the block axis." }, { "name": "overflow-clip-box", "status": "nonstandard", "syntax": "padding-box | content-box", "relevance": 0, "browsers": [ "FF29" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Mozilla/Gecko/Chrome/CSS/overflow-clip-box" } ], "description": "The overflow-clip-box CSS property specifies relative to which box the clipping happens when there is an overflow. It is short hand for the overflow-clip-box-inline and overflow-clip-box-block properties." }, { "name": "overflow-clip-margin", "syntax": "<visual-box> || <length [0,∞]>", "relevance": 50, "browsers": [ "E90", "C90", "O76" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overflow-clip-margin" } ], "description": "The overflow-clip-margin CSS property determines how far outside its bounds an element with overflow: clip may be painted before being clipped." }, { "name": "overflow-inline", "syntax": "visible | hidden | clip | scroll | auto", "relevance": 50, "browsers": [ "FF69" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overflow-inline" } ], "description": "The overflow-inline CSS media feature can be used to test how the output device handles content that overflows the initial containing block along the inline axis." }, { "name": "overscroll-behavior", "syntax": "[ contain | none | auto ]{1,2}", "relevance": 50, "browsers": [ "E18", "FF59", "C63", "O50" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior" } ], "description": "The overscroll-behavior CSS property is shorthand for the overscroll-behavior-x and overscroll-behavior-y properties, which allow you to control the browser's scroll overflow behavior — what happens when the boundary of a scrolling area is reached." }, { "name": "overscroll-behavior-block", "syntax": "contain | none | auto", "relevance": 50, "browsers": [ "E79", "FF73", "C77", "O64" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-block" } ], "description": "The overscroll-behavior-block CSS property sets the browser's behavior when the block direction boundary of a scrolling area is reached." }, { "name": "overscroll-behavior-inline", "syntax": "contain | none | auto", "relevance": 50, "browsers": [ "E79", "FF73", "C77", "O64" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-inline" } ], "description": "The overscroll-behavior-inline CSS property sets the browser's behavior when the inline direction boundary of a scrolling area is reached." }, { "name": "overscroll-behavior-x", "syntax": "contain | none | auto", "relevance": 50, "browsers": [ "E18", "FF59", "C63", "O50" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-x" } ], "description": "The overscroll-behavior-x CSS property is allows you to control the browser's scroll overflow behavior — what happens when the boundary of a scrolling area is reached — in the x axis direction." }, { "name": "overscroll-behavior-y", "syntax": "contain | none | auto", "relevance": 50, "browsers": [ "E18", "FF59", "C63", "O50" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-y" } ], "description": "The overscroll-behavior-y CSS property is allows you to control the browser's scroll overflow behavior — what happens when the boundary of a scrolling area is reached — in the y axis direction." }, { "name": "padding-block", "syntax": "<'padding-left'>{1,2}", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding-block" } ], "description": "The padding-block CSS property defines the logical block start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation." }, { "name": "padding-inline", "syntax": "<'padding-left'>{1,2}", "relevance": 50, "browsers": [ "E87", "FF66", "S14.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/padding-inline" } ], "description": "The padding-inline CSS property defines the logical inline start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation." }, { "name": "place-content", "syntax": "<'align-content'> <'justify-content'>?", "relevance": 50, "browsers": [ "E79", "FF45", "S9", "C59", "O46" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/place-content" } ], "description": "The place-content CSS shorthand property sets both the align-content and justify-content properties." }, { "name": "place-items", "syntax": "<'align-items'> <'justify-items'>?", "relevance": 50, "browsers": [ "E79", "FF45", "S11", "C59", "O46" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/place-items" } ], "description": "The CSS place-items shorthand property sets both the align-items and justify-items properties. The first value is the align-items property value, the second the justify-items one. If the second value is not present, the first value is also used for it." }, { "name": "place-self", "syntax": "<'align-self'> <'justify-self'>?", "relevance": 50, "browsers": [ "E79", "FF45", "S11", "C59", "O46" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/place-self" } ], "description": "The place-self CSS property is a shorthand property sets both the align-self and justify-self properties. The first value is the align-self property value, the second the justify-self one. If the second value is not present, the first value is also used for it." }, { "name": "rotate", "syntax": "none | <angle> | [ x | y | z | <number>{3} ] && <angle>", "relevance": 50, "browsers": [ "FF72", "S14.1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/rotate" } ], "description": "The rotate CSS property allows you to specify rotation transforms individually and independently of the transform property. This maps better to typical user interface usage, and saves having to remember the exact order of transform functions to specify in the transform value." }, { "name": "row-gap", "syntax": "normal | <length-percentage>", "relevance": 50, "browsers": [ "E84", "FF63", "S14.1", "C84", "O70" ], "description": "The row-gap CSS property specifies the gutter between grid rows." }, { "name": "ruby-merge", "status": "experimental", "syntax": "separate | collapse | auto", "relevance": 50, "description": "This property controls how ruby annotation boxes should be rendered when there are more than one in a ruby container box: whether each pair should be kept separate, the annotations should be collapsed and rendered as a group, or the separation should be determined based on the space available." }, { "name": "scale", "syntax": "none | <number>{1,3}", "relevance": 50, "browsers": [ "FF72", "S14.1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scale" } ], "description": "The scale CSS property allows you to specify scale transforms individually and independently of the transform property. This maps better to typical user interface usage, and saves having to remember the exact order of transform functions to specify in the transform value." }, { "name": "scrollbar-color", "syntax": "auto | <color>{2}", "relevance": 50, "browsers": [ "FF64" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scrollbar-color" } ], "description": "The scrollbar-color CSS property sets the color of the scrollbar track and thumb." }, { "name": "scrollbar-gutter", "syntax": "auto | stable && both-edges?", "relevance": 50, "browsers": [ "E94", "FF97", "C94", "O80" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scrollbar-gutter" } ], "description": "The scrollbar-gutter CSS property allows authors to reserve space for the scrollbar, preventing unwanted layout changes as the content grows while also avoiding unnecessary visuals when scrolling isn't needed." }, { "name": "scrollbar-width", "syntax": "auto | thin | none", "relevance": 50, "browsers": [ "FF64" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scrollbar-width" } ], "description": "The scrollbar-width property allows the author to set the maximum thickness of an element’s scrollbars when they are shown. " }, { "name": "scroll-margin", "syntax": "<length>{1,4}", "relevance": 50, "browsers": [ "E79", "FF90", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin" } ], "description": "The scroll-margin property is a shorthand property which sets all of the scroll-margin longhands, assigning values much like the margin property does for the margin-* longhands." }, { "name": "scroll-margin-block", "syntax": "<length>{1,2}", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block" } ], "description": "The scroll-margin-block property is a shorthand property which sets the scroll-margin longhands in the block dimension." }, { "name": "scroll-margin-block-start", "syntax": "<length>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-start" } ], "description": "The scroll-margin-block-start property defines the margin of the scroll snap area at the start of the block dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets." }, { "name": "scroll-margin-block-end", "syntax": "<length>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-end" } ], "description": "The scroll-margin-block-end property defines the margin of the scroll snap area at the end of the block dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets." }, { "name": "scroll-margin-bottom", "syntax": "<length>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-bottom" } ], "description": "The scroll-margin-bottom property defines the bottom margin of the scroll snap area that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets." }, { "name": "scroll-margin-inline", "syntax": "<length>{1,2}", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline" } ], "description": "The scroll-margin-inline property is a shorthand property which sets the scroll-margin longhands in the inline dimension." }, { "name": "scroll-margin-inline-start", "syntax": "<length>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-start" } ], "description": "The scroll-margin-inline-start property defines the margin of the scroll snap area at the start of the inline dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets." }, { "name": "scroll-margin-inline-end", "syntax": "<length>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-end" } ], "description": "The scroll-margin-inline-end property defines the margin of the scroll snap area at the end of the inline dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets." }, { "name": "scroll-margin-left", "syntax": "<length>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-left" } ], "description": "The scroll-margin-left property defines the left margin of the scroll snap area that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets." }, { "name": "scroll-margin-right", "syntax": "<length>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-right" } ], "description": "The scroll-margin-right property defines the right margin of the scroll snap area that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets." }, { "name": "scroll-margin-top", "syntax": "<length>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-margin-top" } ], "description": "The scroll-margin-top property defines the top margin of the scroll snap area that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets." }, { "name": "scroll-padding", "syntax": "[ auto | <length-percentage> ]{1,4}", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding" } ], "description": "The scroll-padding property is a shorthand property which sets all of the scroll-padding longhands, assigning values much like the padding property does for the padding-* longhands." }, { "name": "scroll-padding-block", "syntax": "[ auto | <length-percentage> ]{1,2}", "relevance": 50, "browsers": [ "E79", "FF68", "S15", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block" } ], "description": "The scroll-padding-block property is a shorthand property which sets the scroll-padding longhands for the block dimension." }, { "name": "scroll-padding-block-start", "syntax": "auto | <length-percentage>", "relevance": 50, "browsers": [ "E79", "FF68", "S15", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-start" } ], "description": "The scroll-padding-block-start property defines offsets for the start edge in the block dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport." }, { "name": "scroll-padding-block-end", "syntax": "auto | <length-percentage>", "relevance": 50, "browsers": [ "E79", "FF68", "S15", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-end" } ], "description": "The scroll-padding-block-end property defines offsets for the end edge in the block dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport." }, { "name": "scroll-padding-bottom", "syntax": "auto | <length-percentage>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-bottom" } ], "description": "The scroll-padding-bottom property defines offsets for the bottom of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport." }, { "name": "scroll-padding-inline", "syntax": "[ auto | <length-percentage> ]{1,2}", "relevance": 50, "browsers": [ "E79", "FF68", "S15", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline" } ], "description": "The scroll-padding-inline property is a shorthand property which sets the scroll-padding longhands for the inline dimension." }, { "name": "scroll-padding-inline-start", "syntax": "auto | <length-percentage>", "relevance": 50, "browsers": [ "E79", "FF68", "S15", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-start" } ], "description": "The scroll-padding-inline-start property defines offsets for the start edge in the inline dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport." }, { "name": "scroll-padding-inline-end", "syntax": "auto | <length-percentage>", "relevance": 50, "browsers": [ "E79", "FF68", "S15", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-end" } ], "description": "The scroll-padding-inline-end property defines offsets for the end edge in the inline dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport." }, { "name": "scroll-padding-left", "syntax": "auto | <length-percentage>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-left" } ], "description": "The scroll-padding-left property defines offsets for the left of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport." }, { "name": "scroll-padding-right", "syntax": "auto | <length-percentage>", "relevance": 50, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-right" } ], "description": "The scroll-padding-right property defines offsets for the right of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport." }, { "name": "scroll-padding-top", "syntax": "auto | <length-percentage>", "relevance": 51, "browsers": [ "E79", "FF68", "S14.1", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-padding-top" } ], "description": "The scroll-padding-top property defines offsets for the top of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport." }, { "name": "scroll-snap-align", "syntax": "[ none | start | end | center ]{1,2}", "relevance": 53, "browsers": [ "E79", "FF68", "S11", "C69", "O56" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-align" } ], "description": "The scroll-snap-align property specifies the box’s snap position as an alignment of its snap area (as the alignment subject) within its snap container’s snapport (as the alignment container). The two values specify the snapping alignment in the block axis and inline axis, respectively. If only one value is specified, the second value defaults to the same value." }, { "name": "scroll-snap-stop", "syntax": "normal | always", "relevance": 50, "browsers": [ "E79", "S15", "C75", "O62" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-stop" } ], "description": "The scroll-snap-stop CSS property defines whether the scroll container is allowed to \"pass over\" possible snap positions." }, { "name": "scroll-snap-type-x", "status": "obsolete", "syntax": "none | mandatory | proximity", "relevance": 0, "browsers": [ "FF39", "S9" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-x" } ], "description": "The scroll-snap-type-x CSS property defines how strictly snap points are enforced on the horizontal axis of the scroll container in case there is one.\n\nSpecifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent." }, { "name": "scroll-snap-type-y", "status": "obsolete", "syntax": "none | mandatory | proximity", "relevance": 0, "browsers": [ "FF39" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-y" } ], "description": "The scroll-snap-type-y CSS property defines how strictly snap points are enforced on the vertical axis of the scroll container in case there is one.\n\nSpecifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent." }, { "name": "text-combine-upright", "syntax": "none | all | [ digits <integer>? ]", "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-combine-upright" } ], "description": "The text-combine-upright CSS property specifies the combination of multiple characters into the space of a single character. If the combined text is wider than 1em, the user agent must fit the contents within 1em. The resulting composition is treated as a single upright glyph for layout and decoration. This property only has an effect in vertical writing modes.\n\nThis is used to produce an effect that is known as tate-chū-yoko (縦中横) in Japanese, or as 直書橫向 in Chinese." }, { "name": "text-decoration-skip", "status": "experimental", "syntax": "none | [ objects || [ spaces | [ leading-spaces || trailing-spaces ] ] || edges || box-decoration ]", "relevance": 52, "browsers": [ "S12.1", "C57", "O44" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip" } ], "description": "The text-decoration-skip CSS property specifies what parts of the element’s content any text decoration affecting the element must skip over. It controls all text decoration lines drawn by the element and also any text decoration lines drawn by its ancestors." }, { "name": "text-decoration-skip-ink", "syntax": "auto | all | none", "relevance": 50, "browsers": [ "E79", "FF70", "Spreview", "C64", "O50" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip-ink" } ], "description": "The text-decoration-skip-ink CSS property specifies how overlines and underlines are drawn when they pass over glyph ascenders and descenders." }, { "name": "text-decoration-thickness", "syntax": "auto | from-font | <length> | <percentage> ", "relevance": 50, "browsers": [ "E89", "FF70", "S12.1", "C89", "O75" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-decoration-thickness" } ], "description": "The text-decoration-thickness CSS property sets the thickness, or width, of the decoration line that is used on text in an element, such as a line-through, underline, or overline." }, { "name": "text-emphasis", "syntax": "<'text-emphasis-style'> || <'text-emphasis-color'>", "relevance": 50, "browsers": [ "E79", "FF46", "S7", "C25", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-emphasis" } ], "description": "The text-emphasis CSS property is a shorthand property for setting text-emphasis-style and text-emphasis-color in one declaration. This property will apply the specified emphasis mark to each character of the element's text, except separator characters, like spaces, and control characters." }, { "name": "text-emphasis-color", "syntax": "<color>", "relevance": 50, "browsers": [ "E79", "FF46", "S7", "C25", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-color" } ], "description": "The text-emphasis-color CSS property defines the color used to draw emphasis marks on text being rendered in the HTML document. This value can also be set and reset using the text-emphasis shorthand." }, { "name": "text-emphasis-position", "syntax": "[ over | under ] && [ right | left ]", "relevance": 50, "browsers": [ "E79", "FF46", "S7", "C25", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-position" } ], "description": "The text-emphasis-position CSS property describes where emphasis marks are drawn at. The effect of emphasis marks on the line height is the same as for ruby text: if there isn't enough place, the line height is increased." }, { "name": "text-emphasis-style", "syntax": "none | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>", "relevance": 50, "browsers": [ "E79", "FF46", "S7", "C25", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-emphasis-style" } ], "description": "The text-emphasis-style CSS property defines the type of emphasis used. It can also be set, and reset, using the text-emphasis shorthand." }, { "name": "text-size-adjust", "status": "experimental", "syntax": "none | auto | <percentage>", "relevance": 57, "browsers": [ "E79", "C54", "O41" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-size-adjust" } ], "description": "The text-size-adjust CSS property controls the text inflation algorithm used on some smartphones and tablets. Other browsers will ignore this property." }, { "name": "text-underline-offset", "syntax": "auto | <length> | <percentage> ", "relevance": 50, "browsers": [ "E87", "FF70", "S12.1", "C87", "O73" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/text-underline-offset" } ], "description": "The text-underline-offset CSS property sets the offset distance of an underline text decoration line (applied using text-decoration) from its original position." }, { "name": "transform-box", "syntax": "content-box | border-box | fill-box | stroke-box | view-box", "relevance": 50, "browsers": [ "E79", "FF55", "S11", "C64", "O51" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/transform-box" } ], "description": "The transform-box CSS property defines the layout box to which the transform and transform-origin properties relate." }, { "name": "translate", "syntax": "none | <length-percentage> [ <length-percentage> <length>? ]?", "relevance": 50, "browsers": [ "FF72", "S14.1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/translate" } ], "description": "The translate CSS property allows you to specify translation transforms individually and independently of the transform property. This maps better to typical user interface usage, and saves having to remember the exact order of transform functions to specify in the transform value." }, { "name": "speak-as", "syntax": "auto | bullets | numbers | words | spell-out | <counter-style-name>", "relevance": 50, "description": "The speak-as descriptor specifies how a counter symbol constructed with a given @counter-style will be represented in the spoken form. For example, an author can specify a counter symbol to be either spoken as its numerical value or just represented with an audio cue." }, { "name": "ascent-override", "status": "experimental", "syntax": "normal | <percentage>", "relevance": 50, "description": "Describes the ascent metric of a font." }, { "name": "descent-override", "status": "experimental", "syntax": "normal | <percentage>", "relevance": 50, "description": "Describes the descent metric of a font." }, { "name": "font-display", "status": "experimental", "syntax": "[ auto | block | swap | fallback | optional ]", "relevance": 71, "description": "The font-display descriptor determines how a font face is displayed based on whether and when it is downloaded and ready to use." }, { "name": "line-gap-override", "status": "experimental", "syntax": "normal | <percentage>", "relevance": 50, "description": "Describes the line-gap metric of a font." }, { "name": "size-adjust", "status": "experimental", "syntax": "<percentage>", "relevance": 50, "description": "A multiplier for glyph outlines and metrics of a font." }, { "name": "bleed", "syntax": "auto | <length>", "relevance": 50, "description": "The bleed CSS at-rule descriptor, used with the @page at-rule, specifies the extent of the page bleed area outside the page box. This property only has effect if crop marks are enabled using the marks property." }, { "name": "marks", "syntax": "none | [ crop || cross ]", "relevance": 50, "description": "The marks CSS at-rule descriptor, used with the @page at-rule, adds crop and/or cross marks to the presentation of the document. Crop marks indicate where the page should be cut. Cross marks are used to align sheets." }, { "name": "syntax", "status": "experimental", "syntax": "<string>", "relevance": 50, "description": "Specifies the syntax of the custom property registration represented by the @property rule, controlling how the property’s value is parsed at computed value time." }, { "name": "inherits", "status": "experimental", "syntax": "true | false", "relevance": 50, "description": "Specifies the inherit flag of the custom property registration represented by the @property rule, controlling whether or not the property inherits by default." }, { "name": "initial-value", "status": "experimental", "syntax": "<string>", "relevance": 50, "description": "Specifies the initial value of the custom property registration represented by the @property rule, controlling the property’s initial value." }, { "name": "max-zoom", "syntax": "auto | <number> | <percentage>", "relevance": 50, "description": "The max-zoom CSS descriptor sets the maximum zoom factor of a document defined by the @viewport at-rule. The browser will not zoom in any further than this, whether automatically or at the user's request.\n\nA zoom factor of 1.0 or 100% corresponds to no zooming. Larger values are zoomed in. Smaller values are zoomed out." }, { "name": "min-zoom", "syntax": "auto | <number> | <percentage>", "relevance": 50, "description": "The min-zoom CSS descriptor sets the minimum zoom factor of a document defined by the @viewport at-rule. The browser will not zoom out any further than this, whether automatically or at the user's request.\n\nA zoom factor of 1.0 or 100% corresponds to no zooming. Larger values are zoomed in. Smaller values are zoomed out." }, { "name": "orientation", "syntax": "auto | portrait | landscape", "relevance": 50, "description": "The orientation CSS @media media feature can be used to apply styles based on the orientation of the viewport (or the page box, for paged media)." }, { "name": "user-zoom", "syntax": "zoom | fixed", "relevance": 50, "description": "The user-zoom CSS descriptor controls whether or not the user can change the zoom factor of a document defined by @viewport." }, { "name": "viewport-fit", "syntax": "auto | contain | cover", "relevance": 50, "description": "The border-block-style CSS property defines the style of the logical block borders of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation." } ], "atDirectives": [ { "name": "@charset", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/@charset" } ], "description": "Defines character set of the document." }, { "name": "@counter-style", "browsers": [ "E91", "FF33", "C91", "O77" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/@counter-style" } ], "description": "Defines a custom counter style." }, { "name": "@font-face", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/@font-face" } ], "description": "Allows for linking to fonts that are automatically activated when needed. This permits authors to work around the limitation of 'web-safe' fonts, allowing for consistent rendering independent of the fonts available in a given user's environment." }, { "name": "@font-feature-values", "browsers": [ "FF34", "S9.1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/@font-feature-values" } ], "description": "Defines named values for the indices used to select alternate glyphs for a given font family." }, { "name": "@import", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/@import" } ], "description": "Includes content of another file." }, { "name": "@keyframes", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/@keyframes" } ], "description": "Defines set of animation key frames." }, { "name": "@media", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/@media" } ], "description": "Defines a stylesheet for a particular media type." }, { "name": "@-moz-document", "browsers": [ "FF1.8" ], "description": "Gecko-specific at-rule that restricts the style rules contained within it based on the URL of the document." }, { "name": "@-moz-keyframes", "browsers": [ "FF5" ], "description": "Defines set of animation key frames." }, { "name": "@-ms-viewport", "browsers": [ "E", "IE10" ], "description": "Specifies the size, zoom factor, and orientation of the viewport." }, { "name": "@namespace", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/@namespace" } ], "description": "Declares a prefix and associates it with a namespace name." }, { "name": "@-o-keyframes", "browsers": [ "O12" ], "description": "Defines set of animation key frames." }, { "name": "@-o-viewport", "browsers": [ "O11" ], "description": "Specifies the size, zoom factor, and orientation of the viewport." }, { "name": "@page", "browsers": [ "E12", "FF19", "C2", "IE8", "O6" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/@page" } ], "description": "Directive defines various page parameters." }, { "name": "@supports", "browsers": [ "E12", "FF22", "S9", "C28", "O12.1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/@supports" } ], "description": "A conditional group rule whose condition tests whether the user agent supports CSS property:value pairs." }, { "name": "@-webkit-keyframes", "browsers": [ "C", "S4" ], "description": "Defines set of animation key frames." } ], "pseudoClasses": [ { "name": ":active", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:active" } ], "description": "Applies while an element is being activated by the user. For example, between the times the user presses the mouse button and releases it." }, { "name": ":any-link", "browsers": [ "E79", "FF50", "S9", "C65", "O52" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:any-link" } ], "description": "Represents an element that acts as the source anchor of a hyperlink. Applies to both visited and unvisited links." }, { "name": ":checked", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:checked" } ], "description": "Radio and checkbox elements can be toggled by the user. Some menu items are 'checked' when the user selects them. When such elements are toggled 'on' the :checked pseudo-class applies." }, { "name": ":corner-present", "browsers": [ "C", "S5" ], "description": "Non-standard. Indicates whether or not a scrollbar corner is present." }, { "name": ":decrement", "browsers": [ "C", "S5" ], "description": "Non-standard. Applies to buttons and track pieces. Indicates whether or not the button or track piece will decrement the view’s position when used." }, { "name": ":default", "browsers": [ "E79", "FF4", "S5", "C10", "O10" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:default" } ], "description": "Applies to the one or more UI elements that are the default among a set of similar elements. Typically applies to context menu items, buttons, and select lists/menus." }, { "name": ":disabled", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:disabled" } ], "description": "Represents user interface elements that are in a disabled state; such elements have a corresponding enabled state." }, { "name": ":double-button", "browsers": [ "C", "S5" ], "description": "Non-standard. Applies to buttons and track pieces. Applies when both buttons are displayed together at the same end of the scrollbar." }, { "name": ":empty", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:empty" } ], "description": "Represents an element that has no children at all." }, { "name": ":enabled", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:enabled" } ], "description": "Represents user interface elements that are in an enabled state; such elements have a corresponding disabled state." }, { "name": ":end", "browsers": [ "C", "S5" ], "description": "Non-standard. Applies to buttons and track pieces. Indicates whether the object is placed after the thumb." }, { "name": ":first", "browsers": [ "E12", "S6", "C18", "IE8", "O9.2" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:first" } ], "description": "When printing double-sided documents, the page boxes on left and right pages may be different. This can be expressed through CSS pseudo-classes defined in the page context." }, { "name": ":first-child", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:first-child" } ], "description": "Same as :nth-child(1). Represents an element that is the first child of some other element." }, { "name": ":first-of-type", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:first-of-type" } ], "description": "Same as :nth-of-type(1). Represents an element that is the first sibling of its type in the list of children of its parent element." }, { "name": ":focus", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:focus" } ], "description": "Applies while an element has the focus (accepts keyboard or mouse events, or other forms of input)." }, { "name": ":fullscreen", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:fullscreen" } ], "description": "Matches any element that has its fullscreen flag set." }, { "name": ":future", "browsers": [ "S7" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:future" } ], "description": "Represents any element that is defined to occur entirely after a :current element." }, { "name": ":horizontal", "browsers": [ "C", "S5" ], "description": "Non-standard. Applies to any scrollbar pieces that have a horizontal orientation." }, { "name": ":host", "browsers": [ "E79", "FF63", "S10", "C54", "O41" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:host" } ], "description": "When evaluated in the context of a shadow tree, matches the shadow tree’s host element." }, { "name": ":host()", "browsers": [ "C35", "O22" ], "description": "When evaluated in the context of a shadow tree, it matches the shadow tree’s host element if the host element, in its normal context, matches the selector argument." }, { "name": ":host-context()", "browsers": [ "C35", "O22" ], "description": "Tests whether there is an ancestor, outside the shadow tree, which matches a particular selector." }, { "name": ":hover", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:hover" } ], "description": "Applies while the user designates an element with a pointing device, but does not necessarily activate it. For example, a visual user agent could apply this pseudo-class when the cursor (mouse pointer) hovers over a box generated by the element." }, { "name": ":increment", "browsers": [ "C", "S5" ], "description": "Non-standard. Applies to buttons and track pieces. Indicates whether or not the button or track piece will increment the view’s position when used." }, { "name": ":indeterminate", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:indeterminate" } ], "description": "Applies to UI elements whose value is in an indeterminate state." }, { "name": ":in-range", "browsers": [ "E13", "FF29", "S5.1", "C10", "O11" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:in-range" } ], "description": "Used in conjunction with the min and max attributes, whether on a range input, a number field, or any other types that accept those attributes." }, { "name": ":invalid", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:invalid" } ], "description": "An element is :valid or :invalid when it is, respectively, valid or invalid with respect to data validity semantics defined by a different specification." }, { "name": ":lang()", "browsers": [ "E", "C", "FF1", "IE8", "O8", "S3" ], "description": "Represents an element that is in language specified." }, { "name": ":last-child", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:last-child" } ], "description": "Same as :nth-last-child(1). Represents an element that is the last child of some other element." }, { "name": ":last-of-type", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:last-of-type" } ], "description": "Same as :nth-last-of-type(1). Represents an element that is the last sibling of its type in the list of children of its parent element." }, { "name": ":left", "browsers": [ "E12", "S5.1", "C6", "IE8", "O9.2" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:left" } ], "description": "When printing double-sided documents, the page boxes on left and right pages may be different. This can be expressed through CSS pseudo-classes defined in the page context." }, { "name": ":link", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:link" } ], "description": "Applies to links that have not yet been visited." }, { "name": ":matches()", "browsers": [ "S9" ], "description": "Takes a selector list as its argument. It represents an element that is represented by its argument." }, { "name": ":-moz-any()", "browsers": [ "FF4" ], "description": "Represents an element that is represented by the selector list passed as its argument. Standardized as :matches()." }, { "name": ":-moz-any-link", "browsers": [ "FF1" ], "description": "Represents an element that acts as the source anchor of a hyperlink. Applies to both visited and unvisited links." }, { "name": ":-moz-broken", "browsers": [ "FF3" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:-moz-broken" } ], "description": "Non-standard. Matches elements representing broken images." }, { "name": ":-moz-drag-over", "browsers": [ "FF1" ], "description": "Non-standard. Matches elements when a drag-over event applies to it." }, { "name": ":-moz-first-node", "browsers": [ "FF1" ], "description": "Non-standard. Represents an element that is the first child node of some other element." }, { "name": ":-moz-focusring", "browsers": [ "FF4" ], "description": "Non-standard. Matches an element that has focus and focus ring drawing is enabled in the browser." }, { "name": ":-moz-full-screen", "browsers": [ "FF9" ], "description": "Matches any element that has its fullscreen flag set. Standardized as :fullscreen." }, { "name": ":-moz-last-node", "browsers": [ "FF1" ], "description": "Non-standard. Represents an element that is the last child node of some other element." }, { "name": ":-moz-loading", "browsers": [ "FF3" ], "description": "Non-standard. Matches elements, such as images, that haven’t started loading yet." }, { "name": ":-moz-only-whitespace", "browsers": [ "FF1" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:-moz-only-whitespace" } ], "description": "The same as :empty, except that it additionally matches elements that only contain code points affected by whitespace processing. Standardized as :blank." }, { "name": ":-moz-placeholder", "browsers": [ "FF4" ], "description": "Deprecated. Represents placeholder text in an input field. Use ::-moz-placeholder for Firefox 19+." }, { "name": ":-moz-submit-invalid", "browsers": [ "FF88" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:-moz-submit-invalid" } ], "description": "Non-standard. Represents any submit button when the contents of the associated form are not valid." }, { "name": ":-moz-suppressed", "browsers": [ "FF3" ], "description": "Non-standard. Matches elements representing images that have been blocked from loading." }, { "name": ":-moz-ui-invalid", "browsers": [ "FF4" ], "description": "Non-standard. Represents any validated form element whose value isn't valid " }, { "name": ":-moz-ui-valid", "browsers": [ "FF4" ], "description": "Non-standard. Represents any validated form element whose value is valid " }, { "name": ":-moz-user-disabled", "browsers": [ "FF3" ], "description": "Non-standard. Matches elements representing images that have been disabled due to the user’s preferences." }, { "name": ":-moz-window-inactive", "browsers": [ "FF4" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:-moz-window-inactive" } ], "description": "Non-standard. Matches elements in an inactive window." }, { "name": ":-ms-fullscreen", "browsers": [ "IE11" ], "description": "Matches any element that has its fullscreen flag set." }, { "name": ":-ms-input-placeholder", "browsers": [ "IE10" ], "description": "Represents placeholder text in an input field. Note: for Edge use the pseudo-element ::-ms-input-placeholder. Standardized as ::placeholder." }, { "name": ":-ms-keyboard-active", "browsers": [ "IE10" ], "description": "Windows Store apps only. Applies one or more styles to an element when it has focus and the user presses the space bar." }, { "name": ":-ms-lang()", "browsers": [ "E", "IE10" ], "description": "Represents an element that is in the language specified. Accepts a comma separated list of language tokens." }, { "name": ":no-button", "browsers": [ "C", "S5" ], "description": "Non-standard. Applies to track pieces. Applies when there is no button at that end of the track." }, { "name": ":not()", "browsers": [ "E", "C", "FF1", "IE9", "O9.5", "S2" ], "description": "The negation pseudo-class, :not(X), is a functional notation taking a simple selector (excluding the negation pseudo-class itself) as an argument. It represents an element that is not represented by its argument." }, { "name": ":nth-child()", "browsers": [ "E", "C", "FF3.5", "IE9", "O9.5", "S3.1" ], "description": "Represents an element that has an+b-1 siblings before it in the document tree, for any positive integer or zero value of n, and has a parent element." }, { "name": ":nth-last-child()", "browsers": [ "E", "C", "FF3.5", "IE9", "O9.5", "S3.1" ], "description": "Represents an element that has an+b-1 siblings after it in the document tree, for any positive integer or zero value of n, and has a parent element." }, { "name": ":nth-last-of-type()", "browsers": [ "E", "C", "FF3.5", "IE9", "O9.5", "S3.1" ], "description": "Represents an element that has an+b-1 siblings with the same expanded element name after it in the document tree, for any zero or positive integer value of n, and has a parent element." }, { "name": ":nth-of-type()", "browsers": [ "E", "C", "FF3.5", "IE9", "O9.5", "S3.1" ], "description": "Represents an element that has an+b-1 siblings with the same expanded element name before it in the document tree, for any zero or positive integer value of n, and has a parent element." }, { "name": ":only-child", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:only-child" } ], "description": "Represents an element that has a parent element and whose parent element has no other element children. Same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity." }, { "name": ":only-of-type", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:only-of-type" } ], "description": "Matches every element that is the only child of its type, of its parent. Same as :first-of-type:last-of-type or :nth-of-type(1):nth-last-of-type(1), but with a lower specificity." }, { "name": ":optional", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:optional" } ], "description": "A form element is :required or :optional if a value for it is, respectively, required or optional before the form it belongs to is submitted. Elements that are not form elements are neither required nor optional." }, { "name": ":out-of-range", "browsers": [ "E13", "FF29", "S5.1", "C10", "O11" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:out-of-range" } ], "description": "Used in conjunction with the min and max attributes, whether on a range input, a number field, or any other types that accept those attributes." }, { "name": ":past", "browsers": [ "S7" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:past" } ], "description": "Represents any element that is defined to occur entirely prior to a :current element." }, { "name": ":read-only", "browsers": [ "E13", "FF78", "S4", "C1", "O9" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:read-only" } ], "description": "An element whose contents are not user-alterable is :read-only. However, elements whose contents are user-alterable (such as text input fields) are considered to be in a :read-write state. In typical documents, most elements are :read-only." }, { "name": ":read-write", "browsers": [ "E13", "FF78", "S4", "C1", "O9" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:read-write" } ], "description": "An element whose contents are not user-alterable is :read-only. However, elements whose contents are user-alterable (such as text input fields) are considered to be in a :read-write state. In typical documents, most elements are :read-only." }, { "name": ":required", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:required" } ], "description": "A form element is :required or :optional if a value for it is, respectively, required or optional before the form it belongs to is submitted. Elements that are not form elements are neither required nor optional." }, { "name": ":right", "browsers": [ "E12", "S5.1", "C6", "IE8", "O9.2" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:right" } ], "description": "When printing double-sided documents, the page boxes on left and right pages may be different. This can be expressed through CSS pseudo-classes defined in the page context." }, { "name": ":root", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:root" } ], "description": "Represents an element that is the root of the document. In HTML 4, this is always the HTML element." }, { "name": ":scope", "browsers": [ "E79", "FF32", "S7", "C27", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:scope" } ], "description": "Represents any element that is in the contextual reference element set." }, { "name": ":single-button", "browsers": [ "C", "S5" ], "description": "Non-standard. Applies to buttons and track pieces. Applies when both buttons are displayed separately at either end of the scrollbar." }, { "name": ":start", "browsers": [ "C", "S5" ], "description": "Non-standard. Applies to buttons and track pieces. Indicates whether the object is placed before the thumb." }, { "name": ":target", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:target" } ], "description": "Some URIs refer to a location within a resource. This kind of URI ends with a 'number sign' (#) followed by an anchor identifier (called the fragment identifier)." }, { "name": ":valid", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:valid" } ], "description": "An element is :valid or :invalid when it is, respectively, valid or invalid with respect to data validity semantics defined by a different specification." }, { "name": ":vertical", "browsers": [ "C", "S5" ], "description": "Non-standard. Applies to any scrollbar pieces that have a vertical orientation." }, { "name": ":visited", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:visited" } ], "description": "Applies once the link has been visited by the user." }, { "name": ":-webkit-any()", "browsers": [ "C", "S5" ], "description": "Represents an element that is represented by the selector list passed as its argument. Standardized as :matches()." }, { "name": ":-webkit-full-screen", "browsers": [ "C", "S6" ], "description": "Matches any element that has its fullscreen flag set. Standardized as :fullscreen." }, { "name": ":window-inactive", "browsers": [ "C", "S3" ], "description": "Non-standard. Applies to all scrollbar pieces. Indicates whether or not the window containing the scrollbar is currently active." }, { "name": ":current", "status": "experimental", "description": "The :current CSS pseudo-class selector is a time-dimensional pseudo-class that represents the element, or an ancestor of the element, that is currently being displayed" }, { "name": ":blank", "status": "experimental", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:blank" } ], "description": "The :blank CSS pseudo-class selects empty user input elements (eg. <input> or <textarea>)." }, { "name": ":defined", "status": "experimental", "browsers": [ "E79", "FF63", "S10", "C54", "O41" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:defined" } ], "description": "The :defined CSS pseudo-class represents any element that has been defined. This includes any standard element built in to the browser, and custom elements that have been successfully defined (i.e. with the CustomElementRegistry.define() method)." }, { "name": ":dir", "browsers": [ "FF49" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:dir" } ], "description": "The :dir() CSS pseudo-class matches elements based on the directionality of the text contained in them." }, { "name": ":focus-visible", "browsers": [ "E86", "FF85", "C86", "O72" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:focus-visible" } ], "description": "The :focus-visible pseudo-class applies while an element matches the :focus pseudo-class and the UA determines via heuristics that the focus should be made evident on the element." }, { "name": ":focus-within", "browsers": [ "E79", "FF52", "S10.1", "C60", "O47" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:focus-within" } ], "description": "The :focus-within pseudo-class applies to any element for which the :focus pseudo class applies as well as to an element whose descendant in the flat tree (including non-element nodes, such as text nodes) matches the conditions for matching :focus." }, { "name": ":has", "status": "experimental", "browsers": [ "Spreview" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:has" } ], "description": ":The :has() CSS pseudo-class represents an element if any of the selectors passed as parameters (relative to the :scope of the given element), match at least one element." }, { "name": ":is", "status": "experimental", "browsers": [ "E88", "FF78", "S14", "C88", "O74" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:is" } ], "description": "The :is() CSS pseudo-class function takes a selector list as its argument, and selects any element that can be selected by one of the selectors in that list. This is useful for writing large selectors in a more compact form." }, { "name": ":local-link", "status": "experimental", "description": "The :local-link CSS pseudo-class represents an link to the same document" }, { "name": ":nth-col", "status": "experimental", "description": "The :nth-col() CSS pseudo-class is designed for tables and grids. It accepts the An+B notation such as used with the :nth-child selector, using this to target every nth column. " }, { "name": ":nth-last-col", "status": "experimental", "description": "The :nth-last-col() CSS pseudo-class is designed for tables and grids. It accepts the An+B notation such as used with the :nth-child selector, using this to target every nth column before it, therefore counting back from the end of the set of columns." }, { "name": ":paused", "status": "experimental", "description": "The :paused CSS pseudo-class selector is a resource state pseudo-class that will match an audio, video, or similar resource that is capable of being “played” or “paused”, when that element is “paused”." }, { "name": ":placeholder-shown", "status": "experimental", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:placeholder-shown" } ], "description": "The :placeholder-shown CSS pseudo-class represents any <input> or <textarea> element that is currently displaying placeholder text." }, { "name": ":playing", "status": "experimental", "description": "The :playing CSS pseudo-class selector is a resource state pseudo-class that will match an audio, video, or similar resource that is capable of being “played” or “paused”, when that element is “playing”. " }, { "name": ":target-within", "status": "experimental", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:target-within" } ], "description": "The :target-within CSS pseudo-class represents an element that is a target element or contains an element that is a target. A target element is a unique element with an id matching the URL's fragment." }, { "name": ":user-invalid", "status": "experimental", "browsers": [ "FF88" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:user-invalid" } ], "description": "The :user-invalid CSS pseudo-class represents any validated form element whose value isn't valid based on their validation constraints, after the user has interacted with it." }, { "name": ":user-valid", "status": "experimental", "browsers": [ "FF88" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:user-valid" } ], "description": "The :user-valid CSS pseudo-class represents any validated form element whose value validates correctly based on its validation constraints. However, unlike :valid it only matches once the user has interacted with it." }, { "name": ":where", "status": "experimental", "browsers": [ "E88", "FF78", "S14", "C88", "O74" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/:where" } ], "description": "The :where() CSS pseudo-class function takes a selector list as its argument, and selects any element that can be selected by one of the selectors in that list." }, { "name": ":picture-in-picture", "status": "experimental", "description": "The :picture-in-picture CSS pseudo-class matches the element which is currently in picture-in-picture mode." } ], "pseudoElements": [ { "name": "::after", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::after" } ], "description": "Represents a styleable child pseudo-element immediately after the originating element’s actual content." }, { "name": "::backdrop", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::backdrop" } ], "description": "Used to create a backdrop that hides the underlying document for an element in a top layer (such as an element that is displayed fullscreen)." }, { "name": "::before", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::before" } ], "description": "Represents a styleable child pseudo-element immediately before the originating element’s actual content." }, { "name": "::content", "browsers": [ "C35", "O22" ], "description": "Deprecated. Matches the distribution list itself, on elements that have one. Use ::slotted for forward compatibility." }, { "name": "::cue", "browsers": [ "E79", "FF55", "S7", "C26", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::cue" } ] }, { "name": "::cue()", "browsers": [ "C", "O16", "S6" ] }, { "name": "::cue-region", "browsers": [ "C", "O16", "S6" ] }, { "name": "::cue-region()", "browsers": [ "C", "O16", "S6" ] }, { "name": "::first-letter", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::first-letter" } ], "description": "Represents the first letter of an element, if it is not preceded by any other content (such as images or inline tables) on its line." }, { "name": "::first-line", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::first-line" } ], "description": "Describes the contents of the first formatted line of its originating element." }, { "name": "::-moz-focus-inner", "browsers": [ "FF4" ] }, { "name": "::-moz-focus-outer", "browsers": [ "FF4" ] }, { "name": "::-moz-list-bullet", "browsers": [ "FF1" ], "description": "Used to style the bullet of a list element. Similar to the standardized ::marker." }, { "name": "::-moz-list-number", "browsers": [ "FF1" ], "description": "Used to style the numbers of a list element. Similar to the standardized ::marker." }, { "name": "::-moz-placeholder", "browsers": [ "FF19" ], "description": "Represents placeholder text in an input field" }, { "name": "::-moz-progress-bar", "browsers": [ "FF9" ], "description": "Represents the bar portion of a progress bar." }, { "name": "::-moz-selection", "browsers": [ "FF1" ], "description": "Represents the portion of a document that has been highlighted by the user." }, { "name": "::-ms-backdrop", "browsers": [ "IE11" ], "description": "Used to create a backdrop that hides the underlying document for an element in a top layer (such as an element that is displayed fullscreen)." }, { "name": "::-ms-browse", "browsers": [ "E", "IE10" ], "description": "Represents the browse button of an input type=file control." }, { "name": "::-ms-check", "browsers": [ "E", "IE10" ], "description": "Represents the check of a checkbox or radio button input control." }, { "name": "::-ms-clear", "browsers": [ "E", "IE10" ], "description": "Represents the clear button of a text input control" }, { "name": "::-ms-expand", "browsers": [ "E", "IE10" ], "description": "Represents the drop-down button of a select control." }, { "name": "::-ms-fill", "browsers": [ "E", "IE10" ], "description": "Represents the bar portion of a progress bar." }, { "name": "::-ms-fill-lower", "browsers": [ "E", "IE10" ], "description": "Represents the portion of the slider track from its smallest value up to the value currently selected by the thumb. In a left-to-right layout, this is the portion of the slider track to the left of the thumb." }, { "name": "::-ms-fill-upper", "browsers": [ "E", "IE10" ], "description": "Represents the portion of the slider track from the value currently selected by the thumb up to the slider's largest value. In a left-to-right layout, this is the portion of the slider track to the right of the thumb." }, { "name": "::-ms-reveal", "browsers": [ "E", "IE10" ], "description": "Represents the password reveal button of an input type=password control." }, { "name": "::-ms-thumb", "browsers": [ "E", "IE10" ], "description": "Represents the portion of range input control (also known as a slider control) that the user drags." }, { "name": "::-ms-ticks-after", "browsers": [ "E", "IE10" ], "description": "Represents the tick marks of a slider that begin just after the thumb and continue up to the slider's largest value. In a left-to-right layout, these are the ticks to the right of the thumb." }, { "name": "::-ms-ticks-before", "browsers": [ "E", "IE10" ], "description": "Represents the tick marks of a slider that represent its smallest values up to the value currently selected by the thumb. In a left-to-right layout, these are the ticks to the left of the thumb." }, { "name": "::-ms-tooltip", "browsers": [ "E", "IE10" ], "description": "Represents the tooltip of a slider (input type=range)." }, { "name": "::-ms-track", "browsers": [ "E", "IE10" ], "description": "Represents the track of a slider." }, { "name": "::-ms-value", "browsers": [ "E", "IE10" ], "description": "Represents the content of a text or password input control, or a select control." }, { "name": "::selection", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::selection" } ], "description": "Represents the portion of a document that has been highlighted by the user." }, { "name": "::shadow", "browsers": [ "C35", "O22" ], "description": "Matches the shadow root if an element has a shadow tree." }, { "name": "::-webkit-file-upload-button", "browsers": [ "C", "O", "S6" ] }, { "name": "::-webkit-inner-spin-button", "browsers": [ "E79", "S5", "C6", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-inner-spin-button" } ] }, { "name": "::-webkit-input-placeholder", "browsers": [ "C", "S4" ] }, { "name": "::-webkit-keygen-select", "browsers": [ "C", "O", "S6" ] }, { "name": "::-webkit-meter-bar", "browsers": [ "E79", "S5.1", "C12", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-meter-bar" } ] }, { "name": "::-webkit-meter-even-less-good-value", "browsers": [ "E79", "S5.1", "C12", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-meter-even-less-good-value" } ] }, { "name": "::-webkit-meter-optimum-value", "browsers": [ "E79", "S5.1", "C12", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-meter-optimum-value" } ] }, { "name": "::-webkit-meter-suboptimum-value", "browsers": [ "E79", "S5.1", "C12", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-meter-suboptimum-value" } ] }, { "name": "::-webkit-outer-spin-button", "browsers": [ "S5", "C6" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-outer-spin-button" } ] }, { "name": "::-webkit-progress-bar", "browsers": [ "E79", "S7", "C25", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-progress-bar" } ] }, { "name": "::-webkit-progress-inner-element", "browsers": [ "E79", "S7", "C23", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-progress-inner-element" } ] }, { "name": "::-webkit-progress-value", "browsers": [ "E79", "S7", "C25", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-progress-value" } ] }, { "name": "::-webkit-resizer", "browsers": [ "E79", "S4", "C2", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-scrollbar" } ] }, { "name": "::-webkit-scrollbar", "browsers": [ "E79", "S4", "C2", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-scrollbar" } ] }, { "name": "::-webkit-scrollbar-button", "browsers": [ "E79", "S4", "C2", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-scrollbar" } ] }, { "name": "::-webkit-scrollbar-corner", "browsers": [ "E79", "S4", "C2", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-scrollbar" } ] }, { "name": "::-webkit-scrollbar-thumb", "browsers": [ "E79", "S4", "C2", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-scrollbar" } ] }, { "name": "::-webkit-scrollbar-track", "browsers": [ "E79", "S4", "C2", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-scrollbar" } ] }, { "name": "::-webkit-scrollbar-track-piece", "browsers": [ "E79", "S4", "C2", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-scrollbar" } ] }, { "name": "::-webkit-search-cancel-button", "browsers": [ "E79", "S3", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-search-cancel-button" } ] }, { "name": "::-webkit-search-decoration", "browsers": [ "C", "S4" ] }, { "name": "::-webkit-search-results-button", "browsers": [ "E79", "S3", "C1", "O15" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-search-results-button" } ] }, { "name": "::-webkit-search-results-decoration", "browsers": [ "C", "S4" ] }, { "name": "::-webkit-slider-runnable-track", "browsers": [ "C", "O", "S6" ] }, { "name": "::-webkit-slider-thumb", "browsers": [ "C", "O", "S6" ] }, { "name": "::-webkit-textfield-decoration-container", "browsers": [ "C", "O", "S6" ] }, { "name": "::-webkit-validation-bubble", "browsers": [ "C", "O", "S6" ] }, { "name": "::-webkit-validation-bubble-arrow", "browsers": [ "C", "O", "S6" ] }, { "name": "::-webkit-validation-bubble-arrow-clipper", "browsers": [ "C", "O", "S6" ] }, { "name": "::-webkit-validation-bubble-heading", "browsers": [ "C", "O", "S6" ] }, { "name": "::-webkit-validation-bubble-message", "browsers": [ "C", "O", "S6" ] }, { "name": "::-webkit-validation-bubble-text-block", "browsers": [ "C", "O", "S6" ] }, { "name": "::target-text", "status": "experimental", "browsers": [ "E89", "C89", "O75" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::target-text" } ], "description": "The ::target-text CSS pseudo-element represents the text that has been scrolled to if the browser supports scroll-to-text fragments. It allows authors to choose how to highlight that section of text." }, { "name": "::-moz-range-progress", "status": "nonstandard", "browsers": [ "FF22" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-moz-range-progress" } ], "description": "The ::-moz-range-progress CSS pseudo-element is a Mozilla extension that represents the lower portion of the track (i.e., groove) in which the indicator slides in an <input> of type=\"range\". This portion corresponds to values lower than the value currently selected by the thumb (i.e., virtual knob)." }, { "name": "::-moz-range-thumb", "status": "nonstandard", "browsers": [ "FF21" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-moz-range-thumb" } ], "description": "The ::-moz-range-thumb CSS pseudo-element is a Mozilla extension that represents the thumb (i.e., virtual knob) of an <input> of type=\"range\". The user can move the thumb along the input's track to alter its numerical value." }, { "name": "::-moz-range-track", "status": "nonstandard", "browsers": [ "FF21" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::-moz-range-track" } ], "description": "The ::-moz-range-track CSS pseudo-element is a Mozilla extension that represents the track (i.e., groove) in which the indicator slides in an <input> of type=\"range\"." }, { "name": "::-webkit-progress-inner-value", "status": "nonstandard", "description": "The ::-webkit-progress-value CSS pseudo-element represents the filled-in portion of the bar of a <progress> element. It is a child of the ::-webkit-progress-bar pseudo-element.\n\nIn order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element." }, { "name": "::grammar-error", "status": "experimental", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::grammar-error" } ], "description": "The ::grammar-error CSS pseudo-element represents a text segment which the user agent has flagged as grammatically incorrect." }, { "name": "::marker", "browsers": [ "E86", "FF68", "S11.1", "C86", "O72" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::marker" } ], "description": "The ::marker CSS pseudo-element selects the marker box of a list item, which typically contains a bullet or number. It works on any element or pseudo-element set to display: list-item, such as the <li> and <summary> elements." }, { "name": "::part", "status": "experimental", "browsers": [ "E79", "FF72", "S13.1", "C73", "O60" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::part" } ], "description": "The ::part CSS pseudo-element represents any element within a shadow tree that has a matching part attribute." }, { "name": "::placeholder", "browsers": [ "E79", "FF51", "S10.1", "C57", "O44" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::placeholder" } ], "description": "The ::placeholder CSS pseudo-element represents the placeholder text of a form element." }, { "name": "::slotted", "browsers": [ "E79", "FF63", "S10", "C50", "O37" ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::slotted" } ], "description": "The :slotted() CSS pseudo-element represents any element that has been placed into a slot inside an HTML template." }, { "name": "::spelling-error", "status": "experimental", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/::spelling-error" } ], "description": "The ::spelling-error CSS pseudo-element represents a text segment which the user agent has flagged as incorrectly spelled." } ] }; var CSSDataProvider = (function () { function CSSDataProvider(data) { this._properties = []; this._atDirectives = []; this._pseudoClasses = []; this._pseudoElements = []; this.addData(data); } CSSDataProvider.prototype.provideProperties = function () { return this._properties; }; CSSDataProvider.prototype.provideAtDirectives = function () { return this._atDirectives; }; CSSDataProvider.prototype.providePseudoClasses = function () { return this._pseudoClasses; }; CSSDataProvider.prototype.providePseudoElements = function () { return this._pseudoElements; }; CSSDataProvider.prototype.addData = function (data) { if (Array.isArray(data.properties)) { for (var _i = 0, _a = data.properties; _i < _a.length; _i++) { var prop = _a[_i]; if (isPropertyData(prop)) { this._properties.push(prop); } } } if (Array.isArray(data.atDirectives)) { for (var _b = 0, _c = data.atDirectives; _b < _c.length; _b++) { var prop = _c[_b]; if (isAtDirective(prop)) { this._atDirectives.push(prop); } } } if (Array.isArray(data.pseudoClasses)) { for (var _d = 0, _e = data.pseudoClasses; _d < _e.length; _d++) { var prop = _e[_d]; if (isPseudoClassData(prop)) { this._pseudoClasses.push(prop); } } } if (Array.isArray(data.pseudoElements)) { for (var _f = 0, _g = data.pseudoElements; _f < _g.length; _f++) { var prop = _g[_f]; if (isPseudoElementData(prop)) { this._pseudoElements.push(prop); } } } }; return CSSDataProvider; }()); function isPropertyData(d) { return typeof d.name === 'string'; } function isAtDirective(d) { return typeof d.name === 'string'; } function isPseudoClassData(d) { return typeof d.name === 'string'; } function isPseudoElementData(d) { return typeof d.name === 'string'; } var CSSDataManager = (function () { function CSSDataManager(options) { this.dataProviders = []; this._propertySet = {}; this._atDirectiveSet = {}; this._pseudoClassSet = {}; this._pseudoElementSet = {}; this._properties = []; this._atDirectives = []; this._pseudoClasses = []; this._pseudoElements = []; this.setDataProviders((options === null || options === void 0 ? void 0 : options.useDefaultDataProvider) !== false, (options === null || options === void 0 ? void 0 : options.customDataProviders) || []); } CSSDataManager.prototype.setDataProviders = function (builtIn, providers) { var _a; this.dataProviders = []; if (builtIn) { this.dataProviders.push(new CSSDataProvider(cssData)); } (_a = this.dataProviders).push.apply(_a, providers); this.collectData(); }; CSSDataManager.prototype.collectData = function () { var _this = this; this._propertySet = {}; this._atDirectiveSet = {}; this._pseudoClassSet = {}; this._pseudoElementSet = {}; this.dataProviders.forEach(function (provider) { provider.provideProperties().forEach(function (p) { if (!_this._propertySet[p.name]) { _this._propertySet[p.name] = p; } }); provider.provideAtDirectives().forEach(function (p) { if (!_this._atDirectiveSet[p.name]) { _this._atDirectiveSet[p.name] = p; } }); provider.providePseudoClasses().forEach(function (p) { if (!_this._pseudoClassSet[p.name]) { _this._pseudoClassSet[p.name] = p; } }); provider.providePseudoElements().forEach(function (p) { if (!_this._pseudoElementSet[p.name]) { _this._pseudoElementSet[p.name] = p; } }); }); this._properties = values(this._propertySet); this._atDirectives = values(this._atDirectiveSet); this._pseudoClasses = values(this._pseudoClassSet); this._pseudoElements = values(this._pseudoElementSet); }; CSSDataManager.prototype.getProperty = function (name) { return this._propertySet[name]; }; CSSDataManager.prototype.getAtDirective = function (name) { return this._atDirectiveSet[name]; }; CSSDataManager.prototype.getPseudoClass = function (name) { return this._pseudoClassSet[name]; }; CSSDataManager.prototype.getPseudoElement = function (name) { return this._pseudoElementSet[name]; }; CSSDataManager.prototype.getProperties = function () { return this._properties; }; CSSDataManager.prototype.getAtDirectives = function () { return this._atDirectives; }; CSSDataManager.prototype.getPseudoClasses = function () { return this._pseudoClasses; }; CSSDataManager.prototype.getPseudoElements = function () { return this._pseudoElements; }; CSSDataManager.prototype.isKnownProperty = function (name) { return name.toLowerCase() in this._propertySet; }; CSSDataManager.prototype.isStandardProperty = function (name) { return this.isKnownProperty(name) && (!this._propertySet[name.toLowerCase()].status || this._propertySet[name.toLowerCase()].status === 'standard'); }; return CSSDataManager; }()); function getSelectionRanges$1(document, positions, stylesheet) { function getSelectionRange(position) { var applicableRanges = getApplicableRanges(position); var current = undefined; for (var index = applicableRanges.length - 1; index >= 0; index--) { current = SelectionRange.create(Range.create(document.positionAt(applicableRanges[index][0]), document.positionAt(applicableRanges[index][1])), current); } if (!current) { current = SelectionRange.create(Range.create(position, position)); } return current; } return positions.map(getSelectionRange); function getApplicableRanges(position) { var offset = document.offsetAt(position); var currNode = stylesheet.findChildAtOffset(offset, true); if (!currNode) { return []; } var result = []; while (currNode) { if (currNode.parent && currNode.offset === currNode.parent.offset && currNode.end === currNode.parent.end) { currNode = currNode.parent; continue; } if (currNode.type === NodeType.Declarations) { if (offset > currNode.offset && offset < currNode.end) { result.push([currNode.offset + 1, currNode.end - 1]); } } result.push([currNode.offset, currNode.end]); currNode = currNode.parent; } return result; } } var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var SCSSNavigation = (function (_super) { __extends(SCSSNavigation, _super); function SCSSNavigation(fileSystemProvider) { return _super.call(this, fileSystemProvider, true) || this; } SCSSNavigation.prototype.isRawStringDocumentLinkNode = function (node) { return (_super.prototype.isRawStringDocumentLinkNode.call(this, node) || node.type === NodeType.Use || node.type === NodeType.Forward); }; SCSSNavigation.prototype.resolveRelativeReference = function (ref, documentUri, documentContext, isRawLink) { return __awaiter(this, void 0, void 0, function () { function toPathVariations(uri) { if (uri.path === '') { return undefined; } if (uri.path.endsWith('.scss') || uri.path.endsWith('.css')) { return undefined; } if (uri.path.endsWith('/')) { return [ uri.with({ path: uri.path + 'index.scss' }).toString(), uri.with({ path: uri.path + '_index.scss' }).toString() ]; } var pathFragments = uri.path.split('/'); var basename = pathFragments[pathFragments.length - 1]; var pathWithoutBasename = uri.path.slice(0, -basename.length); if (basename.startsWith('_')) { if (uri.path.endsWith('.scss')) { return undefined; } else { return [uri.with({ path: uri.path + '.scss' }).toString()]; } } var normalizedBasename = basename + '.scss'; var documentUriWithBasename = function (newBasename) { return uri.with({ path: pathWithoutBasename + newBasename }).toString(); }; var normalizedPath = documentUriWithBasename(normalizedBasename); var underScorePath = documentUriWithBasename('_' + normalizedBasename); var indexPath = documentUriWithBasename(normalizedBasename.slice(0, -5) + '/index.scss'); var indexUnderscoreUri = documentUriWithBasename(normalizedBasename.slice(0, -5) + '/_index.scss'); var cssPath = documentUriWithBasename(normalizedBasename.slice(0, -5) + '.css'); return [normalizedPath, underScorePath, indexPath, indexUnderscoreUri, cssPath]; } var target, parsedUri, pathVariations, j; return __generator(this, function (_a) { switch (_a.label) { case 0: if (startsWith(ref, 'sass:')) { return [2 , undefined]; } return [4 , _super.prototype.resolveRelativeReference.call(this, ref, documentUri, documentContext, isRawLink)]; case 1: target = _a.sent(); if (!(this.fileSystemProvider && target && isRawLink)) return [3 , 8]; parsedUri = URI$1.parse(target); _a.label = 2; case 2: _a.trys.push([2, 7, , 8]); pathVariations = toPathVariations(parsedUri); if (!pathVariations) return [3 , 6]; j = 0; _a.label = 3; case 3: if (!(j < pathVariations.length)) return [3 , 6]; return [4 , this.fileExists(pathVariations[j])]; case 4: if (_a.sent()) { return [2 , pathVariations[j]]; } _a.label = 5; case 5: j++; return [3 , 3]; case 6: return [3 , 8]; case 7: _a.sent(); return [3 , 8]; case 8: return [2 , target]; } }); }); }; return SCSSNavigation; }(CSSNavigation)); function getDefaultCSSDataProvider() { return newCSSDataProvider(cssData); } function newCSSDataProvider(data) { return new CSSDataProvider(data); } function createFacade(parser, completion, hover, navigation, codeActions, validation, cssDataManager) { return { configure: function (settings) { validation.configure(settings); completion.configure(settings === null || settings === void 0 ? void 0 : settings.completion); hover.configure(settings === null || settings === void 0 ? void 0 : settings.hover); }, setDataProviders: cssDataManager.setDataProviders.bind(cssDataManager), doValidation: validation.doValidation.bind(validation), parseStylesheet: parser.parseStylesheet.bind(parser), doComplete: completion.doComplete.bind(completion), doComplete2: completion.doComplete2.bind(completion), setCompletionParticipants: completion.setCompletionParticipants.bind(completion), doHover: hover.doHover.bind(hover), findDefinition: navigation.findDefinition.bind(navigation), findReferences: navigation.findReferences.bind(navigation), findDocumentHighlights: navigation.findDocumentHighlights.bind(navigation), findDocumentLinks: navigation.findDocumentLinks.bind(navigation), findDocumentLinks2: navigation.findDocumentLinks2.bind(navigation), findDocumentSymbols: navigation.findDocumentSymbols.bind(navigation), doCodeActions: codeActions.doCodeActions.bind(codeActions), doCodeActions2: codeActions.doCodeActions2.bind(codeActions), findDocumentColors: navigation.findDocumentColors.bind(navigation), getColorPresentations: navigation.getColorPresentations.bind(navigation), doRename: navigation.doRename.bind(navigation), getFoldingRanges: getFoldingRanges, getSelectionRanges: getSelectionRanges$1 }; } var defaultLanguageServiceOptions = {}; function getCSSLanguageService(options) { if (options === void 0) { options = defaultLanguageServiceOptions; } var cssDataManager = new CSSDataManager(options); return createFacade(new Parser(), new CSSCompletion(null, options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new CSSNavigation(options && options.fileSystemProvider, false), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager); } function getSCSSLanguageService(options) { if (options === void 0) { options = defaultLanguageServiceOptions; } var cssDataManager = new CSSDataManager(options); return createFacade(new SCSSParser(), new SCSSCompletion(options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new SCSSNavigation(options && options.fileSystemProvider), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager); } function getLESSLanguageService(options) { if (options === void 0) { options = defaultLanguageServiceOptions; } var cssDataManager = new CSSDataManager(options); return createFacade(new LESSParser(), new LESSCompletion(options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new CSSNavigation(options && options.fileSystemProvider, true), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager); } var cssLanguageService = /*#__PURE__*/Object.freeze({ __proto__: null, getDefaultCSSDataProvider: getDefaultCSSDataProvider, newCSSDataProvider: newCSSDataProvider, getCSSLanguageService: getCSSLanguageService, getSCSSLanguageService: getSCSSLanguageService, getLESSLanguageService: getLESSLanguageService, get TextDocument () { return TextDocument; }, get Range () { return Range; }, get Position () { return Position; }, get MarkupContent () { return MarkupContent; }, get MarkupKind () { return MarkupKind; }, get Color () { return Color; }, get ColorInformation () { return ColorInformation; }, get ColorPresentation () { return ColorPresentation; }, get FoldingRange () { return FoldingRange; }, get FoldingRangeKind () { return FoldingRangeKind; }, get SelectionRange () { return SelectionRange; }, get Diagnostic () { return Diagnostic; }, get DiagnosticSeverity () { return DiagnosticSeverity; }, get CompletionItem () { return CompletionItem; }, get CompletionItemKind () { return CompletionItemKind; }, get CompletionList () { return CompletionList; }, get CompletionItemTag () { return CompletionItemTag; }, get InsertTextFormat () { return InsertTextFormat; }, get SymbolInformation () { return SymbolInformation; }, get SymbolKind () { return SymbolKind; }, get DocumentSymbol () { return DocumentSymbol; }, get Location () { return Location; }, get Hover () { return Hover; }, get MarkedString () { return MarkedString; }, get CodeActionContext () { return CodeActionContext; }, get Command () { return Command; }, get CodeAction () { return CodeAction; }, get DocumentHighlight () { return DocumentHighlight; }, get DocumentLink () { return DocumentLink; }, get WorkspaceEdit () { return WorkspaceEdit; }, get TextEdit () { return TextEdit; }, get CodeActionKind () { return CodeActionKind; }, get TextDocumentEdit () { return TextDocumentEdit; }, get VersionedTextDocumentIdentifier () { return VersionedTextDocumentIdentifier; }, get DocumentHighlightKind () { return DocumentHighlightKind; }, get ClientCapabilities () { return ClientCapabilities; }, get FileType () { return FileType; } }); var svelteSelectors = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.pesudoClass = void 0; exports.pesudoClass = [ { name: ':global()', description: `[svelte] :global modifier Applying styles to a selector globally`, references: [ { name: 'Svelte.dev Reference', url: 'https://svelte.dev/docs#style' } ] } ]; }); getDefaultExportFromCjs(svelteSelectors); var vscode_css_languageservice_1 = /*@__PURE__*/getAugmentedNamespace(cssLanguageService); var service = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createLanguageServices = exports.getLanguageService = exports.getLanguage = void 0; const customDataProvider = { providePseudoClasses() { return svelteSelectors.pesudoClass; }, provideProperties() { return [ { name: 'vector-effect', values: [{ name: 'non-scaling-stroke' }, { name: 'none' }], status: 'experimental' } ]; }, provideAtDirectives() { return []; }, providePseudoElements() { return []; } }; function getLanguage(kind) { switch (kind) { case 'scss': case 'text/scss': return 'scss'; case 'less': case 'text/less': return 'less'; case 'css': case 'text/css': default: return 'css'; } } exports.getLanguage = getLanguage; function getLanguageService(langs, kind) { const lang = getLanguage(kind); return langs[lang]; } exports.getLanguageService = getLanguageService; function createLanguageServices(options) { const [css, less, scss] = [ vscode_css_languageservice_1.getCSSLanguageService, vscode_css_languageservice_1.getLESSLanguageService, vscode_css_languageservice_1.getSCSSLanguageService ].map((getService) => getService({ customDataProviders: [customDataProvider], ...(options !== null && options !== void 0 ? options : {}) })); return { css, less, scss }; } exports.createLanguageServices = createLanguageServices; }); getDefaultExportFromCjs(service); var CSSDocument_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.CSSDocument = void 0; class CSSDocument extends documents.ReadableDocument { constructor(parent, languageServices) { super(); this.parent = parent; this.version = this.parent.version; if (this.parent.styleInfo) { this.styleInfo = this.parent.styleInfo; } else { this.styleInfo = { attributes: {}, start: -1, end: -1 }; } this.languageId = this.language; this.stylesheet = (0, service.getLanguageService)(languageServices, this.languageId).parseStylesheet(this); } getOriginalPosition(pos) { const parentOffset = this.styleInfo.start + this.offsetAt(pos); return this.parent.positionAt(parentOffset); } getGeneratedPosition(pos) { const fragmentOffset = this.parent.offsetAt(pos) - this.styleInfo.start; return this.positionAt(fragmentOffset); } isInGenerated(pos) { const offset = this.parent.offsetAt(pos); return offset >= this.styleInfo.start && offset <= this.styleInfo.end; } getText() { return this.parent.getText().slice(this.styleInfo.start, this.styleInfo.end); } getTextLength() { return this.styleInfo.end - this.styleInfo.start; } getFilePath() { return this.parent.getFilePath(); } getURL() { return this.parent.getURL(); } getAttributes() { return this.styleInfo.attributes; } get language() { const attrs = this.getAttributes(); return attrs.lang || attrs.type || 'css'; } } exports.CSSDocument = CSSDocument; }); getDefaultExportFromCjs(CSSDocument_1); var globalVars = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.GlobalVars = void 0; const varRegex = /^\s*(--\w+.*?):\s*?([^;]*)/; class GlobalVars { constructor() { this.globalVars = new Map(); } watchFiles(filesToWatch) { if (!filesToWatch) { return; } if (this.fsWatcher) { this.fsWatcher.close(); this.globalVars.clear(); } this.fsWatcher = (0, chokidar_1__default['default'].watch)(filesToWatch.split(',')) .addListener('add', (file) => this.updateForFile(file)) .addListener('change', (file) => { this.updateForFile(file); }) .addListener('unlink', (file) => this.globalVars.delete(file)); } updateForFile(filename) { setTimeout(() => { (0, fs__default['default'].readFile)(filename, 'utf-8', (error, contents) => { if (error) { return; } const globalVarsForFile = contents .split('\n') .map((line) => line.match(varRegex)) .filter(utils$4.isNotNullOrUndefined) .map((line) => ({ filename, name: line[1], value: line[2] })); this.globalVars.set(filename, globalVarsForFile); }); }, 1000); } getGlobalVars() { return (0, utils$4.flatten)([...this.globalVars.values()]); } } exports.GlobalVars = GlobalVars; }); getDefaultExportFromCjs(globalVars); var getIdClassCompletion_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.collectSelectors = exports.NodeType = exports.getIdClassCompletion = void 0; function getIdClassCompletion(cssDoc, attributeContext) { const collectingType = getCollectingType(attributeContext); if (!collectingType) { return null; } const items = collectSelectors(cssDoc.stylesheet, collectingType); return main$4.CompletionList.create(items); } exports.getIdClassCompletion = getIdClassCompletion; function getCollectingType(attributeContext) { if (attributeContext.inValue) { if (attributeContext.name === 'class') { return NodeType.ClassSelector; } if (attributeContext.name === 'id') { return NodeType.IdentifierSelector; } } else if (attributeContext.name.startsWith('class:')) { return NodeType.ClassSelector; } } var NodeType; (function (NodeType) { NodeType[NodeType["ClassSelector"] = 14] = "ClassSelector"; NodeType[NodeType["IdentifierSelector"] = 15] = "IdentifierSelector"; })(NodeType = exports.NodeType || (exports.NodeType = {})); function collectSelectors(stylesheet, type) { const result = []; walk(stylesheet, (node) => { if (node.type === type) { result.push(node); } }); return result.map((node) => ({ label: node.getText().substring(1), kind: main$4.CompletionItemKind.Keyword })); } exports.collectSelectors = collectSelectors; function walk(node, callback) { callback(node); if (node.children) { node.children.forEach((node) => walk(node, callback)); } } }); getDefaultExportFromCjs(getIdClassCompletion_1); var StyleAttributeDocument_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.StyleAttributeDocument = void 0; const PREFIX = '__ {'; const SUFFIX = '}'; class StyleAttributeDocument extends documents.ReadableDocument { constructor(parent, attrStart, attrEnd, languageServices) { super(); this.parent = parent; this.attrStart = attrStart; this.attrEnd = attrEnd; this.version = this.parent.version; this.languageId = 'css'; this.stylesheet = (0, service.getLanguageService)(languageServices).parseStylesheet(this); } getOriginalPosition(pos) { const parentOffset = this.attrStart + this.offsetAt(pos) - PREFIX.length; return this.parent.positionAt(parentOffset); } getGeneratedPosition(pos) { const fragmentOffset = this.parent.offsetAt(pos) - this.attrStart + PREFIX.length; return this.positionAt(fragmentOffset); } isInGenerated(pos) { const offset = this.parent.offsetAt(pos); return offset >= this.attrStart && offset <= this.attrEnd; } getText() { return PREFIX + this.parent.getText().slice(this.attrStart, this.attrEnd) + SUFFIX; } getTextLength() { return PREFIX.length + this.attrEnd - this.attrStart + SUFFIX.length; } getFilePath() { return this.parent.getFilePath(); } getURL() { return this.parent.getURL(); } } exports.StyleAttributeDocument = StyleAttributeDocument; }); getDefaultExportFromCjs(StyleAttributeDocument_1); var documentContext = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getDocumentContext = void 0; function getDocumentContext(documentUri, workspaceFolders) { function getRootFolder() { for (const folder of workspaceFolders) { let folderURI = folder.uri; if (!folderURI.endsWith('/')) { folderURI = folderURI + '/'; } if (documentUri.startsWith(folderURI)) { return folderURI; } } return undefined; } return { resolveReference: (ref, base = documentUri) => { if (ref[0] === '/') { const folderUri = getRootFolder(); if (folderUri) { return folderUri + ref.substr(1); } } base = base.substr(0, base.lastIndexOf('/') + 1); return vscode_uri_1.Utils.resolvePath(vscode_uri_1.URI.parse(base), ref).toString(); } }; } exports.getDocumentContext = getDocumentContext; }); getDefaultExportFromCjs(documentContext); var vscode_emmet_helper_1 = /*@__PURE__*/getAugmentedNamespace(emmetHelper); var CSSPlugin_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.CSSPlugin = void 0; class CSSPlugin { constructor(docManager, configManager, workspaceFolders, cssLanguageServices) { this.__name = 'css'; this.cssDocuments = new WeakMap(); this.triggerCharacters = ['.', ':', '-', '/']; this.globalVars = new globalVars.GlobalVars(); this.cssLanguageServices = cssLanguageServices; this.workspaceFolders = workspaceFolders; this.configManager = configManager; this.updateConfigs(); this.globalVars.watchFiles(this.configManager.get('css.globals')); this.configManager.onChange((config) => { this.globalVars.watchFiles(config.get('css.globals')); this.updateConfigs(); }); docManager.on('documentChange', (document) => this.cssDocuments.set(document, new CSSDocument_1.CSSDocument(document, this.cssLanguageServices))); docManager.on('documentClose', (document) => this.cssDocuments.delete(document)); } getSelectionRange(document, position) { if (!this.featureEnabled('selectionRange') || !(0, documents.isInTag)(position, document.styleInfo)) { return null; } const cssDocument = this.getCSSDoc(document); const [range] = this.getLanguageService(extractLanguage(cssDocument)).getSelectionRanges(cssDocument, [cssDocument.getGeneratedPosition(position)], cssDocument.stylesheet); if (!range) { return null; } return (0, documents.mapSelectionRangeToParent)(cssDocument, range); } getDiagnostics(document) { if (!this.featureEnabled('diagnostics')) { return []; } const cssDocument = this.getCSSDoc(document); const kind = extractLanguage(cssDocument); if (shouldExcludeValidation(kind)) { return []; } return this.getLanguageService(kind) .doValidation(cssDocument, cssDocument.stylesheet) .map((diagnostic) => ({ ...diagnostic, source: (0, service.getLanguage)(kind) })) .map((diagnostic) => (0, documents.mapObjWithRangeToOriginal)(cssDocument, diagnostic)); } doHover(document, position) { if (!this.featureEnabled('hover')) { return null; } const cssDocument = this.getCSSDoc(document); if (shouldExcludeHover(cssDocument)) { return null; } if (cssDocument.isInGenerated(position)) { return this.doHoverInternal(cssDocument, position); } const attributeContext = (0, parseHtml_1.getAttributeContextAtPosition)(document, position); if (attributeContext && this.inStyleAttributeWithoutInterpolation(attributeContext, document.getText())) { const [start, end] = attributeContext.valueRange; return this.doHoverInternal(new StyleAttributeDocument_1.StyleAttributeDocument(document, start, end, this.cssLanguageServices), position); } return null; } doHoverInternal(cssDocument, position) { const hoverInfo = this.getLanguageService(extractLanguage(cssDocument)).doHover(cssDocument, cssDocument.getGeneratedPosition(position), cssDocument.stylesheet); return hoverInfo ? (0, documents.mapHoverToParent)(cssDocument, hoverInfo) : hoverInfo; } async getCompletions(document, position, completionContext) { const triggerCharacter = completionContext === null || completionContext === void 0 ? void 0 : completionContext.triggerCharacter; const triggerKind = completionContext === null || completionContext === void 0 ? void 0 : completionContext.triggerKind; const isCustomTriggerCharacter = triggerKind === main$4.CompletionTriggerKind.TriggerCharacter; if (isCustomTriggerCharacter && triggerCharacter && !this.triggerCharacters.includes(triggerCharacter)) { return null; } if (!this.featureEnabled('completions')) { return null; } const cssDocument = this.getCSSDoc(document); if (cssDocument.isInGenerated(position)) { return this.getCompletionsInternal(document, position, cssDocument); } const attributeContext = (0, parseHtml_1.getAttributeContextAtPosition)(document, position); if (!attributeContext) { return null; } if (this.inStyleAttributeWithoutInterpolation(attributeContext, document.getText())) { const [start, end] = attributeContext.valueRange; return this.getCompletionsInternal(document, position, new StyleAttributeDocument_1.StyleAttributeDocument(document, start, end, this.cssLanguageServices)); } else { return (0, getIdClassCompletion_1.getIdClassCompletion)(cssDocument, attributeContext); } } inStyleAttributeWithoutInterpolation(attrContext, text) { return (attrContext.name === 'style' && !!attrContext.valueRange && !text.substring(attrContext.valueRange[0], attrContext.valueRange[1]).includes('{')); } async getCompletionsInternal(document, position, cssDocument) { if (isSASS(cssDocument)) { return ((0, vscode_emmet_helper_1.doComplete)(document, position, 'sass', this.configManager.getEmmetConfig()) || null); } const type = extractLanguage(cssDocument); if (shouldExcludeCompletion(type)) { return null; } const lang = this.getLanguageService(type); let emmetResults = { isIncomplete: false, items: [] }; if (this.configManager.getConfig().css.completions.emmet && this.configManager.getEmmetConfig().showExpandedAbbreviation !== 'never') { lang.setCompletionParticipants([ { onCssProperty: (context) => { if (context === null || context === void 0 ? void 0 : context.propertyName) { emmetResults = (0, vscode_emmet_helper_1.doComplete)(cssDocument, cssDocument.getGeneratedPosition(position), (0, service.getLanguage)(type), this.configManager.getEmmetConfig()) || emmetResults; } }, onCssPropertyValue: (context) => { if (context === null || context === void 0 ? void 0 : context.propertyValue) { emmetResults = (0, vscode_emmet_helper_1.doComplete)(cssDocument, cssDocument.getGeneratedPosition(position), (0, service.getLanguage)(type), this.configManager.getEmmetConfig()) || emmetResults; } } } ]); } const results = await lang.doComplete2(cssDocument, cssDocument.getGeneratedPosition(position), cssDocument.stylesheet, (0, documentContext.getDocumentContext)(cssDocument.uri, this.workspaceFolders)); return main$4.CompletionList.create(this.appendGlobalVars([...(results ? results.items : []), ...emmetResults.items].map((completionItem) => (0, documents.mapCompletionItemToOriginal)(cssDocument, completionItem))), emmetResults.items.length > 0); } appendGlobalVars(items) { const value = items.find((item) => item.kind === main$4.CompletionItemKind.Value); if (!value) { return items; } const additionalItems = this.globalVars .getGlobalVars() .map((globalVar) => ({ label: `var(${globalVar.name})`, sortText: '-', detail: `${globalVar.filename}\n\n${globalVar.name}: ${globalVar.value}`, kind: main$4.CompletionItemKind.Value })); return [...items, ...additionalItems]; } getDocumentColors(document) { if (!this.featureEnabled('documentColors')) { return []; } const cssDocument = this.getCSSDoc(document); if (shouldExcludeColor(cssDocument)) { return []; } return this.getLanguageService(extractLanguage(cssDocument)) .findDocumentColors(cssDocument, cssDocument.stylesheet) .map((colorInfo) => (0, documents.mapObjWithRangeToOriginal)(cssDocument, colorInfo)); } getColorPresentations(document, range, color) { if (!this.featureEnabled('colorPresentations')) { return []; } const cssDocument = this.getCSSDoc(document); if ((!cssDocument.isInGenerated(range.start) && !cssDocument.isInGenerated(range.end)) || shouldExcludeColor(cssDocument)) { return []; } return this.getLanguageService(extractLanguage(cssDocument)) .getColorPresentations(cssDocument, cssDocument.stylesheet, color, (0, documents.mapRangeToGenerated)(cssDocument, range)) .map((colorPres) => (0, documents.mapColorPresentationToOriginal)(cssDocument, colorPres)); } getDocumentSymbols(document) { if (!this.featureEnabled('documentColors')) { return []; } const cssDocument = this.getCSSDoc(document); if (shouldExcludeDocumentSymbols(cssDocument)) { return []; } return this.getLanguageService(extractLanguage(cssDocument)) .findDocumentSymbols(cssDocument, cssDocument.stylesheet) .map((symbol) => { if (!symbol.containerName) { return { ...symbol, containerName: 'style' }; } return symbol; }) .map((symbol) => (0, documents.mapSymbolInformationToOriginal)(cssDocument, symbol)); } getCSSDoc(document) { let cssDoc = this.cssDocuments.get(document); if (!cssDoc || cssDoc.version < document.version) { cssDoc = new CSSDocument_1.CSSDocument(document, this.cssLanguageServices); this.cssDocuments.set(document, cssDoc); } return cssDoc; } updateConfigs() { var _a, _b, _c; (_a = this.getLanguageService('css')) === null || _a === void 0 ? void 0 : _a.configure(this.configManager.getCssConfig()); (_b = this.getLanguageService('scss')) === null || _b === void 0 ? void 0 : _b.configure(this.configManager.getScssConfig()); (_c = this.getLanguageService('less')) === null || _c === void 0 ? void 0 : _c.configure(this.configManager.getLessConfig()); } featureEnabled(feature) { return (this.configManager.enabled('css.enable') && this.configManager.enabled(`css.${feature}.enable`)); } getLanguageService(kind) { return (0, service.getLanguageService)(this.cssLanguageServices, kind); } } exports.CSSPlugin = CSSPlugin; function shouldExcludeValidation(kind) { switch (kind) { case 'postcss': case 'sass': case 'stylus': case 'styl': return true; default: return false; } } function shouldExcludeCompletion(kind) { switch (kind) { case 'stylus': case 'styl': return true; default: return false; } } function shouldExcludeDocumentSymbols(document) { switch (extractLanguage(document)) { case 'sass': case 'stylus': case 'styl': return true; default: return false; } } function shouldExcludeHover(document) { switch (extractLanguage(document)) { case 'sass': case 'stylus': case 'styl': return true; default: return false; } } function shouldExcludeColor(document) { switch (extractLanguage(document)) { case 'sass': case 'stylus': case 'styl': return true; default: return false; } } function isSASS(document) { switch (extractLanguage(document)) { case 'sass': return true; default: return false; } } function extractLanguage(document) { const lang = document.languageId; return lang.replace(/^text\//, ''); } }); getDefaultExportFromCjs(CSSPlugin_1); var lib = function dedent(templateStrings) { var values = []; for (var _i = 1; _i < arguments.length; _i++) { values[_i - 1] = arguments[_i]; } var matches = []; var strings = typeof templateStrings === 'string' ? [templateStrings] : templateStrings.slice(); strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, ''); for (var i = 0; i < strings.length; i++) { var match = void 0; if (match = strings[i].match(/\n[\t ]+/g)) { matches.push.apply(matches, match); } } if (matches.length) { var size = Math.min.apply(Math, matches.map(function (value) { return value.length - 1; })); var pattern = new RegExp("\n[\t ]{" + size + "}", 'g'); for (var i = 0; i < strings.length; i++) { strings[i] = strings[i].replace(pattern, '\n'); } } strings[0] = strings[0].replace(/^\r?\n/, ''); var string = strings[0]; for (var i = 0; i < values.length; i++) { string += values[i] + strings[i + 1]; } return string; }; var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function lowerCase(str) { return str.toLowerCase(); } var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; function noCase(input, options) { if (options === void 0) { options = {}; } var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); var start = 0; var end = result.length; while (result.charAt(start) === "\0") start++; while (result.charAt(end - 1) === "\0") end--; return result.slice(start, end).split("\0").map(transform).join(delimiter); } function replace(input, re, value) { if (re instanceof RegExp) return input.replace(re, value); return re.reduce(function (input, re) { return input.replace(re, value); }, input); } function pascalCaseTransform(input, index) { var firstChar = input.charAt(0); var lowerChars = input.substr(1).toLowerCase(); if (index > 0 && firstChar >= "0" && firstChar <= "9") { return "_" + firstChar + lowerChars; } return "" + firstChar.toUpperCase() + lowerChars; } function pascalCase(input, options) { if (options === void 0) { options = {}; } return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options)); } var charToInteger = {}; var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; for (var i = 0; i < chars.length; i++) { charToInteger[chars.charCodeAt(i)] = i; } function encode(decoded) { var sourceFileIndex = 0; var sourceCodeLine = 0; var sourceCodeColumn = 0; var nameIndex = 0; var mappings = ''; for (var i = 0; i < decoded.length; i++) { var line = decoded[i]; if (i > 0) mappings += ';'; if (line.length === 0) continue; var generatedCodeColumn = 0; var lineMappings = []; for (var _i = 0, line_1 = line; _i < line_1.length; _i++) { var segment = line_1[_i]; var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn); generatedCodeColumn = segment[0]; if (segment.length > 1) { segmentMappings += encodeInteger(segment[1] - sourceFileIndex) + encodeInteger(segment[2] - sourceCodeLine) + encodeInteger(segment[3] - sourceCodeColumn); sourceFileIndex = segment[1]; sourceCodeLine = segment[2]; sourceCodeColumn = segment[3]; } if (segment.length === 5) { segmentMappings += encodeInteger(segment[4] - nameIndex); nameIndex = segment[4]; } lineMappings.push(segmentMappings); } mappings += lineMappings.join(','); } return mappings; } function encodeInteger(num) { var result = ''; num = num < 0 ? (-num << 1) | 1 : num << 1; do { var clamped = num & 31; num >>>= 5; if (num > 0) { clamped |= 32; } result += chars[clamped]; } while (num > 0); return result; } var BitSet = function BitSet(arg) { this.bits = arg instanceof BitSet ? arg.bits.slice() : []; }; BitSet.prototype.add = function add (n) { this.bits[n >> 5] |= 1 << (n & 31); }; BitSet.prototype.has = function has (n) { return !!(this.bits[n >> 5] & (1 << (n & 31))); }; var Chunk = function Chunk(start, end, content) { this.start = start; this.end = end; this.original = content; this.intro = ''; this.outro = ''; this.content = content; this.storeName = false; this.edited = false; Object.defineProperties(this, { previous: { writable: true, value: null }, next: { writable: true, value: null }, }); }; Chunk.prototype.appendLeft = function appendLeft (content) { this.outro += content; }; Chunk.prototype.appendRight = function appendRight (content) { this.intro = this.intro + content; }; Chunk.prototype.clone = function clone () { var chunk = new Chunk(this.start, this.end, this.original); chunk.intro = this.intro; chunk.outro = this.outro; chunk.content = this.content; chunk.storeName = this.storeName; chunk.edited = this.edited; return chunk; }; Chunk.prototype.contains = function contains (index) { return this.start < index && index < this.end; }; Chunk.prototype.eachNext = function eachNext (fn) { var chunk = this; while (chunk) { fn(chunk); chunk = chunk.next; } }; Chunk.prototype.eachPrevious = function eachPrevious (fn) { var chunk = this; while (chunk) { fn(chunk); chunk = chunk.previous; } }; Chunk.prototype.edit = function edit (content, storeName, contentOnly) { this.content = content; if (!contentOnly) { this.intro = ''; this.outro = ''; } this.storeName = storeName; this.edited = true; return this; }; Chunk.prototype.prependLeft = function prependLeft (content) { this.outro = content + this.outro; }; Chunk.prototype.prependRight = function prependRight (content) { this.intro = content + this.intro; }; Chunk.prototype.split = function split (index) { var sliceIndex = index - this.start; var originalBefore = this.original.slice(0, sliceIndex); var originalAfter = this.original.slice(sliceIndex); this.original = originalBefore; var newChunk = new Chunk(index, this.end, originalAfter); newChunk.outro = this.outro; this.outro = ''; this.end = index; if (this.edited) { newChunk.edit('', false); this.content = ''; } else { this.content = originalBefore; } newChunk.next = this.next; if (newChunk.next) { newChunk.next.previous = newChunk; } newChunk.previous = this; this.next = newChunk; return newChunk; }; Chunk.prototype.toString = function toString () { return this.intro + this.content + this.outro; }; Chunk.prototype.trimEnd = function trimEnd (rx) { this.outro = this.outro.replace(rx, ''); if (this.outro.length) { return true; } var trimmed = this.content.replace(rx, ''); if (trimmed.length) { if (trimmed !== this.content) { this.split(this.start + trimmed.length).edit('', undefined, true); } return true; } else { this.edit('', undefined, true); this.intro = this.intro.replace(rx, ''); if (this.intro.length) { return true; } } }; Chunk.prototype.trimStart = function trimStart (rx) { this.intro = this.intro.replace(rx, ''); if (this.intro.length) { return true; } var trimmed = this.content.replace(rx, ''); if (trimmed.length) { if (trimmed !== this.content) { this.split(this.end - trimmed.length); this.edit('', undefined, true); } return true; } else { this.edit('', undefined, true); this.outro = this.outro.replace(rx, ''); if (this.outro.length) { return true; } } }; var btoa = function () { throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.'); }; if (typeof window !== 'undefined' && typeof window.btoa === 'function') { btoa = function (str) { return window.btoa(unescape(encodeURIComponent(str))); }; } else if (typeof Buffer === 'function') { btoa = function (str) { return Buffer.from(str, 'utf-8').toString('base64'); }; } var SourceMap = function SourceMap(properties) { this.version = 3; this.file = properties.file; this.sources = properties.sources; this.sourcesContent = properties.sourcesContent; this.names = properties.names; this.mappings = encode(properties.mappings); }; SourceMap.prototype.toString = function toString () { return JSON.stringify(this); }; SourceMap.prototype.toUrl = function toUrl () { return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString()); }; function guessIndent(code) { var lines = code.split('\n'); var tabbed = lines.filter(function (line) { return /^\t+/.test(line); }); var spaced = lines.filter(function (line) { return /^ {2,}/.test(line); }); if (tabbed.length === 0 && spaced.length === 0) { return null; } if (tabbed.length >= spaced.length) { return '\t'; } var min = spaced.reduce(function (previous, current) { var numSpaces = /^ +/.exec(current)[0].length; return Math.min(numSpaces, previous); }, Infinity); return new Array(min + 1).join(' '); } function getRelativePath(from, to) { var fromParts = from.split(/[/\\]/); var toParts = to.split(/[/\\]/); fromParts.pop(); while (fromParts[0] === toParts[0]) { fromParts.shift(); toParts.shift(); } if (fromParts.length) { var i = fromParts.length; while (i--) { fromParts[i] = '..'; } } return fromParts.concat(toParts).join('/'); } var toString = Object.prototype.toString; function isObject(thing) { return toString.call(thing) === '[object Object]'; } function getLocator(source) { var originalLines = source.split('\n'); var lineOffsets = []; for (var i = 0, pos = 0; i < originalLines.length; i++) { lineOffsets.push(pos); pos += originalLines[i].length + 1; } return function locate(index) { var i = 0; var j = lineOffsets.length; while (i < j) { var m = (i + j) >> 1; if (index < lineOffsets[m]) { j = m; } else { i = m + 1; } } var line = i - 1; var column = index - lineOffsets[line]; return { line: line, column: column }; }; } var Mappings = function Mappings(hires) { this.hires = hires; this.generatedCodeLine = 0; this.generatedCodeColumn = 0; this.raw = []; this.rawSegments = this.raw[this.generatedCodeLine] = []; this.pending = null; }; Mappings.prototype.addEdit = function addEdit (sourceIndex, content, loc, nameIndex) { if (content.length) { var segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; if (nameIndex >= 0) { segment.push(nameIndex); } this.rawSegments.push(segment); } else if (this.pending) { this.rawSegments.push(this.pending); } this.advance(content); this.pending = null; }; Mappings.prototype.addUneditedChunk = function addUneditedChunk (sourceIndex, chunk, original, loc, sourcemapLocations) { var originalCharIndex = chunk.start; var first = true; while (originalCharIndex < chunk.end) { if (this.hires || first || sourcemapLocations.has(originalCharIndex)) { this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]); } if (original[originalCharIndex] === '\n') { loc.line += 1; loc.column = 0; this.generatedCodeLine += 1; this.raw[this.generatedCodeLine] = this.rawSegments = []; this.generatedCodeColumn = 0; first = true; } else { loc.column += 1; this.generatedCodeColumn += 1; first = false; } originalCharIndex += 1; } this.pending = null; }; Mappings.prototype.advance = function advance (str) { if (!str) { return; } var lines = str.split('\n'); if (lines.length > 1) { for (var i = 0; i < lines.length - 1; i++) { this.generatedCodeLine++; this.raw[this.generatedCodeLine] = this.rawSegments = []; } this.generatedCodeColumn = 0; } this.generatedCodeColumn += lines[lines.length - 1].length; }; var n = '\n'; var warned = { insertLeft: false, insertRight: false, storeName: false, }; var MagicString = function MagicString(string, options) { if ( options === void 0 ) options = {}; var chunk = new Chunk(0, string.length, string); Object.defineProperties(this, { original: { writable: true, value: string }, outro: { writable: true, value: '' }, intro: { writable: true, value: '' }, firstChunk: { writable: true, value: chunk }, lastChunk: { writable: true, value: chunk }, lastSearchedChunk: { writable: true, value: chunk }, byStart: { writable: true, value: {} }, byEnd: { writable: true, value: {} }, filename: { writable: true, value: options.filename }, indentExclusionRanges: { writable: true, value: options.indentExclusionRanges }, sourcemapLocations: { writable: true, value: new BitSet() }, storedNames: { writable: true, value: {} }, indentStr: { writable: true, value: guessIndent(string) }, }); this.byStart[0] = chunk; this.byEnd[string.length] = chunk; }; MagicString.prototype.addSourcemapLocation = function addSourcemapLocation (char) { this.sourcemapLocations.add(char); }; MagicString.prototype.append = function append (content) { if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); } this.outro += content; return this; }; MagicString.prototype.appendLeft = function appendLeft (index, content) { if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); } this._split(index); var chunk = this.byEnd[index]; if (chunk) { chunk.appendLeft(content); } else { this.intro += content; } return this; }; MagicString.prototype.appendRight = function appendRight (index, content) { if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); } this._split(index); var chunk = this.byStart[index]; if (chunk) { chunk.appendRight(content); } else { this.outro += content; } return this; }; MagicString.prototype.clone = function clone () { var cloned = new MagicString(this.original, { filename: this.filename }); var originalChunk = this.firstChunk; var clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone()); while (originalChunk) { cloned.byStart[clonedChunk.start] = clonedChunk; cloned.byEnd[clonedChunk.end] = clonedChunk; var nextOriginalChunk = originalChunk.next; var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone(); if (nextClonedChunk) { clonedChunk.next = nextClonedChunk; nextClonedChunk.previous = clonedChunk; clonedChunk = nextClonedChunk; } originalChunk = nextOriginalChunk; } cloned.lastChunk = clonedChunk; if (this.indentExclusionRanges) { cloned.indentExclusionRanges = this.indentExclusionRanges.slice(); } cloned.sourcemapLocations = new BitSet(this.sourcemapLocations); cloned.intro = this.intro; cloned.outro = this.outro; return cloned; }; MagicString.prototype.generateDecodedMap = function generateDecodedMap (options) { var this$1$1 = this; options = options || {}; var sourceIndex = 0; var names = Object.keys(this.storedNames); var mappings = new Mappings(options.hires); var locate = getLocator(this.original); if (this.intro) { mappings.advance(this.intro); } this.firstChunk.eachNext(function (chunk) { var loc = locate(chunk.start); if (chunk.intro.length) { mappings.advance(chunk.intro); } if (chunk.edited) { mappings.addEdit( sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1 ); } else { mappings.addUneditedChunk(sourceIndex, chunk, this$1$1.original, loc, this$1$1.sourcemapLocations); } if (chunk.outro.length) { mappings.advance(chunk.outro); } }); return { file: options.file ? options.file.split(/[/\\]/).pop() : null, sources: [options.source ? getRelativePath(options.file || '', options.source) : null], sourcesContent: options.includeContent ? [this.original] : [null], names: names, mappings: mappings.raw, }; }; MagicString.prototype.generateMap = function generateMap (options) { return new SourceMap(this.generateDecodedMap(options)); }; MagicString.prototype.getIndentString = function getIndentString () { return this.indentStr === null ? '\t' : this.indentStr; }; MagicString.prototype.indent = function indent (indentStr, options) { var pattern = /^[^\r\n]/gm; if (isObject(indentStr)) { options = indentStr; indentStr = undefined; } indentStr = indentStr !== undefined ? indentStr : this.indentStr || '\t'; if (indentStr === '') { return this; } options = options || {}; var isExcluded = {}; if (options.exclude) { var exclusions = typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude; exclusions.forEach(function (exclusion) { for (var i = exclusion[0]; i < exclusion[1]; i += 1) { isExcluded[i] = true; } }); } var shouldIndentNextCharacter = options.indentStart !== false; var replacer = function (match) { if (shouldIndentNextCharacter) { return ("" + indentStr + match); } shouldIndentNextCharacter = true; return match; }; this.intro = this.intro.replace(pattern, replacer); var charIndex = 0; var chunk = this.firstChunk; while (chunk) { var end = chunk.end; if (chunk.edited) { if (!isExcluded[charIndex]) { chunk.content = chunk.content.replace(pattern, replacer); if (chunk.content.length) { shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n'; } } } else { charIndex = chunk.start; while (charIndex < end) { if (!isExcluded[charIndex]) { var char = this.original[charIndex]; if (char === '\n') { shouldIndentNextCharacter = true; } else if (char !== '\r' && shouldIndentNextCharacter) { shouldIndentNextCharacter = false; if (charIndex === chunk.start) { chunk.prependRight(indentStr); } else { this._splitChunk(chunk, charIndex); chunk = chunk.next; chunk.prependRight(indentStr); } } } charIndex += 1; } } charIndex = chunk.end; chunk = chunk.next; } this.outro = this.outro.replace(pattern, replacer); return this; }; MagicString.prototype.insert = function insert () { throw new Error( 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)' ); }; MagicString.prototype.insertLeft = function insertLeft (index, content) { if (!warned.insertLeft) { console.warn( 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead' ); warned.insertLeft = true; } return this.appendLeft(index, content); }; MagicString.prototype.insertRight = function insertRight (index, content) { if (!warned.insertRight) { console.warn( 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead' ); warned.insertRight = true; } return this.prependRight(index, content); }; MagicString.prototype.move = function move (start, end, index) { if (index >= start && index <= end) { throw new Error('Cannot move a selection inside itself'); } this._split(start); this._split(end); this._split(index); var first = this.byStart[start]; var last = this.byEnd[end]; var oldLeft = first.previous; var oldRight = last.next; var newRight = this.byStart[index]; if (!newRight && last === this.lastChunk) { return this; } var newLeft = newRight ? newRight.previous : this.lastChunk; if (oldLeft) { oldLeft.next = oldRight; } if (oldRight) { oldRight.previous = oldLeft; } if (newLeft) { newLeft.next = first; } if (newRight) { newRight.previous = last; } if (!first.previous) { this.firstChunk = last.next; } if (!last.next) { this.lastChunk = first.previous; this.lastChunk.next = null; } first.previous = newLeft; last.next = newRight || null; if (!newLeft) { this.firstChunk = first; } if (!newRight) { this.lastChunk = last; } return this; }; MagicString.prototype.overwrite = function overwrite (start, end, content, options) { if (typeof content !== 'string') { throw new TypeError('replacement content must be a string'); } while (start < 0) { start += this.original.length; } while (end < 0) { end += this.original.length; } if (end > this.original.length) { throw new Error('end is out of bounds'); } if (start === end) { throw new Error( 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead' ); } this._split(start); this._split(end); if (options === true) { if (!warned.storeName) { console.warn( 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string' ); warned.storeName = true; } options = { storeName: true }; } var storeName = options !== undefined ? options.storeName : false; var contentOnly = options !== undefined ? options.contentOnly : false; if (storeName) { var original = this.original.slice(start, end); Object.defineProperty(this.storedNames, original, { writable: true, value: true, enumerable: true }); } var first = this.byStart[start]; var last = this.byEnd[end]; if (first) { var chunk = first; while (chunk !== last) { if (chunk.next !== this.byStart[chunk.end]) { throw new Error('Cannot overwrite across a split point'); } chunk = chunk.next; chunk.edit('', false); } first.edit(content, storeName, contentOnly); } else { var newChunk = new Chunk(start, end, '').edit(content, storeName); last.next = newChunk; newChunk.previous = last; } return this; }; MagicString.prototype.prepend = function prepend (content) { if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); } this.intro = content + this.intro; return this; }; MagicString.prototype.prependLeft = function prependLeft (index, content) { if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); } this._split(index); var chunk = this.byEnd[index]; if (chunk) { chunk.prependLeft(content); } else { this.intro = content + this.intro; } return this; }; MagicString.prototype.prependRight = function prependRight (index, content) { if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); } this._split(index); var chunk = this.byStart[index]; if (chunk) { chunk.prependRight(content); } else { this.outro = content + this.outro; } return this; }; MagicString.prototype.remove = function remove (start, end) { while (start < 0) { start += this.original.length; } while (end < 0) { end += this.original.length; } if (start === end) { return this; } if (start < 0 || end > this.original.length) { throw new Error('Character is out of bounds'); } if (start > end) { throw new Error('end must be greater than start'); } this._split(start); this._split(end); var chunk = this.byStart[start]; while (chunk) { chunk.intro = ''; chunk.outro = ''; chunk.edit(''); chunk = end > chunk.end ? this.byStart[chunk.end] : null; } return this; }; MagicString.prototype.lastChar = function lastChar () { if (this.outro.length) { return this.outro[this.outro.length - 1]; } var chunk = this.lastChunk; do { if (chunk.outro.length) { return chunk.outro[chunk.outro.length - 1]; } if (chunk.content.length) { return chunk.content[chunk.content.length - 1]; } if (chunk.intro.length) { return chunk.intro[chunk.intro.length - 1]; } } while ((chunk = chunk.previous)); if (this.intro.length) { return this.intro[this.intro.length - 1]; } return ''; }; MagicString.prototype.lastLine = function lastLine () { var lineIndex = this.outro.lastIndexOf(n); if (lineIndex !== -1) { return this.outro.substr(lineIndex + 1); } var lineStr = this.outro; var chunk = this.lastChunk; do { if (chunk.outro.length > 0) { lineIndex = chunk.outro.lastIndexOf(n); if (lineIndex !== -1) { return chunk.outro.substr(lineIndex + 1) + lineStr; } lineStr = chunk.outro + lineStr; } if (chunk.content.length > 0) { lineIndex = chunk.content.lastIndexOf(n); if (lineIndex !== -1) { return chunk.content.substr(lineIndex + 1) + lineStr; } lineStr = chunk.content + lineStr; } if (chunk.intro.length > 0) { lineIndex = chunk.intro.lastIndexOf(n); if (lineIndex !== -1) { return chunk.intro.substr(lineIndex + 1) + lineStr; } lineStr = chunk.intro + lineStr; } } while ((chunk = chunk.previous)); lineIndex = this.intro.lastIndexOf(n); if (lineIndex !== -1) { return this.intro.substr(lineIndex + 1) + lineStr; } return this.intro + lineStr; }; MagicString.prototype.slice = function slice (start, end) { if ( start === void 0 ) start = 0; if ( end === void 0 ) end = this.original.length; while (start < 0) { start += this.original.length; } while (end < 0) { end += this.original.length; } var result = ''; var chunk = this.firstChunk; while (chunk && (chunk.start > start || chunk.end <= start)) { if (chunk.start < end && chunk.end >= end) { return result; } chunk = chunk.next; } if (chunk && chunk.edited && chunk.start !== start) { throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); } var startChunk = chunk; while (chunk) { if (chunk.intro && (startChunk !== chunk || chunk.start === start)) { result += chunk.intro; } var containsEnd = chunk.start < end && chunk.end >= end; if (containsEnd && chunk.edited && chunk.end !== end) { throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); } var sliceStart = startChunk === chunk ? start - chunk.start : 0; var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length; result += chunk.content.slice(sliceStart, sliceEnd); if (chunk.outro && (!containsEnd || chunk.end === end)) { result += chunk.outro; } if (containsEnd) { break; } chunk = chunk.next; } return result; }; MagicString.prototype.snip = function snip (start, end) { var clone = this.clone(); clone.remove(0, start); clone.remove(end, clone.original.length); return clone; }; MagicString.prototype._split = function _split (index) { if (this.byStart[index] || this.byEnd[index]) { return; } var chunk = this.lastSearchedChunk; var searchForward = index > chunk.end; while (chunk) { if (chunk.contains(index)) { return this._splitChunk(chunk, index); } chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start]; } }; MagicString.prototype._splitChunk = function _splitChunk (chunk, index) { if (chunk.edited && chunk.content.length) { var loc = getLocator(this.original)(index); throw new Error( ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")") ); } var newChunk = chunk.split(index); this.byEnd[index] = chunk; this.byStart[index] = newChunk; this.byEnd[newChunk.end] = newChunk; if (chunk === this.lastChunk) { this.lastChunk = newChunk; } this.lastSearchedChunk = chunk; return true; }; MagicString.prototype.toString = function toString () { var str = this.intro; var chunk = this.firstChunk; while (chunk) { str += chunk.toString(); chunk = chunk.next; } return str + this.outro; }; MagicString.prototype.isEmpty = function isEmpty () { var chunk = this.firstChunk; do { if ( (chunk.intro.length && chunk.intro.trim()) || (chunk.content.length && chunk.content.trim()) || (chunk.outro.length && chunk.outro.trim()) ) { return false; } } while ((chunk = chunk.next)); return true; }; MagicString.prototype.length = function length () { var chunk = this.firstChunk; var length = 0; do { length += chunk.intro.length + chunk.content.length + chunk.outro.length; } while ((chunk = chunk.next)); return length; }; MagicString.prototype.trimLines = function trimLines () { return this.trim('[\\r\\n]'); }; MagicString.prototype.trim = function trim (charType) { return this.trimStart(charType).trimEnd(charType); }; MagicString.prototype.trimEndAborted = function trimEndAborted (charType) { var rx = new RegExp((charType || '\\s') + '+$'); this.outro = this.outro.replace(rx, ''); if (this.outro.length) { return true; } var chunk = this.lastChunk; do { var end = chunk.end; var aborted = chunk.trimEnd(rx); if (chunk.end !== end) { if (this.lastChunk === chunk) { this.lastChunk = chunk.next; } this.byEnd[chunk.end] = chunk; this.byStart[chunk.next.start] = chunk.next; this.byEnd[chunk.next.end] = chunk.next; } if (aborted) { return true; } chunk = chunk.previous; } while (chunk); return false; }; MagicString.prototype.trimEnd = function trimEnd (charType) { this.trimEndAborted(charType); return this; }; MagicString.prototype.trimStartAborted = function trimStartAborted (charType) { var rx = new RegExp('^' + (charType || '\\s') + '+'); this.intro = this.intro.replace(rx, ''); if (this.intro.length) { return true; } var chunk = this.firstChunk; do { var end = chunk.end; var aborted = chunk.trimStart(rx); if (chunk.end !== end) { if (chunk === this.lastChunk) { this.lastChunk = chunk.next; } this.byEnd[chunk.end] = chunk; this.byStart[chunk.next.start] = chunk.next; this.byEnd[chunk.next.end] = chunk.next; } if (aborted) { return true; } chunk = chunk.next; } while (chunk); return false; }; MagicString.prototype.trimStart = function trimStart (charType) { this.trimStartAborted(charType); return this; }; function parseAttributeValue(value) { return /^['"]/.test(value) ? value.slice(1, -1) : value; } function parseAttributes(str, start) { const attrs = []; str.split(/\s+/) .filter(Boolean) .forEach((attr) => { const attrStart = start + str.indexOf(attr); const [name, value] = attr.split('='); attrs[name] = value ? parseAttributeValue(value) : name; attrs.push({ type: 'Attribute', name, value: !value || [ { type: 'Text', start: attrStart + attr.indexOf('=') + 1, end: attrStart + attr.length, raw: parseAttributeValue(value) } ], start: attrStart, end: attrStart + attr.length }); }); return attrs; } function extractTag(htmlx, tag, useNewTransformation) { const exp = new RegExp(`(<!--[^]*?-->)|(<${tag}([\\S\\s]*?)>)([\\S\\s]*?)<\\/${tag}>`, 'g'); const matches = []; let match = null; while ((match = exp.exec(htmlx)) != null) { if (match[0].startsWith('<!--')) { continue; } let content = match[4]; if (!content) { if (useNewTransformation) { content = ''; } else { continue; } } const start = match.index + match[2].length; const end = start + content.length; const containerStart = match.index; const containerEnd = match.index + match[0].length; matches.push({ start: containerStart, end: containerEnd, name: tag, type: tag === 'style' ? 'Style' : 'Script', attributes: parseAttributes(match[3], containerStart + `<${tag}`.length), content: { type: 'Text', start, end, value: content, raw: content } }); } return matches; } function findVerbatimElements(htmlx, useNewTransformation) { return [ ...extractTag(htmlx, 'script', useNewTransformation), ...extractTag(htmlx, 'style', useNewTransformation) ]; } function blankVerbatimContent(htmlx, verbatimElements) { let output = htmlx; for (const node of verbatimElements) { const content = node.content; if (content) { output = output.substring(0, content.start) + output .substring(content.start, content.end) .replace(/[^\n]/g, ' ') .replace(/[^\n][^\n][^\n][^\n]\n/g, '/**/\n') + output.substring(content.end); } } return output; } function parseHtmlx(htmlx, options) { const verbatimElements = findVerbatimElements(htmlx, options === null || options === void 0 ? void 0 : options.useNewTransformation); const deconstructed = blankVerbatimContent(htmlx, verbatimElements); const parsingCode = (options === null || options === void 0 ? void 0 : options.emitOnTemplateError) ? blankPossiblyErrorOperatorOrPropertyAccess(deconstructed) : deconstructed; const htmlxAst = compiler_1.parse(parsingCode).html; for (const s of verbatimElements) { htmlxAst.children.push(s); htmlxAst.start = Math.min(htmlxAst.start, s.start); htmlxAst.end = Math.max(htmlxAst.end, s.end); } return { htmlxAst, tags: verbatimElements }; } const possibleOperatorOrPropertyAccess = new Set([ '.', '?', '*', '~', '=', '<', '!', '&', '^', '|', ',', '+', '-' ]); function blankPossiblyErrorOperatorOrPropertyAccess(htmlx) { let index = htmlx.indexOf('}'); let lastIndex = 0; const { length } = htmlx; while (index < length && index >= 0) { let backwardIndex = index - 1; while (backwardIndex > lastIndex) { const char = htmlx.charAt(backwardIndex); if (possibleOperatorOrPropertyAccess.has(char)) { const isPlusOrMinus = char === '+' || char === '-'; const isIncrementOrDecrement = isPlusOrMinus && htmlx.charAt(backwardIndex - 1) === char; if (isIncrementOrDecrement) { backwardIndex -= 2; continue; } htmlx = htmlx.substring(0, backwardIndex) + ' ' + htmlx.substring(backwardIndex + 1); } else if (!/\s/.test(char)) { break; } backwardIndex--; } lastIndex = index; index = htmlx.indexOf('}', index + 1); } return htmlx; } function isMember$1(parent, prop) { return parent.type == 'MemberExpression' && prop == 'property'; } function isObjectKey(parent, prop) { return parent.type == 'Property' && prop == 'key'; } function isObjectValue(parent, prop) { return parent.type == 'Property' && prop == 'value'; } function isObjectValueShortHand(property) { const { value, key } = property; return value && isIdentifier(value) && key.start === value.start && key.end == value.end; } function attributeValueIsString(attr) { var _a; return attr.value.length !== 1 || ((_a = attr.value[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Text'; } function isDestructuringPatterns(node) { return node.type === 'ArrayPattern' || node.type === 'ObjectPattern'; } function isIdentifier(node) { return node.type === 'Identifier'; } function getSlotName(child) { var _a, _b; const slot = (_a = child.attributes) === null || _a === void 0 ? void 0 : _a.find((a) => a.name == 'slot'); return (_b = slot === null || slot === void 0 ? void 0 : slot.value) === null || _b === void 0 ? void 0 : _b[0].raw; } // @ts-check class WalkerBase$1 { constructor() { this.should_skip = false; this.should_remove = false; this.replacement = null; this.context = { skip: () => (this.should_skip = true), remove: () => (this.should_remove = true), replace: (node) => (this.replacement = node) }; } replace(parent, prop, index, node) { if (parent) { if (index !== null) { parent[prop][index] = node; } else { parent[prop] = node; } } } remove(parent, prop, index) { if (parent) { if (index !== null) { parent[prop].splice(index, 1); } else { delete parent[prop]; } } } } // @ts-check class SyncWalker$1 extends WalkerBase$1 { constructor(enter, leave) { super(); this.enter = enter; this.leave = leave; } visit(node, parent, prop, index) { if (node) { if (this.enter) { const _should_skip = this.should_skip; const _should_remove = this.should_remove; const _replacement = this.replacement; this.should_skip = false; this.should_remove = false; this.replacement = null; this.enter.call(this.context, node, parent, prop, index); if (this.replacement) { node = this.replacement; this.replace(parent, prop, index, node); } if (this.should_remove) { this.remove(parent, prop, index); } const skipped = this.should_skip; const removed = this.should_remove; this.should_skip = _should_skip; this.should_remove = _should_remove; this.replacement = _replacement; if (skipped) return node; if (removed) return null; } for (const key in node) { const value = node[key]; if (typeof value !== "object") { continue; } else if (Array.isArray(value)) { for (let i = 0; i < value.length; i += 1) { if (value[i] !== null && typeof value[i].type === 'string') { if (!this.visit(value[i], node, key, i)) { i--; } } } } else if (value !== null && typeof value.type === "string") { this.visit(value, node, key, null); } } if (this.leave) { const _replacement = this.replacement; const _should_remove = this.should_remove; this.replacement = null; this.should_remove = false; this.leave.call(this.context, node, parent, prop, index); if (this.replacement) { node = this.replacement; this.replace(parent, prop, index, node); } if (this.should_remove) { this.remove(parent, prop, index); } const removed = this.should_remove; this.replacement = _replacement; this.should_remove = _should_remove; if (removed) return null; } } return node; } } // @ts-check function walk$1(ast, { enter, leave }) { const instance = new SyncWalker$1(enter, leave); return instance.visit(ast, null); } const IGNORE_START_COMMENT = '/*Ωignore_startΩ*/'; const IGNORE_END_COMMENT = '/*Ωignore_endΩ*/'; function surroundWithIgnoreComments(str) { return IGNORE_START_COMMENT + str + IGNORE_END_COMMENT; } function getTypeForComponent(node) { if (node.name === 'svelte:component' || node.name === 'svelte:self') { return '__sveltets_1_componentType()'; } else { return node.name; } } function getInstanceTypeSimple(node, str) { const instanceOf = (str) => `__sveltets_1_instanceOf(${str})`; switch (node.type) { case 'InlineComponent': if (node.name === 'svelte:component' && node.expression) { const thisVal = str.original.substring(node.expression.start, node.expression.end); return `new (${thisVal})({target: __sveltets_1_any(''), props: __sveltets_1_any('')})`; } else if (node.name === 'svelte:component' || node.name === 'svelte:self') { return instanceOf('__sveltets_1_componentType()'); } else { return `new ${node.name}({target: __sveltets_1_any(''), props: __sveltets_1_any('')})`; } case 'Element': return instanceOf(`__sveltets_1_ctorOf(__sveltets_1_mapElementTag('${node.name}'))`); case 'Body': return instanceOf('HTMLBodyElement'); case 'Slot': return instanceOf('HTMLSlotElement'); } } function getInstanceType(node, originalStr, replacedPropValues = []) { if (node.name === 'svelte:component' || node.name === 'svelte:self') { return '__sveltets_1_instanceOf(__sveltets_1_componentType())'; } const propsStr = getNameValuePairsFromAttributes(node, originalStr) .map(({ name, value }) => { var _a; const replacedPropValue = (_a = replacedPropValues.find(({ name: propName }) => propName === name)) === null || _a === void 0 ? void 0 : _a.replacement; return `'${name}':${replacedPropValue || value}`; }) .join(', '); return surroundWithIgnoreComments(`new ${node.name}({target: __sveltets_1_any(''), props: {${propsStr}}})`); } function getInstanceTypeForDefaultSlot(node, originalStr, replacedPropsPrefix) { if (node.name === 'svelte:component' || node.name === 'svelte:self') { return { str: '__sveltets_1_instanceOf(__sveltets_1_componentType())', shadowedProps: [] }; } const lets = new Set((node.attributes || []).filter((attr) => attr.type === 'Let').map((attr) => attr.name)); const shadowedProps = []; const propsStr = getNameValuePairsFromAttributes(node, originalStr) .map(({ name, value, identifier, complexExpression }) => { if (complexExpression || lets.has(identifier)) { const replacement = replacedPropsPrefix + sanitizePropName$1(name); shadowedProps.push({ name, value, replacement }); return `'${name}':${replacement}`; } else { return `'${name}':${value}`; } }) .join(', '); const str = surroundWithIgnoreComments(`new ${node.name}({target: __sveltets_1_any(''), props: {${propsStr}}})`); return { str, shadowedProps }; } function getNameValuePairsFromAttributes(node, originalStr) { return (node.attributes || []) .filter((attr) => attr.type === 'Attribute' && !attr.name.startsWith('--')) .map((attr) => { const name = attr.name; if (attr.value === true) { return { name, value: 'true' }; } if (attr.value.length === 1) { const val = attr.value[0]; if (val.type === 'AttributeShorthand') { return { name, value: name, identifier: name }; } if (val.type === 'Text') { const quote = ['"', "'"].includes(originalStr[val.start - 1]) ? originalStr[val.start - 1] : "'"; return { name, value: `${quote}${val.data || val.raw}${quote}` }; } if (val.type === 'MustacheTag') { const valueStr = originalStr.substring(val.start + 1, val.end - 1); if (val.expression.type === 'Identifier') { return { name, value: valueStr, identifier: valueStr }; } if (val.expression.type === 'Literal') { const value = typeof val.expression.value === 'string' ? val.expression.raw : val.expression.value; return { name, value }; } return { name, value: valueStr, complexExpression: true }; } } if (!attr.value.length) { return { name, value: '""' }; } const value = attr.value .map((val) => val.type === 'Text' ? val.raw : val.type === 'MustacheTag' ? '$' + originalStr.substring(val.start, val.end) : '') .join(''); return { name, value: `\`${value}\`` }; }); } function sanitizePropName$1(name) { return name .split('') .map((char) => (/[0-9A-Za-z$_]/.test(char) ? char : '_')) .join(''); } function beforeStart(start) { return start - 1; } function isShortHandAttribute(attr) { return attr.expression.end === attr.end; } function isQuote(str) { return str === '"' || str === "'"; } function getIdentifiersInIfExpression(expression) { const offset = expression.start; const identifiers = new Map(); walk$1(expression, { enter: (node, parent) => { switch (node.type) { case 'Identifier': if ((parent === null || parent === void 0 ? void 0 : parent.property) !== node && (parent === null || parent === void 0 ? void 0 : parent.callee) !== node) { add(node); } break; } } }); function add(node) { let entry = identifiers.get(node.name); if (!entry) { entry = []; } entry.push({ start: node.start - offset, end: node.end - offset }); identifiers.set(node.name, entry); } return identifiers; } function usesLet(node) { var _a; return (_a = node.attributes) === null || _a === void 0 ? void 0 : _a.some((attr) => attr.type === 'Let'); } function buildTemplateString(attr, str, htmlx, leadingOverride, trailingOverride, overrideStart) { overrideStart = overrideStart !== null && overrideStart !== void 0 ? overrideStart : htmlx.lastIndexOf('=', attr.value[0].start); str.overwrite(overrideStart, attr.value[0].start, leadingOverride); for (const n of attr.value) { if (n.type == 'MustacheTag') { str.appendRight(n.start, '$'); } } if (isQuote(htmlx[attr.end - 1])) { str.overwrite(attr.end - 1, attr.end, trailingOverride); } else { str.appendLeft(attr.end, trailingOverride); } } function withTrailingPropertyAccess$1(originalText, position) { let index = position; while (index < originalText.length) { const char = originalText[index]; if (!char.trim()) { index++; continue; } if (char === '.') { return index + 1; } if (char === '?' && originalText[index + 1] === '.') { return index + 2; } break; } return position; } function handleActionDirective$1(htmlx, str, attr, parent) { str.overwrite(attr.start, attr.start + 'use:'.length, '{...__sveltets_1_ensureAction('); const name = parent.name === 'svelte:body' ? 'body' : parent.name; if (!attr.expression) { str.appendLeft(attr.end, `(__sveltets_1_mapElementTag('${name}')))}`); return; } str.overwrite(attr.start + `use:${attr.name}`.length, attr.expression.start, `(__sveltets_1_mapElementTag('${name}'),(`); str.appendLeft(withTrailingPropertyAccess$1(str.original, attr.expression.end), ')))'); const lastChar = htmlx[attr.end - 1]; if (isQuote(lastChar)) { str.remove(attr.end - 1, attr.end); } } function handleAnimateDirective$1(htmlx, str, attr, parent) { str.overwrite(attr.start, htmlx.indexOf(':', attr.start) + 1, '{...__sveltets_1_ensureAnimation('); const nodeType = `__sveltets_1_mapElementTag('${parent.name}')`; if (!attr.expression) { str.appendLeft(attr.end, `(${nodeType},__sveltets_1_AnimationMove,{}))}`); return; } str.overwrite(htmlx.indexOf(':', attr.start) + 1 + `${attr.name}`.length, attr.expression.start, `(${nodeType},__sveltets_1_AnimationMove,(`); str.appendLeft(withTrailingPropertyAccess$1(str.original, attr.expression.end), ')))'); if (isQuote(htmlx[attr.end - 1])) { str.remove(attr.end - 1, attr.end); } } var svgAttributes$1 = 'accent-height accumulate additive alignment-baseline allowReorder alphabetic amplitude arabic-form ascent attributeName attributeType autoReverse azimuth baseFrequency baseline-shift baseProfile bbox begin bias by calcMode cap-height class clip clipPathUnits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering contentScriptType contentStyleType cursor cx cy d decelerate descent diffuseConstant direction display divisor dominant-baseline dur dx dy edgeMode elevation enable-background end exponent externalResourcesRequired fill fill-opacity fill-rule filter filterRes filterUnits flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight format from fr fx fy g1 g2 glyph-name glyph-orientation-horizontal glyph-orientation-vertical glyphRef gradientTransform gradientUnits hanging height href horiz-adv-x horiz-origin-x id ideographic image-rendering in in2 intercept k k1 k2 k3 k4 kernelMatrix kernelUnitLength kerning keyPoints keySplines keyTimes lang lengthAdjust letter-spacing lighting-color limitingConeAngle local marker-end marker-mid marker-start markerHeight markerUnits markerWidth mask maskContentUnits maskUnits mathematical max media method min mode name numOctaves offset onabort onactivate onbegin onclick onend onerror onfocusin onfocusout onload onmousedown onmousemove onmouseout onmouseover onmouseup onrepeat onresize onscroll onunload opacity operator order orient orientation origin overflow overline-position overline-thickness panose-1 paint-order pathLength patternContentUnits patternTransform patternUnits pointer-events points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits r radius refX refY rendering-intent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry scale seed shape-rendering slope spacing specularConstant specularExponent speed spreadMethod startOffset stdDeviation stemh stemv stitchTiles stop-color stop-opacity strikethrough-position strikethrough-thickness string stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width style surfaceScale systemLanguage tabindex tableValues target targetX targetY text-anchor text-decoration text-rendering textLength to transform type u1 u2 underline-position underline-thickness unicode unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical values version vert-adv-y vert-origin-x vert-origin-y viewBox viewTarget visibility width widths word-spacing writing-mode x x-height x1 x2 xChannelSelector xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xml:lang xml:space y y1 y2 yChannelSelector z zoomAndPan'.split(' '); const numberOnlyAttributes$1 = new Set([ 'cols', 'colspan', 'currenttime', 'defaultplaybackrate', 'high', 'low', 'marginheight', 'marginwidth', 'minlength', 'maxlength', 'optimum', 'rows', 'rowspan', 'size', 'span', 'start', 'tabindex', 'results', 'volume' ]); function handleAttribute$1(htmlx, str, attr, parent, preserveCase) { var _a, _b, _c; const shouldApplySlotCheck = parent.type === 'Slot' && attr.name !== 'name'; const slotName = shouldApplySlotCheck ? ((_c = (_b = (_a = parent.attributes) === null || _a === void 0 ? void 0 : _a.find((a) => a.name === 'name')) === null || _b === void 0 ? void 0 : _b.value[0]) === null || _c === void 0 ? void 0 : _c.data) || 'default' : undefined; const ensureSlotStr = `__sveltets_ensureSlot("${slotName}","${attr.name}",`; let transformedFromDirectiveOrNamespace = false; const transformAttributeCase = (name) => { if (!preserveCase && !svgAttributes$1.find((x) => x == name)) { return name.toLowerCase(); } else { return name; } }; if (parent.type == 'Element') { const sapperLinkActions = ['sapper:prefetch', 'sapper:noscroll']; const sveltekitLinkActions = [ 'sveltekit:prefetch', 'sveltekit:noscroll', 'sveltekit:reload' ]; if ((attr.value !== true && !(attr.value.length && attr.value.length == 1 && attr.value[0].type == 'AttributeShorthand')) || sapperLinkActions.includes(attr.name) || sveltekitLinkActions.includes(attr.name)) { let name = transformAttributeCase(attr.name); const colonIndex = name.indexOf(':'); if (colonIndex >= 0) { const parts = name.split(':'); name = parts[0] + parts[1][0].toUpperCase() + parts[1].substring(1); } str.overwrite(attr.start, attr.start + attr.name.length, name); transformedFromDirectiveOrNamespace = true; } } if (parent.type === 'InlineComponent' && attr.name.startsWith('--') && attr.value !== true) { str.prependRight(attr.start, '{...__sveltets_1_cssProp({"'); buildTemplateString(attr, str, htmlx, '": `', '`})}'); return; } if (attr.value === true) { if (parent.type === 'Element' && !transformedFromDirectiveOrNamespace && parent.name !== '!DOCTYPE') { str.overwrite(attr.start, attr.end, transformAttributeCase(attr.name)); } return; } if (attr.value.length == 0) { return; } if (attr.value.length == 1) { const attrVal = attr.value[0]; if (attr.name == 'slot') { str.remove(attr.start, attr.end); return; } if (attrVal.type == 'AttributeShorthand') { let attrName = attrVal.expression.name; if (parent.type == 'Element') { attrName = transformAttributeCase(attrName); } str.appendRight(attr.start, `${attrName}=`); if (shouldApplySlotCheck) { str.prependRight(attr.start + 1, ensureSlotStr); str.prependLeft(attr.end - 1, ')'); } return; } const equals = htmlx.lastIndexOf('=', attrVal.start); const sanitizedName = sanitizeLeadingChars(attr.name); if (sanitizedName !== attr.name) { str.overwrite(attr.start, equals, sanitizedName); } if (attrVal.type == 'Text') { const endsWithQuote = htmlx.lastIndexOf('"', attrVal.end) === attrVal.end - 1 || htmlx.lastIndexOf("'", attrVal.end) === attrVal.end - 1; const needsQuotes = attrVal.end == attr.end && !endsWithQuote; const hasBrackets = htmlx.lastIndexOf('}', attrVal.end) === attrVal.end - 1 || htmlx.lastIndexOf('}"', attrVal.end) === attrVal.end - 1 || htmlx.lastIndexOf("}'", attrVal.end) === attrVal.end - 1; const needsNumberConversion = !hasBrackets && parent.type === 'Element' && numberOnlyAttributes$1.has(attr.name.toLowerCase()) && !isNaN(attrVal.data); if (needsNumberConversion) { const begin = '{' + (shouldApplySlotCheck ? ensureSlotStr : ''); const end = shouldApplySlotCheck ? ')}' : '}'; if (needsQuotes) { str.prependRight(equals + 1, begin); str.appendLeft(attr.end, end); } else { str.overwrite(equals + 1, equals + 2, begin); str.overwrite(attr.end - 1, attr.end, end); } } else if (needsQuotes) { const begin = shouldApplySlotCheck ? `{${ensureSlotStr}"` : '"'; const end = shouldApplySlotCheck ? '")}' : '"'; str.prependRight(equals + 1, begin); str.appendLeft(attr.end, end); } else if (shouldApplySlotCheck) { str.prependRight(equals + 1, `{${ensureSlotStr}`); str.appendLeft(attr.end, ')}'); } return; } if (attrVal.type == 'MustacheTag') { const isInQuotes = attrVal.end != attr.end; if (isInQuotes) { str.remove(attrVal.start - 1, attrVal.start); str.remove(attr.end - 1, attr.end); } if (shouldApplySlotCheck) { str.prependRight(attrVal.start + 1, ensureSlotStr); str.appendLeft(attr.end - (isInQuotes ? 2 : 1), ')'); } return; } return; } buildTemplateString(attr, str, htmlx, shouldApplySlotCheck ? `={${ensureSlotStr}\`` : '={`', shouldApplySlotCheck ? '`)}' : '`}'); } function sanitizeLeadingChars(attrName) { let sanitizedName = ''; for (let i = 0; i < attrName.length; i++) { if (/[A-Za-z$_]/.test(attrName[i])) { sanitizedName += attrName.substr(i); return sanitizedName; } else { sanitizedName += '_'; } } return sanitizedName; } function extractConstTags(children) { const tags = []; for (const child of children) { if (child.type === 'ConstTag') { const constTag = child; tags.push((insertionPoint, str) => { str.appendRight(constTag.expression.left.start, 'const '); const expressionEnd = withTrailingPropertyAccess$1(str.original, constTag.expression.right.end); str.move(constTag.expression.left.start, expressionEnd, insertionPoint); str.appendLeft(expressionEnd, ';'); str.overwrite(constTag.start + 1, constTag.expression.left.start - 1, '', { contentOnly: true }); }); } } return tags; } function handleAwait$1(htmlx, str, awaitBlock, ifScope, templateScopeManager) { let ifCondition = ifScope.getFullCondition(); ifCondition = ifCondition ? surroundWithIgnoreComments(`if(${ifCondition}) {`) : ''; templateScopeManager.awaitEnter(awaitBlock); const constRedeclares = ifScope.getConstDeclaration(); str.overwrite(awaitBlock.start, awaitBlock.expression.start, `{() => {${constRedeclares}${ifCondition}let _$$p = (`); const awaitEndStart = htmlx.lastIndexOf('{', awaitBlock.end - 1); str.overwrite(awaitEndStart, awaitBlock.end, '</>})}}' + (ifCondition ? '}' : '')); } function handleAwaitPending(awaitBlock, htmlx, str, ifScope) { if (awaitBlock.pending.skip) { return; } const pendingStart = htmlx.indexOf('}', awaitBlock.expression.end); const pendingEnd = !awaitBlock.then.skip ? awaitBlock.then.start : !awaitBlock.catch.skip ? awaitBlock.catch.start : htmlx.lastIndexOf('{', awaitBlock.end); str.overwrite(withTrailingPropertyAccess$1(str.original, awaitBlock.expression.end), pendingStart + 1, ');'); str.appendRight(pendingStart + 1, ` ${ifScope.addPossibleIfCondition()}<>`); str.appendLeft(pendingEnd, '</>; '); if (!awaitBlock.then.skip) { return; } str.appendLeft(pendingEnd, '__sveltets_1_awaitThen(_$$p, () => {<>'); } function handleAwaitThen(awaitBlock, htmlx, str, ifScope) { if (awaitBlock.then.skip) { return; } let thenStart; let thenEnd; if (!awaitBlock.pending.skip) { thenStart = awaitBlock.then.start; if (awaitBlock.value) { thenEnd = htmlx.indexOf('}', awaitBlock.value.end) + 1; } else { thenEnd = htmlx.indexOf('}', awaitBlock.then.start) + 1; } } else { thenStart = htmlx.indexOf('then', awaitBlock.expression.end); thenEnd = htmlx.lastIndexOf('}', awaitBlock.then.start) + 1; str.overwrite(awaitBlock.expression.end, thenStart, '); '); } if (awaitBlock.value) { str.overwrite(thenStart, awaitBlock.value.start, '__sveltets_1_awaitThen(_$$p, ('); str.overwrite(awaitBlock.value.end, thenEnd, ') => {'); extractConstTags(awaitBlock.then.children).forEach((insertion) => { insertion(thenEnd, str); }); str.appendRight(thenEnd, `${ifScope.addPossibleIfCondition()}<>`); } else { const awaitThenFn = '__sveltets_1_awaitThen(_$$p, () => {'; if (thenStart === thenEnd) { str.appendLeft(thenStart, awaitThenFn); } else { str.overwrite(thenStart, thenEnd, awaitThenFn); } extractConstTags(awaitBlock.then.children).forEach((insertion) => { insertion(thenEnd, str); }); str.appendRight(thenEnd, `${ifScope.addPossibleIfCondition()}<>`); } } function handleAwaitCatch(awaitBlock, htmlx, str, ifScope) { if (awaitBlock.catch.skip) { return; } if (awaitBlock.pending.skip && awaitBlock.then.skip) { if (awaitBlock.error) { const catchBegin = htmlx.indexOf('}', awaitBlock.error.end) + 1; str.overwrite(awaitBlock.expression.end, awaitBlock.error.start, '); __sveltets_1_awaitThen(_$$p, () => {}, ('); str.overwrite(awaitBlock.error.end, catchBegin, ') => {'); extractConstTags(awaitBlock.catch.children).forEach((insertion) => { insertion(catchBegin, str); }); str.appendRight(catchBegin, '<>'); } else { const catchBegin = htmlx.indexOf('}', awaitBlock.expression.end) + 1; str.overwrite(awaitBlock.expression.end, catchBegin, '); __sveltets_1_awaitThen(_$$p, () => {}, () => {'); extractConstTags(awaitBlock.catch.children).forEach((insertion) => { insertion(catchBegin, str); }); str.appendRight(catchBegin, '<>'); } } else { const catchStart = awaitBlock.catch.start; const catchSymbolEnd = htmlx.indexOf(':catch', catchStart) + ':catch'.length; const errorStart = awaitBlock.error ? awaitBlock.error.start : catchSymbolEnd; const errorEnd = awaitBlock.error ? awaitBlock.error.end : errorStart; const catchEnd = htmlx.indexOf('}', errorEnd) + 1; str.overwrite(catchStart, errorStart, '</>}, ('); str.overwrite(errorEnd, catchEnd, ') => {'); extractConstTags(awaitBlock.catch.children).forEach((insertion) => { insertion(catchEnd, str); }); str.appendRight(catchEnd, `${ifScope.addPossibleIfCondition()}<>`); } } const oneWayBindingAttributes$1 = new Map(['clientWidth', 'clientHeight', 'offsetWidth', 'offsetHeight'] .map((e) => [e, 'HTMLDivElement']) .concat(['duration', 'buffered', 'seekable', 'seeking', 'played', 'ended'].map((e) => [ e, 'HTMLMediaElement' ]))); new Set([...oneWayBindingAttributes$1.keys(), 'this']); function handleBinding$1(htmlx, str, attr, el) { if (attr.name == 'group' && el.name == 'input') { str.remove(attr.start, attr.expression.start); str.appendLeft(attr.expression.start, '{...__sveltets_1_empty('); const endBrackets = ')}'; if (isShortHandAttribute(attr)) { str.prependRight(attr.end, endBrackets); } else { str.overwrite(withTrailingPropertyAccess$1(str.original, attr.expression.end), attr.end, endBrackets); } return; } const supportsBindThis = [ 'InlineComponent', 'Element', 'Body', 'Slot' ]; if (attr.name === 'this' && supportsBindThis.includes(el.type)) { const thisType = getInstanceTypeSimple(el, str); if (thisType) { str.overwrite(attr.start, attr.expression.start, '{...__sveltets_1_empty('); const instanceOfThisAssignment = ' = ' + surroundWithIgnoreComments(thisType) + ')}'; str.overwrite(attr.expression.end, attr.end, instanceOfThisAssignment); return; } } if (oneWayBindingAttributes$1.has(attr.name) && el.type === 'Element') { str.remove(attr.start, attr.expression.start); str.appendLeft(attr.expression.start, '{...__sveltets_1_empty('); if (isShortHandAttribute(attr)) { str.appendLeft(attr.end, `=__sveltets_1_instanceOf(${oneWayBindingAttributes$1.get(attr.name)}).${attr.name})}`); } else { str.overwrite(attr.expression.end, attr.end, `=__sveltets_1_instanceOf(${oneWayBindingAttributes$1.get(attr.name)}).${attr.name})}`); } return; } str.remove(attr.start, attr.start + 'bind:'.length); if (attr.expression.start === attr.start + 'bind:'.length) { str.prependLeft(attr.expression.start, `${attr.name}={`); str.appendLeft(attr.end, '}'); return; } const lastChar = htmlx[attr.end - 1]; if (isQuote(lastChar)) { const firstQuote = htmlx.indexOf(lastChar, attr.start); str.remove(firstQuote, firstQuote + 1); str.remove(attr.end - 1, attr.end); } } function handleClassDirective$1(str, attr) { str.overwrite(attr.start, attr.expression.start, '{...__sveltets_1_ensureType(Boolean, !!('); const endBrackets = '))}'; if (attr.end !== attr.expression.end) { str.overwrite(withTrailingPropertyAccess$1(str.original, attr.expression.end), attr.end, endBrackets); } else { str.appendLeft(attr.end, endBrackets); } } function handleComment$1(str, node) { str.overwrite(node.start, node.end, '', { contentOnly: true }); } const shadowedPropsSymbol = Symbol('shadowedProps'); function handleSlot(htmlx, str, slotEl, component, slotName, ifScope, templateScope) { var _a; const slotElIsComponent = slotEl === component; let hasMovedLet = false; let slotDefInsertionPoint; const calculateSlotDefInsertionPoint = () => { slotDefInsertionPoint = slotDefInsertionPoint || (slotElIsComponent ? htmlx.lastIndexOf('>', slotEl.children[0].start) + 1 : slotEl.start); }; for (const attr of slotEl.attributes) { if (attr.type != 'Let') { continue; } if (slotElIsComponent && slotEl.children.length == 0) { str.remove(attr.start, attr.end); continue; } calculateSlotDefInsertionPoint(); str.move(attr.start, attr.end, slotDefInsertionPoint); str.remove(attr.start, attr.start + 'let:'.length); if (hasMovedLet) { str.appendRight(attr.start + 'let:'.length, ', '); } templateScope.inits.add(((_a = attr.expression) === null || _a === void 0 ? void 0 : _a.name) || attr.name); hasMovedLet = true; if (attr.expression) { const equalSign = htmlx.lastIndexOf('=', attr.expression.start); const curly = htmlx.lastIndexOf('{', beforeStart(attr.expression.start)); str.overwrite(equalSign, curly + 1, ':'); str.remove(attr.expression.end, attr.end); } } const hasConstTag = slotEl.children.some((child) => child.type === 'ConstTag'); if (!hasMovedLet && !hasConstTag) { return; } calculateSlotDefInsertionPoint(); const { singleSlotDef, constRedeclares } = getSingleSlotDefAndConstsRedeclaration(component, slotName, str.original, ifScope, slotElIsComponent); const prefix = constRedeclares ? `() => {${constRedeclares}` : ''; str.appendLeft(slotDefInsertionPoint, `{${prefix}() => { `); if (hasMovedLet) { str.appendLeft(slotDefInsertionPoint, 'let {'); str.appendRight(slotDefInsertionPoint, `} = ${singleSlotDef};`); } if (hasConstTag) { str.appendRight(slotDefInsertionPoint, '/*'); extractConstTags(slotEl.children).forEach((insertion) => { insertion(slotDefInsertionPoint + 1, str); }); str.appendRight(slotDefInsertionPoint + 1, `${ifScope.addPossibleIfCondition()}<>`); str.appendRight(slotDefInsertionPoint + 1, str.original.slice(slotDefInsertionPoint, slotDefInsertionPoint + 1)); str.appendLeft(slotDefInsertionPoint + 1, '*/'); } else { str.appendRight(slotDefInsertionPoint, `${ifScope.addPossibleIfCondition()}<>`); } const closeSlotDefInsertionPoint = slotElIsComponent ? htmlx.lastIndexOf('<', slotEl.end - 1) : slotEl.end; str.appendLeft(closeSlotDefInsertionPoint, `</>}}${constRedeclares ? '}' : ''}`); } function getSingleSlotDefAndConstsRedeclaration(componentNode, slotName, originalStr, ifScope, findAndRedeclareShadowedProps) { if (findAndRedeclareShadowedProps) { const replacement = 'Ψ'; const { str, shadowedProps } = getInstanceTypeForDefaultSlot(componentNode, originalStr, replacement); componentNode[shadowedPropsSymbol] = shadowedProps; return { singleSlotDef: `${str}.$$slot_def['${slotName}']`, constRedeclares: getConstsToRedeclare(ifScope, shadowedProps) }; } else { const str = getInstanceType(componentNode, originalStr, componentNode[shadowedPropsSymbol] || []); return { singleSlotDef: `${str}.$$slot_def['${slotName}']`, constRedeclares: ifScope.getConstDeclaration() }; } } function getConstsToRedeclare(ifScope, shadowedProps) { const ifScopeRedeclarations = ifScope.getConstsToRedeclare(); const letRedeclarations = shadowedProps.map(({ value, replacement }) => `${replacement}=${value}`); const replacements = [...ifScopeRedeclarations, ...letRedeclarations].join(','); return replacements ? surroundWithIgnoreComments(`const ${replacements};`) : ''; } function handleComponent(htmlx, str, el, parent, ifScope, templateScope) { if (el.name.startsWith('svelte:')) { const colon = htmlx.indexOf(':', el.start); str.remove(colon, colon + 1); const closeTag = htmlx.lastIndexOf('/' + el.name, el.end); if (closeTag > el.start) { const colon = htmlx.indexOf(':', closeTag); str.remove(colon, colon + 1); } } const slotName = getSlotName(el) || 'default'; handleSlot(htmlx, str, el, slotName === 'default' ? el : parent, slotName, ifScope, templateScope); } function handleDebug$1(_htmlx, str, debugBlock) { let cursor = debugBlock.start; for (const identifier of debugBlock.identifiers) { str.remove(cursor, identifier.start); str.prependLeft(identifier.start, '{'); str.prependLeft(identifier.end, '}'); cursor = identifier.end; } str.remove(cursor, debugBlock.end); } function handleEach$1(htmlx, str, eachBlock, ifScope) { const constRedeclares = ifScope.getConstDeclaration(); const prefix = constRedeclares ? `{() => {${constRedeclares}() => ` : ''; str.overwrite(eachBlock.start, eachBlock.expression.start, `${prefix}{__sveltets_1_each(`); str.overwrite(eachBlock.expression.end, eachBlock.context.start, ', ('); if (eachBlock.expression.type === 'SequenceExpression') { str.appendRight(eachBlock.expression.start, '('); str.appendLeft(eachBlock.expression.end, ')'); } let contextEnd = eachBlock.context.end; if (eachBlock.index) { const idxLoc = htmlx.indexOf(eachBlock.index, contextEnd); contextEnd = idxLoc + eachBlock.index.length; } const constTags = extractConstTags(eachBlock.children); str.prependLeft(contextEnd, ') =>' + (constTags.length ? ' {' : '')); constTags.forEach((insertion) => { insertion(contextEnd, str); }); if (eachBlock.key) { const endEachStart = htmlx.indexOf('}', eachBlock.key.end); str.overwrite(endEachStart, endEachStart + 1, ` && ${ifScope.addPossibleIfCondition()}<>`); } else { const endEachStart = htmlx.indexOf('}', contextEnd); str.overwrite(endEachStart, endEachStart + 1, ` ${ifScope.addPossibleIfCondition()}<>`); } const endEach = htmlx.lastIndexOf('{', eachBlock.end - 1); const suffix = '</>' + (constTags.length ? '}' : '') + (constRedeclares ? ')}}}' : ')}'); if (eachBlock.else) { const elseEnd = htmlx.lastIndexOf('}', eachBlock.else.start); const elseStart = htmlx.lastIndexOf('{', elseEnd); str.overwrite(elseStart, elseEnd + 1, suffix); str.remove(endEach, eachBlock.end); } else { str.overwrite(endEach, eachBlock.end, suffix); } } function handleElement(htmlx, str, node, parent, ifScope, templateScope) { const slotName = getSlotName(node); if (slotName) { handleSlot(htmlx, str, node, parent, slotName, ifScope, templateScope); } const voidTags = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr'.split(','); if (voidTags.find((x) => x == node.name)) { if (htmlx[node.end - 2] != '/') { str.appendRight(node.end - 1, '/'); } } if (htmlx[node.end - 1] != '>') { str.appendRight(node.end, `</${node.name}>`); } } function handleEventHandler$1(htmlx, str, attr, parent) { const jsxEventName = attr.name; if (['Element', 'Window', 'Body'].includes(parent.type) ) { if (attr.expression) { const endAttr = htmlx.indexOf('=', attr.start); str.overwrite(attr.start + 'on:'.length - 1, endAttr, jsxEventName); const lastChar = htmlx[attr.end - 1]; if (isQuote(lastChar)) { const firstQuote = htmlx.indexOf(lastChar, endAttr); str.remove(firstQuote, firstQuote + 1); str.remove(attr.end - 1, attr.end); } } else { str.overwrite(attr.start + 'on:'.length - 1, attr.end, `${jsxEventName}={undefined}`); } } else { if (attr.expression) { const on = 'on'; str.appendRight(attr.start, `{${getInstanceType(parent, str.original)}.$`); const eventNameIndex = htmlx.indexOf(':', attr.start) + 1; str.overwrite(htmlx.indexOf(on, attr.start) + on.length, eventNameIndex, "('"); const eventEnd = htmlx.lastIndexOf('=', attr.expression.start); str.overwrite(eventEnd, attr.expression.start, "', "); str.overwrite(withTrailingPropertyAccess$1(str.original, attr.expression.end), attr.end, ')}'); str.move(attr.start, attr.end, parent.end); } else { str.remove(attr.start, attr.end); } } } function handleIf$1(htmlx, str, ifBlock, ifScope) { const endIf = htmlx.lastIndexOf('{', ifBlock.end - 1); const constTags = extractConstTags(ifBlock.children); const ifConditionEnd = htmlx.indexOf('}', ifBlock.expression.end) + 1; const hasConstTags = !!constTags.length; const endIIFE = createEndIIFE(hasConstTags); const startIIFE = createStartIIFE(hasConstTags); if (hasConstTags) { constTags.forEach((constTag) => { constTag(ifConditionEnd, str); }); str.appendRight(ifConditionEnd, 'return <>'); if (ifBlock.else) { const elseWord = htmlx.lastIndexOf(':else', ifBlock.else.start); const elseStart = htmlx.lastIndexOf('{', elseWord); str.appendLeft(elseStart, endIIFE); } } if (ifBlock.elseif) { const elseIfStart = htmlx.lastIndexOf('{', ifBlock.expression.start); str.overwrite(elseIfStart, ifBlock.expression.start, '</> : (', { contentOnly: true }); str.overwrite(withTrailingPropertyAccess$1(str.original, ifBlock.expression.end), ifConditionEnd, ') ? <>' + startIIFE); ifScope.addElseIf(ifBlock.expression, str); if (!ifBlock.else) { str.appendLeft(endIf, endIIFE + '</> : <>'); } return; } str.overwrite(ifBlock.start, ifBlock.expression.start, '{(', { contentOnly: true }); str.overwrite(withTrailingPropertyAccess$1(str.original, ifBlock.expression.end), ifConditionEnd, ') ? <>' + startIIFE, { contentOnly: true }); ifScope.addNestedIf(ifBlock.expression, str); if (ifBlock.else) { str.overwrite(endIf, ifBlock.end, '</> }', { contentOnly: true }); } else { str.overwrite(endIf, ifBlock.end, endIIFE + '</> : <></>}', { contentOnly: true }); } } function createStartIIFE(hasConstTags) { return hasConstTags ? '{(() => {' : ''; } function createEndIIFE(hasConstTags) { return hasConstTags ? '</>})()}' : ''; } function handleElse$1(htmlx, str, elseBlock, parent, ifScope) { var _a, _b; if (parent.type !== 'IfBlock' || (((_a = elseBlock.children[0]) === null || _a === void 0 ? void 0 : _a.type) === 'IfBlock' && ((_b = elseBlock.children[0]) === null || _b === void 0 ? void 0 : _b.elseif))) { return; } const elseEnd = htmlx.lastIndexOf('}', elseBlock.start); const elseword = htmlx.lastIndexOf(':else', elseEnd); const elseStart = htmlx.lastIndexOf('{', elseword); const constTags = extractConstTags(elseBlock.children); const hasConstTags = !!constTags.length; str.overwrite(elseStart, elseEnd + 1, '</> : <>' + createStartIIFE(hasConstTags)); ifScope.addElse(); if (!hasConstTags) { return; } constTags.forEach((constTag) => { constTag(elseEnd + 1, str); }); str.appendRight(elseEnd + 1, 'return <>'); str.appendLeft(elseBlock.end, createEndIIFE(true)); } var IfType; (function (IfType) { IfType[IfType["If"] = 0] = "If"; IfType[IfType["ElseIf"] = 1] = "ElseIf"; IfType[IfType["Else"] = 2] = "Else"; })(IfType || (IfType = {})); function addElseIfCondition(existingCondition, newCondition) { return { parent: existingCondition, condition: newCondition, type: IfType.ElseIf }; } function addElseCondition(existingCondition) { return { parent: existingCondition, type: IfType.Else }; } const REPLACEMENT_PREFIX = '\u03A9'; function getFullCondition(condition, replacedNames, replacementPrefix) { switch (condition.type) { case IfType.If: return _getFullCondition(condition, false, replacedNames, replacementPrefix); case IfType.ElseIf: return _getFullCondition(condition, false, replacedNames, replacementPrefix); case IfType.Else: return _getFullCondition(condition, false, replacedNames, replacementPrefix); } } function _getFullCondition(condition, negate, replacedNames, replacementPrefix) { switch (condition.type) { case IfType.If: return negate ? `!(${getConditionString(condition.condition, replacedNames, replacementPrefix)})` : `(${getConditionString(condition.condition, replacedNames, replacementPrefix)})`; case IfType.ElseIf: return `${_getFullCondition(condition.parent, true, replacedNames, replacementPrefix)} && ${negate ? '!' : ''}(${getConditionString(condition.condition, replacedNames, replacementPrefix)})`; case IfType.Else: return `${_getFullCondition(condition.parent, true, replacedNames, replacementPrefix)}`; } } function getConditionString(condition, replacedNames, replacementPrefix) { const replacements = []; for (const name of replacedNames) { const occurences = condition.identifiers.get(name); if (occurences) { for (const occurence of occurences) { replacements.push({ ...occurence, name }); } } } if (!replacements.length) { return condition.text; } replacements.sort((r1, r2) => r1.start - r2.start); return (condition.text.substring(0, replacements[0].start) + replacements .map((replacement, idx) => { var _a; return replacementPrefix + replacement.name + condition.text.substring(replacement.end, (_a = replacements[idx + 1]) === null || _a === void 0 ? void 0 : _a.start); }) .join('')); } function collectReferencedIdentifiers(condition) { const identifiers = new Set(); let current = condition; while (current) { if (current.type === IfType.ElseIf || current.type === IfType.If) { for (const identifier of current.condition.identifiers.keys()) { identifiers.add(identifier); } } current = current.type === IfType.ElseIf || current.type === IfType.Else ? current.parent : undefined; } return identifiers; } class IfScope { constructor(scope, current, parent) { this.scope = scope; this.current = current; this.parent = parent; this.ownScope = this.scope.value; this.replacementPrefix = REPLACEMENT_PREFIX.repeat(this.computeDepth()); } getFullCondition() { var _a; if (!this.current) { return ''; } const parentCondition = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.getFullCondition(); const condition = `(${getFullCondition(this.current, this.getNamesThatNeedReplacement(), this.replacementPrefix)})`; return parentCondition ? `(${parentCondition}) && ${condition}` : condition; } addPossibleIfCondition() { const condition = this.getFullCondition(); return condition ? surroundWithIgnoreComments(`${condition} && `) : ''; } addNestedIf(expression, str) { const condition = this.getConditionInfo(str, expression); const ifScope = new IfScope(this.scope, { condition, type: IfType.If }, this); this.child = ifScope; } addElseIf(expression, str) { const condition = this.getConditionInfo(str, expression); this.current = addElseIfCondition(this.current, condition); } addElse() { this.current = addElseCondition(this.current); } getChild() { return this.child || this; } getParent() { return this.parent || this; } collectReferencedIdentifiers() { var _a; const current = collectReferencedIdentifiers(this.current); const parent = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.collectReferencedIdentifiers(); if (parent) { for (const identifier of parent) { current.add(identifier); } } return current; } getConstDeclaration() { const replacements = this.getConstsToRedeclare().join(','); return replacements ? surroundWithIgnoreComments(`const ${replacements};`) : ''; } getConstsToRedeclare() { return this.getNamesToRedeclare().map((identifier) => `${this.replacementPrefix + identifier}=${identifier}`); } referencesIdentifier(name) { const current = collectReferencedIdentifiers(this.current); if (current.has(name)) { return true; } if (!this.parent || this.ownScope.inits.has(name)) { return false; } return this.parent.referencesIdentifier(name); } getConditionInfo(str, expression) { const identifiers = getIdentifiersInIfExpression(expression); const text = str.original.substring(expression.start, expression.end); return { identifiers, text }; } getNamesToRedeclare() { return [...this.scope.value.inits.keys()].filter((init) => { let parent = this.scope.value.parent; while (parent && parent !== this.ownScope) { if (parent.inits.has(init)) { return false; } parent = parent.parent; } return this.referencesIdentifier(init); }); } getNamesThatNeedReplacement() { const referencedIdentifiers = this.collectReferencedIdentifiers(); return [...referencedIdentifiers].filter((identifier) => this.someChildScopeHasRedeclaredVariable(identifier)); } someChildScopeHasRedeclaredVariable(name) { let scope = this.scope.value; while (scope && scope !== this.ownScope) { if (scope.inits.has(name)) { return true; } scope = scope.parent; } return false; } computeDepth() { let idx = 1; let parent = this.ownScope.parent; while (parent) { idx++; parent = parent.parent; } return idx; } } function handleKey$1(htmlx, str, keyBlock) { str.overwrite(keyBlock.start, keyBlock.expression.start, '{'); const end = htmlx.indexOf('}', keyBlock.expression.end); str.overwrite(withTrailingPropertyAccess$1(str.original, keyBlock.expression.end), end + 1, '} '); const endKey = htmlx.lastIndexOf('{', keyBlock.end - 1); str.remove(endKey, keyBlock.end); } function handleRawHtml$1(htmlx, str, rawBlock) { const tokenStart = htmlx.indexOf('@html', rawBlock.start); str.remove(tokenStart, tokenStart + '@html'.length); } function handleStyleDirective$1(str, style) { const htmlx = str.original; if (style.value === true || style.value.length === 0) { str.overwrite(style.start, htmlx.indexOf(':', style.start) + 1, '{...__sveltets_1_ensureType(String, Number, '); str.appendLeft(style.end, ')}'); return; } if (style.value.length > 1) { buildTemplateString(style, str, htmlx, '{...__sveltets_1_ensureType(String, Number, `', '`)}', style.start); return; } const styleVal = style.value[0]; if (styleVal.type === 'Text') { str.overwrite(style.start, styleVal.start, '{...__sveltets_1_ensureType(String, Number, "'); if (styleVal.end === style.end) { str.appendLeft(style.end, '")}'); } else { str.overwrite(styleVal.end, style.end, '")}'); } } else { str.overwrite(style.start, styleVal.start + 1, '{...__sveltets_1_ensureType(String, Number, '); str.overwrite(styleVal.end - 1, style.end, ')}'); } } function handleSvelteTag(htmlx, str, node) { const colon = htmlx.indexOf(':', node.start); str.remove(colon, colon + 1); const closeTag = htmlx.lastIndexOf('/' + node.name, node.end); if (closeTag > node.start) { const colon = htmlx.indexOf(':', closeTag); str.remove(colon, colon + 1); } } function extract_identifiers(param, nodes = []) { switch (param.type) { case 'Identifier': nodes.push(param); break; case 'MemberExpression': let object = param; while (object.type === 'MemberExpression') { object = (object.object); } nodes.push( (object)); break; case 'ObjectPattern': const handle_prop = (prop) => { if (prop.type === 'RestElement') { extract_identifiers(prop.argument, nodes); } else { extract_identifiers(prop.value, nodes); } }; param.properties.forEach(handle_prop); break; case 'ArrayPattern': const handle_element = (element) => { if (element) extract_identifiers(element, nodes); }; param.elements.forEach(handle_element); break; case 'RestElement': extract_identifiers(param.argument, nodes); break; case 'AssignmentPattern': extract_identifiers(param.left, nodes); break; } return nodes; } class TemplateScope$1 { constructor(parent) { this.inits = new Set(); this.parent = parent; } child() { const child = new TemplateScope$1(this); return child; } } class TemplateScopeManager { constructor() { this.value = new TemplateScope$1(); } eachEnter(node) { this.value = this.value.child(); if (node.context) { this.handleScope(node.context, node.children); } if (node.index) { this.value.inits.add(node.index); } } eachLeave(node) { if (!node.else) { this.value = this.value.parent; } } awaitEnter(node) { var _a; this.value = this.value.child(); if (node.value) { this.handleScope(node.value, (_a = node.then) === null || _a === void 0 ? void 0 : _a.children); } if (node.error) { this.handleScope(node.error, []); } } awaitPendingEnter(node, parent) { if (node.skip || parent.type !== 'AwaitBlock') { return; } this.value.inits.clear(); } awaitThenEnter(node, parent) { if (node.skip || parent.type !== 'AwaitBlock') { return; } this.value.inits.clear(); if (parent.value) { this.handleScope(parent.value, node.children); } } awaitCatchEnter(node, parent) { if (node.skip || parent.type !== 'AwaitBlock') { return; } this.value.inits.clear(); if (parent.error) { this.handleScope(parent.error, node.children); } } awaitLeave() { this.value = this.value.parent; } elseEnter(parent) { if (parent.type === 'EachBlock') { this.value = this.value.parent; } } componentOrSlotTemplateOrElementEnter(node) { var _a; const hasConstTags = (_a = node.children) === null || _a === void 0 ? void 0 : _a.some((child) => child.type === 'ConstTag'); if (usesLet(node) || hasConstTags) { this.value = this.value.child(); this.handleScope({}, node.children); } } componentOrSlotTemplateOrElementLeave(node) { if (usesLet(node)) { this.value = this.value.parent; } } handleScope(identifierDef, children) { if (isIdentifier(identifierDef)) { this.value.inits.add(identifierDef.name); } if (isDestructuringPatterns(identifierDef)) { const identifiers = extract_identifiers(identifierDef); identifiers.forEach((id) => this.value.inits.add(id.name)); } if (children === null || children === void 0 ? void 0 : children.length) { children.forEach((child) => { if (child.type === 'ConstTag') { const identifiers = extract_identifiers(child.expression.left); identifiers.forEach((id) => this.value.inits.add(id.name)); } }); } } } function handleText$1(str, node) { if (!node.data) { return; } const needsRemoves = ['}', '>']; for (const token of needsRemoves) { let index = node.data.indexOf(token); while (index >= 0) { str.remove(index + node.start, index + node.start + 1); index = node.data.indexOf(token, index + 1); } } } function handleTransitionDirective$1(htmlx, str, attr, parent) { str.overwrite(attr.start, htmlx.indexOf(':', attr.start) + 1, '{...__sveltets_1_ensureTransition('); if (attr.modifiers.length) { const local = htmlx.indexOf('|', attr.start); str.remove(local, attr.expression ? attr.expression.start : attr.end); } const nodeType = `__sveltets_1_mapElementTag('${parent.name}')`; if (!attr.expression) { str.appendLeft(attr.end, `(${nodeType},{}))}`); return; } str.overwrite(htmlx.indexOf(':', attr.start) + 1 + `${attr.name}`.length, attr.expression.start, `(${nodeType},(`); str.appendLeft(withTrailingPropertyAccess$1(str.original, attr.expression.end), ')))'); if (isQuote(htmlx[attr.end - 1])) { str.remove(attr.end - 1, attr.end); } } function stripDoctype$1(str) { const regex = /<!doctype(.+?)>(\n)?/i; const result = regex.exec(str.original); if (result) { str.remove(result.index, result.index + result[0].length); } } function convertHtmlxToJsx$1(str, ast, onWalk = null, onLeave = null, options = {}) { const htmlx = str.original; stripDoctype$1(str); str.prepend('<>'); str.append('</>'); const templateScopeManager = new TemplateScopeManager(); let ifScope = new IfScope(templateScopeManager); compiler_1.walk(ast, { enter: (node, parent, prop, index) => { try { switch (node.type) { case 'IfBlock': handleIf$1(htmlx, str, node, ifScope); if (!node.elseif) { ifScope = ifScope.getChild(); } break; case 'EachBlock': templateScopeManager.eachEnter(node); handleEach$1(htmlx, str, node, ifScope); break; case 'ElseBlock': templateScopeManager.elseEnter(parent); handleElse$1(htmlx, str, node, parent, ifScope); break; case 'AwaitBlock': handleAwait$1(htmlx, str, node, ifScope, templateScopeManager); break; case 'PendingBlock': templateScopeManager.awaitPendingEnter(node, parent); handleAwaitPending(parent, htmlx, str, ifScope); break; case 'ThenBlock': templateScopeManager.awaitThenEnter(node, parent); handleAwaitThen(parent, htmlx, str, ifScope); break; case 'CatchBlock': templateScopeManager.awaitCatchEnter(node, parent); handleAwaitCatch(parent, htmlx, str, ifScope); break; case 'KeyBlock': handleKey$1(htmlx, str, node); break; case 'RawMustacheTag': handleRawHtml$1(htmlx, str, node); break; case 'DebugTag': handleDebug$1(htmlx, str, node); break; case 'InlineComponent': templateScopeManager.componentOrSlotTemplateOrElementEnter(node); handleComponent(htmlx, str, node, parent, ifScope, templateScopeManager.value); break; case 'Element': if (node.name === 'svelte:element') { handleSvelteTag(htmlx, str, node); } templateScopeManager.componentOrSlotTemplateOrElementEnter(node); handleElement(htmlx, str, node, parent, ifScope, templateScopeManager.value); break; case 'Comment': handleComment$1(str, node); break; case 'Binding': handleBinding$1(htmlx, str, node, parent); break; case 'Class': handleClassDirective$1(str, node); break; case 'StyleDirective': handleStyleDirective$1(str, node); break; case 'Action': handleActionDirective$1(htmlx, str, node, parent); break; case 'Transition': handleTransitionDirective$1(htmlx, str, node, parent); break; case 'Animation': handleAnimateDirective$1(htmlx, str, node, parent); break; case 'Attribute': handleAttribute$1(htmlx, str, node, parent, options.preserveAttributeCase); break; case 'EventHandler': handleEventHandler$1(htmlx, str, node, parent); break; case 'Options': handleSvelteTag(htmlx, str, node); break; case 'Window': handleSvelteTag(htmlx, str, node); break; case 'Head': handleSvelteTag(htmlx, str, node); break; case 'Body': handleSvelteTag(htmlx, str, node); break; case 'SlotTemplate': handleSvelteTag(htmlx, str, node); templateScopeManager.componentOrSlotTemplateOrElementEnter(node); handleSlot(htmlx, str, node, parent, getSlotName(node) || 'default', ifScope, templateScopeManager.value); break; case 'Text': handleText$1(str, node); break; } if (onWalk) { onWalk(node, parent, prop, index); } } catch (e) { console.error('Error walking node ', node, e); throw e; } }, leave: (node, parent, prop, index) => { try { switch (node.type) { case 'IfBlock': if (!node.elseif) { ifScope = ifScope.getParent(); } break; case 'EachBlock': templateScopeManager.eachLeave(node); break; case 'AwaitBlock': templateScopeManager.awaitLeave(); break; case 'InlineComponent': case 'Element': case 'SlotTemplate': templateScopeManager.componentOrSlotTemplateOrElementLeave(node); break; } if (onLeave) { onLeave(node, parent, prop, index); } } catch (e) { console.error('Error leaving node ', node); throw e; } } }); } function transform(str, start, end, _xxx, transformations) { const moves = []; let appendPosition = end; let ignoreNextString = false; let deletePos; let deleteDest; for (let i = 0; i < transformations.length; i++) { const transformation = transformations[i]; if (typeof transformation === 'number') { deletePos = moves.length; deleteDest = transformation; } else if (typeof transformation === 'string') { if (!ignoreNextString) { str.appendLeft(appendPosition, transformation); } ignoreNextString = false; } else { const tStart = transformation[0]; let tEnd = transformation[1]; if (tStart === tEnd) { continue; } if (tEnd < end - 1 && !transformations.some((t) => typeof t !== 'string' && t[0] === tEnd)) { tEnd += 1; const next = transformations[i + 1]; ignoreNextString = typeof next === 'string'; const overwrite = typeof next === 'string' ? next : ''; str.overwrite(tEnd - 1, tEnd, overwrite, { contentOnly: true }); } appendPosition = tEnd; moves.push([tStart, tEnd]); } } deletePos = deletePos !== null && deletePos !== void 0 ? deletePos : moves.length; for (let i = 0; i < deletePos; i++) { str.move(moves[i][0], moves[i][1], end); } let removeStart = start; for (const transformation of [...moves].sort((t1, t2) => t1[0] - t2[0])) { if (removeStart < transformation[0]) { if (deletePos !== moves.length && removeStart > deleteDest) { str.move(removeStart, transformation[0], end); } str.overwrite(removeStart, transformation[0], ' ', { contentOnly: true }); } removeStart = transformation[1]; } if (removeStart < end) { str.overwrite(removeStart, removeStart + 1, '', { contentOnly: true }); removeStart++; } if (removeStart < end) { if (deletePos !== moves.length && removeStart > deleteDest && removeStart + 1 < end) { str.move(removeStart, end - 1, end); str.overwrite(removeStart, end - 1, ' ', { contentOnly: true }); str.overwrite(end - 1, end, '', { contentOnly: true }); } else { str.overwrite(removeStart, end, ' ', { contentOnly: true }); } } for (let i = deletePos; i < moves.length; i++) { str.move(moves[i][0], moves[i][1], end); } } function surroundWith(str, [start, end], prefix, suffix) { if (start + 1 === end) { str.overwrite(start, end, `${prefix}${str.original.charAt(start)}${suffix}`, { contentOnly: true }); } else { str.overwrite(start, start + 1, `${prefix}${str.original.charAt(start)}`, { contentOnly: true }); str.overwrite(end - 1, end, `${str.original.charAt(end - 1)}${suffix}`, { contentOnly: true }); } return [start, end]; } function getDirectiveNameStartEndIdx(str, node) { const colonIdx = str.original.indexOf(':', node.start); return [colonIdx + 1, colonIdx + 1 + `${node.name}`.length]; } function sanitizePropName(name) { return name .split('') .map((char) => (/[0-9A-Za-z$_]/.test(char) ? char : '_')) .join(''); } function withTrailingPropertyAccess(originalText, position) { let index = position; while (index < originalText.length) { const char = originalText[index]; if (!char.trim()) { index++; continue; } if (char === '.') { return index + 1; } if (char === '?' && originalText[index + 1] === '.') { return index + 2; } break; } return position; } function rangeWithTrailingPropertyAccess(originalText, node) { return [node.start, withTrailingPropertyAccess(originalText, node.end)]; } function handleActionDirective(str, attr, element) { const transformations = [ '__sveltets_2_ensureAction(', getDirectiveNameStartEndIdx(str, attr), `(${element.typingsNamespace}.mapElementTag('${element.tagName}')` ]; if (attr.expression) { transformations.push(',(', rangeWithTrailingPropertyAccess(str.original, attr.expression), ')'); } transformations.push('));'); element.appendToStartEnd(transformations); } function handleAnimateDirective(str, attr, element) { const transformations = [ '__sveltets_2_ensureAnimation(', getDirectiveNameStartEndIdx(str, attr), `(${element.typingsNamespace}.mapElementTag('${element.tagName}'),__sveltets_2_AnimationMove` ]; if (attr.expression) { transformations.push(',(', rangeWithTrailingPropertyAccess(str.original, attr.expression), ')'); } transformations.push('));'); element.appendToStartEnd(transformations); } var svgAttributes = 'accent-height accumulate additive alignment-baseline allowReorder alphabetic amplitude arabic-form ascent attributeName attributeType autoReverse azimuth baseFrequency baseline-shift baseProfile bbox begin bias by calcMode cap-height class clip clipPathUnits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering contentScriptType contentStyleType cursor cx cy d decelerate descent diffuseConstant direction display divisor dominant-baseline dur dx dy edgeMode elevation enable-background end exponent externalResourcesRequired fill fill-opacity fill-rule filter filterRes filterUnits flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight format from fr fx fy g1 g2 glyph-name glyph-orientation-horizontal glyph-orientation-vertical glyphRef gradientTransform gradientUnits hanging height href horiz-adv-x horiz-origin-x id ideographic image-rendering in in2 intercept k k1 k2 k3 k4 kernelMatrix kernelUnitLength kerning keyPoints keySplines keyTimes lang lengthAdjust letter-spacing lighting-color limitingConeAngle local marker-end marker-mid marker-start markerHeight markerUnits markerWidth mask maskContentUnits maskUnits mathematical max media method min mode name numOctaves offset onabort onactivate onbegin onclick onend onerror onfocusin onfocusout onload onmousedown onmousemove onmouseout onmouseover onmouseup onrepeat onresize onscroll onunload opacity operator order orient orientation origin overflow overline-position overline-thickness panose-1 paint-order pathLength patternContentUnits patternTransform patternUnits pointer-events points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits r radius refX refY rendering-intent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry scale seed shape-rendering slope spacing specularConstant specularExponent speed spreadMethod startOffset stdDeviation stemh stemv stitchTiles stop-color stop-opacity strikethrough-position strikethrough-thickness string stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width style surfaceScale systemLanguage tabindex tableValues target targetX targetY text-anchor text-decoration text-rendering textLength to transform type u1 u2 underline-position underline-thickness unicode unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical values version vert-adv-y vert-origin-x vert-origin-y viewBox viewTarget visibility width widths word-spacing writing-mode x x-height x1 x2 xChannelSelector xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xml:lang xml:space y y1 y2 yChannelSelector z zoomAndPan'.split(' '); const voidTags = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr'.split(','); class Element { constructor(str, node, typingsNamespace, parent) { var _a, _b; this.str = str; this.node = node; this.typingsNamespace = typingsNamespace; this.parent = parent; this.startTransformation = []; this.startEndTransformation = ['});']; this.attrsTransformation = []; this.endTransformation = []; if (parent) { parent.child = this; } this.tagName = this.node.name === 'svelte:body' ? 'body' : this.node.name; this.isSelfclosing = this.computeIsSelfclosing(); this.startTagStart = this.node.start; this.startTagEnd = this.computeStartTagEnd(); const createElement = `${this.typingsNamespace}.createElement`; const tagEnd = this.startTagStart + this.node.name.length + 1; if (/\s/.test(str.original.charAt(tagEnd))) { this.attrsTransformation.push(tagEnd); this.attrsTransformation.push([tagEnd, tagEnd + 1]); this.str.overwrite(tagEnd, tagEnd + 1, '', { contentOnly: true }); } switch (this.node.name) { case 'svelte:options': case 'svelte:head': case 'svelte:window': case 'svelte:body': case 'svelte:fragment': { const nodeName = `svelte${this.node.name.substring(7)}`; this._name = '$$_' + nodeName + this.computeDepth(); this.startTransformation.push(`{ ${createElement}("${nodeName}", {`); this.addNameConstDeclaration = () => (this.startTransformation[0] = `{ const ${this._name} = ${createElement}("${nodeName}", {`); break; } case 'svelte:element': { const nodeName = this.node.tag ? typeof this.node.tag !== 'string' ? [this.node.tag.start, this.node.tag.end] : `"${this.node.tag}"` : '""'; this._name = '$$_svelteelement' + this.computeDepth(); this.startTransformation.push(`{ ${createElement}(`, nodeName, ', {'); this.addNameConstDeclaration = () => ((this.startTransformation[0] = `{ const ${this._name} = ${createElement}(`), ', {'); break; } case 'slot': { this._name = '$$_slot' + this.computeDepth(); const slotName = ((_b = (_a = this.node.attributes) === null || _a === void 0 ? void 0 : _a.find((a) => a.name === 'name')) === null || _b === void 0 ? void 0 : _b.value[0]) || 'default'; this.startTransformation.push('{ __sveltets_createSlot(', typeof slotName === 'string' ? `"${slotName}"` : surroundWith(this.str, [slotName.start, slotName.end], '"', '"'), ', {'); this.addNameConstDeclaration = () => (this.startTransformation[0] = `{ const ${this._name} = __sveltets_createSlot(`); break; } default: { this._name = '$$_' + sanitizePropName(this.node.name) + this.computeDepth(); this.startTransformation.push(`{ ${createElement}("`, [this.node.start + 1, this.node.start + 1 + this.node.name.length], '", {'); this.addNameConstDeclaration = () => (this.startTransformation[0] = `{ const ${this._name} = ${createElement}("`); break; } } } get name() { if (this.addNameConstDeclaration) { this.addNameConstDeclaration(); this.addNameConstDeclaration = undefined; } return this._name; } addAttribute(name, value) { if (value) { this.attrsTransformation.push(...name, ':', ...value, ','); } else { this.attrsTransformation.push(...name, ','); } } addSlotName(transformation) { this.slotLetsTransformation = this.slotLetsTransformation || [[], []]; this.slotLetsTransformation[0] = transformation; } addSlotLet(transformation) { this.slotLetsTransformation = this.slotLetsTransformation || [['default'], []]; this.slotLetsTransformation[1].push(...transformation, ','); } appendToStartEnd(value) { this.startEndTransformation.push(...value); } performTransformation() { this.endTransformation.push('}'); const slotLetTransformation = []; if (this.slotLetsTransformation) { if (this.slotLetsTransformation[0][0] === 'default') { slotLetTransformation.push( `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.parent.name}.$$slot_def.default;$$_$$;`); } else { slotLetTransformation.push( `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.parent.name}.$$slot_def["`, ...this.slotLetsTransformation[0], '"];$$_$$;'); } this.endTransformation.push('}'); } if (this.isSelfclosing) { transform(this.str, this.startTagStart, this.startTagEnd, this.startTagEnd, [ ...slotLetTransformation, ...this.startTransformation, ...this.attrsTransformation, ...this.startEndTransformation, ...this.endTransformation ]); } else { transform(this.str, this.startTagStart, this.startTagEnd, this.startTagEnd, [ ...slotLetTransformation, ...this.startTransformation, ...this.attrsTransformation, ...this.startEndTransformation ]); const tagEndIdx = this.str.original .substring(this.node.start, this.node.end) .lastIndexOf(`</${this.node.name}`); const endStart = tagEndIdx === -1 ? this.node.end : tagEndIdx + this.node.start; transform(this.str, endStart, this.node.end, this.node.end, this.endTransformation); } } computeStartTagEnd() { var _a; if ((_a = this.node.children) === null || _a === void 0 ? void 0 : _a.length) { return this.node.children[0].start; } return this.isSelfclosing ? this.node.end : this.str.original.lastIndexOf('>', this.node.end - 2) + 1; } computeIsSelfclosing() { var _a; if (this.str.original[this.node.end - 2] === '/' || voidTags.includes(this.node.name)) { return true; } return (!((_a = this.node.children) === null || _a === void 0 ? void 0 : _a.length) && !this.str.original .substring(this.node.start, this.node.end) .match(new RegExp(`</${this.node.name}\\s*>$`))); } computeDepth() { let idx = 0; let parent = this.parent; while (parent) { parent = parent.parent; idx++; } return idx; } } class InlineComponent { constructor(str, node, parent) { this.str = str; this.node = node; this.parent = parent; this.startTransformation = []; this.startEndTransformation = []; this.propsTransformation = []; this.eventsTransformation = []; this.endTransformation = []; if (parent) { parent.child = this; } this.isSelfclosing = this.computeIsSelfclosing(); this.startTagStart = this.node.start; this.startTagEnd = this.computeStartTagEnd(); const tagEnd = this.startTagStart + this.node.name.length + 1; if (/\s/.test(str.original.charAt(tagEnd))) { this.propsTransformation.push(tagEnd); this.propsTransformation.push([tagEnd, tagEnd + 1]); this.str.overwrite(tagEnd, tagEnd + 1, '', { contentOnly: true }); } if (this.node.name === 'svelte:self') { this._name = '$$_svelteself' + this.computeDepth(); this.startTransformation.push('{ __sveltets_2_createComponentAny({'); this.addNameConstDeclaration = () => (this.startTransformation[0] = `{ const ${this._name} = __sveltets_2_createComponentAny({`); this.startEndTransformation.push('});'); } else { const isSvelteComponentTag = this.node.name === 'svelte:component'; this._name = '$$_' + sanitizePropName(this.node.name) + this.computeDepth(); const constructorName = this._name + 'C'; const nodeNameStart = isSvelteComponentTag ? this.node.expression.start : this.str.original.indexOf(this.node.name, this.node.start); const nodeNameEnd = isSvelteComponentTag ? this.node.expression.end : nodeNameStart + this.node.name.length; this.startTransformation.push(`{ const ${constructorName} = __sveltets_2_ensureComponent(`, [nodeNameStart, nodeNameEnd], `); new ${constructorName}({ target: __sveltets_2_any(), props: {`); this.addNameConstDeclaration = () => (this.startTransformation[2] = `); const ${this._name} = new ${constructorName}({ target: __sveltets_2_any(), props: {`); this.startEndTransformation.push('}});'); } } get name() { if (this.addNameConstDeclaration) { this.addNameConstDeclaration(); this.addNameConstDeclaration = undefined; } return this._name; } addProp(name, value) { if (value) { this.propsTransformation.push(...name, ':', ...value, ','); } else { this.propsTransformation.push(...name, ','); } } addEvent([nameStart, nameEnd], expression) { this.eventsTransformation.push(`${this.name}.$on(`, surroundWith(this.str, [nameStart, nameEnd], '"', '"'), ', ', expression ? expression : '() => {}', ');'); } addSlotName(transformation) { this.slotLetsTransformation = this.slotLetsTransformation || [[], []]; this.slotLetsTransformation[0] = transformation; } addSlotLet(transformation) { this.slotLetsTransformation = this.slotLetsTransformation || [['default'], []]; this.slotLetsTransformation[1].push(...transformation, ','); } appendToStartEnd(value) { this.startEndTransformation.push(...value); } performTransformation() { const namedSlotLetTransformation = []; const defaultSlotLetTransformation = []; if (this.slotLetsTransformation) { if (this.slotLetsTransformation[0][0] === 'default') { defaultSlotLetTransformation.push( `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.name}.$$slot_def.default;$$_$$;`); } else { namedSlotLetTransformation.push( `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.parent.name}.$$slot_def["`, ...this.slotLetsTransformation[0], '"];$$_$$;'); } this.endTransformation.push('}'); } if (this.isSelfclosing) { this.endTransformation.push('}'); transform(this.str, this.startTagStart, this.startTagEnd, this.startTagEnd, [ ...namedSlotLetTransformation, ...this.startTransformation, ...this.propsTransformation, ...this.startEndTransformation, ...this.eventsTransformation, ...defaultSlotLetTransformation, ...this.endTransformation ]); } else { const endStart = this.str.original .substring(this.node.start, this.node.end) .lastIndexOf(`</${this.node.name}`) + this.node.start; if (!this.node.name.startsWith('svelte:')) { this.endTransformation.push([endStart + 2, endStart + this.node.name.length + 2]); } this.endTransformation.push('}'); transform(this.str, this.startTagStart, this.startTagEnd, this.startTagEnd, [ ...namedSlotLetTransformation, ...this.startTransformation, ...this.propsTransformation, ...this.startEndTransformation, ...this.eventsTransformation, ...defaultSlotLetTransformation ]); transform(this.str, endStart, this.node.end, this.node.end, this.endTransformation); } } computeStartTagEnd() { var _a; if ((_a = this.node.children) === null || _a === void 0 ? void 0 : _a.length) { return this.node.children[0].start; } return this.isSelfclosing ? this.node.end : this.str.original.lastIndexOf('>', this.node.end - 2) + 1; } computeIsSelfclosing() { return this.str.original[this.node.end - 2] === '/'; } computeDepth() { let idx = 0; let parent = this.parent; while (parent) { parent = parent.parent; idx++; } return idx; } } const numberOnlyAttributes = new Set([ 'cols', 'colspan', 'currenttime', 'defaultplaybackrate', 'high', 'low', 'marginheight', 'marginwidth', 'minlength', 'maxlength', 'optimum', 'rows', 'rowspan', 'size', 'span', 'start', 'tabindex', 'results', 'volume' ]); function handleAttribute(str, attr, parent, preserveCase, element) { if (parent.name === '!DOCTYPE' || ['Style', 'Script'].includes(parent.type) || (attr.name === 'name' && parent.type === 'Slot')) { return; } if (attr.name === 'slot' && attributeValueIsOfType(attr.value, 'Text') && element.parent instanceof InlineComponent) { element.addSlotName([[attr.value[0].start, attr.value[0].end]]); return; } const addAttribute = element instanceof Element ? (name, value) => { if (attr.name.startsWith('data-')) { name.unshift('...__sveltets_2_empty({'); if (!value) { value = ['__sveltets_2_any()']; } value.push('})'); } element.addAttribute(name, value); } : (name, value) => { if (attr.name.startsWith('--') && attr.value !== true) { name.unshift('...__sveltets_2_cssProp({'); if (!value) { value = ['""']; } value.push('})'); } element.addProp(name, value); }; const transformAttributeCase = (name) => { if (!preserveCase && !svgAttributes.find((x) => x == name)) { return name.toLowerCase(); } else { return name; } }; const attributeName = []; if (attributeValueIsOfType(attr.value, 'AttributeShorthand')) { addAttribute([[attr.value[0].start, attr.value[0].end]]); return; } else { let name = element instanceof Element && parent.type === 'Element' ? transformAttributeCase(attr.name) : attr.name; if (name !== attr.name) { name = '"' + name; str.overwrite(attr.start, attr.start + attr.name.length, name); } else { str.overwrite(attr.start, attr.start + 1, '"' + str.original.charAt(attr.start), { contentOnly: true }); } attributeName.push([attr.start, attr.start + attr.name.length], '"'); } const attributeValue = []; if (attr.value === true) { attributeValue.push('true'); addAttribute(attributeName, attributeValue); return; } if (attr.value.length == 0) { addAttribute(attributeName, ['""']); return; } if (attr.value.length == 1) { const attrVal = attr.value[0]; if (attrVal.type == 'Text') { if (attrVal.start === attrVal.end) { addAttribute(attributeName, [[attrVal.start - 1, attrVal.end + 1]]); return; } const hasBrackets = str.original.lastIndexOf('}', attrVal.end) === attrVal.end - 1 || str.original.lastIndexOf('}"', attrVal.end) === attrVal.end - 1 || str.original.lastIndexOf("}'", attrVal.end) === attrVal.end - 1; const needsNumberConversion = !hasBrackets && parent.type === 'Element' && numberOnlyAttributes.has(attr.name.toLowerCase()) && !isNaN(attrVal.data); const includesTemplateLiteralQuote = attrVal.data.includes('`'); const quote = !includesTemplateLiteralQuote ? '`' : ['"', "'"].includes(str.original[attrVal.start - 1]) ? str.original[attrVal.start - 1] : '"'; if (!needsNumberConversion) { attributeValue.push(quote); } if (includesTemplateLiteralQuote && attrVal.data.split('\n').length > 1) { str.overwrite(attrVal.start, attrVal.end, attrVal.data.split('\n').join('\\n'), { contentOnly: true }); } attributeValue.push([attrVal.start, attrVal.end]); if (!needsNumberConversion) { attributeValue.push(quote); } addAttribute(attributeName, attributeValue); } else if (attrVal.type == 'MustacheTag') { attributeValue.push(rangeWithTrailingPropertyAccess(str.original, attrVal.expression)); addAttribute(attributeName, attributeValue); } return; } for (const n of attr.value) { if (n.type === 'MustacheTag') { str.appendRight(n.start, '$'); } } attributeValue.push('`', [attr.value[0].start, attr.value[attr.value.length - 1].end], '`'); addAttribute(attributeName, attributeValue); } function attributeValueIsOfType(value, type) { return value !== true && value.length == 1 && value[0].type == type; } function handleAwait(str, awaitBlock) { var _a, _b; const transforms = ['{ ']; if (!awaitBlock.pending.skip) { transforms.push([awaitBlock.pending.start, awaitBlock.pending.end]); } if (awaitBlock.error || !awaitBlock.catch.skip) { transforms.push('try { '); } if (awaitBlock.value) { transforms.push('const $$_value = '); } const expressionEnd = withTrailingPropertyAccess(str.original, awaitBlock.expression.end); transforms.push('await (', [awaitBlock.expression.start, expressionEnd], ');'); if (awaitBlock.value) { transforms.push('{ const ', [awaitBlock.value.start, awaitBlock.value.end], ' = $$_value; '); } if (!awaitBlock.then.skip) { if (awaitBlock.pending.skip) { transforms.push([awaitBlock.then.start, awaitBlock.then.end]); } else if ((_a = awaitBlock.then.children) === null || _a === void 0 ? void 0 : _a.length) { transforms.push([ awaitBlock.then.children[0].start, awaitBlock.then.children[awaitBlock.then.children.length - 1].end ]); } } if (awaitBlock.value) { transforms.push('}'); } if (awaitBlock.error || !awaitBlock.catch.skip) { transforms.push('} catch($$_e) { '); if (awaitBlock.error) { transforms.push('const ', [awaitBlock.error.start, awaitBlock.error.end], ' = __sveltets_2_any();'); } if (!awaitBlock.catch.skip && ((_b = awaitBlock.catch.children) === null || _b === void 0 ? void 0 : _b.length)) { transforms.push([ awaitBlock.catch.children[0].start, awaitBlock.catch.children[awaitBlock.catch.children.length - 1].end ]); } transforms.push('}'); } transforms.push('}'); transform(str, awaitBlock.start, awaitBlock.end, awaitBlock.end, transforms); } const oneWayBindingAttributes = new Map(['clientWidth', 'clientHeight', 'offsetWidth', 'offsetHeight'] .map((e) => [e, 'HTMLDivElement']) .concat(['duration', 'buffered', 'seekable', 'seeking', 'played', 'ended'].map((e) => [ e, 'HTMLMediaElement' ]))); new Set([...oneWayBindingAttributes.keys(), 'this']); const supportsBindThis = [ 'InlineComponent', 'Element', 'Body', 'Slot' ]; function handleBinding(str, attr, parent, element) { if (element instanceof Element && attr.name == 'group' && parent.name == 'input') { element.appendToStartEnd([ rangeWithTrailingPropertyAccess(str.original, attr.expression), ';' ]); return; } if (attr.name === 'this' && supportsBindThis.includes(parent.type)) { element.appendToStartEnd([ [attr.expression.start, attr.expression.end], ` = ${element.name};` ]); return; } if (oneWayBindingAttributes.has(attr.name) && element instanceof Element) { element.appendToStartEnd([ [attr.expression.start, attr.expression.end], `= ${element.name}.${attr.name};` ]); return; } const isShorthand = attr.expression.start === attr.start + 'bind:'.length; const name = isShorthand ? [[attr.expression.start, attr.expression.end]] : [[attr.start + 'bind:'.length, str.original.lastIndexOf('=', attr.expression.start)]]; const value = isShorthand ? undefined : [rangeWithTrailingPropertyAccess(str.original, attr.expression)]; if (element instanceof Element) { element.addAttribute(name, value); } else { element.addProp(name, value); } } function handleClassDirective(str, attr, element) { element.appendToStartEnd([rangeWithTrailingPropertyAccess(str.original, attr.expression), ';']); } function handleComment(str, node) { str.overwrite(node.start, node.end, '', { contentOnly: true }); } function handleConstTag(str, constTag) { str.overwrite(constTag.start, constTag.expression.start, 'const '); str.overwrite(withTrailingPropertyAccess(str.original, constTag.expression.end), constTag.end, ';'); } function handleDebug(str, debugBlock) { let cursor = debugBlock.start; for (const identifier of debugBlock.identifiers) { str.overwrite(cursor, identifier.start, ';', { contentOnly: true }); cursor = identifier.end; } str.overwrite(cursor, debugBlock.end, ';', { contentOnly: true }); } function handleEach(str, eachBlock) { var _a; const startEnd = str.original.indexOf('}', ((_a = eachBlock.key) === null || _a === void 0 ? void 0 : _a.end) || eachBlock.context.end) + 1; let transforms; const containsComma = str.original .substring(eachBlock.expression.start, eachBlock.expression.end) .includes(','); const arrayAndItemVarTheSame = str.original.substring(eachBlock.expression.start, eachBlock.expression.end) === str.original.substring(eachBlock.context.start, eachBlock.context.end); if (arrayAndItemVarTheSame) { transforms = [ `{ const $$_each = __sveltets_2_ensureArray(${containsComma ? '(' : ''}`, [eachBlock.expression.start, eachBlock.expression.end], `${containsComma ? ')' : ''}); for(const `, [eachBlock.context.start, eachBlock.context.end], ' of $$_each){' ]; } else { transforms = [ 'for(const ', [eachBlock.context.start, eachBlock.context.end], ` of __sveltets_2_ensureArray(${containsComma ? '(' : ''}`, [eachBlock.expression.start, eachBlock.expression.end], `${containsComma ? ')' : ''})){` ]; } if (eachBlock.index) { const indexStart = str.original.indexOf(eachBlock.index, eachBlock.context.end); const indexEnd = indexStart + eachBlock.index.length; transforms.push('let ', [indexStart, indexEnd], ' = 1;'); } if (eachBlock.key) { transforms.push([eachBlock.key.start, eachBlock.key.end], ';'); } transform(str, eachBlock.start, startEnd, startEnd, transforms); const endEach = str.original.lastIndexOf('{', eachBlock.end - 1); if (eachBlock.else) { const elseEnd = str.original.lastIndexOf('}', eachBlock.else.start); const elseStart = str.original.lastIndexOf('{', elseEnd); str.overwrite(elseStart, elseEnd + 1, '}' + (arrayAndItemVarTheSame ? '}' : ''), { contentOnly: true }); str.remove(endEach, eachBlock.end); } else { str.overwrite(endEach, eachBlock.end, '}' + (arrayAndItemVarTheSame ? '}' : ''), { contentOnly: true }); } } function handleEventHandler(str, attr, element) { const nameStart = str.original.indexOf(':', attr.start) + 1; const nameEnd = nameStart + attr.name.length; if (element instanceof Element) { surroundWith(str, [nameStart, nameEnd], '"on', '"'); element.addAttribute([[nameStart, nameEnd]], attr.expression ? [rangeWithTrailingPropertyAccess(str.original, attr.expression)] : ['undefined']); } else { element.addEvent([nameStart, nameEnd], attr.expression ? rangeWithTrailingPropertyAccess(str.original, attr.expression) : undefined); } } function handleIf(str, ifBlock) { if (ifBlock.elseif) { const start = str.original.lastIndexOf('{:', ifBlock.expression.start); str.overwrite(start, ifBlock.expression.start, '} else if ('); } else { str.overwrite(ifBlock.start, ifBlock.expression.start, 'if('); } const expressionEnd = withTrailingPropertyAccess(str.original, ifBlock.expression.end); const end = str.original.indexOf('}', expressionEnd); str.overwrite(expressionEnd, end + 1, '){'); const endif = str.original.lastIndexOf('{', ifBlock.end - 1); str.overwrite(endif, ifBlock.end, '}'); } function handleElse(str, elseBlock, parent) { if (parent.type !== 'IfBlock') { return; } const elseEnd = str.original.lastIndexOf('}', elseBlock.start); const elseword = str.original.lastIndexOf(':else', elseEnd); const elseStart = str.original.lastIndexOf('{', elseword); str.overwrite(elseStart, elseStart + 1, '}'); str.overwrite(elseEnd, elseEnd + 1, '{'); const colon = str.original.indexOf(':', elseword); str.remove(colon, colon + 1); } function handleKey(str, keyBlock) { str.overwrite(keyBlock.start, keyBlock.expression.start, '', { contentOnly: true }); const expressionEnd = withTrailingPropertyAccess(str.original, keyBlock.expression.end); const end = str.original.indexOf('}', expressionEnd); str.overwrite(expressionEnd, end + 1, '; '); const endKey = str.original.lastIndexOf('{', keyBlock.end - 1); str.overwrite(endKey, keyBlock.end, '', { contentOnly: true }); } function handleLet(str, node, parent, preserveCase, element) { if (element instanceof InlineComponent) { addSlotLet(node, element); } else { if (element.parent instanceof InlineComponent) { addSlotLet(node, element); } else { handleAttribute(str, { start: node.start, end: node.end, type: 'Attribute', name: 'let:' + node.name, value: node.expression ? [ { type: 'MustacheTag', start: node.expression.start, end: node.expression.end, expression: node.expression } ] : true }, parent, preserveCase, element); } } } function addSlotLet(node, element) { const letTransformation = [ [node.start + 'let:'.length, node.start + 'let:'.length + node.name.length] ]; if (node.expression) { letTransformation.push(':', [node.expression.start, node.expression.end]); } element.addSlotLet(letTransformation); } function handleMustacheTag(str, node, parent) { if (parent.type === 'Attribute') { return; } str.overwrite(node.start, node.start + 1, '', { contentOnly: true }); str.overwrite(node.end - 1, node.end, ';', { contentOnly: true }); } function handleRawHtml(str, node) { str.overwrite(node.start, node.expression.start, ' '); str.overwrite(withTrailingPropertyAccess(str.original, node.expression.end), node.end, ';'); } function handleSpread(node, element) { const transformation = [[node.start + 1, node.end - 1]]; if (element instanceof Element) { element.addAttribute(transformation); } else { element.addProp(transformation); } } function handleStyleDirective(str, style, element) { const htmlx = str.original; const ensureType = '__sveltets_2_ensureType(String, Number, '; if (style.value === true || style.value.length === 0) { element.appendToStartEnd([ ensureType, [htmlx.indexOf(':', style.start) + 1, style.end], ');' ]); return; } let start = style.value[0].start; if (style.value[0].type === 'MustacheTag') { start++; } const last = style.value[style.value.length - 1]; let end = last.end; if (last.type === 'MustacheTag') { end--; } if (style.value.length > 1) { for (const n of style.value) { if (n.type === 'MustacheTag') { str.appendRight(n.start, '$'); } } element.appendToStartEnd([ensureType + '`', [start, end], '`);']); return; } const styleVal = style.value[0]; if (styleVal.type === 'Text') { const quote = ['"', "'"].includes(str.original[styleVal.start - 1]) ? str.original[styleVal.start - 1] : '"'; element.appendToStartEnd([`${ensureType}${quote}`, [start, end], `${quote});`]); } else { element.appendToStartEnd([ensureType, [start, end], ');']); } } function handleText(str, node, parent) { if (!node.data || parent.type === 'Attribute') { return; } let replacement = node.data.replace(/\S/g, ''); if (!replacement && node.data.length) { replacement = ' '; } str.overwrite(node.start, node.end, replacement, { contentOnly: true }); } function handleTransitionDirective(str, attr, element) { const transformations = [ '__sveltets_2_ensureTransition(', getDirectiveNameStartEndIdx(str, attr), `(${element.typingsNamespace}.mapElementTag('${element.tagName}')` ]; if (attr.expression) { transformations.push(',(', rangeWithTrailingPropertyAccess(str.original, attr.expression), ')'); } transformations.push('));'); element.appendToStartEnd(transformations); } function stripDoctype(str) { const regex = /<!doctype(.+?)>(\n)?/i; const result = regex.exec(str.original); if (result) { str.remove(result.index, result.index + result[0].length); } } function convertHtmlxToJsx(str, ast, onWalk = null, onLeave = null, options = {}) { str.original; options = { preserveAttributeCase: false, ...options }; options.typingsNamespace = options.typingsNamespace || 'svelteHTML'; stripDoctype(str); let element; compiler_1.walk(ast, { enter: (node, parent, prop, index) => { try { switch (node.type) { case 'IfBlock': handleIf(str, node); break; case 'EachBlock': handleEach(str, node); break; case 'ElseBlock': handleElse(str, node, parent); break; case 'KeyBlock': handleKey(str, node); break; case 'MustacheTag': handleMustacheTag(str, node, parent); break; case 'RawMustacheTag': handleRawHtml(str, node); break; case 'DebugTag': handleDebug(str, node); break; case 'ConstTag': handleConstTag(str, node); break; case 'InlineComponent': if (element) { element.child = new InlineComponent(str, node, element); element = element.child; } else { element = new InlineComponent(str, node); } break; case 'Element': case 'Options': case 'Window': case 'Head': case 'Title': case 'Body': case 'Slot': case 'SlotTemplate': if (node.name !== '!DOCTYPE') { if (element) { element.child = new Element(str, node, options.typingsNamespace, element); element = element.child; } else { element = new Element(str, node, options.typingsNamespace); } } break; case 'Comment': handleComment(str, node); break; case 'Binding': handleBinding(str, node, parent, element); break; case 'Class': handleClassDirective(str, node, element); break; case 'StyleDirective': handleStyleDirective(str, node, element); break; case 'Action': handleActionDirective(str, node, element); break; case 'Transition': handleTransitionDirective(str, node, element); break; case 'Animation': handleAnimateDirective(str, node, element); break; case 'Attribute': handleAttribute(str, node, parent, options.preserveAttributeCase, element); break; case 'Spread': handleSpread(node, element); break; case 'EventHandler': handleEventHandler(str, node, element); break; case 'Let': handleLet(str, node, parent, options.preserveAttributeCase, element); break; case 'Text': handleText(str, node, parent); break; } if (onWalk) { onWalk(node, parent, prop, index); } } catch (e) { console.error('Error walking node ', node, e); throw e; } }, leave: (node, parent, prop, index) => { try { switch (node.type) { case 'IfBlock': break; case 'EachBlock': break; case 'AwaitBlock': handleAwait(str, node); break; case 'InlineComponent': case 'Element': case 'Options': case 'Window': case 'Head': case 'Title': case 'Body': case 'Slot': case 'SlotTemplate': if (node.name !== '!DOCTYPE') { element.performTransformation(); element = element.parent; } break; } if (onLeave) { onLeave(node, parent, prop, index); } } catch (e) { console.error('Error leaving node ', node); throw e; } } }); } const COMPONENT_DOCUMENTATION_HTML_COMMENT_TAG = '@component'; class ComponentDocumentation { constructor() { this.componentDocumentation = ''; this.handleComment = (node) => { if ('data' in node && typeof node.data === 'string' && node.data.includes(COMPONENT_DOCUMENTATION_HTML_COMMENT_TAG)) { this.componentDocumentation = node.data .replace(COMPONENT_DOCUMENTATION_HTML_COMMENT_TAG, '') .trim(); } }; } getFormatted() { if (!this.componentDocumentation) { return ''; } if (!this.componentDocumentation.includes('\n')) { return `/** ${this.componentDocumentation} */\n`; } const lines = lib(this.componentDocumentation) .split('\n') .map((line) => ` *${line ? ` ${line}` : ''}`) .join('\n'); return `/**\n${lines}\n */\n`; } } function isInterfaceOrTypeDeclaration(node) { return ts__default__default['default'].isTypeAliasDeclaration(node) || ts__default__default['default'].isInterfaceDeclaration(node); } function findExportKeyword(node) { var _a; return (_a = node.modifiers) === null || _a === void 0 ? void 0 : _a.find((x) => x.kind == ts__default__default['default'].SyntaxKind.ExportKeyword); } function isAssignmentBinaryExpr(node) { return (ts__default__default['default'].isBinaryExpression(node) && node.operatorToken.kind == ts__default__default['default'].SyntaxKind.EqualsToken && (ts__default__default['default'].isIdentifier(node.left) || ts__default__default['default'].isObjectLiteralExpression(node.left) || ts__default__default['default'].isArrayLiteralExpression(node.left))); } function getBinaryAssignmentExpr(node) { if (ts__default__default['default'].isExpressionStatement(node.statement)) { if (isAssignmentBinaryExpr(node.statement.expression)) { return node.statement.expression; } if (ts__default__default['default'].isParenthesizedExpression(node.statement.expression) && isAssignmentBinaryExpr(node.statement.expression.expression)) { return node.statement.expression.expression; } } } function isParenthesizedObjectOrArrayLiteralExpression(node) { return (ts__default__default['default'].isParenthesizedExpression(node) && ts__default__default['default'].isBinaryExpression(node.expression) && (ts__default__default['default'].isObjectLiteralExpression(node.expression.left) || ts__default__default['default'].isArrayLiteralExpression(node.expression.left))); } function extractIdentifiers(node, identifiers = []) { if (ts__default__default['default'].isIdentifier(node)) { identifiers.push(node); } else if (ts__default__default['default'].isBindingElement(node)) { extractIdentifiers(node.name, identifiers); } else if (isMember(node)) { let object = node; while (isMember(object)) { object = object.expression; } if (ts__default__default['default'].isIdentifier(object)) { identifiers.push(object); } } else if (ts__default__default['default'].isArrayBindingPattern(node) || ts__default__default['default'].isObjectBindingPattern(node)) { node.elements.forEach((element) => { extractIdentifiers(element, identifiers); }); } else if (ts__default__default['default'].isObjectLiteralExpression(node)) { node.properties.forEach((child) => { if (ts__default__default['default'].isSpreadAssignment(child)) { extractIdentifiers(child.expression, identifiers); } else if (ts__default__default['default'].isShorthandPropertyAssignment(child)) { extractIdentifiers(child.name, identifiers); } else if (ts__default__default['default'].isPropertyAssignment(child)) { extractIdentifiers(child.initializer, identifiers); } }); } else if (ts__default__default['default'].isArrayLiteralExpression(node)) { node.elements.forEach((element) => { if (ts__default__default['default'].isSpreadElement(element)) { extractIdentifiers(element, identifiers); } else { extractIdentifiers(element, identifiers); } }); } return identifiers; } function isMember(node) { return ts__default__default['default'].isElementAccessExpression(node) || ts__default__default['default'].isPropertyAccessExpression(node); } function getVariableAtTopLevel(node, identifierName) { for (const child of node.statements) { if (ts__default__default['default'].isVariableStatement(child)) { const variable = child.declarationList.declarations.find((declaration) => ts__default__default['default'].isIdentifier(declaration.name) && declaration.name.text === identifierName); if (variable) { return variable; } } } } function getLastLeadingDoc(node) { var _a; const nodeText = node.getFullText(); const comments = (_a = ts__default__default['default'] .getLeadingCommentRanges(nodeText, 0)) === null || _a === void 0 ? void 0 : _a.filter((c) => c.kind === ts__default__default['default'].SyntaxKind.MultiLineCommentTrivia); const comment = comments === null || comments === void 0 ? void 0 : comments[(comments === null || comments === void 0 ? void 0 : comments.length) - 1]; if (comment) { let commentText = nodeText.substring(comment.pos, comment.end); const typedefTags = ts__default__default['default'].getAllJSDocTagsOfKind(node, ts__default__default['default'].SyntaxKind.JSDocTypedefTag); typedefTags .filter((tag) => tag.pos >= comment.pos) .map((tag) => nodeText.substring(tag.pos, tag.end)) .forEach((comment) => { commentText = commentText.replace(comment, ''); }); return commentText; } } function isNotPropertyNameOfImport(identifier) { return (!ts__default__default['default'].isImportSpecifier(identifier.parent) || identifier.parent.propertyName !== identifier); } function getNamesFromLabeledStatement(node) { var _a; const leftHandSide = (_a = getBinaryAssignmentExpr(node)) === null || _a === void 0 ? void 0 : _a.left; if (!leftHandSide) { return []; } return (extractIdentifiers(leftHandSide) .map((id) => id.text) .filter((name) => !name.startsWith('$'))); } function is$$EventsDeclaration(node) { return isInterfaceOrTypeDeclaration(node) && node.name.text === '$$Events'; } class ComponentEvents { constructor(eventHandler, strictEvents, str) { this.strictEvents = strictEvents; this.str = str; this.componentEventsInterface = new ComponentEventsFromInterface(); this.componentEventsFromEventsMap = new ComponentEventsFromEventsMap(eventHandler); } get eventsClass() { return this.componentEventsInterface.isPresent() ? this.componentEventsInterface : this.componentEventsFromEventsMap; } createAPI() { const entries = []; const iterableEntries = this.eventsClass.events.entries(); for (const entry of iterableEntries) { entries.push({ name: entry[0], ...entry[1] }); } return { getAll() { return entries; } }; } toDefString() { return this.eventsClass.toDefString(); } setComponentEventsInterface(node, astOffset) { this.componentEventsInterface.setComponentEventsInterface(node, this.str, astOffset); } hasStrictEvents() { return this.componentEventsInterface.isPresent() || this.strictEvents; } checkIfImportIsEventDispatcher(node) { this.componentEventsFromEventsMap.checkIfImportIsEventDispatcher(node); this.componentEventsInterface.checkIfImportIsEventDispatcher(node); } checkIfIsStringLiteralDeclaration(node) { this.componentEventsFromEventsMap.checkIfIsStringLiteralDeclaration(node); } checkIfDeclarationInstantiatedEventDispatcher(node) { this.componentEventsFromEventsMap.checkIfDeclarationInstantiatedEventDispatcher(node); this.componentEventsInterface.checkIfDeclarationInstantiatedEventDispatcher(node); } checkIfCallExpressionIsDispatch(node) { this.componentEventsFromEventsMap.checkIfCallExpressionIsDispatch(node); } } class ComponentEventsFromInterface { constructor() { this.events = new Map(); this.eventDispatcherImport = ''; } setComponentEventsInterface(node, str, astOffset) { this.str = str; this.astOffset = astOffset; this.events = this.extractEvents(node); } checkIfImportIsEventDispatcher(node) { if (this.eventDispatcherImport) { return; } this.eventDispatcherImport = checkIfImportIsEventDispatcher(node); } checkIfDeclarationInstantiatedEventDispatcher(node) { if (!this.isPresent()) { return; } const result = checkIfDeclarationInstantiatedEventDispatcher(node, this.eventDispatcherImport); if (!result) { return; } const { dispatcherTyping, dispatcherCreationExpr } = result; if (!dispatcherTyping) { this.str.prependLeft(dispatcherCreationExpr.expression.getEnd() + this.astOffset, '<__sveltets_1_CustomEvents<$$Events>>'); } } toDefString() { return this.isPresent() ? '{} as unknown as $$Events' : undefined; } isPresent() { return !!this.str; } extractEvents(node) { const map = new Map(); if (ts__default__default['default'].isInterfaceDeclaration(node)) { this.extractProperties(node.members, map); } else { if (ts__default__default['default'].isTypeLiteralNode(node.type)) { this.extractProperties(node.type.members, map); } else if (ts__default__default['default'].isIntersectionTypeNode(node.type)) { node.type.types.forEach((type) => { if (ts__default__default['default'].isTypeLiteralNode(type)) { this.extractProperties(type.members, map); } }); } } return map; } extractProperties(members, map) { members.filter(ts__default__default['default'].isPropertySignature).forEach((member) => { var _a; map.set(getName(member.name), { type: ((_a = member.type) === null || _a === void 0 ? void 0 : _a.getText()) || 'Event', doc: getDoc(member) }); }); } } class ComponentEventsFromEventsMap { constructor(eventHandler) { this.eventHandler = eventHandler; this.events = new Map(); this.dispatchedEvents = new Set(); this.stringVars = new Map(); this.eventDispatcherImport = ''; this.eventDispatchers = []; this.events = this.extractEvents(eventHandler); } checkIfImportIsEventDispatcher(node) { if (this.eventDispatcherImport) { return; } this.eventDispatcherImport = checkIfImportIsEventDispatcher(node); } checkIfIsStringLiteralDeclaration(node) { if (ts__default__default['default'].isIdentifier(node.name) && node.initializer && ts__default__default['default'].isStringLiteral(node.initializer)) { this.stringVars.set(node.name.text, node.initializer.text); } } checkIfDeclarationInstantiatedEventDispatcher(node) { const result = checkIfDeclarationInstantiatedEventDispatcher(node, this.eventDispatcherImport); if (!result) { return; } const { dispatcherTyping, dispatcherName } = result; if (dispatcherTyping && ts__default__default['default'].isTypeLiteralNode(dispatcherTyping)) { this.eventDispatchers.push({ name: dispatcherName, typing: dispatcherTyping.getText() }); dispatcherTyping.members.filter(ts__default__default['default'].isPropertySignature).forEach((member) => { var _a; this.addToEvents(getName(member.name), { type: `CustomEvent<${((_a = member.type) === null || _a === void 0 ? void 0 : _a.getText()) || 'any'}>`, doc: getDoc(member) }); }); } else { this.eventDispatchers.push({ name: dispatcherName }); this.eventHandler .getDispatchedEventsForIdentifier(dispatcherName) .forEach((evtName) => { this.addToEvents(evtName); this.dispatchedEvents.add(evtName); }); } } checkIfCallExpressionIsDispatch(node) { if (this.eventDispatchers.some((dispatcher) => !dispatcher.typing && ts__default__default['default'].isIdentifier(node.expression) && node.expression.text === dispatcher.name)) { const firstArg = node.arguments[0]; if (ts__default__default['default'].isStringLiteral(firstArg)) { this.addToEvents(firstArg.text); this.dispatchedEvents.add(firstArg.text); } else if (ts__default__default['default'].isIdentifier(firstArg)) { const str = this.stringVars.get(firstArg.text); if (str) { this.addToEvents(str); this.dispatchedEvents.add(str); } } } } addToEvents(eventName, info = { type: 'CustomEvent<any>' }) { if (this.events.has(eventName)) { this.events.set(eventName, { type: 'CustomEvent<any>' }); this.dispatchedEvents.add(eventName); } else { this.events.set(eventName, info); } } toDefString() { return ('{' + [ ...this.eventDispatchers .map((dispatcher) => dispatcher.typing && `...__sveltets_1_toEventTypings<${dispatcher.typing}>()`) .filter((str) => !!str), ...this.eventHandler.bubbledEventsAsStrings(), ...[...this.dispatchedEvents.keys()].map((e) => `'${e}': __sveltets_1_customEvent`) ].join(', ') + '}'); } extractEvents(eventHandler) { const map = new Map(); for (const name of eventHandler.getBubbledEvents().keys()) { map.set(name, { type: 'Event' }); } return map; } } function getName(prop) { if (ts__default__default['default'].isIdentifier(prop) || ts__default__default['default'].isStringLiteral(prop)) { return prop.text; } if (ts__default__default['default'].isComputedPropertyName(prop)) { if (ts__default__default['default'].isIdentifier(prop.expression)) { const identifierName = prop.expression.text; const identifierValue = getIdentifierValue(prop, identifierName); if (!identifierValue) { throwError$1(prop); } return identifierValue; } } throwError$1(prop); } function getIdentifierValue(prop, identifierName) { const variable = getVariableAtTopLevel(prop.getSourceFile(), identifierName); if (variable && ts__default__default['default'].isStringLiteral(variable.initializer)) { return variable.initializer.text; } } function throwError$1(prop) { const error = new Error('The ComponentEvents interface can only have properties of type ' + 'Identifier, StringLiteral or ComputedPropertyName. ' + 'In case of ComputedPropertyName, ' + 'it must be a const declared within the component and initialized with a string.'); error.start = toLineColumn(prop.getStart()); error.end = toLineColumn(prop.getEnd()); throw error; function toLineColumn(pos) { const lineChar = prop.getSourceFile().getLineAndCharacterOfPosition(pos); return { line: lineChar.line + 1, column: lineChar.character }; } } function getDoc(member) { let doc = undefined; const comment = getLastLeadingDoc(member); if (comment) { doc = comment .split('\n') .map((line) => line .replace(/\s*\/\*\*/, '') .replace(/\s*\*\//, '') .replace(/\s*\*/, '') .trim()) .join('\n'); } return doc; } function checkIfImportIsEventDispatcher(node) { var _a; if (ts__default__default['default'].isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text !== 'svelte') { return; } const namedImports = (_a = node.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings; if (namedImports && ts__default__default['default'].isNamedImports(namedImports)) { const eventDispatcherImport = namedImports.elements.find( (el) => (el.propertyName || el.name).text === 'createEventDispatcher'); if (eventDispatcherImport) { return eventDispatcherImport.name.text; } } } function checkIfDeclarationInstantiatedEventDispatcher(node, eventDispatcherImport) { var _a; if (!ts__default__default['default'].isIdentifier(node.name) || !node.initializer) { return; } if (ts__default__default['default'].isCallExpression(node.initializer) && ts__default__default['default'].isIdentifier(node.initializer.expression) && node.initializer.expression.text === eventDispatcherImport) { const dispatcherName = node.name.text; const dispatcherTyping = (_a = node.initializer.typeArguments) === null || _a === void 0 ? void 0 : _a[0]; return { dispatcherName, dispatcherTyping, dispatcherCreationExpr: node.initializer }; } } class EventHandler { constructor() { this.bubbledEvents = new Map(); this.callees = []; } handleEventHandler(node, parent) { const eventName = node.name; if (!node.expression) { if (parent.type === 'InlineComponent') { this.handleEventHandlerBubble(parent, eventName); } else { this.bubbledEvents.set(eventName, getEventDefExpressionForNonCompoent(eventName, parent)); } } } handleIdentifier(node, parent, prop) { if (prop === 'callee') { this.callees.push({ name: node.name, parent }); } } getBubbledEvents() { return this.bubbledEvents; } getDispatchedEventsForIdentifier(name) { const eventNames = new Set(); this.callees.forEach((callee) => { if (callee.name === name) { const [name] = callee.parent.arguments; if (name.value !== undefined) { eventNames.add(name.value); } } }); return eventNames; } bubbledEventsAsStrings() { return Array.from(this.bubbledEvents.entries()).map(eventMapEntryToString); } handleEventHandlerBubble(parent, eventName) { const componentEventDef = `__sveltets_1_instanceOf(${parent.name})`; const exp = `__sveltets_1_bubbleEventDef(${componentEventDef}.$$events_def, '${eventName}')`; const exist = this.bubbledEvents.get(eventName); this.bubbledEvents.set(eventName, exist ? [].concat(exist, exp) : exp); } } function getEventDefExpressionForNonCompoent(eventName, ele) { switch (ele.type) { case 'Element': return `__sveltets_1_mapElementEvent('${eventName}')`; case 'Body': return `__sveltets_1_mapBodyEvent('${eventName}')`; case 'Window': return `__sveltets_1_mapWindowEvent('${eventName}')`; } } function eventMapEntryToString([eventName, expression]) { return `'${eventName}':${Array.isArray(expression) ? `__sveltets_1_unionType(${expression.join(',')})` : expression}`; } function preprendStr(str, index, toAppend, removeExisting) { const prepends = updatePrepends(str, index, toAppend, removeExisting); toAppend = prepends.join(''); str.overwrite(index, index + 1, toAppend + str.original.charAt(index), { contentOnly: true }); return str; } function overwriteStr(str, start, end, toOverwrite, removeExisting) { const prepends = updatePrepends(str, start, toOverwrite, removeExisting); toOverwrite = prepends.join(''); str.overwrite(start, end, toOverwrite, { contentOnly: true }); return str; } function updatePrepends(str, index, toAppend, removeExisting) { str.__prepends__ = str.__prepends__ || new Map(); const prepends = removeExisting ? [] : str.__prepends__.get(index) || []; prepends.push(toAppend); str.__prepends__.set(index, prepends); return prepends; } function is$$PropsDeclaration(node) { return isInterfaceOrTypeDeclaration(node) && node.name.text === '$$Props'; } class ExportedNames { constructor(str, astOffset) { this.str = str; this.astOffset = astOffset; this.uses$$Props = false; this.exports = new Map(); this.possibleExports = new Map(); this.doneDeclarationTransformation = new Set(); this.getters = new Set(); } handleVariableStatement(node, parent) { const exportModifier = findExportKeyword(node); if (exportModifier) { const isLet = node.declarationList.flags === ts__default__default['default'].NodeFlags.Let; const isConst = node.declarationList.flags === ts__default__default['default'].NodeFlags.Const; this.handleExportedVariableDeclarationList(node.declarationList, (_, ...args) => this.addExport(...args)); if (isLet) { this.propTypeAssertToUserDefined(node.declarationList); } else if (isConst) { node.declarationList.forEachChild((n) => { if (ts__default__default['default'].isVariableDeclaration(n) && ts__default__default['default'].isIdentifier(n.name)) { this.addGetter(n.name); } }); } this.removeExport(exportModifier.getStart(), exportModifier.end); } else if (ts__default__default['default'].isSourceFile(parent)) { this.handleExportedVariableDeclarationList(node.declarationList, this.addPossibleExport.bind(this)); } } handleExportFunctionOrClass(node) { const exportModifier = findExportKeyword(node); if (!exportModifier) { return; } this.removeExport(exportModifier.getStart(), exportModifier.end); this.addGetter(node.name); if (node.name) { this.addExport(node.name, false); } } handleExportDeclaration(node) { const { exportClause } = node; if (ts__default__default['default'].isNamedExports(exportClause)) { for (const ne of exportClause.elements) { if (ne.propertyName) { this.addExport(ne.propertyName, false, ne.name); } else { this.addExport(ne.name, false); } } this.removeExport(node.getStart(), node.end); } } removeExport(start, end) { const exportStart = this.str.original.indexOf('export', start + this.astOffset); const exportEnd = exportStart + (end - start); this.str.remove(exportStart, exportEnd); } propTypeAssertToUserDefined(node) { if (this.doneDeclarationTransformation.has(node)) { return; } const handleTypeAssertion = (declaration) => { const identifier = declaration.name; const tsType = declaration.type; const jsDocType = ts__default__default['default'].getJSDocType(declaration); const type = tsType || jsDocType; if (ts__default__default['default'].isIdentifier(identifier) && (!declaration.initializer || type || (!type && [ts__default__default['default'].SyntaxKind.FalseKeyword, ts__default__default['default'].SyntaxKind.TrueKeyword].includes(declaration.initializer.kind)))) { const name = identifier.getText(); const end = declaration.end + this.astOffset; preprendStr(this.str, end, surroundWithIgnoreComments(`;${name} = __sveltets_1_any(${name});`)); } }; const findComma = (target) => target.getChildren().filter((child) => child.kind === ts__default__default['default'].SyntaxKind.CommaToken); const splitDeclaration = () => { const commas = node .getChildren() .filter((child) => child.kind === ts__default__default['default'].SyntaxKind.SyntaxList) .map(findComma) .reduce((current, previous) => [...current, ...previous], []); commas.forEach((comma) => { const start = comma.getStart() + this.astOffset; const end = comma.getEnd() + this.astOffset; overwriteStr(this.str, start, end, ';let '); }); }; for (const declaration of node.declarations) { handleTypeAssertion(declaration); } splitDeclaration(); this.doneDeclarationTransformation.add(node); } handleExportedVariableDeclarationList(list, add) { const isLet = list.flags === ts__default__default['default'].NodeFlags.Let; ts__default__default['default'].forEachChild(list, (node) => { if (ts__default__default['default'].isVariableDeclaration(node)) { if (ts__default__default['default'].isIdentifier(node.name)) { add(list, node.name, isLet, node.name, node.type, !node.initializer); } else if (ts__default__default['default'].isObjectBindingPattern(node.name) || ts__default__default['default'].isArrayBindingPattern(node.name)) { ts__default__default['default'].forEachChild(node.name, (element) => { if (ts__default__default['default'].isBindingElement(element)) { add(list, element.name, isLet); } }); } } }); } addGetter(node) { if (!node) { return; } this.getters.add(node.text); } createClassGetters() { return Array.from(this.getters) .map((name) => `\n get ${name}() { return render().getters.${name} }`) .join(''); } createRenderFunctionGetterStr() { const properties = Array.from(this.getters).map((name) => `${name}: ${name}`); return `{${properties.join(', ')}}`; } createClassAccessors() { const accessors = []; for (const value of this.exports.values()) { if (this.getters.has(value.identifierText)) { continue; } accessors.push(value.identifierText); } return accessors .map((name) => `\n get ${name}() { return render().props.${name} }` + `\n /**accessor*/\n set ${name}(_) {}`) .join(''); } addPossibleExport(declaration, name, isLet, target = null, type = null, required = false) { if (!ts__default__default['default'].isIdentifier(name)) { return; } if (target && ts__default__default['default'].isIdentifier(target)) { this.possibleExports.set(name.text, { declaration, isLet, type: type === null || type === void 0 ? void 0 : type.getText(), identifierText: target.text, required, doc: this.getDoc(target) }); } else { this.possibleExports.set(name.text, { declaration, isLet }); } } addExport(name, isLet, target = null, type = null, required = false) { if (name.kind != ts__default__default['default'].SyntaxKind.Identifier) { throw Error('export source kind not supported ' + name); } if (target && target.kind != ts__default__default['default'].SyntaxKind.Identifier) { throw Error('export target kind not supported ' + target); } const existingDeclaration = this.possibleExports.get(name.text); if (target) { this.exports.set(name.text, { isLet: isLet || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.isLet), type: (type === null || type === void 0 ? void 0 : type.getText()) || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.type), identifierText: target.text, required: required || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.required), doc: this.getDoc(target) || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.doc) }); } else { this.exports.set(name.text, { isLet: isLet || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.isLet), type: existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.type, required: existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.required, doc: existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.doc }); } if (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.isLet) { this.propTypeAssertToUserDefined(existingDeclaration.declaration); } } getDoc(target) { var _a, _b; let doc = undefined; const variableDeclaration = target === null || target === void 0 ? void 0 : target.parent; const exportExpr = (_b = (_a = target === null || target === void 0 ? void 0 : target.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent; if (variableDeclaration) { doc = getLastLeadingDoc(variableDeclaration); } if (exportExpr && !doc) { doc = getLastLeadingDoc(exportExpr); } return doc; } createPropsStr(isTsFile) { const names = Array.from(this.exports.entries()); if (this.uses$$Props) { const lets = names.filter(([, { isLet }]) => isLet); const others = names.filter(([, { isLet }]) => !isLet); return ('{...__sveltets_1_ensureRightProps<{' + this.createReturnElementsType(lets).join(',') + '}>(__sveltets_1_any("") as $$Props), ' + '...__sveltets_1_ensureRightProps<Partial<$$Props>>({' + this.createReturnElements(lets, false).join(',') + '}), ...{} as unknown as $$Props, ...{' + this.createReturnElements(others, false).join(', ') + '} as {' + this.createReturnElementsType(others).join(',') + '}}'); } const dontAddTypeDef = !isTsFile || names.length === 0 || names.every(([_, value]) => !value.type && value.required); const returnElements = this.createReturnElements(names, dontAddTypeDef); if (dontAddTypeDef) { return `{${returnElements.join(' , ')}}`; } const returnElementsType = this.createReturnElementsType(names); return `{${returnElements.join(' , ')}} as {${returnElementsType.join(', ')}}`; } createReturnElements(names, dontAddTypeDef) { return names.map(([key, value]) => { return `${dontAddTypeDef && value.doc ? `\n${value.doc}` : ''}${value.identifierText || key}: ${key}`; }); } createReturnElementsType(names) { return names.map(([key, value]) => { const identifier = `${value.doc ? `\n${value.doc}` : ''}${value.identifierText || key}${value.required ? '' : '?'}`; if (!value.type) { return `${identifier}: typeof ${key}`; } return `${identifier}: ${value.type}`; }); } createOptionalPropsArray() { return Array.from(this.exports.entries()) .filter(([_, entry]) => !entry.required) .map(([name, entry]) => `'${entry.identifierText || name}'`); } getExportsMap() { return this.exports; } } function handleScopeAndResolveForSlot({ identifierDef, initExpression, owner, slotHandler, templateScope }) { if (isIdentifier(identifierDef)) { templateScope.add(identifierDef, owner); slotHandler.resolve(identifierDef, initExpression, templateScope); } if (isDestructuringPatterns(identifierDef)) { const identifiers = extract_identifiers(identifierDef); templateScope.addMany(identifiers, owner); slotHandler.resolveDestructuringAssignment(identifierDef, identifiers, initExpression, templateScope); } } function handleScopeAndResolveLetVarForSlot({ letNode, component, slotName, templateScope, slotHandler }) { const { expression } = letNode; if (!expression) { templateScope.add(letNode, component); slotHandler.resolveLet(letNode, letNode, component, slotName); } else { if (isIdentifier(expression)) { templateScope.add(expression, component); slotHandler.resolveLet(letNode, expression, component, slotName); } const expForExtract = { ...expression }; if (expression.type === 'ArrayExpression') { expForExtract.type = 'ArrayPattern'; } else if (expression.type === 'ObjectExpression') { expForExtract.type = 'ObjectPattern'; } if (isDestructuringPatterns(expForExtract)) { const identifiers = extract_identifiers(expForExtract); templateScope.addMany(identifiers, component); slotHandler.resolveDestructuringAssignmentForLet(expForExtract, identifiers, letNode, component, slotName); } } } class ImplicitStoreValues { constructor(storesResolvedInTemplate = [], renderFunctionStart, storeFromImportsWrapper = (input) => input) { this.renderFunctionStart = renderFunctionStart; this.storeFromImportsWrapper = storeFromImportsWrapper; this.accessedStores = new Set(); this.variableDeclarations = []; this.reactiveDeclarations = []; this.importStatements = []; this.addStoreAcess = this.accessedStores.add.bind(this.accessedStores); this.addVariableDeclaration = this.variableDeclarations.push.bind(this.variableDeclarations); this.addReactiveDeclaration = this.reactiveDeclarations.push.bind(this.reactiveDeclarations); this.addImportStatement = this.importStatements.push.bind(this.importStatements); storesResolvedInTemplate.forEach(this.addStoreAcess); } modifyCode(astOffset, str) { this.variableDeclarations.forEach((node) => this.attachStoreValueDeclarationToDecl(node, astOffset, str)); this.reactiveDeclarations.forEach((node) => this.attachStoreValueDeclarationToReactiveAssignment(node, astOffset, str)); this.attachStoreValueDeclarationOfImportsToRenderFn(str); } getAccessedStores() { return [...this.accessedStores.keys()]; } attachStoreValueDeclarationToDecl(node, astOffset, str) { const storeNames = extractIdentifiers(node.name) .map((id) => id.text) .filter((name) => this.accessedStores.has(name)); if (!storeNames.length) { return; } const storeDeclarations = surroundWithIgnoreComments(this.createStoreDeclarations(storeNames)); const nodeEnd = ts__default__default['default'].isVariableDeclarationList(node.parent) && node.parent.declarations.length > 1 ? node.parent.declarations[node.parent.declarations.length - 1].getEnd() : node.getEnd(); str.appendRight(nodeEnd + astOffset, storeDeclarations); } attachStoreValueDeclarationToReactiveAssignment(node, astOffset, str) { const storeNames = getNamesFromLabeledStatement(node).filter((name) => this.accessedStores.has(name)); if (!storeNames.length) { return; } const storeDeclarations = surroundWithIgnoreComments(this.createStoreDeclarations(storeNames)); const endPos = node.getEnd() + astOffset; if (str.original.charAt(endPos - 1) !== ';') { preprendStr(str, endPos, storeDeclarations); } else { str.appendRight(endPos, storeDeclarations); } } attachStoreValueDeclarationOfImportsToRenderFn(str) { const storeNames = this.importStatements .filter(({ name }) => name && this.accessedStores.has(name.getText())) .map(({ name }) => name.getText()); if (!storeNames.length) { return; } const storeDeclarations = this.storeFromImportsWrapper(surroundWithIgnoreComments(this.createStoreDeclarations(storeNames))); str.appendRight(this.renderFunctionStart, storeDeclarations); } createStoreDeclarations(storeNames) { let declarations = ''; for (let i = 0; i < storeNames.length; i++) { declarations += this.createStoreDeclaration(storeNames[i]); } return declarations; } createStoreDeclaration(storeName) { return `;let $${storeName} = __sveltets_1_store_get(${storeName});`; } } class Scripts { constructor(htmlxAst) { this.htmlxAst = htmlxAst; this.scriptTags = this.htmlxAst.children.filter((child) => child.type === 'Script'); this.topLevelScripts = this.scriptTags; } checkIfElementIsScriptTag(node, parent) { if (parent !== this.htmlxAst && node.name === 'script') { this.topLevelScripts = this.topLevelScripts.filter((tag) => tag.start !== node.start || tag.end !== node.end); } } checkIfContainsScriptTag(node) { this.topLevelScripts = this.topLevelScripts.filter((tag) => !(node.start <= tag.start && node.end >= tag.end)); } getTopLevelScriptTags() { let scriptTag = null; let moduleScriptTag = null; this.topLevelScripts.forEach((tag) => { if (tag.attributes && tag.attributes.find((a) => a.name == 'context' && a.value.length == 1 && a.value[0].raw == 'module')) { moduleScriptTag = tag; } else { scriptTag = tag; } }); return { scriptTag, moduleScriptTag }; } blankOtherScriptTags(str) { this.scriptTags .filter((tag) => !this.topLevelScripts.includes(tag)) .forEach((tag) => { str.remove(tag.start, tag.end); }); } } function attributeStrValueAsJsExpression(attr) { if (attr.value.length == 0) { return "''"; } if (attr.value.length == 1) { const attrVal = attr.value[0]; if (attrVal.type == 'Text') { return '"' + attrVal.raw + '"'; } } return '"__svelte_ts_string"'; } function is$$SlotsDeclaration(node) { return isInterfaceOrTypeDeclaration(node) && node.name.text === '$$Slots'; } class SlotHandler { constructor(htmlx) { this.htmlx = htmlx; this.slots = new Map(); this.resolved = new Map(); this.resolvedExpression = new Map(); } resolve(identifierDef, initExpression, scope) { let resolved = this.resolved.get(identifierDef); if (resolved) { return resolved; } resolved = this.getResolveExpressionStr(identifierDef, scope, initExpression); if (resolved) { this.resolved.set(identifierDef, resolved); } return resolved; } getResolveExpressionStr(identifierDef, scope, initExpression) { const { name } = identifierDef; const owner = scope.getOwner(name); if ((owner === null || owner === void 0 ? void 0 : owner.type) === 'CatchBlock') { return '__sveltets_1_any({})'; } else if ((owner === null || owner === void 0 ? void 0 : owner.type) === 'ThenBlock') { const resolvedExpression = this.resolveExpression(initExpression, scope.parent); return `__sveltets_1_unwrapPromiseLike(${resolvedExpression})`; } else if ((owner === null || owner === void 0 ? void 0 : owner.type) === 'EachBlock') { const resolvedExpression = this.resolveExpression(initExpression, scope.parent); return `__sveltets_1_unwrapArr(${resolvedExpression})`; } return null; } resolveDestructuringAssignment(destructuringNode, identifiers, initExpression, scope) { const destructuring = this.htmlx.slice(destructuringNode.start, destructuringNode.end); identifiers.forEach((identifier) => { const resolved = this.getResolveExpressionStr(identifier, scope, initExpression); if (resolved) { this.resolved.set(identifier, `((${destructuring}) => ${identifier.name})(${resolved})`); } }); } resolveDestructuringAssignmentForLet(destructuringNode, identifiers, letNode, component, slotName) { const destructuring = this.htmlx.slice(destructuringNode.start, destructuringNode.end); identifiers.forEach((identifier) => { const resolved = this.getResolveExpressionStrForLet(letNode, component, slotName); this.resolved.set(identifier, `((${destructuring}) => ${identifier.name})(${resolved})`); }); } getResolveExpressionStrForLet(letNode, component, slotName) { return `${getSingleSlotDef(component, slotName)}.${letNode.name}`; } resolveLet(letNode, identifierDef, component, slotName) { let resolved = this.resolved.get(identifierDef); if (resolved) { return resolved; } resolved = this.getResolveExpressionStrForLet(letNode, component, slotName); this.resolved.set(identifierDef, resolved); return resolved; } getSlotConsumerOfComponent(component) { var _a; let result = (_a = this.getLetNodes(component, 'default')) !== null && _a !== void 0 ? _a : []; for (const child of component.children) { const slotName = getSlotName(child); if (slotName) { const letNodes = this.getLetNodes(child, slotName); if (letNodes === null || letNodes === void 0 ? void 0 : letNodes.length) { result = result.concat(letNodes); } } } return result; } getLetNodes(child, slotName) { var _a; const letNodes = ((_a = child === null || child === void 0 ? void 0 : child.attributes) !== null && _a !== void 0 ? _a : []).filter((attr) => attr.type === 'Let'); return letNodes === null || letNodes === void 0 ? void 0 : letNodes.map((letNode) => ({ letNode, slotName })); } resolveExpression(expression, scope) { let resolved = this.resolvedExpression.get(expression); if (resolved) { return resolved; } const strForExpression = new MagicString(this.htmlx); const identifiers = []; const objectShortHands = []; walk$1(expression, { enter(node, parent, prop) { if (node.type === 'Identifier') { if (parent) { if (isMember$1(parent, prop)) { return; } if (isObjectKey(parent, prop)) { return; } if (isObjectValue(parent, prop)) { if (isObjectValueShortHand(parent)) { this.skip(); objectShortHands.push(node); return; } } } this.skip(); identifiers.push(node); } } }); const getOverwrite = (name) => { const init = scope.getInit(name); return init ? this.resolved.get(init) : name; }; for (const identifier of objectShortHands) { const { end, name } = identifier; const value = getOverwrite(name); strForExpression.appendLeft(end, `:${value}`); } for (const identifier of identifiers) { const { start, end, name } = identifier; const value = getOverwrite(name); strForExpression.overwrite(start, end, value); } resolved = strForExpression.slice(expression.start, expression.end); this.resolvedExpression.set(expression, resolved); return resolved; } handleSlot(node, scope) { var _a; const nameAttr = node.attributes.find((a) => a.name == 'name'); const slotName = nameAttr ? nameAttr.value[0].raw : 'default'; const attributes = new Map(); for (const attr of node.attributes) { if (attr.name == 'name') { continue; } if (attr.type === 'Spread') { const rawName = attr.expression.name; const init = scope.getInit(rawName); const name = init ? this.resolved.get(init) : rawName; attributes.set(`__spread__${name}`, name); } if (!((_a = attr.value) === null || _a === void 0 ? void 0 : _a.length)) { continue; } if (attributeValueIsString(attr)) { attributes.set(attr.name, attributeStrValueAsJsExpression(attr)); continue; } attributes.set(attr.name, this.resolveAttr(attr, scope)); } this.slots.set(slotName, attributes); } getSlotDef() { return this.slots; } resolveAttr(attr, scope) { const attrVal = attr.value[0]; if (!attrVal) { return null; } if (attrVal.type == 'AttributeShorthand') { const { name } = attrVal.expression; const init = scope.getInit(name); const resolved = this.resolved.get(init); return resolved !== null && resolved !== void 0 ? resolved : name; } if (attrVal.type == 'MustacheTag') { return this.resolveExpression(attrVal.expression, scope); } throw Error('Unknown attribute value type:' + attrVal.type); } } function getSingleSlotDef(componentNode, slotName) { const componentType = getTypeForComponent(componentNode); return `__sveltets_1_instanceOf(${componentType}).$$slot_def['${slotName}']`; } const reservedNames = new Set(['$$props', '$$restProps', '$$slots']); class Stores { constructor(scope, isDeclaration) { this.scope = scope; this.isDeclaration = isDeclaration; this.possibleStores = []; } handleDirective(node, str) { if (this.notAStore(node.name) || this.isDeclaration.value) { return; } const start = str.original.indexOf('$', node.start); const end = start + node.name.length; this.possibleStores.push({ node: { type: 'Identifier', start, end, name: node.name }, parent: { start: 0, end: 0, type: '' }, scope: this.scope.current }); } handleIdentifier(node, parent, prop) { if (this.notAStore(node.name)) { return; } if (this.isDeclaration.value) { if (isObjectKey(parent, prop)) { return; } this.scope.current.declared.add(node.name); } else { if (isMember$1(parent, prop) && !parent.computed) { return; } if (isObjectKey(parent, prop)) { return; } this.possibleStores.push({ node, parent, scope: this.scope.current }); } } getStoreNames() { const stores = this.possibleStores.filter(({ node, scope }) => { const name = node.name; return !scope.hasDefined(name); }); return stores.map(({ node }) => node.name.slice(1)); } notAStore(name) { return name[0] !== '$' || reservedNames.has(name); } } class TemplateScope { constructor(parent) { this.owners = new Map(); this.inits = new Map(); this.parent = parent; this.names = new Set(parent ? parent.names : []); } addMany(inits, owner) { inits.forEach((item) => this.add(item, owner)); return this; } add(init, owner) { const { name } = init; this.names.add(name); this.inits.set(name, init); this.owners.set(name, owner); return this; } child() { const child = new TemplateScope(this); return child; } getOwner(name) { var _a; return this.owners.get(name) || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.getOwner(name)); } getInit(name) { var _a; return this.inits.get(name) || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.getInit(name)); } isLet(name) { const owner = this.getOwner(name); return owner && (owner.type === 'Element' || owner.type === 'InlineComponent'); } } class ImplicitTopLevelNames { constructor(str, astOffset) { this.str = str; this.astOffset = astOffset; this.map = new Set(); } add(node) { this.map.add(node); } handleReactiveStatement(node, binaryExpression) { if (binaryExpression) { this.wrapExpressionWithInvalidate(binaryExpression.right); } else { const start = node.getStart() + this.astOffset; const end = node.getEnd() + this.astOffset; this.str.prependLeft(start, ';() => {'); preprendStr(this.str, end, '}'); } } wrapExpressionWithInvalidate(expression) { if (!expression) { return; } const start = expression.getStart() + this.astOffset; const end = expression.getEnd() + this.astOffset; if (ts__default__default['default'].isObjectLiteralExpression(expression) || (expression.getText().startsWith('{') && this.isNodeStartsWithObjectLiteral(expression)) || ts__default__default['default'].isAsExpression(expression)) { this.str.appendLeft(start, '('); this.str.appendRight(end, ')'); } this.str.prependLeft(start, '__sveltets_1_invalidate(() => '); preprendStr(this.str, end, ')'); } isNodeStartsWithObjectLiteral(node) { if (ts__default__default['default'].isObjectLiteralExpression(node)) { return true; } if (ts__default__default['default'].isElementAccessExpression(node)) { return this.isNodeStartsWithObjectLiteral(node.expression); } if (ts__default__default['default'].isBinaryExpression(node)) { return this.isNodeStartsWithObjectLiteral(node.left); } if (ts__default__default['default'].isConditionalExpression(node)) { return this.isNodeStartsWithObjectLiteral(node.condition); } return node .getChildren() .filter((e) => e.pos === node.pos) .some((child) => this.isNodeStartsWithObjectLiteral(child)); } modifyCode(rootVariables) { for (const node of this.map.values()) { const names = getNamesFromLabeledStatement(node); if (names.length === 0) { continue; } const implicitTopLevelNames = names.filter((name) => !rootVariables.has(name)); const pos = node.label.getStart(); if (this.hasOnlyImplicitTopLevelNames(names, implicitTopLevelNames)) { this.str.remove(pos + this.astOffset, pos + this.astOffset + 2); this.str.prependRight(pos + this.astOffset, 'let '); this.removeBracesFromParenthizedExpression(node); } else { implicitTopLevelNames.forEach((name) => { this.str.prependRight(pos + this.astOffset, `let ${name};\n`); }); } } } hasOnlyImplicitTopLevelNames(names, implicitTopLevelNames) { return names.length === implicitTopLevelNames.length; } removeBracesFromParenthizedExpression(node) { if (ts__default__default['default'].isExpressionStatement(node.statement) && isParenthesizedObjectOrArrayLiteralExpression(node.statement.expression)) { const parenthesizedExpression = node.statement.expression; const parenthesisStart = parenthesizedExpression.getStart() + this.astOffset; const expressionStart = parenthesizedExpression.expression.getStart() + this.astOffset; this.str.overwrite(parenthesisStart, expressionStart, '', { contentOnly: true }); const parenthesisEnd = parenthesizedExpression.getEnd() + this.astOffset; const expressionEnd = parenthesizedExpression.expression.getEnd() + this.astOffset; overwriteStr(this.str, expressionEnd, parenthesisEnd, ')', true); } } } class Scope { constructor(parent) { this.declared = new Set(); this.parent = parent; } hasDefined(name) { return this.declared.has(name) || (!!this.parent && this.parent.hasDefined(name)); } } class ScopeStack { constructor() { this.current = new Scope(); } push() { this.current = new Scope(this.current); } pop() { this.current = this.current.parent; } } function handleTypeAssertion(str, assertion, astOffset) { const { expression, type } = assertion; const assertionStart = assertion.getStart() + astOffset; const typeStart = type.getStart() + astOffset; const typeEnd = type.getEnd() + astOffset; const expressionStart = expression.getStart() + astOffset; const expressionEnd = expression.getEnd() + astOffset; str.appendLeft(expressionEnd, ' as '); str.move(assertionStart, typeEnd, expressionEnd); str.remove(assertionStart, typeStart); str.remove(typeEnd, expressionStart); } function throwError(start, end, message, code) { const error = new Error(message); error.start = positionAt(start, code); error.end = positionAt(end, code); throw error; } function positionAt(offset, text) { offset = clamp(offset, 0, text.length); const lineOffsets = getLineOffsets(text); let low = 0; let high = lineOffsets.length; if (high === 0) { return { line: 1, column: offset }; } while (low < high) { const mid = Math.floor((low + high) / 2); if (lineOffsets[mid] > offset) { high = mid; } else { low = mid + 1; } } return { line: low, column: offset - lineOffsets[low - 1] }; } function clamp(num, min, max) { return Math.max(min, Math.min(max, num)); } function getLineOffsets(text) { const lineOffsets = []; let isLineStart = true; for (let i = 0; i < text.length; i++) { if (isLineStart) { lineOffsets.push(i); isLineStart = false; } const ch = text.charAt(i); isLineStart = ch === '\r' || ch === '\n'; if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') { i++; } } if (isLineStart && text.length > 0) { lineOffsets.push(text.length); } return lineOffsets; } class Generics { constructor(str, astOffset) { this.str = str; this.astOffset = astOffset; this.definitions = []; this.references = []; } addIfIsGeneric(node) { var _a, _b; if (ts__default__default['default'].isTypeAliasDeclaration(node) && this.is$$GenericType(node.type)) { if (((_a = node.type.typeArguments) === null || _a === void 0 ? void 0 : _a.length) > 1) { throw new Error('Invalid $$Generic declaration: Only one type argument allowed'); } if (((_b = node.type.typeArguments) === null || _b === void 0 ? void 0 : _b.length) === 1) { this.definitions.push(`${node.name.text} extends ${node.type.typeArguments[0].getText()}`); } else { this.definitions.push(`${node.name.text}`); } this.references.push(node.name.text); this.str.remove(this.astOffset + node.getStart(), this.astOffset + node.getEnd()); } } throwIfIsGeneric(node) { if (ts__default__default['default'].isTypeAliasDeclaration(node) && this.is$$GenericType(node.type)) { throwError(this.astOffset + node.getStart(), this.astOffset + node.getEnd(), '$$Generic declarations are only allowed in the instance script', this.str.original); } } is$$GenericType(node) { return (ts__default__default['default'].isTypeReferenceNode(node) && ts__default__default['default'].isIdentifier(node.typeName) && node.typeName.text === '$$Generic'); } toDefinitionString(addIgnore = false) { const surround = addIgnore ? surroundWithIgnoreComments : (str) => str; return this.definitions.length ? surround(`<${this.definitions.join(',')}>`) : ''; } toReferencesString() { return this.references.length ? `<${this.references.join(',')}>` : ''; } has() { return this.definitions.length > 0; } } function handleImportDeclaration(node, str, astOffset, scriptStart, sourceFile) { var _a; const scanner = ts__default__default['default'].createScanner(sourceFile.languageVersion, false, sourceFile.languageVariant); const comments = (_a = ts__default__default['default'].getLeadingCommentRanges(node.getFullText(), 0)) !== null && _a !== void 0 ? _a : []; if (!comments.some((comment) => comment.hasTrailingNewLine) && isNewGroup(sourceFile, node, scanner)) { str.appendRight(node.getStart() + astOffset, '\n'); } for (const comment of comments) { const commentEnd = node.pos + comment.end + astOffset; str.move(node.pos + comment.pos + astOffset, commentEnd, scriptStart + 1); if (comment.hasTrailingNewLine) { str.overwrite(commentEnd - 1, commentEnd, str.original[commentEnd - 1] + '\n'); } } str.move(node.getStart() + astOffset, node.end + astOffset, scriptStart + 1); const originalEndChar = str.original[node.end + astOffset - 1]; str.overwrite(node.end + astOffset - 1, node.end + astOffset, originalEndChar + '\n'); } function isNewGroup(sourceFile, topLevelImportDecl, scanner) { const startPos = topLevelImportDecl.getFullStart(); const endPos = topLevelImportDecl.getStart(); scanner.setText(sourceFile.text, startPos, endPos - startPos); let numberOfNewLines = 0; while (scanner.getTokenPos() < endPos) { const tokenKind = scanner.scan(); if (tokenKind === ts__default__default['default'].SyntaxKind.NewLineTrivia) { numberOfNewLines++; if (numberOfNewLines >= 2) { return true; } } } return false; } function processInstanceScriptContent(str, script, events, implicitStoreValues, mode, hasModuleScript) { const htmlx = str.original; const scriptContent = htmlx.substring(script.content.start, script.content.end); const tsAst = ts__default__namespace.createSourceFile('component.ts.svelte', scriptContent, ts__default__namespace.ScriptTarget.Latest, true, ts__default__namespace.ScriptKind.TS); const astOffset = script.content.start; const exportedNames = new ExportedNames(str, astOffset); const generics = new Generics(str, astOffset); const implicitTopLevelNames = new ImplicitTopLevelNames(str, astOffset); let uses$$props = false; let uses$$restProps = false; let uses$$slots = false; let uses$$SlotsInterface = false; let isDeclaration = false; const pendingStoreResolutions = []; let scope = new Scope(); const rootScope = scope; const pushScope = () => (scope = new Scope(scope)); const popScope = () => (scope = scope.parent); const resolveStore = (pending) => { let { node, scope } = pending; const name = node.text; while (scope) { if (scope.declared.has(name)) { return; } scope = scope.parent; } const storename = node.getText().slice(1); implicitStoreValues.addStoreAcess(storename); }; const handleIdentifier = (ident, parent) => { if (ident.text === '$$props') { uses$$props = true; return; } if (ident.text === '$$restProps') { uses$$restProps = true; return; } if (ident.text === '$$slots') { uses$$slots = true; return; } if (ts__default__namespace.isLabeledStatement(parent) && parent.label == ident) { return; } if (isDeclaration || ts__default__namespace.isParameter(parent)) { if (isNotPropertyNameOfImport(ident) && (!ts__default__namespace.isBindingElement(ident.parent) || ident.parent.name == ident)) { if (ident.text.startsWith('$') || scope == rootScope) { scope.declared.add(ident.text); } } } else { if (ident.text.startsWith('$')) { if ((!ts__default__namespace.isPropertyAccessExpression(parent) || parent.expression == ident) && (!ts__default__namespace.isPropertyAssignment(parent) || parent.initializer == ident) && !ts__default__namespace.isPropertySignature(parent) && !ts__default__namespace.isPropertyDeclaration(parent) && !ts__default__namespace.isTypeReferenceNode(parent) && !ts__default__namespace.isTypeAliasDeclaration(parent) && !ts__default__namespace.isInterfaceDeclaration(parent)) { pendingStoreResolutions.push({ node: ident, parent, scope }); } } } }; const walk = (node, parent) => { var _a; const onLeaveCallbacks = []; generics.addIfIsGeneric(node); if (is$$EventsDeclaration(node)) { events.setComponentEventsInterface(node, astOffset); } if (is$$SlotsDeclaration(node)) { uses$$SlotsInterface = true; } if (is$$PropsDeclaration(node)) { exportedNames.uses$$Props = true; } if (ts__default__namespace.isVariableStatement(node)) { exportedNames.handleVariableStatement(node, parent); } if (ts__default__namespace.isFunctionDeclaration(node)) { exportedNames.handleExportFunctionOrClass(node); pushScope(); onLeaveCallbacks.push(() => popScope()); } if (ts__default__namespace.isClassDeclaration(node)) { exportedNames.handleExportFunctionOrClass(node); } if (ts__default__namespace.isBlock(node) || ts__default__namespace.isArrowFunction(node) || ts__default__namespace.isFunctionExpression(node)) { pushScope(); onLeaveCallbacks.push(() => popScope()); } if (ts__default__namespace.isExportDeclaration(node)) { exportedNames.handleExportDeclaration(node); } if (ts__default__namespace.isImportDeclaration(node)) { handleImportDeclaration(node, str, astOffset, script.start, tsAst); events.checkIfImportIsEventDispatcher(node); } if (ts__default__namespace.isImportEqualsDeclaration(node)) { const end = node.getEnd() + astOffset; if (str.original[end - 1] !== ';') { preprendStr(str, end, ';'); } } if (ts__default__namespace.isVariableDeclaration(node)) { events.checkIfIsStringLiteralDeclaration(node); events.checkIfDeclarationInstantiatedEventDispatcher(node); implicitStoreValues.addVariableDeclaration(node); } if (ts__default__namespace.isCallExpression(node)) { events.checkIfCallExpressionIsDispatch(node); } if (ts__default__namespace.isVariableDeclaration(parent) && parent.name == node) { isDeclaration = true; onLeaveCallbacks.push(() => (isDeclaration = false)); } if (ts__default__namespace.isBindingElement(parent) && parent.name == node) { isDeclaration = true; onLeaveCallbacks.push(() => (isDeclaration = false)); } if (ts__default__namespace.isImportClause(node)) { isDeclaration = true; onLeaveCallbacks.push(() => (isDeclaration = false)); implicitStoreValues.addImportStatement(node); } if (ts__default__namespace.isImportSpecifier(node)) { implicitStoreValues.addImportStatement(node); } if (ts__default__namespace.isIdentifier(node)) { handleIdentifier(node, parent); } if (ts__default__namespace.isLabeledStatement(node) && parent == tsAst && node.label.text == '$' && node.statement) { const binaryExpression = getBinaryAssignmentExpr(node); if (binaryExpression) { implicitTopLevelNames.add(node); implicitStoreValues.addReactiveDeclaration(node); } implicitTopLevelNames.handleReactiveStatement(node, binaryExpression); } if (mode !== 'ts' && ((_a = ts__default__namespace.isTypeAssertionExpression) === null || _a === void 0 ? void 0 : _a.call(ts__default__namespace, node))) { handleTypeAssertion(str, node, astOffset); } ts__default__namespace.forEachChild(node, (n) => walk(n, node)); onLeaveCallbacks.map((c) => c()); }; tsAst.forEachChild((n) => walk(n, tsAst)); pendingStoreResolutions.map(resolveStore); implicitTopLevelNames.modifyCode(rootScope.declared); implicitStoreValues.modifyCode(astOffset, str); const firstImport = tsAst.statements .filter(ts__default__namespace.isImportDeclaration) .sort((a, b) => a.end - b.end)[0]; if (firstImport) { str.appendRight(firstImport.getStart() + astOffset, '\n' + (hasModuleScript ? '\n' : '')); } if (mode === 'dts') { transformInterfacesToTypes(tsAst, str, astOffset); } return { exportedNames, events, uses$$props, uses$$restProps, uses$$slots, uses$$SlotsInterface, generics }; } function transformInterfacesToTypes(tsAst, str, astOffset) { tsAst.statements.filter(ts__default__namespace.isInterfaceDeclaration).forEach((node) => { var _a; str.overwrite(node.getStart() + astOffset, node.getStart() + astOffset + 'interface'.length, 'type'); if ((_a = node.heritageClauses) === null || _a === void 0 ? void 0 : _a.length) { const extendsStart = node.heritageClauses[0].getStart() + astOffset; str.overwrite(extendsStart, extendsStart + 'extends'.length, '='); const extendsList = node.heritageClauses[0].types; let prev = extendsList[0]; extendsList.slice(1).forEach((heritageClause) => { str.overwrite(prev.getEnd() + astOffset, heritageClause.getStart() + astOffset, ' & '); prev = heritageClause; }); str.appendLeft(node.heritageClauses[0].getEnd() + astOffset, ' & '); } else { str.prependLeft(str.original.indexOf('{', node.getStart() + astOffset), '='); } }); } function processModuleScriptTag(str, script, implicitStoreValues, useNewTransformation) { const htmlx = str.original; const scriptContent = htmlx.substring(script.content.start, script.content.end); const tsAst = ts__default__default['default'].createSourceFile('component.module.ts.svelte', scriptContent, ts__default__default['default'].ScriptTarget.Latest, true, ts__default__default['default'].ScriptKind.TS); const astOffset = script.content.start; const generics = new Generics(str, astOffset); const walk = (node) => { resolveImplicitStoreValue(node, implicitStoreValues, str, astOffset); generics.throwIfIsGeneric(node); throwIfIs$$EventsDeclaration(node, str, astOffset); throwIfIs$$SlotsDeclaration(node, str, astOffset); throwIfIs$$PropsDeclaration(node, str, astOffset); ts__default__default['default'].forEachChild(node, (n) => walk(n)); }; tsAst.forEachChild((n) => walk(n)); implicitStoreValues.modifyCode(astOffset, str); const scriptStartTagEnd = htmlx.indexOf('>', script.start) + 1; const scriptEndTagStart = htmlx.lastIndexOf('<', script.end - 1); str.overwrite(script.start, scriptStartTagEnd, useNewTransformation ? ';' : '</>;', { contentOnly: true }); str.overwrite(scriptEndTagStart, script.end, useNewTransformation ? ';' : ';<>', { contentOnly: true }); } function resolveImplicitStoreValue(node, implicitStoreValues, str, astOffset) { var _a; if (ts__default__default['default'].isVariableDeclaration(node)) { implicitStoreValues.addVariableDeclaration(node); } if (ts__default__default['default'].isImportClause(node)) { implicitStoreValues.addImportStatement(node); } if (ts__default__default['default'].isImportSpecifier(node)) { implicitStoreValues.addImportStatement(node); } if ((_a = ts__default__default['default'].isTypeAssertionExpression) === null || _a === void 0 ? void 0 : _a.call(ts__default__default['default'], node)) { handleTypeAssertion(str, node, astOffset); } } function throwIfIs$$EventsDeclaration(node, str, astOffset) { if (is$$EventsDeclaration(node)) { throw$$Error(node, str, astOffset, '$$Events'); } } function throwIfIs$$SlotsDeclaration(node, str, astOffset) { if (is$$SlotsDeclaration(node)) { throw$$Error(node, str, astOffset, '$$Slots'); } } function throwIfIs$$PropsDeclaration(node, str, astOffset) { if (is$$PropsDeclaration(node)) { throw$$Error(node, str, astOffset, '$$Props'); } } function throw$$Error(node, str, astOffset, type) { throwError(node.getStart() + astOffset, node.getEnd() + astOffset, `${type} can only be declared in the instance script`, str.original); } const COMPONENT_SUFFIX = '__SvelteComponent_'; function addComponentExport(params) { if (params.generics.has()) { addGenericsComponentExport(params); } else { addSimpleComponentExport(params); } } function addGenericsComponentExport({ strictEvents, canHaveAnyProp, exportedNames, componentDocumentation, fileName, mode, usesAccessors, str, generics }) { const genericsDef = generics.toDefinitionString(); const genericsRef = generics.toReferencesString(); const doc = componentDocumentation.getFormatted(); const className = fileName && classNameFromFilename(fileName, mode !== 'dts'); function returnType(forPart) { return `ReturnType<__sveltets_Render${genericsRef}['${forPart}']>`; } let statement = ` class __sveltets_Render${genericsDef} { props() { return ${props(true, canHaveAnyProp, exportedNames, `render${genericsRef}()`)}.props; } events() { return ${events$1(strictEvents, `render${genericsRef}()`)}.events; } slots() { return render${genericsRef}().slots; } } `; if (mode === 'dts') { statement += `export type ${className}Props${genericsDef} = ${returnType('props')};\n` + `export type ${className}Events${genericsDef} = ${returnType('events')};\n` + `export type ${className}Slots${genericsDef} = ${returnType('slots')};\n` + `\n${doc}export default class${className ? ` ${className}` : ''}${genericsDef} extends SvelteComponentTyped<${className}Props${genericsRef}, ${className}Events${genericsRef}, ${className}Slots${genericsRef}> {` + exportedNames.createClassGetters() + (usesAccessors ? exportedNames.createClassAccessors() : '') + '\n}'; } else { statement += `\n\n${doc}export default class${className ? ` ${className}` : ''}${genericsDef} extends Svelte2TsxComponent<${returnType('props')}, ${returnType('events')}, ${returnType('slots')}> {` + exportedNames.createClassGetters() + (usesAccessors ? exportedNames.createClassAccessors() : '') + '\n}'; } str.append(statement); } function addSimpleComponentExport({ strictEvents, isTsFile, canHaveAnyProp, exportedNames, componentDocumentation, fileName, mode, usesAccessors, str }) { const propDef = props(isTsFile, canHaveAnyProp, exportedNames, events$1(strictEvents, 'render()')); const doc = componentDocumentation.getFormatted(); const className = fileName && classNameFromFilename(fileName, mode !== 'dts'); let statement; if (mode === 'dts' && isTsFile) { statement = `\nconst __propDef = ${propDef};\n` + `export type ${className}Props = typeof __propDef.props;\n` + `export type ${className}Events = typeof __propDef.events;\n` + `export type ${className}Slots = typeof __propDef.slots;\n` + `\n${doc}export default class${className ? ` ${className}` : ''} extends SvelteComponentTyped<${className}Props, ${className}Events, ${className}Slots> {` + exportedNames.createClassGetters() + (usesAccessors ? exportedNames.createClassAccessors() : '') + '\n}'; } else if (mode === 'dts' && !isTsFile) { statement = `\nconst __propDef = ${propDef};\n` + `/** @typedef {typeof __propDef.props} ${className}Props */\n` + `/** @typedef {typeof __propDef.events} ${className}Events */\n` + `/** @typedef {typeof __propDef.slots} ${className}Slots */\n` + `\n${doc}export default class${className ? ` ${className}` : ''} extends __sveltets_1_createSvelteComponentTyped(${propDef}) {` + exportedNames.createClassGetters() + (usesAccessors ? exportedNames.createClassAccessors() : '') + '\n}'; } else { statement = `\n\n${doc}export default class${className ? ` ${className}` : ''} extends __sveltets_1_createSvelte2TsxComponent(${propDef}) {` + exportedNames.createClassGetters() + (usesAccessors ? exportedNames.createClassAccessors() : '') + '\n}'; } str.append(statement); } function events$1(strictEvents, renderStr) { return strictEvents ? renderStr : `__sveltets_1_with_any_event(${renderStr})`; } function props(isTsFile, canHaveAnyProp, exportedNames, renderStr) { if (isTsFile) { return canHaveAnyProp ? `__sveltets_1_with_any(${renderStr})` : renderStr; } else { const optionalProps = exportedNames.createOptionalPropsArray(); const partial = `__sveltets_1_partial${canHaveAnyProp ? '_with_any' : ''}`; return optionalProps.length > 0 ? `${partial}([${optionalProps.join(',')}], ${renderStr})` : `${partial}(${renderStr})`; } } function classNameFromFilename(filename, appendSuffix) { var _a; try { const withoutExtensions = (_a = path__default['default'].parse(filename).name) === null || _a === void 0 ? void 0 : _a.split('.')[0]; const withoutInvalidCharacters = withoutExtensions .split('') .filter((char) => /[A-Za-z$_\d-]/.test(char)) .join(''); const firstValidCharIdx = withoutInvalidCharacters .split('') .findIndex((char) => /[A-Za-z]/.test(char)); const withoutLeadingInvalidCharacters = withoutInvalidCharacters.substr(firstValidCharIdx); const inPascalCase = pascalCase(withoutLeadingInvalidCharacters); const finalName = firstValidCharIdx === -1 ? `A${inPascalCase}` : inPascalCase; return `${finalName}${appendSuffix ? COMPONENT_SUFFIX : ''}`; } catch (error) { console.warn(`Failed to create a name for the component class from filename ${filename}`); return undefined; } } function createRenderFunction({ str, scriptTag, scriptDestination, slots, events, exportedNames, isTsFile, uses$$props, uses$$restProps, uses$$slots, uses$$SlotsInterface, generics, mode }) { const useNewTransformation = mode === 'ts'; const htmlx = str.original; let propsDecl = ''; if (uses$$props) { propsDecl += ' let $$props = __sveltets_1_allPropsType();'; } if (uses$$restProps) { propsDecl += ' let $$restProps = __sveltets_1_restPropsType();'; } if (uses$$slots) { propsDecl += ' let $$slots = __sveltets_1_slotsType({' + Array.from(slots.keys()) .map((name) => `'${name}': ''`) .join(', ') + '});'; } const slotsDeclaration = slots.size > 0 && mode !== 'dts' ? '\n' + surroundWithIgnoreComments(useNewTransformation ? ';const __sveltets_createSlot = __sveltets_2_createCreateSlot' + (uses$$SlotsInterface ? '<$$Slots>' : '') + '();' : ';const __sveltets_ensureSlot = __sveltets_1_createEnsureSlot' + (uses$$SlotsInterface ? '<$$Slots>' : '') + '();') : ''; if (scriptTag) { const scriptTagEnd = htmlx.lastIndexOf('>', scriptTag.content.start) + 1; str.overwrite(scriptTag.start, scriptTag.start + 1, useNewTransformation ? ';' : '</>;'); str.overwrite(scriptTag.start + 1, scriptTagEnd, `function render${generics.toDefinitionString(true)}() {${propsDecl}\n`); const scriptEndTagStart = htmlx.lastIndexOf('<', scriptTag.end - 1); str.overwrite(scriptEndTagStart, scriptTag.end, useNewTransformation ? `${slotsDeclaration};\nasync () => {` : `${slotsDeclaration};\n() => (<>`, { contentOnly: true }); } else { str.prependRight(scriptDestination, `${useNewTransformation ? '' : '</>'};function render${generics.toDefinitionString(true)}() {` + `${propsDecl}${slotsDeclaration}\n${useNewTransformation ? 'async () => {' : '<>'}`); } const slotsAsDef = uses$$SlotsInterface ? '{} as unknown as $$Slots' : '{' + Array.from(slots.entries()) .map(([name, attrs]) => { const attrsAsString = Array.from(attrs.entries()) .map(([exportName, expr]) => exportName.startsWith('__spread__') ? `...${expr}` : `${exportName}:${expr}`) .join(', '); return `'${name}': {${attrsAsString}}`; }) .join(', ') + '}'; const returnString = `\nreturn { props: ${exportedNames.createPropsStr(isTsFile)}` + `, slots: ${slotsAsDef}` + `, getters: ${exportedNames.createRenderFunctionGetterStr()}` + `, events: ${events.toDefString()} }}`; if (useNewTransformation) { str.append('};'); } else if (scriptTag) { str.append(');'); } str.append(returnString); } function processSvelteTemplate(str, options) { const { htmlxAst, tags } = parseHtmlx(str.original, { ...options, useNewTransformation: (options === null || options === void 0 ? void 0 : options.mode) === 'ts' }); let uses$$props = false; let uses$$restProps = false; let uses$$slots = false; let usesAccessors = !!options.accessors; const componentDocumentation = new ComponentDocumentation(); const isDeclaration = { value: false }; const scopeStack = new ScopeStack(); const stores = new Stores(scopeStack, isDeclaration); const scripts = new Scripts(htmlxAst); const handleSvelteOptions = (node) => { for (let i = 0; i < node.attributes.length; i++) { const optionName = node.attributes[i].name; const optionValue = node.attributes[i].value; switch (optionName) { case 'accessors': if (Array.isArray(optionValue)) { if (optionValue[0].type === 'MustacheTag') { usesAccessors = optionValue[0].expression.value; } } else { usesAccessors = true; } break; } } }; const handleIdentifier = (node) => { if (node.name === '$$props') { uses$$props = true; return; } if (node.name === '$$restProps') { uses$$restProps = true; return; } if (node.name === '$$slots') { uses$$slots = true; return; } }; const handleStyleTag = (node) => { str.remove(node.start, node.end); }; const slotHandler = new SlotHandler(str.original); let templateScope = new TemplateScope(); const handleEach = (node) => { templateScope = templateScope.child(); if (node.context) { handleScopeAndResolveForSlotInner(node.context, node.expression, node); } }; const handleAwait = (node) => { templateScope = templateScope.child(); if (node.value) { handleScopeAndResolveForSlotInner(node.value, node.expression, node.then); } if (node.error) { handleScopeAndResolveForSlotInner(node.error, node.expression, node.catch); } }; const handleComponentLet = (component) => { templateScope = templateScope.child(); const lets = slotHandler.getSlotConsumerOfComponent(component); for (const { letNode, slotName } of lets) { handleScopeAndResolveLetVarForSlot({ letNode, slotName, slotHandler, templateScope, component }); } }; const handleScopeAndResolveForSlotInner = (identifierDef, initExpression, owner) => { handleScopeAndResolveForSlot({ identifierDef, initExpression, slotHandler, templateScope, owner }); }; const eventHandler = new EventHandler(); const onHtmlxWalk = (node, parent, prop) => { if (prop == 'params' && (parent.type == 'FunctionDeclaration' || parent.type == 'ArrowFunctionExpression')) { isDeclaration.value = true; } if (prop == 'id' && parent.type == 'VariableDeclarator') { isDeclaration.value = true; } switch (node.type) { case 'Comment': componentDocumentation.handleComment(node); break; case 'Options': handleSvelteOptions(node); break; case 'Identifier': handleIdentifier(node); stores.handleIdentifier(node, parent, prop); eventHandler.handleIdentifier(node, parent, prop); break; case 'Transition': case 'Action': case 'Animation': stores.handleDirective(node, str); break; case 'Slot': slotHandler.handleSlot(node, templateScope); break; case 'Style': handleStyleTag(node); break; case 'Element': scripts.checkIfElementIsScriptTag(node, parent); break; case 'RawMustacheTag': scripts.checkIfContainsScriptTag(node); break; case 'BlockStatement': scopeStack.push(); break; case 'FunctionDeclaration': scopeStack.push(); break; case 'ArrowFunctionExpression': scopeStack.push(); break; case 'EventHandler': eventHandler.handleEventHandler(node, parent); break; case 'VariableDeclarator': isDeclaration.value = true; break; case 'EachBlock': handleEach(node); break; case 'AwaitBlock': handleAwait(node); break; case 'InlineComponent': handleComponentLet(node); break; } }; const onHtmlxLeave = (node, parent, prop, _index) => { if (prop == 'params' && (parent.type == 'FunctionDeclaration' || parent.type == 'ArrowFunctionExpression')) { isDeclaration.value = false; } if (prop == 'id' && parent.type == 'VariableDeclarator') { isDeclaration.value = false; } const onTemplateScopeLeave = () => { templateScope = templateScope.parent; }; switch (node.type) { case 'BlockStatement': scopeStack.pop(); break; case 'FunctionDeclaration': scopeStack.pop(); break; case 'ArrowFunctionExpression': scopeStack.pop(); break; case 'EachBlock': onTemplateScopeLeave(); break; case 'AwaitBlock': onTemplateScopeLeave(); break; case 'InlineComponent': onTemplateScopeLeave(); break; } }; if (options.mode === 'ts') { convertHtmlxToJsx(str, htmlxAst, onHtmlxWalk, onHtmlxLeave, { preserveAttributeCase: (options === null || options === void 0 ? void 0 : options.namespace) == 'foreign', typingsNamespace: options.typingsNamespace }); } else { convertHtmlxToJsx$1(str, htmlxAst, onHtmlxWalk, onHtmlxLeave, { preserveAttributeCase: (options === null || options === void 0 ? void 0 : options.namespace) == 'foreign' }); } const { scriptTag, moduleScriptTag } = scripts.getTopLevelScriptTags(); scripts.blankOtherScriptTags(str); const resolvedStores = stores.getStoreNames(); return { htmlAst: htmlxAst, moduleScriptTag, scriptTag, slots: slotHandler.getSlotDef(), events: new ComponentEvents(eventHandler, tags.some((tag) => { var _a; return (_a = tag.attributes) === null || _a === void 0 ? void 0 : _a.some((a) => a.name === 'strictEvents'); }), str), uses$$props, uses$$restProps, uses$$slots, componentDocumentation, resolvedStores, usesAccessors }; } function svelte2tsx(svelte, options = {}) { options.mode = options.mode || 'ts'; const str = new MagicString(svelte); let { htmlAst, moduleScriptTag, scriptTag, slots, uses$$props, uses$$slots, uses$$restProps, events, componentDocumentation, resolvedStores, usesAccessors } = processSvelteTemplate(str, options); let instanceScriptTarget = 0; if (moduleScriptTag) { if (moduleScriptTag.start != 0) { str.move(moduleScriptTag.start, moduleScriptTag.end, 0); } else { instanceScriptTarget = moduleScriptTag.end; } } const renderFunctionStart = scriptTag ? str.original.lastIndexOf('>', scriptTag.content.start) + 1 : instanceScriptTarget; const implicitStoreValues = new ImplicitStoreValues(resolvedStores, renderFunctionStart); let exportedNames = new ExportedNames(str, 0); let generics = new Generics(str, 0); let uses$$SlotsInterface = false; if (scriptTag) { if (scriptTag.start != instanceScriptTarget) { str.move(scriptTag.start, scriptTag.end, instanceScriptTarget); } const res = processInstanceScriptContent(str, scriptTag, events, implicitStoreValues, options.mode, !!moduleScriptTag); uses$$props = uses$$props || res.uses$$props; uses$$restProps = uses$$restProps || res.uses$$restProps; uses$$slots = uses$$slots || res.uses$$slots; ({ exportedNames, events, generics, uses$$SlotsInterface } = res); } createRenderFunction({ str, scriptTag, scriptDestination: instanceScriptTarget, slots, events, exportedNames, isTsFile: options === null || options === void 0 ? void 0 : options.isTsFile, uses$$props, uses$$restProps, uses$$slots, uses$$SlotsInterface, generics, mode: options.mode }); if (moduleScriptTag) { processModuleScriptTag(str, moduleScriptTag, new ImplicitStoreValues(implicitStoreValues.getAccessedStores(), renderFunctionStart, scriptTag || options.mode === 'ts' ? undefined : (input) => `</>;${input}<>`), options.mode === 'ts'); } addComponentExport({ str, canHaveAnyProp: !exportedNames.uses$$Props && (uses$$props || uses$$restProps), strictEvents: events.hasStrictEvents(), isTsFile: options === null || options === void 0 ? void 0 : options.isTsFile, exportedNames, usesAccessors, fileName: options === null || options === void 0 ? void 0 : options.filename, componentDocumentation, mode: options.mode, generics }); if (options.mode === 'dts') { str.prepend('import { SvelteComponentTyped } from "svelte"\n' + ((options === null || options === void 0 ? void 0 : options.isTsFile) ? '' : ` declare function __sveltets_1_createSvelteComponentTyped<Props, Events, Slots>( render: {props: Props, events: Events, slots: Slots } ): SvelteComponentConstructor<SvelteComponentTyped<Props, Events, Slots>,Svelte2TsxComponentConstructorParameters<Props>>; `) + '\n'); let code = str.toString(); code = code .replace('<></>;', '') .replace('<></>;', '') .replace(/<>.*<\/>/s, '') .replace('\n() => ();', ''); return { code }; } else { str.prepend('///<reference types="svelte" />\n'); return { code: str.toString(), map: str.generateMap({ hires: true, source: options === null || options === void 0 ? void 0 : options.filename }), exportedNames: exportedNames.getExportsMap(), events: events.createAPI(), htmlAst }; } } async function emitDts(config) { const svelteMap = await createSvelteMap(config); const { options, filenames } = loadTsconfig(config, svelteMap); const host = await createTsCompilerHost(options, svelteMap); const program = ts__default__default['default'].createProgram(filenames, options, host); program.emit(); } function loadTsconfig(config, svelteMap) { const libRoot = config.libRoot || process.cwd(); const jsconfigFile = ts__default__default['default'].findConfigFile(libRoot, ts__default__default['default'].sys.fileExists, 'jsconfig.json'); let tsconfigFile = ts__default__default['default'].findConfigFile(libRoot, ts__default__default['default'].sys.fileExists); if (!tsconfigFile && !jsconfigFile) { throw new Error('Failed to locate tsconfig or jsconfig'); } tsconfigFile = tsconfigFile || jsconfigFile; if (jsconfigFile && isSubpath(path__namespace.dirname(tsconfigFile), path__namespace.dirname(jsconfigFile))) { tsconfigFile = jsconfigFile; } tsconfigFile = path__namespace.isAbsolute(tsconfigFile) ? tsconfigFile : path__namespace.join(libRoot, tsconfigFile); const basepath = path__namespace.dirname(tsconfigFile); const { error, config: tsConfig } = ts__default__default['default'].readConfigFile(tsconfigFile, ts__default__default['default'].sys.readFile); if (error) { throw new Error('Malformed tsconfig\n' + JSON.stringify(error, null, 2)); } const libPathRelative = path__namespace.relative(basepath, libRoot).split(path__namespace.sep).join('/'); if (libPathRelative) { tsConfig.include = [`${libPathRelative}/**/*`]; tsConfig.files = []; } const { options, fileNames } = ts__default__default['default'].parseJsonConfigFileContent(tsConfig, ts__default__default['default'].sys, basepath, { sourceMap: false }, tsconfigFile, undefined, [{ extension: 'svelte', isMixedContent: true, scriptKind: ts__default__default['default'].ScriptKind.Deferred }]); const filenames = fileNames.map((name) => { if (!isSvelteFilepath(name)) { return name; } const isTsFile = svelteMap.add(name); return name + (isTsFile ? '.ts' : '.js'); }); filenames.push(config.svelteShimsPath); return { options: { ...options, noEmit: false, moduleResolution: ts__default__default['default'].ModuleResolutionKind.NodeJs, declaration: true, emitDeclarationOnly: true, declarationDir: config.declarationDir, allowNonTsExtensions: true }, filenames }; } async function createTsCompilerHost(options, svelteMap) { const host = ts__default__default['default'].createCompilerHost(options); const pathPrefix = path__namespace.relative(process.cwd(), path__namespace.dirname(options.configFilePath)); const svelteSys = { ...ts__default__default['default'].sys, fileExists(originalPath) { const path = ensureRealSvelteFilepath(originalPath); const exists = ts__default__default['default'].sys.fileExists(path); if (exists && isSvelteFilepath(path)) { const isTsFile = svelteMap.add(path); if ((isTsFile && !isTsFilepath(originalPath)) || (!isTsFile && isTsFilepath(originalPath))) { return false; } } return exists; }, readFile(path, encoding = 'utf-8') { if (isVirtualSvelteFilepath(path) || isSvelteFilepath(path)) { path = ensureRealSvelteFilepath(path); return svelteMap.get(path); } else { return ts__default__default['default'].sys.readFile(path, encoding); } }, readDirectory(path, extensions, exclude, include, depth) { const extensionsWithSvelte = (extensions || []).concat('.svelte'); return ts__default__default['default'].sys.readDirectory(path, extensionsWithSvelte, exclude, include, depth); }, writeFile(fileName, data, writeByteOrderMark) { return ts__default__default['default'].sys.writeFile(pathPrefix ? path__namespace.join(pathPrefix, fileName) : fileName, data, writeByteOrderMark); } }; host.fileExists = svelteSys.fileExists; host.readFile = svelteSys.readFile; host.readDirectory = svelteSys.readDirectory; host.writeFile = svelteSys.writeFile; host.resolveModuleNames = (moduleNames, containingFile, _reusedNames, _redirectedReference, compilerOptions) => { return moduleNames.map((moduleName) => { return resolveModuleName(moduleName, containingFile, compilerOptions); }); }; function resolveModuleName(name, containingFile, compilerOptions) { const tsResolvedModule = ts__default__default['default'].resolveModuleName(name, containingFile, compilerOptions, ts__default__default['default'].sys).resolvedModule; if (tsResolvedModule && !isVirtualSvelteFilepath(tsResolvedModule.resolvedFileName)) { return tsResolvedModule; } return ts__default__default['default'].resolveModuleName(name, containingFile, compilerOptions, svelteSys) .resolvedModule; } return host; } async function createSvelteMap(config) { const svelteFiles = new Map(); function add(path) { var _a, _b; const code = ts__default__default['default'].sys.readFile(path, 'utf-8'); const isTsFile = ['ts', 'typescript'].includes((_b = (_a = config.preprocess) === null || _a === void 0 ? void 0 : _a.defaultLanguages) === null || _b === void 0 ? void 0 : _b.script) || /<script\s+[^>]*?lang=('|")(ts|typescript)('|")/.test(code); const transformed = svelte2tsx(code, { filename: path, isTsFile, mode: 'dts' }).code; svelteFiles.set(path, transformed); return isTsFile; } return { add, get: (key) => svelteFiles.get(key) }; } function isSvelteFilepath(filePath) { return filePath.endsWith('.svelte'); } function isTsFilepath(filePath) { return filePath.endsWith('.ts'); } function isVirtualSvelteFilepath(filePath) { return filePath.endsWith('.svelte.ts') || filePath.endsWith('svelte.js'); } function toRealSvelteFilepath(filePath) { return filePath.slice(0, -3); } function ensureRealSvelteFilepath(filePath) { return isVirtualSvelteFilepath(filePath) ? toRealSvelteFilepath(filePath) : filePath; } function isSubpath(maybeParent, maybeChild) { const relative = path__namespace.relative(maybeParent, maybeChild); return relative && !relative.startsWith('..') && !path__namespace.isAbsolute(relative); } var svelte2tsx$1 = /*#__PURE__*/Object.freeze({ __proto__: null, emitDts: emitDts, svelte2tsx: svelte2tsx }); var DocumentMapper = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ConsumerDocumentMapper = void 0; class ConsumerDocumentMapper extends documents.SourceMapDocumentMapper { constructor(traceMap, sourceUri, nrPrependesLines) { super(traceMap, sourceUri); this.nrPrependesLines = nrPrependesLines; } getOriginalPosition(generatedPosition) { return super.getOriginalPosition(main$4.Position.create(generatedPosition.line - this.nrPrependesLines, generatedPosition.character)); } getGeneratedPosition(originalPosition) { const result = super.getGeneratedPosition(originalPosition); result.line += this.nrPrependesLines; return result; } isInGenerated() { return true; } } exports.ConsumerDocumentMapper = ConsumerDocumentMapper; }); getDefaultExportFromCjs(DocumentMapper); var utils$2 = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasTsExtensions = exports.changeSvelteComponentName = exports.getDiagnosticTag = exports.isInScript = exports.convertToTextSpan = exports.getTsCheckComment = exports.mapSeverity = exports.getCommitCharactersForScriptElement = exports.scriptElementKindToCompletionItemKind = exports.symbolKindFromString = exports.isSubPath = exports.findTsConfigPath = exports.rangeToTextSpan = exports.hasNonZeroRange = exports.convertToLocationRange = exports.convertRange = exports.ensureRealSvelteFilePath = exports.toVirtualSvelteFilePath = exports.toRealSvelteFilePath = exports.isVirtualSvelteFilePath = exports.isSvelteFilePath = exports.getScriptKindFromAttributes = exports.getExtensionFromScriptKind = exports.getScriptKindFromFileName = void 0; const typescript_1 = __importDefault(ts__default__default['default']); function getScriptKindFromFileName(fileName) { const ext = fileName.substr(fileName.lastIndexOf('.')); switch (ext.toLowerCase()) { case typescript_1.default.Extension.Js: return typescript_1.default.ScriptKind.JS; case typescript_1.default.Extension.Jsx: return typescript_1.default.ScriptKind.JSX; case typescript_1.default.Extension.Ts: return typescript_1.default.ScriptKind.TS; case typescript_1.default.Extension.Tsx: return typescript_1.default.ScriptKind.TSX; case typescript_1.default.Extension.Json: return typescript_1.default.ScriptKind.JSON; default: return typescript_1.default.ScriptKind.Unknown; } } exports.getScriptKindFromFileName = getScriptKindFromFileName; function getExtensionFromScriptKind(kind) { switch (kind) { case typescript_1.default.ScriptKind.JSX: return typescript_1.default.Extension.Jsx; case typescript_1.default.ScriptKind.TS: return typescript_1.default.Extension.Ts; case typescript_1.default.ScriptKind.TSX: return typescript_1.default.Extension.Tsx; case typescript_1.default.ScriptKind.JSON: return typescript_1.default.Extension.Json; case typescript_1.default.ScriptKind.JS: default: return typescript_1.default.Extension.Js; } } exports.getExtensionFromScriptKind = getExtensionFromScriptKind; function getScriptKindFromAttributes(attrs) { const type = attrs.lang || attrs.type; switch (type) { case 'ts': case 'typescript': case 'text/ts': case 'text/typescript': return typescript_1.default.ScriptKind.TSX; case 'javascript': case 'text/javascript': default: return typescript_1.default.ScriptKind.JSX; } } exports.getScriptKindFromAttributes = getScriptKindFromAttributes; function isSvelteFilePath(filePath) { return filePath.endsWith('.svelte'); } exports.isSvelteFilePath = isSvelteFilePath; function isVirtualSvelteFilePath(filePath) { return filePath.endsWith('.svelte.ts'); } exports.isVirtualSvelteFilePath = isVirtualSvelteFilePath; function toRealSvelteFilePath(filePath) { return filePath.slice(0, -'.ts'.length); } exports.toRealSvelteFilePath = toRealSvelteFilePath; function toVirtualSvelteFilePath(filePath) { return filePath.endsWith('.ts') ? filePath : filePath + '.ts'; } exports.toVirtualSvelteFilePath = toVirtualSvelteFilePath; function ensureRealSvelteFilePath(filePath) { return isVirtualSvelteFilePath(filePath) ? toRealSvelteFilePath(filePath) : filePath; } exports.ensureRealSvelteFilePath = ensureRealSvelteFilePath; function convertRange(document, range) { return main$4.Range.create(document.positionAt(range.start || 0), document.positionAt((range.start || 0) + (range.length || 0))); } exports.convertRange = convertRange; function convertToLocationRange(snapshot, textSpan) { const range = (0, documents.mapRangeToOriginal)(snapshot, convertRange(snapshot, textSpan)); if (range.start.line < 0) { range.start.line = 0; range.start.character = 1; } if (range.end.line < 0) { range.end = range.start; } return range; } exports.convertToLocationRange = convertToLocationRange; function hasNonZeroRange({ range }) { return (!!range && (range.start.line !== range.end.line || range.start.character !== range.end.character)); } exports.hasNonZeroRange = hasNonZeroRange; function rangeToTextSpan(range, document) { const start = document.offsetAt(range.start); const end = document.offsetAt(range.end); return { start, length: end - start }; } exports.rangeToTextSpan = rangeToTextSpan; function findTsConfigPath(fileName, rootUris, fileExists) { const searchDir = (0, path__default['default'].dirname)(fileName); const path = typescript_1.default.findConfigFile(searchDir, fileExists, 'tsconfig.json') || typescript_1.default.findConfigFile(searchDir, fileExists, 'jsconfig.json') || ''; return !!path && rootUris.some((rootUri) => isSubPath(rootUri, path)) ? path : ''; } exports.findTsConfigPath = findTsConfigPath; function isSubPath(uri, possibleSubPath) { return (0, utils$4.pathToUrl)(possibleSubPath).startsWith(uri); } exports.isSubPath = isSubPath; function symbolKindFromString(kind) { switch (kind) { case 'module': return main$4.SymbolKind.Module; case 'class': return main$4.SymbolKind.Class; case 'local class': return main$4.SymbolKind.Class; case 'interface': return main$4.SymbolKind.Interface; case 'enum': return main$4.SymbolKind.Enum; case 'enum member': return main$4.SymbolKind.Constant; case 'var': return main$4.SymbolKind.Variable; case 'local var': return main$4.SymbolKind.Variable; case 'function': return main$4.SymbolKind.Function; case 'local function': return main$4.SymbolKind.Function; case 'method': return main$4.SymbolKind.Method; case 'getter': return main$4.SymbolKind.Method; case 'setter': return main$4.SymbolKind.Method; case 'property': return main$4.SymbolKind.Property; case 'constructor': return main$4.SymbolKind.Constructor; case 'parameter': return main$4.SymbolKind.Variable; case 'type parameter': return main$4.SymbolKind.Variable; case 'alias': return main$4.SymbolKind.Variable; case 'let': return main$4.SymbolKind.Variable; case 'const': return main$4.SymbolKind.Constant; case 'JSX attribute': return main$4.SymbolKind.Property; default: return main$4.SymbolKind.Variable; } } exports.symbolKindFromString = symbolKindFromString; function scriptElementKindToCompletionItemKind(kind) { switch (kind) { case typescript_1.default.ScriptElementKind.primitiveType: case typescript_1.default.ScriptElementKind.keyword: return main$4.CompletionItemKind.Keyword; case typescript_1.default.ScriptElementKind.constElement: return main$4.CompletionItemKind.Constant; case typescript_1.default.ScriptElementKind.letElement: case typescript_1.default.ScriptElementKind.variableElement: case typescript_1.default.ScriptElementKind.localVariableElement: case typescript_1.default.ScriptElementKind.alias: return main$4.CompletionItemKind.Variable; case typescript_1.default.ScriptElementKind.memberVariableElement: case typescript_1.default.ScriptElementKind.memberGetAccessorElement: case typescript_1.default.ScriptElementKind.memberSetAccessorElement: return main$4.CompletionItemKind.Field; case typescript_1.default.ScriptElementKind.functionElement: return main$4.CompletionItemKind.Function; case typescript_1.default.ScriptElementKind.memberFunctionElement: case typescript_1.default.ScriptElementKind.constructSignatureElement: case typescript_1.default.ScriptElementKind.callSignatureElement: case typescript_1.default.ScriptElementKind.indexSignatureElement: return main$4.CompletionItemKind.Method; case typescript_1.default.ScriptElementKind.enumElement: return main$4.CompletionItemKind.Enum; case typescript_1.default.ScriptElementKind.moduleElement: case typescript_1.default.ScriptElementKind.externalModuleName: return main$4.CompletionItemKind.Module; case typescript_1.default.ScriptElementKind.classElement: case typescript_1.default.ScriptElementKind.typeElement: return main$4.CompletionItemKind.Class; case typescript_1.default.ScriptElementKind.interfaceElement: return main$4.CompletionItemKind.Interface; case typescript_1.default.ScriptElementKind.warning: case typescript_1.default.ScriptElementKind.scriptElement: return main$4.CompletionItemKind.File; case typescript_1.default.ScriptElementKind.directory: return main$4.CompletionItemKind.Folder; case typescript_1.default.ScriptElementKind.string: return main$4.CompletionItemKind.Constant; } return main$4.CompletionItemKind.Property; } exports.scriptElementKindToCompletionItemKind = scriptElementKindToCompletionItemKind; function getCommitCharactersForScriptElement(kind) { const commitCharacters = []; switch (kind) { case typescript_1.default.ScriptElementKind.memberGetAccessorElement: case typescript_1.default.ScriptElementKind.memberSetAccessorElement: case typescript_1.default.ScriptElementKind.constructSignatureElement: case typescript_1.default.ScriptElementKind.callSignatureElement: case typescript_1.default.ScriptElementKind.indexSignatureElement: case typescript_1.default.ScriptElementKind.enumElement: case typescript_1.default.ScriptElementKind.interfaceElement: commitCharacters.push('.'); break; case typescript_1.default.ScriptElementKind.moduleElement: case typescript_1.default.ScriptElementKind.alias: case typescript_1.default.ScriptElementKind.constElement: case typescript_1.default.ScriptElementKind.letElement: case typescript_1.default.ScriptElementKind.variableElement: case typescript_1.default.ScriptElementKind.localVariableElement: case typescript_1.default.ScriptElementKind.memberVariableElement: case typescript_1.default.ScriptElementKind.classElement: case typescript_1.default.ScriptElementKind.functionElement: case typescript_1.default.ScriptElementKind.memberFunctionElement: commitCharacters.push('.', ','); commitCharacters.push('('); break; } return commitCharacters.length === 0 ? undefined : commitCharacters; } exports.getCommitCharactersForScriptElement = getCommitCharactersForScriptElement; function mapSeverity(category) { switch (category) { case typescript_1.default.DiagnosticCategory.Error: return main$4.DiagnosticSeverity.Error; case typescript_1.default.DiagnosticCategory.Warning: return main$4.DiagnosticSeverity.Warning; case typescript_1.default.DiagnosticCategory.Suggestion: return main$4.DiagnosticSeverity.Hint; case typescript_1.default.DiagnosticCategory.Message: return main$4.DiagnosticSeverity.Information; } return main$4.DiagnosticSeverity.Error; } exports.mapSeverity = mapSeverity; const commentsRegex = /^(\s*\/\/.*\s*)*/; const tsCheckRegex = /\/\/[ \t\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]*(@ts-(no)?check)($|\s)/; function getTsCheckComment(str = '') { var _a; const comments = (_a = str.match(commentsRegex)) === null || _a === void 0 ? void 0 : _a[0]; if (comments) { const tsCheck = comments.match(tsCheckRegex); if (tsCheck) { return `// ${tsCheck[tsCheck.length - 3]}${typescript_1.default.sys.newLine}`; } } } exports.getTsCheckComment = getTsCheckComment; function convertToTextSpan(range, snapshot) { const start = snapshot.offsetAt(snapshot.getGeneratedPosition(range.start)); const end = snapshot.offsetAt(snapshot.getGeneratedPosition(range.end)); return { start, length: end - start }; } exports.convertToTextSpan = convertToTextSpan; function isInScript(position, snapshot) { return (0, documents.isInTag)(position, snapshot.scriptInfo) || (0, documents.isInTag)(position, snapshot.moduleScriptInfo); } exports.isInScript = isInScript; function getDiagnosticTag(diagnostic) { const tags = []; if (diagnostic.reportsUnnecessary) { tags.push(main$4.DiagnosticTag.Unnecessary); } if (diagnostic.reportsDeprecated) { tags.push(main$4.DiagnosticTag.Deprecated); } return tags; } exports.getDiagnosticTag = getDiagnosticTag; function changeSvelteComponentName(name) { return name.replace(/(\w+)__SvelteComponent_/, '$1'); } exports.changeSvelteComponentName = changeSvelteComponentName; function hasTsExtensions(fileName) { return (fileName.endsWith(typescript_1.default.Extension.Dts) || fileName.endsWith(typescript_1.default.Extension.Tsx) || fileName.endsWith(typescript_1.default.Extension.Ts)); } exports.hasTsExtensions = hasTsExtensions; }); getDefaultExportFromCjs(utils$2); var svelte2tsx_1 = /*@__PURE__*/getAugmentedNamespace(svelte2tsx$1); var DocumentSnapshot_1 = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.JSOrTSDocumentSnapshot = exports.SvelteDocumentSnapshot = exports.DocumentSnapshot = exports.INITIAL_VERSION = void 0; const typescript_1 = __importDefault(ts__default__default['default']); exports.INITIAL_VERSION = 0; (function (DocumentSnapshot) { function fromDocument(document, options) { const { tsxMap, htmlAst, text, exportedNames, parserError, nrPrependedLines, scriptKind } = preprocessSvelteFile(document, options); return new SvelteDocumentSnapshot(document, parserError, scriptKind, text, nrPrependedLines, exportedNames, tsxMap, htmlAst); } DocumentSnapshot.fromDocument = fromDocument; function fromFilePath(filePath, createDocument, options) { if ((0, utils$2.isSvelteFilePath)(filePath)) { return DocumentSnapshot.fromSvelteFilePath(filePath, createDocument, options); } else { return DocumentSnapshot.fromNonSvelteFilePath(filePath); } } DocumentSnapshot.fromFilePath = fromFilePath; function fromNonSvelteFilePath(filePath) { let originalText = ''; const normalizedPath = filePath.replace(/\\/g, '/'); if (!normalizedPath.endsWith('node_modules/svelte/types/runtime/ambient.d.ts')) { originalText = typescript_1.default.sys.readFile(filePath) || ''; } if (normalizedPath.endsWith('svelte2tsx/svelte-shims.d.ts') || normalizedPath.endsWith('svelte-check/dist/src/svelte-shims.d.ts')) { if (originalText.includes('// -- start svelte-ls-remove --')) { originalText = originalText.substring(0, originalText.indexOf('// -- start svelte-ls-remove --')) + originalText.substring(originalText.indexOf('// -- end svelte-ls-remove --')); } } return new JSOrTSDocumentSnapshot(exports.INITIAL_VERSION, filePath, originalText); } DocumentSnapshot.fromNonSvelteFilePath = fromNonSvelteFilePath; function fromSvelteFilePath(filePath, createDocument, options) { var _a; const originalText = (_a = typescript_1.default.sys.readFile(filePath)) !== null && _a !== void 0 ? _a : ''; return fromDocument(createDocument(filePath, originalText), options); } DocumentSnapshot.fromSvelteFilePath = fromSvelteFilePath; })(exports.DocumentSnapshot || (exports.DocumentSnapshot = {})); function preprocessSvelteFile(document, options) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r; let tsxMap; let parserError = null; let nrPrependedLines = 0; let text = document.getText(); let exportedNames = { has: () => false }; let htmlAst; const scriptKind = [ (0, utils$2.getScriptKindFromAttributes)((_b = (_a = document.scriptInfo) === null || _a === void 0 ? void 0 : _a.attributes) !== null && _b !== void 0 ? _b : {}), (0, utils$2.getScriptKindFromAttributes)((_d = (_c = document.moduleScriptInfo) === null || _c === void 0 ? void 0 : _c.attributes) !== null && _d !== void 0 ? _d : {}) ].includes(typescript_1.default.ScriptKind.TSX) ? options.useNewTransformation ? typescript_1.default.ScriptKind.TS : typescript_1.default.ScriptKind.TSX : options.useNewTransformation ? typescript_1.default.ScriptKind.JS : typescript_1.default.ScriptKind.JSX; try { const tsx = (0, svelte2tsx_1.svelte2tsx)(text, { filename: (_e = document.getFilePath()) !== null && _e !== void 0 ? _e : undefined, isTsFile: options.useNewTransformation ? scriptKind === typescript_1.default.ScriptKind.TS : scriptKind === typescript_1.default.ScriptKind.TSX, mode: options.useNewTransformation ? 'ts' : 'tsx', typingsNamespace: options.useNewTransformation ? options.typingsNamespace : undefined, emitOnTemplateError: options.transformOnTemplateError, namespace: (_g = (_f = document.config) === null || _f === void 0 ? void 0 : _f.compilerOptions) === null || _g === void 0 ? void 0 : _g.namespace, accessors: (_k = (_j = (_h = document.config) === null || _h === void 0 ? void 0 : _h.compilerOptions) === null || _j === void 0 ? void 0 : _j.accessors) !== null && _k !== void 0 ? _k : (_m = (_l = document.config) === null || _l === void 0 ? void 0 : _l.compilerOptions) === null || _m === void 0 ? void 0 : _m.customElement }); text = tsx.code; tsxMap = tsx.map; exportedNames = tsx.exportedNames; htmlAst = tsx.htmlAst; if (tsxMap) { tsxMap.sources = [document.uri]; const scriptInfo = document.scriptInfo || document.moduleScriptInfo; const tsCheck = (0, utils$2.getTsCheckComment)(scriptInfo === null || scriptInfo === void 0 ? void 0 : scriptInfo.content); if (tsCheck) { text = tsCheck + text; nrPrependedLines = 1; } } } catch (e) { const start = { line: ((_p = (_o = e.start) === null || _o === void 0 ? void 0 : _o.line) !== null && _p !== void 0 ? _p : 1) - 1, character: (_r = (_q = e.start) === null || _q === void 0 ? void 0 : _q.column) !== null && _r !== void 0 ? _r : 0 }; const end = e.end ? { line: e.end.line - 1, character: e.end.column } : start; parserError = { range: { start, end }, message: e.message, code: -1 }; const scriptInfo = document.scriptInfo || document.moduleScriptInfo; text = scriptInfo ? scriptInfo.content : ''; } return { tsxMap, text, exportedNames, htmlAst, parserError, nrPrependedLines, scriptKind }; } class SvelteDocumentSnapshot { constructor(parent, parserError, scriptKind, text, nrPrependedLines, exportedNames, tsxMap, htmlAst) { this.parent = parent; this.parserError = parserError; this.scriptKind = scriptKind; this.text = text; this.nrPrependedLines = nrPrependedLines; this.exportedNames = exportedNames; this.tsxMap = tsxMap; this.htmlAst = htmlAst; this.url = (0, utils$4.pathToUrl)(this.filePath); this.version = this.parent.version; } get filePath() { return this.parent.getFilePath() || ''; } get scriptInfo() { return this.parent.scriptInfo; } get moduleScriptInfo() { return this.parent.moduleScriptInfo; } getOriginalText(range) { return this.parent.getText(range); } getText(start, end) { return this.text.substring(start, end); } getLength() { return this.text.length; } getFullText() { return this.text; } getChangeRange() { return undefined; } positionAt(offset) { return (0, documents.positionAt)(offset, this.text, this.getLineOffsets()); } offsetAt(position) { return (0, documents.offsetAt)(position, this.text, this.getLineOffsets()); } getLineContainingOffset(offset) { const chunks = this.getText(0, offset).split('\n'); return chunks[chunks.length - 1]; } hasProp(name) { return this.exportedNames.has(name); } svelteNodeAt(postionOrOffset) { if (!this.htmlAst) { return null; } const offset = typeof postionOrOffset === 'number' ? postionOrOffset : this.parent.offsetAt(postionOrOffset); let foundNode = null; (0, compiler_1__default['default'].walk)(this.htmlAst, { enter(node) { if (node.start > offset || node.end < offset) { this.skip(); return; } const parent = foundNode; foundNode = { ...node }; if (parent) { foundNode.parent = parent; } } }); return foundNode; } getOriginalPosition(pos) { return this.getMapper().getOriginalPosition(pos); } getGeneratedPosition(pos) { return this.getMapper().getGeneratedPosition(pos); } isInGenerated(pos) { return !(0, documents.isInTag)(pos, this.parent.styleInfo); } getURL() { return this.url; } getLineOffsets() { if (!this.lineOffsets) { this.lineOffsets = (0, documents.getLineOffsets)(this.text); } return this.lineOffsets; } getMapper() { if (!this.mapper) { this.mapper = this.initMapper(); } return this.mapper; } initMapper() { const scriptInfo = this.parent.scriptInfo || this.parent.moduleScriptInfo; if (!this.tsxMap) { if (!scriptInfo) { return new documents.IdentityMapper(this.url); } return new documents.FragmentMapper(this.parent.getText(), scriptInfo, this.url); } return new DocumentMapper.ConsumerDocumentMapper(new trace_mapping_1__default['default'].TraceMap(this.tsxMap), this.url, this.nrPrependedLines); } } exports.SvelteDocumentSnapshot = SvelteDocumentSnapshot; class JSOrTSDocumentSnapshot extends documents.IdentityMapper { constructor(version, filePath, text) { super((0, utils$4.pathToUrl)(filePath)); this.version = version; this.filePath = filePath; this.text = text; this.scriptKind = (0, utils$2.getScriptKindFromFileName)(this.filePath); this.scriptInfo = null; } getText(start, end) { return this.text.substring(start, end); } getLength() { return this.text.length; } getFullText() { return this.text; } getChangeRange() { return undefined; } positionAt(offset) { return (0, documents.positionAt)(offset, this.text, this.getLineOffsets()); } offsetAt(position) { return (0, documents.offsetAt)(position, this.text, this.getLineOffsets()); } update(changes) { for (const change of changes) { let start = 0; let end = 0; if ('range' in change) { start = this.offsetAt(change.range.start); end = this.offsetAt(change.range.end); } else { end = this.getLength(); } this.text = this.text.slice(0, start) + change.text + this.text.slice(end); } this.version++; this.lineOffsets = undefined; } getLineOffsets() { if (!this.lineOffsets) { this.lineOffsets = (0, documents.getLineOffsets)(this.text); } return this.lineOffsets; } } exports.JSOrTSDocumentSnapshot = JSOrTSDocumentSnapshot; }); getDefaultExportFromCjs(DocumentSnapshot_1); var ComponentInfoProvider = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.JsOrTsComponentInfoProvider = void 0; const typescript_1 = __importDefault(ts__default__default['default']); class JsOrTsComponentInfoProvider { constructor(typeChecker, classType) { this.typeChecker = typeChecker; this.classType = classType; } getEvents() { const eventType = this.getType('$$events_def'); if (!eventType) { return []; } return this.mapPropertiesOfType(eventType); } getSlotLets(slot = 'default') { const slotType = this.getType('$$slot_def'); if (!slotType) { return []; } const slotLets = slotType.getProperties().find((prop) => prop.name === slot); if (!(slotLets === null || slotLets === void 0 ? void 0 : slotLets.valueDeclaration)) { return []; } const slotLetsType = this.typeChecker.getTypeOfSymbolAtLocation(slotLets, slotLets.valueDeclaration); return this.mapPropertiesOfType(slotLetsType); } getProps(propName) { const props = this.getType('$$prop_def'); if (!props) { return []; } const prop = props.getProperties().find((prop) => prop.name === propName); if (!(prop === null || prop === void 0 ? void 0 : prop.valueDeclaration)) { return []; } const propDef = this.typeChecker.getTypeOfSymbolAtLocation(prop, prop.valueDeclaration); if (!propDef.isUnion()) { return []; } const types = (0, utils$4.flatten)(propDef.types.map((type) => this.getStringLiteralTypes(type))); return types.map((v) => ({ name: v.value, kindModifiers: typescript_1.default.ScriptElementKindModifier.none, kind: typescript_1.default.ScriptElementKind.string, sortText: '11' })); } getStringLiteralTypes(type, uniques = new Set()) { if (!type) { return []; } type = type.isTypeParameter() ? type.getConstraint() || type : type; if (type.isUnion()) { return (0, utils$4.flatten)(type.types.map((t) => this.getStringLiteralTypes(t, uniques))); } if (type.isStringLiteral() && !(type.flags & typescript_1.default.TypeFlags.EnumLiteral) && !uniques.has(type.value)) { return [type]; } return []; } getType(classProperty) { const symbol = this.classType.getProperty(classProperty); if (!(symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration)) { return null; } return this.typeChecker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration); } mapPropertiesOfType(type) { return type .getProperties() .map((prop) => { var _a, _b; const declaration = (_a = prop.valueDeclaration) !== null && _a !== void 0 ? _a : (_b = prop.declarations) === null || _b === void 0 ? void 0 : _b[0]; if (!declaration) { return; } return { name: prop.name, type: this.typeChecker.typeToString(this.typeChecker.getTypeOfSymbolAtLocation(prop, declaration)), doc: typescript_1.default.displayPartsToString(prop.getDocumentationComment(this.typeChecker)) }; }) .filter(utils$4.isNotNullOrUndefined); } static create(lang, def) { const program = lang.getProgram(); const sourceFile = program === null || program === void 0 ? void 0 : program.getSourceFile(def.fileName); if (!program || !sourceFile) { return null; } const defClass = (0, utils$1.findContainingNode)(sourceFile, def.textSpan, typescript_1.default.isClassDeclaration); if (!defClass) { return null; } const typeChecker = program.getTypeChecker(); const classType = typeChecker.getTypeAtLocation(defClass); if (!classType) { return null; } return new JsOrTsComponentInfoProvider(typeChecker, classType); } } exports.JsOrTsComponentInfoProvider = JsOrTsComponentInfoProvider; }); getDefaultExportFromCjs(ComponentInfoProvider); var utils$1 = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.gatherIdentifiers = exports.isInReactiveStatement = exports.isReactiveStatement = exports.findNodeAtSpan = exports.findContainingNode = exports.isAfterSvelte2TsxPropsReturn = exports.SnapshotMap = exports.getStoreOffsetOf$storeDeclaration = exports.is$storeVariableIn$storeDeclaration = exports.get$storeOffsetOf$storeDeclaration = exports.isStoreVariableIn$storeDeclaration = exports.isPartOfImportStatement = exports.isTextSpanInGeneratedCode = exports.isInGeneratedCode = exports.isComponentAtPosition = exports.getComponentAtPosition = void 0; const typescript_1 = __importDefault(ts__default__default['default']); function getComponentAtPosition(lang, doc, tsDoc, originalPosition) { var _a; if (tsDoc.parserError) { return null; } if ((0, documents.isInTag)(originalPosition, doc.scriptInfo) || (0, documents.isInTag)(originalPosition, doc.moduleScriptInfo)) { return null; } const node = (0, documents.getNodeIfIsInComponentStartTag)(doc.html, doc.offsetAt(originalPosition)); if (!node) { return null; } const generatedPosition = tsDoc.getGeneratedPosition(doc.positionAt(node.start + 1)); const def = (_a = lang.getDefinitionAtPosition(tsDoc.filePath, tsDoc.offsetAt(generatedPosition))) === null || _a === void 0 ? void 0 : _a[0]; if (!def) { return null; } return ComponentInfoProvider.JsOrTsComponentInfoProvider.create(lang, def); } exports.getComponentAtPosition = getComponentAtPosition; function isComponentAtPosition(doc, tsDoc, originalPosition) { if (tsDoc.parserError) { return false; } if ((0, documents.isInTag)(originalPosition, doc.scriptInfo) || (0, documents.isInTag)(originalPosition, doc.moduleScriptInfo)) { return false; } return !!(0, documents.getNodeIfIsInComponentStartTag)(doc.html, doc.offsetAt(originalPosition)); } exports.isComponentAtPosition = isComponentAtPosition; function isInGeneratedCode(text, start, end = start) { const lastStart = text.lastIndexOf('/*Ωignore_startΩ*/', start); const lastEnd = text.lastIndexOf('/*Ωignore_endΩ*/', start); const nextEnd = text.indexOf('/*Ωignore_endΩ*/', end); return (lastStart > lastEnd || lastEnd === nextEnd) && lastStart < nextEnd; } exports.isInGeneratedCode = isInGeneratedCode; function isTextSpanInGeneratedCode(text, span) { return isInGeneratedCode(text, span.start, span.start + span.length); } exports.isTextSpanInGeneratedCode = isTextSpanInGeneratedCode; function isPartOfImportStatement(text, position) { const line = (0, documents.getLineAtPosition)(position, text); return /\s*from\s+["'][^"']*/.test(line.slice(0, position.character)); } exports.isPartOfImportStatement = isPartOfImportStatement; function isStoreVariableIn$storeDeclaration(text, varStart) { return (text.lastIndexOf('__sveltets_1_store_get(', varStart) === varStart - '__sveltets_1_store_get('.length); } exports.isStoreVariableIn$storeDeclaration = isStoreVariableIn$storeDeclaration; function get$storeOffsetOf$storeDeclaration(text, storePosition) { return text.lastIndexOf(' =', storePosition) - 1; } exports.get$storeOffsetOf$storeDeclaration = get$storeOffsetOf$storeDeclaration; function is$storeVariableIn$storeDeclaration(text, varStart) { return /^\$\w+ = __sveltets_1_store_get/.test(text.substring(varStart)); } exports.is$storeVariableIn$storeDeclaration = is$storeVariableIn$storeDeclaration; function getStoreOffsetOf$storeDeclaration(text, $storeVarStart) { return text.indexOf(');', $storeVarStart) - 1; } exports.getStoreOffsetOf$storeDeclaration = getStoreOffsetOf$storeDeclaration; class SnapshotMap { constructor(resolver) { this.resolver = resolver; this.map = new Map(); } set(fileName, snapshot) { this.map.set(fileName, snapshot); } get(fileName) { return this.map.get(fileName); } async retrieve(fileName) { let snapshot = this.get(fileName); if (!snapshot) { const snap = await this.resolver.getSnapshot(fileName); this.set(fileName, snap); snapshot = snap; } return snapshot; } } exports.SnapshotMap = SnapshotMap; function isAfterSvelte2TsxPropsReturn(text, end) { const textBeforeProp = text.substring(0, end); if (textBeforeProp.includes('\nreturn { props: {')) { return true; } } exports.isAfterSvelte2TsxPropsReturn = isAfterSvelte2TsxPropsReturn; function findContainingNode(node, textSpan, predicate) { const children = node.getChildren(); const end = textSpan.start + textSpan.length; for (const child of children) { if (!(child.getStart() <= textSpan.start && child.getEnd() >= end)) { continue; } if (predicate(child)) { return child; } const foundInChildren = findContainingNode(child, textSpan, predicate); if (foundInChildren) { return foundInChildren; } } } exports.findContainingNode = findContainingNode; function findNodeAtSpan(node, span, predicate) { const { start, length } = span; const end = start + length; for (const child of node.getChildren()) { const childStart = child.getStart(); if (end <= childStart) { return; } const childEnd = child.getEnd(); if (start >= childEnd) { continue; } if (start === childStart && end === childEnd) { if (!predicate) { return child; } if (predicate(child)) { return child; } } const foundInChildren = findNodeAtSpan(child, span, predicate); if (foundInChildren) { return foundInChildren; } } } exports.findNodeAtSpan = findNodeAtSpan; function isSomeAncestor(node, predicate) { for (let parent = node.parent; parent; parent = parent.parent) { if (predicate(parent)) { return true; } } return false; } function nodeAndParentsSatisfyRespectivePredicates(selfPredicate, ...predicates) { return (node) => { let next = node; return [selfPredicate, ...predicates].every((predicate) => { if (!next) { return false; } const current = next; next = next.parent; return predicate(current); }); }; } const isRenderFunction = nodeAndParentsSatisfyRespectivePredicates((node) => { var _a; return typescript_1.default.isFunctionDeclaration(node) && ((_a = node === null || node === void 0 ? void 0 : node.name) === null || _a === void 0 ? void 0 : _a.getText()) === 'render'; }, typescript_1.default.isSourceFile); const isRenderFunctionBody = nodeAndParentsSatisfyRespectivePredicates(typescript_1.default.isBlock, isRenderFunction); exports.isReactiveStatement = nodeAndParentsSatisfyRespectivePredicates((node) => typescript_1.default.isLabeledStatement(node) && node.label.getText() === '$', (0, utils$4.or)( isRenderFunctionBody, nodeAndParentsSatisfyRespectivePredicates(typescript_1.default.isBlock, typescript_1.default.isArrowFunction, typescript_1.default.isExpressionStatement, isRenderFunctionBody))); const isInReactiveStatement = (node) => isSomeAncestor(node, exports.isReactiveStatement); exports.isInReactiveStatement = isInReactiveStatement; function gatherDescendants(node, predicate, dest = []) { if (predicate(node)) { dest.push(node); } else { for (const child of node.getChildren()) { gatherDescendants(child, predicate, dest); } } return dest; } const gatherIdentifiers = (node) => gatherDescendants(node, typescript_1.default.isIdentifier); exports.gatherIdentifiers = gatherIdentifiers; }); getDefaultExportFromCjs(utils$1); var CodeActionsProvider = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CodeActionsProviderImpl = exports.SORT_IMPORT_CODE_ACTION_KIND = void 0; const typescript_1 = __importDefault(ts__default__default['default']); exports.SORT_IMPORT_CODE_ACTION_KIND = 'source.sortImports'; class CodeActionsProviderImpl { constructor(lsAndTsDocResolver, completionProvider, configManager) { this.lsAndTsDocResolver = lsAndTsDocResolver; this.completionProvider = completionProvider; this.configManager = configManager; } async getCodeActions(document, range, context, cancellationToken) { var _a, _b, _c; if (((_a = context.only) === null || _a === void 0 ? void 0 : _a[0]) === main$4.CodeActionKind.SourceOrganizeImports) { return await this.organizeImports(document, cancellationToken); } if (((_b = context.only) === null || _b === void 0 ? void 0 : _b[0]) === exports.SORT_IMPORT_CODE_ACTION_KIND) { return await this.organizeImports(document, cancellationToken, true); } if (((_c = context.only) === null || _c === void 0 ? void 0 : _c[0]) === main$4.CodeActionKind.Source) { return [ ...(await this.organizeImports(document, cancellationToken)), ...(await this.organizeImports(document, cancellationToken, true)) ]; } if (context.diagnostics.length && (!context.only || context.only.includes(main$4.CodeActionKind.QuickFix))) { return await this.applyQuickfix(document, range, context, cancellationToken); } if (!context.only || context.only.includes(main$4.CodeActionKind.Refactor)) { return await this.getApplicableRefactors(document, range, cancellationToken); } return []; } async organizeImports(document, cancellationToken, skipDestructiveCodeActions = false) { var _a; if (!document.scriptInfo && !document.moduleScriptInfo) { return []; } const { lang, tsDoc, userPreferences } = await this.getLSAndTSDoc(document); if ((cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) || tsDoc.parserError) { return []; } const useSemicolons = (_a = this.configManager.getMergedPrettierConfig(await (0, importPackage.importPrettier)(document.getFilePath()).resolveConfig(document.getFilePath(), { editorconfig: true })).semi) !== null && _a !== void 0 ? _a : true; const documentUseLf = document.getText().includes('\n') && !document.getText().includes('\r\n'); const changes = lang.organizeImports({ fileName: tsDoc.filePath, type: 'file', skipDestructiveCodeActions }, { newLineCharacter: documentUseLf ? '\n' : typescript_1.default.sys.newLine, semicolons: useSemicolons ? typescript_1.default.SemicolonPreference.Insert : typescript_1.default.SemicolonPreference.Remove }, userPreferences); const documentChanges = await Promise.all(changes.map(async (change) => { return main$4.TextDocumentEdit.create(main$4.OptionalVersionedTextDocumentIdentifier.create(document.url, null), change.textChanges.map((edit) => { const range = this.checkRemoveImportCodeActionRange(edit, tsDoc, (0, documents.mapRangeToOriginal)(tsDoc, (0, utils$2.convertRange)(tsDoc, edit.span))); return this.fixIndentationOfImports(main$4.TextEdit.replace(range, edit.newText), document); })); })); return [ main$4.CodeAction.create(skipDestructiveCodeActions ? 'Sort Imports' : 'Organize Imports', { documentChanges }, skipDestructiveCodeActions ? exports.SORT_IMPORT_CODE_ACTION_KIND : main$4.CodeActionKind.SourceOrganizeImports) ]; } fixIndentationOfImports(edit, document) { const { newText, range } = edit; if (!newText || range.start.character === 0) { return edit; } const line = (0, documents.getLineAtPosition)(range.start, document.getText()); const leadingChars = line.substring(0, range.start.character); if (leadingChars.trim() !== '') { return edit; } const fixedNewText = (0, utils$4.modifyLines)(edit.newText, (line, idx) => idx === 0 || !line ? line : leadingChars + line); if (range.end.character > 0) { const endLine = (0, documents.getLineAtPosition)(range.end, document.getText()); const isIndent = !endLine.substring(0, range.end.character).trim(); if (isIndent) { const trimmedEndLine = endLine.trim(); if (trimmedEndLine && !trimmedEndLine.startsWith('import')) { range.end.character = 0; } } } return main$4.TextEdit.replace(range, fixedNewText); } checkRemoveImportCodeActionRange(edit, snapshot, range) { if ((range.end.line === 0 && range.end.character === 1) || range.end.line < range.start.line) { edit.span.length -= 1; range = (0, documents.mapRangeToOriginal)(snapshot, (0, utils$2.convertRange)(snapshot, edit.span)); if (!(snapshot instanceof DocumentSnapshot_1.SvelteDocumentSnapshot)) { range.end.character += 1; return range; } const line = (0, documents.getLineAtPosition)(range.end, snapshot.getOriginalText()); if ([';', '"', "'"].includes(line[range.end.character])) { range.end.character += 1; } if ((0, documents.isAtEndOfLine)(line, range.end.character)) { range.end.line += 1; range.end.character = 0; } } return range; } async applyQuickfix(document, range, context, cancellationToken) { const { lang, tsDoc, userPreferences } = await this.getLSAndTSDoc(document); if (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) { return []; } const start = tsDoc.offsetAt(tsDoc.getGeneratedPosition(range.start)); const end = tsDoc.offsetAt(tsDoc.getGeneratedPosition(range.end)); const errorCodes = context.diagnostics.map((diag) => Number(diag.code)); let codeFixes = errorCodes.includes(2304) ? this.getComponentImportQuickFix(start, end, lang, tsDoc.filePath, userPreferences) : undefined; codeFixes = codeFixes || lang.getCodeFixesAtPosition(tsDoc.filePath, start, end, errorCodes, {}, userPreferences); const snapshots = new utils$1.SnapshotMap(this.lsAndTsDocResolver); snapshots.set(tsDoc.filePath, tsDoc); const codeActionsPromises = codeFixes.map(async (fix) => { const documentChangesPromises = fix.changes.map(async (change) => { const snapshot = await snapshots.retrieve(change.fileName); return main$4.TextDocumentEdit.create(main$4.OptionalVersionedTextDocumentIdentifier.create((0, utils$4.pathToUrl)(change.fileName), null), change.textChanges .map((edit) => { if (fix.fixName === 'import' && snapshot instanceof DocumentSnapshot_1.SvelteDocumentSnapshot) { return this.completionProvider.codeActionChangeToTextEdit(document, snapshot, edit, true, range.start); } if ((0, utils$1.isTextSpanInGeneratedCode)(snapshot.getFullText(), edit.span)) { return undefined; } let originalRange = (0, documents.mapRangeToOriginal)(snapshot, (0, utils$2.convertRange)(snapshot, edit.span)); if (fix.fixName === 'unusedIdentifier') { originalRange = this.checkRemoveImportCodeActionRange(edit, snapshot, originalRange); } if (fix.fixName === 'fixMissingFunctionDeclaration') { originalRange = this.checkEndOfFileCodeInsert(originalRange, range, document); } if (fix.fixName === 'disableJsDiagnostics') { if (edit.newText.includes('ts-nocheck')) { return this.checkTsNoCheckCodeInsert(document, edit); } return this.checkDisableJsDiagnosticsCodeInsert(originalRange, document, edit); } if (originalRange.start.line < 0 || originalRange.end.line < 0) { return undefined; } return main$4.TextEdit.replace(originalRange, edit.newText); }) .filter(utils$4.isNotNullOrUndefined)); }); const documentChanges = await Promise.all(documentChangesPromises); return main$4.CodeAction.create(fix.description, { documentChanges }, main$4.CodeActionKind.QuickFix); }); const codeActions = await Promise.all(codeActionsPromises); return codeActions.filter((codeAction) => { var _a, _b; return (_b = (_a = codeAction.edit) === null || _a === void 0 ? void 0 : _a.documentChanges) === null || _b === void 0 ? void 0 : _b.every((change) => change.edits.length > 0); }); } getComponentImportQuickFix(start, end, lang, filePath, userPreferences) { var _a; const sourceFile = (_a = lang.getProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFile(filePath); if (!sourceFile) { return; } const node = (0, utils$1.findContainingNode)(sourceFile, { start, length: end - start }, (node) => this.configManager.getConfig().svelte.useNewTransformation ? typescript_1.default.isCallExpression(node.parent) && typescript_1.default.isIdentifier(node.parent.expression) && node.parent.expression.text === '__sveltets_2_ensureComponent' && typescript_1.default.isIdentifier(node) : typescript_1.default.isJsxClosingElement(node) || typescript_1.default.isJsxOpeningLikeElement(node)); if (!node) { return; } const tagName = typescript_1.default.isIdentifier(node) ? node : node.tagName; const completion = lang.getCompletionsAtPosition(filePath, tagName.getEnd(), userPreferences); if (!completion) { return; } const name = tagName.getText(); const suffixedName = name + '__SvelteComponent_'; const errorPreventingUserPreferences = this.completionProvider.fixUserPreferencesForSvelteComponentImport(userPreferences); const toFix = (c) => { var _a, _b, _c; return (_c = (_b = (_a = lang .getCompletionEntryDetails(filePath, end, c.name, {}, c.source, errorPreventingUserPreferences, c.data)) === null || _a === void 0 ? void 0 : _a.codeActions) === null || _b === void 0 ? void 0 : _b.map((a) => ({ ...a, description: (0, utils$2.changeSvelteComponentName)(a.description), fixName: 'import' }))) !== null && _c !== void 0 ? _c : []; }; return (0, utils$4.flatten)(completion.entries.filter((c) => c.name === name || c.name === suffixedName).map(toFix)); } async getApplicableRefactors(document, range, cancellationToken) { if (!(0, documents.isRangeInTag)(range, document.scriptInfo) && !(0, documents.isRangeInTag)(range, document.moduleScriptInfo)) { return []; } const textInRange = document .getText() .substring(document.offsetAt(range.start), document.offsetAt(range.end)); if (textInRange.includes('$')) { return []; } const { lang, tsDoc, userPreferences } = await this.getLSAndTSDoc(document); if (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) { return []; } const textRange = { pos: tsDoc.offsetAt(tsDoc.getGeneratedPosition(range.start)), end: tsDoc.offsetAt(tsDoc.getGeneratedPosition(range.end)) }; const applicableRefactors = lang.getApplicableRefactors(document.getFilePath() || '', textRange, userPreferences); return (this.applicableRefactorsToCodeActions(applicableRefactors, document, range, textRange) .filter((refactor) => { var _a, _b, _c; return ((_a = refactor.command) === null || _a === void 0 ? void 0 : _a.command.includes('function_scope')) || ((_b = refactor.command) === null || _b === void 0 ? void 0 : _b.command.includes('constant_scope')) || ((_c = refactor.command) === null || _c === void 0 ? void 0 : _c.command) === 'Infer function return type'; }) .filter((refactor) => !refactor.title.includes('module scope')) .map((refactor) => ({ ...refactor, title: refactor.title .replace("Extract to inner function in function 'render'", 'Extract to function') .replace("Extract to constant in function 'render'", 'Extract to constant') }))); } applicableRefactorsToCodeActions(applicableRefactors, document, originalRange, textRange) { return (0, utils$4.flatten)(applicableRefactors.map((applicableRefactor) => { if (applicableRefactor.inlineable === false) { return [ main$4.CodeAction.create(applicableRefactor.description, { title: applicableRefactor.description, command: applicableRefactor.name, arguments: [ document.uri, { type: 'refactor', textRange, originalRange, refactorName: 'Extract Symbol' } ] }) ]; } return applicableRefactor.actions.map((action) => { return main$4.CodeAction.create(action.description, { title: action.description, command: action.name, arguments: [ document.uri, { type: 'refactor', textRange, originalRange, refactorName: applicableRefactor.name } ] }); }); })); } async executeCommand(document, command, args) { var _a; if (!(((_a = args === null || args === void 0 ? void 0 : args[1]) === null || _a === void 0 ? void 0 : _a.type) === 'refactor')) { return null; } const { lang, tsDoc, userPreferences } = await this.getLSAndTSDoc(document); const path = document.getFilePath() || ''; const { refactorName, originalRange, textRange } = args[1]; const edits = lang.getEditsForRefactor(path, {}, textRange, refactorName, command, userPreferences); if (!edits || edits.edits.length === 0) { return null; } const documentChanges = edits === null || edits === void 0 ? void 0 : edits.edits.map((edit) => main$4.TextDocumentEdit.create(main$4.OptionalVersionedTextDocumentIdentifier.create(document.uri, null), edit.textChanges.map((edit) => { const range = (0, documents.mapRangeToOriginal)(tsDoc, (0, utils$2.convertRange)(tsDoc, edit.span)); return main$4.TextEdit.replace(this.checkEndOfFileCodeInsert(range, originalRange, document), edit.newText); }))); return { documentChanges }; } checkEndOfFileCodeInsert(resultRange, targetRange, document) { if (resultRange.start.line < 0 || resultRange.end.line < 0) { if ((0, documents.isRangeInTag)(targetRange, document.moduleScriptInfo)) { return main$4.Range.create(document.moduleScriptInfo.endPos, document.moduleScriptInfo.endPos); } if (document.scriptInfo) { return main$4.Range.create(document.scriptInfo.endPos, document.scriptInfo.endPos); } } return resultRange; } checkTsNoCheckCodeInsert(document, edit) { if (!document.scriptInfo) { return undefined; } const newText = typescript_1.default.sys.newLine + edit.newText; return main$4.TextEdit.insert(document.scriptInfo.startPos, newText); } checkDisableJsDiagnosticsCodeInsert(originalRange, document, edit) { const startOffset = document.offsetAt(originalRange.start); const text = document.getText(); const insertedAfterExport = text.slice(0, startOffset).trim().endsWith('export'); if (!insertedAfterExport) { return main$4.TextEdit.replace(originalRange, edit.newText); } const position = document.positionAt(text.lastIndexOf('export', startOffset)); const linesOfNewText = edit.newText.split('\n'); if (/^[ \t]*$/.test(linesOfNewText[linesOfNewText.length - 1])) { const line = (0, documents.getLineAtPosition)(originalRange.start, document.getText()); const indent = (0, utils$4.getIndent)(line); linesOfNewText[linesOfNewText.length - 1] = indent; } return main$4.TextEdit.insert(position, linesOfNewText.join('\n')); } async getLSAndTSDoc(document) { return this.lsAndTsDocResolver.getLSAndTSDoc(document); } } exports.CodeActionsProviderImpl = CodeActionsProviderImpl; }); getDefaultExportFromCjs(CodeActionsProvider); var previewer = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMarkdownDocumentation = exports.plain = exports.getTagDocumentation = void 0; const typescript_1 = __importDefault(ts__default__default['default']); function replaceLinks(text) { return (text .replace(/\{@(link|linkplain|linkcode) (https?:\/\/[^ |}]+?)(?:[| ]([^{}\n]+?))?\}/gi, (_, tag, link, text) => { switch (tag) { case 'linkcode': return `[\`${text ? text.trim() : link}\`](${link})`; default: return `[${text ? text.trim() : link}](${link})`; } })); } function processInlineTags(text) { return replaceLinks(text); } function getTagBodyText(tag) { if (!tag.text) { return undefined; } function makeCodeblock(text) { if (text.match(/^\s*[~`]{3}/g)) { return text; } return '```\n' + text + '\n```'; } function makeExampleTag(text) { const captionTagMatches = text.match(/<caption>(.*?)<\/caption>\s*(\r\n|\n)/); if (captionTagMatches && captionTagMatches.index === 0) { return (captionTagMatches[1] + '\n\n' + makeCodeblock(text.substr(captionTagMatches[0].length))); } else { return makeCodeblock(text); } } function makeEmailTag(text) { const emailMatch = text.match(/(.+)\s<([-.\w]+@[-.\w]+)>/); if (emailMatch === null) { return text; } else { return `${emailMatch[1]} ${emailMatch[2]}`; } } switch (tag.name) { case 'example': return makeExampleTag(typescript_1.default.displayPartsToString(tag.text)); case 'author': return makeEmailTag(typescript_1.default.displayPartsToString(tag.text)); case 'default': return makeCodeblock(typescript_1.default.displayPartsToString(tag.text)); } return processInlineTags(typescript_1.default.displayPartsToString(tag.text)); } function getTagDocumentation(tag) { function getWithType() { const body = (typescript_1.default.displayPartsToString(tag.text) || '').split(/^(\S+)\s*-?\s*/); if ((body === null || body === void 0 ? void 0 : body.length) === 3) { const param = body[1]; const doc = body[2]; const label = `*@${tag.name}* \`${param}\``; if (!doc) { return label; } return (label + (doc.match(/\r\n|\n/g) ? ' \n' + processInlineTags(doc) : ` — ${processInlineTags(doc)}`)); } } switch (tag.name) { case 'augments': case 'extends': case 'param': case 'template': return getWithType(); } const label = `*@${tag.name}*`; const text = getTagBodyText(tag); if (!text) { return label; } return label + (text.match(/\r\n|\n/g) ? ' \n' + text : ` — ${text}`); } exports.getTagDocumentation = getTagDocumentation; function plain(parts) { return processInlineTags(typeof parts === 'string' ? parts : typescript_1.default.displayPartsToString(parts)); } exports.plain = plain; function getMarkdownDocumentation(documentation, tags) { let result = []; if (documentation) { result.push(plain(documentation)); } if (tags) { result = result.concat(tags.map(getTagDocumentation)); } return result.filter(utils$4.isNotNullOrUndefined).join('\n\n'); } exports.getMarkdownDocumentation = getMarkdownDocumentation; }); getDefaultExportFromCjs(previewer); var getJsDocTemplateCompletion_1 = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getJsDocTemplateCompletion = void 0; const typescript_1 = __importDefault(ts__default__default['default']); const DEFAULT_SNIPPET = `/**${typescript_1.default.sys.newLine} * $0${typescript_1.default.sys.newLine} */`; function getJsDocTemplateCompletion(snapshot, lang, filePath, offset) { var _a, _b; const template = lang.getDocCommentTemplateAtPosition(filePath, offset); if (!template) { return null; } const text = snapshot.getFullText(); const lineStart = text.lastIndexOf('\n', offset); const lineEnd = text.indexOf('\n', offset); const isLastLine = lineEnd === -1; const line = text.substring(lineStart, isLastLine ? undefined : lineEnd); const character = offset - lineStart; const start = line.lastIndexOf('/**', character) + lineStart; const suffix = line.slice(character).match(/^\s*\**\//); const textEditRange = (0, documents.mapRangeToOriginal)(snapshot, main$4.Range.create(snapshot.positionAt(start), snapshot.positionAt(offset + ((_b = (_a = suffix === null || suffix === void 0 ? void 0 : suffix[0]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0)))); const { newText } = template; const snippet = newText === '/** */' ? DEFAULT_SNIPPET : templateToSnippet(newText); const item = { label: '/** */', detail: 'JSDoc comment', sortText: '\0', kind: main$4.CompletionItemKind.Snippet, textEdit: main$4.TextEdit.replace(textEditRange, snippet), insertTextFormat: main$4.InsertTextFormat.Snippet }; return main$4.CompletionList.create([item]); } exports.getJsDocTemplateCompletion = getJsDocTemplateCompletion; function templateToSnippet(text) { return (text .replace(/\$/g, '\\$') .split('\n') .map((part) => part.replace(/^\s*(?=(\/|[ ]\*))/g, '')) .join('\n') .replace(/^(\/\*\*\s*\*[ ]*)$/m, (x) => x + '$0')); } }); getDefaultExportFromCjs(getJsDocTemplateCompletion_1); var CompletionProvider = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CompletionsProviderImpl = void 0; const typescript_1 = __importDefault(ts__default__default['default']); class CompletionsProviderImpl { constructor(lsAndTsDocResolver, configManager) { this.lsAndTsDocResolver = lsAndTsDocResolver; this.configManager = configManager; this.validTriggerCharacters = ['.', '"', "'", '`', '/', '@', '<', '#']; } isValidTriggerCharacter(character) { return this.validTriggerCharacters.includes(character); } async getCompletions(document, position, completionContext, cancellationToken) { var _a, _b, _c; if ((0, documents.isInTag)(position, document.styleInfo)) { return null; } const { lang, tsDoc, userPreferences } = await this.lsAndTsDocResolver.getLSAndTSDoc(document); const filePath = tsDoc.filePath; if (!filePath) { return null; } const triggerCharacter = completionContext === null || completionContext === void 0 ? void 0 : completionContext.triggerCharacter; const triggerKind = completionContext === null || completionContext === void 0 ? void 0 : completionContext.triggerKind; const validTriggerCharacter = this.isValidTriggerCharacter(triggerCharacter) ? triggerCharacter : undefined; const isCustomTriggerCharacter = triggerKind === main$4.CompletionTriggerKind.TriggerCharacter; const isJsDocTriggerCharacter = triggerCharacter === '*'; const isEventOrSlotLetTriggerCharacter = triggerCharacter === ':'; if (isCustomTriggerCharacter && !validTriggerCharacter && !isJsDocTriggerCharacter && !isEventOrSlotLetTriggerCharacter) { return null; } if (this.canReuseLastCompletion(this.lastCompletion, triggerKind, triggerCharacter, document, position)) { this.lastCompletion.position = position; return this.lastCompletion.completionList; } else { this.lastCompletion = undefined; } if (!tsDoc.isInGenerated(position)) { return null; } const originalOffset = document.offsetAt(position); const offset = tsDoc.offsetAt(tsDoc.getGeneratedPosition(position)); if (isJsDocTriggerCharacter) { return (0, getJsDocTemplateCompletion_1.getJsDocTemplateCompletion)(tsDoc, lang, filePath, offset); } const svelteNode = tsDoc.svelteNodeAt(originalOffset); if ( ((svelteNode === null || svelteNode === void 0 ? void 0 : svelteNode.type) === 'Text' && ['Element', 'InlineComponent', 'Fragment', 'SlotTemplate'].includes((_a = svelteNode.parent) === null || _a === void 0 ? void 0 : _a.type)) || document.getText().substring(originalOffset - 1, originalOffset + 2) === '></') { return null; } if (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) { return null; } const wordRange = (0, documents.getWordRangeAt)(document.getText(), originalOffset, { left: /[^\s.]+$/, right: /[^\w$:]/ }); const componentInfo = (0, utils$1.getComponentAtPosition)(lang, document, tsDoc, position); const eventAndSlotLetCompletions = this.getEventAndSlotLetCompletions(componentInfo, document, wordRange); if (isEventOrSlotLetTriggerCharacter) { return main$4.CompletionList.create(eventAndSlotLetCompletions, !!tsDoc.parserError); } if (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) { return null; } let completions = ((_b = lang.getCompletionsAtPosition(filePath, offset, { ...userPreferences, triggerCharacter: validTriggerCharacter })) === null || _b === void 0 ? void 0 : _b.entries) || []; if (!completions.length) { completions = (_c = this.jsxTransformationPropStringLiteralCompletion(lang, componentInfo, offset, tsDoc)) !== null && _c !== void 0 ? _c : []; } if (completions.length === 0 && eventAndSlotLetCompletions.length === 0) { return tsDoc.parserError ? main$4.CompletionList.create([], true) : null; } const existingImports = this.getExistingImports(document); const wordRangeStartPosition = document.positionAt(wordRange.start); const completionItems = completions .filter(isValidCompletion(document, position)) .map((comp) => this.toCompletionItem(tsDoc, comp, (0, utils$4.pathToUrl)(tsDoc.filePath), position, existingImports)) .filter(utils$4.isNotNullOrUndefined) .map((comp) => (0, documents.mapCompletionItemToOriginal)(tsDoc, comp)) .map((comp) => this.fixTextEditRange(wordRangeStartPosition, comp)) .concat(eventAndSlotLetCompletions); const completionList = main$4.CompletionList.create(completionItems, !!tsDoc.parserError); this.lastCompletion = { key: document.getFilePath() || '', position, completionList }; return completionList; } canReuseLastCompletion(lastCompletion, triggerKind, triggerCharacter, document, position) { return (!!lastCompletion && lastCompletion.key === document.getFilePath() && lastCompletion.position.line === position.line && ((Math.abs(lastCompletion.position.character - position.character) < 2 && (triggerKind === main$4.CompletionTriggerKind.TriggerForIncompleteCompletions || (triggerCharacter === '.' && (0, utils$1.isPartOfImportStatement)(document.getText(), position)))) || (Math.abs(lastCompletion.position.character - position.character) < 4 && triggerCharacter === ':' && !!(0, documents.getNodeIfIsInStartTag)(document.html, document.offsetAt(position))))); } getExistingImports(document) { const rawImports = (0, utils$4.getRegExpMatches)(scriptImportRegex, document.getText()).map((match) => { var _a; return ((_a = match[1]) !== null && _a !== void 0 ? _a : match[2]).split(','); }); const tidiedImports = (0, utils$4.flatten)(rawImports).map((match) => match.trim()); return new Set(tidiedImports); } getEventAndSlotLetCompletions(componentInfo, doc, wordRange) { if (componentInfo === null) { return []; } const { start, end } = wordRange; const events = componentInfo.getEvents().map((event) => mapToCompletionEntry(event, 'on:')); const slotLets = componentInfo .getSlotLets() .map((slot) => mapToCompletionEntry(slot, 'let:')); return [...events, ...slotLets]; function mapToCompletionEntry(info, prefix) { const slotName = prefix + info.name; return { label: slotName, sortText: '-1', detail: info.name + ': ' + info.type, documentation: info.doc && { kind: main$4.MarkupKind.Markdown, value: info.doc }, textEdit: start !== end ? main$4.TextEdit.replace((0, documents.toRange)(doc.getText(), start, end), slotName) : undefined }; } } toCompletionItem(snapshot, comp, uri, position, existingImports) { const completionLabelAndInsert = this.getCompletionLabelAndInsert(snapshot, comp); if (!completionLabelAndInsert) { return null; } const { label, insertText, isSvelteComp, replacementSpan } = completionLabelAndInsert; if (isSvelteComp && existingImports.has(label)) { return null; } const textEdit = replacementSpan ? main$4.TextEdit.replace((0, utils$2.convertRange)(snapshot, replacementSpan), insertText !== null && insertText !== void 0 ? insertText : label) : undefined; return { label, insertText, kind: (0, utils$2.scriptElementKindToCompletionItemKind)(comp.kind), commitCharacters: (0, utils$2.getCommitCharactersForScriptElement)(comp.kind), sortText: isSvelteComp ? '-1' : comp.sortText, preselect: isSvelteComp ? true : comp.isRecommended, textEdit, data: { ...comp, uri, position } }; } getCompletionLabelAndInsert(snapshot, comp) { let { name, insertText, kindModifiers } = comp; const isScriptElement = comp.kind === typescript_1.default.ScriptElementKind.scriptElement; const hasModifier = Boolean(comp.kindModifiers); const isSvelteComp = this.isSvelteComponentImport(name); if (isSvelteComp) { name = (0, utils$2.changeSvelteComponentName)(name); if (this.isExistingSvelteComponentImport(snapshot, name, comp.source)) { return null; } } if (isScriptElement && hasModifier) { const label = kindModifiers && !name.endsWith(kindModifiers) ? name + kindModifiers : name; return { insertText: name, label, isSvelteComp }; } if (comp.replacementSpan) { return { label: name, isSvelteComp, insertText: insertText ? (0, utils$2.changeSvelteComponentName)(insertText) : undefined, replacementSpan: comp.replacementSpan }; } return { label: name, isSvelteComp }; } isExistingSvelteComponentImport(snapshot, name, source) { const importStatement = new RegExp(`import ${name} from ["'\`][\\s\\S]+\\.svelte["'\`]`); return !!source && !!snapshot.getFullText().match(importStatement); } fixTextEditRange(wordRangePosition, completionItem) { const { textEdit } = completionItem; if (!textEdit || !main$4.TextEdit.is(textEdit)) { return completionItem; } const { newText, range: { start } } = textEdit; const wordRangeStartCharacter = wordRangePosition.character; if (wordRangePosition.line !== wordRangePosition.line || start.character > wordRangePosition.character) { return completionItem; } textEdit.newText = newText.substring(wordRangeStartCharacter - start.character); textEdit.range.start = { line: start.line, character: wordRangeStartCharacter }; completionItem.additionalTextEdits = [ main$4.TextEdit.replace({ start, end: { line: start.line, character: wordRangeStartCharacter } }, newText.substring(0, wordRangeStartCharacter - start.character)) ]; return completionItem; } fixUserPreferencesForSvelteComponentImport(userPreferences) { if (userPreferences.importModuleSpecifierEnding === 'js') { return { ...userPreferences, importModuleSpecifierEnding: 'index' }; } return userPreferences; } async resolveCompletion(document, completionItem, cancellationToken) { var _a, _b; const { data: comp } = completionItem; const { tsDoc, lang, userPreferences } = await this.lsAndTsDocResolver.getLSAndTSDoc(document); const filePath = tsDoc.filePath; if (!comp || !filePath || (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested)) { return completionItem; } const errorPreventingUserPreferences = ((_a = comp.source) === null || _a === void 0 ? void 0 : _a.endsWith('.svelte')) ? this.fixUserPreferencesForSvelteComponentImport(userPreferences) : userPreferences; const detail = lang.getCompletionEntryDetails(filePath, tsDoc.offsetAt(tsDoc.getGeneratedPosition(comp.position)), comp.name, {}, comp.source, errorPreventingUserPreferences, comp.data); if (detail) { const { detail: itemDetail, documentation: itemDocumentation } = this.getCompletionDocument(detail); completionItem.detail = itemDetail; completionItem.documentation = itemDocumentation; } const actions = detail === null || detail === void 0 ? void 0 : detail.codeActions; const isImport = !!(detail === null || detail === void 0 ? void 0 : detail.source); if (actions) { const edit = []; for (const action of actions) { for (const change of action.changes) { edit.push(...this.codeActionChangesToTextEdit(document, tsDoc, change, isImport, comp.position)); } } completionItem.additionalTextEdits = ((_b = completionItem.additionalTextEdits) !== null && _b !== void 0 ? _b : []).concat(edit); } return completionItem; } getCompletionDocument(compDetail) { const { sourceDisplay, documentation: tsDocumentation, displayParts, tags } = compDetail; let detail = (0, utils$2.changeSvelteComponentName)(typescript_1.default.displayPartsToString(displayParts)); if (sourceDisplay) { const importPath = typescript_1.default.displayPartsToString(sourceDisplay); detail = `Auto import from ${importPath}\n${detail}`; } const markdownDoc = (0, previewer.getMarkdownDocumentation)(tsDocumentation, tags); const documentation = markdownDoc ? { value: markdownDoc, kind: main$4.MarkupKind.Markdown } : undefined; return { documentation, detail }; } codeActionChangesToTextEdit(doc, snapshot, changes, isImport, originalTriggerPosition) { return changes.textChanges.map((change) => this.codeActionChangeToTextEdit(doc, snapshot, change, isImport, originalTriggerPosition)); } codeActionChangeToTextEdit(doc, snapshot, change, isImport, originalTriggerPosition) { var _a, _b, _c, _d; change.newText = this.changeComponentImport(change.newText, (0, utils$2.isInScript)(originalTriggerPosition, doc)); const scriptTagInfo = snapshot.scriptInfo || snapshot.moduleScriptInfo; if (!scriptTagInfo) { const lang = this.configManager.getConfig().svelte.defaultScriptLanguage; const scriptLang = lang === 'none' ? '' : ` lang="${lang}"`; return main$4.TextEdit.replace(beginOfDocumentRange, `<script${scriptLang}>${typescript_1.default.sys.newLine}${change.newText}</script>${typescript_1.default.sys.newLine}`); } const { span } = change; const virtualRange = (0, utils$2.convertRange)(snapshot, span); let range; const isNewImport = isImport && virtualRange.start.character === 0; if (isNewImport && virtualRange.start.line > 1) { range = this.mapRangeForNewImport(snapshot, virtualRange); } else { range = (0, documents.mapRangeToOriginal)(snapshot, virtualRange); } if (range.start.line === -1 || (range.start.line === 0 && range.start.character <= 1 && span.length === 0) || !(0, utils$2.isInScript)(range.start, snapshot)) { range = (0, utils$2.convertRange)(doc, { start: (0, documents.isInTag)(originalTriggerPosition, doc.scriptInfo) ? ((_a = snapshot.scriptInfo) === null || _a === void 0 ? void 0 : _a.start) || scriptTagInfo.start : (0, documents.isInTag)(originalTriggerPosition, doc.moduleScriptInfo) ? ((_b = snapshot.moduleScriptInfo) === null || _b === void 0 ? void 0 : _b.start) || scriptTagInfo.start : scriptTagInfo.start, length: span.length }); } const editOffset = doc.offsetAt(range.start); if ((editOffset === ((_c = snapshot.scriptInfo) === null || _c === void 0 ? void 0 : _c.start) || editOffset === ((_d = snapshot.moduleScriptInfo) === null || _d === void 0 ? void 0 : _d.start)) && !change.newText.startsWith('\r\n') && !change.newText.startsWith('\n')) { change.newText = typescript_1.default.sys.newLine + change.newText; } return main$4.TextEdit.replace(range, change.newText); } mapRangeForNewImport(snapshot, virtualRange) { const sourceMappableRange = this.offsetLinesAndMovetoStartOfLine(virtualRange, -1); const mappableRange = (0, documents.mapRangeToOriginal)(snapshot, sourceMappableRange); return this.offsetLinesAndMovetoStartOfLine(mappableRange, 1); } offsetLinesAndMovetoStartOfLine({ start, end }, offsetLines) { return main$4.Range.create(main$4.Position.create(start.line + offsetLines, 0), main$4.Position.create(end.line + offsetLines, 0)); } isSvelteComponentImport(className) { return className.endsWith('__SvelteComponent_'); } changeComponentImport(importText, actionTriggeredInScript) { const changedName = (0, utils$2.changeSvelteComponentName)(importText); if (importText !== changedName || !actionTriggeredInScript) { return changedName.replace(' type ', ' '); } return importText; } jsxTransformationPropStringLiteralCompletion(lang, componentInfo, position, tsDoc) { if (!componentInfo || this.configManager.getConfig().svelte.useNewTransformation) { return null; } const program = lang.getProgram(); const sourceFile = program === null || program === void 0 ? void 0 : program.getSourceFile(tsDoc.filePath); if (!sourceFile) { return null; } const jsxAttribute = (0, utils$1.findContainingNode)(sourceFile, { start: position, length: 0 }, typescript_1.default.isJsxAttribute); if (!jsxAttribute || !jsxAttribute.initializer || !typescript_1.default.isStringLiteral(jsxAttribute.initializer)) { return null; } const replacementSpan = jsxAttribute.initializer.getWidth() ? { start: jsxAttribute.initializer.getStart() + 1, length: jsxAttribute.initializer.getWidth() - 2 } : undefined; return componentInfo.getProps(jsxAttribute.name.getText()).map((item) => ({ ...item, replacementSpan })); } } exports.CompletionsProviderImpl = CompletionsProviderImpl; const beginOfDocumentRange = main$4.Range.create(main$4.Position.create(0, 0), main$4.Position.create(0, 0)); const scriptImportRegex = /\bimport\s+{([^}]*?)}\s+?from\s+['"`].+?['"`]|\bimport\s+(\w+?)\s+from\s+['"`].+?['"`]/g; const svelte2tsxTypes = new Set([ 'Svelte2TsxComponent', 'Svelte2TsxComponentConstructorParameters', 'SvelteComponentConstructor', 'SvelteActionReturnType', 'SvelteTransitionConfig', 'SvelteTransitionReturnType', 'SvelteAnimationReturnType', 'SvelteWithOptionalProps', 'SvelteAllProps', 'SveltePropsAnyFallback', 'SvelteSlotsAnyFallback', 'SvelteRestProps', 'SvelteSlots', 'SvelteStore' ]); function isValidCompletion(document, position) { const isNoSvelte2tsxCompletion = (value) => value.kindModifiers !== 'declare' || (!value.name.startsWith('__sveltets_') && !svelte2tsxTypes.has(value.name)); const isCompletionInHTMLStartTag = !!(0, documents.getNodeIfIsInHTMLStartTag)(document.html, document.offsetAt(position)); if (!isCompletionInHTMLStartTag) { return isNoSvelte2tsxCompletion; } return (value) => value.kind !== typescript_1.default.ScriptElementKind.jsxAttribute && isNoSvelte2tsxCompletion(value); } }); getDefaultExportFromCjs(CompletionProvider); var svelteAstUtils = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isEventHandler = exports.isAttributeShorthand = exports.isHTMLElement = exports.isAttributeName = void 0; function isAttributeName(node, only) { var _a; return !!node && node.type === 'Attribute' && (!only || ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === only); } exports.isAttributeName = isAttributeName; function isHTMLElement(node, only) { var _a; return !!node && node.type === 'Attribute' && (!only || ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === only); } exports.isHTMLElement = isHTMLElement; function isAttributeShorthand(node, only) { if (!node) { return false; } do { if (isAttributeName(node, only)) { return true; } node = node.parent; } while (node); return false; } exports.isAttributeShorthand = isAttributeShorthand; function isEventHandler(node, only) { var _a; return !!node && node.type === 'EventHandler' && (!only || ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === only); } exports.isEventHandler = isEventHandler; }); getDefaultExportFromCjs(svelteAstUtils); var DiagnosticsProvider = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DiagnosticsProviderImpl = void 0; const typescript_1 = __importDefault(ts__default__default['default']); var DiagnosticCode; (function (DiagnosticCode) { DiagnosticCode[DiagnosticCode["MODIFIERS_CANNOT_APPEAR_HERE"] = 1184] = "MODIFIERS_CANNOT_APPEAR_HERE"; DiagnosticCode[DiagnosticCode["USED_BEFORE_ASSIGNED"] = 2454] = "USED_BEFORE_ASSIGNED"; DiagnosticCode[DiagnosticCode["JSX_ELEMENT_DOES_NOT_SUPPORT_ATTRIBUTES"] = 2607] = "JSX_ELEMENT_DOES_NOT_SUPPORT_ATTRIBUTES"; DiagnosticCode[DiagnosticCode["CANNOT_BE_USED_AS_JSX_COMPONENT"] = 2786] = "CANNOT_BE_USED_AS_JSX_COMPONENT"; DiagnosticCode[DiagnosticCode["NOOP_IN_COMMAS"] = 2695] = "NOOP_IN_COMMAS"; DiagnosticCode[DiagnosticCode["NEVER_READ"] = 6133] = "NEVER_READ"; DiagnosticCode[DiagnosticCode["ALL_IMPORTS_UNUSED"] = 6192] = "ALL_IMPORTS_UNUSED"; DiagnosticCode[DiagnosticCode["UNUSED_LABEL"] = 7028] = "UNUSED_LABEL"; DiagnosticCode[DiagnosticCode["DUPLICATED_JSX_ATTRIBUTES"] = 17001] = "DUPLICATED_JSX_ATTRIBUTES"; DiagnosticCode[DiagnosticCode["DUPLICATE_IDENTIFIER"] = 2300] = "DUPLICATE_IDENTIFIER"; DiagnosticCode[DiagnosticCode["MULTIPLE_PROPS_SAME_NAME"] = 1117] = "MULTIPLE_PROPS_SAME_NAME"; DiagnosticCode[DiagnosticCode["TYPE_X_NOT_ASSIGNABLE_TO_TYPE_Y"] = 2345] = "TYPE_X_NOT_ASSIGNABLE_TO_TYPE_Y"; DiagnosticCode[DiagnosticCode["MISSING_PROPS"] = 2739] = "MISSING_PROPS"; DiagnosticCode[DiagnosticCode["MISSING_PROP"] = 2741] = "MISSING_PROP"; DiagnosticCode[DiagnosticCode["NO_OVERLOAD_MATCHES_CALL"] = 2769] = "NO_OVERLOAD_MATCHES_CALL"; })(DiagnosticCode || (DiagnosticCode = {})); class DiagnosticsProviderImpl { constructor(lsAndTsDocResolver, configManager) { this.lsAndTsDocResolver = lsAndTsDocResolver; this.configManager = configManager; } async getDiagnostics(document, cancellationToken) { const { lang, tsDoc } = await this.getLSAndTSDoc(document); if (['coffee', 'coffeescript'].includes(document.getLanguageAttribute('script')) || (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested)) { return []; } const isTypescript = tsDoc.scriptKind === typescript_1.default.ScriptKind.TSX || tsDoc.scriptKind === typescript_1.default.ScriptKind.TS; if (tsDoc.parserError) { return [ { range: tsDoc.parserError.range, severity: main$4.DiagnosticSeverity.Error, source: isTypescript ? 'ts' : 'js', message: tsDoc.parserError.message, code: tsDoc.parserError.code } ]; } let diagnostics = [ ...lang.getSyntacticDiagnostics(tsDoc.filePath), ...lang.getSuggestionDiagnostics(tsDoc.filePath), ...lang.getSemanticDiagnostics(tsDoc.filePath) ]; const additionalStoreDiagnostics = []; const notGenerated = isNotGenerated(tsDoc.getFullText()); for (const diagnostic of diagnostics) { if ((diagnostic.code === DiagnosticCode.NO_OVERLOAD_MATCHES_CALL || diagnostic.code === DiagnosticCode.TYPE_X_NOT_ASSIGNABLE_TO_TYPE_Y) && !notGenerated(diagnostic)) { if ((0, utils$1.isStoreVariableIn$storeDeclaration)(tsDoc.getFullText(), diagnostic.start)) { const storeName = tsDoc .getFullText() .substring(diagnostic.start, diagnostic.start + diagnostic.length); const storeUsages = lang.findReferences(tsDoc.filePath, (0, utils$1.get$storeOffsetOf$storeDeclaration)(tsDoc.getFullText(), diagnostic.start))[0].references; for (const storeUsage of storeUsages) { additionalStoreDiagnostics.push({ ...diagnostic, messageText: `Cannot use '${storeName}' as a store. '${storeName}' needs to be an object with a subscribe method on it.\n\n${typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`, start: storeUsage.textSpan.start, length: storeUsage.textSpan.length }); } } } } diagnostics.push(...additionalStoreDiagnostics); diagnostics = diagnostics.filter(notGenerated).filter((0, utils$4.not)(isUnusedReactiveStatementLabel)); diagnostics = resolveNoopsInReactiveStatements(lang, diagnostics); return diagnostics .map((diagnostic) => ({ range: (0, utils$2.convertRange)(tsDoc, diagnostic), severity: (0, utils$2.mapSeverity)(diagnostic.category), source: isTypescript ? 'ts' : 'js', message: typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), code: diagnostic.code, tags: (0, utils$2.getDiagnosticTag)(diagnostic) })) .map(mapRange(tsDoc, document, this.configManager.getConfig().svelte.useNewTransformation)) .filter(hasNoNegativeLines) .filter(isNoFalsePositive(this.configManager.getConfig().svelte.useNewTransformation, document, tsDoc)) .map(enhanceIfNecessary) .map(swapDiagRangeStartEndIfNecessary); } async getLSAndTSDoc(document) { return this.lsAndTsDocResolver.getLSAndTSDoc(document); } } exports.DiagnosticsProviderImpl = DiagnosticsProviderImpl; function mapRange(snapshot, document, useNewTransformation) { return (diagnostic) => { var _a; let range = (0, documents.mapRangeToOriginal)(snapshot, diagnostic.range); if (range.start.line < 0) { const is$$PropsError = (0, utils$1.isAfterSvelte2TsxPropsReturn)(snapshot.getFullText(), snapshot.offsetAt(diagnostic.range.start)) && diagnostic.message.includes('$$Props'); if (is$$PropsError) { const propsStart = (0, utils$4.regexIndexOf)(document.getText(), /(interface|type)\s+\$\$Props[\s{=]/); if (propsStart) { const start = document.positionAt(propsStart + document.getText().substring(propsStart).indexOf('$$Props')); range = { start, end: { ...start, character: start.character + '$$Props'.length } }; } } } if (useNewTransformation && [DiagnosticCode.MISSING_PROP, DiagnosticCode.MISSING_PROPS].includes(diagnostic.code) && !(0, utils$2.hasNonZeroRange)({ range })) { const node = (0, documents.getNodeIfIsInStartTag)(document.html, document.offsetAt(range.start)); if (node) { range.start = document.positionAt(node.start + 1); range.end = document.positionAt(node.start + 1 + (((_a = node.tag) === null || _a === void 0 ? void 0 : _a.length) || 1)); } } return { ...diagnostic, range }; }; } function findDiagnosticNode(diagnostic) { const { file, start, length } = diagnostic; if (!file || !start || !length) { return; } const span = { start, length }; return (0, utils$1.findNodeAtSpan)(file, span); } function copyDiagnosticAndChangeNode(diagnostic) { return (node) => ({ ...diagnostic, start: node.getStart(), length: node.getWidth() }); } function hasNoNegativeLines(diagnostic) { return diagnostic.range.start.line >= 0 && diagnostic.range.end.line >= 0; } function isNoFalsePositive(useNewTransformation, document, tsDoc) { const text = document.getText(); const usesPug = document.getLanguageAttribute('template') === 'pug'; return (diagnostic) => { if (useNewTransformation && [DiagnosticCode.MULTIPLE_PROPS_SAME_NAME, DiagnosticCode.DUPLICATE_IDENTIFIER].includes(diagnostic.code)) { const node = tsDoc.svelteNodeAt(diagnostic.range.start); if ((0, svelteAstUtils.isAttributeName)(node, 'Element') || (0, svelteAstUtils.isEventHandler)(node, 'Element')) { return false; } } return (isNoJsxCannotHaveMultipleAttrsError(diagnostic) && isNoUsedBeforeAssigned(diagnostic, text, tsDoc) && (!usesPug || isNoPugFalsePositive(diagnostic, document))); }; } function isNoPugFalsePositive(diagnostic, document) { return (!(0, documents.isRangeInTag)(diagnostic.range, document.templateInfo) && diagnostic.code !== DiagnosticCode.NEVER_READ && diagnostic.code !== DiagnosticCode.ALL_IMPORTS_UNUSED); } function isNoUsedBeforeAssigned(diagnostic, text, tsDoc) { if (diagnostic.code !== DiagnosticCode.USED_BEFORE_ASSIGNED) { return true; } return !tsDoc.hasProp((0, documents.getTextInRange)(diagnostic.range, text)); } function isNoJsxCannotHaveMultipleAttrsError(diagnostic) { return diagnostic.code !== DiagnosticCode.DUPLICATED_JSX_ATTRIBUTES; } function enhanceIfNecessary(diagnostic) { if (diagnostic.code === DiagnosticCode.CANNOT_BE_USED_AS_JSX_COMPONENT || (diagnostic.code === DiagnosticCode.TYPE_X_NOT_ASSIGNABLE_TO_TYPE_Y && diagnostic.message.includes('ConstructorOfATypedSvelteComponent'))) { return { ...diagnostic, message: diagnostic.message + '\n\nPossible causes:\n' + '- You use the instance type of a component where you should use the constructor type\n' + '- Type definitions are missing for this Svelte Component. ' + 'If you are using Svelte 3.31+, use SvelteComponentTyped to add a definition:\n' + ' import type { SvelteComponentTyped } from "svelte";\n' + ' class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}' }; } if (diagnostic.code === DiagnosticCode.JSX_ELEMENT_DOES_NOT_SUPPORT_ATTRIBUTES) { return { ...diagnostic, message: 'Element does not support attributes because ' + 'type definitions are missing for this Svelte Component or element cannot be used as such.\n\n' + 'Underlying error:\n' + diagnostic.message }; } if (diagnostic.code === DiagnosticCode.MODIFIERS_CANNOT_APPEAR_HERE) { return { ...diagnostic, message: diagnostic.message + '\nIf this is a declare statement, move it into <script context="module">..</script>' }; } return diagnostic; } function swapDiagRangeStartEndIfNecessary(diag) { diag.range = (0, utils$4.swapRangeStartEndIfNecessary)(diag.range); return diag; } function isNotGenerated(text) { return (diagnostic) => { if (diagnostic.start === undefined || diagnostic.length === undefined) { return true; } return !(0, utils$1.isInGeneratedCode)(text, diagnostic.start, diagnostic.start + diagnostic.length); }; } function isUnusedReactiveStatementLabel(diagnostic) { if (diagnostic.code !== DiagnosticCode.UNUSED_LABEL) { return false; } const diagNode = findDiagnosticNode(diagnostic); if (!diagNode) { return false; } if (!typescript_1.default.isIdentifier(diagNode)) { return false; } if (!diagNode.parent) { return false; } return (0, utils$1.isReactiveStatement)(diagNode.parent); } function resolveNoopsInReactiveStatements(lang, diagnostics) { const isLet = (file) => (node) => { const defs = lang.getDefinitionAtPosition(file.fileName, node.getStart()); return !!defs && defs.some((def) => def.fileName === file.fileName && def.kind === 'let'); }; const expandRemainingNoopWarnings = (diagnostic) => { const { code, file } = diagnostic; if (!file) { return; } const isNoopDiag = code === DiagnosticCode.NOOP_IN_COMMAS; if (!isNoopDiag) { return; } const diagNode = findDiagnosticNode(diagnostic); if (!diagNode) { return; } if (!(0, utils$1.isInReactiveStatement)(diagNode)) { return; } return ( (0, utils$1.gatherIdentifiers)(diagNode) .filter((0, utils$4.not)(isLet(file))) .map(copyDiagnosticAndChangeNode(diagnostic))); }; const expandedDiagnostics = (0, utils$4.flatten)((0, utils$4.passMap)(diagnostics, expandRemainingNoopWarnings)); return expandedDiagnostics.length === diagnostics.length ? expandedDiagnostics : expandedDiagnostics.filter(dedupDiagnostics()); } function dedupDiagnostics() { const hashDiagnostic = (diag) => [diag.start, diag.length, diag.category, diag.source, diag.code] .map((x) => JSON.stringify(x)) .join(':'); const known = new Set(); return (diag) => { const key = hashDiagnostic(diag); if (known.has(key)) { return false; } else { known.add(key); return true; } }; } }); getDefaultExportFromCjs(DiagnosticsProvider); var FindFileReferencesProvider = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.FindFileReferencesProviderImpl = void 0; class FindFileReferencesProviderImpl { constructor(lsAndTsDocResolver) { this.lsAndTsDocResolver = lsAndTsDocResolver; } async fileReferences(uri) { const u = vscode_uri_1.URI.parse(uri); const fileName = u.fsPath; const lang = await this.getLSForPath(fileName); const tsDoc = await this.getSnapshotForPath(fileName); const references = lang.getFileReferences(fileName); if (!references) { return null; } const snapshots = new utils$1.SnapshotMap(this.lsAndTsDocResolver); snapshots.set(tsDoc.filePath, tsDoc); const locations = await Promise.all(references.map(async (ref) => { const snapshot = await snapshots.retrieve(ref.fileName); return main$4.Location.create((0, utils$4.pathToUrl)(ref.fileName), (0, utils$2.convertToLocationRange)(snapshot, ref.textSpan)); })); return locations.filter(utils$2.hasNonZeroRange); } async getLSForPath(path) { return this.lsAndTsDocResolver.getLSForPath(path); } async getSnapshotForPath(path) { return this.lsAndTsDocResolver.getSnapshot(path); } } exports.FindFileReferencesProviderImpl = FindFileReferencesProviderImpl; }); getDefaultExportFromCjs(FindFileReferencesProvider); var FindComponentReferencesProvider = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.FindComponentReferencesProviderImpl = void 0; const COMPONENT_SUFFIX = '__SvelteComponent_'; class FindComponentReferencesProviderImpl { constructor(lsAndTsDocResolver) { this.lsAndTsDocResolver = lsAndTsDocResolver; } async findComponentReferences(uri) { const fileName = (0, utils$4.urlToPath)(uri); if (!fileName) { return null; } const lang = await this.lsAndTsDocResolver.getLSForPath(fileName); const tsDoc = await this.lsAndTsDocResolver.getSnapshot(fileName); if (!(tsDoc instanceof DocumentSnapshot_1.SvelteDocumentSnapshot)) { return null; } const references = lang.findReferences(tsDoc.filePath, this.offsetOfComponentExport(tsDoc)); if (!references) { return null; } const snapshots = new utils$1.SnapshotMap(this.lsAndTsDocResolver); snapshots.set(tsDoc.filePath, tsDoc); const locations = await Promise.all((0, utils$4.flatten)(references.map((ref) => ref.references)).map(async (ref) => { if (ref.isDefinition) { return null; } const snapshot = await snapshots.retrieve(ref.fileName); if ((0, utils$1.isTextSpanInGeneratedCode)(snapshot.getFullText(), ref.textSpan)) { return null; } const refLocation = main$4.Location.create((0, utils$4.pathToUrl)(ref.fileName), (0, utils$2.convertToLocationRange)(snapshot, ref.textSpan)); if (this.isEndTag(refLocation, snapshot)) { return null; } if (!(0, utils$2.hasNonZeroRange)(refLocation)) { return null; } return refLocation; })); return locations.filter(utils$4.isNotNullOrUndefined); } offsetOfComponentExport(snapshot) { return snapshot.getFullText().lastIndexOf(COMPONENT_SUFFIX); } isEndTag(element, snapshot) { if (!(snapshot instanceof DocumentSnapshot_1.SvelteDocumentSnapshot)) { return false; } const testEndTagRange = main$4.Range.create(main$4.Position.create(element.range.start.line, element.range.start.character - 1), element.range.end); const text = snapshot.getOriginalText(testEndTagRange); if (text.substring(0, 1) == '/') { return true; } return false; } } exports.FindComponentReferencesProviderImpl = FindComponentReferencesProviderImpl; }); getDefaultExportFromCjs(FindComponentReferencesProvider); var FindReferencesProvider = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.FindReferencesProviderImpl = void 0; class FindReferencesProviderImpl { constructor(lsAndTsDocResolver) { this.lsAndTsDocResolver = lsAndTsDocResolver; } async findReferences(document, position, context) { const { lang, tsDoc } = await this.getLSAndTSDoc(document); const rawReferences = lang.findReferences(tsDoc.filePath, tsDoc.offsetAt(tsDoc.getGeneratedPosition(position))); if (!rawReferences) { return null; } const snapshots = new utils$1.SnapshotMap(this.lsAndTsDocResolver); snapshots.set(tsDoc.filePath, tsDoc); const references = (0, utils$4.flatten)(rawReferences.map((ref) => ref.references)); references.push(...(await this.getStoreReferences(references, tsDoc, snapshots, lang))); const locations = await Promise.all(references.map(async (ref) => this.mapReference(ref, context, snapshots))); return (locations .filter(utils$4.isNotNullOrUndefined) .sort(sortLocationByFileAndRange)); } async getStoreReferences(references, tsDoc, snapshots, lang) { let storeReferences = []; const storeReference = references.find((ref) => ref.fileName === tsDoc.filePath && (0, utils$1.isTextSpanInGeneratedCode)(tsDoc.getFullText(), ref.textSpan) && (0, utils$1.is$storeVariableIn$storeDeclaration)(tsDoc.getFullText(), ref.textSpan.start)); if (storeReference) { const additionalReferences = lang.findReferences(tsDoc.filePath, (0, utils$1.getStoreOffsetOf$storeDeclaration)(tsDoc.getFullText(), storeReference.textSpan.start)) || []; storeReferences = (0, utils$4.flatten)(additionalReferences.map((ref) => ref.references)); } const $storeReferences = []; for (const ref of [...references, ...storeReferences]) { const snapshot = await snapshots.retrieve(ref.fileName); if (!((0, utils$1.isTextSpanInGeneratedCode)(snapshot.getFullText(), ref.textSpan) && (0, utils$1.isStoreVariableIn$storeDeclaration)(snapshot.getFullText(), ref.textSpan.start))) { continue; } if ((storeReference === null || storeReference === void 0 ? void 0 : storeReference.fileName) === ref.fileName) { continue; } const additionalReferences = lang.findReferences(snapshot.filePath, (0, utils$1.get$storeOffsetOf$storeDeclaration)(snapshot.getFullText(), ref.textSpan.start)) || []; $storeReferences.push(...(0, utils$4.flatten)(additionalReferences.map((ref) => ref.references))); } return [...storeReferences, ...$storeReferences]; } async mapReference(ref, context, snapshots) { if (!context.includeDeclaration && ref.isDefinition) { return null; } const snapshot = await snapshots.retrieve(ref.fileName); if ((0, utils$1.isTextSpanInGeneratedCode)(snapshot.getFullText(), ref.textSpan)) { return null; } const location = main$4.Location.create((0, utils$4.pathToUrl)(ref.fileName), (0, utils$2.convertToLocationRange)(snapshot, ref.textSpan)); if (!(0, utils$2.hasNonZeroRange)(location)) { return null; } return location; } async getLSAndTSDoc(document) { return this.lsAndTsDocResolver.getLSAndTSDoc(document); } } exports.FindReferencesProviderImpl = FindReferencesProviderImpl; function sortLocationByFileAndRange(l1, l2) { const localeCompare = l1.uri.localeCompare(l2.uri); return localeCompare === 0 ? (l1.range.start.line - l2.range.start.line) * 10000 + (l1.range.start.character - l2.range.start.character) : localeCompare; } }); getDefaultExportFromCjs(FindReferencesProvider); var getDirectiveCommentCompletions_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getDirectiveCommentCompletions = exports.tsDirectives = void 0; exports.tsDirectives = [ { value: '@ts-check', description: 'Enables semantic checking in a JavaScript file. Must be at the top of a file.' }, { value: '@ts-nocheck', description: 'Disables semantic checking in a JavaScript file. Must be at the top of a file.' }, { value: '@ts-ignore', description: 'Suppresses @ts-check errors on the next line of a file.' }, { value: '@ts-expect-error', description: 'Suppresses @ts-check errors on the next line of a file, expecting at least one to exist.' } ]; function getDirectiveCommentCompletions(position, document, completionContext) { var _a, _b; if ((completionContext === null || completionContext === void 0 ? void 0 : completionContext.triggerCharacter) === '/') { return null; } const inScript = (0, documents.isInTag)(position, document.scriptInfo); const inModule = (0, documents.isInTag)(position, document.moduleScriptInfo); if (!inModule && !inScript) { return null; } const lineStart = document.offsetAt(main$4.Position.create(position.line, 0)); const offset = document.offsetAt(position); const prefix = document.getText().slice(lineStart, offset); const match = prefix.match(/^\s*\/\/+\s?(@[a-zA-Z-]*)?$/); if (!match) { return null; } const startCharacter = Math.max(0, position.character - ((_b = (_a = match[1]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0)); const start = main$4.Position.create(position.line, startCharacter); const items = exports.tsDirectives.map(({ value, description }) => ({ detail: description, label: value, kind: main$4.CompletionItemKind.Snippet, textEdit: main$4.TextEdit.replace(main$4.Range.create(start, main$4.Position.create(start.line, start.character + value.length)), value) })); return main$4.CompletionList.create(items, false); } exports.getDirectiveCommentCompletions = getDirectiveCommentCompletions; }); getDefaultExportFromCjs(getDirectiveCommentCompletions_1); var HoverProvider = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HoverProviderImpl = void 0; const typescript_1 = __importDefault(ts__default__default['default']); class HoverProviderImpl { constructor(lsAndTsDocResolver) { this.lsAndTsDocResolver = lsAndTsDocResolver; } async doHover(document, position) { const { lang, tsDoc } = await this.getLSAndTSDoc(document); const eventHoverInfo = this.getEventHoverInfo(lang, document, tsDoc, position); if (eventHoverInfo) { return eventHoverInfo; } const offset = tsDoc.offsetAt(tsDoc.getGeneratedPosition(position)); const info = lang.getQuickInfoAtPosition(tsDoc.filePath, offset); if (!info) { return null; } const declaration = typescript_1.default.displayPartsToString(info.displayParts); const documentation = (0, previewer.getMarkdownDocumentation)(info.documentation, info.tags); const contents = ['```typescript', declaration, '```'] .concat(documentation ? ['---', documentation] : []) .join('\n'); return (0, documents.mapObjWithRangeToOriginal)(tsDoc, { range: (0, utils$2.convertRange)(tsDoc, info.textSpan), contents }); } getEventHoverInfo(lang, doc, tsDoc, originalPosition) { const possibleEventName = (0, documents.getWordAt)(doc.getText(), doc.offsetAt(originalPosition), { left: /\S+$/, right: /[\s=]/ }); if (!possibleEventName.startsWith('on:')) { return null; } const component = (0, utils$1.getComponentAtPosition)(lang, doc, tsDoc, originalPosition); if (!component) { return null; } const eventName = possibleEventName.substr('on:'.length); const event = component.getEvents().find((event) => event.name === eventName); if (!event) { return null; } return { contents: [ '```typescript', `${event.name}: ${event.type}`, '```', event.doc || '' ].join('\n') }; } async getLSAndTSDoc(document) { return this.lsAndTsDocResolver.getLSAndTSDoc(document); } } exports.HoverProviderImpl = HoverProviderImpl; }); getDefaultExportFromCjs(HoverProvider); var ral = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); let _ral; function RAL() { if (_ral === undefined) { throw new Error(`No runtime abstraction layer installed`); } return _ral; } (function (RAL) { function install(ral) { if (ral === undefined) { throw new Error(`No runtime abstraction layer provided`); } _ral = ral; } RAL.install = install; })(RAL || (RAL = {})); exports.default = RAL; }); getDefaultExportFromCjs(ral); var disposable = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Disposable = void 0; (function (Disposable) { function create(func) { return { dispose: func }; } Disposable.create = create; })(exports.Disposable || (exports.Disposable = {})); }); getDefaultExportFromCjs(disposable); var messageBuffer = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.AbstractMessageBuffer = void 0; const CR = 13; const LF = 10; const CRLF = '\r\n'; class AbstractMessageBuffer { constructor(encoding = 'utf-8') { this._encoding = encoding; this._chunks = []; this._totalLength = 0; } get encoding() { return this._encoding; } append(chunk) { const toAppend = typeof chunk === 'string' ? this.fromString(chunk, this._encoding) : chunk; this._chunks.push(toAppend); this._totalLength += toAppend.byteLength; } tryReadHeaders() { if (this._chunks.length === 0) { return undefined; } let state = 0; let chunkIndex = 0; let offset = 0; let chunkBytesRead = 0; row: while (chunkIndex < this._chunks.length) { const chunk = this._chunks[chunkIndex]; offset = 0; while (offset < chunk.length) { const value = chunk[offset]; switch (value) { case CR: switch (state) { case 0: state = 1; break; case 2: state = 3; break; default: state = 0; } break; case LF: switch (state) { case 1: state = 2; break; case 3: state = 4; offset++; break row; default: state = 0; } break; default: state = 0; } offset++; } chunkBytesRead += chunk.byteLength; chunkIndex++; } if (state !== 4) { return undefined; } const buffer = this._read(chunkBytesRead + offset); const result = new Map(); const headers = this.toString(buffer, 'ascii').split(CRLF); if (headers.length < 2) { return result; } for (let i = 0; i < headers.length - 2; i++) { const header = headers[i]; const index = header.indexOf(':'); if (index === -1) { throw new Error('Message header must separate key and value using :'); } const key = header.substr(0, index); const value = header.substr(index + 1).trim(); result.set(key, value); } return result; } tryReadBody(length) { if (this._totalLength < length) { return undefined; } return this._read(length); } get numberOfBytes() { return this._totalLength; } _read(byteCount) { if (byteCount === 0) { return this.emptyBuffer(); } if (byteCount > this._totalLength) { throw new Error(`Cannot read so many bytes!`); } if (this._chunks[0].byteLength === byteCount) { const chunk = this._chunks[0]; this._chunks.shift(); this._totalLength -= byteCount; return this.asNative(chunk); } if (this._chunks[0].byteLength > byteCount) { const chunk = this._chunks[0]; const result = this.asNative(chunk, byteCount); this._chunks[0] = chunk.slice(byteCount); this._totalLength -= byteCount; return result; } const result = this.allocNative(byteCount); let resultOffset = 0; let chunkIndex = 0; while (byteCount > 0) { const chunk = this._chunks[chunkIndex]; if (chunk.byteLength > byteCount) { const chunkPart = chunk.slice(0, byteCount); result.set(chunkPart, resultOffset); resultOffset += byteCount; this._chunks[chunkIndex] = chunk.slice(byteCount); this._totalLength -= byteCount; byteCount -= byteCount; } else { result.set(chunk, resultOffset); resultOffset += chunk.byteLength; this._chunks.shift(); this._totalLength -= chunk.byteLength; byteCount -= chunk.byteLength; } } return result; } } exports.AbstractMessageBuffer = AbstractMessageBuffer; }); getDefaultExportFromCjs(messageBuffer); var ril = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); class MessageBuffer extends messageBuffer.AbstractMessageBuffer { constructor(encoding = 'utf-8') { super(encoding); } emptyBuffer() { return MessageBuffer.emptyBuffer; } fromString(value, encoding) { return Buffer.from(value, encoding); } toString(value, encoding) { if (value instanceof Buffer) { return value.toString(encoding); } else { return new util_1__default['default'].TextDecoder(encoding).decode(value); } } asNative(buffer, length) { if (length === undefined) { return buffer instanceof Buffer ? buffer : Buffer.from(buffer); } else { return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length); } } allocNative(length) { return Buffer.allocUnsafe(length); } } MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0); class ReadableStreamWrapper { constructor(stream) { this.stream = stream; } onClose(listener) { this.stream.on('close', listener); return disposable.Disposable.create(() => this.stream.off('close', listener)); } onError(listener) { this.stream.on('error', listener); return disposable.Disposable.create(() => this.stream.off('error', listener)); } onEnd(listener) { this.stream.on('end', listener); return disposable.Disposable.create(() => this.stream.off('end', listener)); } onData(listener) { this.stream.on('data', listener); return disposable.Disposable.create(() => this.stream.off('data', listener)); } } class WritableStreamWrapper { constructor(stream) { this.stream = stream; } onClose(listener) { this.stream.on('close', listener); return disposable.Disposable.create(() => this.stream.off('close', listener)); } onError(listener) { this.stream.on('error', listener); return disposable.Disposable.create(() => this.stream.off('error', listener)); } onEnd(listener) { this.stream.on('end', listener); return disposable.Disposable.create(() => this.stream.off('end', listener)); } write(data, encoding) { return new Promise((resolve, reject) => { const callback = (error) => { if (error === undefined || error === null) { resolve(); } else { reject(error); } }; if (typeof data === 'string') { this.stream.write(data, encoding, callback); } else { this.stream.write(data, callback); } }); } end() { this.stream.end(); } } const _ril = Object.freeze({ messageBuffer: Object.freeze({ create: (encoding) => new MessageBuffer(encoding) }), applicationJson: Object.freeze({ encoder: Object.freeze({ name: 'application/json', encode: (msg, options) => { try { return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset)); } catch (err) { return Promise.reject(err); } } }), decoder: Object.freeze({ name: 'application/json', decode: (buffer, options) => { try { if (buffer instanceof Buffer) { return Promise.resolve(JSON.parse(buffer.toString(options.charset))); } else { return Promise.resolve(JSON.parse(new util_1__default['default'].TextDecoder(options.charset).decode(buffer))); } } catch (err) { return Promise.reject(err); } } }) }), stream: Object.freeze({ asReadableStream: (stream) => new ReadableStreamWrapper(stream), asWritableStream: (stream) => new WritableStreamWrapper(stream) }), console: console, timer: Object.freeze({ setTimeout(callback, ms, ...args) { return setTimeout(callback, ms, ...args); }, clearTimeout(handle) { clearTimeout(handle); }, setImmediate(callback, ...args) { return setImmediate(callback, ...args); }, clearImmediate(handle) { clearImmediate(handle); } }) }); function RIL() { return _ril; } (function (RIL) { function install() { ral.default.install(_ril); } RIL.install = install; })(RIL || (RIL = {})); exports.default = RIL; }); getDefaultExportFromCjs(ril); var is$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; function boolean(value) { return value === true || value === false; } exports.boolean = boolean; function string(value) { return typeof value === 'string' || value instanceof String; } exports.string = string; function number(value) { return typeof value === 'number' || value instanceof Number; } exports.number = number; function error(value) { return value instanceof Error; } exports.error = error; function func(value) { return typeof value === 'function'; } exports.func = func; function array(value) { return Array.isArray(value); } exports.array = array; function stringArray(value) { return array(value) && value.every(elem => string(elem)); } exports.stringArray = stringArray; }); getDefaultExportFromCjs(is$1); var messages$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isResponseMessage = exports.isNotificationMessage = exports.isRequestMessage = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0; var ErrorCodes; (function (ErrorCodes) { ErrorCodes.ParseError = -32700; ErrorCodes.InvalidRequest = -32600; ErrorCodes.MethodNotFound = -32601; ErrorCodes.InvalidParams = -32602; ErrorCodes.InternalError = -32603; ErrorCodes.jsonrpcReservedErrorRangeStart = -32099; ErrorCodes.serverErrorStart = ErrorCodes.jsonrpcReservedErrorRangeStart; ErrorCodes.MessageWriteError = -32099; ErrorCodes.MessageReadError = -32098; ErrorCodes.ServerNotInitialized = -32002; ErrorCodes.UnknownErrorCode = -32001; ErrorCodes.jsonrpcReservedErrorRangeEnd = -32000; ErrorCodes.serverErrorEnd = ErrorCodes.jsonrpcReservedErrorRangeEnd; })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {})); class ResponseError extends Error { constructor(code, message, data) { super(message); this.code = is$1.number(code) ? code : ErrorCodes.UnknownErrorCode; this.data = data; Object.setPrototypeOf(this, ResponseError.prototype); } toJson() { return { code: this.code, message: this.message, data: this.data, }; } } exports.ResponseError = ResponseError; class ParameterStructures { constructor(kind) { this.kind = kind; } static is(value) { return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition; } toString() { return this.kind; } } exports.ParameterStructures = ParameterStructures; ParameterStructures.auto = new ParameterStructures('auto'); ParameterStructures.byPosition = new ParameterStructures('byPosition'); ParameterStructures.byName = new ParameterStructures('byName'); class AbstractMessageSignature { constructor(method, numberOfParams) { this.method = method; this.numberOfParams = numberOfParams; } get parameterStructures() { return ParameterStructures.auto; } } exports.AbstractMessageSignature = AbstractMessageSignature; class RequestType0 extends AbstractMessageSignature { constructor(method) { super(method, 0); } } exports.RequestType0 = RequestType0; class RequestType extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } } exports.RequestType = RequestType; class RequestType1 extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } } exports.RequestType1 = RequestType1; class RequestType2 extends AbstractMessageSignature { constructor(method) { super(method, 2); } } exports.RequestType2 = RequestType2; class RequestType3 extends AbstractMessageSignature { constructor(method) { super(method, 3); } } exports.RequestType3 = RequestType3; class RequestType4 extends AbstractMessageSignature { constructor(method) { super(method, 4); } } exports.RequestType4 = RequestType4; class RequestType5 extends AbstractMessageSignature { constructor(method) { super(method, 5); } } exports.RequestType5 = RequestType5; class RequestType6 extends AbstractMessageSignature { constructor(method) { super(method, 6); } } exports.RequestType6 = RequestType6; class RequestType7 extends AbstractMessageSignature { constructor(method) { super(method, 7); } } exports.RequestType7 = RequestType7; class RequestType8 extends AbstractMessageSignature { constructor(method) { super(method, 8); } } exports.RequestType8 = RequestType8; class RequestType9 extends AbstractMessageSignature { constructor(method) { super(method, 9); } } exports.RequestType9 = RequestType9; class NotificationType extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } } exports.NotificationType = NotificationType; class NotificationType0 extends AbstractMessageSignature { constructor(method) { super(method, 0); } } exports.NotificationType0 = NotificationType0; class NotificationType1 extends AbstractMessageSignature { constructor(method, _parameterStructures = ParameterStructures.auto) { super(method, 1); this._parameterStructures = _parameterStructures; } get parameterStructures() { return this._parameterStructures; } } exports.NotificationType1 = NotificationType1; class NotificationType2 extends AbstractMessageSignature { constructor(method) { super(method, 2); } } exports.NotificationType2 = NotificationType2; class NotificationType3 extends AbstractMessageSignature { constructor(method) { super(method, 3); } } exports.NotificationType3 = NotificationType3; class NotificationType4 extends AbstractMessageSignature { constructor(method) { super(method, 4); } } exports.NotificationType4 = NotificationType4; class NotificationType5 extends AbstractMessageSignature { constructor(method) { super(method, 5); } } exports.NotificationType5 = NotificationType5; class NotificationType6 extends AbstractMessageSignature { constructor(method) { super(method, 6); } } exports.NotificationType6 = NotificationType6; class NotificationType7 extends AbstractMessageSignature { constructor(method) { super(method, 7); } } exports.NotificationType7 = NotificationType7; class NotificationType8 extends AbstractMessageSignature { constructor(method) { super(method, 8); } } exports.NotificationType8 = NotificationType8; class NotificationType9 extends AbstractMessageSignature { constructor(method) { super(method, 9); } } exports.NotificationType9 = NotificationType9; function isRequestMessage(message) { const candidate = message; return candidate && is$1.string(candidate.method) && (is$1.string(candidate.id) || is$1.number(candidate.id)); } exports.isRequestMessage = isRequestMessage; function isNotificationMessage(message) { const candidate = message; return candidate && is$1.string(candidate.method) && message.id === void 0; } exports.isNotificationMessage = isNotificationMessage; function isResponseMessage(message) { const candidate = message; return candidate && (candidate.result !== void 0 || !!candidate.error) && (is$1.string(candidate.id) || is$1.number(candidate.id) || candidate.id === null); } exports.isResponseMessage = isResponseMessage; }); getDefaultExportFromCjs(messages$1); var events = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Emitter = exports.Event = void 0; (function (Event) { const _disposable = { dispose() { } }; Event.None = function () { return _disposable; }; })(exports.Event || (exports.Event = {})); class CallbackList { add(callback, context = null, bucket) { if (!this._callbacks) { this._callbacks = []; this._contexts = []; } this._callbacks.push(callback); this._contexts.push(context); if (Array.isArray(bucket)) { bucket.push({ dispose: () => this.remove(callback, context) }); } } remove(callback, context = null) { if (!this._callbacks) { return; } let foundCallbackWithDifferentContext = false; for (let i = 0, len = this._callbacks.length; i < len; i++) { if (this._callbacks[i] === callback) { if (this._contexts[i] === context) { this._callbacks.splice(i, 1); this._contexts.splice(i, 1); return; } else { foundCallbackWithDifferentContext = true; } } } if (foundCallbackWithDifferentContext) { throw new Error('When adding a listener with a context, you should remove it with the same context'); } } invoke(...args) { if (!this._callbacks) { return []; } const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); for (let i = 0, len = callbacks.length; i < len; i++) { try { ret.push(callbacks[i].apply(contexts[i], args)); } catch (e) { ral.default().console.error(e); } } return ret; } isEmpty() { return !this._callbacks || this._callbacks.length === 0; } dispose() { this._callbacks = undefined; this._contexts = undefined; } } class Emitter { constructor(_options) { this._options = _options; } get event() { if (!this._event) { this._event = (listener, thisArgs, disposables) => { if (!this._callbacks) { this._callbacks = new CallbackList(); } if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { this._options.onFirstListenerAdd(this); } this._callbacks.add(listener, thisArgs); const result = { dispose: () => { if (!this._callbacks) { return; } this._callbacks.remove(listener, thisArgs); result.dispose = Emitter._noop; if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) { this._options.onLastListenerRemove(this); } } }; if (Array.isArray(disposables)) { disposables.push(result); } return result; }; } return this._event; } fire(event) { if (this._callbacks) { this._callbacks.invoke.call(this._callbacks, event); } } dispose() { if (this._callbacks) { this._callbacks.dispose(); this._callbacks = undefined; } } } exports.Emitter = Emitter; Emitter._noop = function () { }; }); getDefaultExportFromCjs(events); var cancellation = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.CancellationTokenSource = exports.CancellationToken = void 0; var CancellationToken; (function (CancellationToken) { CancellationToken.None = Object.freeze({ isCancellationRequested: false, onCancellationRequested: events.Event.None }); CancellationToken.Cancelled = Object.freeze({ isCancellationRequested: true, onCancellationRequested: events.Event.None }); function is(value) { const candidate = value; return candidate && (candidate === CancellationToken.None || candidate === CancellationToken.Cancelled || (is$1.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested)); } CancellationToken.is = is; })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {})); const shortcutEvent = Object.freeze(function (callback, context) { const handle = ral.default().timer.setTimeout(callback.bind(context), 0); return { dispose() { ral.default().timer.clearTimeout(handle); } }; }); class MutableToken { constructor() { this._isCancelled = false; } cancel() { if (!this._isCancelled) { this._isCancelled = true; if (this._emitter) { this._emitter.fire(undefined); this.dispose(); } } } get isCancellationRequested() { return this._isCancelled; } get onCancellationRequested() { if (this._isCancelled) { return shortcutEvent; } if (!this._emitter) { this._emitter = new events.Emitter(); } return this._emitter.event; } dispose() { if (this._emitter) { this._emitter.dispose(); this._emitter = undefined; } } } class CancellationTokenSource { get token() { if (!this._token) { this._token = new MutableToken(); } return this._token; } cancel() { if (!this._token) { this._token = CancellationToken.Cancelled; } else { this._token.cancel(); } } dispose() { if (!this._token) { this._token = CancellationToken.None; } else if (this._token instanceof MutableToken) { this._token.dispose(); } } } exports.CancellationTokenSource = CancellationTokenSource; }); getDefaultExportFromCjs(cancellation); var messageReader = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0; (function (MessageReader) { function is(value) { let candidate = value; return candidate && is$1.func(candidate.listen) && is$1.func(candidate.dispose) && is$1.func(candidate.onError) && is$1.func(candidate.onClose) && is$1.func(candidate.onPartialMessage); } MessageReader.is = is; })(exports.MessageReader || (exports.MessageReader = {})); class AbstractMessageReader { constructor() { this.errorEmitter = new events.Emitter(); this.closeEmitter = new events.Emitter(); this.partialMessageEmitter = new events.Emitter(); } dispose() { this.errorEmitter.dispose(); this.closeEmitter.dispose(); } get onError() { return this.errorEmitter.event; } fireError(error) { this.errorEmitter.fire(this.asError(error)); } get onClose() { return this.closeEmitter.event; } fireClose() { this.closeEmitter.fire(undefined); } get onPartialMessage() { return this.partialMessageEmitter.event; } firePartialMessage(info) { this.partialMessageEmitter.fire(info); } asError(error) { if (error instanceof Error) { return error; } else { return new Error(`Reader received error. Reason: ${is$1.string(error.message) ? error.message : 'unknown'}`); } } } exports.AbstractMessageReader = AbstractMessageReader; var ResolvedMessageReaderOptions; (function (ResolvedMessageReaderOptions) { function fromOptions(options) { var _a; let charset; let contentDecoder; const contentDecoders = new Map(); let contentTypeDecoder; const contentTypeDecoders = new Map(); if (options === undefined || typeof options === 'string') { charset = options !== null && options !== void 0 ? options : 'utf-8'; } else { charset = (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8'; if (options.contentDecoder !== undefined) { contentDecoder = options.contentDecoder; contentDecoders.set(contentDecoder.name, contentDecoder); } if (options.contentDecoders !== undefined) { for (const decoder of options.contentDecoders) { contentDecoders.set(decoder.name, decoder); } } if (options.contentTypeDecoder !== undefined) { contentTypeDecoder = options.contentTypeDecoder; contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); } if (options.contentTypeDecoders !== undefined) { for (const decoder of options.contentTypeDecoders) { contentTypeDecoders.set(decoder.name, decoder); } } } if (contentTypeDecoder === undefined) { contentTypeDecoder = ral.default().applicationJson.decoder; contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); } return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders }; } ResolvedMessageReaderOptions.fromOptions = fromOptions; })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {})); class ReadableStreamMessageReader extends AbstractMessageReader { constructor(readable, options) { super(); this.readable = readable; this.options = ResolvedMessageReaderOptions.fromOptions(options); this.buffer = ral.default().messageBuffer.create(this.options.charset); this._partialMessageTimeout = 10000; this.nextMessageLength = -1; this.messageToken = 0; } set partialMessageTimeout(timeout) { this._partialMessageTimeout = timeout; } get partialMessageTimeout() { return this._partialMessageTimeout; } listen(callback) { this.nextMessageLength = -1; this.messageToken = 0; this.partialMessageTimer = undefined; this.callback = callback; const result = this.readable.onData((data) => { this.onData(data); }); this.readable.onError((error) => this.fireError(error)); this.readable.onClose(() => this.fireClose()); return result; } onData(data) { this.buffer.append(data); while (true) { if (this.nextMessageLength === -1) { const headers = this.buffer.tryReadHeaders(); if (!headers) { return; } const contentLength = headers.get('Content-Length'); if (!contentLength) { throw new Error('Header must provide a Content-Length property.'); } const length = parseInt(contentLength); if (isNaN(length)) { throw new Error('Content-Length value must be a number.'); } this.nextMessageLength = length; } const body = this.buffer.tryReadBody(this.nextMessageLength); if (body === undefined) { this.setPartialMessageTimer(); return; } this.clearPartialMessageTimer(); this.nextMessageLength = -1; let p; if (this.options.contentDecoder !== undefined) { p = this.options.contentDecoder.decode(body); } else { p = Promise.resolve(body); } p.then((value) => { this.options.contentTypeDecoder.decode(value, this.options).then((msg) => { this.callback(msg); }, (error) => { this.fireError(error); }); }, (error) => { this.fireError(error); }); } } clearPartialMessageTimer() { if (this.partialMessageTimer) { ral.default().timer.clearTimeout(this.partialMessageTimer); this.partialMessageTimer = undefined; } } setPartialMessageTimer() { this.clearPartialMessageTimer(); if (this._partialMessageTimeout <= 0) { return; } this.partialMessageTimer = ral.default().timer.setTimeout((token, timeout) => { this.partialMessageTimer = undefined; if (token === this.messageToken) { this.firePartialMessage({ messageToken: token, waitingTime: timeout }); this.setPartialMessageTimer(); } }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); } } exports.ReadableStreamMessageReader = ReadableStreamMessageReader; }); getDefaultExportFromCjs(messageReader); var semaphore = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Semaphore = void 0; class Semaphore { constructor(capacity = 1) { if (capacity <= 0) { throw new Error('Capacity must be greater than 0'); } this._capacity = capacity; this._active = 0; this._waiting = []; } lock(thunk) { return new Promise((resolve, reject) => { this._waiting.push({ thunk, resolve, reject }); this.runNext(); }); } get active() { return this._active; } runNext() { if (this._waiting.length === 0 || this._active === this._capacity) { return; } ral.default().timer.setImmediate(() => this.doRunNext()); } doRunNext() { if (this._waiting.length === 0 || this._active === this._capacity) { return; } const next = this._waiting.shift(); this._active++; if (this._active > this._capacity) { throw new Error(`To many thunks active`); } try { const result = next.thunk(); if (result instanceof Promise) { result.then((value) => { this._active--; next.resolve(value); this.runNext(); }, (err) => { this._active--; next.reject(err); this.runNext(); }); } else { this._active--; next.resolve(result); this.runNext(); } } catch (err) { this._active--; next.reject(err); this.runNext(); } } } exports.Semaphore = Semaphore; }); getDefaultExportFromCjs(semaphore); var messageWriter = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0; const ContentLength = 'Content-Length: '; const CRLF = '\r\n'; (function (MessageWriter) { function is(value) { let candidate = value; return candidate && is$1.func(candidate.dispose) && is$1.func(candidate.onClose) && is$1.func(candidate.onError) && is$1.func(candidate.write); } MessageWriter.is = is; })(exports.MessageWriter || (exports.MessageWriter = {})); class AbstractMessageWriter { constructor() { this.errorEmitter = new events.Emitter(); this.closeEmitter = new events.Emitter(); } dispose() { this.errorEmitter.dispose(); this.closeEmitter.dispose(); } get onError() { return this.errorEmitter.event; } fireError(error, message, count) { this.errorEmitter.fire([this.asError(error), message, count]); } get onClose() { return this.closeEmitter.event; } fireClose() { this.closeEmitter.fire(undefined); } asError(error) { if (error instanceof Error) { return error; } else { return new Error(`Writer received error. Reason: ${is$1.string(error.message) ? error.message : 'unknown'}`); } } } exports.AbstractMessageWriter = AbstractMessageWriter; var ResolvedMessageWriterOptions; (function (ResolvedMessageWriterOptions) { function fromOptions(options) { var _a, _b; if (options === undefined || typeof options === 'string') { return { charset: options !== null && options !== void 0 ? options : 'utf-8', contentTypeEncoder: ral.default().applicationJson.encoder }; } else { return { charset: (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8', contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) !== null && _b !== void 0 ? _b : ral.default().applicationJson.encoder }; } } ResolvedMessageWriterOptions.fromOptions = fromOptions; })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {})); class WriteableStreamMessageWriter extends AbstractMessageWriter { constructor(writable, options) { super(); this.writable = writable; this.options = ResolvedMessageWriterOptions.fromOptions(options); this.errorCount = 0; this.writeSemaphore = new semaphore.Semaphore(1); this.writable.onError((error) => this.fireError(error)); this.writable.onClose(() => this.fireClose()); } async write(msg) { return this.writeSemaphore.lock(async () => { const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => { if (this.options.contentEncoder !== undefined) { return this.options.contentEncoder.encode(buffer); } else { return buffer; } }); return payload.then((buffer) => { const headers = []; headers.push(ContentLength, buffer.byteLength.toString(), CRLF); headers.push(CRLF); return this.doWrite(msg, headers, buffer); }, (error) => { this.fireError(error); throw error; }); }); } async doWrite(msg, headers, data) { try { await this.writable.write(headers.join(''), 'ascii'); return this.writable.write(data); } catch (error) { this.handleError(error, msg); return Promise.reject(error); } } handleError(error, msg) { this.errorCount++; this.fireError(error, msg, this.errorCount); } end() { this.writable.end(); } } exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter; }); getDefaultExportFromCjs(messageWriter); var linkedMap = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.LRUCache = exports.LinkedMap = exports.Touch = void 0; var Touch; (function (Touch) { Touch.None = 0; Touch.First = 1; Touch.AsOld = Touch.First; Touch.Last = 2; Touch.AsNew = Touch.Last; })(Touch = exports.Touch || (exports.Touch = {})); class LinkedMap { constructor() { this[Symbol.toStringTag] = 'LinkedMap'; this._map = new Map(); this._head = undefined; this._tail = undefined; this._size = 0; this._state = 0; } clear() { this._map.clear(); this._head = undefined; this._tail = undefined; this._size = 0; this._state++; } isEmpty() { return !this._head && !this._tail; } get size() { return this._size; } get first() { var _a; return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value; } get last() { var _a; return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value; } has(key) { return this._map.has(key); } get(key, touch = Touch.None) { const item = this._map.get(key); if (!item) { return undefined; } if (touch !== Touch.None) { this.touch(item, touch); } return item.value; } set(key, value, touch = Touch.None) { let item = this._map.get(key); if (item) { item.value = value; if (touch !== Touch.None) { this.touch(item, touch); } } else { item = { key, value, next: undefined, previous: undefined }; switch (touch) { case Touch.None: this.addItemLast(item); break; case Touch.First: this.addItemFirst(item); break; case Touch.Last: this.addItemLast(item); break; default: this.addItemLast(item); break; } this._map.set(key, item); this._size++; } return this; } delete(key) { return !!this.remove(key); } remove(key) { const item = this._map.get(key); if (!item) { return undefined; } this._map.delete(key); this.removeItem(item); this._size--; return item.value; } shift() { if (!this._head && !this._tail) { return undefined; } if (!this._head || !this._tail) { throw new Error('Invalid list'); } const item = this._head; this._map.delete(item.key); this.removeItem(item); this._size--; return item.value; } forEach(callbackfn, thisArg) { const state = this._state; let current = this._head; while (current) { if (thisArg) { callbackfn.bind(thisArg)(current.value, current.key, this); } else { callbackfn(current.value, current.key, this); } if (this._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } current = current.next; } } keys() { const map = this; const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]() { return iterator; }, next() { if (map._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: current.key, done: false }; current = current.next; return result; } else { return { value: undefined, done: true }; } } }; return iterator; } values() { const map = this; const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]() { return iterator; }, next() { if (map._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: current.value, done: false }; current = current.next; return result; } else { return { value: undefined, done: true }; } } }; return iterator; } entries() { const map = this; const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]() { return iterator; }, next() { if (map._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: [current.key, current.value], done: false }; current = current.next; return result; } else { return { value: undefined, done: true }; } } }; return iterator; } [Symbol.iterator]() { return this.entries(); } trimOld(newSize) { if (newSize >= this.size) { return; } if (newSize === 0) { this.clear(); return; } let current = this._head; let currentSize = this.size; while (current && currentSize > newSize) { this._map.delete(current.key); current = current.next; currentSize--; } this._head = current; this._size = currentSize; if (current) { current.previous = undefined; } this._state++; } addItemFirst(item) { if (!this._head && !this._tail) { this._tail = item; } else if (!this._head) { throw new Error('Invalid list'); } else { item.next = this._head; this._head.previous = item; } this._head = item; this._state++; } addItemLast(item) { if (!this._head && !this._tail) { this._head = item; } else if (!this._tail) { throw new Error('Invalid list'); } else { item.previous = this._tail; this._tail.next = item; } this._tail = item; this._state++; } removeItem(item) { if (item === this._head && item === this._tail) { this._head = undefined; this._tail = undefined; } else if (item === this._head) { if (!item.next) { throw new Error('Invalid list'); } item.next.previous = undefined; this._head = item.next; } else if (item === this._tail) { if (!item.previous) { throw new Error('Invalid list'); } item.previous.next = undefined; this._tail = item.previous; } else { const next = item.next; const previous = item.previous; if (!next || !previous) { throw new Error('Invalid list'); } next.previous = previous; previous.next = next; } item.next = undefined; item.previous = undefined; this._state++; } touch(item, touch) { if (!this._head || !this._tail) { throw new Error('Invalid list'); } if ((touch !== Touch.First && touch !== Touch.Last)) { return; } if (touch === Touch.First) { if (item === this._head) { return; } const next = item.next; const previous = item.previous; if (item === this._tail) { previous.next = undefined; this._tail = previous; } else { next.previous = previous; previous.next = next; } item.previous = undefined; item.next = this._head; this._head.previous = item; this._head = item; this._state++; } else if (touch === Touch.Last) { if (item === this._tail) { return; } const next = item.next; const previous = item.previous; if (item === this._head) { next.previous = undefined; this._head = next; } else { next.previous = previous; previous.next = next; } item.next = undefined; item.previous = this._tail; this._tail.next = item; this._tail = item; this._state++; } } toJSON() { const data = []; this.forEach((value, key) => { data.push([key, value]); }); return data; } fromJSON(data) { this.clear(); for (const [key, value] of data) { this.set(key, value); } } } exports.LinkedMap = LinkedMap; class LRUCache extends LinkedMap { constructor(limit, ratio = 1) { super(); this._limit = limit; this._ratio = Math.min(Math.max(0, ratio), 1); } get limit() { return this._limit; } set limit(limit) { this._limit = limit; this.checkTrim(); } get ratio() { return this._ratio; } set ratio(ratio) { this._ratio = Math.min(Math.max(0, ratio), 1); this.checkTrim(); } get(key, touch = Touch.AsNew) { return super.get(key, touch); } peek(key) { return super.get(key, Touch.None); } set(key, value) { super.set(key, value, Touch.Last); this.checkTrim(); return this; } checkTrim() { if (this.size > this._limit) { this.trimOld(Math.round(this._limit * this._ratio)); } } } exports.LRUCache = LRUCache; }); getDefaultExportFromCjs(linkedMap); var connection$1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createMessageConnection = exports.ConnectionOptions = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.NullLogger = exports.ProgressType = void 0; var CancelNotification; (function (CancelNotification) { CancelNotification.type = new messages$1.NotificationType('$/cancelRequest'); })(CancelNotification || (CancelNotification = {})); var ProgressNotification; (function (ProgressNotification) { ProgressNotification.type = new messages$1.NotificationType('$/progress'); })(ProgressNotification || (ProgressNotification = {})); class ProgressType { constructor() { } } exports.ProgressType = ProgressType; var StarRequestHandler; (function (StarRequestHandler) { function is(value) { return is$1.func(value); } StarRequestHandler.is = is; })(StarRequestHandler || (StarRequestHandler = {})); exports.NullLogger = Object.freeze({ error: () => { }, warn: () => { }, info: () => { }, log: () => { } }); var Trace; (function (Trace) { Trace[Trace["Off"] = 0] = "Off"; Trace[Trace["Messages"] = 1] = "Messages"; Trace[Trace["Verbose"] = 2] = "Verbose"; })(Trace = exports.Trace || (exports.Trace = {})); (function (Trace) { function fromString(value) { if (!is$1.string(value)) { return Trace.Off; } value = value.toLowerCase(); switch (value) { case 'off': return Trace.Off; case 'messages': return Trace.Messages; case 'verbose': return Trace.Verbose; default: return Trace.Off; } } Trace.fromString = fromString; function toString(value) { switch (value) { case Trace.Off: return 'off'; case Trace.Messages: return 'messages'; case Trace.Verbose: return 'verbose'; default: return 'off'; } } Trace.toString = toString; })(Trace = exports.Trace || (exports.Trace = {})); var TraceFormat; (function (TraceFormat) { TraceFormat["Text"] = "text"; TraceFormat["JSON"] = "json"; })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); (function (TraceFormat) { function fromString(value) { value = value.toLowerCase(); if (value === 'json') { return TraceFormat.JSON; } else { return TraceFormat.Text; } } TraceFormat.fromString = fromString; })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); var SetTraceNotification; (function (SetTraceNotification) { SetTraceNotification.type = new messages$1.NotificationType('$/setTrace'); })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {})); var LogTraceNotification; (function (LogTraceNotification) { LogTraceNotification.type = new messages$1.NotificationType('$/logTrace'); })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {})); var ConnectionErrors; (function (ConnectionErrors) { ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed"; ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed"; ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening"; })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {})); class ConnectionError extends Error { constructor(code, message) { super(message); this.code = code; Object.setPrototypeOf(this, ConnectionError.prototype); } } exports.ConnectionError = ConnectionError; var ConnectionStrategy; (function (ConnectionStrategy) { function is(value) { const candidate = value; return candidate && is$1.func(candidate.cancelUndispatched); } ConnectionStrategy.is = is; })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {})); var CancellationReceiverStrategy; (function (CancellationReceiverStrategy) { CancellationReceiverStrategy.Message = Object.freeze({ createCancellationTokenSource(_) { return new cancellation.CancellationTokenSource(); } }); function is(value) { const candidate = value; return candidate && is$1.func(candidate.createCancellationTokenSource); } CancellationReceiverStrategy.is = is; })(CancellationReceiverStrategy = exports.CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = {})); var CancellationSenderStrategy; (function (CancellationSenderStrategy) { CancellationSenderStrategy.Message = Object.freeze({ sendCancellation(conn, id) { conn.sendNotification(CancelNotification.type, { id }); }, cleanup(_) { } }); function is(value) { const candidate = value; return candidate && is$1.func(candidate.sendCancellation) && is$1.func(candidate.cleanup); } CancellationSenderStrategy.is = is; })(CancellationSenderStrategy = exports.CancellationSenderStrategy || (exports.CancellationSenderStrategy = {})); var CancellationStrategy; (function (CancellationStrategy) { CancellationStrategy.Message = Object.freeze({ receiver: CancellationReceiverStrategy.Message, sender: CancellationSenderStrategy.Message }); function is(value) { const candidate = value; return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender); } CancellationStrategy.is = is; })(CancellationStrategy = exports.CancellationStrategy || (exports.CancellationStrategy = {})); (function (ConnectionOptions) { function is(value) { const candidate = value; return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy)); } ConnectionOptions.is = is; })(exports.ConnectionOptions || (exports.ConnectionOptions = {})); var ConnectionState; (function (ConnectionState) { ConnectionState[ConnectionState["New"] = 1] = "New"; ConnectionState[ConnectionState["Listening"] = 2] = "Listening"; ConnectionState[ConnectionState["Closed"] = 3] = "Closed"; ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed"; })(ConnectionState || (ConnectionState = {})); function createMessageConnection(messageReader, messageWriter, _logger, options) { const logger = _logger !== undefined ? _logger : exports.NullLogger; let sequenceNumber = 0; let notificationSquenceNumber = 0; let unknownResponseSquenceNumber = 0; const version = '2.0'; let starRequestHandler = undefined; const requestHandlers = Object.create(null); let starNotificationHandler = undefined; const notificationHandlers = Object.create(null); const progressHandlers = new Map(); let timer; let messageQueue = new linkedMap.LinkedMap(); let responsePromises = Object.create(null); let requestTokens = Object.create(null); let trace = Trace.Off; let traceFormat = TraceFormat.Text; let tracer; let state = ConnectionState.New; const errorEmitter = new events.Emitter(); const closeEmitter = new events.Emitter(); const unhandledNotificationEmitter = new events.Emitter(); const unhandledProgressEmitter = new events.Emitter(); const disposeEmitter = new events.Emitter(); const cancellationStrategy = (options && options.cancellationStrategy) ? options.cancellationStrategy : CancellationStrategy.Message; function createRequestQueueKey(id) { if (id === null) { throw new Error(`Can't send requests with id null since the response can't be correlated.`); } return 'req-' + id.toString(); } function createResponseQueueKey(id) { if (id === null) { return 'res-unknown-' + (++unknownResponseSquenceNumber).toString(); } else { return 'res-' + id.toString(); } } function createNotificationQueueKey() { return 'not-' + (++notificationSquenceNumber).toString(); } function addMessageToQueue(queue, message) { if (messages$1.isRequestMessage(message)) { queue.set(createRequestQueueKey(message.id), message); } else if (messages$1.isResponseMessage(message)) { queue.set(createResponseQueueKey(message.id), message); } else { queue.set(createNotificationQueueKey(), message); } } function cancelUndispatched(_message) { return undefined; } function isListening() { return state === ConnectionState.Listening; } function isClosed() { return state === ConnectionState.Closed; } function isDisposed() { return state === ConnectionState.Disposed; } function closeHandler() { if (state === ConnectionState.New || state === ConnectionState.Listening) { state = ConnectionState.Closed; closeEmitter.fire(undefined); } } function readErrorHandler(error) { errorEmitter.fire([error, undefined, undefined]); } function writeErrorHandler(data) { errorEmitter.fire(data); } messageReader.onClose(closeHandler); messageReader.onError(readErrorHandler); messageWriter.onClose(closeHandler); messageWriter.onError(writeErrorHandler); function triggerMessageQueue() { if (timer || messageQueue.size === 0) { return; } timer = ral.default().timer.setImmediate(() => { timer = undefined; processMessageQueue(); }); } function processMessageQueue() { if (messageQueue.size === 0) { return; } const message = messageQueue.shift(); try { if (messages$1.isRequestMessage(message)) { handleRequest(message); } else if (messages$1.isNotificationMessage(message)) { handleNotification(message); } else if (messages$1.isResponseMessage(message)) { handleResponse(message); } else { handleInvalidMessage(message); } } finally { triggerMessageQueue(); } } const callback = (message) => { try { if (messages$1.isNotificationMessage(message) && message.method === CancelNotification.type.method) { const key = createRequestQueueKey(message.params.id); const toCancel = messageQueue.get(key); if (messages$1.isRequestMessage(toCancel)) { const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy; const response = (strategy && strategy.cancelUndispatched) ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); if (response && (response.error !== undefined || response.result !== undefined)) { messageQueue.delete(key); response.id = toCancel.id; traceSendingResponse(response, message.method, Date.now()); messageWriter.write(response); return; } } } addMessageToQueue(messageQueue, message); } finally { triggerMessageQueue(); } }; function handleRequest(requestMessage) { if (isDisposed()) { return; } function reply(resultOrError, method, startTime) { const message = { jsonrpc: version, id: requestMessage.id }; if (resultOrError instanceof messages$1.ResponseError) { message.error = resultOrError.toJson(); } else { message.result = resultOrError === undefined ? null : resultOrError; } traceSendingResponse(message, method, startTime); messageWriter.write(message); } function replyError(error, method, startTime) { const message = { jsonrpc: version, id: requestMessage.id, error: error.toJson() }; traceSendingResponse(message, method, startTime); messageWriter.write(message); } function replySuccess(result, method, startTime) { if (result === undefined) { result = null; } const message = { jsonrpc: version, id: requestMessage.id, result: result }; traceSendingResponse(message, method, startTime); messageWriter.write(message); } traceReceivedRequest(requestMessage); const element = requestHandlers[requestMessage.method]; let type; let requestHandler; if (element) { type = element.type; requestHandler = element.handler; } const startTime = Date.now(); if (requestHandler || starRequestHandler) { const tokenKey = String(requestMessage.id); const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey); requestTokens[tokenKey] = cancellationSource; try { let handlerResult; if (requestHandler) { if (requestMessage.params === undefined) { if (type !== undefined && type.numberOfParams !== 0) { replyError(new messages$1.ResponseError(messages$1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but recevied none.`), requestMessage.method, startTime); return; } handlerResult = requestHandler(cancellationSource.token); } else if (Array.isArray(requestMessage.params)) { if (type !== undefined && type.parameterStructures === messages$1.ParameterStructures.byName) { replyError(new messages$1.ResponseError(messages$1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime); return; } handlerResult = requestHandler(...requestMessage.params, cancellationSource.token); } else { if (type !== undefined && type.parameterStructures === messages$1.ParameterStructures.byPosition) { replyError(new messages$1.ResponseError(messages$1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime); return; } handlerResult = requestHandler(requestMessage.params, cancellationSource.token); } } else if (starRequestHandler) { handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); } const promise = handlerResult; if (!handlerResult) { delete requestTokens[tokenKey]; replySuccess(handlerResult, requestMessage.method, startTime); } else if (promise.then) { promise.then((resultOrError) => { delete requestTokens[tokenKey]; reply(resultOrError, requestMessage.method, startTime); }, error => { delete requestTokens[tokenKey]; if (error instanceof messages$1.ResponseError) { replyError(error, requestMessage.method, startTime); } else if (error && is$1.string(error.message)) { replyError(new messages$1.ResponseError(messages$1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); } else { replyError(new messages$1.ResponseError(messages$1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); } }); } else { delete requestTokens[tokenKey]; reply(handlerResult, requestMessage.method, startTime); } } catch (error) { delete requestTokens[tokenKey]; if (error instanceof messages$1.ResponseError) { reply(error, requestMessage.method, startTime); } else if (error && is$1.string(error.message)) { replyError(new messages$1.ResponseError(messages$1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); } else { replyError(new messages$1.ResponseError(messages$1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); } } } else { replyError(new messages$1.ResponseError(messages$1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); } } function handleResponse(responseMessage) { if (isDisposed()) { return; } if (responseMessage.id === null) { if (responseMessage.error) { logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`); } else { logger.error(`Received response message without id. No further error information provided.`); } } else { const key = String(responseMessage.id); const responsePromise = responsePromises[key]; traceReceivedResponse(responseMessage, responsePromise); if (responsePromise) { delete responsePromises[key]; try { if (responseMessage.error) { const error = responseMessage.error; responsePromise.reject(new messages$1.ResponseError(error.code, error.message, error.data)); } else if (responseMessage.result !== undefined) { responsePromise.resolve(responseMessage.result); } else { throw new Error('Should never happen.'); } } catch (error) { if (error.message) { logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`); } else { logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); } } } } } function handleNotification(message) { if (isDisposed()) { return; } let type = undefined; let notificationHandler; if (message.method === CancelNotification.type.method) { notificationHandler = (params) => { const id = params.id; const source = requestTokens[String(id)]; if (source) { source.cancel(); } }; } else { const element = notificationHandlers[message.method]; if (element) { notificationHandler = element.handler; type = element.type; } } if (notificationHandler || starNotificationHandler) { try { traceReceivedNotification(message); if (notificationHandler) { if (message.params === undefined) { if (type !== undefined) { if (type.numberOfParams !== 0 && type.parameterStructures !== messages$1.ParameterStructures.byName) { logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but recevied none.`); } } notificationHandler(); } else if (Array.isArray(message.params)) { if (type !== undefined) { if (type.parameterStructures === messages$1.ParameterStructures.byName) { logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`); } if (type.numberOfParams !== message.params.length) { logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${message.params.length} argumennts`); } } notificationHandler(...message.params); } else { if (type !== undefined && type.parameterStructures === messages$1.ParameterStructures.byPosition) { logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`); } notificationHandler(message.params); } } else if (starNotificationHandler) { starNotificationHandler(message.method, message.params); } } catch (error) { if (error.message) { logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`); } else { logger.error(`Notification handler '${message.method}' failed unexpectedly.`); } } } else { unhandledNotificationEmitter.fire(message); } } function handleInvalidMessage(message) { if (!message) { logger.error('Received empty message.'); return; } logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`); const responseMessage = message; if (is$1.string(responseMessage.id) || is$1.number(responseMessage.id)) { const key = String(responseMessage.id); const responseHandler = responsePromises[key]; if (responseHandler) { responseHandler.reject(new Error('The received response has neither a result nor an error property.')); } } } function traceSendingRequest(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose && message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } tracer.log(`Sending request '${message.method} - (${message.id})'.`, data); } else { logLSPMessage('send-request', message); } } function traceSendingNotification(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } else { data = 'No parameters provided.\n\n'; } } tracer.log(`Sending notification '${message.method}'.`, data); } else { logLSPMessage('send-notification', message); } } function traceSendingResponse(message, method, startTime) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.error && message.error.data) { data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`; } else { if (message.result) { data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`; } else if (message.error === undefined) { data = 'No result returned.\n\n'; } } } tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data); } else { logLSPMessage('send-response', message); } } function traceReceivedRequest(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose && message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } tracer.log(`Received request '${message.method} - (${message.id})'.`, data); } else { logLSPMessage('receive-request', message); } } function traceReceivedNotification(message) { if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } else { data = 'No parameters provided.\n\n'; } } tracer.log(`Received notification '${message.method}'.`, data); } else { logLSPMessage('receive-notification', message); } } function traceReceivedResponse(message, responsePromise) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.error && message.error.data) { data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`; } else { if (message.result) { data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`; } else if (message.error === undefined) { data = 'No result returned.\n\n'; } } } if (responsePromise) { const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ''; tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data); } else { tracer.log(`Received response ${message.id} without active response promise.`, data); } } else { logLSPMessage('receive-response', message); } } function logLSPMessage(type, message) { if (!tracer || trace === Trace.Off) { return; } const lspMessage = { isLSPMessage: true, type, message, timestamp: Date.now() }; tracer.log(lspMessage); } function throwIfClosedOrDisposed() { if (isClosed()) { throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.'); } if (isDisposed()) { throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.'); } } function throwIfListening() { if (isListening()) { throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening'); } } function throwIfNotListening() { if (!isListening()) { throw new Error('Call listen() first.'); } } function undefinedToNull(param) { if (param === undefined) { return null; } else { return param; } } function nullToUndefined(param) { if (param === null) { return undefined; } else { return param; } } function isNamedParam(param) { return param !== undefined && param !== null && !Array.isArray(param) && typeof param === 'object'; } function computeSingleParam(parameterStructures, param) { switch (parameterStructures) { case messages$1.ParameterStructures.auto: if (isNamedParam(param)) { return nullToUndefined(param); } else { return [undefinedToNull(param)]; } case messages$1.ParameterStructures.byName: if (!isNamedParam(param)) { throw new Error(`Recevied parameters by name but param is not an object literal.`); } return nullToUndefined(param); case messages$1.ParameterStructures.byPosition: return [undefinedToNull(param)]; default: throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`); } } function computeMessageParams(type, params) { let result; const numberOfParams = type.numberOfParams; switch (numberOfParams) { case 0: result = undefined; break; case 1: result = computeSingleParam(type.parameterStructures, params[0]); break; default: result = []; for (let i = 0; i < params.length && i < numberOfParams; i++) { result.push(undefinedToNull(params[i])); } if (params.length < numberOfParams) { for (let i = params.length; i < numberOfParams; i++) { result.push(null); } } break; } return result; } const connection = { sendNotification: (type, ...args) => { throwIfClosedOrDisposed(); let method; let messageParams; if (is$1.string(type)) { method = type; const first = args[0]; let paramStart = 0; let parameterStructures = messages$1.ParameterStructures.auto; if (messages$1.ParameterStructures.is(first)) { paramStart = 1; parameterStructures = first; } let paramEnd = args.length; const numberOfParams = paramEnd - paramStart; switch (numberOfParams) { case 0: messageParams = undefined; break; case 1: messageParams = computeSingleParam(parameterStructures, args[paramStart]); break; default: if (parameterStructures === messages$1.ParameterStructures.byName) { throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' notification parameter structure.`); } messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value)); break; } } else { const params = args; method = type.method; messageParams = computeMessageParams(type, params); } const notificationMessage = { jsonrpc: version, method: method, params: messageParams }; traceSendingNotification(notificationMessage); messageWriter.write(notificationMessage); }, onNotification: (type, handler) => { throwIfClosedOrDisposed(); let method; if (is$1.func(type)) { starNotificationHandler = type; } else if (handler) { if (is$1.string(type)) { method = type; notificationHandlers[type] = { type: undefined, handler }; } else { method = type.method; notificationHandlers[type.method] = { type, handler }; } } return { dispose: () => { if (method !== undefined) { delete notificationHandlers[method]; } else { starNotificationHandler = undefined; } } }; }, onProgress: (_type, token, handler) => { if (progressHandlers.has(token)) { throw new Error(`Progress handler for token ${token} already registered`); } progressHandlers.set(token, handler); return { dispose: () => { progressHandlers.delete(token); } }; }, sendProgress: (_type, token, value) => { connection.sendNotification(ProgressNotification.type, { token, value }); }, onUnhandledProgress: unhandledProgressEmitter.event, sendRequest: (type, ...args) => { throwIfClosedOrDisposed(); throwIfNotListening(); let method; let messageParams; let token = undefined; if (is$1.string(type)) { method = type; const first = args[0]; const last = args[args.length - 1]; let paramStart = 0; let parameterStructures = messages$1.ParameterStructures.auto; if (messages$1.ParameterStructures.is(first)) { paramStart = 1; parameterStructures = first; } let paramEnd = args.length; if (cancellation.CancellationToken.is(last)) { paramEnd = paramEnd - 1; token = last; } const numberOfParams = paramEnd - paramStart; switch (numberOfParams) { case 0: messageParams = undefined; break; case 1: messageParams = computeSingleParam(parameterStructures, args[paramStart]); break; default: if (parameterStructures === messages$1.ParameterStructures.byName) { throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' request parameter structure.`); } messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value)); break; } } else { const params = args; method = type.method; messageParams = computeMessageParams(type, params); const numberOfParams = type.numberOfParams; token = cancellation.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined; } const id = sequenceNumber++; let disposable; if (token) { disposable = token.onCancellationRequested(() => { cancellationStrategy.sender.sendCancellation(connection, id); }); } const result = new Promise((resolve, reject) => { const requestMessage = { jsonrpc: version, id: id, method: method, params: messageParams }; const resolveWithCleanup = (r) => { resolve(r); cancellationStrategy.sender.cleanup(id); disposable === null || disposable === void 0 ? void 0 : disposable.dispose(); }; const rejectWithCleanup = (r) => { reject(r); cancellationStrategy.sender.cleanup(id); disposable === null || disposable === void 0 ? void 0 : disposable.dispose(); }; let responsePromise = { method: method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup }; traceSendingRequest(requestMessage); try { messageWriter.write(requestMessage); } catch (e) { responsePromise.reject(new messages$1.ResponseError(messages$1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason')); responsePromise = null; } if (responsePromise) { responsePromises[String(id)] = responsePromise; } }); return result; }, onRequest: (type, handler) => { throwIfClosedOrDisposed(); let method = null; if (StarRequestHandler.is(type)) { method = undefined; starRequestHandler = type; } else if (is$1.string(type)) { method = null; if (handler !== undefined) { method = type; requestHandlers[type] = { handler: handler, type: undefined }; } } else { if (handler !== undefined) { method = type.method; requestHandlers[type.method] = { type, handler }; } } return { dispose: () => { if (method === null) { return; } if (method !== undefined) { delete requestHandlers[method]; } else { starRequestHandler = undefined; } } }; }, trace: (_value, _tracer, sendNotificationOrTraceOptions) => { let _sendNotification = false; let _traceFormat = TraceFormat.Text; if (sendNotificationOrTraceOptions !== undefined) { if (is$1.boolean(sendNotificationOrTraceOptions)) { _sendNotification = sendNotificationOrTraceOptions; } else { _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; } } trace = _value; traceFormat = _traceFormat; if (trace === Trace.Off) { tracer = undefined; } else { tracer = _tracer; } if (_sendNotification && !isClosed() && !isDisposed()) { connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); } }, onError: errorEmitter.event, onClose: closeEmitter.event, onUnhandledNotification: unhandledNotificationEmitter.event, onDispose: disposeEmitter.event, end: () => { messageWriter.end(); }, dispose: () => { if (isDisposed()) { return; } state = ConnectionState.Disposed; disposeEmitter.fire(undefined); const error = new Error('Connection got disposed.'); Object.keys(responsePromises).forEach((key) => { responsePromises[key].reject(error); }); responsePromises = Object.create(null); requestTokens = Object.create(null); messageQueue = new linkedMap.LinkedMap(); if (is$1.func(messageWriter.dispose)) { messageWriter.dispose(); } if (is$1.func(messageReader.dispose)) { messageReader.dispose(); } }, listen: () => { throwIfClosedOrDisposed(); throwIfListening(); state = ConnectionState.Listening; messageReader.listen(callback); }, inspect: () => { ral.default().console.log('inspect'); } }; connection.onNotification(LogTraceNotification.type, (params) => { if (trace === Trace.Off || !tracer) { return; } tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined); }); connection.onNotification(ProgressNotification.type, (params) => { const handler = progressHandlers.get(params.token); if (handler) { handler(params.value); } else { unhandledProgressEmitter.fire(params); } }); return connection; } exports.createMessageConnection = createMessageConnection; }); getDefaultExportFromCjs(connection$1); var api$1 = createCommonjsModule(function (module, exports) { /// <reference path="../../typings/thenable.d.ts" /> Object.defineProperty(exports, "__esModule", { value: true }); exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.ProgressType = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.RAL = void 0; exports.CancellationStrategy = void 0; Object.defineProperty(exports, "RequestType", { enumerable: true, get: function () { return messages$1.RequestType; } }); Object.defineProperty(exports, "RequestType0", { enumerable: true, get: function () { return messages$1.RequestType0; } }); Object.defineProperty(exports, "RequestType1", { enumerable: true, get: function () { return messages$1.RequestType1; } }); Object.defineProperty(exports, "RequestType2", { enumerable: true, get: function () { return messages$1.RequestType2; } }); Object.defineProperty(exports, "RequestType3", { enumerable: true, get: function () { return messages$1.RequestType3; } }); Object.defineProperty(exports, "RequestType4", { enumerable: true, get: function () { return messages$1.RequestType4; } }); Object.defineProperty(exports, "RequestType5", { enumerable: true, get: function () { return messages$1.RequestType5; } }); Object.defineProperty(exports, "RequestType6", { enumerable: true, get: function () { return messages$1.RequestType6; } }); Object.defineProperty(exports, "RequestType7", { enumerable: true, get: function () { return messages$1.RequestType7; } }); Object.defineProperty(exports, "RequestType8", { enumerable: true, get: function () { return messages$1.RequestType8; } }); Object.defineProperty(exports, "RequestType9", { enumerable: true, get: function () { return messages$1.RequestType9; } }); Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function () { return messages$1.ResponseError; } }); Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function () { return messages$1.ErrorCodes; } }); Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function () { return messages$1.NotificationType; } }); Object.defineProperty(exports, "NotificationType0", { enumerable: true, get: function () { return messages$1.NotificationType0; } }); Object.defineProperty(exports, "NotificationType1", { enumerable: true, get: function () { return messages$1.NotificationType1; } }); Object.defineProperty(exports, "NotificationType2", { enumerable: true, get: function () { return messages$1.NotificationType2; } }); Object.defineProperty(exports, "NotificationType3", { enumerable: true, get: function () { return messages$1.NotificationType3; } }); Object.defineProperty(exports, "NotificationType4", { enumerable: true, get: function () { return messages$1.NotificationType4; } }); Object.defineProperty(exports, "NotificationType5", { enumerable: true, get: function () { return messages$1.NotificationType5; } }); Object.defineProperty(exports, "NotificationType6", { enumerable: true, get: function () { return messages$1.NotificationType6; } }); Object.defineProperty(exports, "NotificationType7", { enumerable: true, get: function () { return messages$1.NotificationType7; } }); Object.defineProperty(exports, "NotificationType8", { enumerable: true, get: function () { return messages$1.NotificationType8; } }); Object.defineProperty(exports, "NotificationType9", { enumerable: true, get: function () { return messages$1.NotificationType9; } }); Object.defineProperty(exports, "ParameterStructures", { enumerable: true, get: function () { return messages$1.ParameterStructures; } }); Object.defineProperty(exports, "Disposable", { enumerable: true, get: function () { return disposable.Disposable; } }); Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return events.Event; } }); Object.defineProperty(exports, "Emitter", { enumerable: true, get: function () { return events.Emitter; } }); Object.defineProperty(exports, "CancellationTokenSource", { enumerable: true, get: function () { return cancellation.CancellationTokenSource; } }); Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function () { return cancellation.CancellationToken; } }); Object.defineProperty(exports, "MessageReader", { enumerable: true, get: function () { return messageReader.MessageReader; } }); Object.defineProperty(exports, "AbstractMessageReader", { enumerable: true, get: function () { return messageReader.AbstractMessageReader; } }); Object.defineProperty(exports, "ReadableStreamMessageReader", { enumerable: true, get: function () { return messageReader.ReadableStreamMessageReader; } }); Object.defineProperty(exports, "MessageWriter", { enumerable: true, get: function () { return messageWriter.MessageWriter; } }); Object.defineProperty(exports, "AbstractMessageWriter", { enumerable: true, get: function () { return messageWriter.AbstractMessageWriter; } }); Object.defineProperty(exports, "WriteableStreamMessageWriter", { enumerable: true, get: function () { return messageWriter.WriteableStreamMessageWriter; } }); Object.defineProperty(exports, "ConnectionStrategy", { enumerable: true, get: function () { return connection$1.ConnectionStrategy; } }); Object.defineProperty(exports, "ConnectionOptions", { enumerable: true, get: function () { return connection$1.ConnectionOptions; } }); Object.defineProperty(exports, "NullLogger", { enumerable: true, get: function () { return connection$1.NullLogger; } }); Object.defineProperty(exports, "createMessageConnection", { enumerable: true, get: function () { return connection$1.createMessageConnection; } }); Object.defineProperty(exports, "ProgressType", { enumerable: true, get: function () { return connection$1.ProgressType; } }); Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return connection$1.Trace; } }); Object.defineProperty(exports, "TraceFormat", { enumerable: true, get: function () { return connection$1.TraceFormat; } }); Object.defineProperty(exports, "SetTraceNotification", { enumerable: true, get: function () { return connection$1.SetTraceNotification; } }); Object.defineProperty(exports, "LogTraceNotification", { enumerable: true, get: function () { return connection$1.LogTraceNotification; } }); Object.defineProperty(exports, "ConnectionErrors", { enumerable: true, get: function () { return connection$1.ConnectionErrors; } }); Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return connection$1.ConnectionError; } }); Object.defineProperty(exports, "CancellationReceiverStrategy", { enumerable: true, get: function () { return connection$1.CancellationReceiverStrategy; } }); Object.defineProperty(exports, "CancellationSenderStrategy", { enumerable: true, get: function () { return connection$1.CancellationSenderStrategy; } }); Object.defineProperty(exports, "CancellationStrategy", { enumerable: true, get: function () { return connection$1.CancellationStrategy; } }); exports.RAL = ral.default; }); getDefaultExportFromCjs(api$1); var main$1 = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createMessageConnection = exports.createServerSocketTransport = exports.createClientSocketTransport = exports.createServerPipeTransport = exports.createClientPipeTransport = exports.generateRandomPipeName = exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = void 0; ril.default.install(); __exportStar(api$1, exports); class IPCMessageReader extends api$1.AbstractMessageReader { constructor(process) { super(); this.process = process; let eventEmitter = this.process; eventEmitter.on('error', (error) => this.fireError(error)); eventEmitter.on('close', () => this.fireClose()); } listen(callback) { this.process.on('message', callback); return api$1.Disposable.create(() => this.process.off('message', callback)); } } exports.IPCMessageReader = IPCMessageReader; class IPCMessageWriter extends api$1.AbstractMessageWriter { constructor(process) { super(); this.process = process; this.errorCount = 0; let eventEmitter = this.process; eventEmitter.on('error', (error) => this.fireError(error)); eventEmitter.on('close', () => this.fireClose); } write(msg) { try { if (typeof this.process.send === 'function') { this.process.send(msg, undefined, undefined, (error) => { if (error) { this.errorCount++; this.handleError(error, msg); } else { this.errorCount = 0; } }); } return Promise.resolve(); } catch (error) { this.handleError(error, msg); return Promise.reject(error); } } handleError(error, msg) { this.errorCount++; this.fireError(error, msg, this.errorCount); } end() { } } exports.IPCMessageWriter = IPCMessageWriter; class SocketMessageReader extends api$1.ReadableStreamMessageReader { constructor(socket, encoding = 'utf-8') { super(ril.default().stream.asReadableStream(socket), encoding); } } exports.SocketMessageReader = SocketMessageReader; class SocketMessageWriter extends api$1.WriteableStreamMessageWriter { constructor(socket, options) { super(ril.default().stream.asWritableStream(socket), options); this.socket = socket; } dispose() { super.dispose(); this.socket.destroy(); } } exports.SocketMessageWriter = SocketMessageWriter; class StreamMessageReader extends api$1.ReadableStreamMessageReader { constructor(readble, encoding) { super(ril.default().stream.asReadableStream(readble), encoding); } } exports.StreamMessageReader = StreamMessageReader; class StreamMessageWriter extends api$1.WriteableStreamMessageWriter { constructor(writable, options) { super(ril.default().stream.asWritableStream(writable), options); } } exports.StreamMessageWriter = StreamMessageWriter; const XDG_RUNTIME_DIR = process.env['XDG_RUNTIME_DIR']; const safeIpcPathLengths = new Map([ ['linux', 107], ['darwin', 103] ]); function generateRandomPipeName() { const randomSuffix = crypto_1__default['default'].randomBytes(21).toString('hex'); if (process.platform === 'win32') { return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`; } let result; if (XDG_RUNTIME_DIR) { result = path__default['default'].join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`); } else { result = path__default['default'].join(os__default['default'].tmpdir(), `vscode-${randomSuffix}.sock`); } const limit = safeIpcPathLengths.get(process.platform); if (limit !== undefined && result.length >= limit) { ril.default().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`); } return result; } exports.generateRandomPipeName = generateRandomPipeName; function createClientPipeTransport(pipeName, encoding = 'utf-8') { let connectResolve; const connected = new Promise((resolve, _reject) => { connectResolve = resolve; }); return new Promise((resolve, reject) => { let server = net_1__default['default'].createServer((socket) => { server.close(); connectResolve([ new SocketMessageReader(socket, encoding), new SocketMessageWriter(socket, encoding) ]); }); server.on('error', reject); server.listen(pipeName, () => { server.removeListener('error', reject); resolve({ onConnected: () => { return connected; } }); }); }); } exports.createClientPipeTransport = createClientPipeTransport; function createServerPipeTransport(pipeName, encoding = 'utf-8') { const socket = net_1__default['default'].createConnection(pipeName); return [ new SocketMessageReader(socket, encoding), new SocketMessageWriter(socket, encoding) ]; } exports.createServerPipeTransport = createServerPipeTransport; function createClientSocketTransport(port, encoding = 'utf-8') { let connectResolve; const connected = new Promise((resolve, _reject) => { connectResolve = resolve; }); return new Promise((resolve, reject) => { const server = net_1__default['default'].createServer((socket) => { server.close(); connectResolve([ new SocketMessageReader(socket, encoding), new SocketMessageWriter(socket, encoding) ]); }); server.on('error', reject); server.listen(port, '127.0.0.1', () => { server.removeListener('error', reject); resolve({ onConnected: () => { return connected; } }); }); }); } exports.createClientSocketTransport = createClientSocketTransport; function createServerSocketTransport(port, encoding = 'utf-8') { const socket = net_1__default['default'].createConnection(port, '127.0.0.1'); return [ new SocketMessageReader(socket, encoding), new SocketMessageWriter(socket, encoding) ]; } exports.createServerSocketTransport = createServerSocketTransport; function isReadableStream(value) { const candidate = value; return candidate.read !== undefined && candidate.addListener !== undefined; } function isWritableStream(value) { const candidate = value; return candidate.write !== undefined && candidate.addListener !== undefined; } function createMessageConnection(input, output, logger, options) { if (!logger) { logger = api$1.NullLogger; } const reader = isReadableStream(input) ? new StreamMessageReader(input) : input; const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output; if (api$1.ConnectionStrategy.is(options)) { options = { connectionStrategy: options }; } return api$1.createMessageConnection(reader, writer, logger, options); } exports.createMessageConnection = createMessageConnection; }); getDefaultExportFromCjs(main$1); var node = main$1; var messages = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ProtocolNotificationType = exports.ProtocolNotificationType0 = exports.ProtocolRequestType = exports.ProtocolRequestType0 = exports.RegistrationType = void 0; class RegistrationType { constructor(method) { this.method = method; } } exports.RegistrationType = RegistrationType; class ProtocolRequestType0 extends main$1.RequestType0 { constructor(method) { super(method); } } exports.ProtocolRequestType0 = ProtocolRequestType0; class ProtocolRequestType extends main$1.RequestType { constructor(method) { super(method, main$1.ParameterStructures.byName); } } exports.ProtocolRequestType = ProtocolRequestType; class ProtocolNotificationType0 extends main$1.NotificationType0 { constructor(method) { super(method); } } exports.ProtocolNotificationType0 = ProtocolNotificationType0; class ProtocolNotificationType extends main$1.NotificationType { constructor(method) { super(method, main$1.ParameterStructures.byName); } } exports.ProtocolNotificationType = ProtocolNotificationType; }); getDefaultExportFromCjs(messages); var is = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; function boolean(value) { return value === true || value === false; } exports.boolean = boolean; function string(value) { return typeof value === 'string' || value instanceof String; } exports.string = string; function number(value) { return typeof value === 'number' || value instanceof Number; } exports.number = number; function error(value) { return value instanceof Error; } exports.error = error; function func(value) { return typeof value === 'function'; } exports.func = func; function array(value) { return Array.isArray(value); } exports.array = array; function stringArray(value) { return array(value) && value.every(elem => string(elem)); } exports.stringArray = stringArray; function typedArray(value, check) { return Array.isArray(value) && value.every(check); } exports.typedArray = typedArray; function objectLiteral(value) { return value !== null && typeof value === 'object'; } exports.objectLiteral = objectLiteral; }); getDefaultExportFromCjs(is); var protocol_implementation = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ImplementationRequest = void 0; (function (ImplementationRequest) { ImplementationRequest.method = 'textDocument/implementation'; ImplementationRequest.type = new messages.ProtocolRequestType(ImplementationRequest.method); })(exports.ImplementationRequest || (exports.ImplementationRequest = {})); }); getDefaultExportFromCjs(protocol_implementation); var protocol_typeDefinition = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.TypeDefinitionRequest = void 0; (function (TypeDefinitionRequest) { TypeDefinitionRequest.method = 'textDocument/typeDefinition'; TypeDefinitionRequest.type = new messages.ProtocolRequestType(TypeDefinitionRequest.method); })(exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {})); }); getDefaultExportFromCjs(protocol_typeDefinition); var protocol_workspaceFolders = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = void 0; (function (WorkspaceFoldersRequest) { WorkspaceFoldersRequest.type = new messages.ProtocolRequestType0('workspace/workspaceFolders'); })(exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {})); (function (DidChangeWorkspaceFoldersNotification) { DidChangeWorkspaceFoldersNotification.type = new messages.ProtocolNotificationType('workspace/didChangeWorkspaceFolders'); })(exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {})); }); getDefaultExportFromCjs(protocol_workspaceFolders); var protocol_configuration = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigurationRequest = void 0; (function (ConfigurationRequest) { ConfigurationRequest.type = new messages.ProtocolRequestType('workspace/configuration'); })(exports.ConfigurationRequest || (exports.ConfigurationRequest = {})); }); getDefaultExportFromCjs(protocol_configuration); var protocol_colorProvider = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ColorPresentationRequest = exports.DocumentColorRequest = void 0; (function (DocumentColorRequest) { DocumentColorRequest.method = 'textDocument/documentColor'; DocumentColorRequest.type = new messages.ProtocolRequestType(DocumentColorRequest.method); })(exports.DocumentColorRequest || (exports.DocumentColorRequest = {})); (function (ColorPresentationRequest) { ColorPresentationRequest.type = new messages.ProtocolRequestType('textDocument/colorPresentation'); })(exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {})); }); getDefaultExportFromCjs(protocol_colorProvider); var protocol_foldingRange = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.FoldingRangeRequest = exports.FoldingRangeKind = void 0; (function (FoldingRangeKind) { FoldingRangeKind["Comment"] = "comment"; FoldingRangeKind["Imports"] = "imports"; FoldingRangeKind["Region"] = "region"; })(exports.FoldingRangeKind || (exports.FoldingRangeKind = {})); (function (FoldingRangeRequest) { FoldingRangeRequest.method = 'textDocument/foldingRange'; FoldingRangeRequest.type = new messages.ProtocolRequestType(FoldingRangeRequest.method); })(exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {})); }); getDefaultExportFromCjs(protocol_foldingRange); var protocol_declaration = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DeclarationRequest = void 0; (function (DeclarationRequest) { DeclarationRequest.method = 'textDocument/declaration'; DeclarationRequest.type = new messages.ProtocolRequestType(DeclarationRequest.method); })(exports.DeclarationRequest || (exports.DeclarationRequest = {})); }); getDefaultExportFromCjs(protocol_declaration); var protocol_selectionRange = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.SelectionRangeRequest = void 0; (function (SelectionRangeRequest) { SelectionRangeRequest.method = 'textDocument/selectionRange'; SelectionRangeRequest.type = new messages.ProtocolRequestType(SelectionRangeRequest.method); })(exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {})); }); getDefaultExportFromCjs(protocol_selectionRange); var protocol_progress = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = void 0; (function (WorkDoneProgress) { WorkDoneProgress.type = new main$1.ProgressType(); function is(value) { return value === WorkDoneProgress.type; } WorkDoneProgress.is = is; })(exports.WorkDoneProgress || (exports.WorkDoneProgress = {})); (function (WorkDoneProgressCreateRequest) { WorkDoneProgressCreateRequest.type = new messages.ProtocolRequestType('window/workDoneProgress/create'); })(exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {})); (function (WorkDoneProgressCancelNotification) { WorkDoneProgressCancelNotification.type = new messages.ProtocolNotificationType('window/workDoneProgress/cancel'); })(exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {})); }); getDefaultExportFromCjs(protocol_progress); var protocol_callHierarchy = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.CallHierarchyPrepareRequest = void 0; (function (CallHierarchyPrepareRequest) { CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy'; CallHierarchyPrepareRequest.type = new messages.ProtocolRequestType(CallHierarchyPrepareRequest.method); })(exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {})); (function (CallHierarchyIncomingCallsRequest) { CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls'; CallHierarchyIncomingCallsRequest.type = new messages.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method); })(exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {})); (function (CallHierarchyOutgoingCallsRequest) { CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls'; CallHierarchyOutgoingCallsRequest.type = new messages.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method); })(exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {})); }); getDefaultExportFromCjs(protocol_callHierarchy); var protocol_semanticTokens = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.SemanticTokensRegistrationType = exports.TokenFormat = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = void 0; (function (SemanticTokenTypes) { SemanticTokenTypes["namespace"] = "namespace"; SemanticTokenTypes["type"] = "type"; SemanticTokenTypes["class"] = "class"; SemanticTokenTypes["enum"] = "enum"; SemanticTokenTypes["interface"] = "interface"; SemanticTokenTypes["struct"] = "struct"; SemanticTokenTypes["typeParameter"] = "typeParameter"; SemanticTokenTypes["parameter"] = "parameter"; SemanticTokenTypes["variable"] = "variable"; SemanticTokenTypes["property"] = "property"; SemanticTokenTypes["enumMember"] = "enumMember"; SemanticTokenTypes["event"] = "event"; SemanticTokenTypes["function"] = "function"; SemanticTokenTypes["method"] = "method"; SemanticTokenTypes["macro"] = "macro"; SemanticTokenTypes["keyword"] = "keyword"; SemanticTokenTypes["modifier"] = "modifier"; SemanticTokenTypes["comment"] = "comment"; SemanticTokenTypes["string"] = "string"; SemanticTokenTypes["number"] = "number"; SemanticTokenTypes["regexp"] = "regexp"; SemanticTokenTypes["operator"] = "operator"; })(exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {})); (function (SemanticTokenModifiers) { SemanticTokenModifiers["declaration"] = "declaration"; SemanticTokenModifiers["definition"] = "definition"; SemanticTokenModifiers["readonly"] = "readonly"; SemanticTokenModifiers["static"] = "static"; SemanticTokenModifiers["deprecated"] = "deprecated"; SemanticTokenModifiers["abstract"] = "abstract"; SemanticTokenModifiers["async"] = "async"; SemanticTokenModifiers["modification"] = "modification"; SemanticTokenModifiers["documentation"] = "documentation"; SemanticTokenModifiers["defaultLibrary"] = "defaultLibrary"; })(exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {})); (function (SemanticTokens) { function is(value) { const candidate = value; return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number'); } SemanticTokens.is = is; })(exports.SemanticTokens || (exports.SemanticTokens = {})); (function (TokenFormat) { TokenFormat.Relative = 'relative'; })(exports.TokenFormat || (exports.TokenFormat = {})); (function (SemanticTokensRegistrationType) { SemanticTokensRegistrationType.method = 'textDocument/semanticTokens'; SemanticTokensRegistrationType.type = new messages.RegistrationType(SemanticTokensRegistrationType.method); })(exports.SemanticTokensRegistrationType || (exports.SemanticTokensRegistrationType = {})); (function (SemanticTokensRequest) { SemanticTokensRequest.method = 'textDocument/semanticTokens/full'; SemanticTokensRequest.type = new messages.ProtocolRequestType(SemanticTokensRequest.method); })(exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {})); (function (SemanticTokensDeltaRequest) { SemanticTokensDeltaRequest.method = 'textDocument/semanticTokens/full/delta'; SemanticTokensDeltaRequest.type = new messages.ProtocolRequestType(SemanticTokensDeltaRequest.method); })(exports.SemanticTokensDeltaRequest || (exports.SemanticTokensDeltaRequest = {})); (function (SemanticTokensRangeRequest) { SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range'; SemanticTokensRangeRequest.type = new messages.ProtocolRequestType(SemanticTokensRangeRequest.method); })(exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {})); (function (SemanticTokensRefreshRequest) { SemanticTokensRefreshRequest.method = `workspace/semanticTokens/refresh`; SemanticTokensRefreshRequest.type = new messages.ProtocolRequestType0(SemanticTokensRefreshRequest.method); })(exports.SemanticTokensRefreshRequest || (exports.SemanticTokensRefreshRequest = {})); }); getDefaultExportFromCjs(protocol_semanticTokens); var protocol_showDocument = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ShowDocumentRequest = void 0; (function (ShowDocumentRequest) { ShowDocumentRequest.method = 'window/showDocument'; ShowDocumentRequest.type = new messages.ProtocolRequestType(ShowDocumentRequest.method); })(exports.ShowDocumentRequest || (exports.ShowDocumentRequest = {})); }); getDefaultExportFromCjs(protocol_showDocument); var protocol_linkedEditingRange = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.LinkedEditingRangeRequest = void 0; (function (LinkedEditingRangeRequest) { LinkedEditingRangeRequest.method = 'textDocument/linkedEditingRange'; LinkedEditingRangeRequest.type = new messages.ProtocolRequestType(LinkedEditingRangeRequest.method); })(exports.LinkedEditingRangeRequest || (exports.LinkedEditingRangeRequest = {})); }); getDefaultExportFromCjs(protocol_linkedEditingRange); var protocol_fileOperations = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.DidRenameFilesNotification = exports.WillRenameFilesRequest = exports.DidCreateFilesNotification = exports.WillCreateFilesRequest = exports.FileOperationPatternKind = void 0; (function (FileOperationPatternKind) { FileOperationPatternKind.file = 'file'; FileOperationPatternKind.folder = 'folder'; })(exports.FileOperationPatternKind || (exports.FileOperationPatternKind = {})); (function (WillCreateFilesRequest) { WillCreateFilesRequest.method = 'workspace/willCreateFiles'; WillCreateFilesRequest.type = new messages.ProtocolRequestType(WillCreateFilesRequest.method); })(exports.WillCreateFilesRequest || (exports.WillCreateFilesRequest = {})); (function (DidCreateFilesNotification) { DidCreateFilesNotification.method = 'workspace/didCreateFiles'; DidCreateFilesNotification.type = new messages.ProtocolNotificationType(DidCreateFilesNotification.method); })(exports.DidCreateFilesNotification || (exports.DidCreateFilesNotification = {})); (function (WillRenameFilesRequest) { WillRenameFilesRequest.method = 'workspace/willRenameFiles'; WillRenameFilesRequest.type = new messages.ProtocolRequestType(WillRenameFilesRequest.method); })(exports.WillRenameFilesRequest || (exports.WillRenameFilesRequest = {})); (function (DidRenameFilesNotification) { DidRenameFilesNotification.method = 'workspace/didRenameFiles'; DidRenameFilesNotification.type = new messages.ProtocolNotificationType(DidRenameFilesNotification.method); })(exports.DidRenameFilesNotification || (exports.DidRenameFilesNotification = {})); (function (DidDeleteFilesNotification) { DidDeleteFilesNotification.method = 'workspace/didDeleteFiles'; DidDeleteFilesNotification.type = new messages.ProtocolNotificationType(DidDeleteFilesNotification.method); })(exports.DidDeleteFilesNotification || (exports.DidDeleteFilesNotification = {})); (function (WillDeleteFilesRequest) { WillDeleteFilesRequest.method = 'workspace/willDeleteFiles'; WillDeleteFilesRequest.type = new messages.ProtocolRequestType(WillDeleteFilesRequest.method); })(exports.WillDeleteFilesRequest || (exports.WillDeleteFilesRequest = {})); }); getDefaultExportFromCjs(protocol_fileOperations); var protocol_moniker = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = void 0; (function (UniquenessLevel) { UniquenessLevel["document"] = "document"; UniquenessLevel["project"] = "project"; UniquenessLevel["group"] = "group"; UniquenessLevel["scheme"] = "scheme"; UniquenessLevel["global"] = "global"; })(exports.UniquenessLevel || (exports.UniquenessLevel = {})); (function (MonikerKind) { MonikerKind["import"] = "import"; MonikerKind["export"] = "export"; MonikerKind["local"] = "local"; })(exports.MonikerKind || (exports.MonikerKind = {})); (function (MonikerRequest) { MonikerRequest.method = 'textDocument/moniker'; MonikerRequest.type = new messages.ProtocolRequestType(MonikerRequest.method); })(exports.MonikerRequest || (exports.MonikerRequest = {})); }); getDefaultExportFromCjs(protocol_moniker); var protocol = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DocumentLinkRequest = exports.CodeLensRefreshRequest = exports.CodeLensResolveRequest = exports.CodeLensRequest = exports.WorkspaceSymbolRequest = exports.CodeActionResolveRequest = exports.CodeActionRequest = exports.DocumentSymbolRequest = exports.DocumentHighlightRequest = exports.ReferencesRequest = exports.DefinitionRequest = exports.SignatureHelpRequest = exports.SignatureHelpTriggerKind = exports.HoverRequest = exports.CompletionResolveRequest = exports.CompletionRequest = exports.CompletionTriggerKind = exports.PublishDiagnosticsNotification = exports.WatchKind = exports.FileChangeType = exports.DidChangeWatchedFilesNotification = exports.WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentNotification = exports.TextDocumentSaveReason = exports.DidSaveTextDocumentNotification = exports.DidCloseTextDocumentNotification = exports.DidChangeTextDocumentNotification = exports.TextDocumentContentChangeEvent = exports.DidOpenTextDocumentNotification = exports.TextDocumentSyncKind = exports.TelemetryEventNotification = exports.LogMessageNotification = exports.ShowMessageRequest = exports.ShowMessageNotification = exports.MessageType = exports.DidChangeConfigurationNotification = exports.ExitNotification = exports.ShutdownRequest = exports.InitializedNotification = exports.InitializeError = exports.InitializeRequest = exports.WorkDoneProgressOptions = exports.TextDocumentRegistrationOptions = exports.StaticRegistrationOptions = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.UnregistrationRequest = exports.RegistrationRequest = exports.DocumentSelector = exports.DocumentFilter = void 0; exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.WillRenameFilesRequest = exports.DidRenameFilesNotification = exports.WillCreateFilesRequest = exports.DidCreateFilesNotification = exports.FileOperationPatternKind = exports.LinkedEditingRangeRequest = exports.ShowDocumentRequest = exports.SemanticTokensRegistrationType = exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.TokenFormat = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = exports.CallHierarchyPrepareRequest = exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = exports.SelectionRangeRequest = exports.DeclarationRequest = exports.FoldingRangeRequest = exports.ColorPresentationRequest = exports.DocumentColorRequest = exports.ConfigurationRequest = exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = exports.TypeDefinitionRequest = exports.ImplementationRequest = exports.ApplyWorkspaceEditRequest = exports.ExecuteCommandRequest = exports.PrepareRenameRequest = exports.RenameRequest = exports.PrepareSupportDefaultBehavior = exports.DocumentOnTypeFormattingRequest = exports.DocumentRangeFormattingRequest = exports.DocumentFormattingRequest = exports.DocumentLinkResolveRequest = void 0; Object.defineProperty(exports, "ImplementationRequest", { enumerable: true, get: function () { return protocol_implementation.ImplementationRequest; } }); Object.defineProperty(exports, "TypeDefinitionRequest", { enumerable: true, get: function () { return protocol_typeDefinition.TypeDefinitionRequest; } }); Object.defineProperty(exports, "WorkspaceFoldersRequest", { enumerable: true, get: function () { return protocol_workspaceFolders.WorkspaceFoldersRequest; } }); Object.defineProperty(exports, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: function () { return protocol_workspaceFolders.DidChangeWorkspaceFoldersNotification; } }); Object.defineProperty(exports, "ConfigurationRequest", { enumerable: true, get: function () { return protocol_configuration.ConfigurationRequest; } }); Object.defineProperty(exports, "DocumentColorRequest", { enumerable: true, get: function () { return protocol_colorProvider.DocumentColorRequest; } }); Object.defineProperty(exports, "ColorPresentationRequest", { enumerable: true, get: function () { return protocol_colorProvider.ColorPresentationRequest; } }); Object.defineProperty(exports, "FoldingRangeRequest", { enumerable: true, get: function () { return protocol_foldingRange.FoldingRangeRequest; } }); Object.defineProperty(exports, "DeclarationRequest", { enumerable: true, get: function () { return protocol_declaration.DeclarationRequest; } }); Object.defineProperty(exports, "SelectionRangeRequest", { enumerable: true, get: function () { return protocol_selectionRange.SelectionRangeRequest; } }); Object.defineProperty(exports, "WorkDoneProgress", { enumerable: true, get: function () { return protocol_progress.WorkDoneProgress; } }); Object.defineProperty(exports, "WorkDoneProgressCreateRequest", { enumerable: true, get: function () { return protocol_progress.WorkDoneProgressCreateRequest; } }); Object.defineProperty(exports, "WorkDoneProgressCancelNotification", { enumerable: true, get: function () { return protocol_progress.WorkDoneProgressCancelNotification; } }); Object.defineProperty(exports, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: function () { return protocol_callHierarchy.CallHierarchyIncomingCallsRequest; } }); Object.defineProperty(exports, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: function () { return protocol_callHierarchy.CallHierarchyOutgoingCallsRequest; } }); Object.defineProperty(exports, "CallHierarchyPrepareRequest", { enumerable: true, get: function () { return protocol_callHierarchy.CallHierarchyPrepareRequest; } }); Object.defineProperty(exports, "SemanticTokenTypes", { enumerable: true, get: function () { return protocol_semanticTokens.SemanticTokenTypes; } }); Object.defineProperty(exports, "SemanticTokenModifiers", { enumerable: true, get: function () { return protocol_semanticTokens.SemanticTokenModifiers; } }); Object.defineProperty(exports, "SemanticTokens", { enumerable: true, get: function () { return protocol_semanticTokens.SemanticTokens; } }); Object.defineProperty(exports, "TokenFormat", { enumerable: true, get: function () { return protocol_semanticTokens.TokenFormat; } }); Object.defineProperty(exports, "SemanticTokensRequest", { enumerable: true, get: function () { return protocol_semanticTokens.SemanticTokensRequest; } }); Object.defineProperty(exports, "SemanticTokensDeltaRequest", { enumerable: true, get: function () { return protocol_semanticTokens.SemanticTokensDeltaRequest; } }); Object.defineProperty(exports, "SemanticTokensRangeRequest", { enumerable: true, get: function () { return protocol_semanticTokens.SemanticTokensRangeRequest; } }); Object.defineProperty(exports, "SemanticTokensRefreshRequest", { enumerable: true, get: function () { return protocol_semanticTokens.SemanticTokensRefreshRequest; } }); Object.defineProperty(exports, "SemanticTokensRegistrationType", { enumerable: true, get: function () { return protocol_semanticTokens.SemanticTokensRegistrationType; } }); Object.defineProperty(exports, "ShowDocumentRequest", { enumerable: true, get: function () { return protocol_showDocument.ShowDocumentRequest; } }); Object.defineProperty(exports, "LinkedEditingRangeRequest", { enumerable: true, get: function () { return protocol_linkedEditingRange.LinkedEditingRangeRequest; } }); Object.defineProperty(exports, "FileOperationPatternKind", { enumerable: true, get: function () { return protocol_fileOperations.FileOperationPatternKind; } }); Object.defineProperty(exports, "DidCreateFilesNotification", { enumerable: true, get: function () { return protocol_fileOperations.DidCreateFilesNotification; } }); Object.defineProperty(exports, "WillCreateFilesRequest", { enumerable: true, get: function () { return protocol_fileOperations.WillCreateFilesRequest; } }); Object.defineProperty(exports, "DidRenameFilesNotification", { enumerable: true, get: function () { return protocol_fileOperations.DidRenameFilesNotification; } }); Object.defineProperty(exports, "WillRenameFilesRequest", { enumerable: true, get: function () { return protocol_fileOperations.WillRenameFilesRequest; } }); Object.defineProperty(exports, "DidDeleteFilesNotification", { enumerable: true, get: function () { return protocol_fileOperations.DidDeleteFilesNotification; } }); Object.defineProperty(exports, "WillDeleteFilesRequest", { enumerable: true, get: function () { return protocol_fileOperations.WillDeleteFilesRequest; } }); Object.defineProperty(exports, "UniquenessLevel", { enumerable: true, get: function () { return protocol_moniker.UniquenessLevel; } }); Object.defineProperty(exports, "MonikerKind", { enumerable: true, get: function () { return protocol_moniker.MonikerKind; } }); Object.defineProperty(exports, "MonikerRequest", { enumerable: true, get: function () { return protocol_moniker.MonikerRequest; } }); var DocumentFilter; (function (DocumentFilter) { function is$1(value) { const candidate = value; return is.string(candidate.language) || is.string(candidate.scheme) || is.string(candidate.pattern); } DocumentFilter.is = is$1; })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {})); var DocumentSelector; (function (DocumentSelector) { function is$1(value) { if (!Array.isArray(value)) { return false; } for (let elem of value) { if (!is.string(elem) && !DocumentFilter.is(elem)) { return false; } } return true; } DocumentSelector.is = is$1; })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {})); (function (RegistrationRequest) { RegistrationRequest.type = new messages.ProtocolRequestType('client/registerCapability'); })(exports.RegistrationRequest || (exports.RegistrationRequest = {})); (function (UnregistrationRequest) { UnregistrationRequest.type = new messages.ProtocolRequestType('client/unregisterCapability'); })(exports.UnregistrationRequest || (exports.UnregistrationRequest = {})); (function (ResourceOperationKind) { ResourceOperationKind.Create = 'create'; ResourceOperationKind.Rename = 'rename'; ResourceOperationKind.Delete = 'delete'; })(exports.ResourceOperationKind || (exports.ResourceOperationKind = {})); (function (FailureHandlingKind) { FailureHandlingKind.Abort = 'abort'; FailureHandlingKind.Transactional = 'transactional'; FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional'; FailureHandlingKind.Undo = 'undo'; })(exports.FailureHandlingKind || (exports.FailureHandlingKind = {})); (function (StaticRegistrationOptions) { function hasId(value) { const candidate = value; return candidate && is.string(candidate.id) && candidate.id.length > 0; } StaticRegistrationOptions.hasId = hasId; })(exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {})); (function (TextDocumentRegistrationOptions) { function is(value) { const candidate = value; return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector)); } TextDocumentRegistrationOptions.is = is; })(exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {})); (function (WorkDoneProgressOptions) { function is$1(value) { const candidate = value; return is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || is.boolean(candidate.workDoneProgress)); } WorkDoneProgressOptions.is = is$1; function hasWorkDoneProgress(value) { const candidate = value; return candidate && is.boolean(candidate.workDoneProgress); } WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress; })(exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {})); (function (InitializeRequest) { InitializeRequest.type = new messages.ProtocolRequestType('initialize'); })(exports.InitializeRequest || (exports.InitializeRequest = {})); (function (InitializeError) { InitializeError.unknownProtocolVersion = 1; })(exports.InitializeError || (exports.InitializeError = {})); (function (InitializedNotification) { InitializedNotification.type = new messages.ProtocolNotificationType('initialized'); })(exports.InitializedNotification || (exports.InitializedNotification = {})); (function (ShutdownRequest) { ShutdownRequest.type = new messages.ProtocolRequestType0('shutdown'); })(exports.ShutdownRequest || (exports.ShutdownRequest = {})); (function (ExitNotification) { ExitNotification.type = new messages.ProtocolNotificationType0('exit'); })(exports.ExitNotification || (exports.ExitNotification = {})); (function (DidChangeConfigurationNotification) { DidChangeConfigurationNotification.type = new messages.ProtocolNotificationType('workspace/didChangeConfiguration'); })(exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {})); (function (MessageType) { MessageType.Error = 1; MessageType.Warning = 2; MessageType.Info = 3; MessageType.Log = 4; })(exports.MessageType || (exports.MessageType = {})); (function (ShowMessageNotification) { ShowMessageNotification.type = new messages.ProtocolNotificationType('window/showMessage'); })(exports.ShowMessageNotification || (exports.ShowMessageNotification = {})); (function (ShowMessageRequest) { ShowMessageRequest.type = new messages.ProtocolRequestType('window/showMessageRequest'); })(exports.ShowMessageRequest || (exports.ShowMessageRequest = {})); (function (LogMessageNotification) { LogMessageNotification.type = new messages.ProtocolNotificationType('window/logMessage'); })(exports.LogMessageNotification || (exports.LogMessageNotification = {})); (function (TelemetryEventNotification) { TelemetryEventNotification.type = new messages.ProtocolNotificationType('telemetry/event'); })(exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {})); (function (TextDocumentSyncKind) { TextDocumentSyncKind.None = 0; TextDocumentSyncKind.Full = 1; TextDocumentSyncKind.Incremental = 2; })(exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {})); (function (DidOpenTextDocumentNotification) { DidOpenTextDocumentNotification.method = 'textDocument/didOpen'; DidOpenTextDocumentNotification.type = new messages.ProtocolNotificationType(DidOpenTextDocumentNotification.method); })(exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {})); (function (TextDocumentContentChangeEvent) { function isIncremental(event) { let candidate = event; return candidate !== undefined && candidate !== null && typeof candidate.text === 'string' && candidate.range !== undefined && (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number'); } TextDocumentContentChangeEvent.isIncremental = isIncremental; function isFull(event) { let candidate = event; return candidate !== undefined && candidate !== null && typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined; } TextDocumentContentChangeEvent.isFull = isFull; })(exports.TextDocumentContentChangeEvent || (exports.TextDocumentContentChangeEvent = {})); (function (DidChangeTextDocumentNotification) { DidChangeTextDocumentNotification.method = 'textDocument/didChange'; DidChangeTextDocumentNotification.type = new messages.ProtocolNotificationType(DidChangeTextDocumentNotification.method); })(exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {})); (function (DidCloseTextDocumentNotification) { DidCloseTextDocumentNotification.method = 'textDocument/didClose'; DidCloseTextDocumentNotification.type = new messages.ProtocolNotificationType(DidCloseTextDocumentNotification.method); })(exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {})); (function (DidSaveTextDocumentNotification) { DidSaveTextDocumentNotification.method = 'textDocument/didSave'; DidSaveTextDocumentNotification.type = new messages.ProtocolNotificationType(DidSaveTextDocumentNotification.method); })(exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {})); (function (TextDocumentSaveReason) { TextDocumentSaveReason.Manual = 1; TextDocumentSaveReason.AfterDelay = 2; TextDocumentSaveReason.FocusOut = 3; })(exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {})); (function (WillSaveTextDocumentNotification) { WillSaveTextDocumentNotification.method = 'textDocument/willSave'; WillSaveTextDocumentNotification.type = new messages.ProtocolNotificationType(WillSaveTextDocumentNotification.method); })(exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {})); (function (WillSaveTextDocumentWaitUntilRequest) { WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil'; WillSaveTextDocumentWaitUntilRequest.type = new messages.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method); })(exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {})); (function (DidChangeWatchedFilesNotification) { DidChangeWatchedFilesNotification.type = new messages.ProtocolNotificationType('workspace/didChangeWatchedFiles'); })(exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {})); (function (FileChangeType) { FileChangeType.Created = 1; FileChangeType.Changed = 2; FileChangeType.Deleted = 3; })(exports.FileChangeType || (exports.FileChangeType = {})); (function (WatchKind) { WatchKind.Create = 1; WatchKind.Change = 2; WatchKind.Delete = 4; })(exports.WatchKind || (exports.WatchKind = {})); (function (PublishDiagnosticsNotification) { PublishDiagnosticsNotification.type = new messages.ProtocolNotificationType('textDocument/publishDiagnostics'); })(exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {})); (function (CompletionTriggerKind) { CompletionTriggerKind.Invoked = 1; CompletionTriggerKind.TriggerCharacter = 2; CompletionTriggerKind.TriggerForIncompleteCompletions = 3; })(exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {})); (function (CompletionRequest) { CompletionRequest.method = 'textDocument/completion'; CompletionRequest.type = new messages.ProtocolRequestType(CompletionRequest.method); })(exports.CompletionRequest || (exports.CompletionRequest = {})); (function (CompletionResolveRequest) { CompletionResolveRequest.method = 'completionItem/resolve'; CompletionResolveRequest.type = new messages.ProtocolRequestType(CompletionResolveRequest.method); })(exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {})); (function (HoverRequest) { HoverRequest.method = 'textDocument/hover'; HoverRequest.type = new messages.ProtocolRequestType(HoverRequest.method); })(exports.HoverRequest || (exports.HoverRequest = {})); (function (SignatureHelpTriggerKind) { SignatureHelpTriggerKind.Invoked = 1; SignatureHelpTriggerKind.TriggerCharacter = 2; SignatureHelpTriggerKind.ContentChange = 3; })(exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {})); (function (SignatureHelpRequest) { SignatureHelpRequest.method = 'textDocument/signatureHelp'; SignatureHelpRequest.type = new messages.ProtocolRequestType(SignatureHelpRequest.method); })(exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {})); (function (DefinitionRequest) { DefinitionRequest.method = 'textDocument/definition'; DefinitionRequest.type = new messages.ProtocolRequestType(DefinitionRequest.method); })(exports.DefinitionRequest || (exports.DefinitionRequest = {})); (function (ReferencesRequest) { ReferencesRequest.method = 'textDocument/references'; ReferencesRequest.type = new messages.ProtocolRequestType(ReferencesRequest.method); })(exports.ReferencesRequest || (exports.ReferencesRequest = {})); (function (DocumentHighlightRequest) { DocumentHighlightRequest.method = 'textDocument/documentHighlight'; DocumentHighlightRequest.type = new messages.ProtocolRequestType(DocumentHighlightRequest.method); })(exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {})); (function (DocumentSymbolRequest) { DocumentSymbolRequest.method = 'textDocument/documentSymbol'; DocumentSymbolRequest.type = new messages.ProtocolRequestType(DocumentSymbolRequest.method); })(exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {})); (function (CodeActionRequest) { CodeActionRequest.method = 'textDocument/codeAction'; CodeActionRequest.type = new messages.ProtocolRequestType(CodeActionRequest.method); })(exports.CodeActionRequest || (exports.CodeActionRequest = {})); (function (CodeActionResolveRequest) { CodeActionResolveRequest.method = 'codeAction/resolve'; CodeActionResolveRequest.type = new messages.ProtocolRequestType(CodeActionResolveRequest.method); })(exports.CodeActionResolveRequest || (exports.CodeActionResolveRequest = {})); (function (WorkspaceSymbolRequest) { WorkspaceSymbolRequest.method = 'workspace/symbol'; WorkspaceSymbolRequest.type = new messages.ProtocolRequestType(WorkspaceSymbolRequest.method); })(exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {})); (function (CodeLensRequest) { CodeLensRequest.method = 'textDocument/codeLens'; CodeLensRequest.type = new messages.ProtocolRequestType(CodeLensRequest.method); })(exports.CodeLensRequest || (exports.CodeLensRequest = {})); (function (CodeLensResolveRequest) { CodeLensResolveRequest.method = 'codeLens/resolve'; CodeLensResolveRequest.type = new messages.ProtocolRequestType(CodeLensResolveRequest.method); })(exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {})); (function (CodeLensRefreshRequest) { CodeLensRefreshRequest.method = `workspace/codeLens/refresh`; CodeLensRefreshRequest.type = new messages.ProtocolRequestType0(CodeLensRefreshRequest.method); })(exports.CodeLensRefreshRequest || (exports.CodeLensRefreshRequest = {})); (function (DocumentLinkRequest) { DocumentLinkRequest.method = 'textDocument/documentLink'; DocumentLinkRequest.type = new messages.ProtocolRequestType(DocumentLinkRequest.method); })(exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {})); (function (DocumentLinkResolveRequest) { DocumentLinkResolveRequest.method = 'documentLink/resolve'; DocumentLinkResolveRequest.type = new messages.ProtocolRequestType(DocumentLinkResolveRequest.method); })(exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {})); (function (DocumentFormattingRequest) { DocumentFormattingRequest.method = 'textDocument/formatting'; DocumentFormattingRequest.type = new messages.ProtocolRequestType(DocumentFormattingRequest.method); })(exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {})); (function (DocumentRangeFormattingRequest) { DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting'; DocumentRangeFormattingRequest.type = new messages.ProtocolRequestType(DocumentRangeFormattingRequest.method); })(exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {})); (function (DocumentOnTypeFormattingRequest) { DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting'; DocumentOnTypeFormattingRequest.type = new messages.ProtocolRequestType(DocumentOnTypeFormattingRequest.method); })(exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {})); (function (PrepareSupportDefaultBehavior) { PrepareSupportDefaultBehavior.Identifier = 1; })(exports.PrepareSupportDefaultBehavior || (exports.PrepareSupportDefaultBehavior = {})); (function (RenameRequest) { RenameRequest.method = 'textDocument/rename'; RenameRequest.type = new messages.ProtocolRequestType(RenameRequest.method); })(exports.RenameRequest || (exports.RenameRequest = {})); (function (PrepareRenameRequest) { PrepareRenameRequest.method = 'textDocument/prepareRename'; PrepareRenameRequest.type = new messages.ProtocolRequestType(PrepareRenameRequest.method); })(exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {})); (function (ExecuteCommandRequest) { ExecuteCommandRequest.type = new messages.ProtocolRequestType('workspace/executeCommand'); })(exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {})); (function (ApplyWorkspaceEditRequest) { ApplyWorkspaceEditRequest.type = new messages.ProtocolRequestType('workspace/applyEdit'); })(exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {})); }); getDefaultExportFromCjs(protocol); var connection = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createProtocolConnection = void 0; function createProtocolConnection(input, output, logger, options) { if (main$1.ConnectionStrategy.is(options)) { options = { connectionStrategy: options }; } return main$1.createMessageConnection(input, output, logger, options); } exports.createProtocolConnection = createProtocolConnection; }); getDefaultExportFromCjs(connection); var require$$1 = /*@__PURE__*/getAugmentedNamespace(main$2); var api = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LSPErrorCodes = exports.createProtocolConnection = void 0; __exportStar(main$1, exports); __exportStar(require$$1, exports); __exportStar(messages, exports); __exportStar(protocol, exports); Object.defineProperty(exports, "createProtocolConnection", { enumerable: true, get: function () { return connection.createProtocolConnection; } }); (function (LSPErrorCodes) { LSPErrorCodes.lspReservedErrorRangeStart = -32899; LSPErrorCodes.ContentModified = -32801; LSPErrorCodes.RequestCancelled = -32800; LSPErrorCodes.lspReservedErrorRangeEnd = -32800; })(exports.LSPErrorCodes || (exports.LSPErrorCodes = {})); }); getDefaultExportFromCjs(api); var main = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createProtocolConnection = void 0; __exportStar(node, exports); __exportStar(api, exports); function createProtocolConnection(input, output, logger, options) { return node.createMessageConnection(input, output, logger, options); } exports.createProtocolConnection = createProtocolConnection; }); getDefaultExportFromCjs(main); var ImplementationProvider = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ImplementationProviderImpl = void 0; class ImplementationProviderImpl { constructor(lsAndTsDocResolver) { this.lsAndTsDocResolver = lsAndTsDocResolver; } async getImplementation(document, position) { const { tsDoc, lang } = await this.lsAndTsDocResolver.getLSAndTSDoc(document); const offset = tsDoc.offsetAt(tsDoc.getGeneratedPosition(position)); const implementations = lang.getImplementationAtPosition(tsDoc.filePath, offset); const snapshots = new utils$1.SnapshotMap(this.lsAndTsDocResolver); snapshots.set(tsDoc.filePath, tsDoc); if (!implementations) { return null; } const result = await Promise.all(implementations.map(async (implementation) => { let snapshot = await snapshots.retrieve(implementation.fileName); if ((0, utils$1.isTextSpanInGeneratedCode)(snapshot.getFullText(), implementation.textSpan)) { if (!(0, utils$1.is$storeVariableIn$storeDeclaration)(snapshot.getFullText(), implementation.textSpan.start)) { return; } implementation = lang.getImplementationAtPosition(tsDoc.filePath, tsDoc.getFullText().indexOf(');', implementation.textSpan.start) - 1)[0]; snapshot = await snapshots.retrieve(implementation.fileName); } const range = (0, documents.mapRangeToOriginal)(snapshot, (0, utils$2.convertRange)(snapshot, implementation.textSpan)); if (range.start.line >= 0 && range.end.line >= 0) { return main.Location.create((0, utils$4.pathToUrl)(implementation.fileName), range); } })); return result.filter(utils$4.isNotNullOrUndefined); } } exports.ImplementationProviderImpl = ImplementationProviderImpl; }); getDefaultExportFromCjs(ImplementationProvider); var RenameProvider = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RenameProviderImpl = void 0; const typescript_1 = __importDefault(ts__default__default['default']); class RenameProviderImpl { constructor(lsAndTsDocResolver, configManager) { this.lsAndTsDocResolver = lsAndTsDocResolver; this.configManager = configManager; } async prepareRename(document, position) { const { lang, tsDoc } = await this.getLSAndTSDoc(document); const offset = tsDoc.offsetAt(tsDoc.getGeneratedPosition(position)); const renameInfo = this.getRenameInfo(lang, tsDoc, document, position, offset); if (!renameInfo) { return null; } return this.mapRangeToOriginal(tsDoc, renameInfo.triggerSpan); } async rename(document, position, newName) { const { lang, tsDoc } = await this.getLSAndTSDoc(document); const offset = tsDoc.offsetAt(tsDoc.getGeneratedPosition(position)); const renameInfo = this.getRenameInfo(lang, tsDoc, document, position, offset); if (!renameInfo) { return null; } const renameLocations = lang.findRenameLocations(tsDoc.filePath, offset, false, false, true); if (!renameLocations) { return null; } const docs = new utils$1.SnapshotMap(this.lsAndTsDocResolver); docs.set(tsDoc.filePath, tsDoc); let convertedRenameLocations = await this.mapAndFilterRenameLocations(renameLocations, docs, renameInfo.isStore ? `$${newName}` : undefined); convertedRenameLocations.push(...(await this.enhanceRenamesInCaseOf$Store(renameLocations, newName, docs, lang))); convertedRenameLocations = this.checkShortHandBindingOrSlotLetLocation(lang, convertedRenameLocations, docs); const additionalRenameForPropRenameInsideComponentWithProp = await this.getAdditionLocationsForRenameOfPropInsideComponentWithProp(document, tsDoc, position, convertedRenameLocations, docs, lang); const additionalRenamesForPropRenameOutsideComponentWithProp = additionalRenameForPropRenameInsideComponentWithProp.length > 0 ? [] : await this.getAdditionalLocationsForRenameOfPropInsideOtherComponent(convertedRenameLocations, docs, lang); convertedRenameLocations = [ ...convertedRenameLocations, ...additionalRenameForPropRenameInsideComponentWithProp, ...additionalRenamesForPropRenameOutsideComponentWithProp ]; return (0, utils$4.unique)(convertedRenameLocations.filter((loc) => loc.range.start.line >= 0 && loc.range.end.line >= 0)).reduce((acc, loc) => { const uri = (0, utils$4.pathToUrl)(loc.fileName); if (!acc.changes[uri]) { acc.changes[uri] = []; } acc.changes[uri].push({ newText: (loc.prefixText || '') + (loc.newName || newName) + (loc.suffixText || ''), range: loc.range }); return acc; }, { changes: {} }); } getRenameInfo(lang, tsDoc, doc, originalPosition, generatedOffset) { var _a, _b, _c; if (tsDoc.parserError) { return null; } const renameInfo = lang.getRenameInfo(tsDoc.filePath, generatedOffset, { allowRenameOfImportPath: false }); if (!renameInfo.canRename || ((_a = renameInfo.fullDisplayName) === null || _a === void 0 ? void 0 : _a.includes('JSX.IntrinsicElements')) || (renameInfo.kind === typescript_1.default.ScriptElementKind.jsxAttribute && !(0, utils$1.isComponentAtPosition)(doc, tsDoc, originalPosition))) { return null; } const svelteNode = tsDoc.svelteNodeAt(originalPosition); if (this.configManager.getConfig().svelte.useNewTransformation && ((0, documents.isInHTMLTagRange)(doc.html, doc.offsetAt(originalPosition)) || (0, svelteAstUtils.isAttributeName)(svelteNode, 'Element') || (0, svelteAstUtils.isEventHandler)(svelteNode, 'Element'))) { return null; } if (tsDoc.getFullText().charAt(renameInfo.triggerSpan.start) === '$') { const definition = (_c = (_b = lang.getDefinitionAndBoundSpan(tsDoc.filePath, generatedOffset)) === null || _b === void 0 ? void 0 : _b.definitions) === null || _c === void 0 ? void 0 : _c[0]; if (definition && (0, utils$1.isTextSpanInGeneratedCode)(tsDoc.getFullText(), definition.textSpan)) { renameInfo.triggerSpan.start++; renameInfo.triggerSpan.length--; renameInfo.isStore = true; } } return renameInfo; } async enhanceRenamesInCaseOf$Store(renameLocations, newName, docs, lang) { for (const loc of renameLocations) { const snapshot = await docs.retrieve(loc.fileName); if ((0, utils$1.isTextSpanInGeneratedCode)(snapshot.getFullText(), loc.textSpan)) { if ((0, utils$1.isStoreVariableIn$storeDeclaration)(snapshot.getFullText(), loc.textSpan.start)) { const storeRenameLocations = lang.findRenameLocations(snapshot.filePath, (0, utils$1.get$storeOffsetOf$storeDeclaration)(snapshot.getFullText(), loc.textSpan.start), false, false, true); return await this.mapAndFilterRenameLocations(storeRenameLocations, docs, `$${newName}`); } else if ((0, utils$1.is$storeVariableIn$storeDeclaration)(snapshot.getFullText(), loc.textSpan.start)) { const storeRenameLocations = lang.findRenameLocations(snapshot.filePath, (0, utils$1.getStoreOffsetOf$storeDeclaration)(snapshot.getFullText(), loc.textSpan.start), false, false, true); return await this.mapAndFilterRenameLocations(storeRenameLocations, docs); } } } return []; } async getAdditionLocationsForRenameOfPropInsideComponentWithProp(document, tsDoc, position, convertedRenameLocations, snapshots, lang) { const regex = new RegExp(`export\\s+let\\s+${this.getVariableAtPosition(tsDoc, lang, position)}($|\\s|;|:)` ); const isRenameInsideComponentWithProp = regex.test((0, documents.getLineAtPosition)(position, document.getText())); if (!isRenameInsideComponentWithProp) { return []; } const updatePropLocation = this.findLocationWhichWantsToUpdatePropName(convertedRenameLocations, snapshots); if (!updatePropLocation) { return []; } const idxOfOldPropName = tsDoc .getFullText() .lastIndexOf(':', updatePropLocation.textSpan.start); const replacementsForProp = (lang.findRenameLocations(updatePropLocation.fileName, idxOfOldPropName, false, false) || []).filter((rename) => rename.fileName !== updatePropLocation.fileName || this.isInSvelte2TsxPropLine(tsDoc, rename)); return await this.mapAndFilterRenameLocations(replacementsForProp, snapshots); } async getAdditionalLocationsForRenameOfPropInsideOtherComponent(convertedRenameLocations, snapshots, lang) { const updatePropLocation = this.findLocationWhichWantsToUpdatePropName(convertedRenameLocations, snapshots); if (!updatePropLocation) { return []; } const doc = snapshots.get(updatePropLocation.fileName); const match = this.matchGeneratedExportLet(doc, updatePropLocation); if (!match) { return []; } const idx = (match.index || 0) + match[0].lastIndexOf(match[1]); const replacementsForProp = lang.findRenameLocations(updatePropLocation.fileName, idx, false, false) || []; return this.checkShortHandBindingOrSlotLetLocation(lang, await this.mapAndFilterRenameLocations(replacementsForProp, snapshots), snapshots); } matchGeneratedExportLet(snapshot, updatePropLocation) { const regex = new RegExp( `\\s+let\\s+(${snapshot .getFullText() .substring(updatePropLocation.textSpan.start, updatePropLocation.textSpan.start + updatePropLocation.textSpan.length)})($|\\s|;|:)`); const match = snapshot.getFullText().match(regex); return match; } findLocationWhichWantsToUpdatePropName(convertedRenameLocations, snapshots) { return convertedRenameLocations.find((loc) => { if (loc.range.start.line >= 0 && loc.range.end.line >= 0) { return; } const snapshot = snapshots.get(loc.fileName); if (!(snapshot instanceof DocumentSnapshot_1.SvelteDocumentSnapshot)) { return false; } return this.isInSvelte2TsxPropLine(snapshot, loc); }); } isInSvelte2TsxPropLine(snapshot, loc) { return (0, utils$1.isAfterSvelte2TsxPropsReturn)(snapshot.getFullText(), loc.textSpan.start); } async mapAndFilterRenameLocations(renameLocations, snapshots, newName) { const mappedLocations = await Promise.all(renameLocations.map(async (loc) => { const snapshot = await snapshots.retrieve(loc.fileName); if (!(0, utils$1.isTextSpanInGeneratedCode)(snapshot.getFullText(), loc.textSpan)) { return { ...loc, range: this.mapRangeToOriginal(snapshot, loc.textSpan), newName }; } })); return this.filterWrongRenameLocations(mappedLocations.filter(utils$4.isNotNullOrUndefined)); } filterWrongRenameLocations(mappedLocations) { return (0, utils$4.filterAsync)(mappedLocations, async (loc) => { const snapshot = await this.getSnapshot(loc.fileName); if (!(snapshot instanceof DocumentSnapshot_1.SvelteDocumentSnapshot)) { return true; } const content = snapshot.getText(0, snapshot.getLength()); return (notPrecededBy('__sveltets_1_instanceOf(') && notPrecededBy('__sveltets_1_ensureType(') && notPrecededBy('= __sveltets_1_store_get(')); function notPrecededBy(str) { return (content.lastIndexOf(str, loc.textSpan.start) !== loc.textSpan.start - str.length); } }); } mapRangeToOriginal(snapshot, textSpan) { const range = (0, documents.mapRangeToOriginal)(snapshot, (0, utils$2.convertRange)(snapshot, textSpan)); if (range.end.character - range.start.character < textSpan.length) { range.end.character++; } return range; } getVariableAtPosition(tsDoc, lang, position) { const offset = tsDoc.offsetAt(tsDoc.getGeneratedPosition(position)); const { start, length } = lang.getSmartSelectionRange(tsDoc.filePath, offset).textSpan; return tsDoc.getText(start, start + length); } async getLSAndTSDoc(document) { return this.lsAndTsDocResolver.getLSAndTSDoc(document); } getSnapshot(filePath) { return this.lsAndTsDocResolver.getSnapshot(filePath); } checkShortHandBindingOrSlotLetLocation(lang, renameLocations, snapshots) { const bind = 'bind:'; return renameLocations.map((location) => { var _a, _b, _c; const sourceFile = (_a = lang.getProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFile(location.fileName); if (!sourceFile || location.fileName !== sourceFile.fileName || location.range.start.line < 0 || location.range.end.line < 0) { return location; } const snapshot = snapshots.get(location.fileName); if (!(snapshot instanceof DocumentSnapshot_1.SvelteDocumentSnapshot)) { return location; } const { parent } = snapshot; if (this.configManager.getConfig().svelte.useNewTransformation) { let prefixText = (_b = location.prefixText) === null || _b === void 0 ? void 0 : _b.trimRight(); if (!prefixText || prefixText.slice(-1) !== ':') { return location; } let rangeStart = parent.offsetAt(location.range.start); if (!(0, documents.getNodeIfIsInStartTag)(parent.html, rangeStart) || (parent.getText().charAt(rangeStart - 1) !== ':' && !/[^{]\s+{$/.test(parent.getText({ start: main$4.Position.create(0, 0), end: location.range.start })))) { return location; } prefixText = prefixText.slice(0, -1) + '={'; location = { ...location, prefixText, suffixText: '}' }; if (snapshot.getOriginalText().charAt(rangeStart - 1) === '{') { rangeStart--; const rangeEnd = parent.offsetAt(location.range.end) + 1; location.range = { start: parent.positionAt(rangeStart), end: parent.positionAt(rangeEnd) }; } return location; } const renamingInfo = (_c = this.getShorthandPropInfo(sourceFile, location)) !== null && _c !== void 0 ? _c : this.getSlotLetInfo(sourceFile, location); if (!renamingInfo) { return location; } const [renamingNode, identifierName] = renamingInfo; const originalStart = parent.offsetAt(location.range.start); const isShortHandBinding = parent.getText().substring(originalStart - bind.length, originalStart) === bind; const directiveName = (isShortHandBinding ? bind : '') + identifierName; const prefixText = directiveName + '={'; const newRange = (0, documents.mapRangeToOriginal)(snapshot, (0, utils$2.convertRange)(snapshot, { start: renamingNode.getStart(), length: renamingNode.getWidth() })); if (isShortHandBinding || parent.getText({ start: newRange.start, end: location.range.start }).trimLeft() === '{') { newRange.start.character++; } return { ...location, prefixText, suffixText: '}', range: newRange }; }); } getShorthandPropInfo(sourceFile, location) { var _a; const possibleJsxAttribute = (0, utils$1.findContainingNode)(sourceFile, location.textSpan, typescript_1.default.isJsxAttribute); if (!possibleJsxAttribute) { return null; } const attributeName = possibleJsxAttribute.name.getText(); const { initializer } = possibleJsxAttribute; if (!initializer || !typescript_1.default.isJsxExpression(initializer) || attributeName !== ((_a = initializer.expression) === null || _a === void 0 ? void 0 : _a.getText())) { return null; } return [possibleJsxAttribute, attributeName]; } getSlotLetInfo(sourceFile, location) { const possibleSlotLet = (0, utils$1.findContainingNode)(sourceFile, location.textSpan, typescript_1.default.isVariableDeclaration); if (!possibleSlotLet || !typescript_1.default.isObjectBindingPattern(possibleSlotLet.name)) { return null; } const bindingElement = (0, utils$1.findContainingNode)(possibleSlotLet.name, location.textSpan, typescript_1.default.isBindingElement); if (!bindingElement || bindingElement.propertyName) { return null; } const identifierName = bindingElement.name.getText(); return [bindingElement, identifierName]; } } exports.RenameProviderImpl = RenameProviderImpl; }); getDefaultExportFromCjs(RenameProvider); var SelectionRangeProvider = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.SelectionRangeProviderImpl = void 0; class SelectionRangeProviderImpl { constructor(lsAndTsDocResolver) { this.lsAndTsDocResolver = lsAndTsDocResolver; } async getSelectionRange(document, position) { const { tsDoc, lang } = await this.lsAndTsDocResolver.getLSAndTSDoc(document); const tsSelectionRange = lang.getSmartSelectionRange(tsDoc.filePath, tsDoc.offsetAt(tsDoc.getGeneratedPosition(position))); const selectionRange = this.toSelectionRange(tsDoc, tsSelectionRange); const mappedRange = (0, documents.mapSelectionRangeToParent)(tsDoc, selectionRange); return this.filterOutUnmappedRange(mappedRange); } toSelectionRange(snapshot, { textSpan, parent }) { return { range: (0, utils$2.convertRange)(snapshot, textSpan), parent: parent && this.toSelectionRange(snapshot, parent) }; } filterOutUnmappedRange(selectionRange) { const flattened = this.flattenAndReverseSelectionRange(selectionRange); const filtered = flattened.filter((range) => range.start.line > 0 && range.end.line > 0); if (!filtered.length) { return null; } let result; for (const selectionRange of filtered) { result = main$4.SelectionRange.create(selectionRange, result); } return result !== null && result !== void 0 ? result : null; } flattenAndReverseSelectionRange(selectionRange) { const result = []; let current = selectionRange; while (current.parent) { result.unshift(current.range); current = current.parent; } return result; } } exports.SelectionRangeProviderImpl = SelectionRangeProviderImpl; }); getDefaultExportFromCjs(SelectionRangeProvider); var SemanticTokensProvider = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SemanticTokensProviderImpl = void 0; const typescript_1 = __importDefault(ts__default__default['default']); const CONTENT_LENGTH_LIMIT = 50000; class SemanticTokensProviderImpl { constructor(lsAndTsDocResolver) { this.lsAndTsDocResolver = lsAndTsDocResolver; } async getSemanticTokens(textDocument, range, cancellationToken) { const { lang, tsDoc } = await this.lsAndTsDocResolver.getLSAndTSDoc(textDocument); if ((!range && tsDoc.getLength() > CONTENT_LENGTH_LIMIT) || (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested)) { return null; } if (!textDocument.scriptInfo && !textDocument.moduleScriptInfo) { return null; } const textSpan = range ? (0, utils$2.convertToTextSpan)(range, tsDoc) : { start: 0, length: tsDoc.parserError ? tsDoc.getLength() : tsDoc.getFullText().lastIndexOf('return { props:') || tsDoc.getLength() }; const { spans } = lang.getEncodedSemanticClassifications(tsDoc.filePath, textSpan, typescript_1.default.SemanticClassificationFormat.TwentyTwenty); const data = []; let index = 0; while (index < spans.length) { const generatedOffset = spans[index++]; const generatedLength = spans[index++]; const encodedClassification = spans[index++]; const classificationType = this.getTokenTypeFromClassification(encodedClassification); if (classificationType < 0) { continue; } const originalPosition = this.mapToOrigin(textDocument, tsDoc, generatedOffset, generatedLength); if (!originalPosition) { continue; } const [line, character, length] = originalPosition; if (length <= 0) { continue; } const modifier = this.getTokenModifierFromClassification(encodedClassification); data.push([line, character, length, classificationType, modifier]); } const sorted = data.sort((a, b) => { const [lineA, charA] = a; const [lineB, charB] = b; return lineA - lineB || charA - charB; }); const builder = new main$4.SemanticTokensBuilder(); sorted.forEach((tokenData) => builder.push(...tokenData)); return builder.build(); } mapToOrigin(document, snapshot, generatedOffset, generatedLength) { if ((0, utils$1.isInGeneratedCode)(snapshot.getFullText(), generatedOffset, generatedOffset + generatedLength)) { return; } const range = { start: snapshot.positionAt(generatedOffset), end: snapshot.positionAt(generatedOffset + generatedLength) }; const { start: startPosition, end: endPosition } = (0, documents.mapRangeToOriginal)(snapshot, range); if (startPosition.line < 0 || endPosition.line < 0) { return; } const startOffset = document.offsetAt(startPosition); const endOffset = document.offsetAt(endPosition); return [startPosition.line, startPosition.character, endOffset - startOffset, startOffset]; } getTokenTypeFromClassification(tsClassification) { return (tsClassification >> 8 ) - 1; } getTokenModifierFromClassification(tsClassification) { return tsClassification & 255 ; } } exports.SemanticTokensProviderImpl = SemanticTokensProviderImpl; }); getDefaultExportFromCjs(SemanticTokensProvider); var SignatureHelpProvider = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SignatureHelpProviderImpl = void 0; const typescript_1 = __importDefault(ts__default__default['default']); class SignatureHelpProviderImpl { constructor(lsAndTsDocResolver) { this.lsAndTsDocResolver = lsAndTsDocResolver; } async getSignatureHelp(document, position, context, cancellationToken) { const { lang, tsDoc } = await this.lsAndTsDocResolver.getLSAndTSDoc(document); if (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) { return null; } const offset = tsDoc.offsetAt(tsDoc.getGeneratedPosition(position)); const triggerReason = this.toTsTriggerReason(context); const info = lang.getSignatureHelpItems(tsDoc.filePath, offset, triggerReason ? { triggerReason } : undefined); if (!info || info.items.some((signature) => this.isInSvelte2tsxGeneratedFunction(signature))) { return null; } const signatures = info.items.map(this.toSignatureHelpInformation); return { signatures, activeSignature: info.selectedItemIndex, activeParameter: info.argumentIndex }; } isReTrigger(isRetrigger, triggerCharacter) { return (isRetrigger && (this.isTriggerCharacter(triggerCharacter) || SignatureHelpProviderImpl.retriggerCharacters.includes(triggerCharacter))); } isTriggerCharacter(triggerCharacter) { return SignatureHelpProviderImpl.triggerCharacters.includes(triggerCharacter); } toTsTriggerReason(context) { switch (context === null || context === void 0 ? void 0 : context.triggerKind) { case main$4.SignatureHelpTriggerKind.TriggerCharacter: if (context.triggerCharacter) { if (this.isReTrigger(context.isRetrigger, context.triggerCharacter)) { return { kind: 'retrigger', triggerCharacter: context.triggerCharacter }; } if (this.isTriggerCharacter(context.triggerCharacter)) { return { kind: 'characterTyped', triggerCharacter: context.triggerCharacter }; } } return { kind: 'invoked' }; case main$4.SignatureHelpTriggerKind.ContentChange: return context.isRetrigger ? { kind: 'retrigger' } : { kind: 'invoked' }; case main$4.SignatureHelpTriggerKind.Invoked: default: return { kind: 'invoked' }; } } toSignatureHelpInformation(item) { const [prefixLabel, separatorLabel, suffixLabel] = [ item.prefixDisplayParts, item.separatorDisplayParts, item.suffixDisplayParts ].map(typescript_1.default.displayPartsToString); let textIndex = prefixLabel.length; let signatureLabel = ''; const parameters = []; const lastIndex = item.parameters.length - 1; item.parameters.forEach((parameter, index) => { const label = typescript_1.default.displayPartsToString(parameter.displayParts); const startIndex = textIndex; const endIndex = textIndex + label.length; const doc = typescript_1.default.displayPartsToString(parameter.documentation); signatureLabel += label; parameters.push(main$4.ParameterInformation.create([startIndex, endIndex], doc)); if (index < lastIndex) { textIndex = endIndex + separatorLabel.length; signatureLabel += separatorLabel; } }); const signatureDocumentation = (0, previewer.getMarkdownDocumentation)(item.documentation, item.tags.filter((tag) => tag.name !== 'param')); return { label: prefixLabel + signatureLabel + suffixLabel, documentation: signatureDocumentation ? { value: signatureDocumentation, kind: main$4.MarkupKind.Markdown } : undefined, parameters }; } isInSvelte2tsxGeneratedFunction(signatureHelpItem) { return signatureHelpItem.prefixDisplayParts.some((part) => part.text.includes('__sveltets')); } } exports.SignatureHelpProviderImpl = SignatureHelpProviderImpl; SignatureHelpProviderImpl.triggerCharacters = ['(', ',', '<']; SignatureHelpProviderImpl.retriggerCharacters = [')']; }); getDefaultExportFromCjs(SignatureHelpProvider); var TypeDefinitionProvider = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.TypeDefinitionProviderImpl = void 0; class TypeDefinitionProviderImpl { constructor(lsAndTsDocResolver) { this.lsAndTsDocResolver = lsAndTsDocResolver; } async getTypeDefinition(document, position) { const { tsDoc, lang } = await this.lsAndTsDocResolver.getLSAndTSDoc(document); const offset = tsDoc.offsetAt(tsDoc.getGeneratedPosition(position)); const typeDefs = lang.getTypeDefinitionAtPosition(tsDoc.filePath, offset); const snapshots = new utils$1.SnapshotMap(this.lsAndTsDocResolver); snapshots.set(tsDoc.filePath, tsDoc); if (!typeDefs) { return null; } const result = await Promise.all(typeDefs.map(async (typeDef) => { const snapshot = await snapshots.retrieve(typeDef.fileName); if ((0, utils$1.isTextSpanInGeneratedCode)(snapshot.getFullText(), typeDef.textSpan)) { return; } const range = (0, documents.mapRangeToOriginal)(snapshot, (0, utils$2.convertRange)(snapshot, typeDef.textSpan)); if (range.start.line >= 0 && range.end.line >= 0) { return main.Location.create((0, utils$4.pathToUrl)(typeDef.fileName), range); } })); return result.filter(utils$4.isNotNullOrUndefined); } } exports.TypeDefinitionProviderImpl = TypeDefinitionProviderImpl; }); getDefaultExportFromCjs(TypeDefinitionProvider); var UpdateImportsProvider = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.UpdateImportsProviderImpl = void 0; class UpdateImportsProviderImpl { constructor(lsAndTsDocResolver) { this.lsAndTsDocResolver = lsAndTsDocResolver; } async updateImports(fileRename) { const oldPath = (0, utils$4.urlToPath)(fileRename.oldUri); const newPath = (0, utils$4.urlToPath)(fileRename.newUri); if (!oldPath || !newPath) { return null; } const ls = await this.getLSForPath(newPath); const fileChanges = ls.getEditsForFileRename(oldPath, newPath, {}, {}); await this.lsAndTsDocResolver.updateSnapshotPath(oldPath, newPath); const updateImportsChanges = fileChanges .filter((change) => !change.isNewFile || change.fileName === oldPath) .map((change) => { change.fileName = change.fileName.replace(oldPath, newPath); return change; }); const docs = new utils$1.SnapshotMap(this.lsAndTsDocResolver); const documentChanges = await Promise.all(updateImportsChanges.map(async (change) => { const snapshot = await docs.retrieve(change.fileName); return main$4.TextDocumentEdit.create(main$4.OptionalVersionedTextDocumentIdentifier.create(snapshot.getURL(), null), change.textChanges.map((edit) => { const range = (0, documents.mapRangeToOriginal)(snapshot, (0, utils$2.convertRange)(snapshot, edit.span)); return main$4.TextEdit.replace(range, edit.newText); })); })); return { documentChanges }; } async getLSForPath(path) { return this.lsAndTsDocResolver.getLSForPath(path); } } exports.UpdateImportsProviderImpl = UpdateImportsProviderImpl; }); getDefaultExportFromCjs(UpdateImportsProvider); var SnapshotManager_1 = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ignoredBuildDirectories = exports.SnapshotManager = exports.GlobalSnapshotsManager = void 0; const typescript_1 = __importDefault(ts__default__default['default']); class GlobalSnapshotsManager { constructor() { this.emitter = new events_1__default['default'].EventEmitter(); this.documents = new Map(); } get(fileName) { fileName = (0, utils$4.normalizePath)(fileName); return this.documents.get(fileName); } set(fileName, document) { fileName = (0, utils$4.normalizePath)(fileName); this.documents.set(fileName, document); this.emitter.emit('change', fileName, document); } delete(fileName) { fileName = (0, utils$4.normalizePath)(fileName); this.documents.delete(fileName); this.emitter.emit('change', fileName, undefined); } updateTsOrJsFile(fileName, changes) { fileName = (0, utils$4.normalizePath)(fileName); const previousSnapshot = this.get(fileName); if (changes) { if (!(previousSnapshot instanceof DocumentSnapshot_1.JSOrTSDocumentSnapshot)) { return; } previousSnapshot.update(changes); this.emitter.emit('change', fileName, previousSnapshot); return previousSnapshot; } else { const newSnapshot = DocumentSnapshot_1.DocumentSnapshot.fromNonSvelteFilePath(fileName); if (previousSnapshot) { newSnapshot.version = previousSnapshot.version + 1; } else { newSnapshot.version += 1; } this.set(fileName, newSnapshot); return newSnapshot; } } onChange(listener) { this.emitter.on('change', listener); } removeChangeListener(listener) { this.emitter.off('change', listener); } } exports.GlobalSnapshotsManager = GlobalSnapshotsManager; class SnapshotManager { constructor(globalSnapshotsManager, projectFiles, fileSpec, workspaceRoot) { this.globalSnapshotsManager = globalSnapshotsManager; this.projectFiles = projectFiles; this.fileSpec = fileSpec; this.workspaceRoot = workspaceRoot; this.documents = new Map(); this.lastLogged = new Date(new Date().getTime() - 60001); this.watchExtensions = [ typescript_1.default.Extension.Dts, typescript_1.default.Extension.Js, typescript_1.default.Extension.Jsx, typescript_1.default.Extension.Ts, typescript_1.default.Extension.Tsx, typescript_1.default.Extension.Json ]; this.onSnapshotChange = this.onSnapshotChange.bind(this); this.globalSnapshotsManager.onChange(this.onSnapshotChange); } onSnapshotChange(fileName, document) { if (!document) { this.documents.delete(fileName); } else if (this.documents.has(fileName)) { this.documents.set(fileName, document); } } updateProjectFiles() { const { include, exclude } = this.fileSpec; if ((include === null || include === void 0 ? void 0 : include.length) === 0) { return; } const projectFiles = typescript_1.default.sys .readDirectory(this.workspaceRoot, this.watchExtensions, exclude, include) .map(utils$4.normalizePath); this.projectFiles = Array.from(new Set([...this.projectFiles, ...projectFiles])); } updateTsOrJsFile(fileName, changes) { const snapshot = this.globalSnapshotsManager.updateTsOrJsFile(fileName, changes); if (snapshot) { this.documents.set((0, utils$4.normalizePath)(fileName), snapshot); } } has(fileName) { fileName = (0, utils$4.normalizePath)(fileName); return this.projectFiles.includes(fileName) || this.getFileNames().includes(fileName); } set(fileName, snapshot) { this.globalSnapshotsManager.set(fileName, snapshot); this.documents.set((0, utils$4.normalizePath)(fileName), snapshot); this.logStatistics(); } get(fileName) { fileName = (0, utils$4.normalizePath)(fileName); let snapshot = this.documents.get(fileName); if (!snapshot) { snapshot = this.globalSnapshotsManager.get(fileName); if (snapshot) { this.documents.set(fileName, snapshot); } } return snapshot; } delete(fileName) { fileName = (0, utils$4.normalizePath)(fileName); this.projectFiles = this.projectFiles.filter((s) => s !== fileName); this.globalSnapshotsManager.delete(fileName); } getFileNames() { return Array.from(this.documents.keys()); } getProjectFileNames() { return [...this.projectFiles]; } logStatistics() { const date = new Date(); if (date.getTime() - this.lastLogged.getTime() > 60000) { this.lastLogged = date; const projectFiles = this.getProjectFileNames(); const allFiles = Array.from(new Set([...projectFiles, ...this.getFileNames()])); logger.Logger.log('SnapshotManager File Statistics:\n' + `Project files: ${projectFiles.length}\n` + `Svelte files: ${allFiles.filter((name) => name.endsWith('.svelte')).length}\n` + `From node_modules: ${allFiles.filter((name) => name.includes('node_modules')).length}\n` + `Total: ${allFiles.length}`); } } dispose() { this.globalSnapshotsManager.removeChangeListener(this.onSnapshotChange); } } exports.SnapshotManager = SnapshotManager; exports.ignoredBuildDirectories = ['__sapper__', '.svelte-kit']; }); getDefaultExportFromCjs(SnapshotManager_1); var TypeScriptPlugin_1 = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TypeScriptPlugin = void 0; const typescript_1 = __importDefault(ts__default__default['default']); class TypeScriptPlugin { constructor(configManager, lsAndTsDocResolver) { this.__name = 'ts'; this.configManager = configManager; this.lsAndTsDocResolver = lsAndTsDocResolver; this.completionProvider = new CompletionProvider.CompletionsProviderImpl(this.lsAndTsDocResolver, this.configManager); this.codeActionsProvider = new CodeActionsProvider.CodeActionsProviderImpl(this.lsAndTsDocResolver, this.completionProvider, configManager); this.updateImportsProvider = new UpdateImportsProvider.UpdateImportsProviderImpl(this.lsAndTsDocResolver); this.diagnosticsProvider = new DiagnosticsProvider.DiagnosticsProviderImpl(this.lsAndTsDocResolver, configManager); this.renameProvider = new RenameProvider.RenameProviderImpl(this.lsAndTsDocResolver, configManager); this.hoverProvider = new HoverProvider.HoverProviderImpl(this.lsAndTsDocResolver); this.findReferencesProvider = new FindReferencesProvider.FindReferencesProviderImpl(this.lsAndTsDocResolver); this.findFileReferencesProvider = new FindFileReferencesProvider.FindFileReferencesProviderImpl(this.lsAndTsDocResolver); this.findComponentReferencesProvider = new FindComponentReferencesProvider.FindComponentReferencesProviderImpl(this.lsAndTsDocResolver); this.selectionRangeProvider = new SelectionRangeProvider.SelectionRangeProviderImpl(this.lsAndTsDocResolver); this.signatureHelpProvider = new SignatureHelpProvider.SignatureHelpProviderImpl(this.lsAndTsDocResolver); this.semanticTokensProvider = new SemanticTokensProvider.SemanticTokensProviderImpl(this.lsAndTsDocResolver); this.implementationProvider = new ImplementationProvider.ImplementationProviderImpl(this.lsAndTsDocResolver); this.typeDefinitionProvider = new TypeDefinitionProvider.TypeDefinitionProviderImpl(this.lsAndTsDocResolver); } async getDiagnostics(document, cancellationToken) { if (!this.featureEnabled('diagnostics')) { return []; } return this.diagnosticsProvider.getDiagnostics(document, cancellationToken); } async doHover(document, position) { if (!this.featureEnabled('hover')) { return null; } return this.hoverProvider.doHover(document, position); } async getDocumentSymbols(document, cancellationToken) { if (!this.featureEnabled('documentSymbols')) { return []; } const { lang, tsDoc } = await this.getLSAndTSDoc(document); if (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) { return []; } const navTree = lang.getNavigationTree(tsDoc.filePath); const symbols = []; collectSymbols(navTree, undefined, (symbol) => symbols.push(symbol)); const topContainerName = symbols[0].name; const result = []; for (let symbol of symbols.slice(1)) { if (symbol.containerName === topContainerName) { symbol.containerName = 'script'; } symbol = (0, documents.mapSymbolInformationToOriginal)(tsDoc, symbol); if (symbol.location.range.start.line < 0 || symbol.location.range.end.line < 0 || (0, utils$4.isZeroLengthRange)(symbol.location.range) || symbol.name.startsWith('__sveltets_')) { continue; } if ((symbol.kind === main$4.SymbolKind.Property || symbol.kind === main$4.SymbolKind.Method) && !(0, utils$2.isInScript)(symbol.location.range.start, document)) { if (symbol.name === 'props' && document.getText().charAt(document.offsetAt(symbol.location.range.start)) !== 'p') { continue; } const node = tsDoc.svelteNodeAt(symbol.location.range.start); if ((node && ((0, svelteAstUtils.isAttributeName)(node) || (0, svelteAstUtils.isAttributeShorthand)(node))) || (0, svelteAstUtils.isEventHandler)(node)) { continue; } } if (symbol.name === '<function>') { let name = (0, documents.getTextInRange)(symbol.location.range, document.getText()).trimLeft(); if (name.length > 50) { name = name.substring(0, 50) + '...'; } symbol.name = name; } if (symbol.name.startsWith('$$_')) { if (!symbol.name.includes('$on')) { continue; } symbol.name = symbol.name.substring(symbol.name.indexOf('$on')); } result.push(symbol); } return result; function collectSymbols(tree, container, cb) { const start = tree.spans[0]; const end = tree.spans[tree.spans.length - 1]; if (start && end) { cb(main$4.SymbolInformation.create(tree.text, (0, utils$2.symbolKindFromString)(tree.kind), main$4.Range.create(tsDoc.positionAt(start.start), tsDoc.positionAt(end.start + end.length)), tsDoc.getURL(), container)); } if (tree.childItems) { for (const child of tree.childItems) { collectSymbols(child, tree.text, cb); } } } } async getCompletions(document, position, completionContext, cancellationToken) { if (!this.featureEnabled('completions')) { return null; } const tsDirectiveCommentCompletions = (0, getDirectiveCommentCompletions_1.getDirectiveCommentCompletions)(position, document, completionContext); const completions = await this.completionProvider.getCompletions(document, position, completionContext, cancellationToken); if (completions && tsDirectiveCommentCompletions) { return main$4.CompletionList.create(completions.items.concat(tsDirectiveCommentCompletions.items), completions.isIncomplete); } return completions !== null && completions !== void 0 ? completions : tsDirectiveCommentCompletions; } async resolveCompletion(document, completionItem, cancellationToken) { return this.completionProvider.resolveCompletion(document, completionItem, cancellationToken); } async getDefinitions(document, position) { const { lang, tsDoc } = await this.getLSAndTSDoc(document); const defs = lang.getDefinitionAndBoundSpan(tsDoc.filePath, tsDoc.offsetAt(tsDoc.getGeneratedPosition(position))); if (!defs || !defs.definitions) { return []; } const snapshots = new utils$1.SnapshotMap(this.lsAndTsDocResolver); snapshots.set(tsDoc.filePath, tsDoc); const result = await Promise.all(defs.definitions.map(async (def) => { if (def.fileName.endsWith('svelte-shims.d.ts')) { return; } let snapshot = await snapshots.retrieve(def.fileName); if ((0, utils$1.isTextSpanInGeneratedCode)(snapshot.getFullText(), def.textSpan)) { if (!(0, utils$1.is$storeVariableIn$storeDeclaration)(snapshot.getFullText(), def.textSpan.start)) { return; } def = lang.getDefinitionAndBoundSpan(tsDoc.filePath, tsDoc.getFullText().indexOf(');', def.textSpan.start) - 1).definitions[0]; snapshot = await snapshots.retrieve(def.fileName); } return main$4.LocationLink.create((0, utils$4.pathToUrl)(def.fileName), (0, utils$2.convertToLocationRange)(snapshot, def.textSpan), (0, utils$2.convertToLocationRange)(snapshot, def.textSpan), (0, utils$2.convertToLocationRange)(tsDoc, defs.textSpan)); })); return result.filter(utils$4.isNotNullOrUndefined); } async prepareRename(document, position) { return this.renameProvider.prepareRename(document, position); } async rename(document, position, newName) { return this.renameProvider.rename(document, position, newName); } async getCodeActions(document, range, context, cancellationToken) { if (!this.featureEnabled('codeActions')) { return []; } return this.codeActionsProvider.getCodeActions(document, range, context, cancellationToken); } async executeCommand(document, command, args) { if (!this.featureEnabled('codeActions')) { return null; } return this.codeActionsProvider.executeCommand(document, command, args); } async updateImports(fileRename) { if (!(this.configManager.enabled('svelte.enable') && this.configManager.enabled('svelte.rename.enable'))) { return null; } return this.updateImportsProvider.updateImports(fileRename); } async findReferences(document, position, context) { return this.findReferencesProvider.findReferences(document, position, context); } async fileReferences(uri) { return this.findFileReferencesProvider.fileReferences(uri); } async findComponentReferences(uri) { return this.findComponentReferencesProvider.findComponentReferences(uri); } async onWatchFileChanges(onWatchFileChangesParas) { let doneUpdateProjectFiles = false; for (const { fileName, changeType } of onWatchFileChangesParas) { const pathParts = fileName.split(/\/|\\/); const dirPathParts = pathParts.slice(0, pathParts.length - 1); if (SnapshotManager_1.ignoredBuildDirectories.some((dir) => dirPathParts.includes(dir))) { continue; } const scriptKind = (0, utils$2.getScriptKindFromFileName)(fileName); if (scriptKind === typescript_1.default.ScriptKind.Unknown) { continue; } if (changeType === main$4.FileChangeType.Created && !doneUpdateProjectFiles) { doneUpdateProjectFiles = true; await this.lsAndTsDocResolver.updateProjectFiles(); } else if (changeType === main$4.FileChangeType.Deleted) { await this.lsAndTsDocResolver.deleteSnapshot(fileName); } else { await this.lsAndTsDocResolver.updateExistingTsOrJsFile(fileName); } } } async updateTsOrJsFile(fileName, changes) { await this.lsAndTsDocResolver.updateExistingTsOrJsFile(fileName, changes); } async getSelectionRange(document, position) { if (!this.featureEnabled('selectionRange')) { return null; } return this.selectionRangeProvider.getSelectionRange(document, position); } async getSignatureHelp(document, position, context, cancellationToken) { if (!this.featureEnabled('signatureHelp')) { return null; } return this.signatureHelpProvider.getSignatureHelp(document, position, context, cancellationToken); } async getSemanticTokens(textDocument, range, cancellationToken) { if (!this.featureEnabled('semanticTokens')) { return { data: [] }; } return this.semanticTokensProvider.getSemanticTokens(textDocument, range, cancellationToken); } async getImplementation(document, position) { return this.implementationProvider.getImplementation(document, position); } async getTypeDefinition(document, position) { return this.typeDefinitionProvider.getTypeDefinition(document, position); } async getLSAndTSDoc(document) { return this.lsAndTsDocResolver.getLSAndTSDoc(document); } getSnapshotManager(fileName) { return this.lsAndTsDocResolver.getSnapshotManager(fileName); } featureEnabled(feature) { return (this.configManager.enabled('typescript.enable') && this.configManager.enabled(`typescript.${feature}.enable`)); } } exports.TypeScriptPlugin = TypeScriptPlugin; }); getDefaultExportFromCjs(TypeScriptPlugin_1); var svelteSys = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createSvelteSys = void 0; const typescript_1 = __importDefault(ts__default__default['default']); function createSvelteSys(getSnapshot) { const fileExistsCache = new Map(); const svelteSys = { ...typescript_1.default.sys, fileExists(path) { var _a; path = (0, utils$2.ensureRealSvelteFilePath)(path); const exists = (_a = fileExistsCache.get(path)) !== null && _a !== void 0 ? _a : typescript_1.default.sys.fileExists(path); fileExistsCache.set(path, exists); return exists; }, readFile(path) { const snapshot = getSnapshot(path); return snapshot.getText(0, snapshot.getLength()); }, readDirectory(path, extensions, exclude, include, depth) { const extensionsWithSvelte = (extensions !== null && extensions !== void 0 ? extensions : []).concat('.svelte'); return typescript_1.default.sys.readDirectory(path, extensionsWithSvelte, exclude, include, depth); }, deleteFile(path) { var _a, _b; fileExistsCache.delete((0, utils$2.ensureRealSvelteFilePath)(path)); return (_b = (_a = typescript_1.default.sys).deleteFile) === null || _b === void 0 ? void 0 : _b.call(_a, path); }, deleteFromCache(path) { fileExistsCache.delete((0, utils$2.ensureRealSvelteFilePath)(path)); } }; if (typescript_1.default.sys.realpath) { const realpath = typescript_1.default.sys.realpath; svelteSys.realpath = function (path) { if ((0, utils$2.isVirtualSvelteFilePath)(path)) { return realpath((0, utils$2.toRealSvelteFilePath)(path)) + '.ts'; } return realpath(path); }; } return svelteSys; } exports.createSvelteSys = createSvelteSys; }); getDefaultExportFromCjs(svelteSys); var moduleLoader = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createSvelteModuleLoader = void 0; const typescript_1 = __importDefault(ts__default__default['default']); class ModuleResolutionCache { constructor() { this.cache = new Map(); } get(moduleName, containingFile) { return this.cache.get(this.getKey(moduleName, containingFile)); } has(moduleName, containingFile) { return this.cache.has(this.getKey(moduleName, containingFile)); } set(moduleName, containingFile, resolvedModule) { this.cache.set(this.getKey(moduleName, containingFile), resolvedModule); } delete(resolvedModuleName) { this.cache.forEach((val, key) => { if ((val === null || val === void 0 ? void 0 : val.resolvedFileName) === resolvedModuleName) { this.cache.delete(key); } }); } deleteUnresolvedResolutionsFromCache(path) { const fileNameWithoutEnding = (0, utils$4.getLastPartOfPath)(path).split('.').shift() || ''; this.cache.forEach((val, key) => { const moduleName = key.split(':::').pop() || ''; if (!val && moduleName.includes(fileNameWithoutEnding)) { this.cache.delete(key); } }); } getKey(moduleName, containingFile) { return containingFile + ':::' + (0, utils$2.ensureRealSvelteFilePath)(moduleName); } } class ImpliedNodeFormatResolver { constructor() { this.alreadyResolved = new Map(); } resolve(importPath, importIdxInFile, sourceFile, compilerOptions) { if ((0, utils$2.isSvelteFilePath)(importPath)) { return undefined; } let mode = undefined; if (sourceFile) { if (!sourceFile.impliedNodeFormat && (0, utils$2.isSvelteFilePath)(sourceFile.fileName)) { if (!this.alreadyResolved.has(sourceFile.fileName)) { sourceFile.impliedNodeFormat = typescript_1.default.getImpliedNodeFormatForFile((0, utils$2.toVirtualSvelteFilePath)(sourceFile.fileName), undefined, typescript_1.default.sys, compilerOptions); this.alreadyResolved.set(sourceFile.fileName, sourceFile.impliedNodeFormat); } else { sourceFile.impliedNodeFormat = this.alreadyResolved.get(sourceFile.fileName); } } mode = typescript_1.default.getModeForResolutionAtIndex(sourceFile, importIdxInFile); } return mode; } } function createSvelteModuleLoader(getSnapshot, compilerOptions) { const svelteSys$1 = (0, svelteSys.createSvelteSys)(getSnapshot); const moduleCache = new ModuleResolutionCache(); const impliedNodeFormatResolver = new ImpliedNodeFormatResolver(); return { fileExists: svelteSys$1.fileExists, readFile: svelteSys$1.readFile, readDirectory: svelteSys$1.readDirectory, deleteFromModuleCache: (path) => { svelteSys$1.deleteFromCache(path); moduleCache.delete(path); }, deleteUnresolvedResolutionsFromCache: (path) => { svelteSys$1.deleteFromCache(path); moduleCache.deleteUnresolvedResolutionsFromCache(path); }, resolveModuleNames }; function resolveModuleNames(moduleNames, containingFile, _reusedNames, _redirectedReference, _options, containingSourceFile) { return moduleNames.map((moduleName, index) => { if (moduleCache.has(moduleName, containingFile)) { return moduleCache.get(moduleName, containingFile); } const resolvedModule = resolveModuleName(moduleName, containingFile, containingSourceFile, index); moduleCache.set(moduleName, containingFile, resolvedModule); return resolvedModule; }); } function resolveModuleName(name, containingFile, containingSourceFile, index) { const mode = impliedNodeFormatResolver.resolve(name, index, containingSourceFile, compilerOptions); const tsResolvedModule = typescript_1.default.resolveModuleName(name, containingFile, compilerOptions, typescript_1.default.sys, undefined, undefined, mode).resolvedModule; if (tsResolvedModule && !(0, utils$2.isVirtualSvelteFilePath)(tsResolvedModule.resolvedFileName)) { return tsResolvedModule; } const svelteResolvedModule = typescript_1.default.resolveModuleName(name, containingFile, compilerOptions, svelteSys$1, undefined, undefined, mode).resolvedModule; if (!svelteResolvedModule || !(0, utils$2.isVirtualSvelteFilePath)(svelteResolvedModule.resolvedFileName)) { return svelteResolvedModule; } const resolvedFileName = (0, utils$2.ensureRealSvelteFilePath)(svelteResolvedModule.resolvedFileName); const snapshot = getSnapshot(resolvedFileName); const resolvedSvelteModule = { extension: (0, utils$2.getExtensionFromScriptKind)(snapshot && snapshot.scriptKind), resolvedFileName, isExternalLibraryImport: svelteResolvedModule.isExternalLibraryImport }; return resolvedSvelteModule; } } exports.createSvelteModuleLoader = createSvelteModuleLoader; }); getDefaultExportFromCjs(moduleLoader); var service_1 = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getServiceForTsconfig = exports.forAllServices = exports.getService = exports.__resetCache = void 0; const typescript_1 = __importDefault(ts__default__default['default']); const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024; const services = new Map(); const serviceSizeMap = new Map(); const configWatchers = new Map(); const extendedConfigWatchers = new Map(); const extendedConfigToTsConfigPath = new Map(); const pendingReloads = new Set(); function __resetCache() { services.clear(); serviceSizeMap.clear(); } exports.__resetCache = __resetCache; async function getService(path, workspaceUris, docContext) { const tsconfigPath = (0, utils$2.findTsConfigPath)(path, workspaceUris, docContext.tsSystem.fileExists); return getServiceForTsconfig(tsconfigPath, docContext); } exports.getService = getService; async function forAllServices(cb) { for (const service of services.values()) { cb(await service); } } exports.forAllServices = forAllServices; async function getServiceForTsconfig(tsconfigPath, docContext) { let service; if (services.has(tsconfigPath)) { service = await services.get(tsconfigPath); } else { const reloading = pendingReloads.has(tsconfigPath); if (reloading) { logger.Logger.log('Reloading ts service at ', tsconfigPath, ' due to config updated'); } else { logger.Logger.log('Initialize new ts service at ', tsconfigPath); } pendingReloads.delete(tsconfigPath); const newService = createLanguageService(tsconfigPath, docContext); services.set(tsconfigPath, newService); service = await newService; } return service; } exports.getServiceForTsconfig = getServiceForTsconfig; async function createLanguageService(tsconfigPath, docContext) { var _a; const workspacePath = tsconfigPath ? (0, path__default['default'].dirname)(tsconfigPath) : ''; const { tsSystem } = docContext; const { options: compilerOptions, fileNames: files, raw, extendedConfigPaths } = getParsedConfig(); const snapshotManager = new SnapshotManager_1.SnapshotManager(docContext.globalSnapshotsManager, files, raw, workspacePath || process.cwd()); await configLoader.configLoader.loadConfigs(workspacePath); const svelteModuleLoader = (0, moduleLoader.createSvelteModuleLoader)(getSnapshot, compilerOptions); let svelteTsPath; try { svelteTsPath = (0, path__default['default'].dirname)(require.resolve(docContext.ambientTypesSource)); } catch (e) { svelteTsPath = __dirname; } const svelteTsxFiles = [ './svelte-shims.d.ts', './svelte-jsx.d.ts', './svelte-native-jsx.d.ts' ].map((f) => tsSystem.resolvePath((0, path__default['default'].resolve)(svelteTsPath, f))); let languageServiceReducedMode = false; let projectVersion = 0; const host = { getCompilationSettings: () => compilerOptions, getScriptFileNames: () => Array.from(new Set([ ...(languageServiceReducedMode ? [] : snapshotManager.getProjectFileNames()), ...snapshotManager.getFileNames(), ...svelteTsxFiles ])), getScriptVersion: (fileName) => getSnapshot(fileName).version.toString(), getScriptSnapshot: getSnapshot, getCurrentDirectory: () => workspacePath, getDefaultLibFileName: typescript_1.default.getDefaultLibFilePath, fileExists: svelteModuleLoader.fileExists, readFile: svelteModuleLoader.readFile, resolveModuleNames: svelteModuleLoader.resolveModuleNames, readDirectory: svelteModuleLoader.readDirectory, getDirectories: tsSystem.getDirectories, useCaseSensitiveFileNames: () => tsSystem.useCaseSensitiveFileNames, getScriptKind: (fileName) => getSnapshot(fileName).scriptKind, getProjectVersion: () => projectVersion.toString(), getNewLine: () => tsSystem.newLine }; let languageService = typescript_1.default.createLanguageService(host); const transformationConfig = { transformOnTemplateError: docContext.transformOnTemplateError, useNewTransformation: docContext.useNewTransformation, typingsNamespace: ((_a = raw === null || raw === void 0 ? void 0 : raw.svelteOptions) === null || _a === void 0 ? void 0 : _a.namespace) || 'svelteHTML' }; const onSnapshotChange = () => { projectVersion++; }; docContext.globalSnapshotsManager.onChange(onSnapshotChange); reduceLanguageServiceCapabilityIfFileSizeTooBig(); updateExtendedConfigDependents(); watchConfigFile(); return { tsconfigPath, compilerOptions, getService: () => languageService, updateSnapshot, deleteSnapshot, updateProjectFiles, updateTsOrJsFile, hasFile, fileBelongsToProject, snapshotManager, dispose }; function deleteSnapshot(filePath) { svelteModuleLoader.deleteFromModuleCache(filePath); snapshotManager.delete(filePath); } function updateSnapshot(documentOrFilePath) { return typeof documentOrFilePath === 'string' ? updateSnapshotFromFilePath(documentOrFilePath) : updateSnapshotFromDocument(documentOrFilePath); } function updateSnapshotFromDocument(document) { const filePath = document.getFilePath() || ''; const prevSnapshot = snapshotManager.get(filePath); if ((prevSnapshot === null || prevSnapshot === void 0 ? void 0 : prevSnapshot.version) === document.version) { return prevSnapshot; } if (!prevSnapshot) { svelteModuleLoader.deleteUnresolvedResolutionsFromCache(filePath); } const newSnapshot = DocumentSnapshot_1.DocumentSnapshot.fromDocument(document, transformationConfig); snapshotManager.set(filePath, newSnapshot); if (prevSnapshot && prevSnapshot.scriptKind !== newSnapshot.scriptKind) { languageService.dispose(); languageService = typescript_1.default.createLanguageService(host); } return newSnapshot; } function updateSnapshotFromFilePath(filePath) { const prevSnapshot = snapshotManager.get(filePath); if (prevSnapshot) { return prevSnapshot; } svelteModuleLoader.deleteUnresolvedResolutionsFromCache(filePath); const newSnapshot = DocumentSnapshot_1.DocumentSnapshot.fromFilePath(filePath, docContext.createDocument, transformationConfig); snapshotManager.set(filePath, newSnapshot); return newSnapshot; } function getSnapshot(fileName) { fileName = (0, utils$2.ensureRealSvelteFilePath)(fileName); let doc = snapshotManager.get(fileName); if (doc) { return doc; } svelteModuleLoader.deleteUnresolvedResolutionsFromCache(fileName); doc = DocumentSnapshot_1.DocumentSnapshot.fromFilePath(fileName, docContext.createDocument, transformationConfig); snapshotManager.set(fileName, doc); return doc; } function updateProjectFiles() { projectVersion++; const projectFileCountBefore = snapshotManager.getProjectFileNames().length; snapshotManager.updateProjectFiles(); const projectFileCountAfter = snapshotManager.getProjectFileNames().length; if (projectFileCountAfter <= projectFileCountBefore) { return; } reduceLanguageServiceCapabilityIfFileSizeTooBig(); } function hasFile(filePath) { return snapshotManager.has(filePath); } function fileBelongsToProject(filePath) { filePath = (0, utils$4.normalizePath)(filePath); return hasFile(filePath) || getParsedConfig().fileNames.includes(filePath); } function updateTsOrJsFile(fileName, changes) { if (!snapshotManager.has(fileName)) { svelteModuleLoader.deleteUnresolvedResolutionsFromCache(fileName); } snapshotManager.updateTsOrJsFile(fileName, changes); } function getParsedConfig() { var _a; const forcedCompilerOptions = { allowNonTsExtensions: true, target: typescript_1.default.ScriptTarget.Latest, allowJs: true, noEmit: true, declaration: false, skipLibCheck: true }; if (!docContext.useNewTransformation) { forcedCompilerOptions.jsx = typescript_1.default.JsxEmit.Preserve; } let configJson = (tsconfigPath && typescript_1.default.readConfigFile(tsconfigPath, tsSystem.readFile).config) || getDefaultJsConfig(); if (!configJson.extends) { configJson = Object.assign({ exclude: getDefaultExclude() }, configJson); } const extendedConfigPaths = new Set(); const { extendedConfigCache } = docContext; const cacheMonitorProxy = { ...docContext.extendedConfigCache, get(key) { extendedConfigPaths.add(key); return extendedConfigCache.get(key); }, has(key) { extendedConfigPaths.add(key); return extendedConfigCache.has(key); }, set(key, value) { extendedConfigPaths.add(key); return extendedConfigCache.set(key, value); } }; const parsedConfig = typescript_1.default.parseJsonConfigFileContent(configJson, tsSystem, workspacePath, forcedCompilerOptions, tsconfigPath, undefined, [ { extension: 'svelte', isMixedContent: true, scriptKind: (_a = typescript_1.default.ScriptKind.Deferred) !== null && _a !== void 0 ? _a : (docContext.useNewTransformation ? typescript_1.default.ScriptKind.TS : typescript_1.default.ScriptKind.TSX) } ], cacheMonitorProxy); const compilerOptions = { ...parsedConfig.options, ...forcedCompilerOptions }; if (!compilerOptions.moduleResolution || compilerOptions.moduleResolution === typescript_1.default.ModuleResolutionKind.Classic) { compilerOptions.moduleResolution = typescript_1.default.ModuleResolutionKind.NodeJs; } if (!compilerOptions.module || [ typescript_1.default.ModuleKind.AMD, typescript_1.default.ModuleKind.CommonJS, typescript_1.default.ModuleKind.ES2015, typescript_1.default.ModuleKind.None, typescript_1.default.ModuleKind.System, typescript_1.default.ModuleKind.UMD ].includes(compilerOptions.module)) { compilerOptions.module = typescript_1.default.ModuleKind.ESNext; } if (!compilerOptions.jsxFactory || !compilerOptions.jsxFactory.startsWith('svelte')) { if (!docContext.useNewTransformation) { compilerOptions.jsxFactory = 'svelte.createElement'; } if (workspacePath) { try { const svelteNativePkgInfo = (0, importPackage.getPackageInfo)('svelte-native', workspacePath); if (svelteNativePkgInfo.path) { if (docContext.useNewTransformation) { parsedConfig.raw.svelteOptions = parsedConfig.raw.svelteOptions || {}; parsedConfig.raw.svelteOptions.namespace = 'svelteNative.JSX'; } else { compilerOptions.jsxFactory = 'svelteNative.createElement'; } } } catch (e) { } } } return { ...parsedConfig, fileNames: parsedConfig.fileNames.map(utils$4.normalizePath), options: compilerOptions, extendedConfigPaths }; } function getDefaultJsConfig() { return { compilerOptions: { maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true }, include: [] }; } function getDefaultExclude() { return ['node_modules', ...SnapshotManager_1.ignoredBuildDirectories]; } function reduceLanguageServiceCapabilityIfFileSizeTooBig() { var _a; if (exceedsTotalSizeLimitForNonTsFiles(compilerOptions, tsconfigPath, snapshotManager, tsSystem)) { languageService.cleanupSemanticCache(); languageServiceReducedMode = true; (_a = docContext.notifyExceedSizeLimit) === null || _a === void 0 ? void 0 : _a.call(docContext); } } function dispose() { var _a; languageService.dispose(); snapshotManager.dispose(); (_a = configWatchers.get(tsconfigPath)) === null || _a === void 0 ? void 0 : _a.close(); configWatchers.delete(tsconfigPath); docContext.globalSnapshotsManager.removeChangeListener(onSnapshotChange); } function updateExtendedConfigDependents() { extendedConfigPaths.forEach((extendedConfig) => { let dependedTsConfig = extendedConfigToTsConfigPath.get(extendedConfig); if (!dependedTsConfig) { dependedTsConfig = new Set(); extendedConfigToTsConfigPath.set(extendedConfig, dependedTsConfig); } dependedTsConfig.add(tsconfigPath); }); } function watchConfigFile() { if (!tsSystem.watchFile || !docContext.watchTsConfig) { return; } if (!configWatchers.has(tsconfigPath) && tsconfigPath) { configWatchers.set(tsconfigPath, tsSystem.watchFile(tsconfigPath, watchConfigCallback)); } for (const config of extendedConfigPaths) { if (extendedConfigWatchers.has(config)) { continue; } extendedConfigWatchers.set(config, tsSystem.watchFile(config, createWatchExtendedConfigCallback(docContext))); } } async function watchConfigCallback(fileName, kind) { var _a; dispose(); if (kind === typescript_1.default.FileWatcherEventKind.Changed) { scheduleReload(fileName); } else if (kind === typescript_1.default.FileWatcherEventKind.Deleted) { services.delete(fileName); } (_a = docContext.onProjectReloaded) === null || _a === void 0 ? void 0 : _a.call(docContext); } } function exceedsTotalSizeLimitForNonTsFiles(compilerOptions, tsconfigPath, snapshotManager, tsSystem) { var _a, _b; if (compilerOptions.disableSizeLimit) { return false; } let availableSpace = maxProgramSizeForNonTsFiles; serviceSizeMap.set(tsconfigPath, 0); serviceSizeMap.forEach((size) => { availableSpace -= size; }); let totalNonTsFileSize = 0; const fileNames = snapshotManager.getProjectFileNames(); for (const fileName of fileNames) { if ((0, utils$2.hasTsExtensions)(fileName)) { continue; } totalNonTsFileSize += (_b = (_a = tsSystem.getFileSize) === null || _a === void 0 ? void 0 : _a.call(tsSystem, fileName)) !== null && _b !== void 0 ? _b : 0; if (totalNonTsFileSize > availableSpace) { const top5LargestFiles = fileNames .filter((name) => !(0, utils$2.hasTsExtensions)(name)) .map((name) => { var _a, _b; return ({ name, size: (_b = (_a = tsSystem.getFileSize) === null || _a === void 0 ? void 0 : _a.call(tsSystem, name)) !== null && _b !== void 0 ? _b : 0 }); }) .sort((a, b) => b.size - a.size) .slice(0, 5); logger.Logger.log(`Non TS file size exceeded limit (${totalNonTsFileSize}). ` + `Largest files: ${top5LargestFiles .map((file) => `${file.name}:${file.size}`) .join(', ')}`); return true; } } serviceSizeMap.set(tsconfigPath, totalNonTsFileSize); return false; } function createWatchExtendedConfigCallback(docContext) { return async (fileName) => { var _a, _b; docContext.extendedConfigCache.delete(fileName); const promises = Array.from((_a = extendedConfigToTsConfigPath.get(fileName)) !== null && _a !== void 0 ? _a : []).map(async (config) => { var _a; const oldService = services.get(config); scheduleReload(config); (_a = (await oldService)) === null || _a === void 0 ? void 0 : _a.dispose(); }); await Promise.all(promises); (_b = docContext.onProjectReloaded) === null || _b === void 0 ? void 0 : _b.call(docContext); }; } function scheduleReload(fileName) { services.delete(fileName); pendingReloads.add(fileName); } }); getDefaultExportFromCjs(service_1); var LSAndTSDocResolver_1 = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LSAndTSDocResolver = void 0; const typescript_1 = __importDefault(ts__default__default['default']); class LSAndTSDocResolver { constructor(docManager, workspaceUris, configManager, options) { this.docManager = docManager; this.workspaceUris = workspaceUris; this.configManager = configManager; this.options = options; this.createDocument = (fileName, content) => { const uri = (0, utils$4.pathToUrl)(fileName); const document = this.docManager.openDocument({ text: content, uri }); this.docManager.lockDocument(uri); return document; }; this.globalSnapshotsManager = new SnapshotManager_1.GlobalSnapshotsManager(); this.extendedConfigCache = new Map(); const handleDocumentChange = (document) => { this.getSnapshot(document); }; docManager.on('documentChange', (0, utils$4.debounceSameArg)(handleDocumentChange, (newDoc, prevDoc) => newDoc.uri === (prevDoc === null || prevDoc === void 0 ? void 0 : prevDoc.uri), 1000)); docManager.on('documentOpen', handleDocumentChange); } get lsDocumentContext() { var _a, _b, _c, _d, _e; return { ambientTypesSource: ((_a = this.options) === null || _a === void 0 ? void 0 : _a.isSvelteCheck) ? 'svelte-check' : 'svelte2tsx', createDocument: this.createDocument, useNewTransformation: this.configManager.getConfig().svelte.useNewTransformation, transformOnTemplateError: !((_b = this.options) === null || _b === void 0 ? void 0 : _b.isSvelteCheck), globalSnapshotsManager: this.globalSnapshotsManager, notifyExceedSizeLimit: (_c = this.options) === null || _c === void 0 ? void 0 : _c.notifyExceedSizeLimit, extendedConfigCache: this.extendedConfigCache, onProjectReloaded: (_d = this.options) === null || _d === void 0 ? void 0 : _d.onProjectReloaded, watchTsConfig: !!((_e = this.options) === null || _e === void 0 ? void 0 : _e.watchTsConfig), tsSystem: typescript_1.default.sys }; } async getLSForPath(path) { return (await this.getTSService(path)).getService(); } async getLSAndTSDoc(document) { const lang = await this.getLSForPath(document.getFilePath() || ''); const tsDoc = await this.getSnapshot(document); const userPreferences = this.getUserPreferences(tsDoc.scriptKind); return { tsDoc, lang, userPreferences }; } async getSnapshot(pathOrDoc) { const filePath = typeof pathOrDoc === 'string' ? pathOrDoc : pathOrDoc.getFilePath() || ''; const tsService = await this.getTSService(filePath); return tsService.updateSnapshot(pathOrDoc); } async updateSnapshotPath(oldPath, newPath) { await this.deleteSnapshot(oldPath); return this.getSnapshot(newPath); } async deleteSnapshot(filePath) { await (0, service_1.forAllServices)((service) => service.deleteSnapshot(filePath)); this.docManager.releaseDocument((0, utils$4.pathToUrl)(filePath)); } async updateProjectFiles() { await (0, service_1.forAllServices)((service) => service.updateProjectFiles()); } async updateExistingTsOrJsFile(path, changes) { path = (0, utils$4.normalizePath)(path); let didUpdate = false; await (0, service_1.forAllServices)((service) => { if (service.hasFile(path) && !didUpdate) { didUpdate = true; service.updateTsOrJsFile(path, changes); } }); } async getSnapshotManager(filePath) { return (await this.getTSService(filePath)).snapshotManager; } async getTSService(filePath) { var _a, _b; if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.tsconfigPath) { return (0, service_1.getServiceForTsconfig)((_b = this.options) === null || _b === void 0 ? void 0 : _b.tsconfigPath, this.lsDocumentContext); } if (!filePath) { throw new Error('Cannot call getTSService without filePath and without tsconfigPath'); } return (0, service_1.getService)(filePath, this.workspaceUris, this.lsDocumentContext); } getUserPreferences(scriptKind) { const configLang = scriptKind === typescript_1.default.ScriptKind.TS || scriptKind === typescript_1.default.ScriptKind.TSX ? 'typescript' : 'javascript'; return this.configManager.getTsUserPreferences(configLang); } } exports.LSAndTSDocResolver = LSAndTSDocResolver; }); getDefaultExportFromCjs(LSAndTSDocResolver_1); // @ts-check class WalkerBase { constructor() { this.should_skip = false; this.should_remove = false; this.replacement = null; this.context = { skip: () => (this.should_skip = true), remove: () => (this.should_remove = true), replace: (node) => (this.replacement = node) }; } replace(parent, prop, index, node) { if (parent) { if (index !== null) { parent[prop][index] = node; } else { parent[prop] = node; } } } remove(parent, prop, index) { if (parent) { if (index !== null) { parent[prop].splice(index, 1); } else { delete parent[prop]; } } } } // @ts-check class SyncWalker extends WalkerBase { constructor(enter, leave) { super(); this.enter = enter; this.leave = leave; } visit(node, parent, prop, index) { if (node) { if (this.enter) { const _should_skip = this.should_skip; const _should_remove = this.should_remove; const _replacement = this.replacement; this.should_skip = false; this.should_remove = false; this.replacement = null; this.enter.call(this.context, node, parent, prop, index); if (this.replacement) { node = this.replacement; this.replace(parent, prop, index, node); } if (this.should_remove) { this.remove(parent, prop, index); } const skipped = this.should_skip; const removed = this.should_remove; this.should_skip = _should_skip; this.should_remove = _should_remove; this.replacement = _replacement; if (skipped) return node; if (removed) return null; } for (const key in node) { const value = node[key]; if (typeof value !== "object") { continue; } else if (Array.isArray(value)) { for (let i = 0; i < value.length; i += 1) { if (value[i] !== null && typeof value[i].type === 'string') { if (!this.visit(value[i], node, key, i)) { i--; } } } } else if (value !== null && typeof value.type === "string") { this.visit(value, node, key, null); } } if (this.leave) { const _replacement = this.replacement; const _should_remove = this.should_remove; this.replacement = null; this.should_remove = false; this.leave.call(this.context, node, parent, prop, index); if (this.replacement) { node = this.replacement; this.replace(parent, prop, index, node); } if (this.should_remove) { this.remove(parent, prop, index); } const removed = this.should_remove; this.replacement = _replacement; this.should_remove = _should_remove; if (removed) return null; } } return node; } } // @ts-check class AsyncWalker extends WalkerBase { constructor(enter, leave) { super(); this.enter = enter; this.leave = leave; } async visit(node, parent, prop, index) { if (node) { if (this.enter) { const _should_skip = this.should_skip; const _should_remove = this.should_remove; const _replacement = this.replacement; this.should_skip = false; this.should_remove = false; this.replacement = null; await this.enter.call(this.context, node, parent, prop, index); if (this.replacement) { node = this.replacement; this.replace(parent, prop, index, node); } if (this.should_remove) { this.remove(parent, prop, index); } const skipped = this.should_skip; const removed = this.should_remove; this.should_skip = _should_skip; this.should_remove = _should_remove; this.replacement = _replacement; if (skipped) return node; if (removed) return null; } for (const key in node) { const value = node[key]; if (typeof value !== "object") { continue; } else if (Array.isArray(value)) { for (let i = 0; i < value.length; i += 1) { if (value[i] !== null && typeof value[i].type === 'string') { if (!(await this.visit(value[i], node, key, i))) { i--; } } } } else if (value !== null && typeof value.type === "string") { await this.visit(value, node, key, null); } } if (this.leave) { const _replacement = this.replacement; const _should_remove = this.should_remove; this.replacement = null; this.should_remove = false; await this.leave.call(this.context, node, parent, prop, index); if (this.replacement) { node = this.replacement; this.replace(parent, prop, index, node); } if (this.should_remove) { this.remove(parent, prop, index); } const removed = this.should_remove; this.replacement = _replacement; this.should_remove = _should_remove; if (removed) return null; } } return node; } } // @ts-check function walk(ast, { enter, leave }) { const instance = new SyncWalker(enter, leave); return instance.visit(ast, null); } async function asyncWalk(ast, { enter, leave }) { const instance = new AsyncWalker(enter, leave); return await instance.visit(ast, null); } var estreeWalker = /*#__PURE__*/Object.freeze({ __proto__: null, asyncWalk: asyncWalk, walk: walk }); var estree_walker_1 = /*@__PURE__*/getAugmentedNamespace(estreeWalker); var getQuickfixes = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isIgnorableSvelteDiagnostic = exports.getQuickfixActions = void 0; async function getQuickfixActions(svelteDoc, svelteDiagnostics) { const { ast } = await svelteDoc.getCompiled(); return Promise.all(svelteDiagnostics.map(async (diagnostic) => await createQuickfixAction(diagnostic, svelteDoc, ast))); } exports.getQuickfixActions = getQuickfixActions; async function createQuickfixAction(diagnostic, svelteDoc, ast) { const textDocument = main$4.OptionalVersionedTextDocumentIdentifier.create((0, utils$4.pathToUrl)(svelteDoc.getFilePath()), null); return main$4.CodeAction.create(getCodeActionTitle(diagnostic), { documentChanges: [ main$4.TextDocumentEdit.create(textDocument, [ await getSvelteIgnoreEdit(svelteDoc, ast, diagnostic) ]) ] }, main$4.CodeActionKind.QuickFix); } function getCodeActionTitle(diagnostic) { return `(svelte) Disable ${diagnostic.code} for this line`; } function isIgnorableSvelteDiagnostic(diagnostic) { const { source, severity, code } = diagnostic; return (code && !nonIgnorableWarnings.includes(code) && source === 'svelte' && severity !== main$4.DiagnosticSeverity.Error); } exports.isIgnorableSvelteDiagnostic = isIgnorableSvelteDiagnostic; const nonIgnorableWarnings = [ 'missing-custom-element-compile-options', 'unused-export-let', 'css-unused-selector' ]; async function getSvelteIgnoreEdit(svelteDoc, ast, diagnostic) { const { code, range: { start, end } } = diagnostic; const transpiled = await svelteDoc.getTranspiled(); const content = transpiled.getText(); const lineOffsets = (0, documents.getLineOffsets)(content); const { html } = ast; const generatedStart = transpiled.getGeneratedPosition(start); const generatedEnd = transpiled.getGeneratedPosition(end); const diagnosticStartOffset = (0, documents.offsetAt)(generatedStart, content, lineOffsets); const diagnosticEndOffset = (0, documents.offsetAt)(generatedEnd, content, lineOffsets); const offsetRange = { pos: diagnosticStartOffset, end: diagnosticEndOffset }; const node = findTagForRange(html, offsetRange); const nodeStartPosition = (0, documents.positionAt)(node.start, content, lineOffsets); const nodeLineStart = (0, documents.offsetAt)({ line: nodeStartPosition.line, character: 0 }, content, lineOffsets); const afterStartLineStart = content.slice(nodeLineStart); const indent = (0, utils$4.getIndent)(afterStartLineStart); const ignore = `${indent}<!-- svelte-ignore ${code} -->${os__default['default'].EOL}`; const position = main$4.Position.create(nodeStartPosition.line, 0); return (0, documents.mapObjWithRangeToOriginal)(transpiled, main$4.TextEdit.insert(position, ignore)); } const elementOrComponent = ['Component', 'Element', 'InlineComponent']; function findTagForRange(html, range) { let nearest = html; (0, estree_walker_1.walk)(html, { enter(node, parent) { const { type } = node; const isBlock = 'block' in node || node.type.toLowerCase().includes('block'); const isFragment = type === 'Fragment'; const keepLooking = isFragment || elementOrComponent.includes(type) || isBlock; if (!keepLooking) { this.skip(); return; } if (within(node, range) && parent === nearest) { nearest = node; } } }); return nearest; } function within(node, range) { return node.end >= range.end && node.start <= range.pos; } }); getDefaultExportFromCjs(getQuickfixes); var getRefactorings = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.executeRefactoringCommand = exports.extractComponentCommand = void 0; const path = __importStar(path__default['default']); exports.extractComponentCommand = 'extract_to_svelte_component'; async function executeRefactoringCommand(svelteDoc, command, args) { if (command === exports.extractComponentCommand && args) { return executeExtractComponentCommand(svelteDoc, args[1]); } return null; } exports.executeRefactoringCommand = executeRefactoringCommand; async function executeExtractComponentCommand(svelteDoc, refactorArgs) { var _a; const { range } = refactorArgs; if (isInvalidSelectionRange()) { return 'Invalid selection range'; } let filePath = refactorArgs.filePath || './NewComponent.svelte'; if (!filePath.endsWith('.svelte')) { filePath += '.svelte'; } if (!filePath.startsWith('.')) { filePath = './' + filePath; } const componentName = ((_a = filePath.split('/').pop()) === null || _a === void 0 ? void 0 : _a.split('.svelte')[0]) || ''; const newFileUri = (0, utils$4.pathToUrl)(path.join(path.dirname(svelteDoc.getFilePath()), filePath)); return { documentChanges: [ main$4.TextDocumentEdit.create(main$4.OptionalVersionedTextDocumentIdentifier.create(svelteDoc.uri, null), [ main$4.TextEdit.replace(range, `<${componentName}></${componentName}>`), createComponentImportTextEdit() ]), main$4.CreateFile.create(newFileUri, { overwrite: true }), createNewFileEdit() ] }; function isInvalidSelectionRange() { const text = svelteDoc.getText(); const offsetStart = svelteDoc.offsetAt(range.start); const offsetEnd = svelteDoc.offsetAt(range.end); const validStart = offsetStart === 0 || /[\s\W]/.test(text[offsetStart - 1]); const validEnd = offsetEnd === text.length - 1 || /[\s\W]/.test(text[offsetEnd]); return (!validStart || !validEnd || (0, documents.isRangeInTag)(range, svelteDoc.style) || (0, documents.isRangeInTag)(range, svelteDoc.script) || (0, documents.isRangeInTag)(range, svelteDoc.moduleScript)); } function createNewFileEdit() { const text = svelteDoc.getText(); const newText = [ getTemplate(), getTag(svelteDoc.script, false), getTag(svelteDoc.moduleScript, false), getTag(svelteDoc.style, true) ] .filter((tag) => tag.start >= 0) .sort((a, b) => a.start - b.start) .map((tag) => tag.text) .join(''); return main$4.TextDocumentEdit.create(main$4.OptionalVersionedTextDocumentIdentifier.create(newFileUri, null), [main$4.TextEdit.insert(main$4.Position.create(0, 0), newText)]); function getTemplate() { const startOffset = svelteDoc.offsetAt(range.start); return { text: text.substring(startOffset, svelteDoc.offsetAt(range.end)) + '\n\n', start: startOffset }; } function getTag(tag, isStyleTag) { if (!tag) { return { text: '', start: -1 }; } const tagText = updateRelativeImports(svelteDoc, text.substring(tag.container.start, tag.container.end), filePath, isStyleTag); return { text: `${tagText}\n\n`, start: tag.container.start }; } } function createComponentImportTextEdit() { var _a; const startPos = (_a = (svelteDoc.script || svelteDoc.moduleScript)) === null || _a === void 0 ? void 0 : _a.startPos; const importText = `\n import ${componentName} from '${filePath}';\n`; return main$4.TextEdit.insert(startPos || main$4.Position.create(0, 0), startPos ? importText : `<script>\n${importText}</script>`); } } const scriptRelativeImportRegex = /import\s+{[^}]*}.*['"`](((\.\/)|(\.\.\/)).*?)['"`]|import\s+\w+\s+from\s+['"`](((\.\/)|(\.\.\/)).*?)['"`]/g; const styleRelativeImportRege = /@import\s+['"`](((\.\/)|(\.\.\/)).*?)['"`]/g; function updateRelativeImports(svelteDoc, tagText, newComponentRelativePath, isStyleTag) { const oldPath = path.dirname(svelteDoc.getFilePath()); const newPath = path.dirname(path.join(oldPath, newComponentRelativePath)); const regex = isStyleTag ? styleRelativeImportRege : scriptRelativeImportRegex; let match = regex.exec(tagText); while (match) { const importPath = match[1] || match[5]; const newImportPath = (0, documents.updateRelativeImport)(oldPath, newPath, importPath); tagText = tagText.replace(importPath, newImportPath); match = regex.exec(tagText); } return tagText; } }); getDefaultExportFromCjs(getRefactorings); var getCodeActions_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.executeCommand = exports.getCodeActions = void 0; async function getCodeActions(svelteDoc, range, context) { const svelteDiagnostics = context.diagnostics.filter(getQuickfixes.isIgnorableSvelteDiagnostic); if (svelteDiagnostics.length && (!context.only || context.only.includes(main$4.CodeActionKind.QuickFix))) { return await (0, getQuickfixes.getQuickfixActions)(svelteDoc, svelteDiagnostics); } return []; } exports.getCodeActions = getCodeActions; async function executeCommand(svelteDoc, command, args) { return await (0, getRefactorings.executeRefactoringCommand)(svelteDoc, command, args); } exports.executeCommand = executeCommand; }); getDefaultExportFromCjs(getCodeActions_1); var SvelteTags = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getLatestOpeningTag = exports.documentation = void 0; exports.documentation = { await: `\`{#await ...}\`\\ Await blocks allow you to branch on the three possible states of a Promise — pending, ` + `fulfilled or rejected. #### Usage: \`{#await expression}...{:then name}...{:catch name}...{/await}\`\\ \`{#await expression}...{:then name}...{/await}\`\\ \`{#await expression then name}...{/await}\`\\ \\ https://svelte.dev/docs#template-syntax-await `, each: `\`{#each ...}\`\\ Iterating over lists of values can be done with an each block. #### Usage: \`{#each expression as name}...{/each}\`\\ \`{#each expression as name, index}...{/each}\`\\ \`{#each expression as name, index (key)}...{/each}\`\\ \`{#each expression as name}...{:else}...{/each}\`\\ \\ https://svelte.dev/docs#template-syntax-each `, if: `\`{#if ...}\`\\ Content that is conditionally rendered can be wrapped in an if block. #### Usage: \`{#if expression}...{/if}\`\\ \`{#if expression}...{:else if expression}...{/if}\`\\ \`{#if expression}...{:else}...{/if}\`\\ \\ https://svelte.dev/docs#template-syntax-if `, key: `\`{#key expression}...{/key}\`\\ Key blocks destroy and recreate their contents when the value of an expression changes.\\ This is useful if you want an element to play its transition whenever a value changes.\\ When used around components, this will cause them to be reinstantiated and reinitialised. #### Usage: \`{#key expression}...{/key}\`\\ \\ https://svelte.dev/docs#template-syntax-key `, html: `\`{@html ...}\`\\ In a text expression, characters like < and > are escaped; however, ` + `with HTML expressions, they're not. The expression should be valid standalone HTML. #### Caution Svelte does not sanitize expressions before injecting HTML. If the data comes from an untrusted source, you must sanitize it, ` + `or you are exposing your users to an XSS vulnerability. #### Usage: \`{@html expression}\`\\ \\ https://svelte.dev/docs#template-syntax-html `, debug: `\`{@debug ...}\`\\ Offers an alternative to \`console.log(...)\`. It logs the values of specific variables whenever they change, ` + `and pauses code execution if you have devtools open. It accepts a comma-separated list of variable names (not arbitrary expressions). #### Usage: \`{@debug}\` \`{@debug var1, var2, ..., varN}\`\\ \\ https://svelte.dev/docs#template-syntax-debug `, const: `\`{@const ...}\`\\ TODO #### Usage: \`{@const a = b + c}\`\\ ` }; function getLatestOpeningTag(svelteDoc, offset) { const content = svelteDoc .getText() .substring(0, offset) .replace(/<!--(.*?)-->/g, ''); const lastIdxs = [ idxOfLastOpeningTag(content, 'each'), idxOfLastOpeningTag(content, 'if'), idxOfLastOpeningTag(content, 'await'), idxOfLastOpeningTag(content, 'key') ]; const lastIdx = lastIdxs.sort((i1, i2) => i2.lastIdx - i1.lastIdx); return lastIdx[0].lastIdx === -1 ? null : lastIdx[0].tag; } exports.getLatestOpeningTag = getLatestOpeningTag; function idxOfLastOpeningTag(content, tag) { var _a, _b; const nrOfEndingTags = (_b = (_a = content.match(new RegExp(`{\\s*/${tag}`, 'g'))) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; let lastIdx = -1; let nrOfOpeningTags = 0; let match; const regexp = new RegExp(`{\\s*#${tag}`, 'g'); while ((match = regexp.exec(content)) != null) { nrOfOpeningTags += 1; lastIdx = match.index; } return { lastIdx: nrOfOpeningTags <= nrOfEndingTags ? -1 : lastIdx, tag }; } }); getDefaultExportFromCjs(SvelteTags); var getModifierData_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getModifierData = void 0; function getModifierData() { return [ { modifier: 'preventDefault', documentation: 'calls `event.preventDefault()` before running the handler', modifiersInvalidWith: ['passive'] }, { modifier: 'stopPropagation', documentation: 'calls `event.stopPropagation()`, preventing the event reaching the next element' }, { modifier: 'passive', documentation: 'improves scrolling performance on touch/wheel events ' + "(Svelte will add it automatically where it's safe to do so)", modifiersInvalidWith: ['nopassive', 'preventDefault'] }, { modifier: 'nonpassive', documentation: 'explicitly set `passive: false`', modifiersInvalidWith: ['passive'] }, { modifier: 'capture', documentation: 'fires the handler during the capture phase instead of the bubbling phase' }, { modifier: 'once', documentation: 'remove the handler after the first time it runs' }, { modifier: 'self', documentation: 'only trigger handler if `event.target` is the element itself' }, { modifier: 'trusted', documentation: 'only trigger handler if event.isTrusted is true. ' + 'I.e. if the event is triggered by a user action' } ].map((item) => ({ ...item, documentation: { kind: main$4.MarkupKind.Markdown, value: `\`${item.modifier}\` event modifier ${item.documentation} https://svelte.dev/docs#on_element_event` } })); } exports.getModifierData = getModifierData; }); getDefaultExportFromCjs(getModifierData_1); var utils = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.attributeCanHaveEventModifier = void 0; function attributeCanHaveEventModifier(attributeContext) { return (!attributeContext.inValue && !(0, utils$4.possiblyComponent)(attributeContext.elementTag) && attributeContext.name.startsWith('on:') && attributeContext.name.includes('|')); } exports.attributeCanHaveEventModifier = attributeCanHaveEventModifier; }); getDefaultExportFromCjs(utils); var getCompletions_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getCompletions = void 0; const HTML_COMMENT_START = '<!--'; const componentDocumentationCompletion = { label: '@component', insertText: `component${os__default['default'].EOL}$1${os__default['default'].EOL}`, documentation: 'Documentation for this component. ' + 'It will show up on hover. You can use markdown and code blocks here', insertTextFormat: main$4.InsertTextFormat.Snippet, kind: main$4.CompletionItemKind.Snippet, sortText: '-1', filterText: 'component', preselect: true }; function getCompletions(document, svelteDoc, position) { const offset = svelteDoc.offsetAt(position); const isInStyleOrScript = (0, documents.isInTag)(position, svelteDoc.style) || (0, documents.isInTag)(position, svelteDoc.script) || (0, documents.isInTag)(position, svelteDoc.moduleScript); const lastCharactersBeforePosition = svelteDoc .getText() .substr(Math.max(offset - 10, 0), Math.min(offset, 10)); const precededByOpeningBracket = /[\s\S]*{\s*[#:/@]\w*$/.test(lastCharactersBeforePosition); if (isInStyleOrScript) { return null; } if (precededByOpeningBracket) { return getTagCompletionsWithinMoustache(); } const attributeContext = (0, parseHtml_1.getAttributeContextAtPosition)(document, position); if (attributeContext) { return getEventModifierCompletion(attributeContext); } return getComponentDocumentationCompletions(); function getTagCompletionsWithinMoustache() { const triggerCharacter = getTriggerCharacter(lastCharactersBeforePosition); return getCompletionsWithRegardToTriggerCharacter(triggerCharacter, svelteDoc, offset); } function getComponentDocumentationCompletions() { if (!lastCharactersBeforePosition.includes(HTML_COMMENT_START)) { return null; } const commentStartIndex = lastCharactersBeforePosition.lastIndexOf(HTML_COMMENT_START); const text = lastCharactersBeforePosition .substring(commentStartIndex + HTML_COMMENT_START.length) .trimLeft(); if (componentDocumentationCompletion.label.includes(text)) { return main$4.CompletionList.create([componentDocumentationCompletion], false); } return null; } } exports.getCompletions = getCompletions; function getEventModifierCompletion(attributeContext) { const modifiers = (0, getModifierData_1.getModifierData)(); if (!attributeContext || !(0, utils.attributeCanHaveEventModifier)(attributeContext)) { return null; } const items = modifiers .filter((modifier) => { var _a; return !attributeContext.name.includes('|' + modifier.modifier) && !((_a = modifier.modifiersInvalidWith) === null || _a === void 0 ? void 0 : _a.some((invalidWith) => attributeContext.name.includes(invalidWith))); }) .map((m) => ({ label: m.modifier, documentation: m.documentation, kind: main$4.CompletionItemKind.Event })); return main$4.CompletionList.create(items); } function getCompletionsWithRegardToTriggerCharacter(triggerCharacter, svelteDoc, offset) { if (triggerCharacter === '@') { return createCompletionItems([ { tag: 'html', label: 'html' }, { tag: 'debug', label: 'debug' }, { tag: 'const', label: 'const' } ]); } if (triggerCharacter === '#') { return createCompletionItems([ { tag: 'if', label: 'if', insertText: 'if $1}\n\t$2\n{/if' }, { tag: 'each', label: 'each', insertText: 'each $1 as $2}\n\t$3\n{/each' }, { tag: 'await', label: 'await :then', insertText: 'await $1}\n\t$2\n{:then $3} \n\t$4\n{/await' }, { tag: 'await', label: 'await then', insertText: 'await $1 then $2}\n\t$3\n{/await' }, { tag: 'key', label: 'key', insertText: 'key $1}\n\t$2\n{/key' } ]); } if (triggerCharacter === ':') { return showCompletionWithRegardsToOpenedTags({ awaitOpen: createCompletionItems([ { tag: 'await', label: 'then' }, { tag: 'await', label: 'catch' } ]), eachOpen: createCompletionItems([{ tag: 'each', label: 'else' }]), ifOpen: createCompletionItems([ { tag: 'if', label: 'else' }, { tag: 'if', label: 'else if' } ]) }, svelteDoc, offset); } if (triggerCharacter === '/') { return showCompletionWithRegardsToOpenedTags({ awaitOpen: createCompletionItems([{ tag: 'await', label: 'await' }]), eachOpen: createCompletionItems([{ tag: 'each', label: 'each' }]), ifOpen: createCompletionItems([{ tag: 'if', label: 'if' }]), keyOpen: createCompletionItems([{ tag: 'key', label: 'key' }]) }, svelteDoc, offset); } return null; } function getTriggerCharacter(content) { const chars = [ getLastIndexOf('#'), getLastIndexOf('/'), getLastIndexOf(':'), getLastIndexOf('@') ]; return chars.sort((c1, c2) => c2.idx - c1.idx)[0].char; function getLastIndexOf(char) { return { char, idx: content.lastIndexOf(char) }; } } function showCompletionWithRegardsToOpenedTags(on, svelteDoc, offset) { var _a; switch ((0, SvelteTags.getLatestOpeningTag)(svelteDoc, offset)) { case 'each': return on.eachOpen; case 'if': return on.ifOpen; case 'await': return on.awaitOpen; case 'key': return (_a = on === null || on === void 0 ? void 0 : on.keyOpen) !== null && _a !== void 0 ? _a : null; default: return null; } } function createCompletionItems(items) { return main$4.CompletionList.create( items.map((item) => ({ insertTextFormat: main$4.InsertTextFormat.Snippet, insertText: item.insertText, label: item.label, sortText: '-1', kind: main$4.CompletionItemKind.Keyword, preselect: true, documentation: { kind: main$4.MarkupKind.Markdown, value: SvelteTags.documentation[item.tag] } }))); } }); getDefaultExportFromCjs(getCompletions_1); var SvelteDocument_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.SvelteFragmentMapper = exports.FallbackTranspiledSvelteDocument = exports.TranspiledSvelteDocument = exports.SvelteDocument = exports.TranspileErrorSource = void 0; var TranspileErrorSource; (function (TranspileErrorSource) { TranspileErrorSource["Script"] = "Script"; TranspileErrorSource["Style"] = "Style"; })(TranspileErrorSource = exports.TranspileErrorSource || (exports.TranspileErrorSource = {})); class SvelteDocument { constructor(parent) { this.parent = parent; this.languageId = 'svelte'; this.version = 0; this.uri = this.parent.uri; this.script = this.parent.scriptInfo; this.moduleScript = this.parent.moduleScriptInfo; this.style = this.parent.styleInfo; this.version = this.parent.version; } get config() { return this.parent.configPromise; } getText() { return this.parent.getText(); } getFilePath() { return this.parent.getFilePath() || ''; } offsetAt(position) { return this.parent.offsetAt(position); } async getTranspiled() { var _a; if (!this.transpiledDoc) { const { version: { major, minor } } = (0, importPackage.getPackageInfo)('svelte', this.getFilePath()); if (major > 3 || (major === 3 && minor >= 32)) { this.transpiledDoc = await TranspiledSvelteDocument.create(this.parent, await this.config); } else { this.transpiledDoc = await FallbackTranspiledSvelteDocument.create(this.parent, (_a = (await this.config)) === null || _a === void 0 ? void 0 : _a.preprocess); } } return this.transpiledDoc; } async getCompiled() { var _a; if (!this.compileResult) { this.compileResult = await this.getCompiledWith((_a = (await this.config)) === null || _a === void 0 ? void 0 : _a.compilerOptions); } return this.compileResult; } async getCompiledWith(options = {}) { const svelte = (0, importPackage.importSvelte)(this.getFilePath()); return svelte.compile((await this.getTranspiled()).getText(), options); } } exports.SvelteDocument = SvelteDocument; class TranspiledSvelteDocument { constructor(code, mapper) { this.code = code; this.mapper = mapper; } static async create(document, config) { if (!(config === null || config === void 0 ? void 0 : config.preprocess)) { return new TranspiledSvelteDocument(document.getText()); } const filename = document.getFilePath() || ''; const svelte = (0, importPackage.importSvelte)(filename); const preprocessed = await svelte.preprocess(document.getText(), wrapPreprocessors(config === null || config === void 0 ? void 0 : config.preprocess), { filename }); if (preprocessed.code === document.getText()) { return new TranspiledSvelteDocument(document.getText()); } return new TranspiledSvelteDocument(preprocessed.code, preprocessed.map ? new documents.SourceMapDocumentMapper(createTraceMap(preprocessed.map), (0, utils$4.getLastPartOfPath)(filename)) : undefined); } getOriginalPosition(generatedPosition) { var _a; return ((_a = this.mapper) === null || _a === void 0 ? void 0 : _a.getOriginalPosition(generatedPosition)) || generatedPosition; } getText() { return this.code; } getGeneratedPosition(originalPosition) { var _a; return ((_a = this.mapper) === null || _a === void 0 ? void 0 : _a.getGeneratedPosition(originalPosition)) || originalPosition; } } exports.TranspiledSvelteDocument = TranspiledSvelteDocument; class FallbackTranspiledSvelteDocument { constructor(parent, transpiled, scriptMapper, styleMapper) { var _a, _b; this.parent = parent; this.transpiled = transpiled; this.scriptMapper = scriptMapper; this.styleMapper = styleMapper; this.fragmentInfos = [(_a = this.scriptMapper) === null || _a === void 0 ? void 0 : _a.fragmentInfo, (_b = this.styleMapper) === null || _b === void 0 ? void 0 : _b.fragmentInfo] .filter(utils$4.isNotNullOrUndefined) .sort((i1, i2) => i1.end - i2.end); } static async create(document, preprocessors = []) { const { transpiled, processedScripts, processedStyles } = await transpile(document, preprocessors); const scriptMapper = SvelteFragmentMapper.createScript(document, transpiled, processedScripts); const styleMapper = SvelteFragmentMapper.createStyle(document, transpiled, processedStyles); return new FallbackTranspiledSvelteDocument(document, transpiled, scriptMapper, styleMapper); } getOriginalPosition(generatedPosition) { var _a, _b; if ((_a = this.scriptMapper) === null || _a === void 0 ? void 0 : _a.isInTranspiledFragment(generatedPosition)) { return this.scriptMapper.getOriginalPosition(generatedPosition); } if ((_b = this.styleMapper) === null || _b === void 0 ? void 0 : _b.isInTranspiledFragment(generatedPosition)) { return this.styleMapper.getOriginalPosition(generatedPosition); } let offset = (0, documents.offsetAt)(generatedPosition, this.transpiled); for (const fragmentInfo of this.fragmentInfos) { if (offset > fragmentInfo.end) { offset += fragmentInfo.diff; } } return this.parent.positionAt(offset); } getURL() { return this.parent.getURL(); } getText() { return this.transpiled; } getGeneratedPosition(originalPosition) { const { styleInfo, scriptInfo } = this.parent; if ((0, documents.isInTag)(originalPosition, scriptInfo) && this.scriptMapper) { return this.scriptMapper.getGeneratedPosition(originalPosition); } if ((0, documents.isInTag)(originalPosition, styleInfo) && this.styleMapper) { return this.styleMapper.getGeneratedPosition(originalPosition); } let offset = (0, documents.offsetAt)(originalPosition, this.parent.getText()); for (const fragmentInfo of this.fragmentInfos) { if (offset > fragmentInfo.end) { offset -= fragmentInfo.diff; } } return (0, documents.positionAt)(offset, this.getText()); } } exports.FallbackTranspiledSvelteDocument = FallbackTranspiledSvelteDocument; class SvelteFragmentMapper { constructor( fragmentInfo, originalFragmentMapper, transpiledFragmentMapper, sourceMapper) { this.fragmentInfo = fragmentInfo; this.originalFragmentMapper = originalFragmentMapper; this.transpiledFragmentMapper = transpiledFragmentMapper; this.sourceMapper = sourceMapper; } static createStyle(originalDoc, transpiled, processed) { return SvelteFragmentMapper.create(originalDoc, transpiled, originalDoc.styleInfo, (0, documents.extractStyleTag)(transpiled), processed); } static createScript(originalDoc, transpiled, processed) { const scriptInfo = originalDoc.scriptInfo || originalDoc.moduleScriptInfo; const maybeScriptTag = (0, documents.extractScriptTags)(transpiled); const maybeScriptTagInfo = maybeScriptTag && (maybeScriptTag.script || maybeScriptTag.moduleScript); return SvelteFragmentMapper.create(originalDoc, transpiled, scriptInfo, maybeScriptTagInfo || null, processed); } static create(originalDoc, transpiled, originalTagInfo, transpiledTagInfo, processed) { const sourceMapper = processed.length > 0 ? SvelteFragmentMapper.createSourceMapper(processed, originalDoc) : new documents.IdentityMapper(originalDoc.uri); if (originalTagInfo && transpiledTagInfo) { const sourceLength = originalTagInfo.container.end - originalTagInfo.container.start; const transpiledLength = transpiledTagInfo.container.end - transpiledTagInfo.container.start; const diff = sourceLength - transpiledLength; return new SvelteFragmentMapper({ end: transpiledTagInfo.container.end, diff }, new documents.FragmentMapper(originalDoc.getText(), originalTagInfo, originalDoc.uri), new documents.FragmentMapper(transpiled, transpiledTagInfo, originalDoc.uri), sourceMapper); } return null; } static createSourceMapper(processed, originalDoc) { return processed.reduce((parent, processedSingle) => (processedSingle === null || processedSingle === void 0 ? void 0 : processedSingle.map) ? new documents.SourceMapDocumentMapper(createTraceMap(processedSingle.map), originalDoc.uri, parent) : new documents.IdentityMapper(originalDoc.uri, parent), undefined); } isInTranspiledFragment(generatedPosition) { return this.transpiledFragmentMapper.isInGenerated(generatedPosition); } getOriginalPosition(generatedPosition) { const positionInTranspiledFragment = this.transpiledFragmentMapper.getGeneratedPosition(generatedPosition); const positionInOriginalFragment = this.sourceMapper.getOriginalPosition(positionInTranspiledFragment); return this.originalFragmentMapper.getOriginalPosition(positionInOriginalFragment); } getGeneratedPosition(originalPosition) { const positionInOriginalFragment = this.originalFragmentMapper.getGeneratedPosition(originalPosition); const positionInTranspiledFragment = this.sourceMapper.getGeneratedPosition(positionInOriginalFragment); return this.transpiledFragmentMapper.getOriginalPosition(positionInTranspiledFragment); } } exports.SvelteFragmentMapper = SvelteFragmentMapper; function wrapPreprocessors(preprocessors = []) { preprocessors = Array.isArray(preprocessors) ? preprocessors : [preprocessors]; return preprocessors.map((preprocessor) => { const wrappedPreprocessor = { markup: preprocessor.markup }; if (preprocessor.script) { wrappedPreprocessor.script = async (args) => { try { return await preprocessor.script(args); } catch (e) { e.__source = TranspileErrorSource.Script; throw e; } }; } if (preprocessor.style) { wrappedPreprocessor.style = async (args) => { try { return await preprocessor.style(args); } catch (e) { e.__source = TranspileErrorSource.Style; throw e; } }; } return wrappedPreprocessor; }); } async function transpile(document, preprocessors = []) { var _a; preprocessors = Array.isArray(preprocessors) ? preprocessors : [preprocessors]; const processedScripts = []; const processedStyles = []; const wrappedPreprocessors = preprocessors.map((preprocessor) => { const wrappedPreprocessor = { markup: preprocessor.markup }; if (preprocessor.script) { wrappedPreprocessor.script = async (args) => { try { const res = await preprocessor.script(args); if (res && res.map) { processedScripts.push(res); } return res; } catch (e) { e.__source = TranspileErrorSource.Script; throw e; } }; } if (preprocessor.style) { wrappedPreprocessor.style = async (args) => { try { const res = await preprocessor.style(args); if (res && res.map) { processedStyles.push(res); } return res; } catch (e) { e.__source = TranspileErrorSource.Style; throw e; } }; } return wrappedPreprocessor; }); const svelte = (0, importPackage.importSvelte)(document.getFilePath() || ''); const result = await svelte.preprocess(document.getText(), wrappedPreprocessors, { filename: document.getFilePath() || '' }); const transpiled = result.code || ((_a = result.toString) === null || _a === void 0 ? void 0 : _a.call(result)) || ''; return { transpiled, processedScripts, processedStyles }; } function createTraceMap(map) { return new trace_mapping_1__default['default'].TraceMap(normalizeMap(map)); function normalizeMap(map) { if (typeof map === 'string' || map.version) { return map; } return map.toString(); } } }); getDefaultExportFromCjs(SvelteDocument_1); var getDiagnostics_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getDiagnostics = void 0; async function getDiagnostics(document, svelteDoc, settings) { const config = await svelteDoc.config; if (config === null || config === void 0 ? void 0 : config.loadConfigError) { return getConfigLoadErrorDiagnostics(config.loadConfigError); } try { return await tryGetDiagnostics(document, svelteDoc, settings); } catch (error) { return getPreprocessErrorDiagnostics(document, error); } } exports.getDiagnostics = getDiagnostics; async function tryGetDiagnostics(document, svelteDoc, settings) { const transpiled = await svelteDoc.getTranspiled(); try { const res = await svelteDoc.getCompiled(); return (res.stats.warnings || res.warnings || []) .filter((warning) => settings[warning.code] !== 'ignore') .map((warning) => { const start = warning.start || { line: 1, column: 0 }; const end = warning.end || start; return { range: main$4.Range.create(start.line - 1, start.column, end.line - 1, end.column), message: warning.message, severity: settings[warning.code] === 'error' ? main$4.DiagnosticSeverity.Error : main$4.DiagnosticSeverity.Warning, source: 'svelte', code: warning.code }; }) .map((diag) => (0, documents.mapObjWithRangeToOriginal)(transpiled, diag)) .map((diag) => adjustMappings(diag, document)) .filter((diag) => isNoFalsePositive(diag, document)); } catch (err) { return (await createParserErrorDiagnostic(err, document)) .map((diag) => (0, documents.mapObjWithRangeToOriginal)(transpiled, diag)) .map((diag) => adjustMappings(diag, document)); } } async function createParserErrorDiagnostic(error, document) { const start = error.start || { line: 1, column: 0 }; const end = error.end || start; const diagnostic = { range: main$4.Range.create(start.line - 1, start.column, end.line - 1, end.column), message: error.message, severity: main$4.DiagnosticSeverity.Error, source: 'svelte', code: error.code }; if (diagnostic.message.includes('expected')) { const isInStyle = (0, documents.isInTag)(diagnostic.range.start, document.styleInfo); const isInScript = (0, documents.isInTag)(diagnostic.range.start, document.scriptInfo || document.moduleScriptInfo); if (isInStyle || isInScript) { diagnostic.message += '\n\nIf you expect this syntax to work, here are some suggestions: '; if (isInScript) { diagnostic.message += '\nIf you use typescript with `svelte-preprocess`, did you add `lang="ts"` to your `script` tag? '; } else { diagnostic.message += '\nIf you use less/SCSS with `svelte-preprocess`, did you add `lang="scss"`/`lang="less"` to your `style` tag? ' + scssNodeRuntimeHint; } diagnostic.message += '\nDid you setup a `svelte.config.js`? ' + '\nSee https://github.com/sveltejs/language-tools/tree/master/docs#using-with-preprocessors for more info.'; } } return [diagnostic]; } function getPreprocessErrorDiagnostics(document, error) { logger.Logger.error('Preprocessing failed'); logger.Logger.error(error); if (document.styleInfo && error.__source === SvelteDocument_1.TranspileErrorSource.Style) { return getStyleErrorDiagnostics(error, document); } if ((document.scriptInfo || document.moduleScriptInfo) && error.__source === SvelteDocument_1.TranspileErrorSource.Script) { return getScriptErrorDiagnostics(error, document); } return getOtherErrorDiagnostics(error); } function getConfigLoadErrorDiagnostics(error) { return [ { message: 'Error in svelte.config.js\n\n' + error, range: main$4.Range.create(main$4.Position.create(0, 0), main$4.Position.create(0, 5)), severity: main$4.DiagnosticSeverity.Error, source: 'svelte' } ]; } function getStyleErrorDiagnostics(error, document) { const isErrorFromOtherFile = typeof (error === null || error === void 0 ? void 0 : error.file) === 'string' && (0, utils$4.getLastPartOfPath)(error.file) !== (0, utils$4.getLastPartOfPath)(document.getFilePath() || ''); return [ { message: getStyleErrorMessage(), range: getStyleErrorRange(), severity: main$4.DiagnosticSeverity.Error, source: 'svelte(style)' } ]; function getStyleErrorMessage() { if (isSveltePreprocessCannotFindModulesError(error)) { const hint = error.message.includes('node-sass') ? scssNodeRuntimeHint : ''; return getErrorMessage(error.message, 'style', hint); } const msg = error.formatted || error.message || 'Style error. Transpilation failed.'; return isErrorFromOtherFile ? 'Error in referenced file\n\n' + msg : msg; } function getStyleErrorRange() { var _a, _b; const lineOffset = ((_a = document.styleInfo) === null || _a === void 0 ? void 0 : _a.startPos.line) || 0; const position = !isErrorFromOtherFile && typeof (error === null || error === void 0 ? void 0 : error.column) === 'number' && typeof (error === null || error === void 0 ? void 0 : error.line) === 'number' ? main$4.Position.create(lineOffset + error.line - 1, error.column) : ((_b = document.styleInfo) === null || _b === void 0 ? void 0 : _b.startPos) || main$4.Position.create(0, 0); return main$4.Range.create(position, position); } } function getScriptErrorDiagnostics(error, document) { return [ { message: getScriptErrorMessage(), range: getScriptErrorRange(), severity: main$4.DiagnosticSeverity.Error, source: 'svelte(script)' } ]; function getScriptErrorMessage() { if (isSveltePreprocessCannotFindModulesError(error)) { return getErrorMessage(error.message, 'script'); } return error.message || 'Script error. Transpilation failed.'; } function getScriptErrorRange() { var _a, _b; const position = ((_a = document.scriptInfo) === null || _a === void 0 ? void 0 : _a.startPos) || ((_b = document.moduleScriptInfo) === null || _b === void 0 ? void 0 : _b.startPos) || main$4.Position.create(0, 0); return main$4.Range.create(position, position); } } function getOtherErrorDiagnostics(error) { return [ { message: getOtherErrorMessage(), range: main$4.Range.create(main$4.Position.create(0, 0), main$4.Position.create(0, 5)), severity: main$4.DiagnosticSeverity.Warning, source: 'svelte' } ]; function getOtherErrorMessage() { if (isSveltePreprocessCannotFindModulesError(error)) { return getErrorMessage(error.message, 'it'); } return error.message || 'Error. Transpilation failed.'; } } function isSveltePreprocessCannotFindModulesError(error) { return error instanceof Error && error.message.startsWith('Cannot find any of modules'); } function getErrorMessage(error, source, hint = '') { return (error + '\n\nThe file cannot be parsed because ' + source + " requires a preprocessor that doesn't seem to be setup or failed during setup. " + 'Did you setup a `svelte.config.js`? ' + hint + '\n\nSee https://github.com/sveltejs/language-tools/tree/master/docs#using-with-preprocessors for more info.'); } function isNoFalsePositive(diag, doc) { if (diag.code !== 'unused-export-let') { return true; } const unusedExportName = diag.message.substring(diag.message.indexOf("'") + 1, diag.message.lastIndexOf("'")); const hasExportedEnumWithThatName = new RegExp(`\\bexport\\s+?(enum|namespace)\\s+?${unusedExportName}\\b`).test(doc.getText()); return !hasExportedEnumWithThatName; } function adjustMappings(diag, doc) { if (diag.range.start.character < 0) { diag.range.start.character = 0; } if (diag.range.end.character < 0) { diag.range.end.character = 0; } if (diag.range.start.line < 0) { diag.range.start = { line: 0, character: 0 }; } if (diag.range.end.line < 0) { diag.range.end = { line: 0, character: 0 }; } diag.range = (0, utils$4.moveRangeStartToEndIfNecessary)(diag.range); if (diag.code === 'css-unused-selector' && doc.styleInfo && !(0, documents.isInTag)(diag.range.start, doc.styleInfo)) { diag.range.start = doc.styleInfo.startPos; diag.range.end = diag.range.start; } return diag; } const scssNodeRuntimeHint = 'If you use SCSS, it may be necessary to add the path to your NODE runtime to the setting `svelte.language-server.runtime`, or use `sass` instead of `node-sass`. '; }); getDefaultExportFromCjs(getDiagnostics_1); var getHoverInfo_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getHoverInfo = void 0; function getHoverInfo(document, svelteDoc, position) { const offset = svelteDoc.offsetAt(position); const isInStyleOrScript = (0, documents.isInTag)(position, svelteDoc.style) || (0, documents.isInTag)(position, svelteDoc.script) || (0, documents.isInTag)(position, svelteDoc.moduleScript); const offsetStart = Math.max(offset - 10, 0); const charactersAroundOffset = svelteDoc .getText() .substr(offsetStart, 20); const isSvelteTag = tagRegexp.test(charactersAroundOffset); if (isInStyleOrScript) { return null; } if (isSvelteTag) { return getTagHoverInfoAtOffset(svelteDoc, offsetStart, charactersAroundOffset, offset); } const attributeContext = (0, parseHtml_1.getAttributeContextAtPosition)(document, position); if (!attributeContext || !(0, utils.attributeCanHaveEventModifier)(attributeContext)) { return null; } const attributeOffset = svelteDoc.getText().lastIndexOf(attributeContext.name, offset); return getEventModifierHoverInfo(attributeContext, attributeOffset, offset); } exports.getHoverInfo = getHoverInfo; function getTagHoverInfoAtOffset(svelteDoc, charactersOffset, charactersAroundOffset, offset) { const tag = getTagAtOffset(svelteDoc, charactersOffset, charactersAroundOffset, offset); if (!tag) { return null; } return { contents: SvelteTags.documentation[tag] }; } function getTagAtOffset(svelteDoc, charactersOffset, charactersAroundOffset, offset) { const foundTag = tagPossibilities.find((tagAndValues) => tagAndValues.values.find((value) => isAroundOffset(charactersOffset, charactersAroundOffset, value, offset))); if (!foundTag) { return null; } if (foundTag.tag !== ':else') { return foundTag.tag; } return (0, SvelteTags.getLatestOpeningTag)(svelteDoc, offset); } function isAroundOffset(charactersOffset, charactersAroundOffset, toFind, offset) { const match = charactersAroundOffset.match(toFind); if (!match || match.index === undefined) { return false; } const idx = match.index + charactersOffset; return idx <= offset && idx + toFind.length >= offset; } const tagPossibilities = [ { tag: 'if', values: ['#if', '/if', ':else if'] }, { tag: 'each', values: ['#each', '/each'] }, { tag: 'await', values: ['#await', '/await', ':then', ':catch'] }, { tag: 'key', values: ['#key', '/key'] }, { tag: 'html', values: ['@html'] }, { tag: 'debug', values: ['@debug'] }, { tag: 'const', values: ['@const'] }, { tag: ':else', values: [':else'] } ]; const tagRegexp = new RegExp(`[\\s\\S]*{\\s*(${(0, utils$4.flatten)(tagPossibilities.map((p) => p.values)).join('|')})(\\s|})`); function getEventModifierHoverInfo(attributeContext, attributeOffset, offset) { const { name } = attributeContext; const modifierData = (0, getModifierData_1.getModifierData)(); const found = modifierData.find((modifier) => isAroundOffset(attributeOffset, name, modifier.modifier, offset)); if (!found) { return null; } return { contents: found.documentation }; } }); getDefaultExportFromCjs(getHoverInfo_1); var getSelectionRanges = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.getSelectionRange = void 0; async function getSelectionRange(svelteDoc, position) { const { script, style, moduleScript } = svelteDoc; const { ast: { html } } = await svelteDoc.getCompiled(); const transpiled = await svelteDoc.getTranspiled(); const content = transpiled.getText(); const offset = (0, documents.offsetAt)(transpiled.getGeneratedPosition(position), content); const embedded = [script, style, moduleScript]; for (const info of embedded) { if ((0, documents.isInTag)(position, info)) { return null; } } let nearest = html; let result; (0, estree_walker_1.walk)(html, { enter(node, parent) { if (!parent) { return; } if (!('start' in node && 'end' in node)) { this.skip(); return; } const { start, end } = node; const isWithin = start <= offset && end >= offset; if (!isWithin) { this.skip(); return; } if (nearest === parent) { nearest = node; result = createSelectionRange(node, result); } } }); return result ? (0, documents.mapSelectionRangeToParent)(transpiled, result) : null; function createSelectionRange(node, parent) { const range = (0, documents.toRange)(content, node.start, node.end); return main$4.SelectionRange.create(range, parent); } } exports.getSelectionRange = getSelectionRange; }); getDefaultExportFromCjs(getSelectionRanges); var SveltePlugin_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.SveltePlugin = void 0; class SveltePlugin { constructor(configManager) { this.configManager = configManager; this.__name = 'svelte'; this.docManager = new Map(); } async getDiagnostics(document) { if (!this.featureEnabled('diagnostics') || !this.configManager.getIsTrusted()) { return []; } return (0, getDiagnostics_1.getDiagnostics)(document, await this.getSvelteDoc(document), this.configManager.getConfig().svelte.compilerWarnings); } async getCompiledResult(document) { try { const svelteDoc = await this.getSvelteDoc(document); return svelteDoc.getCompiledWith({ generate: 'dom' }); } catch (error) { return null; } } async formatDocument(document, options) { var _a, _b, _c; if (!this.featureEnabled('format')) { return []; } const filePath = document.getFilePath(); const prettier = (0, importPackage.importPrettier)(filePath); const config = this.configManager.getMergedPrettierConfig(await prettier.resolveConfig(filePath, { editorconfig: true }), options && { tabWidth: options.tabSize, useTabs: !options.insertSpaces }); if ((config === null || config === void 0 ? void 0 : config.svelteSortOrder) && ((_a = (0, importPackage.getPackageInfo)('prettier-plugin-svelte', filePath)) === null || _a === void 0 ? void 0 : _a.version.major) < 2) { config.svelteSortOrder = config.svelteSortOrder .replace('-options', '') .replace('options-', ''); } const fileInfo = await prettier.getFileInfo(filePath, { ignorePath: (_c = (_b = this.configManager.getPrettierConfig()) === null || _b === void 0 ? void 0 : _b.ignorePath) !== null && _c !== void 0 ? _c : '.prettierignore', withNodeModules: true }); if (fileInfo.ignored) { logger.Logger.log('File is ignored, formatting skipped'); return []; } const formattedCode = prettier.format(document.getText(), { ...config, plugins: getSveltePlugin(), parser: 'svelte' }); return document.getText() === formattedCode ? [] : [ main$4.TextEdit.replace(main$4.Range.create(document.positionAt(0), document.positionAt(document.getTextLength())), formattedCode) ]; function getSveltePlugin() { const hasPluginLoadedAlready = prettier .getSupportInfo() .languages.some((l) => l.name === 'svelte'); return hasPluginLoadedAlready ? [] : [require.resolve('prettier-plugin-svelte')]; } } async getCompletions(document, position, _, cancellationToken) { if (!this.featureEnabled('completions')) { return null; } const svelteDoc = await this.getSvelteDoc(document); if (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) { return null; } return (0, getCompletions_1.getCompletions)(document, svelteDoc, position); } async doHover(document, position) { if (!this.featureEnabled('hover')) { return null; } return (0, getHoverInfo_1.getHoverInfo)(document, await this.getSvelteDoc(document), position); } async getCodeActions(document, range, context, cancellationToken) { if (!this.featureEnabled('codeActions')) { return []; } const svelteDoc = await this.getSvelteDoc(document); if (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) { return []; } try { return (0, getCodeActions_1.getCodeActions)(svelteDoc, range, context); } catch (error) { return []; } } async executeCommand(document, command, args) { if (!this.featureEnabled('codeActions')) { return null; } const svelteDoc = await this.getSvelteDoc(document); try { return (0, getCodeActions_1.executeCommand)(svelteDoc, command, args); } catch (error) { return null; } } async getSelectionRange(document, position) { if (!this.featureEnabled('selectionRange')) { return null; } const svelteDoc = await this.getSvelteDoc(document); return (0, getSelectionRanges.getSelectionRange)(svelteDoc, position); } featureEnabled(feature) { return (this.configManager.enabled('svelte.enable') && this.configManager.enabled(`svelte.${feature}.enable`)); } async getSvelteDoc(document) { let svelteDoc = this.docManager.get(document); if (!svelteDoc || svelteDoc.version !== document.version) { svelteDoc = new SvelteDocument_1.SvelteDocument(document); this.docManager.set(document, svelteDoc); } return svelteDoc; } } exports.SveltePlugin = SveltePlugin; }); getDefaultExportFromCjs(SveltePlugin_1); var webCustomData = createCommonjsModule(function (module, exports) { (function (factory) { { var v = factory(commonjsRequire, exports); if (v !== undefined) module.exports = v; } })(function (require, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.htmlData = void 0; exports.htmlData = { "version": 1.1, "tags": [ { "name": "html", "description": { "kind": "markdown", "value": "The html element represents the root of an HTML document." }, "attributes": [ { "name": "manifest", "description": { "kind": "markdown", "value": "Specifies the URI of a resource manifest indicating resources that should be cached locally. See [Using the application cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache) for details." } }, { "name": "version", "description": "Specifies the version of the HTML [Document Type Definition](https://developer.mozilla.org/en-US/docs/Glossary/DTD \"Document Type Definition: In HTML, the doctype is the required \"<!DOCTYPE html>\" preamble found at the top of all documents. Its sole purpose is to prevent a browser from switching into so-called “quirks mode” when rendering a document; that is, the \"<!DOCTYPE html>\" doctype ensures that the browser makes a best-effort attempt at following the relevant specifications, rather than using a different rendering mode that is incompatible with some specifications.\") that governs the current document. This attribute is not needed, because it is redundant with the version information in the document type declaration." }, { "name": "xmlns", "description": "Specifies the XML Namespace of the document. Default value is `\"http://www.w3.org/1999/xhtml\"`. This is required in documents parsed with XML parsers, and optional in text/html documents." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/html" } ] }, { "name": "head", "description": { "kind": "markdown", "value": "The head element represents a collection of metadata for the Document." }, "attributes": [ { "name": "profile", "description": "The URIs of one or more metadata profiles, separated by white space." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/head" } ] }, { "name": "title", "description": { "kind": "markdown", "value": "The title element represents the document's title or name. Authors should use titles that identify their documents even when they are used out of context, for example in a user's history or bookmarks, or in search results. The document's title is often different from its first heading, since the first heading does not have to stand alone when taken out of context." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/title" } ] }, { "name": "base", "description": { "kind": "markdown", "value": "The base element allows authors to specify the document base URL for the purposes of resolving relative URLs, and the name of the default browsing context for the purposes of following hyperlinks. The element does not represent any content beyond this information." }, "attributes": [ { "name": "href", "description": { "kind": "markdown", "value": "The base URL to be used throughout the document for relative URL addresses. If this attribute is specified, this element must come before any other elements with attributes whose values are URLs. Absolute and relative URLs are allowed." } }, { "name": "target", "description": { "kind": "markdown", "value": "A name or keyword indicating the default location to display the result when hyperlinks or forms cause navigation, for elements that do not have an explicit target reference. It is a name of, or keyword for, a _browsing context_ (for example: tab, window, or inline frame). The following keywords have special meanings:\n\n* `_self`: Load the result into the same browsing context as the current one. This value is the default if the attribute is not specified.\n* `_blank`: Load the result into a new unnamed browsing context.\n* `_parent`: Load the result into the parent browsing context of the current one. If there is no parent, this option behaves the same way as `_self`.\n* `_top`: Load the result into the top-level browsing context (that is, the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as `_self`.\n\nIf this attribute is specified, this element must come before any other elements with attributes whose values are URLs." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/base" } ] }, { "name": "link", "description": { "kind": "markdown", "value": "The link element allows authors to link their document to other resources." }, "attributes": [ { "name": "href", "description": { "kind": "markdown", "value": "This attribute specifies the [URL](https://developer.mozilla.org/en-US/docs/Glossary/URL \"URL: Uniform Resource Locator (URL) is a text string specifying where a resource can be found on the Internet.\") of the linked resource. A URL can be absolute or relative." } }, { "name": "crossorigin", "valueSet": "xo", "description": { "kind": "markdown", "value": "This enumerated attribute indicates whether [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS \"CORS: CORS (Cross-Origin Resource Sharing) is a system, consisting of transmitting HTTP headers, that determines whether browsers block frontend JavaScript code from accessing responses for cross-origin requests.\") must be used when fetching the resource. [CORS-enabled images](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_Enabled_Image) can be reused in the [`<canvas>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas \"Use the HTML <canvas> element with either the canvas scripting API or the WebGL API to draw graphics and animations.\") element without being _tainted_. The allowed values are:\n\n`anonymous`\n\nA cross-origin request (i.e. with an [`Origin`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin \"The Origin request header indicates where a fetch originates from. It doesn't include any path information, but only the server name. It is sent with CORS requests, as well as with POST requests. It is similar to the Referer header, but, unlike this header, it doesn't disclose the whole path.\") HTTP header) is performed, but no credential is sent (i.e. no cookie, X.509 certificate, or HTTP Basic authentication). If the server does not give credentials to the origin site (by not setting the [`Access-Control-Allow-Origin`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin \"The Access-Control-Allow-Origin response header indicates whether the response can be shared with requesting code from the given origin.\") HTTP header) the image will be tainted and its usage restricted.\n\n`use-credentials`\n\nA cross-origin request (i.e. with an `Origin` HTTP header) is performed along with a credential sent (i.e. a cookie, certificate, and/or HTTP Basic authentication is performed). If the server does not give credentials to the origin site (through [`Access-Control-Allow-Credentials`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials \"The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to frontend JavaScript code when the request's credentials mode (Request.credentials) is \"include\".\") HTTP header), the resource will be _tainted_ and its usage restricted.\n\nIf the attribute is not present, the resource is fetched without a [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS \"CORS: CORS (Cross-Origin Resource Sharing) is a system, consisting of transmitting HTTP headers, that determines whether browsers block frontend JavaScript code from accessing responses for cross-origin requests.\") request (i.e. without sending the `Origin` HTTP header), preventing its non-tainted usage. If invalid, it is handled as if the enumerated keyword **anonymous** was used. See [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for additional information." } }, { "name": "rel", "description": { "kind": "markdown", "value": "This attribute names a relationship of the linked document to the current document. The attribute must be a space-separated list of the [link types values](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types)." } }, { "name": "media", "description": { "kind": "markdown", "value": "This attribute specifies the media that the linked resource applies to. Its value must be a media type / [media query](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_queries). This attribute is mainly useful when linking to external stylesheets — it allows the user agent to pick the best adapted one for the device it runs on.\n\n**Notes:**\n\n* In HTML 4, this can only be a simple white-space-separated list of media description literals, i.e., [media types and groups](https://developer.mozilla.org/en-US/docs/Web/CSS/@media), where defined and allowed as values for this attribute, such as `print`, `screen`, `aural`, `braille`. HTML5 extended this to any kind of [media queries](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_queries), which are a superset of the allowed values of HTML 4.\n* Browsers not supporting [CSS3 Media Queries](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_queries) won't necessarily recognize the adequate link; do not forget to set fallback links, the restricted set of media queries defined in HTML 4." } }, { "name": "hreflang", "description": { "kind": "markdown", "value": "This attribute indicates the language of the linked resource. It is purely advisory. Allowed values are determined by [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt). Use this attribute only if the [`href`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href) attribute is present." } }, { "name": "type", "description": { "kind": "markdown", "value": "This attribute is used to define the type of the content linked to. The value of the attribute should be a MIME type such as **text/html**, **text/css**, and so on. The common use of this attribute is to define the type of stylesheet being referenced (such as **text/css**), but given that CSS is the only stylesheet language used on the web, not only is it possible to omit the `type` attribute, but is actually now recommended practice. It is also used on `rel=\"preload\"` link types, to make sure the browser only downloads file types that it supports." } }, { "name": "sizes", "description": { "kind": "markdown", "value": "This attribute defines the sizes of the icons for visual media contained in the resource. It must be present only if the [`rel`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-rel) contains a value of `icon` or a non-standard type such as Apple's `apple-touch-icon`. It may have the following values:\n\n* `any`, meaning that the icon can be scaled to any size as it is in a vector format, like `image/svg+xml`.\n* a white-space separated list of sizes, each in the format `_<width in pixels>_x_<height in pixels>_` or `_<width in pixels>_X_<height in pixels>_`. Each of these sizes must be contained in the resource.\n\n**Note:** Most icon formats are only able to store one single icon; therefore most of the time the [`sizes`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-sizes) contains only one entry. MS's ICO format does, as well as Apple's ICNS. ICO is more ubiquitous; you should definitely use it." } }, { "name": "as", "description": "This attribute is only used when `rel=\"preload\"` or `rel=\"prefetch\"` has been set on the `<link>` element. It specifies the type of content being loaded by the `<link>`, which is necessary for content prioritization, request matching, application of correct [content security policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP), and setting of correct [`Accept`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept \"The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Type response header. Browsers set adequate values for this header depending on the context where the request is done: when fetching a CSS stylesheet a different value is set for the request than when fetching an image, video or a script.\") request header." }, { "name": "importance", "description": "Indicates the relative importance of the resource. Priority hints are delegated using the values:" }, { "name": "importance", "description": "**`auto`**: Indicates **no preference**. The browser may use its own heuristics to decide the priority of the resource.\n\n**`high`**: Indicates to the browser that the resource is of **high** priority.\n\n**`low`**: Indicates to the browser that the resource is of **low** priority.\n\n**Note:** The `importance` attribute may only be used for the `<link>` element if `rel=\"preload\"` or `rel=\"prefetch\"` is present." }, { "name": "integrity", "description": "Contains inline metadata — a base64-encoded cryptographic hash of the resource (file) you’re telling the browser to fetch. The browser can use this to verify that the fetched resource has been delivered free of unexpected manipulation. See [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)." }, { "name": "referrerpolicy", "description": "A string indicating which referrer to use when fetching the resource:\n\n* `no-referrer` means that the [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent.\n* `no-referrer-when-downgrade` means that no [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will be sent when navigating to an origin without TLS (HTTPS). This is a user agent’s default behavior, if no policy is otherwise specified.\n* `origin` means that the referrer will be the origin of the page, which is roughly the scheme, the host, and the port.\n* `origin-when-cross-origin` means that navigating to other origins will be limited to the scheme, the host, and the port, while navigating on the same origin will include the referrer's path.\n* `unsafe-url` means that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe because it can leak origins and paths from TLS-protected resources to insecure origins." }, { "name": "title", "description": "The `title` attribute has special semantics on the `<link>` element. When used on a `<link rel=\"stylesheet\">` it defines a [preferred or an alternate stylesheet](https://developer.mozilla.org/en-US/docs/Web/CSS/Alternative_style_sheets). Incorrectly using it may [cause the stylesheet to be ignored](https://developer.mozilla.org/en-US/docs/Correctly_Using_Titles_With_External_Stylesheets)." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/link" } ] }, { "name": "meta", "description": { "kind": "markdown", "value": "The meta element represents various kinds of metadata that cannot be expressed using the title, base, link, style, and script elements." }, "attributes": [ { "name": "name", "description": { "kind": "markdown", "value": "This attribute defines the name of a piece of document-level metadata. It should not be set if one of the attributes [`itemprop`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-itemprop), [`http-equiv`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-http-equiv) or [`charset`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-charset) is also set.\n\nThis metadata name is associated with the value contained by the [`content`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content) attribute. The possible values for the name attribute are:\n\n* `application-name` which defines the name of the application running in the web page.\n \n **Note:**\n \n * Browsers may use this to identify the application. It is different from the [`<title>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title \"The HTML Title element (<title>) defines the document's title that is shown in a browser's title bar or a page's tab.\") element, which usually contain the application name, but may also contain information like the document name or a status.\n * Simple web pages shouldn't define an application-name.\n \n* `author` which defines the name of the document's author.\n* `description` which contains a short and accurate summary of the content of the page. Several browsers, like Firefox and Opera, use this as the default description of bookmarked pages.\n* `generator` which contains the identifier of the software that generated the page.\n* `keywords` which contains words relevant to the page's content separated by commas.\n* `referrer` which controls the [`Referer` HTTP header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer) attached to requests sent from the document:\n \n Values for the `content` attribute of `<meta name=\"referrer\">`\n \n `no-referrer`\n \n Do not send a HTTP `Referrer` header.\n \n `origin`\n \n Send the [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) of the document.\n \n `no-referrer-when-downgrade`\n \n Send the [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) as a referrer to URLs as secure as the current page, (https→https), but does not send a referrer to less secure URLs (https→http). This is the default behaviour.\n \n `origin-when-cross-origin`\n \n Send the full URL (stripped of parameters) for same-origin requests, but only send the [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) for other cases.\n \n `same-origin`\n \n A referrer will be sent for [same-site origins](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy), but cross-origin requests will contain no referrer information.\n \n `strict-origin`\n \n Only send the origin of the document as the referrer to a-priori as-much-secure destination (HTTPS->HTTPS), but don't send it to a less secure destination (HTTPS->HTTP).\n \n `strict-origin-when-cross-origin`\n \n Send a full URL when performing a same-origin request, only send the origin of the document to a-priori as-much-secure destination (HTTPS->HTTPS), and send no header to a less secure destination (HTTPS->HTTP).\n \n `unsafe-URL`\n \n Send the full URL (stripped of parameters) for same-origin or cross-origin requests.\n \n **Notes:**\n \n * Some browsers support the deprecated values of `always`, `default`, and `never` for referrer.\n * Dynamically inserting `<meta name=\"referrer\">` (with [`document.write`](https://developer.mozilla.org/en-US/docs/Web/API/Document/write) or [`appendChild`](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild)) makes the referrer behaviour unpredictable.\n * When several conflicting policies are defined, the no-referrer policy is applied.\n \n\nThis attribute may also have a value taken from the extended list defined on [WHATWG Wiki MetaExtensions page](https://wiki.whatwg.org/wiki/MetaExtensions). Although none have been formally accepted yet, a few commonly used names are:\n\n* `creator` which defines the name of the creator of the document, such as an organization or institution. If there are more than one, several [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") elements should be used.\n* `googlebot`, a synonym of `robots`, is only followed by Googlebot (the indexing crawler for Google).\n* `publisher` which defines the name of the document's publisher.\n* `robots` which defines the behaviour that cooperative crawlers, or \"robots\", should use with the page. It is a comma-separated list of the values below:\n \n Values for the content of `<meta name=\"robots\">`\n \n Value\n \n Description\n \n Used by\n \n `index`\n \n Allows the robot to index the page (default).\n \n All\n \n `noindex`\n \n Requests the robot to not index the page.\n \n All\n \n `follow`\n \n Allows the robot to follow the links on the page (default).\n \n All\n \n `nofollow`\n \n Requests the robot to not follow the links on the page.\n \n All\n \n `none`\n \n Equivalent to `noindex, nofollow`\n \n [Google](https://support.google.com/webmasters/answer/79812)\n \n `noodp`\n \n Prevents using the [Open Directory Project](https://www.dmoz.org/) description, if any, as the page description in search engine results.\n \n [Google](https://support.google.com/webmasters/answer/35624#nodmoz), [Yahoo](https://help.yahoo.com/kb/search-for-desktop/meta-tags-robotstxt-yahoo-search-sln2213.html#cont5), [Bing](https://www.bing.com/webmaster/help/which-robots-metatags-does-bing-support-5198d240)\n \n `noarchive`\n \n Requests the search engine not to cache the page content.\n \n [Google](https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag#valid-indexing--serving-directives), [Yahoo](https://help.yahoo.com/kb/search-for-desktop/SLN2213.html), [Bing](https://www.bing.com/webmaster/help/which-robots-metatags-does-bing-support-5198d240)\n \n `nosnippet`\n \n Prevents displaying any description of the page in search engine results.\n \n [Google](https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag#valid-indexing--serving-directives), [Bing](https://www.bing.com/webmaster/help/which-robots-metatags-does-bing-support-5198d240)\n \n `noimageindex`\n \n Requests this page not to appear as the referring page of an indexed image.\n \n [Google](https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag#valid-indexing--serving-directives)\n \n `nocache`\n \n Synonym of `noarchive`.\n \n [Bing](https://www.bing.com/webmaster/help/which-robots-metatags-does-bing-support-5198d240)\n \n **Notes:**\n \n * Only cooperative robots follow these rules. Do not expect to prevent e-mail harvesters with them.\n * The robot still needs to access the page in order to read these rules. To prevent bandwidth consumption, use a _[robots.txt](https://developer.mozilla.org/en-US/docs/Glossary/robots.txt \"robots.txt: Robots.txt is a file which is usually placed in the root of any website. It decides whether crawlers are permitted or forbidden access to the web site.\")_ file.\n * If you want to remove a page, `noindex` will work, but only after the robot visits the page again. Ensure that the `robots.txt` file is not preventing revisits.\n * Some values are mutually exclusive, like `index` and `noindex`, or `follow` and `nofollow`. In these cases the robot's behaviour is undefined and may vary between them.\n * Some crawler robots, like Google, Yahoo and Bing, support the same values for the HTTP header `X-Robots-Tag`; this allows non-HTML documents like images to use these rules.\n \n* `slurp`, is a synonym of `robots`, but only for Slurp - the crawler for Yahoo Search.\n* `viewport`, which gives hints about the size of the initial size of the [viewport](https://developer.mozilla.org/en-US/docs/Glossary/viewport \"viewport: A viewport represents a polygonal (normally rectangular) area in computer graphics that is currently being viewed. In web browser terms, it refers to the part of the document you're viewing which is currently visible in its window (or the screen, if the document is being viewed in full screen mode). Content outside the viewport is not visible onscreen until scrolled into view.\"). Used by mobile devices only.\n \n Values for the content of `<meta name=\"viewport\">`\n \n Value\n \n Possible subvalues\n \n Description\n \n `width`\n \n A positive integer number, or the text `device-width`\n \n Defines the pixel width of the viewport that you want the web site to be rendered at.\n \n `height`\n \n A positive integer, or the text `device-height`\n \n Defines the height of the viewport. Not used by any browser.\n \n `initial-scale`\n \n A positive number between `0.0` and `10.0`\n \n Defines the ratio between the device width (`device-width` in portrait mode or `device-height` in landscape mode) and the viewport size.\n \n `maximum-scale`\n \n A positive number between `0.0` and `10.0`\n \n Defines the maximum amount to zoom in. It must be greater or equal to the `minimum-scale` or the behaviour is undefined. Browser settings can ignore this rule and iOS10+ ignores it by default.\n \n `minimum-scale`\n \n A positive number between `0.0` and `10.0`\n \n Defines the minimum zoom level. It must be smaller or equal to the `maximum-scale` or the behaviour is undefined. Browser settings can ignore this rule and iOS10+ ignores it by default.\n \n `user-scalable`\n \n `yes` or `no`\n \n If set to `no`, the user is not able to zoom in the webpage. The default is `yes`. Browser settings can ignore this rule, and iOS10+ ignores it by default.\n \n Specification\n \n Status\n \n Comment\n \n [CSS Device Adaptation \n The definition of '<meta name=\"viewport\">' in that specification.](https://drafts.csswg.org/css-device-adapt/#viewport-meta)\n \n Working Draft\n \n Non-normatively describes the Viewport META element\n \n See also: [`@viewport`](https://developer.mozilla.org/en-US/docs/Web/CSS/@viewport \"The @viewport CSS at-rule lets you configure the viewport through which the document is viewed. It's primarily used for mobile devices, but is also used by desktop browsers that support features like \"snap to edge\" (such as Microsoft Edge).\")\n \n **Notes:**\n \n * Though unstandardized, this declaration is respected by most mobile browsers due to de-facto dominance.\n * The default values may vary between devices and browsers.\n * To learn about this declaration in Firefox for Mobile, see [this article](https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag \"Mobile/Viewport meta tag\")." } }, { "name": "http-equiv", "description": { "kind": "markdown", "value": "Defines a pragma directive. The attribute is named `**http-equiv**(alent)` because all the allowed values are names of particular HTTP headers:\n\n* `\"content-language\"` \n Defines the default language of the page. It can be overridden by the [lang](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang) attribute on any element.\n \n **Warning:** Do not use this value, as it is obsolete. Prefer the `lang` attribute on the [`<html>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html \"The HTML <html> element represents the root (top-level element) of an HTML document, so it is also referred to as the root element. All other elements must be descendants of this element.\") element.\n \n* `\"content-security-policy\"` \n Allows page authors to define a [content policy](https://developer.mozilla.org/en-US/docs/Web/Security/CSP/CSP_policy_directives) for the current page. Content policies mostly specify allowed server origins and script endpoints which help guard against cross-site scripting attacks.\n* `\"content-type\"` \n Defines the [MIME type](https://developer.mozilla.org/en-US/docs/Glossary/MIME_type) of the document, followed by its character encoding. It follows the same syntax as the HTTP `content-type` entity-header field, but as it is inside a HTML page, most values other than `text/html` are impossible. Therefore the valid syntax for its `content` is the string '`text/html`' followed by a character set with the following syntax: '`; charset=_IANAcharset_`', where `IANAcharset` is the _preferred MIME name_ for a character set as [defined by the IANA.](https://www.iana.org/assignments/character-sets)\n \n **Warning:** Do not use this value, as it is obsolete. Use the [`charset`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-charset) attribute on the [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") element.\n \n **Note:** As [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") can't change documents' types in XHTML or HTML5's XHTML serialization, never set the MIME type to an XHTML MIME type with `<meta>`.\n \n* `\"refresh\"` \n This instruction specifies:\n * The number of seconds until the page should be reloaded - only if the [`content`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content) attribute contains a positive integer.\n * The number of seconds until the page should redirect to another - only if the [`content`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content) attribute contains a positive integer followed by the string '`;url=`', and a valid URL.\n* `\"set-cookie\"` \n Defines a [cookie](https://developer.mozilla.org/en-US/docs/cookie) for the page. Its content must follow the syntax defined in the [IETF HTTP Cookie Specification](https://tools.ietf.org/html/draft-ietf-httpstate-cookie-14).\n \n **Warning:** Do not use this instruction, as it is obsolete. Use the HTTP header [`Set-Cookie`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) instead." } }, { "name": "content", "description": { "kind": "markdown", "value": "This attribute contains the value for the [`http-equiv`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-http-equiv) or [`name`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-name) attribute, depending on which is used." } }, { "name": "charset", "description": { "kind": "markdown", "value": "This attribute declares the page's character encoding. It must contain a [standard IANA MIME name for character encodings](https://www.iana.org/assignments/character-sets). Although the standard doesn't request a specific encoding, it suggests:\n\n* Authors are encouraged to use [`UTF-8`](https://developer.mozilla.org/en-US/docs/Glossary/UTF-8).\n* Authors should not use ASCII-incompatible encodings to avoid security risk: browsers not supporting them may interpret harmful content as HTML. This happens with the `JIS_C6226-1983`, `JIS_X0212-1990`, `HZ-GB-2312`, `JOHAB`, the ISO-2022 family and the EBCDIC family.\n\n**Note:** ASCII-incompatible encodings are those that don't map the 8-bit code points `0x20` to `0x7E` to the `0x0020` to `0x007E` Unicode code points)\n\n* Authors **must not** use `CESU-8`, `UTF-7`, `BOCU-1` and/or `SCSU` as [cross-site scripting](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting) attacks with these encodings have been demonstrated.\n* Authors should not use `UTF-32` because not all HTML5 encoding algorithms can distinguish it from `UTF-16`.\n\n**Notes:**\n\n* The declared character encoding must match the one the page was saved with to avoid garbled characters and security holes.\n* The [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") element declaring the encoding must be inside the [`<head>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head \"The HTML <head> element provides general information (metadata) about the document, including its title and links to its scripts and style sheets.\") element and **within the first 1024 bytes** of the HTML as some browsers only look at those bytes before choosing an encoding.\n* This [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") element is only one part of the [algorithm to determine a page's character set](https://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#encoding-sniffing-algorithm \"Algorithm charset page\"). The [`Content-Type` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) and any [Byte-Order Marks](https://developer.mozilla.org/en-US/docs/Glossary/Byte-Order_Mark \"The definition of that term (Byte-Order Marks) has not been written yet; please consider contributing it!\") override this element.\n* It is strongly recommended to define the character encoding. If a page's encoding is undefined, cross-scripting techniques are possible, such as the [`UTF-7` fallback cross-scripting technique](https://code.google.com/p/doctype-mirror/wiki/ArticleUtf7).\n* The [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta \"The HTML <meta> element represents metadata that cannot be represented by other HTML meta-related elements, like <base>, <link>, <script>, <style> or <title>.\") element with a `charset` attribute is a synonym for the pre-HTML5 `<meta http-equiv=\"Content-Type\" content=\"text/html; charset=_IANAcharset_\">`, where _`IANAcharset`_ contains the value of the equivalent [`charset`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-charset) attribute. This syntax is still allowed, although no longer recommended." } }, { "name": "scheme", "description": "This attribute defines the scheme in which metadata is described. A scheme is a context leading to the correct interpretations of the [`content`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content) value, like a format.\n\n**Warning:** Do not use this value, as it is obsolete. There is no replacement as there was no real usage for it." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/meta" } ] }, { "name": "style", "description": { "kind": "markdown", "value": "The style element allows authors to embed style information in their documents. The style element is one of several inputs to the styling processing model. The element does not represent content for the user." }, "attributes": [ { "name": "media", "description": { "kind": "markdown", "value": "This attribute defines which media the style should be applied to. Its value is a [media query](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries), which defaults to `all` if the attribute is missing." } }, { "name": "nonce", "description": { "kind": "markdown", "value": "A cryptographic nonce (number used once) used to whitelist inline styles in a [style-src Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide a nonce that cannot be guessed as bypassing a resource’s policy is otherwise trivial." } }, { "name": "type", "description": { "kind": "markdown", "value": "This attribute defines the styling language as a MIME type (charset should not be specified). This attribute is optional and defaults to `text/css` if it is not specified — there is very little reason to include this in modern web documents." } }, { "name": "scoped", "valueSet": "v" }, { "name": "title", "description": "This attribute specifies [alternative style sheet](https://developer.mozilla.org/en-US/docs/Web/CSS/Alternative_style_sheets) sets." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/style" } ] }, { "name": "body", "description": { "kind": "markdown", "value": "The body element represents the content of the document." }, "attributes": [ { "name": "onafterprint", "description": { "kind": "markdown", "value": "Function to call after the user has printed the document." } }, { "name": "onbeforeprint", "description": { "kind": "markdown", "value": "Function to call when the user requests printing of the document." } }, { "name": "onbeforeunload", "description": { "kind": "markdown", "value": "Function to call when the document is about to be unloaded." } }, { "name": "onhashchange", "description": { "kind": "markdown", "value": "Function to call when the fragment identifier part (starting with the hash (`'#'`) character) of the document's current address has changed." } }, { "name": "onlanguagechange", "description": { "kind": "markdown", "value": "Function to call when the preferred languages changed." } }, { "name": "onmessage", "description": { "kind": "markdown", "value": "Function to call when the document has received a message." } }, { "name": "onoffline", "description": { "kind": "markdown", "value": "Function to call when network communication has failed." } }, { "name": "ononline", "description": { "kind": "markdown", "value": "Function to call when network communication has been restored." } }, { "name": "onpagehide" }, { "name": "onpageshow" }, { "name": "onpopstate", "description": { "kind": "markdown", "value": "Function to call when the user has navigated session history." } }, { "name": "onstorage", "description": { "kind": "markdown", "value": "Function to call when the storage area has changed." } }, { "name": "onunload", "description": { "kind": "markdown", "value": "Function to call when the document is going away." } }, { "name": "alink", "description": "Color of text for hyperlinks when selected. _This method is non-conforming, use CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color \"The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value.\") property in conjunction with the [`:active`](https://developer.mozilla.org/en-US/docs/Web/CSS/:active \"The :active CSS pseudo-class represents an element (such as a button) that is being activated by the user.\") pseudo-class instead._" }, { "name": "background", "description": "URI of a image to use as a background. _This method is non-conforming, use CSS [`background`](https://developer.mozilla.org/en-US/docs/Web/CSS/background \"The background shorthand CSS property sets all background style properties at once, such as color, image, origin and size, or repeat method.\") property on the element instead._" }, { "name": "bgcolor", "description": "Background color for the document. _This method is non-conforming, use CSS [`background-color`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-color \"The background-color CSS property sets the background color of an element.\") property on the element instead._" }, { "name": "bottommargin", "description": "The margin of the bottom of the body. _This method is non-conforming, use CSS [`margin-bottom`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom \"The margin-bottom CSS property sets the margin area on the bottom of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") property on the element instead._" }, { "name": "leftmargin", "description": "The margin of the left of the body. _This method is non-conforming, use CSS [`margin-left`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left \"The margin-left CSS property sets the margin area on the left side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") property on the element instead._" }, { "name": "link", "description": "Color of text for unvisited hypertext links. _This method is non-conforming, use CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color \"The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value.\") property in conjunction with the [`:link`](https://developer.mozilla.org/en-US/docs/Web/CSS/:link \"The :link CSS pseudo-class represents an element that has not yet been visited. It matches every unvisited <a>, <area>, or <link> element that has an href attribute.\") pseudo-class instead._" }, { "name": "onblur", "description": "Function to call when the document loses focus." }, { "name": "onerror", "description": "Function to call when the document fails to load properly." }, { "name": "onfocus", "description": "Function to call when the document receives focus." }, { "name": "onload", "description": "Function to call when the document has finished loading." }, { "name": "onredo", "description": "Function to call when the user has moved forward in undo transaction history." }, { "name": "onresize", "description": "Function to call when the document has been resized." }, { "name": "onundo", "description": "Function to call when the user has moved backward in undo transaction history." }, { "name": "rightmargin", "description": "The margin of the right of the body. _This method is non-conforming, use CSS [`margin-right`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right \"The margin-right CSS property sets the margin area on the right side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") property on the element instead._" }, { "name": "text", "description": "Foreground color of text. _This method is non-conforming, use CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color \"The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value.\") property on the element instead._" }, { "name": "topmargin", "description": "The margin of the top of the body. _This method is non-conforming, use CSS [`margin-top`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top \"The margin-top CSS property sets the margin area on the top of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") property on the element instead._" }, { "name": "vlink", "description": "Color of text for visited hypertext links. _This method is non-conforming, use CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color \"The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value.\") property in conjunction with the [`:visited`](https://developer.mozilla.org/en-US/docs/Web/CSS/:visited \"The :visited CSS pseudo-class represents links that the user has already visited. For privacy reasons, the styles that can be modified using this selector are very limited.\") pseudo-class instead._" } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/body" } ] }, { "name": "article", "description": { "kind": "markdown", "value": "The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content. Each article should be identified, typically by including a heading (h1–h6 element) as a child of the article element." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/article" } ] }, { "name": "section", "description": { "kind": "markdown", "value": "The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content. Each section should be identified, typically by including a heading ( h1- h6 element) as a child of the section element." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/section" } ] }, { "name": "nav", "description": { "kind": "markdown", "value": "The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/nav" } ] }, { "name": "aside", "description": { "kind": "markdown", "value": "The aside element represents a section of a page that consists of content that is tangentially related to the content around the aside element, and which could be considered separate from that content. Such sections are often represented as sidebars in printed typography." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/aside" } ] }, { "name": "h1", "description": { "kind": "markdown", "value": "The h1 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "h2", "description": { "kind": "markdown", "value": "The h2 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "h3", "description": { "kind": "markdown", "value": "The h3 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "h4", "description": { "kind": "markdown", "value": "The h4 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "h5", "description": { "kind": "markdown", "value": "The h5 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "h6", "description": { "kind": "markdown", "value": "The h6 element represents a section heading." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/Heading_Elements" } ] }, { "name": "header", "description": { "kind": "markdown", "value": "The header element represents introductory content for its nearest ancestor sectioning content or sectioning root element. A header typically contains a group of introductory or navigational aids. When the nearest ancestor sectioning content or sectioning root element is the body element, then it applies to the whole page." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/header" } ] }, { "name": "footer", "description": { "kind": "markdown", "value": "The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/footer" } ] }, { "name": "address", "description": { "kind": "markdown", "value": "The address element represents the contact information for its nearest article or body element ancestor. If that is the body element, then the contact information applies to the document as a whole." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/address" } ] }, { "name": "p", "description": { "kind": "markdown", "value": "The p element represents a paragraph." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/p" } ] }, { "name": "hr", "description": { "kind": "markdown", "value": "The hr element represents a paragraph-level thematic break, e.g. a scene change in a story, or a transition to another topic within a section of a reference book." }, "attributes": [ { "name": "align", "description": "Sets the alignment of the rule on the page. If no value is specified, the default value is `left`." }, { "name": "color", "description": "Sets the color of the rule through color name or hexadecimal value." }, { "name": "noshade", "description": "Sets the rule to have no shading." }, { "name": "size", "description": "Sets the height, in pixels, of the rule." }, { "name": "width", "description": "Sets the length of the rule on the page through a pixel or percentage value." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/hr" } ] }, { "name": "pre", "description": { "kind": "markdown", "value": "The pre element represents a block of preformatted text, in which structure is represented by typographic conventions rather than by elements." }, "attributes": [ { "name": "cols", "description": "Contains the _preferred_ count of characters that a line should have. It was a non-standard synonym of [`width`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre#attr-width). To achieve such an effect, use CSS [`width`](https://developer.mozilla.org/en-US/docs/Web/CSS/width \"The width CSS property sets an element's width. By default it sets the width of the content area, but if box-sizing is set to border-box, it sets the width of the border area.\") instead." }, { "name": "width", "description": "Contains the _preferred_ count of characters that a line should have. Though technically still implemented, this attribute has no visual effect; to achieve such an effect, use CSS [`width`](https://developer.mozilla.org/en-US/docs/Web/CSS/width \"The width CSS property sets an element's width. By default it sets the width of the content area, but if box-sizing is set to border-box, it sets the width of the border area.\") instead." }, { "name": "wrap", "description": "Is a _hint_ indicating how the overflow must happen. In modern browser this hint is ignored and no visual effect results in its present; to achieve such an effect, use CSS [`white-space`](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space \"The white-space CSS property sets how white space inside an element is handled.\") instead." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/pre" } ] }, { "name": "blockquote", "description": { "kind": "markdown", "value": "The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a footer or cite element, and optionally with in-line changes such as annotations and abbreviations." }, "attributes": [ { "name": "cite", "description": { "kind": "markdown", "value": "A URL that designates a source document or message for the information quoted. This attribute is intended to point to information explaining the context or the reference for the quote." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/blockquote" } ] }, { "name": "ol", "description": { "kind": "markdown", "value": "The ol element represents a list of items, where the items have been intentionally ordered, such that changing the order would change the meaning of the document." }, "attributes": [ { "name": "reversed", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute specifies that the items of the list are specified in reversed order." } }, { "name": "start", "description": { "kind": "markdown", "value": "This integer attribute specifies the start value for numbering the individual list items. Although the ordering type of list elements might be Roman numerals, such as XXXI, or letters, the value of start is always represented as a number. To start numbering elements from the letter \"C\", use `<ol start=\"3\">`.\n\n**Note**: This attribute was deprecated in HTML4, but reintroduced in HTML5." } }, { "name": "type", "valueSet": "lt", "description": { "kind": "markdown", "value": "Indicates the numbering type:\n\n* `'a'` indicates lowercase letters,\n* `'A'` indicates uppercase letters,\n* `'i'` indicates lowercase Roman numerals,\n* `'I'` indicates uppercase Roman numerals,\n* and `'1'` indicates numbers (default).\n\nThe type set is used for the entire list unless a different [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li#attr-type) attribute is used within an enclosed [`<li>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li \"The HTML <li> element is used to represent an item in a list. It must be contained in a parent element: an ordered list (<ol>), an unordered list (<ul>), or a menu (<menu>). In menus and unordered lists, list items are usually displayed using bullet points. In ordered lists, they are usually displayed with an ascending counter on the left, such as a number or letter.\") element.\n\n**Note:** This attribute was deprecated in HTML4, but reintroduced in HTML5.\n\nUnless the value of the list number matters (e.g. in legal or technical documents where items are to be referenced by their number/letter), the CSS [`list-style-type`](https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type \"The list-style-type CSS property sets the marker (such as a disc, character, or custom counter style) of a list item element.\") property should be used instead." } }, { "name": "compact", "description": "This Boolean attribute hints that the list should be rendered in a compact style. The interpretation of this attribute depends on the user agent and it doesn't work in all browsers.\n\n**Warning:** Do not use this attribute, as it has been deprecated: the [`<ol>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol \"The HTML <ol> element represents an ordered list of items, typically rendered as a numbered list.\") element should be styled using [CSS](https://developer.mozilla.org/en-US/docs/CSS). To give an effect similar to the `compact` attribute, the [CSS](https://developer.mozilla.org/en-US/docs/CSS) property [`line-height`](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height \"The line-height CSS property sets the amount of space used for lines, such as in text. On block-level elements, it specifies the minimum height of line boxes within the element. On non-replaced inline elements, it specifies the height that is used to calculate line box height.\") can be used with a value of `80%`." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/ol" } ] }, { "name": "ul", "description": { "kind": "markdown", "value": "The ul element represents a list of items, where the order of the items is not important — that is, where changing the order would not materially change the meaning of the document." }, "attributes": [ { "name": "compact", "description": "This Boolean attribute hints that the list should be rendered in a compact style. The interpretation of this attribute depends on the user agent and it doesn't work in all browsers.\n\n**Usage note: **Do not use this attribute, as it has been deprecated: the [`<ul>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul \"The HTML <ul> element represents an unordered list of items, typically rendered as a bulleted list.\") element should be styled using [CSS](https://developer.mozilla.org/en-US/docs/CSS). To give a similar effect as the `compact` attribute, the [CSS](https://developer.mozilla.org/en-US/docs/CSS) property [line-height](https://developer.mozilla.org/en-US/docs/CSS/line-height) can be used with a value of `80%`." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/ul" } ] }, { "name": "li", "description": { "kind": "markdown", "value": "The li element represents a list item. If its parent element is an ol, ul, or menu element, then the element is an item of the parent element's list, as defined for those elements. Otherwise, the list item has no defined list-related relationship to any other li element." }, "attributes": [ { "name": "value", "description": { "kind": "markdown", "value": "This integer attribute indicates the current ordinal value of the list item as defined by the [`<ol>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol \"The HTML <ol> element represents an ordered list of items, typically rendered as a numbered list.\") element. The only allowed value for this attribute is a number, even if the list is displayed with Roman numerals or letters. List items that follow this one continue numbering from the value set. The **value** attribute has no meaning for unordered lists ([`<ul>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul \"The HTML <ul> element represents an unordered list of items, typically rendered as a bulleted list.\")) or for menus ([`<menu>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menu \"The HTML <menu> element represents a group of commands that a user can perform or activate. This includes both list menus, which might appear across the top of a screen, as well as context menus, such as those that might appear underneath a button after it has been clicked.\")).\n\n**Note**: This attribute was deprecated in HTML4, but reintroduced in HTML5.\n\n**Note:** Prior to Gecko 9.0, negative values were incorrectly converted to 0. Starting in Gecko 9.0 all integer values are correctly parsed." } }, { "name": "type", "description": "This character attribute indicates the numbering type:\n\n* `a`: lowercase letters\n* `A`: uppercase letters\n* `i`: lowercase Roman numerals\n* `I`: uppercase Roman numerals\n* `1`: numbers\n\nThis type overrides the one used by its parent [`<ol>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol \"The HTML <ol> element represents an ordered list of items, typically rendered as a numbered list.\") element, if any.\n\n**Usage note:** This attribute has been deprecated: use the CSS [`list-style-type`](https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type \"The list-style-type CSS property sets the marker (such as a disc, character, or custom counter style) of a list item element.\") property instead." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/li" } ] }, { "name": "dl", "description": { "kind": "markdown", "value": "The dl element represents an association list consisting of zero or more name-value groups (a description list). A name-value group consists of one or more names (dt elements) followed by one or more values (dd elements), ignoring any nodes other than dt and dd elements. Within a single dl element, there should not be more than one dt element for each name." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/dl" } ] }, { "name": "dt", "description": { "kind": "markdown", "value": "The dt element represents the term, or name, part of a term-description group in a description list (dl element)." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/dt" } ] }, { "name": "dd", "description": { "kind": "markdown", "value": "The dd element represents the description, definition, or value, part of a term-description group in a description list (dl element)." }, "attributes": [ { "name": "nowrap", "description": "If the value of this attribute is set to `yes`, the definition text will not wrap. The default value is `no`." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/dd" } ] }, { "name": "figure", "description": { "kind": "markdown", "value": "The figure element represents some flow content, optionally with a caption, that is self-contained (like a complete sentence) and is typically referenced as a single unit from the main flow of the document." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/figure" } ] }, { "name": "figcaption", "description": { "kind": "markdown", "value": "The figcaption element represents a caption or legend for the rest of the contents of the figcaption element's parent figure element, if any." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/figcaption" } ] }, { "name": "main", "description": { "kind": "markdown", "value": "The main element represents the main content of the body of a document or application. The main content area consists of content that is directly related to or expands upon the central topic of a document or central functionality of an application." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/main" } ] }, { "name": "div", "description": { "kind": "markdown", "value": "The div element has no special meaning at all. It represents its children. It can be used with the class, lang, and title attributes to mark up semantics common to a group of consecutive elements." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/div" } ] }, { "name": "a", "description": { "kind": "markdown", "value": "If the a element has an href attribute, then it represents a hyperlink (a hypertext anchor) labeled by its contents." }, "attributes": [ { "name": "href", "description": { "kind": "markdown", "value": "Contains a URL or a URL fragment that the hyperlink points to." } }, { "name": "target", "description": { "kind": "markdown", "value": "Specifies where to display the linked URL. It is a name of, or keyword for, a _browsing context_: a tab, window, or `<iframe>`. The following keywords have special meanings:\n\n* `_self`: Load the URL into the same browsing context as the current one. This is the default behavior.\n* `_blank`: Load the URL into a new browsing context. This is usually a tab, but users can configure browsers to use new windows instead.\n* `_parent`: Load the URL into the parent browsing context of the current one. If there is no parent, this behaves the same way as `_self`.\n* `_top`: Load the URL into the top-level browsing context (that is, the \"highest\" browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this behaves the same way as `_self`.\n\n**Note:** When using `target`, consider adding `rel=\"noreferrer\"` to avoid exploitation of the `window.opener` API.\n\n**Note:** Linking to another page using `target=\"_blank\"` will run the new page on the same process as your page. If the new page is executing expensive JS, your page's performance may suffer. To avoid this use `rel=\"noopener\"`." } }, { "name": "download", "description": { "kind": "markdown", "value": "This attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want). There are no restrictions on allowed values, though `/` and `\\` are converted to underscores. Most file systems limit some punctuation in file names, and browsers will adjust the suggested name accordingly.\n\n**Notes:**\n\n* This attribute only works for [same-origin URLs](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy).\n* Although HTTP(s) URLs need to be in the same-origin, [`blob:` URLs](https://developer.mozilla.org/en-US/docs/Web/API/URL.createObjectURL) and [`data:` URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) are allowed so that content generated by JavaScript, such as pictures created in an image-editor Web app, can be downloaded.\n* If the HTTP header [`Content-Disposition:`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) gives a different filename than this attribute, the HTTP header takes priority over this attribute.\n* If `Content-Disposition:` is set to `inline`, Firefox prioritizes `Content-Disposition`, like the filename case, while Chrome prioritizes the `download` attribute." } }, { "name": "ping", "description": { "kind": "markdown", "value": "Contains a space-separated list of URLs to which, when the hyperlink is followed, [`POST`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST \"The HTTP POST method sends data to the server. The type of the body of the request is indicated by the Content-Type header.\") requests with the body `PING` will be sent by the browser (in the background). Typically used for tracking." } }, { "name": "rel", "description": { "kind": "markdown", "value": "Specifies the relationship of the target object to the link object. The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types)." } }, { "name": "hreflang", "description": { "kind": "markdown", "value": "This attribute indicates the human language of the linked resource. It is purely advisory, with no built-in functionality. Allowed values are determined by [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt \"Tags for Identifying Languages\")." } }, { "name": "type", "description": { "kind": "markdown", "value": "Specifies the media type in the form of a [MIME type](https://developer.mozilla.org/en-US/docs/Glossary/MIME_type \"MIME type: A MIME type (now properly called \"media type\", but also sometimes \"content type\") is a string sent along with a file indicating the type of the file (describing the content format, for example, a sound file might be labeled audio/ogg, or an image file image/png).\") for the linked URL. It is purely advisory, with no built-in functionality." } }, { "name": "referrerpolicy", "description": "Indicates which [referrer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer) to send when fetching the URL:\n\n* `'no-referrer'` means the `Referer:` header will not be sent.\n* `'no-referrer-when-downgrade'` means no `Referer:` header will be sent when navigating to an origin without HTTPS. This is the default behavior.\n* `'origin'` means the referrer will be the [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) of the page, not including information after the domain.\n* `'origin-when-cross-origin'` meaning that navigations to other origins will be limited to the scheme, the host and the port, while navigations on the same origin will include the referrer's path.\n* `'strict-origin-when-cross-origin'`\n* `'unsafe-url'` means the referrer will include the origin and path, but not the fragment, password, or username. This is unsafe because it can leak data from secure URLs to insecure ones." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/a" } ] }, { "name": "em", "description": { "kind": "markdown", "value": "The em element represents stress emphasis of its contents." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/em" } ] }, { "name": "strong", "description": { "kind": "markdown", "value": "The strong element represents strong importance, seriousness, or urgency for its contents." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/strong" } ] }, { "name": "small", "description": { "kind": "markdown", "value": "The small element represents side comments such as small print." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/small" } ] }, { "name": "s", "description": { "kind": "markdown", "value": "The s element represents contents that are no longer accurate or no longer relevant." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/s" } ] }, { "name": "cite", "description": { "kind": "markdown", "value": "The cite element represents a reference to a creative work. It must include the title of the work or the name of the author(person, people or organization) or an URL reference, or a reference in abbreviated form as per the conventions used for the addition of citation metadata." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/cite" } ] }, { "name": "q", "description": { "kind": "markdown", "value": "The q element represents some phrasing content quoted from another source." }, "attributes": [ { "name": "cite", "description": { "kind": "markdown", "value": "The value of this attribute is a URL that designates a source document or message for the information quoted. This attribute is intended to point to information explaining the context or the reference for the quote." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/q" } ] }, { "name": "dfn", "description": { "kind": "markdown", "value": "The dfn element represents the defining instance of a term. The paragraph, description list group, or section that is the nearest ancestor of the dfn element must also contain the definition(s) for the term given by the dfn element." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/dfn" } ] }, { "name": "abbr", "description": { "kind": "markdown", "value": "The abbr element represents an abbreviation or acronym, optionally with its expansion. The title attribute may be used to provide an expansion of the abbreviation. The attribute, if specified, must contain an expansion of the abbreviation, and nothing else." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/abbr" } ] }, { "name": "ruby", "description": { "kind": "markdown", "value": "The ruby element allows one or more spans of phrasing content to be marked with ruby annotations. Ruby annotations are short runs of text presented alongside base text, primarily used in East Asian typography as a guide for pronunciation or to include other annotations. In Japanese, this form of typography is also known as furigana. Ruby text can appear on either side, and sometimes both sides, of the base text, and it is possible to control its position using CSS. A more complete introduction to ruby can be found in the Use Cases & Exploratory Approaches for Ruby Markup document as well as in CSS Ruby Module Level 1. [RUBY-UC] [CSSRUBY]" }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/ruby" } ] }, { "name": "rb", "description": { "kind": "markdown", "value": "The rb element marks the base text component of a ruby annotation. When it is the child of a ruby element, it doesn't represent anything itself, but its parent ruby element uses it as part of determining what it represents." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/rb" } ] }, { "name": "rt", "description": { "kind": "markdown", "value": "The rt element marks the ruby text component of a ruby annotation. When it is the child of a ruby element or of an rtc element that is itself the child of a ruby element, it doesn't represent anything itself, but its ancestor ruby element uses it as part of determining what it represents." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/rt" } ] }, { "name": "rp", "description": { "kind": "markdown", "value": "The rp element is used to provide fallback text to be shown by user agents that don't support ruby annotations. One widespread convention is to provide parentheses around the ruby text component of a ruby annotation." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/rp" } ] }, { "name": "time", "description": { "kind": "markdown", "value": "The time element represents its contents, along with a machine-readable form of those contents in the datetime attribute. The kind of content is limited to various kinds of dates, times, time-zone offsets, and durations, as described below." }, "attributes": [ { "name": "datetime", "description": { "kind": "markdown", "value": "This attribute indicates the time and/or date of the element and must be in one of the formats described below." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/time" } ] }, { "name": "code", "description": { "kind": "markdown", "value": "The code element represents a fragment of computer code. This could be an XML element name, a file name, a computer program, or any other string that a computer would recognize." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/code" } ] }, { "name": "var", "description": { "kind": "markdown", "value": "The var element represents a variable. This could be an actual variable in a mathematical expression or programming context, an identifier representing a constant, a symbol identifying a physical quantity, a function parameter, or just be a term used as a placeholder in prose." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/var" } ] }, { "name": "samp", "description": { "kind": "markdown", "value": "The samp element represents sample or quoted output from another program or computing system." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/samp" } ] }, { "name": "kbd", "description": { "kind": "markdown", "value": "The kbd element represents user input (typically keyboard input, although it may also be used to represent other input, such as voice commands)." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/kbd" } ] }, { "name": "sub", "description": { "kind": "markdown", "value": "The sub element represents a subscript." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/sub" } ] }, { "name": "sup", "description": { "kind": "markdown", "value": "The sup element represents a superscript." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/sup" } ] }, { "name": "i", "description": { "kind": "markdown", "value": "The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/i" } ] }, { "name": "b", "description": { "kind": "markdown", "value": "The b element represents a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/b" } ] }, { "name": "u", "description": { "kind": "markdown", "value": "The u element represents a span of text with an unarticulated, though explicitly rendered, non-textual annotation, such as labeling the text as being a proper name in Chinese text (a Chinese proper name mark), or labeling the text as being misspelt." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/u" } ] }, { "name": "mark", "description": { "kind": "markdown", "value": "The mark element represents a run of text in one document marked or highlighted for reference purposes, due to its relevance in another context. When used in a quotation or other block of text referred to from the prose, it indicates a highlight that was not originally present but which has been added to bring the reader's attention to a part of the text that might not have been considered important by the original author when the block was originally written, but which is now under previously unexpected scrutiny. When used in the main prose of a document, it indicates a part of the document that has been highlighted due to its likely relevance to the user's current activity." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/mark" } ] }, { "name": "bdi", "description": { "kind": "markdown", "value": "The bdi element represents a span of text that is to be isolated from its surroundings for the purposes of bidirectional text formatting. [BIDI]" }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/bdi" } ] }, { "name": "bdo", "description": { "kind": "markdown", "value": "The bdo element represents explicit text directionality formatting control for its children. It allows authors to override the Unicode bidirectional algorithm by explicitly specifying a direction override. [BIDI]" }, "attributes": [ { "name": "dir", "description": "The direction in which text should be rendered in this element's contents. Possible values are:\n\n* `ltr`: Indicates that the text should go in a left-to-right direction.\n* `rtl`: Indicates that the text should go in a right-to-left direction." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/bdo" } ] }, { "name": "span", "description": { "kind": "markdown", "value": "The span element doesn't mean anything on its own, but can be useful when used together with the global attributes, e.g. class, lang, or dir. It represents its children." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/span" } ] }, { "name": "br", "description": { "kind": "markdown", "value": "The br element represents a line break." }, "attributes": [ { "name": "clear", "description": "Indicates where to begin the next line after the break." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/br" } ] }, { "name": "wbr", "description": { "kind": "markdown", "value": "The wbr element represents a line break opportunity." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/wbr" } ] }, { "name": "ins", "description": { "kind": "markdown", "value": "The ins element represents an addition to the document." }, "attributes": [ { "name": "cite", "description": "This attribute defines the URI of a resource that explains the change, such as a link to meeting minutes or a ticket in a troubleshooting system." }, { "name": "datetime", "description": "This attribute indicates the time and date of the change and must be a valid date with an optional time string. If the value cannot be parsed as a date with an optional time string, the element does not have an associated time stamp. For the format of the string without a time, see [Format of a valid date string](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#Format_of_a_valid_date_string \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\") in [Date and time formats used in HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\"). The format of the string if it includes both date and time is covered in [Format of a valid local date and time string](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#Format_of_a_valid_local_date_and_time_string \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\") in [Date and time formats used in HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\")." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/ins" } ] }, { "name": "del", "description": { "kind": "markdown", "value": "The del element represents a removal from the document." }, "attributes": [ { "name": "cite", "description": { "kind": "markdown", "value": "A URI for a resource that explains the change (for example, meeting minutes)." } }, { "name": "datetime", "description": { "kind": "markdown", "value": "This attribute indicates the time and date of the change and must be a valid date string with an optional time. If the value cannot be parsed as a date with an optional time string, the element does not have an associated time stamp. For the format of the string without a time, see [Format of a valid date string](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#Format_of_a_valid_date_string \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\") in [Date and time formats used in HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\"). The format of the string if it includes both date and time is covered in [Format of a valid local date and time string](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats#Format_of_a_valid_local_date_and_time_string \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\") in [Date and time formats used in HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Date_and_time_formats \"Certain HTML elements use date and/or time values. The formats of the strings that specify these are described in this article.\")." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/del" } ] }, { "name": "picture", "description": { "kind": "markdown", "value": "The picture element is a container which provides multiple sources to its contained img element to allow authors to declaratively control or give hints to the user agent about which image resource to use, based on the screen pixel density, viewport size, image format, and other factors. It represents its children." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/picture" } ] }, { "name": "img", "description": { "kind": "markdown", "value": "An img element represents an image." }, "attributes": [ { "name": "alt", "description": { "kind": "markdown", "value": "This attribute defines an alternative text description of the image.\n\n**Note:** Browsers do not always display the image referenced by the element. This is the case for non-graphical browsers (including those used by people with visual impairments), if the user chooses not to display images, or if the browser cannot display the image because it is invalid or an [unsupported type](#Supported_image_formats). In these cases, the browser may replace the image with the text defined in this element's `alt` attribute. You should, for these reasons and others, provide a useful value for `alt` whenever possible.\n\n**Note:** Omitting this attribute altogether indicates that the image is a key part of the content, and no textual equivalent is available. Setting this attribute to an empty string (`alt=\"\"`) indicates that this image is _not_ a key part of the content (decorative), and that non-visual browsers may omit it from rendering." } }, { "name": "src", "description": { "kind": "markdown", "value": "The image URL. This attribute is mandatory for the `<img>` element. On browsers supporting `srcset`, `src` is treated like a candidate image with a pixel density descriptor `1x` unless an image with this pixel density descriptor is already defined in `srcset,` or unless `srcset` contains '`w`' descriptors." } }, { "name": "srcset", "description": { "kind": "markdown", "value": "A list of one or more strings separated by commas indicating a set of possible image sources for the user agent to use. Each string is composed of:\n\n1. a URL to an image,\n2. optionally, whitespace followed by one of:\n * A width descriptor, or a positive integer directly followed by '`w`'. The width descriptor is divided by the source size given in the `sizes` attribute to calculate the effective pixel density.\n * A pixel density descriptor, which is a positive floating point number directly followed by '`x`'.\n\nIf no descriptor is specified, the source is assigned the default descriptor: `1x`.\n\nIt is incorrect to mix width descriptors and pixel density descriptors in the same `srcset` attribute. Duplicate descriptors (for instance, two sources in the same `srcset` which are both described with '`2x`') are also invalid.\n\nThe user agent selects any one of the available sources at its discretion. This provides them with significant leeway to tailor their selection based on things like user preferences or bandwidth conditions. See our [Responsive images](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images) tutorial for an example." } }, { "name": "crossorigin", "valueSet": "xo", "description": { "kind": "markdown", "value": "This enumerated attribute indicates if the fetching of the related image must be done using CORS or not. [CORS-enabled images](https://developer.mozilla.org/en-US/docs/CORS_Enabled_Image) can be reused in the [`<canvas>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas \"Use the HTML <canvas> element with either the canvas scripting API or the WebGL API to draw graphics and animations.\") element without being \"[tainted](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image#What_is_a_tainted_canvas).\" The allowed values are:" } }, { "name": "usemap", "description": { "kind": "markdown", "value": "The partial URL (starting with '#') of an [image map](https://developer.mozilla.org/en-US/docs/HTML/Element/map) associated with the element.\n\n**Note:** You cannot use this attribute if the `<img>` element is a descendant of an [`<a>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a \"The HTML <a> element (or anchor element) creates a hyperlink to other web pages, files, locations within the same page, email addresses, or any other URL.\") or [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") element." } }, { "name": "ismap", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the image is part of a server-side map. If so, the precise coordinates of a click are sent to the server.\n\n**Note:** This attribute is allowed only if the `<img>` element is a descendant of an [`<a>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a \"The HTML <a> element (or anchor element) creates a hyperlink to other web pages, files, locations within the same page, email addresses, or any other URL.\") element with a valid [`href`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href) attribute." } }, { "name": "width", "description": { "kind": "markdown", "value": "The intrinsic width of the image in pixels." } }, { "name": "height", "description": { "kind": "markdown", "value": "The intrinsic height of the image in pixels." } }, { "name": "decoding", "description": "Provides an image decoding hint to the browser. The allowed values are:" }, { "name": "decoding", "description": "`sync`\n\nDecode the image synchronously for atomic presentation with other content.\n\n`async`\n\nDecode the image asynchronously to reduce delay in presenting other content.\n\n`auto`\n\nDefault mode, which indicates no preference for the decoding mode. The browser decides what is best for the user." }, { "name": "importance", "description": "Indicates the relative importance of the resource. Priority hints are delegated using the values:" }, { "name": "importance", "description": "`auto`: Indicates **no preference**. The browser may use its own heuristics to decide the priority of the image.\n\n`high`: Indicates to the browser that the image is of **high** priority.\n\n`low`: Indicates to the browser that the image is of **low** priority." }, { "name": "intrinsicsize", "description": "This attribute tells the browser to ignore the actual intrinsic size of the image and pretend it’s the size specified in the attribute. Specifically, the image would raster at these dimensions and `naturalWidth`/`naturalHeight` on images would return the values specified in this attribute. [Explainer](https://github.com/ojanvafai/intrinsicsize-attribute), [examples](https://googlechrome.github.io/samples/intrinsic-size/index.html)" }, { "name": "referrerpolicy", "description": "A string indicating which referrer to use when fetching the resource:\n\n* `no-referrer:` The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent.\n* `no-referrer-when-downgrade:` No `Referer` header will be sent when navigating to an origin without TLS (HTTPS). This is a user agent’s default behavior if no policy is otherwise specified.\n* `origin:` The `Referer` header will include the page of origin's scheme, the host, and the port.\n* `origin-when-cross-origin:` Navigating to other origins will limit the included referral data to the scheme, the host and the port, while navigating from the same origin will include the referrer's full path.\n* `unsafe-url:` The `Referer` header will include the origin and the path, but not the fragment, password, or username. This case is unsafe because it can leak origins and paths from TLS-protected resources to insecure origins." }, { "name": "sizes", "description": "A list of one or more strings separated by commas indicating a set of source sizes. Each source size consists of:\n\n1. a media condition. This must be omitted for the last item.\n2. a source size value.\n\nSource size values specify the intended display size of the image. User agents use the current source size to select one of the sources supplied by the `srcset` attribute, when those sources are described using width ('`w`') descriptors. The selected source size affects the intrinsic size of the image (the image’s display size if no CSS styling is applied). If the `srcset` attribute is absent, or contains no values with a width (`w`) descriptor, then the `sizes` attribute has no effect." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/img" } ] }, { "name": "iframe", "description": { "kind": "markdown", "value": "The iframe element represents a nested browsing context." }, "attributes": [ { "name": "src", "description": { "kind": "markdown", "value": "The URL of the page to embed. Use a value of `about:blank` to embed an empty page that conforms to the [same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#Inherited_origins). Also note that programatically removing an `<iframe>`'s src attribute (e.g. via [`Element.removeAttribute()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute \"The Element method removeAttribute() removes the attribute with the specified name from the element.\")) causes `about:blank` to be loaded in the frame in Firefox (from version 65), Chromium-based browsers, and Safari/iOS." } }, { "name": "srcdoc", "description": { "kind": "markdown", "value": "Inline HTML to embed, overriding the `src` attribute. If a browser does not support the `srcdoc` attribute, it will fall back to the URL in the `src` attribute." } }, { "name": "name", "description": { "kind": "markdown", "value": "A targetable name for the embedded browsing context. This can be used in the `target` attribute of the [`<a>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a \"The HTML <a> element (or anchor element) creates a hyperlink to other web pages, files, locations within the same page, email addresses, or any other URL.\"), [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\"), or [`<base>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base \"The HTML <base> element specifies the base URL to use for all relative URLs contained within a document. There can be only one <base> element in a document.\") elements; the `formtarget` attribute of the [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") or [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") elements; or the `windowName` parameter in the [`window.open()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/open \"The Window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. If the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.\") method." } }, { "name": "sandbox", "valueSet": "sb", "description": { "kind": "markdown", "value": "Applies extra restrictions to the content in the frame. The value of the attribute can either be empty to apply all restrictions, or space-separated tokens to lift particular restrictions:\n\n* `allow-forms`: Allows the resource to submit forms. If this keyword is not used, form submission is blocked.\n* `allow-modals`: Lets the resource [open modal windows](https://html.spec.whatwg.org/multipage/origin.html#sandboxed-modals-flag).\n* `allow-orientation-lock`: Lets the resource [lock the screen orientation](https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation).\n* `allow-pointer-lock`: Lets the resource use the [Pointer Lock API](https://developer.mozilla.org/en-US/docs/WebAPI/Pointer_Lock).\n* `allow-popups`: Allows popups (such as `window.open()`, `target=\"_blank\"`, or `showModalDialog()`). If this keyword is not used, the popup will silently fail to open.\n* `allow-popups-to-escape-sandbox`: Lets the sandboxed document open new windows without those windows inheriting the sandboxing. For example, this can safely sandbox an advertisement without forcing the same restrictions upon the page the ad links to.\n* `allow-presentation`: Lets the resource start a [presentation session](https://developer.mozilla.org/en-US/docs/Web/API/PresentationRequest).\n* `allow-same-origin`: If this token is not used, the resource is treated as being from a special origin that always fails the [same-origin policy](https://developer.mozilla.org/en-US/docs/Glossary/same-origin_policy \"same-origin policy: The same-origin policy is a critical security mechanism that restricts how a document or script loaded from one origin can interact with a resource from another origin.\").\n* `allow-scripts`: Lets the resource run scripts (but not create popup windows).\n* `allow-storage-access-by-user-activation` : Lets the resource request access to the parent's storage capabilities with the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).\n* `allow-top-navigation`: Lets the resource navigate the top-level browsing context (the one named `_top`).\n* `allow-top-navigation-by-user-activation`: Lets the resource navigate the top-level browsing context, but only if initiated by a user gesture.\n\n**Notes about sandboxing:**\n\n* When the embedded document has the same origin as the embedding page, it is **strongly discouraged** to use both `allow-scripts` and `allow-same-origin`, as that lets the embedded document remove the `sandbox` attribute — making it no more secure than not using the `sandbox` attribute at all.\n* Sandboxing is useless if the attacker can display content outside a sandboxed `iframe` — such as if the viewer opens the frame in a new tab. Such content should be also served from a _separate origin_ to limit potential damage.\n* The `sandbox` attribute is unsupported in Internet Explorer 9 and earlier." } }, { "name": "seamless", "valueSet": "v" }, { "name": "allowfullscreen", "valueSet": "v", "description": { "kind": "markdown", "value": "Set to `true` if the `<iframe>` can activate fullscreen mode by calling the [`requestFullscreen()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen \"The Element.requestFullscreen() method issues an asynchronous request to make the element be displayed in full-screen mode.\") method." } }, { "name": "width", "description": { "kind": "markdown", "value": "The width of the frame in CSS pixels. Default is `300`." } }, { "name": "height", "description": { "kind": "markdown", "value": "The height of the frame in CSS pixels. Default is `150`." } }, { "name": "allow", "description": "Specifies a [feature policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Feature_Policy) for the `<iframe>`." }, { "name": "allowpaymentrequest", "description": "Set to `true` if a cross-origin `<iframe>` should be allowed to invoke the [Payment Request API](https://developer.mozilla.org/en-US/docs/Web/API/Payment_Request_API)." }, { "name": "allowpaymentrequest", "description": "This attribute is considered a legacy attribute and redefined as `allow=\"payment\"`." }, { "name": "csp", "description": "A [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) enforced for the embedded resource. See [`HTMLIFrameElement.csp`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/csp \"The csp property of the HTMLIFrameElement interface specifies the Content Security Policy that an embedded document must agree to enforce upon itself.\") for details." }, { "name": "importance", "description": "The download priority of the resource in the `<iframe>`'s `src` attribute. Allowed values:\n\n`auto` (default)\n\nNo preference. The browser uses its own heuristics to decide the priority of the resource.\n\n`high`\n\nThe resource should be downloaded before other lower-priority page resources.\n\n`low`\n\nThe resource should be downloaded after other higher-priority page resources." }, { "name": "referrerpolicy", "description": "Indicates which [referrer](https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer) to send when fetching the frame's resource:\n\n* `no-referrer`: The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent.\n* `no-referrer-when-downgrade` (default): The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent to [origin](https://developer.mozilla.org/en-US/docs/Glossary/origin \"origin: Web content's origin is defined by the scheme (protocol), host (domain), and port of the URL used to access it. Two objects have the same origin only when the scheme, host, and port all match.\")s without [TLS](https://developer.mozilla.org/en-US/docs/Glossary/TLS \"TLS: Transport Layer Security (TLS), previously known as Secure Sockets Layer (SSL), is a protocol used by applications to communicate securely across a network, preventing tampering with and eavesdropping on email, web browsing, messaging, and other protocols.\") ([HTTPS](https://developer.mozilla.org/en-US/docs/Glossary/HTTPS \"HTTPS: HTTPS (HTTP Secure) is an encrypted version of the HTTP protocol. It usually uses SSL or TLS to encrypt all communication between a client and a server. This secure connection allows clients to safely exchange sensitive data with a server, for example for banking activities or online shopping.\")).\n* `origin`: The sent referrer will be limited to the origin of the referring page: its [scheme](https://developer.mozilla.org/en-US/docs/Archive/Mozilla/URIScheme), [host](https://developer.mozilla.org/en-US/docs/Glossary/host \"host: A host is a device connected to the Internet (or a local network). Some hosts called servers offer additional services like serving webpages or storing files and emails.\"), and [port](https://developer.mozilla.org/en-US/docs/Glossary/port \"port: For a computer connected to a network with an IP address, a port is a communication endpoint. Ports are designated by numbers, and below 1024 each port is associated by default with a specific protocol.\").\n* `origin-when-cross-origin`: The referrer sent to other origins will be limited to the scheme, the host, and the port. Navigations on the same origin will still include the path.\n* `same-origin`: A referrer will be sent for [same origin](https://developer.mozilla.org/en-US/docs/Glossary/Same-origin_policy \"same origin: The same-origin policy is a critical security mechanism that restricts how a document or script loaded from one origin can interact with a resource from another origin.\"), but cross-origin requests will contain no referrer information.\n* `strict-origin`: Only send the origin of the document as the referrer when the protocol security level stays the same (HTTPS→HTTPS), but don't send it to a less secure destination (HTTPS→HTTP).\n* `strict-origin-when-cross-origin`: Send a full URL when performing a same-origin request, only send the origin when the protocol security level stays the same (HTTPS→HTTPS), and send no header to a less secure destination (HTTPS→HTTP).\n* `unsafe-url`: The referrer will include the origin _and_ the path (but not the [fragment](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/hash), [password](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/password), or [username](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/username)). **This value is unsafe**, because it leaks origins and paths from TLS-protected resources to insecure origins." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/iframe" } ] }, { "name": "embed", "description": { "kind": "markdown", "value": "The embed element provides an integration point for an external (typically non-HTML) application or interactive content." }, "attributes": [ { "name": "src", "description": { "kind": "markdown", "value": "The URL of the resource being embedded." } }, { "name": "type", "description": { "kind": "markdown", "value": "The MIME type to use to select the plug-in to instantiate." } }, { "name": "width", "description": { "kind": "markdown", "value": "The displayed width of the resource, in [CSS pixels](https://drafts.csswg.org/css-values/#px). This must be an absolute value; percentages are _not_ allowed." } }, { "name": "height", "description": { "kind": "markdown", "value": "The displayed height of the resource, in [CSS pixels](https://drafts.csswg.org/css-values/#px). This must be an absolute value; percentages are _not_ allowed." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/embed" } ] }, { "name": "object", "description": { "kind": "markdown", "value": "The object element can represent an external resource, which, depending on the type of the resource, will either be treated as an image, as a nested browsing context, or as an external resource to be processed by a plugin." }, "attributes": [ { "name": "data", "description": { "kind": "markdown", "value": "The address of the resource as a valid URL. At least one of **data** and **type** must be defined." } }, { "name": "type", "description": { "kind": "markdown", "value": "The [content type](https://developer.mozilla.org/en-US/docs/Glossary/Content_type) of the resource specified by **data**. At least one of **data** and **type** must be defined." } }, { "name": "typemustmatch", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates if the **type** attribute and the actual [content type](https://developer.mozilla.org/en-US/docs/Glossary/Content_type) of the resource must match to be used." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name of valid browsing context (HTML5), or the name of the control (HTML 4)." } }, { "name": "usemap", "description": { "kind": "markdown", "value": "A hash-name reference to a [`<map>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map \"The HTML <map> element is used with <area> elements to define an image map (a clickable link area).\") element; that is a '#' followed by the value of a [`name`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map#attr-name) of a map element." } }, { "name": "form", "description": { "kind": "markdown", "value": "The form element, if any, that the object element is associated with (its _form owner_). The value of the attribute must be an ID of a [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element in the same document." } }, { "name": "width", "description": { "kind": "markdown", "value": "The width of the display resource, in [CSS pixels](https://drafts.csswg.org/css-values/#px). -- (Absolute values only. [NO percentages](https://html.spec.whatwg.org/multipage/embedded-content.html#dimension-attributes))" } }, { "name": "height", "description": { "kind": "markdown", "value": "The height of the displayed resource, in [CSS pixels](https://drafts.csswg.org/css-values/#px). -- (Absolute values only. [NO percentages](https://html.spec.whatwg.org/multipage/embedded-content.html#dimension-attributes))" } }, { "name": "archive", "description": "A space-separated list of URIs for archives of resources for the object." }, { "name": "border", "description": "The width of a border around the control, in pixels." }, { "name": "classid", "description": "The URI of the object's implementation. It can be used together with, or in place of, the **data** attribute." }, { "name": "codebase", "description": "The base path used to resolve relative URIs specified by **classid**, **data**, or **archive**. If not specified, the default is the base URI of the current document." }, { "name": "codetype", "description": "The content type of the data specified by **classid**." }, { "name": "declare", "description": "The presence of this Boolean attribute makes this element a declaration only. The object must be instantiated by a subsequent `<object>` element. In HTML5, repeat the <object> element completely each that that the resource is reused." }, { "name": "standby", "description": "A message that the browser can show while loading the object's implementation and data." }, { "name": "tabindex", "description": "The position of the element in the tabbing navigation order for the current document." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/object" } ] }, { "name": "param", "description": { "kind": "markdown", "value": "The param element defines parameters for plugins invoked by object elements. It does not represent anything on its own." }, "attributes": [ { "name": "name", "description": { "kind": "markdown", "value": "Name of the parameter." } }, { "name": "value", "description": { "kind": "markdown", "value": "Specifies the value of the parameter." } }, { "name": "type", "description": "Only used if the `valuetype` is set to \"ref\". Specifies the MIME type of values found at the URI specified by value." }, { "name": "valuetype", "description": "Specifies the type of the `value` attribute. Possible values are:\n\n* data: Default value. The value is passed to the object's implementation as a string.\n* ref: The value is a URI to a resource where run-time values are stored.\n* object: An ID of another [`<object>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object \"The HTML <object> element represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.\") in the same document." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/param" } ] }, { "name": "video", "description": { "kind": "markdown", "value": "A video element is used for playing videos or movies, and audio files with captions." }, "attributes": [ { "name": "src" }, { "name": "crossorigin", "valueSet": "xo" }, { "name": "poster" }, { "name": "preload", "valueSet": "pl" }, { "name": "autoplay", "valueSet": "v", "description": { "kind": "markdown", "value": "A Boolean attribute; if specified, the video automatically begins to play back as soon as it can do so without stopping to finish loading the data." } }, { "name": "mediagroup" }, { "name": "loop", "valueSet": "v" }, { "name": "muted", "valueSet": "v" }, { "name": "controls", "valueSet": "v" }, { "name": "width" }, { "name": "height" } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/video" } ] }, { "name": "audio", "description": { "kind": "markdown", "value": "An audio element represents a sound or audio stream." }, "attributes": [ { "name": "src", "description": { "kind": "markdown", "value": "The URL of the audio to embed. This is subject to [HTTP access controls](https://developer.mozilla.org/en-US/docs/HTTP_access_control). This is optional; you may instead use the [`<source>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source \"The HTML <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element.\") element within the audio block to specify the audio to embed." } }, { "name": "crossorigin", "valueSet": "xo", "description": { "kind": "markdown", "value": "This enumerated attribute indicates whether to use CORS to fetch the related image. [CORS-enabled resources](https://developer.mozilla.org/en-US/docs/CORS_Enabled_Image) can be reused in the [`<canvas>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas \"Use the HTML <canvas> element with either the canvas scripting API or the WebGL API to draw graphics and animations.\") element without being _tainted_. The allowed values are:\n\nanonymous\n\nSends a cross-origin request without a credential. In other words, it sends the `Origin:` HTTP header without a cookie, X.509 certificate, or performing HTTP Basic authentication. If the server does not give credentials to the origin site (by not setting the `Access-Control-Allow-Origin:` HTTP header), the image will be _tainted_, and its usage restricted.\n\nuse-credentials\n\nSends a cross-origin request with a credential. In other words, it sends the `Origin:` HTTP header with a cookie, a certificate, or performing HTTP Basic authentication. If the server does not give credentials to the origin site (through `Access-Control-Allow-Credentials:` HTTP header), the image will be _tainted_ and its usage restricted.\n\nWhen not present, the resource is fetched without a CORS request (i.e. without sending the `Origin:` HTTP header), preventing its non-tainted used in [`<canvas>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas \"Use the HTML <canvas> element with either the canvas scripting API or the WebGL API to draw graphics and animations.\") elements. If invalid, it is handled as if the enumerated keyword **anonymous** was used. See [CORS settings attributes](https://developer.mozilla.org/en-US/docs/HTML/CORS_settings_attributes) for additional information." } }, { "name": "preload", "valueSet": "pl", "description": { "kind": "markdown", "value": "This enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience. It may have one of the following values:\n\n* `none`: Indicates that the audio should not be preloaded.\n* `metadata`: Indicates that only audio metadata (e.g. length) is fetched.\n* `auto`: Indicates that the whole audio file can be downloaded, even if the user is not expected to use it.\n* _empty string_: A synonym of the `auto` value.\n\nIf not set, `preload`'s default value is browser-defined (i.e. each browser may have its own default value). The spec advises it to be set to `metadata`.\n\n**Usage notes:**\n\n* The `autoplay` attribute has precedence over `preload`. If `autoplay` is specified, the browser would obviously need to start downloading the audio for playback.\n* The browser is not forced by the specification to follow the value of this attribute; it is a mere hint." } }, { "name": "autoplay", "valueSet": "v", "description": { "kind": "markdown", "value": "A Boolean attribute: if specified, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading.\n\n**Note**: Sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible. If you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). However, this can be useful when creating media elements whose source will be set at a later time, under user control." } }, { "name": "mediagroup" }, { "name": "loop", "valueSet": "v", "description": { "kind": "markdown", "value": "A Boolean attribute: if specified, the audio player will automatically seek back to the start upon reaching the end of the audio." } }, { "name": "muted", "valueSet": "v", "description": { "kind": "markdown", "value": "A Boolean attribute that indicates whether the audio will be initially silenced. Its default value is `false`." } }, { "name": "controls", "valueSet": "v", "description": { "kind": "markdown", "value": "If this attribute is present, the browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/audio" } ] }, { "name": "source", "description": { "kind": "markdown", "value": "The source element allows authors to specify multiple alternative media resources for media elements. It does not represent anything on its own." }, "attributes": [ { "name": "src", "description": { "kind": "markdown", "value": "Required for [`<audio>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio \"The HTML <audio> element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the <source> element: the browser will choose the most suitable one. It can also be the destination for streamed media, using a MediaStream.\") and [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video \"The HTML Video element (<video>) embeds a media player which supports video playback into the document.\"), address of the media resource. The value of this attribute is ignored when the `<source>` element is placed inside a [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture \"The HTML <picture> element contains zero or more <source> elements and one <img> element to provide versions of an image for different display/device scenarios.\") element." } }, { "name": "type", "description": { "kind": "markdown", "value": "The MIME-type of the resource, optionally with a `codecs` parameter. See [RFC 4281](https://tools.ietf.org/html/rfc4281) for information about how to specify codecs." } }, { "name": "sizes", "description": "Is a list of source sizes that describes the final rendered width of the image represented by the source. Each source size consists of a comma-separated list of media condition-length pairs. This information is used by the browser to determine, before laying the page out, which image defined in [`srcset`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source#attr-srcset) to use. \nThe `sizes` attribute has an effect only when the [`<source>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source \"The HTML <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element.\") element is the direct child of a [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture \"The HTML <picture> element contains zero or more <source> elements and one <img> element to provide versions of an image for different display/device scenarios.\") element." }, { "name": "srcset", "description": "A list of one or more strings separated by commas indicating a set of possible images represented by the source for the browser to use. Each string is composed of:\n\n1. one URL to an image,\n2. a width descriptor, that is a positive integer directly followed by `'w'`. The default value, if missing, is the infinity.\n3. a pixel density descriptor, that is a positive floating number directly followed by `'x'`. The default value, if missing, is `1x`.\n\nEach string in the list must have at least a width descriptor or a pixel density descriptor to be valid. Among the list, there must be only one string containing the same tuple of width descriptor and pixel density descriptor. \nThe browser chooses the most adequate image to display at a given point of time. \nThe `srcset` attribute has an effect only when the [`<source>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source \"The HTML <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element.\") element is the direct child of a [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture \"The HTML <picture> element contains zero or more <source> elements and one <img> element to provide versions of an image for different display/device scenarios.\") element." }, { "name": "media", "description": "[Media query](https://developer.mozilla.org/en-US/docs/CSS/Media_queries) of the resource's intended media; this should be used only in a [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture \"The HTML <picture> element contains zero or more <source> elements and one <img> element to provide versions of an image for different display/device scenarios.\") element." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/source" } ] }, { "name": "track", "description": { "kind": "markdown", "value": "The track element allows authors to specify explicit external timed text tracks for media elements. It does not represent anything on its own." }, "attributes": [ { "name": "default", "valueSet": "v", "description": { "kind": "markdown", "value": "This attribute indicates that the track should be enabled unless the user's preferences indicate that another track is more appropriate. This may only be used on one `track` element per media element." } }, { "name": "kind", "valueSet": "tk", "description": { "kind": "markdown", "value": "How the text track is meant to be used. If omitted the default kind is `subtitles`. If the attribute is not present, it will use the `subtitles`. If the attribute contains an invalid value, it will use `metadata`. (Versions of Chrome earlier than 52 treated an invalid value as `subtitles`.) The following keywords are allowed:\n\n* `subtitles`\n * Subtitles provide translation of content that cannot be understood by the viewer. For example dialogue or text that is not English in an English language film.\n * Subtitles may contain additional content, usually extra background information. For example the text at the beginning of the Star Wars films, or the date, time, and location of a scene.\n* `captions`\n * Closed captions provide a transcription and possibly a translation of audio.\n * It may include important non-verbal information such as music cues or sound effects. It may indicate the cue's source (e.g. music, text, character).\n * Suitable for users who are deaf or when the sound is muted.\n* `descriptions`\n * Textual description of the video content.\n * Suitable for users who are blind or where the video cannot be seen.\n* `chapters`\n * Chapter titles are intended to be used when the user is navigating the media resource.\n* `metadata`\n * Tracks used by scripts. Not visible to the user." } }, { "name": "label", "description": { "kind": "markdown", "value": "A user-readable title of the text track which is used by the browser when listing available text tracks." } }, { "name": "src", "description": { "kind": "markdown", "value": "Address of the track (`.vtt` file). Must be a valid URL. This attribute must be specified and its URL value must have the same origin as the document — unless the [`<audio>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio \"The HTML <audio> element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the <source> element: the browser will choose the most suitable one. It can also be the destination for streamed media, using a MediaStream.\") or [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video \"The HTML Video element (<video>) embeds a media player which supports video playback into the document.\") parent element of the `track` element has a [`crossorigin`](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) attribute." } }, { "name": "srclang", "description": { "kind": "markdown", "value": "Language of the track text data. It must be a valid [BCP 47](https://r12a.github.io/app-subtags/) language tag. If the `kind` attribute is set to `subtitles,` then `srclang` must be defined." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/track" } ] }, { "name": "map", "description": { "kind": "markdown", "value": "The map element, in conjunction with an img element and any area element descendants, defines an image map. The element represents its children." }, "attributes": [ { "name": "name", "description": { "kind": "markdown", "value": "The name attribute gives the map a name so that it can be referenced. The attribute must be present and must have a non-empty value with no space characters. The value of the name attribute must not be a compatibility-caseless match for the value of the name attribute of another map element in the same document. If the id attribute is also specified, both attributes must have the same value." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/map" } ] }, { "name": "area", "description": { "kind": "markdown", "value": "The area element represents either a hyperlink with some text and a corresponding area on an image map, or a dead area on an image map." }, "attributes": [ { "name": "alt" }, { "name": "coords" }, { "name": "shape", "valueSet": "sh" }, { "name": "href" }, { "name": "target" }, { "name": "download" }, { "name": "ping" }, { "name": "rel" }, { "name": "hreflang" }, { "name": "type" }, { "name": "accesskey", "description": "Specifies a keyboard navigation accelerator for the element. Pressing ALT or a similar key in association with the specified character selects the form control correlated with that key sequence. Page designers are forewarned to avoid key sequences already bound to browsers. This attribute is global since HTML5." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/area" } ] }, { "name": "table", "description": { "kind": "markdown", "value": "The table element represents data with more than one dimension, in the form of a table." }, "attributes": [ { "name": "border" }, { "name": "align", "description": "This enumerated attribute indicates how the table must be aligned inside the containing document. It may have the following values:\n\n* left: the table is displayed on the left side of the document;\n* center: the table is displayed in the center of the document;\n* right: the table is displayed on the right side of the document.\n\n**Usage Note**\n\n* **Do not use this attribute**, as it has been deprecated. The [`<table>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table \"The HTML <table> element represents tabular data — that is, information presented in a two-dimensional table comprised of rows and columns of cells containing data.\") element should be styled using [CSS](https://developer.mozilla.org/en-US/docs/CSS). Set [`margin-left`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left \"The margin-left CSS property sets the margin area on the left side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") and [`margin-right`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right \"The margin-right CSS property sets the margin area on the right side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.\") to `auto` or [`margin`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin \"The margin CSS property sets the margin area on all four sides of an element. It is a shorthand for margin-top, margin-right, margin-bottom, and margin-left.\") to `0 auto` to achieve an effect that is similar to the align attribute.\n* Prior to Firefox 4, Firefox also supported the `middle`, `absmiddle`, and `abscenter` values as synonyms of `center`, in quirks mode only." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/table" } ] }, { "name": "caption", "description": { "kind": "markdown", "value": "The caption element represents the title of the table that is its parent, if it has a parent and that is a table element." }, "attributes": [ { "name": "align", "description": "This enumerated attribute indicates how the caption must be aligned with respect to the table. It may have one of the following values:\n\n`left`\n\nThe caption is displayed to the left of the table.\n\n`top`\n\nThe caption is displayed above the table.\n\n`right`\n\nThe caption is displayed to the right of the table.\n\n`bottom`\n\nThe caption is displayed below the table.\n\n**Usage note:** Do not use this attribute, as it has been deprecated. The [`<caption>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption \"The HTML Table Caption element (<caption>) specifies the caption (or title) of a table, and if used is always the first child of a <table>.\") element should be styled using the [CSS](https://developer.mozilla.org/en-US/docs/CSS) properties [`caption-side`](https://developer.mozilla.org/en-US/docs/Web/CSS/caption-side \"The caption-side CSS property puts the content of a table's <caption> on the specified side. The values are relative to the writing-mode of the table.\") and [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\")." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/caption" } ] }, { "name": "colgroup", "description": { "kind": "markdown", "value": "The colgroup element represents a group of one or more columns in the table that is its parent, if it has a parent and that is a table element." }, "attributes": [ { "name": "span" }, { "name": "align", "description": "This enumerated attribute specifies how horizontal alignment of each column cell content will be handled. Possible values are:\n\n* `left`, aligning the content to the left of the cell\n* `center`, centering the content in the cell\n* `right`, aligning the content to the right of the cell\n* `justify`, inserting spaces into the textual content so that the content is justified in the cell\n* `char`, aligning the textual content on a special character with a minimal offset, defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-charoff) attributes Unimplemented (see [bug 2212](https://bugzilla.mozilla.org/show_bug.cgi?id=2212 \"character alignment not implemented (align=char, charoff=, text-align:<string>)\")).\n\nIf this attribute is not set, the `left` value is assumed. The descendant [`<col>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col \"The HTML <col> element defines a column within a table and is used for defining common semantics on all common cells. It is generally found within a <colgroup> element.\") elements may override this value using their own [`align`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-align) attribute.\n\n**Note:** Do not use this attribute as it is obsolete (not supported) in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values:\n * Do not try to set the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property on a selector giving a [`<colgroup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup \"The HTML <colgroup> element defines a group of columns within a table.\") element. Because [`<td>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td \"The HTML <td> element defines a cell of a table that contains data. It participates in the table model.\") elements are not descendant of the [`<colgroup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup \"The HTML <colgroup> element defines a group of columns within a table.\") element, they won't inherit it.\n * If the table doesn't use a [`colspan`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-colspan) attribute, use one `td:nth-child(an+b)` CSS selector per column, where a is the total number of the columns in the table and b is the ordinal position of this column in the table. Only after this selector the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property can be used.\n * If the table does use a [`colspan`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-colspan) attribute, the effect can be achieved by combining adequate CSS attribute selectors like `[colspan=n]`, though this is not trivial.\n* To achieve the same effect as the `char` value, in CSS3, you can use the value of the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup#attr-char) as the value of the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property Unimplemented." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/colgroup" } ] }, { "name": "col", "description": { "kind": "markdown", "value": "If a col element has a parent and that is a colgroup element that itself has a parent that is a table element, then the col element represents one or more columns in the column group represented by that colgroup." }, "attributes": [ { "name": "span" }, { "name": "align", "description": "This enumerated attribute specifies how horizontal alignment of each column cell content will be handled. Possible values are:\n\n* `left`, aligning the content to the left of the cell\n* `center`, centering the content in the cell\n* `right`, aligning the content to the right of the cell\n* `justify`, inserting spaces into the textual content so that the content is justified in the cell\n* `char`, aligning the textual content on a special character with a minimal offset, defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-charoff) attributes Unimplemented (see [bug 2212](https://bugzilla.mozilla.org/show_bug.cgi?id=2212 \"character alignment not implemented (align=char, charoff=, text-align:<string>)\")).\n\nIf this attribute is not set, its value is inherited from the [`align`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup#attr-align) of the [`<colgroup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup \"The HTML <colgroup> element defines a group of columns within a table.\") element this `<col>` element belongs too. If there are none, the `left` value is assumed.\n\n**Note:** Do not use this attribute as it is obsolete (not supported) in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values:\n * Do not try to set the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property on a selector giving a [`<col>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col \"The HTML <col> element defines a column within a table and is used for defining common semantics on all common cells. It is generally found within a <colgroup> element.\") element. Because [`<td>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td \"The HTML <td> element defines a cell of a table that contains data. It participates in the table model.\") elements are not descendant of the [`<col>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col \"The HTML <col> element defines a column within a table and is used for defining common semantics on all common cells. It is generally found within a <colgroup> element.\") element, they won't inherit it.\n * If the table doesn't use a [`colspan`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-colspan) attribute, use the `td:nth-child(an+b)` CSS selector. Set `a` to zero and `b` to the position of the column in the table, e.g. `td:nth-child(2) { text-align: right; }` to right-align the second column.\n * If the table does use a [`colspan`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-colspan) attribute, the effect can be achieved by combining adequate CSS attribute selectors like `[colspan=n]`, though this is not trivial.\n* To achieve the same effect as the `char` value, in CSS3, you can use the value of the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col#attr-char) as the value of the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property Unimplemented." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/col" } ] }, { "name": "tbody", "description": { "kind": "markdown", "value": "The tbody element represents a block of rows that consist of a body of data for the parent table element, if the tbody element has a parent and it is a table." }, "attributes": [ { "name": "align", "description": "This enumerated attribute specifies how horizontal alignment of each cell content will be handled. Possible values are:\n\n* `left`, aligning the content to the left of the cell\n* `center`, centering the content in the cell\n* `right`, aligning the content to the right of the cell\n* `justify`, inserting spaces into the textual content so that the content is justified in the cell\n* `char`, aligning the textual content on a special character with a minimal offset, defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody#attr-charoff) attributes.\n\nIf this attribute is not set, the `left` value is assumed.\n\n**Note:** Do not use this attribute as it is obsolete (not supported) in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values, use the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property on it.\n* To achieve the same effect as the `char` value, in CSS3, you can use the value of the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody#attr-char) as the value of the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property Unimplemented." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/tbody" } ] }, { "name": "thead", "description": { "kind": "markdown", "value": "The thead element represents the block of rows that consist of the column labels (headers) for the parent table element, if the thead element has a parent and it is a table." }, "attributes": [ { "name": "align", "description": "This enumerated attribute specifies how horizontal alignment of each cell content will be handled. Possible values are:\n\n* `left`, aligning the content to the left of the cell\n* `center`, centering the content in the cell\n* `right`, aligning the content to the right of the cell\n* `justify`, inserting spaces into the textual content so that the content is justified in the cell\n* `char`, aligning the textual content on a special character with a minimal offset, defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead#attr-charoff) attributes Unimplemented (see [bug 2212](https://bugzilla.mozilla.org/show_bug.cgi?id=2212 \"character alignment not implemented (align=char, charoff=, text-align:<string>)\")).\n\nIf this attribute is not set, the `left` value is assumed.\n\n**Note:** Do not use this attribute as it is obsolete (not supported) in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values, use the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property on it.\n* To achieve the same effect as the `char` value, in CSS3, you can use the value of the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead#attr-char) as the value of the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property Unimplemented." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/thead" } ] }, { "name": "tfoot", "description": { "kind": "markdown", "value": "The tfoot element represents the block of rows that consist of the column summaries (footers) for the parent table element, if the tfoot element has a parent and it is a table." }, "attributes": [ { "name": "align", "description": "This enumerated attribute specifies how horizontal alignment of each cell content will be handled. Possible values are:\n\n* `left`, aligning the content to the left of the cell\n* `center`, centering the content in the cell\n* `right`, aligning the content to the right of the cell\n* `justify`, inserting spaces into the textual content so that the content is justified in the cell\n* `char`, aligning the textual content on a special character with a minimal offset, defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody#attr-charoff) attributes Unimplemented (see [bug 2212](https://bugzilla.mozilla.org/show_bug.cgi?id=2212 \"character alignment not implemented (align=char, charoff=, text-align:<string>)\")).\n\nIf this attribute is not set, the `left` value is assumed.\n\n**Note:** Do not use this attribute as it is obsolete (not supported) in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values, use the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property on it.\n* To achieve the same effect as the `char` value, in CSS3, you can use the value of the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tfoot#attr-char) as the value of the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property Unimplemented." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/tfoot" } ] }, { "name": "tr", "description": { "kind": "markdown", "value": "The tr element represents a row of cells in a table." }, "attributes": [ { "name": "align", "description": "A [`DOMString`](https://developer.mozilla.org/en-US/docs/Web/API/DOMString \"DOMString is a UTF-16 String. As JavaScript already uses such strings, DOMString is mapped directly to a String.\") which specifies how the cell's context should be aligned horizontally within the cells in the row; this is shorthand for using `align` on every cell in the row individually. Possible values are:\n\n`left`\n\nAlign the content of each cell at its left edge.\n\n`center`\n\nCenter the contents of each cell between their left and right edges.\n\n`right`\n\nAlign the content of each cell at its right edge.\n\n`justify`\n\nWiden whitespaces within the text of each cell so that the text fills the full width of each cell (full justification).\n\n`char`\n\nAlign each cell in the row on a specific character (such that each row in the column that is configured this way will horizontally align its cells on that character). This uses the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr#attr-charoff) to establish the alignment character (typically \".\" or \",\" when aligning numerical data) and the number of characters that should follow the alignment character. This alignment type was never widely supported.\n\nIf no value is expressly set for `align`, the parent node's value is inherited.\n\nInstead of using the obsolete `align` attribute, you should instead use the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property to establish `left`, `center`, `right`, or `justify` alignment for the row's cells. To apply character-based alignment, set the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property to the alignment character (such as `\".\"` or `\",\"`)." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/tr" } ] }, { "name": "td", "description": { "kind": "markdown", "value": "The td element represents a data cell in a table." }, "attributes": [ { "name": "colspan" }, { "name": "rowspan" }, { "name": "headers" }, { "name": "abbr", "description": "This attribute contains a short abbreviated description of the cell's content. Some user-agents, such as speech readers, may present this description before the content itself.\n\n**Note:** Do not use this attribute as it is obsolete in the latest standard. Alternatively, you can put the abbreviated description inside the cell and place the long content in the **title** attribute." }, { "name": "align", "description": "This enumerated attribute specifies how the cell content's horizontal alignment will be handled. Possible values are:\n\n* `left`: The content is aligned to the left of the cell.\n* `center`: The content is centered in the cell.\n* `right`: The content is aligned to the right of the cell.\n* `justify` (with text only): The content is stretched out inside the cell so that it covers its entire width.\n* `char` (with text only): The content is aligned to a character inside the `<th>` element with minimal offset. This character is defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-charoff) attributes Unimplemented (see [bug 2212](https://bugzilla.mozilla.org/show_bug.cgi?id=2212 \"character alignment not implemented (align=char, charoff=, text-align:<string>)\")).\n\nThe default value when this attribute is not specified is `left`.\n\n**Note:** Do not use this attribute as it is obsolete in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values, apply the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property to the element.\n* To achieve the same effect as the `char` value, give the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property the same value you would use for the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-char). Unimplemented in CSS3." }, { "name": "axis", "description": "This attribute contains a list of space-separated strings. Each string is the `id` of a group of cells that this header applies to.\n\n**Note:** Do not use this attribute as it is obsolete in the latest standard." }, { "name": "bgcolor", "description": "This attribute defines the background color of each cell in a column. It consists of a 6-digit hexadecimal code as defined in [sRGB](https://www.w3.org/Graphics/Color/sRGB) and is prefixed by '#'. This attribute may be used with one of sixteen predefined color strings:\n\n \n\n`black` = \"#000000\"\n\n \n\n`green` = \"#008000\"\n\n \n\n`silver` = \"#C0C0C0\"\n\n \n\n`lime` = \"#00FF00\"\n\n \n\n`gray` = \"#808080\"\n\n \n\n`olive` = \"#808000\"\n\n \n\n`white` = \"#FFFFFF\"\n\n \n\n`yellow` = \"#FFFF00\"\n\n \n\n`maroon` = \"#800000\"\n\n \n\n`navy` = \"#000080\"\n\n \n\n`red` = \"#FF0000\"\n\n \n\n`blue` = \"#0000FF\"\n\n \n\n`purple` = \"#800080\"\n\n \n\n`teal` = \"#008080\"\n\n \n\n`fuchsia` = \"#FF00FF\"\n\n \n\n`aqua` = \"#00FFFF\"\n\n**Note:** Do not use this attribute, as it is non-standard and only implemented in some versions of Microsoft Internet Explorer: The [`<td>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td \"The HTML <td> element defines a cell of a table that contains data. It participates in the table model.\") element should be styled using [CSS](https://developer.mozilla.org/en-US/docs/CSS). To create a similar effect use the [`background-color`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-color \"The background-color CSS property sets the background color of an element.\") property in [CSS](https://developer.mozilla.org/en-US/docs/CSS) instead." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/td" } ] }, { "name": "th", "description": { "kind": "markdown", "value": "The th element represents a header cell in a table." }, "attributes": [ { "name": "colspan" }, { "name": "rowspan" }, { "name": "headers" }, { "name": "scope", "valueSet": "s" }, { "name": "sorted" }, { "name": "abbr", "description": { "kind": "markdown", "value": "This attribute contains a short abbreviated description of the cell's content. Some user-agents, such as speech readers, may present this description before the content itself." } }, { "name": "align", "description": "This enumerated attribute specifies how the cell content's horizontal alignment will be handled. Possible values are:\n\n* `left`: The content is aligned to the left of the cell.\n* `center`: The content is centered in the cell.\n* `right`: The content is aligned to the right of the cell.\n* `justify` (with text only): The content is stretched out inside the cell so that it covers its entire width.\n* `char` (with text only): The content is aligned to a character inside the `<th>` element with minimal offset. This character is defined by the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-char) and [`charoff`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-charoff) attributes.\n\nThe default value when this attribute is not specified is `left`.\n\n**Note:** Do not use this attribute as it is obsolete in the latest standard.\n\n* To achieve the same effect as the `left`, `center`, `right` or `justify` values, apply the CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property to the element.\n* To achieve the same effect as the `char` value, give the [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align \"The text-align CSS property sets the horizontal alignment of an inline or table-cell box. This means it works like vertical-align but in the horizontal direction.\") property the same value you would use for the [`char`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-char). Unimplemented in CSS3." }, { "name": "axis", "description": "This attribute contains a list of space-separated strings. Each string is the `id` of a group of cells that this header applies to.\n\n**Note:** Do not use this attribute as it is obsolete in the latest standard: use the [`scope`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope) attribute instead." }, { "name": "bgcolor", "description": "This attribute defines the background color of each cell in a column. It consists of a 6-digit hexadecimal code as defined in [sRGB](https://www.w3.org/Graphics/Color/sRGB) and is prefixed by '#'. This attribute may be used with one of sixteen predefined color strings:\n\n \n\n`black` = \"#000000\"\n\n \n\n`green` = \"#008000\"\n\n \n\n`silver` = \"#C0C0C0\"\n\n \n\n`lime` = \"#00FF00\"\n\n \n\n`gray` = \"#808080\"\n\n \n\n`olive` = \"#808000\"\n\n \n\n`white` = \"#FFFFFF\"\n\n \n\n`yellow` = \"#FFFF00\"\n\n \n\n`maroon` = \"#800000\"\n\n \n\n`navy` = \"#000080\"\n\n \n\n`red` = \"#FF0000\"\n\n \n\n`blue` = \"#0000FF\"\n\n \n\n`purple` = \"#800080\"\n\n \n\n`teal` = \"#008080\"\n\n \n\n`fuchsia` = \"#FF00FF\"\n\n \n\n`aqua` = \"#00FFFF\"\n\n**Note:** Do not use this attribute, as it is non-standard and only implemented in some versions of Microsoft Internet Explorer: The [`<th>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th \"The HTML <th> element defines a cell as header of a group of table cells. The exact nature of this group is defined by the scope and headers attributes.\") element should be styled using [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS). To create a similar effect use the [`background-color`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-color \"The background-color CSS property sets the background color of an element.\") property in [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) instead." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/th" } ] }, { "name": "form", "description": { "kind": "markdown", "value": "The form element represents a collection of form-associated elements, some of which can represent editable values that can be submitted to a server for processing." }, "attributes": [ { "name": "accept-charset", "description": { "kind": "markdown", "value": "A space- or comma-delimited list of character encodings that the server accepts. The browser uses them in the order in which they are listed. The default value, the reserved string `\"UNKNOWN\"`, indicates the same encoding as that of the document containing the form element. \nIn previous versions of HTML, the different character encodings could be delimited by spaces or commas. In HTML5, only spaces are allowed as delimiters." } }, { "name": "action", "description": { "kind": "markdown", "value": "The URI of a program that processes the form information. This value can be overridden by a [`formaction`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formaction) attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") or [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element." } }, { "name": "autocomplete", "valueSet": "o", "description": { "kind": "markdown", "value": "Indicates whether input elements can by default have their values automatically completed by the browser. This setting can be overridden by an `autocomplete` attribute on an element belonging to the form. Possible values are:\n\n* `off`: The user must explicitly enter a value into each field for every use, or the document provides its own auto-completion method; the browser does not automatically complete entries.\n* `on`: The browser can automatically complete values based on values that the user has previously entered in the form.\n\nFor most modern browsers (including Firefox 38+, Google Chrome 34+, IE 11+) setting the autocomplete attribute will not prevent a browser's password manager from asking the user if they want to store login fields (username and password), if the user permits the storage the browser will autofill the login the next time the user visits the page. See [The autocomplete attribute and login fields](https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields)." } }, { "name": "enctype", "valueSet": "et", "description": { "kind": "markdown", "value": "When the value of the `method` attribute is `post`, enctype is the [MIME type](https://en.wikipedia.org/wiki/Mime_type) of content that is used to submit the form to the server. Possible values are:\n\n* `application/x-www-form-urlencoded`: The default value if the attribute is not specified.\n* `multipart/form-data`: The value used for an [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element with the `type` attribute set to \"file\".\n* `text/plain`: (HTML5)\n\nThis value can be overridden by a [`formenctype`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formenctype) attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") or [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element." } }, { "name": "method", "valueSet": "m", "description": { "kind": "markdown", "value": "The [HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP) method that the browser uses to submit the form. Possible values are:\n\n* `post`: Corresponds to the HTTP [POST method](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5) ; form data are included in the body of the form and sent to the server.\n* `get`: Corresponds to the HTTP [GET method](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3); form data are appended to the `action` attribute URI with a '?' as separator, and the resulting URI is sent to the server. Use this method when the form has no side-effects and contains only ASCII characters.\n* `dialog`: Use when the form is inside a [`<dialog>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog \"The HTML <dialog> element represents a dialog box or other interactive component, such as an inspector or window.\") element to close the dialog when submitted.\n\nThis value can be overridden by a [`formmethod`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formmethod) attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") or [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name of the form. In HTML 4, its use is deprecated (`id` should be used instead). It must be unique among the forms in a document and not just an empty string in HTML 5." } }, { "name": "novalidate", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the form is not to be validated when submitted. If this attribute is not specified (and therefore the form is validated), this default setting can be overridden by a [`formnovalidate`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formnovalidate) attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") or [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element belonging to the form." } }, { "name": "target", "description": { "kind": "markdown", "value": "A name or keyword indicating where to display the response that is received after submitting the form. In HTML 4, this is the name/keyword for a frame. In HTML5, it is a name/keyword for a _browsing context_ (for example, tab, window, or inline frame). The following keywords have special meanings:\n\n* `_self`: Load the response into the same HTML 4 frame (or HTML5 browsing context) as the current one. This value is the default if the attribute is not specified.\n* `_blank`: Load the response into a new unnamed HTML 4 window or HTML5 browsing context.\n* `_parent`: Load the response into the HTML 4 frameset parent of the current frame, or HTML5 parent browsing context of the current one. If there is no parent, this option behaves the same way as `_self`.\n* `_top`: HTML 4: Load the response into the full original window, and cancel all other frames. HTML5: Load the response into the top-level browsing context (i.e., the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as `_self`.\n* _iframename_: The response is displayed in a named [`<iframe>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe \"The HTML Inline Frame element (<iframe>) represents a nested browsing context, embedding another HTML page into the current one.\").\n\nHTML5: This value can be overridden by a [`formtarget`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formtarget) attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") or [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element." } }, { "name": "accept", "description": "A comma-separated list of content types that the server accepts.\n\n**Usage note:** This attribute has been removed in HTML5 and should no longer be used. Instead, use the [`accept`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept) attribute of the specific [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element." }, { "name": "autocapitalize", "description": "This is a nonstandard attribute used by iOS Safari Mobile which controls whether and how the text value for textual form control descendants should be automatically capitalized as it is entered/edited by the user. If the `autocapitalize` attribute is specified on an individual form control descendant, it trumps the form-wide `autocapitalize` setting. The non-deprecated values are available in iOS 5 and later. The default value is `sentences`. Possible values are:\n\n* `none`: Completely disables automatic capitalization\n* `sentences`: Automatically capitalize the first letter of sentences.\n* `words`: Automatically capitalize the first letter of words.\n* `characters`: Automatically capitalize all characters.\n* `on`: Deprecated since iOS 5.\n* `off`: Deprecated since iOS 5." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/form" } ] }, { "name": "label", "description": { "kind": "markdown", "value": "The label element represents a caption in a user interface. The caption can be associated with a specific form control, known as the label element's labeled control, either using the for attribute, or by putting the form control inside the label element itself." }, "attributes": [ { "name": "form", "description": { "kind": "markdown", "value": "The [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element with which the label is associated (its _form owner_). If specified, the value of the attribute is the `id` of a [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element in the same document. This lets you place label elements anywhere within a document, not just as descendants of their form elements." } }, { "name": "for", "description": { "kind": "markdown", "value": "The [`id`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-id) of a [labelable](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Form_labelable) form-related element in the same document as the `<label>` element. The first element in the document with an `id` matching the value of the `for` attribute is the _labeled control_ for this label element, if it is a labelable element. If it is not labelable then the `for` attribute has no effect. If there are other elements which also match the `id` value, later in the document, they are not considered.\n\n**Note**: A `<label>` element can have both a `for` attribute and a contained control element, as long as the `for` attribute points to the contained control element." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/label" } ] }, { "name": "input", "description": { "kind": "markdown", "value": "The input element represents a typed data field, usually with a form control to allow the user to edit the data." }, "attributes": [ { "name": "accept" }, { "name": "alt" }, { "name": "autocomplete", "valueSet": "inputautocomplete" }, { "name": "autofocus", "valueSet": "v" }, { "name": "checked", "valueSet": "v" }, { "name": "dirname" }, { "name": "disabled", "valueSet": "v" }, { "name": "form" }, { "name": "formaction" }, { "name": "formenctype", "valueSet": "et" }, { "name": "formmethod", "valueSet": "fm" }, { "name": "formnovalidate", "valueSet": "v" }, { "name": "formtarget" }, { "name": "height" }, { "name": "inputmode", "valueSet": "im" }, { "name": "list" }, { "name": "max" }, { "name": "maxlength" }, { "name": "min" }, { "name": "minlength" }, { "name": "multiple", "valueSet": "v" }, { "name": "name" }, { "name": "pattern" }, { "name": "placeholder" }, { "name": "readonly", "valueSet": "v" }, { "name": "required", "valueSet": "v" }, { "name": "size" }, { "name": "src" }, { "name": "step" }, { "name": "type", "valueSet": "t" }, { "name": "value" }, { "name": "width" } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/input" } ] }, { "name": "button", "description": { "kind": "markdown", "value": "The button element represents a button labeled by its contents." }, "attributes": [ { "name": "autofocus", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute lets you specify that the button should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specified." } }, { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the user cannot interact with the button. If this attribute is not specified, the button inherits its setting from the containing element, for example [`<fieldset>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset \"The HTML <fieldset> element is used to group several controls as well as labels (<label>) within a web form.\"); if there is no containing element with the **disabled** attribute set, then the button is enabled.\n\nFirefox will, unlike other browsers, by default, [persist the dynamic disabled state](https://stackoverflow.com/questions/5985839/bug-with-firefox-disabled-attribute-of-input-not-resetting-when-refreshing) of a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") across page loads. Use the [`autocomplete`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-autocomplete) attribute to control this feature." } }, { "name": "form", "description": { "kind": "markdown", "value": "The form element that the button is associated with (its _form owner_). The value of the attribute must be the **id** attribute of a [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element in the same document. If this attribute is not specified, the `<button>` element will be associated to an ancestor [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element, if one exists. This attribute enables you to associate `<button>` elements to [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") elements anywhere within a document, not just as descendants of [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") elements." } }, { "name": "formaction", "description": { "kind": "markdown", "value": "The URI of a program that processes the information submitted by the button. If specified, it overrides the [`action`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-action) attribute of the button's form owner." } }, { "name": "formenctype", "valueSet": "et", "description": { "kind": "markdown", "value": "If the button is a submit button, this attribute specifies the type of content that is used to submit the form to the server. Possible values are:\n\n* `application/x-www-form-urlencoded`: The default value if the attribute is not specified.\n* `multipart/form-data`: Use this value if you are using an [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") element with the [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type) attribute set to `file`.\n* `text/plain`\n\nIf this attribute is specified, it overrides the [`enctype`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-enctype) attribute of the button's form owner." } }, { "name": "formmethod", "valueSet": "fm", "description": { "kind": "markdown", "value": "If the button is a submit button, this attribute specifies the HTTP method that the browser uses to submit the form. Possible values are:\n\n* `post`: The data from the form are included in the body of the form and sent to the server.\n* `get`: The data from the form are appended to the **form** attribute URI, with a '?' as a separator, and the resulting URI is sent to the server. Use this method when the form has no side-effects and contains only ASCII characters.\n\nIf specified, this attribute overrides the [`method`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-method) attribute of the button's form owner." } }, { "name": "formnovalidate", "valueSet": "v", "description": { "kind": "markdown", "value": "If the button is a submit button, this Boolean attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the [`novalidate`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-novalidate) attribute of the button's form owner." } }, { "name": "formtarget", "description": { "kind": "markdown", "value": "If the button is a submit button, this attribute is a name or keyword indicating where to display the response that is received after submitting the form. This is a name of, or keyword for, a _browsing context_ (for example, tab, window, or inline frame). If this attribute is specified, it overrides the [`target`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-target) attribute of the button's form owner. The following keywords have special meanings:\n\n* `_self`: Load the response into the same browsing context as the current one. This value is the default if the attribute is not specified.\n* `_blank`: Load the response into a new unnamed browsing context.\n* `_parent`: Load the response into the parent browsing context of the current one. If there is no parent, this option behaves the same way as `_self`.\n* `_top`: Load the response into the top-level browsing context (that is, the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as `_self`." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name of the button, which is submitted with the form data." } }, { "name": "type", "valueSet": "bt", "description": { "kind": "markdown", "value": "The type of the button. Possible values are:\n\n* `submit`: The button submits the form data to the server. This is the default if the attribute is not specified, or if the attribute is dynamically changed to an empty or invalid value.\n* `reset`: The button resets all the controls to their initial values.\n* `button`: The button has no default behavior. It can have client-side scripts associated with the element's events, which are triggered when the events occur." } }, { "name": "value", "description": { "kind": "markdown", "value": "The initial value of the button. It defines the value associated with the button which is submitted with the form data. This value is passed to the server in params when the form is submitted." } }, { "name": "autocomplete", "description": "The use of this attribute on a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") is nonstandard and Firefox-specific. By default, unlike other browsers, [Firefox persists the dynamic disabled state](https://stackoverflow.com/questions/5985839/bug-with-firefox-disabled-attribute-of-input-not-resetting-when-refreshing) of a [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button \"The HTML <button> element represents a clickable button, which can be used in forms or anywhere in a document that needs simple, standard button functionality.\") across page loads. Setting the value of this attribute to `off` (i.e. `autocomplete=\"off\"`) disables this feature. See [bug 654072](https://bugzilla.mozilla.org/show_bug.cgi?id=654072 \"if disabled state is changed with javascript, the normal state doesn't return after refreshing the page\")." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/button" } ] }, { "name": "select", "description": { "kind": "markdown", "value": "The select element represents a control for selecting amongst a set of options." }, "attributes": [ { "name": "autocomplete", "valueSet": "inputautocomplete", "description": { "kind": "markdown", "value": "A [`DOMString`](https://developer.mozilla.org/en-US/docs/Web/API/DOMString \"DOMString is a UTF-16 String. As JavaScript already uses such strings, DOMString is mapped directly to a String.\") providing a hint for a [user agent's](https://developer.mozilla.org/en-US/docs/Glossary/user_agent \"user agent's: A user agent is a computer program representing a person, for example, a browser in a Web context.\") autocomplete feature. See [The HTML autocomplete attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for a complete list of values and details on how to use autocomplete." } }, { "name": "autofocus", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute lets you specify that a form control should have input focus when the page loads. Only one form element in a document can have the `autofocus` attribute." } }, { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the user cannot interact with the control. If this attribute is not specified, the control inherits its setting from the containing element, for example `fieldset`; if there is no containing element with the `disabled` attribute set, then the control is enabled." } }, { "name": "form", "description": { "kind": "markdown", "value": "This attribute lets you specify the form element to which the select element is associated (that is, its \"form owner\"). If this attribute is specified, its value must be the same as the `id` of a form element in the same document. This enables you to place select elements anywhere within a document, not just as descendants of their form elements." } }, { "name": "multiple", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that multiple options can be selected in the list. If it is not specified, then only one option can be selected at a time. When `multiple` is specified, most browsers will show a scrolling list box instead of a single line dropdown." } }, { "name": "name", "description": { "kind": "markdown", "value": "This attribute is used to specify the name of the control." } }, { "name": "required", "valueSet": "v", "description": { "kind": "markdown", "value": "A Boolean attribute indicating that an option with a non-empty string value must be selected." } }, { "name": "size", "description": { "kind": "markdown", "value": "If the control is presented as a scrolling list box (e.g. when `multiple` is specified), this attribute represents the number of rows in the list that should be visible at one time. Browsers are not required to present a select element as a scrolled list box. The default value is 0.\n\n**Note:** According to the HTML5 specification, the default value for size should be 1; however, in practice, this has been found to break some web sites, and no other browser currently does that, so Mozilla has opted to continue to return 0 for the time being with Firefox." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/select" } ] }, { "name": "datalist", "description": { "kind": "markdown", "value": "The datalist element represents a set of option elements that represent predefined options for other controls. In the rendering, the datalist element represents nothing and it, along with its children, should be hidden." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/datalist" } ] }, { "name": "optgroup", "description": { "kind": "markdown", "value": "The optgroup element represents a group of option elements with a common label." }, "attributes": [ { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "If this Boolean attribute is set, none of the items in this option group is selectable. Often browsers grey out such control and it won't receive any browsing events, like mouse clicks or focus-related ones." } }, { "name": "label", "description": { "kind": "markdown", "value": "The name of the group of options, which the browser can use when labeling the options in the user interface. This attribute is mandatory if this element is used." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/optgroup" } ] }, { "name": "option", "description": { "kind": "markdown", "value": "The option element represents an option in a select element or as part of a list of suggestions in a datalist element." }, "attributes": [ { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "If this Boolean attribute is set, this option is not checkable. Often browsers grey out such control and it won't receive any browsing event, like mouse clicks or focus-related ones. If this attribute is not set, the element can still be disabled if one of its ancestors is a disabled [`<optgroup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup \"The HTML <optgroup> element creates a grouping of options within a <select> element.\") element." } }, { "name": "label", "description": { "kind": "markdown", "value": "This attribute is text for the label indicating the meaning of the option. If the `label` attribute isn't defined, its value is that of the element text content." } }, { "name": "selected", "valueSet": "v", "description": { "kind": "markdown", "value": "If present, this Boolean attribute indicates that the option is initially selected. If the `<option>` element is the descendant of a [`<select>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select \"The HTML <select> element represents a control that provides a menu of options\") element whose [`multiple`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple) attribute is not set, only one single `<option>` of this [`<select>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select \"The HTML <select> element represents a control that provides a menu of options\") element may have the `selected` attribute." } }, { "name": "value", "description": { "kind": "markdown", "value": "The content of this attribute represents the value to be submitted with the form, should this option be selected. If this attribute is omitted, the value is taken from the text content of the option element." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/option" } ] }, { "name": "textarea", "description": { "kind": "markdown", "value": "The textarea element represents a multiline plain text edit control for the element's raw value. The contents of the control represent the control's default value." }, "attributes": [ { "name": "autocomplete", "valueSet": "inputautocomplete", "description": { "kind": "markdown", "value": "This attribute indicates whether the value of the control can be automatically completed by the browser. Possible values are:\n\n* `off`: The user must explicitly enter a value into this field for every use, or the document provides its own auto-completion method; the browser does not automatically complete the entry.\n* `on`: The browser can automatically complete the value based on values that the user has entered during previous uses.\n\nIf the `autocomplete` attribute is not specified on a `<textarea>` element, then the browser uses the `autocomplete` attribute value of the `<textarea>` element's form owner. The form owner is either the [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element that this `<textarea>` element is a descendant of or the form element whose `id` is specified by the `form` attribute of the input element. For more information, see the [`autocomplete`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-autocomplete) attribute in [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\")." } }, { "name": "autofocus", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute lets you specify that a form control should have input focus when the page loads. Only one form-associated element in a document can have this attribute specified." } }, { "name": "cols", "description": { "kind": "markdown", "value": "The visible width of the text control, in average character widths. If it is specified, it must be a positive integer. If it is not specified, the default value is `20`." } }, { "name": "dirname" }, { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the user cannot interact with the control. If this attribute is not specified, the control inherits its setting from the containing element, for example [`<fieldset>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset \"The HTML <fieldset> element is used to group several controls as well as labels (<label>) within a web form.\"); if there is no containing element when the `disabled` attribute is set, the control is enabled." } }, { "name": "form", "description": { "kind": "markdown", "value": "The form element that the `<textarea>` element is associated with (its \"form owner\"). The value of the attribute must be the `id` of a form element in the same document. If this attribute is not specified, the `<textarea>` element must be a descendant of a form element. This attribute enables you to place `<textarea>` elements anywhere within a document, not just as descendants of form elements." } }, { "name": "inputmode", "valueSet": "im" }, { "name": "maxlength", "description": { "kind": "markdown", "value": "The maximum number of characters (unicode code points) that the user can enter. If this value isn't specified, the user can enter an unlimited number of characters." } }, { "name": "minlength", "description": { "kind": "markdown", "value": "The minimum number of characters (unicode code points) required that the user should enter." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name of the control." } }, { "name": "placeholder", "description": { "kind": "markdown", "value": "A hint to the user of what can be entered in the control. Carriage returns or line-feeds within the placeholder text must be treated as line breaks when rendering the hint.\n\n**Note:** Placeholders should only be used to show an example of the type of data that should be entered into a form; they are _not_ a substitute for a proper [`<label>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label \"The HTML <label> element represents a caption for an item in a user interface.\") element tied to the input. See [Labels and placeholders](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Labels_and_placeholders \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") in [<input>: The Input (Form Input) element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") for a full explanation." } }, { "name": "readonly", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates that the user cannot modify the value of the control. Unlike the `disabled` attribute, the `readonly` attribute does not prevent the user from clicking or selecting in the control. The value of a read-only control is still submitted with the form." } }, { "name": "required", "valueSet": "v", "description": { "kind": "markdown", "value": "This attribute specifies that the user must fill in a value before submitting a form." } }, { "name": "rows", "description": { "kind": "markdown", "value": "The number of visible text lines for the control." } }, { "name": "wrap", "valueSet": "w", "description": { "kind": "markdown", "value": "Indicates how the control wraps text. Possible values are:\n\n* `hard`: The browser automatically inserts line breaks (CR+LF) so that each line has no more than the width of the control; the `cols` attribute must also be specified for this to take effect.\n* `soft`: The browser ensures that all line breaks in the value consist of a CR+LF pair, but does not insert any additional line breaks.\n* `off` : Like `soft` but changes appearance to `white-space: pre` so line segments exceeding `cols` are not wrapped and the `<textarea>` becomes horizontally scrollable.\n\nIf this attribute is not specified, `soft` is its default value." } }, { "name": "autocapitalize", "description": "This is a non-standard attribute supported by WebKit on iOS (therefore nearly all browsers running on iOS, including Safari, Firefox, and Chrome), which controls whether and how the text value should be automatically capitalized as it is entered/edited by the user. The non-deprecated values are available in iOS 5 and later. Possible values are:\n\n* `none`: Completely disables automatic capitalization.\n* `sentences`: Automatically capitalize the first letter of sentences.\n* `words`: Automatically capitalize the first letter of words.\n* `characters`: Automatically capitalize all characters.\n* `on`: Deprecated since iOS 5.\n* `off`: Deprecated since iOS 5." }, { "name": "spellcheck", "description": "Specifies whether the `<textarea>` is subject to spell checking by the underlying browser/OS. the value can be:\n\n* `true`: Indicates that the element needs to have its spelling and grammar checked.\n* `default` : Indicates that the element is to act according to a default behavior, possibly based on the parent element's own `spellcheck` value.\n* `false` : Indicates that the element should not be spell checked." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/textarea" } ] }, { "name": "output", "description": { "kind": "markdown", "value": "The output element represents the result of a calculation performed by the application, or the result of a user action." }, "attributes": [ { "name": "for", "description": { "kind": "markdown", "value": "A space-separated list of other elements’ [`id`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id)s, indicating that those elements contributed input values to (or otherwise affected) the calculation." } }, { "name": "form", "description": { "kind": "markdown", "value": "The [form element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) that this element is associated with (its \"form owner\"). The value of the attribute must be an `id` of a form element in the same document. If this attribute is not specified, the output element must be a descendant of a form element. This attribute enables you to place output elements anywhere within a document, not just as descendants of their form elements." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name of the element, exposed in the [`HTMLFormElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement \"The HTMLFormElement interface represents a <form> element in the DOM; it allows access to and in some cases modification of aspects of the form, as well as access to its component elements.\") API." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/output" } ] }, { "name": "progress", "description": { "kind": "markdown", "value": "The progress element represents the completion progress of a task. The progress is either indeterminate, indicating that progress is being made but that it is not clear how much more work remains to be done before the task is complete (e.g. because the task is waiting for a remote host to respond), or the progress is a number in the range zero to a maximum, giving the fraction of work that has so far been completed." }, "attributes": [ { "name": "value", "description": { "kind": "markdown", "value": "This attribute specifies how much of the task that has been completed. It must be a valid floating point number between 0 and `max`, or between 0 and 1 if `max` is omitted. If there is no `value` attribute, the progress bar is indeterminate; this indicates that an activity is ongoing with no indication of how long it is expected to take." } }, { "name": "max", "description": { "kind": "markdown", "value": "This attribute describes how much work the task indicated by the `progress` element requires. The `max` attribute, if present, must have a value greater than zero and be a valid floating point number. The default value is 1." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/progress" } ] }, { "name": "meter", "description": { "kind": "markdown", "value": "The meter element represents a scalar measurement within a known range, or a fractional value; for example disk usage, the relevance of a query result, or the fraction of a voting population to have selected a particular candidate." }, "attributes": [ { "name": "value", "description": { "kind": "markdown", "value": "The current numeric value. This must be between the minimum and maximum values (`min` attribute and `max` attribute) if they are specified. If unspecified or malformed, the value is 0. If specified, but not within the range given by the `min` attribute and `max` attribute, the value is equal to the nearest end of the range.\n\n**Usage note:** Unless the `value` attribute is between `0` and `1` (inclusive), the `min` and `max` attributes should define the range so that the `value` attribute's value is within it." } }, { "name": "min", "description": { "kind": "markdown", "value": "The lower numeric bound of the measured range. This must be less than the maximum value (`max` attribute), if specified. If unspecified, the minimum value is 0." } }, { "name": "max", "description": { "kind": "markdown", "value": "The upper numeric bound of the measured range. This must be greater than the minimum value (`min` attribute), if specified. If unspecified, the maximum value is 1." } }, { "name": "low", "description": { "kind": "markdown", "value": "The upper numeric bound of the low end of the measured range. This must be greater than the minimum value (`min` attribute), and it also must be less than the high value and maximum value (`high` attribute and `max` attribute, respectively), if any are specified. If unspecified, or if less than the minimum value, the `low` value is equal to the minimum value." } }, { "name": "high", "description": { "kind": "markdown", "value": "The lower numeric bound of the high end of the measured range. This must be less than the maximum value (`max` attribute), and it also must be greater than the low value and minimum value (`low` attribute and **min** attribute, respectively), if any are specified. If unspecified, or if greater than the maximum value, the `high` value is equal to the maximum value." } }, { "name": "optimum", "description": { "kind": "markdown", "value": "This attribute indicates the optimal numeric value. It must be within the range (as defined by the `min` attribute and `max` attribute). When used with the `low` attribute and `high` attribute, it gives an indication where along the range is considered preferable. For example, if it is between the `min` attribute and the `low` attribute, then the lower range is considered preferred." } }, { "name": "form", "description": "This attribute associates the element with a `form` element that has ownership of the `meter` element. For example, a `meter` might be displaying a range corresponding to an `input` element of `type` _number_. This attribute is only used if the `meter` element is being used as a form-associated element; even then, it may be omitted if the element appears as a descendant of a `form` element." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/meter" } ] }, { "name": "fieldset", "description": { "kind": "markdown", "value": "The fieldset element represents a set of form controls optionally grouped under a common name." }, "attributes": [ { "name": "disabled", "valueSet": "v", "description": { "kind": "markdown", "value": "If this Boolean attribute is set, all form controls that are descendants of the `<fieldset>`, are disabled, meaning they are not editable and won't be submitted along with the `<form>`. They won't receive any browsing events, like mouse clicks or focus-related events. By default browsers display such controls grayed out. Note that form elements inside the [`<legend>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend \"The HTML <legend> element represents a caption for the content of its parent <fieldset>.\") element won't be disabled." } }, { "name": "form", "description": { "kind": "markdown", "value": "This attribute takes the value of the `id` attribute of a [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form \"The HTML <form> element represents a document section that contains interactive controls for submitting information to a web server.\") element you want the `<fieldset>` to be part of, even if it is not inside the form." } }, { "name": "name", "description": { "kind": "markdown", "value": "The name associated with the group.\n\n**Note**: The caption for the fieldset is given by the first [`<legend>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend \"The HTML <legend> element represents a caption for the content of its parent <fieldset>.\") element nested inside it." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/fieldset" } ] }, { "name": "legend", "description": { "kind": "markdown", "value": "The legend element represents a caption for the rest of the contents of the legend element's parent fieldset element, if any." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/legend" } ] }, { "name": "details", "description": { "kind": "markdown", "value": "The details element represents a disclosure widget from which the user can obtain additional information or controls." }, "attributes": [ { "name": "open", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute indicates whether or not the details — that is, the contents of the `<details>` element — are currently visible. The default, `false`, means the details are not visible." } } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/details" } ] }, { "name": "summary", "description": { "kind": "markdown", "value": "The summary element represents a summary, caption, or legend for the rest of the contents of the summary element's parent details element, if any." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/summary" } ] }, { "name": "dialog", "description": { "kind": "markdown", "value": "The dialog element represents a part of an application that a user interacts with to perform a task, for example a dialog box, inspector, or window." }, "attributes": [ { "name": "open", "description": "Indicates that the dialog is active and available for interaction. When the `open` attribute is not set, the dialog shouldn't be shown to the user." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/dialog" } ] }, { "name": "script", "description": { "kind": "markdown", "value": "The script element allows authors to include dynamic script and data blocks in their documents. The element does not represent content for the user." }, "attributes": [ { "name": "src", "description": { "kind": "markdown", "value": "This attribute specifies the URI of an external script; this can be used as an alternative to embedding a script directly within a document.\n\nIf a `script` element has a `src` attribute specified, it should not have a script embedded inside its tags." } }, { "name": "type", "description": { "kind": "markdown", "value": "This attribute indicates the type of script represented. The value of this attribute will be in one of the following categories:\n\n* **Omitted or a JavaScript MIME type:** For HTML5-compliant browsers this indicates the script is JavaScript. HTML5 specification urges authors to omit the attribute rather than provide a redundant MIME type. In earlier browsers, this identified the scripting language of the embedded or imported (via the `src` attribute) code. JavaScript MIME types are [listed in the specification](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#JavaScript_types).\n* **`module`:** For HTML5-compliant browsers the code is treated as a JavaScript module. The processing of the script contents is not affected by the `charset` and `defer` attributes. For information on using `module`, see [ES6 in Depth: Modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/). Code may behave differently when the `module` keyword is used.\n* **Any other value:** The embedded content is treated as a data block which won't be processed by the browser. Developers must use a valid MIME type that is not a JavaScript MIME type to denote data blocks. The `src` attribute will be ignored.\n\n**Note:** in Firefox you could specify the version of JavaScript contained in a `<script>` element by including a non-standard `version` parameter inside the `type` attribute — for example `type=\"text/javascript;version=1.8\"`. This has been removed in Firefox 59 (see [bug 1428745](https://bugzilla.mozilla.org/show_bug.cgi?id=1428745 \"FIXED: Remove support for version parameter from script loader\"))." } }, { "name": "charset" }, { "name": "async", "valueSet": "v", "description": { "kind": "markdown", "value": "This is a Boolean attribute indicating that the browser should, if possible, load the script asynchronously.\n\nThis attribute must not be used if the `src` attribute is absent (i.e. for inline scripts). If it is included in this case it will have no effect.\n\nBrowsers usually assume the worst case scenario and load scripts synchronously, (i.e. `async=\"false\"`) during HTML parsing.\n\nDynamically inserted scripts (using [`document.createElement()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement \"In an HTML document, the document.createElement() method creates the HTML element specified by tagName, or an HTMLUnknownElement if tagName isn't recognized.\")) load asynchronously by default, so to turn on synchronous loading (i.e. scripts load in the order they were inserted) set `async=\"false\"`.\n\nSee [Browser compatibility](#Browser_compatibility) for notes on browser support. See also [Async scripts for asm.js](https://developer.mozilla.org/en-US/docs/Games/Techniques/Async_scripts)." } }, { "name": "defer", "valueSet": "v", "description": { "kind": "markdown", "value": "This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded \"/en-US/docs/Web/Events/DOMContentLoaded\").\n\nScripts with the `defer` attribute will prevent the `DOMContentLoaded` event from firing until the script has loaded and finished evaluating.\n\nThis attribute must not be used if the `src` attribute is absent (i.e. for inline scripts), in this case it would have no effect.\n\nTo achieve a similar effect for dynamically inserted scripts use `async=\"false\"` instead. Scripts with the `defer` attribute will execute in the order in which they appear in the document." } }, { "name": "crossorigin", "valueSet": "xo", "description": { "kind": "markdown", "value": "Normal `script` elements pass minimal information to the [`window.onerror`](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror \"The onerror property of the GlobalEventHandlers mixin is an EventHandler that processes error events.\") for scripts which do not pass the standard [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS \"CORS: CORS (Cross-Origin Resource Sharing) is a system, consisting of transmitting HTTP headers, that determines whether browsers block frontend JavaScript code from accessing responses for cross-origin requests.\") checks. To allow error logging for sites which use a separate domain for static media, use this attribute. See [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for a more descriptive explanation of its valid arguments." } }, { "name": "nonce", "description": { "kind": "markdown", "value": "A cryptographic nonce (number used once) to whitelist inline scripts in a [script-src Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide a nonce that cannot be guessed as bypassing a resource's policy is otherwise trivial." } }, { "name": "integrity", "description": "This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation. See [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)." }, { "name": "nomodule", "description": "This Boolean attribute is set to indicate that the script should not be executed in browsers that support [ES2015 modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/) — in effect, this can be used to serve fallback scripts to older browsers that do not support modular JavaScript code." }, { "name": "referrerpolicy", "description": "Indicates which [referrer](https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer) to send when fetching the script, or resources fetched by the script:\n\n* `no-referrer`: The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent.\n* `no-referrer-when-downgrade` (default): The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer \"The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.\") header will not be sent to [origin](https://developer.mozilla.org/en-US/docs/Glossary/origin \"origin: Web content's origin is defined by the scheme (protocol), host (domain), and port of the URL used to access it. Two objects have the same origin only when the scheme, host, and port all match.\")s without [TLS](https://developer.mozilla.org/en-US/docs/Glossary/TLS \"TLS: Transport Layer Security (TLS), previously known as Secure Sockets Layer (SSL), is a protocol used by applications to communicate securely across a network, preventing tampering with and eavesdropping on email, web browsing, messaging, and other protocols.\") ([HTTPS](https://developer.mozilla.org/en-US/docs/Glossary/HTTPS \"HTTPS: HTTPS (HTTP Secure) is an encrypted version of the HTTP protocol. It usually uses SSL or TLS to encrypt all communication between a client and a server. This secure connection allows clients to safely exchange sensitive data with a server, for example for banking activities or online shopping.\")).\n* `origin`: The sent referrer will be limited to the origin of the referring page: its [scheme](https://developer.mozilla.org/en-US/docs/Archive/Mozilla/URIScheme), [host](https://developer.mozilla.org/en-US/docs/Glossary/host \"host: A host is a device connected to the Internet (or a local network). Some hosts called servers offer additional services like serving webpages or storing files and emails.\"), and [port](https://developer.mozilla.org/en-US/docs/Glossary/port \"port: For a computer connected to a network with an IP address, a port is a communication endpoint. Ports are designated by numbers, and below 1024 each port is associated by default with a specific protocol.\").\n* `origin-when-cross-origin`: The referrer sent to other origins will be limited to the scheme, the host, and the port. Navigations on the same origin will still include the path.\n* `same-origin`: A referrer will be sent for [same origin](https://developer.mozilla.org/en-US/docs/Glossary/Same-origin_policy \"same origin: The same-origin policy is a critical security mechanism that restricts how a document or script loaded from one origin can interact with a resource from another origin.\"), but cross-origin requests will contain no referrer information.\n* `strict-origin`: Only send the origin of the document as the referrer when the protocol security level stays the same (e.g. HTTPS→HTTPS), but don't send it to a less secure destination (e.g. HTTPS→HTTP).\n* `strict-origin-when-cross-origin`: Send a full URL when performing a same-origin request, but only send the origin when the protocol security level stays the same (e.g.HTTPS→HTTPS), and send no header to a less secure destination (e.g. HTTPS→HTTP).\n* `unsafe-url`: The referrer will include the origin _and_ the path (but not the [fragment](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/hash), [password](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/password), or [username](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/username)). **This value is unsafe**, because it leaks origins and paths from TLS-protected resources to insecure origins.\n\n**Note**: An empty string value (`\"\"`) is both the default value, and a fallback value if `referrerpolicy` is not supported. If `referrerpolicy` is not explicitly specified on the `<script>` element, it will adopt a higher-level referrer policy, i.e. one set on the whole document or domain. If a higher-level policy is not available, the empty string is treated as being equivalent to `no-referrer-when-downgrade`." }, { "name": "text", "description": "Like the `textContent` attribute, this attribute sets the text content of the element. Unlike the `textContent` attribute, however, this attribute is evaluated as executable code after the node is inserted into the DOM." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/script" } ] }, { "name": "noscript", "description": { "kind": "markdown", "value": "The noscript element represents nothing if scripting is enabled, and represents its children if scripting is disabled. It is used to present different markup to user agents that support scripting and those that don't support scripting, by affecting how the document is parsed." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/noscript" } ] }, { "name": "template", "description": { "kind": "markdown", "value": "The template element is used to declare fragments of HTML that can be cloned and inserted in the document by script." }, "attributes": [], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/template" } ] }, { "name": "canvas", "description": { "kind": "markdown", "value": "The canvas element provides scripts with a resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, art, or other visual images on the fly." }, "attributes": [ { "name": "width", "description": { "kind": "markdown", "value": "The width of the coordinate space in CSS pixels. Defaults to 300." } }, { "name": "height", "description": { "kind": "markdown", "value": "The height of the coordinate space in CSS pixels. Defaults to 150." } }, { "name": "moz-opaque", "description": "Lets the canvas know whether or not translucency will be a factor. If the canvas knows there's no translucency, painting performance can be optimized. This is only supported by Mozilla-based browsers; use the standardized [`canvas.getContext('2d', { alpha: false })`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext \"The HTMLCanvasElement.getContext() method returns a drawing context on the canvas, or null if the context identifier is not supported.\") instead." } ], "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Element/canvas" } ] } ], "globalAttributes": [ { "name": "accesskey", "description": { "kind": "markdown", "value": "Provides a hint for generating a keyboard shortcut for the current element. This attribute consists of a space-separated list of characters. The browser should use the first one that exists on the computer keyboard layout." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/accesskey" } ] }, { "name": "autocapitalize", "description": { "kind": "markdown", "value": "Controls whether and how text input is automatically capitalized as it is entered/edited by the user. It can have the following values:\n\n* `off` or `none`, no autocapitalization is applied (all letters default to lowercase)\n* `on` or `sentences`, the first letter of each sentence defaults to a capital letter; all other letters default to lowercase\n* `words`, the first letter of each word defaults to a capital letter; all other letters default to lowercase\n* `characters`, all letters should default to uppercase" }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/autocapitalize" } ] }, { "name": "class", "description": { "kind": "markdown", "value": "A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the [class selectors](/en-US/docs/Web/CSS/Class_selectors) or functions like the method [`Document.getElementsByClassName()`](/en-US/docs/Web/API/Document/getElementsByClassName \"returns an array-like object of all child elements which have all of the given class names.\")." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/class" } ] }, { "name": "contenteditable", "description": { "kind": "markdown", "value": "An enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing. The attribute must take one of the following values:\n\n* `true` or the _empty string_, which indicates that the element must be editable;\n* `false`, which indicates that the element must not be editable." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/contenteditable" } ] }, { "name": "contextmenu", "description": { "kind": "markdown", "value": "The `[**id**](#attr-id)` of a [`<menu>`](/en-US/docs/Web/HTML/Element/menu \"The HTML <menu> element represents a group of commands that a user can perform or activate. This includes both list menus, which might appear across the top of a screen, as well as context menus, such as those that might appear underneath a button after it has been clicked.\") to use as the contextual menu for this element." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/contextmenu" } ] }, { "name": "dir", "description": { "kind": "markdown", "value": "An enumerated attribute indicating the directionality of the element's text. It can have the following values:\n\n* `ltr`, which means _left to right_ and is to be used for languages that are written from the left to the right (like English);\n* `rtl`, which means _right to left_ and is to be used for languages that are written from the right to the left (like Arabic);\n* `auto`, which lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then it applies that directionality to the whole element." }, "valueSet": "d", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/dir" } ] }, { "name": "draggable", "description": { "kind": "markdown", "value": "An enumerated attribute indicating whether the element can be dragged, using the [Drag and Drop API](/en-us/docs/DragDrop/Drag_and_Drop). It can have the following values:\n\n* `true`, which indicates that the element may be dragged\n* `false`, which indicates that the element may not be dragged." }, "valueSet": "b", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/draggable" } ] }, { "name": "dropzone", "description": { "kind": "markdown", "value": "An enumerated attribute indicating what types of content can be dropped on an element, using the [Drag and Drop API](/en-US/docs/DragDrop/Drag_and_Drop). It can have the following values:\n\n* `copy`, which indicates that dropping will create a copy of the element that was dragged\n* `move`, which indicates that the element that was dragged will be moved to this new location.\n* `link`, will create a link to the dragged data." } }, { "name": "exportparts", "description": { "kind": "markdown", "value": "Used to transitively export shadow parts from a nested shadow tree into a containing light tree." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/exportparts" } ] }, { "name": "hidden", "description": { "kind": "markdown", "value": "A Boolean attribute indicates that the element is not yet, or is no longer, _relevant_. For example, it can be used to hide elements of the page that can't be used until the login process has been completed. The browser won't render such elements. This attribute must not be used to hide content that could legitimately be shown." }, "valueSet": "v", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/hidden" } ] }, { "name": "id", "description": { "kind": "markdown", "value": "Defines a unique identifier (ID) which must be unique in the whole document. Its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with CSS)." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/id" } ] }, { "name": "inputmode", "description": { "kind": "markdown", "value": "Provides a hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents. Used primarily on [`<input>`](/en-US/docs/Web/HTML/Element/input \"The HTML <input> element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent.\") elements, but is usable on any element while in `[contenteditable](/en-US/docs/Web/HTML/Global_attributes#attr-contenteditable)` mode." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/inputmode" } ] }, { "name": "is", "description": { "kind": "markdown", "value": "Allows you to specify that a standard HTML element should behave like a registered custom built-in element (see [Using custom elements](/en-US/docs/Web/Web_Components/Using_custom_elements) for more details)." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/is" } ] }, { "name": "itemid", "description": { "kind": "markdown", "value": "The unique, global identifier of an item." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemid" } ] }, { "name": "itemprop", "description": { "kind": "markdown", "value": "Used to add properties to an item. Every HTML element may have an `itemprop` attribute specified, where an `itemprop` consists of a name and value pair." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemprop" } ] }, { "name": "itemref", "description": { "kind": "markdown", "value": "Properties that are not descendants of an element with the `itemscope` attribute can be associated with the item using an `itemref`. It provides a list of element ids (not `itemid`s) with additional properties elsewhere in the document." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemref" } ] }, { "name": "itemscope", "description": { "kind": "markdown", "value": "`itemscope` (usually) works along with `[itemtype](/en-US/docs/Web/HTML/Global_attributes#attr-itemtype)` to specify that the HTML contained in a block is about a particular item. `itemscope` creates the Item and defines the scope of the `itemtype` associated with it. `itemtype` is a valid URL of a vocabulary (such as [schema.org](https://schema.org/)) that describes the item and its properties context." }, "valueSet": "v", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemscope" } ] }, { "name": "itemtype", "description": { "kind": "markdown", "value": "Specifies the URL of the vocabulary that will be used to define `itemprop`s (item properties) in the data structure. `[itemscope](/en-US/docs/Web/HTML/Global_attributes#attr-itemscope)` is used to set the scope of where in the data structure the vocabulary set by `itemtype` will be active." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/itemtype" } ] }, { "name": "lang", "description": { "kind": "markdown", "value": "Helps define the language of an element: the language that non-editable elements are in, or the language that editable elements should be written in by the user. The attribute contains one “language tag” (made of hyphen-separated “language subtags”) in the format defined in [_Tags for Identifying Languages (BCP47)_](https://www.ietf.org/rfc/bcp/bcp47.txt). [**xml:lang**](#attr-xml:lang) has priority over it." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/lang" } ] }, { "name": "part", "description": { "kind": "markdown", "value": "A space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the [`::part`](/en-US/docs/Web/CSS/::part \"The ::part CSS pseudo-element represents any element within a shadow tree that has a matching part attribute.\") pseudo-element." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/part" } ] }, { "name": "role", "valueSet": "roles" }, { "name": "slot", "description": { "kind": "markdown", "value": "Assigns a slot in a [shadow DOM](/en-US/docs/Web/Web_Components/Shadow_DOM) shadow tree to an element: An element with a `slot` attribute is assigned to the slot created by the [`<slot>`](/en-US/docs/Web/HTML/Element/slot \"The HTML <slot> element—part of the Web Components technology suite—is a placeholder inside a web component that you can fill with your own markup, which lets you create separate DOM trees and present them together.\") element whose `[name](/en-US/docs/Web/HTML/Element/slot#attr-name)` attribute's value matches that `slot` attribute's value." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/slot" } ] }, { "name": "spellcheck", "description": { "kind": "markdown", "value": "An enumerated attribute defines whether the element may be checked for spelling errors. It may have the following values:\n\n* `true`, which indicates that the element should be, if possible, checked for spelling errors;\n* `false`, which indicates that the element should not be checked for spelling errors." }, "valueSet": "b", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/spellcheck" } ] }, { "name": "style", "description": { "kind": "markdown", "value": "Contains [CSS](/en-US/docs/Web/CSS) styling declarations to be applied to the element. Note that it is recommended for styles to be defined in a separate file or files. This attribute and the [`<style>`](/en-US/docs/Web/HTML/Element/style \"The HTML <style> element contains style information for a document, or part of a document.\") element have mainly the purpose of allowing for quick styling, for example for testing purposes." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/style" } ] }, { "name": "tabindex", "description": { "kind": "markdown", "value": "An integer attribute indicating if the element can take input focus (is _focusable_), if it should participate to sequential keyboard navigation, and if so, at what position. It can take several values:\n\n* a _negative value_ means that the element should be focusable, but should not be reachable via sequential keyboard navigation;\n* `0` means that the element should be focusable and reachable via sequential keyboard navigation, but its relative order is defined by the platform convention;\n* a _positive value_ means that the element should be focusable and reachable via sequential keyboard navigation; the order in which the elements are focused is the increasing value of the [**tabindex**](#attr-tabindex). If several elements share the same tabindex, their relative order follows their relative positions in the document." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/tabindex" } ] }, { "name": "title", "description": { "kind": "markdown", "value": "Contains a text representing advisory information related to the element it belongs to. Such information can typically, but not necessarily, be presented to the user as a tooltip." }, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/title" } ] }, { "name": "translate", "description": { "kind": "markdown", "value": "An enumerated attribute that is used to specify whether an element's attribute values and the values of its [`Text`](/en-US/docs/Web/API/Text \"The Text interface represents the textual content of Element or Attr. If an element has no markup within its content, it has a single child implementing Text that contains the element's text. However, if the element contains markup, it is parsed into information items and Text nodes that form its children.\") node children are to be translated when the page is localized, or whether to leave them unchanged. It can have the following values:\n\n* empty string and `yes`, which indicates that the element will be translated.\n* `no`, which indicates that the element will not be translated." }, "valueSet": "y", "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/translate" } ] }, { "name": "onabort", "description": { "kind": "markdown", "value": "The loading of a resource has been aborted." } }, { "name": "onblur", "description": { "kind": "markdown", "value": "An element has lost focus (does not bubble)." } }, { "name": "oncanplay", "description": { "kind": "markdown", "value": "The user agent can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content." } }, { "name": "oncanplaythrough", "description": { "kind": "markdown", "value": "The user agent can play the media up to its end without having to stop for further buffering of content." } }, { "name": "onchange", "description": { "kind": "markdown", "value": "The change event is fired for <input>, <select>, and <textarea> elements when a change to the element's value is committed by the user." } }, { "name": "onclick", "description": { "kind": "markdown", "value": "A pointing device button has been pressed and released on an element." } }, { "name": "oncontextmenu", "description": { "kind": "markdown", "value": "The right button of the mouse is clicked (before the context menu is displayed)." } }, { "name": "ondblclick", "description": { "kind": "markdown", "value": "A pointing device button is clicked twice on an element." } }, { "name": "ondrag", "description": { "kind": "markdown", "value": "An element or text selection is being dragged (every 350ms)." } }, { "name": "ondragend", "description": { "kind": "markdown", "value": "A drag operation is being ended (by releasing a mouse button or hitting the escape key)." } }, { "name": "ondragenter", "description": { "kind": "markdown", "value": "A dragged element or text selection enters a valid drop target." } }, { "name": "ondragleave", "description": { "kind": "markdown", "value": "A dragged element or text selection leaves a valid drop target." } }, { "name": "ondragover", "description": { "kind": "markdown", "value": "An element or text selection is being dragged over a valid drop target (every 350ms)." } }, { "name": "ondragstart", "description": { "kind": "markdown", "value": "The user starts dragging an element or text selection." } }, { "name": "ondrop", "description": { "kind": "markdown", "value": "An element is dropped on a valid drop target." } }, { "name": "ondurationchange", "description": { "kind": "markdown", "value": "The duration attribute has been updated." } }, { "name": "onemptied", "description": { "kind": "markdown", "value": "The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it." } }, { "name": "onended", "description": { "kind": "markdown", "value": "Playback has stopped because the end of the media was reached." } }, { "name": "onerror", "description": { "kind": "markdown", "value": "A resource failed to load." } }, { "name": "onfocus", "description": { "kind": "markdown", "value": "An element has received focus (does not bubble)." } }, { "name": "onformchange" }, { "name": "onforminput" }, { "name": "oninput", "description": { "kind": "markdown", "value": "The value of an element changes or the content of an element with the attribute contenteditable is modified." } }, { "name": "oninvalid", "description": { "kind": "markdown", "value": "A submittable element has been checked and doesn't satisfy its constraints." } }, { "name": "onkeydown", "description": { "kind": "markdown", "value": "A key is pressed down." } }, { "name": "onkeypress", "description": { "kind": "markdown", "value": "A key is pressed down and that key normally produces a character value (use input instead)." } }, { "name": "onkeyup", "description": { "kind": "markdown", "value": "A key is released." } }, { "name": "onload", "description": { "kind": "markdown", "value": "A resource and its dependent resources have finished loading." } }, { "name": "onloadeddata", "description": { "kind": "markdown", "value": "The first frame of the media has finished loading." } }, { "name": "onloadedmetadata", "description": { "kind": "markdown", "value": "The metadata has been loaded." } }, { "name": "onloadstart", "description": { "kind": "markdown", "value": "Progress has begun." } }, { "name": "onmousedown", "description": { "kind": "markdown", "value": "A pointing device button (usually a mouse) is pressed on an element." } }, { "name": "onmousemove", "description": { "kind": "markdown", "value": "A pointing device is moved over an element." } }, { "name": "onmouseout", "description": { "kind": "markdown", "value": "A pointing device is moved off the element that has the listener attached or off one of its children." } }, { "name": "onmouseover", "description": { "kind": "markdown", "value": "A pointing device is moved onto the element that has the listener attached or onto one of its children." } }, { "name": "onmouseup", "description": { "kind": "markdown", "value": "A pointing device button is released over an element." } }, { "name": "onmousewheel" }, { "name": "onmouseenter", "description": { "kind": "markdown", "value": "A pointing device is moved onto the element that has the listener attached." } }, { "name": "onmouseleave", "description": { "kind": "markdown", "value": "A pointing device is moved off the element that has the listener attached." } }, { "name": "onpause", "description": { "kind": "markdown", "value": "Playback has been paused." } }, { "name": "onplay", "description": { "kind": "markdown", "value": "Playback has begun." } }, { "name": "onplaying", "description": { "kind": "markdown", "value": "Playback is ready to start after having been paused or delayed due to lack of data." } }, { "name": "onprogress", "description": { "kind": "markdown", "value": "In progress." } }, { "name": "onratechange", "description": { "kind": "markdown", "value": "The playback rate has changed." } }, { "name": "onreset", "description": { "kind": "markdown", "value": "A form is reset." } }, { "name": "onresize", "description": { "kind": "markdown", "value": "The document view has been resized." } }, { "name": "onreadystatechange", "description": { "kind": "markdown", "value": "The readyState attribute of a document has changed." } }, { "name": "onscroll", "description": { "kind": "markdown", "value": "The document view or an element has been scrolled." } }, { "name": "onseeked", "description": { "kind": "markdown", "value": "A seek operation completed." } }, { "name": "onseeking", "description": { "kind": "markdown", "value": "A seek operation began." } }, { "name": "onselect", "description": { "kind": "markdown", "value": "Some text is being selected." } }, { "name": "onshow", "description": { "kind": "markdown", "value": "A contextmenu event was fired on/bubbled to an element that has a contextmenu attribute" } }, { "name": "onstalled", "description": { "kind": "markdown", "value": "The user agent is trying to fetch media data, but data is unexpectedly not forthcoming." } }, { "name": "onsubmit", "description": { "kind": "markdown", "value": "A form is submitted." } }, { "name": "onsuspend", "description": { "kind": "markdown", "value": "Media data loading has been suspended." } }, { "name": "ontimeupdate", "description": { "kind": "markdown", "value": "The time indicated by the currentTime attribute has been updated." } }, { "name": "onvolumechange", "description": { "kind": "markdown", "value": "The volume has changed." } }, { "name": "onwaiting", "description": { "kind": "markdown", "value": "Playback has stopped because of a temporary lack of data." } }, { "name": "onpointercancel", "description": { "kind": "markdown", "value": "The pointer is unlikely to produce any more events." } }, { "name": "onpointerdown", "description": { "kind": "markdown", "value": "The pointer enters the active buttons state." } }, { "name": "onpointerenter", "description": { "kind": "markdown", "value": "Pointing device is moved inside the hit-testing boundary." } }, { "name": "onpointerleave", "description": { "kind": "markdown", "value": "Pointing device is moved out of the hit-testing boundary." } }, { "name": "onpointerlockchange", "description": { "kind": "markdown", "value": "The pointer was locked or released." } }, { "name": "onpointerlockerror", "description": { "kind": "markdown", "value": "It was impossible to lock the pointer for technical reasons or because the permission was denied." } }, { "name": "onpointermove", "description": { "kind": "markdown", "value": "The pointer changed coordinates." } }, { "name": "onpointerout", "description": { "kind": "markdown", "value": "The pointing device moved out of hit-testing boundary or leaves detectable hover range." } }, { "name": "onpointerover", "description": { "kind": "markdown", "value": "The pointing device is moved into the hit-testing boundary." } }, { "name": "onpointerup", "description": { "kind": "markdown", "value": "The pointer leaves the active buttons state." } }, { "name": "aria-activedescendant", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-activedescendant" } ], "description": { "kind": "markdown", "value": "Identifies the currently active element when DOM focus is on a [`composite`](https://www.w3.org/TR/wai-aria-1.1/#composite) widget, [`textbox`](https://www.w3.org/TR/wai-aria-1.1/#textbox), [`group`](https://www.w3.org/TR/wai-aria-1.1/#group), or [`application`](https://www.w3.org/TR/wai-aria-1.1/#application)." } }, { "name": "aria-atomic", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-atomic" } ], "description": { "kind": "markdown", "value": "Indicates whether [assistive technologies](https://www.w3.org/TR/wai-aria-1.1/#dfn-assistive-technology) will present all, or only parts of, the changed region based on the change notifications defined by the [`aria-relevant`](https://www.w3.org/TR/wai-aria-1.1/#aria-relevant) attribute." } }, { "name": "aria-autocomplete", "valueSet": "autocomplete", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-autocomplete" } ], "description": { "kind": "markdown", "value": "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made." } }, { "name": "aria-busy", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-busy" } ], "description": { "kind": "markdown", "value": "Indicates an element is being modified and that assistive technologies _MAY_ want to wait until the modifications are complete before exposing them to the user." } }, { "name": "aria-checked", "valueSet": "tristate", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-checked" } ], "description": { "kind": "markdown", "value": "Indicates the current \"checked\" [state](https://www.w3.org/TR/wai-aria-1.1/#dfn-state) of checkboxes, radio buttons, and other [widgets](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget). See related [`aria-pressed`](https://www.w3.org/TR/wai-aria-1.1/#aria-pressed) and [`aria-selected`](https://www.w3.org/TR/wai-aria-1.1/#aria-selected)." } }, { "name": "aria-colcount", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-colcount" } ], "description": { "kind": "markdown", "value": "Defines the total number of columns in a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-colindex`](https://www.w3.org/TR/wai-aria-1.1/#aria-colindex)." } }, { "name": "aria-colindex", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-colindex" } ], "description": { "kind": "markdown", "value": "Defines an [element's](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) column index or position with respect to the total number of columns within a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-colcount`](https://www.w3.org/TR/wai-aria-1.1/#aria-colcount) and [`aria-colspan`](https://www.w3.org/TR/wai-aria-1.1/#aria-colspan)." } }, { "name": "aria-colspan", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-colspan" } ], "description": { "kind": "markdown", "value": "Defines the number of columns spanned by a cell or gridcell within a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-colindex`](https://www.w3.org/TR/wai-aria-1.1/#aria-colindex) and [`aria-rowspan`](https://www.w3.org/TR/wai-aria-1.1/#aria-rowspan)." } }, { "name": "aria-controls", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-controls" } ], "description": { "kind": "markdown", "value": "Identifies the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) (or elements) whose contents or presence are controlled by the current element. See related [`aria-owns`](https://www.w3.org/TR/wai-aria-1.1/#aria-owns)." } }, { "name": "aria-current", "valueSet": "current", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-current" } ], "description": { "kind": "markdown", "value": "Indicates the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) that represents the current item within a container or set of related elements." } }, { "name": "aria-describedat", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-describedat" } ] }, { "name": "aria-describedby", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-describedby" } ], "description": { "kind": "markdown", "value": "Identifies the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) (or elements) that describes the [object](https://www.w3.org/TR/wai-aria-1.1/#dfn-object). See related [`aria-labelledby`](https://www.w3.org/TR/wai-aria-1.1/#aria-labelledby)." } }, { "name": "aria-disabled", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-disabled" } ], "description": { "kind": "markdown", "value": "Indicates that the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) is [perceivable](https://www.w3.org/TR/wai-aria-1.1/#dfn-perceivable) but disabled, so it is not editable or otherwise [operable](https://www.w3.org/TR/wai-aria-1.1/#dfn-operable). See related [`aria-hidden`](https://www.w3.org/TR/wai-aria-1.1/#aria-hidden) and [`aria-readonly`](https://www.w3.org/TR/wai-aria-1.1/#aria-readonly)." } }, { "name": "aria-dropeffect", "valueSet": "dropeffect", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-dropeffect" } ], "description": { "kind": "markdown", "value": "\\[Deprecated in ARIA 1.1\\] Indicates what functions can be performed when a dragged object is released on the drop target." } }, { "name": "aria-errormessage", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-errormessage" } ], "description": { "kind": "markdown", "value": "Identifies the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) that provides an error message for the [object](https://www.w3.org/TR/wai-aria-1.1/#dfn-object). See related [`aria-invalid`](https://www.w3.org/TR/wai-aria-1.1/#aria-invalid) and [`aria-describedby`](https://www.w3.org/TR/wai-aria-1.1/#aria-describedby)." } }, { "name": "aria-expanded", "valueSet": "u", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-expanded" } ], "description": { "kind": "markdown", "value": "Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed." } }, { "name": "aria-flowto", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-flowto" } ], "description": { "kind": "markdown", "value": "Identifies the next [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order." } }, { "name": "aria-grabbed", "valueSet": "u", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-grabbed" } ], "description": { "kind": "markdown", "value": "\\[Deprecated in ARIA 1.1\\] Indicates an element's \"grabbed\" [state](https://www.w3.org/TR/wai-aria-1.1/#dfn-state) in a drag-and-drop operation." } }, { "name": "aria-haspopup", "valueSet": "haspopup", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup" } ], "description": { "kind": "markdown", "value": "Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element)." } }, { "name": "aria-hidden", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-hidden" } ], "description": { "kind": "markdown", "value": "Indicates whether the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) is exposed to an accessibility API. See related [`aria-disabled`](https://www.w3.org/TR/wai-aria-1.1/#aria-disabled)." } }, { "name": "aria-invalid", "valueSet": "invalid", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-invalid" } ], "description": { "kind": "markdown", "value": "Indicates the entered value does not conform to the format expected by the application. See related [`aria-errormessage`](https://www.w3.org/TR/wai-aria-1.1/#aria-errormessage)." } }, { "name": "aria-kbdshortcuts", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-kbdshortcuts" } ] }, { "name": "aria-label", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-label" } ], "description": { "kind": "markdown", "value": "Defines a string value that labels the current element. See related [`aria-labelledby`](https://www.w3.org/TR/wai-aria-1.1/#aria-labelledby)." } }, { "name": "aria-labelledby", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-labelledby" } ], "description": { "kind": "markdown", "value": "Identifies the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) (or elements) that labels the current element. See related [`aria-describedby`](https://www.w3.org/TR/wai-aria-1.1/#aria-describedby)." } }, { "name": "aria-level", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-level" } ], "description": { "kind": "markdown", "value": "Defines the hierarchical level of an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) within a structure." } }, { "name": "aria-live", "valueSet": "live", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-live" } ], "description": { "kind": "markdown", "value": "Indicates that an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) will be updated, and describes the types of updates the [user agents](https://www.w3.org/TR/wai-aria-1.1/#dfn-user-agent), [assistive technologies](https://www.w3.org/TR/wai-aria-1.1/#dfn-assistive-technology), and user can expect from the [live region](https://www.w3.org/TR/wai-aria-1.1/#dfn-live-region)." } }, { "name": "aria-modal", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-modal" } ], "description": { "kind": "markdown", "value": "Indicates whether an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) is modal when displayed." } }, { "name": "aria-multiline", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-multiline" } ], "description": { "kind": "markdown", "value": "Indicates whether a text box accepts multiple lines of input or only a single line." } }, { "name": "aria-multiselectable", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-multiselectable" } ], "description": { "kind": "markdown", "value": "Indicates that the user may select more than one item from the current selectable descendants." } }, { "name": "aria-orientation", "valueSet": "orientation", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-orientation" } ], "description": { "kind": "markdown", "value": "Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous." } }, { "name": "aria-owns", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-owns" } ], "description": { "kind": "markdown", "value": "Identifies an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) (or elements) in order to define a visual, functional, or contextual parent/child [relationship](https://www.w3.org/TR/wai-aria-1.1/#dfn-relationship) between DOM elements where the DOM hierarchy cannot be used to represent the relationship. See related [`aria-controls`](https://www.w3.org/TR/wai-aria-1.1/#aria-controls)." } }, { "name": "aria-placeholder", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-placeholder" } ], "description": { "kind": "markdown", "value": "Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format." } }, { "name": "aria-posinset", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-posinset" } ], "description": { "kind": "markdown", "value": "Defines an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element)'s number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. See related [`aria-setsize`](https://www.w3.org/TR/wai-aria-1.1/#aria-setsize)." } }, { "name": "aria-pressed", "valueSet": "tristate", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-pressed" } ], "description": { "kind": "markdown", "value": "Indicates the current \"pressed\" [state](https://www.w3.org/TR/wai-aria-1.1/#dfn-state) of toggle buttons. See related [`aria-checked`](https://www.w3.org/TR/wai-aria-1.1/#aria-checked) and [`aria-selected`](https://www.w3.org/TR/wai-aria-1.1/#aria-selected)." } }, { "name": "aria-readonly", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-readonly" } ], "description": { "kind": "markdown", "value": "Indicates that the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) is not editable, but is otherwise [operable](https://www.w3.org/TR/wai-aria-1.1/#dfn-operable). See related [`aria-disabled`](https://www.w3.org/TR/wai-aria-1.1/#aria-disabled)." } }, { "name": "aria-relevant", "valueSet": "relevant", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-relevant" } ], "description": { "kind": "markdown", "value": "Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. See related [`aria-atomic`](https://www.w3.org/TR/wai-aria-1.1/#aria-atomic)." } }, { "name": "aria-required", "valueSet": "b", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-required" } ], "description": { "kind": "markdown", "value": "Indicates that user input is required on the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) before a form may be submitted." } }, { "name": "aria-roledescription", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-roledescription" } ], "description": { "kind": "markdown", "value": "Defines a human-readable, author-localized description for the [role](https://www.w3.org/TR/wai-aria-1.1/#dfn-role) of an [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element)." } }, { "name": "aria-rowcount", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-rowcount" } ], "description": { "kind": "markdown", "value": "Defines the total number of rows in a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-rowindex`](https://www.w3.org/TR/wai-aria-1.1/#aria-rowindex)." } }, { "name": "aria-rowindex", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-rowindex" } ], "description": { "kind": "markdown", "value": "Defines an [element's](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) row index or position with respect to the total number of rows within a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-rowcount`](https://www.w3.org/TR/wai-aria-1.1/#aria-rowcount) and [`aria-rowspan`](https://www.w3.org/TR/wai-aria-1.1/#aria-rowspan)." } }, { "name": "aria-rowspan", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-rowspan" } ], "description": { "kind": "markdown", "value": "Defines the number of rows spanned by a cell or gridcell within a [`table`](https://www.w3.org/TR/wai-aria-1.1/#table), [`grid`](https://www.w3.org/TR/wai-aria-1.1/#grid), or [`treegrid`](https://www.w3.org/TR/wai-aria-1.1/#treegrid). See related [`aria-rowindex`](https://www.w3.org/TR/wai-aria-1.1/#aria-rowindex) and [`aria-colspan`](https://www.w3.org/TR/wai-aria-1.1/#aria-colspan)." } }, { "name": "aria-selected", "valueSet": "u", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-selected" } ], "description": { "kind": "markdown", "value": "Indicates the current \"selected\" [state](https://www.w3.org/TR/wai-aria-1.1/#dfn-state) of various [widgets](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget). See related [`aria-checked`](https://www.w3.org/TR/wai-aria-1.1/#aria-checked) and [`aria-pressed`](https://www.w3.org/TR/wai-aria-1.1/#aria-pressed)." } }, { "name": "aria-setsize", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-setsize" } ], "description": { "kind": "markdown", "value": "Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. See related [`aria-posinset`](https://www.w3.org/TR/wai-aria-1.1/#aria-posinset)." } }, { "name": "aria-sort", "valueSet": "sort", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-sort" } ], "description": { "kind": "markdown", "value": "Indicates if items in a table or grid are sorted in ascending or descending order." } }, { "name": "aria-valuemax", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-valuemax" } ], "description": { "kind": "markdown", "value": "Defines the maximum allowed value for a range [widget](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget)." } }, { "name": "aria-valuemin", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-valuemin" } ], "description": { "kind": "markdown", "value": "Defines the minimum allowed value for a range [widget](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget)." } }, { "name": "aria-valuenow", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-valuenow" } ], "description": { "kind": "markdown", "value": "Defines the current value for a range [widget](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget). See related [`aria-valuetext`](https://www.w3.org/TR/wai-aria-1.1/#aria-valuetext)." } }, { "name": "aria-valuetext", "references": [ { "name": "WAI-ARIA Reference", "url": "https://www.w3.org/TR/wai-aria-1.1/#aria-valuetext" } ], "description": { "kind": "markdown", "value": "Defines the human readable text alternative of [`aria-valuenow`](https://www.w3.org/TR/wai-aria-1.1/#aria-valuenow) for a range [widget](https://www.w3.org/TR/wai-aria-1.1/#dfn-widget)." } }, { "name": "aria-details", "description": { "kind": "markdown", "value": "Identifies the [element](https://www.w3.org/TR/wai-aria-1.1/#dfn-element) that provides a detailed, extended description for the [object](https://www.w3.org/TR/wai-aria-1.1/#dfn-object). See related [`aria-describedby`](https://www.w3.org/TR/wai-aria-1.1/#aria-describedby)." } }, { "name": "aria-keyshortcuts", "description": { "kind": "markdown", "value": "Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element." } } ], "valueSets": [ { "name": "b", "values": [ { "name": "true" }, { "name": "false" } ] }, { "name": "u", "values": [ { "name": "true" }, { "name": "false" }, { "name": "undefined" } ] }, { "name": "o", "values": [ { "name": "on" }, { "name": "off" } ] }, { "name": "y", "values": [ { "name": "yes" }, { "name": "no" } ] }, { "name": "w", "values": [ { "name": "soft" }, { "name": "hard" } ] }, { "name": "d", "values": [ { "name": "ltr" }, { "name": "rtl" }, { "name": "auto" } ] }, { "name": "m", "values": [ { "name": "get", "description": { "kind": "markdown", "value": "Corresponds to the HTTP [GET method](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3); form data are appended to the `action` attribute URI with a '?' as separator, and the resulting URI is sent to the server. Use this method when the form has no side-effects and contains only ASCII characters." } }, { "name": "post", "description": { "kind": "markdown", "value": "Corresponds to the HTTP [POST method](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5); form data are included in the body of the form and sent to the server." } }, { "name": "dialog", "description": { "kind": "markdown", "value": "Use when the form is inside a [`<dialog>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog) element to close the dialog when submitted." } } ] }, { "name": "fm", "values": [ { "name": "get" }, { "name": "post" } ] }, { "name": "s", "values": [ { "name": "row" }, { "name": "col" }, { "name": "rowgroup" }, { "name": "colgroup" } ] }, { "name": "t", "values": [ { "name": "hidden" }, { "name": "text" }, { "name": "search" }, { "name": "tel" }, { "name": "url" }, { "name": "email" }, { "name": "password" }, { "name": "datetime" }, { "name": "date" }, { "name": "month" }, { "name": "week" }, { "name": "time" }, { "name": "datetime-local" }, { "name": "number" }, { "name": "range" }, { "name": "color" }, { "name": "checkbox" }, { "name": "radio" }, { "name": "file" }, { "name": "submit" }, { "name": "image" }, { "name": "reset" }, { "name": "button" } ] }, { "name": "im", "values": [ { "name": "verbatim" }, { "name": "latin" }, { "name": "latin-name" }, { "name": "latin-prose" }, { "name": "full-width-latin" }, { "name": "kana" }, { "name": "kana-name" }, { "name": "katakana" }, { "name": "numeric" }, { "name": "tel" }, { "name": "email" }, { "name": "url" } ] }, { "name": "bt", "values": [ { "name": "button" }, { "name": "submit" }, { "name": "reset" }, { "name": "menu" } ] }, { "name": "lt", "values": [ { "name": "1" }, { "name": "a" }, { "name": "A" }, { "name": "i" }, { "name": "I" } ] }, { "name": "mt", "values": [ { "name": "context" }, { "name": "toolbar" } ] }, { "name": "mit", "values": [ { "name": "command" }, { "name": "checkbox" }, { "name": "radio" } ] }, { "name": "et", "values": [ { "name": "application/x-www-form-urlencoded" }, { "name": "multipart/form-data" }, { "name": "text/plain" } ] }, { "name": "tk", "values": [ { "name": "subtitles" }, { "name": "captions" }, { "name": "descriptions" }, { "name": "chapters" }, { "name": "metadata" } ] }, { "name": "pl", "values": [ { "name": "none" }, { "name": "metadata" }, { "name": "auto" } ] }, { "name": "sh", "values": [ { "name": "circle" }, { "name": "default" }, { "name": "poly" }, { "name": "rect" } ] }, { "name": "xo", "values": [ { "name": "anonymous" }, { "name": "use-credentials" } ] }, { "name": "sb", "values": [ { "name": "allow-forms" }, { "name": "allow-modals" }, { "name": "allow-pointer-lock" }, { "name": "allow-popups" }, { "name": "allow-popups-to-escape-sandbox" }, { "name": "allow-same-origin" }, { "name": "allow-scripts" }, { "name": "allow-top-navigation" } ] }, { "name": "tristate", "values": [ { "name": "true" }, { "name": "false" }, { "name": "mixed" }, { "name": "undefined" } ] }, { "name": "inputautocomplete", "values": [ { "name": "additional-name" }, { "name": "address-level1" }, { "name": "address-level2" }, { "name": "address-level3" }, { "name": "address-level4" }, { "name": "address-line1" }, { "name": "address-line2" }, { "name": "address-line3" }, { "name": "bday" }, { "name": "bday-year" }, { "name": "bday-day" }, { "name": "bday-month" }, { "name": "billing" }, { "name": "cc-additional-name" }, { "name": "cc-csc" }, { "name": "cc-exp" }, { "name": "cc-exp-month" }, { "name": "cc-exp-year" }, { "name": "cc-family-name" }, { "name": "cc-given-name" }, { "name": "cc-name" }, { "name": "cc-number" }, { "name": "cc-type" }, { "name": "country" }, { "name": "country-name" }, { "name": "current-password" }, { "name": "email" }, { "name": "family-name" }, { "name": "fax" }, { "name": "given-name" }, { "name": "home" }, { "name": "honorific-prefix" }, { "name": "honorific-suffix" }, { "name": "impp" }, { "name": "language" }, { "name": "mobile" }, { "name": "name" }, { "name": "new-password" }, { "name": "nickname" }, { "name": "organization" }, { "name": "organization-title" }, { "name": "pager" }, { "name": "photo" }, { "name": "postal-code" }, { "name": "sex" }, { "name": "shipping" }, { "name": "street-address" }, { "name": "tel-area-code" }, { "name": "tel" }, { "name": "tel-country-code" }, { "name": "tel-extension" }, { "name": "tel-local" }, { "name": "tel-local-prefix" }, { "name": "tel-local-suffix" }, { "name": "tel-national" }, { "name": "transaction-amount" }, { "name": "transaction-currency" }, { "name": "url" }, { "name": "username" }, { "name": "work" } ] }, { "name": "autocomplete", "values": [ { "name": "inline" }, { "name": "list" }, { "name": "both" }, { "name": "none" } ] }, { "name": "current", "values": [ { "name": "page" }, { "name": "step" }, { "name": "location" }, { "name": "date" }, { "name": "time" }, { "name": "true" }, { "name": "false" } ] }, { "name": "dropeffect", "values": [ { "name": "copy" }, { "name": "move" }, { "name": "link" }, { "name": "execute" }, { "name": "popup" }, { "name": "none" } ] }, { "name": "invalid", "values": [ { "name": "grammar" }, { "name": "false" }, { "name": "spelling" }, { "name": "true" } ] }, { "name": "live", "values": [ { "name": "off" }, { "name": "polite" }, { "name": "assertive" } ] }, { "name": "orientation", "values": [ { "name": "vertical" }, { "name": "horizontal" }, { "name": "undefined" } ] }, { "name": "relevant", "values": [ { "name": "additions" }, { "name": "removals" }, { "name": "text" }, { "name": "all" }, { "name": "additions text" } ] }, { "name": "sort", "values": [ { "name": "ascending" }, { "name": "descending" }, { "name": "none" }, { "name": "other" } ] }, { "name": "roles", "values": [ { "name": "alert" }, { "name": "alertdialog" }, { "name": "button" }, { "name": "checkbox" }, { "name": "dialog" }, { "name": "gridcell" }, { "name": "link" }, { "name": "log" }, { "name": "marquee" }, { "name": "menuitem" }, { "name": "menuitemcheckbox" }, { "name": "menuitemradio" }, { "name": "option" }, { "name": "progressbar" }, { "name": "radio" }, { "name": "scrollbar" }, { "name": "searchbox" }, { "name": "slider" }, { "name": "spinbutton" }, { "name": "status" }, { "name": "switch" }, { "name": "tab" }, { "name": "tabpanel" }, { "name": "textbox" }, { "name": "timer" }, { "name": "tooltip" }, { "name": "treeitem" }, { "name": "combobox" }, { "name": "grid" }, { "name": "listbox" }, { "name": "menu" }, { "name": "menubar" }, { "name": "radiogroup" }, { "name": "tablist" }, { "name": "tree" }, { "name": "treegrid" }, { "name": "application" }, { "name": "article" }, { "name": "cell" }, { "name": "columnheader" }, { "name": "definition" }, { "name": "directory" }, { "name": "document" }, { "name": "feed" }, { "name": "figure" }, { "name": "group" }, { "name": "heading" }, { "name": "img" }, { "name": "list" }, { "name": "listitem" }, { "name": "math" }, { "name": "none" }, { "name": "note" }, { "name": "presentation" }, { "name": "region" }, { "name": "row" }, { "name": "rowgroup" }, { "name": "rowheader" }, { "name": "separator" }, { "name": "table" }, { "name": "term" }, { "name": "text" }, { "name": "toolbar" }, { "name": "banner" }, { "name": "complementary" }, { "name": "contentinfo" }, { "name": "form" }, { "name": "main" }, { "name": "navigation" }, { "name": "region" }, { "name": "search" }, { "name": "doc-abstract" }, { "name": "doc-acknowledgments" }, { "name": "doc-afterword" }, { "name": "doc-appendix" }, { "name": "doc-backlink" }, { "name": "doc-biblioentry" }, { "name": "doc-bibliography" }, { "name": "doc-biblioref" }, { "name": "doc-chapter" }, { "name": "doc-colophon" }, { "name": "doc-conclusion" }, { "name": "doc-cover" }, { "name": "doc-credit" }, { "name": "doc-credits" }, { "name": "doc-dedication" }, { "name": "doc-endnote" }, { "name": "doc-endnotes" }, { "name": "doc-epigraph" }, { "name": "doc-epilogue" }, { "name": "doc-errata" }, { "name": "doc-example" }, { "name": "doc-footnote" }, { "name": "doc-foreword" }, { "name": "doc-glossary" }, { "name": "doc-glossref" }, { "name": "doc-index" }, { "name": "doc-introduction" }, { "name": "doc-noteref" }, { "name": "doc-notice" }, { "name": "doc-pagebreak" }, { "name": "doc-pagelist" }, { "name": "doc-part" }, { "name": "doc-preface" }, { "name": "doc-prologue" }, { "name": "doc-pullquote" }, { "name": "doc-qna" }, { "name": "doc-subtitle" }, { "name": "doc-tip" }, { "name": "doc-toc" } ] }, { "name": "metanames", "values": [ { "name": "application-name" }, { "name": "author" }, { "name": "description" }, { "name": "format-detection" }, { "name": "generator" }, { "name": "keywords" }, { "name": "publisher" }, { "name": "referrer" }, { "name": "robots" }, { "name": "theme-color" }, { "name": "viewport" } ] }, { "name": "haspopup", "values": [ { "name": "false", "description": { "kind": "markdown", "value": "(default) Indicates the element does not have a popup." } }, { "name": "true", "description": { "kind": "markdown", "value": "Indicates the popup is a menu." } }, { "name": "menu", "description": { "kind": "markdown", "value": "Indicates the popup is a menu." } }, { "name": "listbox", "description": { "kind": "markdown", "value": "Indicates the popup is a listbox." } }, { "name": "tree", "description": { "kind": "markdown", "value": "Indicates the popup is a tree." } }, { "name": "grid", "description": { "kind": "markdown", "value": "Indicates the popup is a grid." } }, { "name": "dialog", "description": { "kind": "markdown", "value": "Indicates the popup is a dialog." } } ] } ] }; }); }); getDefaultExportFromCjs(webCustomData); var dataProvider = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.svelteHtmlDataProvider = void 0; const svelteEvents = [ ...webCustomData.htmlData.globalAttributes.map(mapToSvelteEvent), { name: 'on:introstart', description: 'Available when element has transition' }, { name: 'on:introend', description: 'Available when element has transition' }, { name: 'on:outrostart', description: 'Available when element has transition' }, { name: 'on:outroend', description: 'Available when element has transition' }, { name: 'on:pointercancel' }, { name: 'on:pointerdown' }, { name: 'on:pointerenter' }, { name: 'on:pointerleave' }, { name: 'on:pointermove' }, { name: 'on:pointerout' }, { name: 'on:pointerover' }, { name: 'on:pointerup' }, { name: 'on:mouseenter' }, { name: 'on:mouseleave' }, { name: 'on:hashchange' } ]; const svelteAttributes = [ { name: 'bind:innerHTML', description: 'Available when contenteditable=true' }, { name: 'bind:textContent', description: 'Available when contenteditable=true' }, { name: 'bind:clientWidth', description: 'Available for block level elements. (read-only)' }, { name: 'bind:clientHeight', description: 'Available for block level elements. (read-only)' }, { name: 'bind:offsetWidth', description: 'Available for block level elements. (read-only)' }, { name: 'bind:offsetHeight', description: 'Available for block level elements. (read-only)' }, { name: 'bind:this', description: 'To get a reference to a DOM node, use bind:this. If used on a component, gets a reference to that component instance.' } ]; const svelteTags = [ { name: 'svelte:self', description: 'Allows a component to include itself, recursively.\n\nIt cannot appear at the top level of your markup; it must be inside an if or each block to prevent an infinite loop.', attributes: [] }, { name: 'svelte:component', description: 'Renders a component dynamically, using the component constructor specified as the this property. When the property changes, the component is destroyed and recreated.\n\nIf this is falsy, no component is rendered.', attributes: [ { name: 'this', description: 'Component to render.\n\nWhen this property changes, the component is destroyed and recreated.\nIf this is falsy, no component is rendered.' } ] }, { name: 'svelte:element', description: 'Renders a DOM element dynamically, using the string as the this property. When the property changes, the element is destroyed and recreated.\n\nIf this is falsy, no element is rendered.', attributes: [ { name: 'this', description: 'DOM element to render.\n\nWhen this property changes, the element is destroyed and recreated.\nIf this is falsy, no element is rendered.' } ] }, { name: 'svelte:window', description: 'Allows you to add event listeners to the window object without worrying about removing them when the component is destroyed, or checking for the existence of window when server-side rendering.', attributes: [ { name: 'bind:innerWidth', description: 'Bind to the inner width of the window. (read-only)' }, { name: 'bind:innerHeight', description: 'Bind to the inner height of the window. (read-only)' }, { name: 'bind:outerWidth', description: 'Bind to the outer width of the window. (read-only)' }, { name: 'bind:outerHeight', description: 'Bind to the outer height of the window. (read-only)' }, { name: 'bind:scrollX', description: 'Bind to the scroll x position of the window.' }, { name: 'bind:scrollY', description: 'Bind to the scroll y position of the window.' }, { name: 'bind:online', description: 'An alias for window.navigator.onLine' } ] }, { name: 'svelte:body', description: "As with <svelte:window>, this element allows you to add listeners to events on document.body, such as mouseenter and mouseleave which don't fire on window.", attributes: [] }, { name: 'svelte:head', description: 'This element makes it possible to insert elements into document.head. During server-side rendering, head content exposed separately to the main html content.', attributes: [] }, { name: 'svelte:options', description: 'Provides a place to specify per-component compiler options', attributes: [ { name: 'immutable', description: 'If true, tells the compiler that you promise not to mutate any objects. This allows it to be less conservative about checking whether values have changed.', values: [ { name: '{true}', description: 'You never use mutable data, so the compiler can do simple referential equality checks to determine if values have changed' }, { name: '{false}', description: 'The default. Svelte will be more conservative about whether or not mutable objects have changed' } ] }, { name: 'accessors', description: "If true, getters and setters will be created for the component's props. If false, they will only be created for readonly exported values (i.e. those declared with const, class and function). If compiling with customElement: true this option defaults to true.", values: [ { name: '{true}', description: "Adds getters and setters for the component's props" }, { name: '{false}', description: 'The default.' } ] }, { name: 'namespace', description: 'The namespace where this component will be used, most commonly "svg"' }, { name: 'tag', description: 'The name to use when compiling this component as a custom element' } ] }, { name: 'svelte:fragment', description: 'This element is useful if you want to assign a component to a named slot without creating a wrapper DOM element.', attributes: [ { name: 'slot', description: 'The name of the named slot that should be targeted.' } ] }, { name: 'slot', description: 'Components can have child content, in the same way that elements can.\n\nThe content is exposed in the child component using the <slot> element, which can contain fallback content that is rendered if no children are provided.', attributes: [ { name: 'name', description: 'Named slots allow consumers to target specific areas. They can also have fallback content.' } ] } ]; const mediaAttributes = [ { name: 'bind:duration', description: 'The total duration of the video, in seconds. (readonly)' }, { name: 'bind:buffered', description: 'An array of {start, end} objects. (readonly)' }, { name: 'bind:seekable', description: 'An array of {start, end} objects. (readonly)' }, { name: 'bind:played', description: 'An array of {start, end} objects. (readonly)' }, { name: 'bind:seeking', description: 'boolean. (readonly)' }, { name: 'bind:ended', description: 'boolean. (readonly)' }, { name: 'bind:currentTime', description: 'The current point in the video, in seconds.' }, { name: 'bind:playbackRate', description: "how fast or slow to play the video, where 1 is 'normal'" }, { name: 'bind:paused' }, { name: 'bind:volume', description: 'A value between 0 and 1' }, { name: 'bind:muted' } ]; const videoAttributes = [ { name: 'bind:videoWidth', description: 'readonly' }, { name: 'bind:videoHeight', description: 'readonly' } ]; const indeterminateAttribute = { name: 'indeterminate', description: 'Available for type="checkbox"' }; const addAttributes = { select: [{ name: 'bind:value' }], input: [ { name: 'bind:value' }, { name: 'bind:group', description: 'Available for type="radio" and type="checkbox"' }, { name: 'bind:checked', description: 'Available for type="checkbox"' }, { name: 'bind:files', description: 'Available for type="file" (readonly)' }, indeterminateAttribute, { ...indeterminateAttribute, name: 'bind:indeterminate' } ], textarea: [{ name: 'bind:value' }], video: [...mediaAttributes, ...videoAttributes], audio: [...mediaAttributes], a: [ { name: 'sveltekit:noscroll', description: 'SvelteKit-specific attribute. Will prevent scrolling after the link is clicked.', valueSet: 'v' }, { name: 'sveltekit:prefetch', description: "SvelteKit-specific attribute. Will cause SvelteKit to run the page's load function as soon as the user hovers over the link (on a desktop) or touches it (on mobile), rather than waiting for the click event to trigger navigation.", valueSet: 'v' }, { name: 'sveltekit:reload', description: 'SvelteKit-specific attribute. Will cause SvelteKit to do a normal browser navigation which results in a full page reload.', valueSet: 'v' } ], details: [ { name: 'bind:open' } ] }; const html5Tags = webCustomData.htmlData.tags.map((tag) => { let attributes = tag.attributes.map(mapToSvelteEvent); if (addAttributes[tag.name]) { attributes = [...attributes, ...addAttributes[tag.name]]; } return { ...tag, attributes }; }); exports.svelteHtmlDataProvider = (0, vscode_html_languageservice_1.newHTMLDataProvider)('svelte-builtin', { version: 1, globalAttributes: [...webCustomData.htmlData.globalAttributes, ...svelteEvents, ...svelteAttributes], tags: [...html5Tags, ...svelteTags], valueSets: webCustomData.htmlData.valueSets }); function mapToSvelteEvent(attr) { return { ...attr, name: attr.name.replace(/^on/, 'on:') }; } }); getDefaultExportFromCjs(dataProvider); var HTMLPlugin_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.HTMLPlugin = void 0; class HTMLPlugin { constructor(docManager, configManager) { this.__name = 'html'; this.lang = (0, vscode_html_languageservice_1.getLanguageService)({ customDataProviders: [dataProvider.svelteHtmlDataProvider], useDefaultDataProvider: false }); this.documents = new WeakMap(); this.styleScriptTemplate = new Set(['template', 'style', 'script']); this.configManager = configManager; docManager.on('documentChange', (document) => { this.documents.set(document, document.html); }); } doHover(document, position) { if (!this.featureEnabled('hover')) { return null; } const html = this.documents.get(document); if (!html) { return null; } const node = html.findNodeAt(document.offsetAt(position)); if (!node || (0, utils$4.possiblyComponent)(node)) { return null; } return this.lang.doHover(document, position, html); } getCompletions(document, position) { if (!this.featureEnabled('completions')) { return null; } const html = this.documents.get(document); if (!html) { return null; } if (this.isInsideMoustacheTag(html, document, position) || (0, documents.isInTag)(position, document.scriptInfo) || (0, documents.isInTag)(position, document.moduleScriptInfo)) { return null; } let emmetResults = { isIncomplete: false, items: [] }; if (this.configManager.getConfig().html.completions.emmet && this.configManager.getEmmetConfig().showExpandedAbbreviation !== 'never') { this.lang.setCompletionParticipants([ { onHtmlContent: () => (emmetResults = (0, vscode_emmet_helper_1.doComplete)(document, position, 'html', this.configManager.getEmmetConfig()) || emmetResults) } ]); } const results = this.isInComponentTag(html, document, position) ? main$4.CompletionList.create([]) : this.lang.doComplete(document, position, html); const items = this.toCompletionItems(results.items); items.forEach((item) => { if (item.label.startsWith('on:') && item.textEdit) { item.textEdit = { ...item.textEdit, newText: item.textEdit.newText.replace('="$1"', '$2="$1"') }; } }); return main$4.CompletionList.create([ ...this.toCompletionItems(items), ...this.getLangCompletions(items), ...emmetResults.items ], emmetResults.items.length > 0); } toCompletionItems(items) { return items.map((item) => { if (!item.textEdit || main$4.TextEdit.is(item.textEdit)) { return item; } return { ...item, textEdit: main$4.TextEdit.replace(item.textEdit.replace, item.textEdit.newText) }; }); } isInComponentTag(html, document, position) { return !!(0, documents.getNodeIfIsInComponentStartTag)(html, document.offsetAt(position)); } getLangCompletions(completions) { const styleScriptTemplateCompletions = completions.filter((completion) => completion.kind === main$4.CompletionItemKind.Property && this.styleScriptTemplate.has(completion.label)); const langCompletions = []; addLangCompletion('script', ['ts']); addLangCompletion('style', ['less', 'scss']); addLangCompletion('template', ['pug']); return langCompletions; function addLangCompletion(tag, languages) { const existingCompletion = styleScriptTemplateCompletions.find((completion) => completion.label === tag); if (!existingCompletion) { return; } languages.forEach((lang) => langCompletions.push({ ...existingCompletion, label: `${tag} (lang="${lang}")`, insertText: existingCompletion.insertText && `${existingCompletion.insertText} lang="${lang}"`, textEdit: existingCompletion.textEdit && main$4.TextEdit.is(existingCompletion.textEdit) ? { range: existingCompletion.textEdit.range, newText: `${existingCompletion.textEdit.newText} lang="${lang}"` } : undefined })); } } doTagComplete(document, position) { if (!this.featureEnabled('tagComplete')) { return null; } const html = this.documents.get(document); if (!html) { return null; } if (this.isInsideMoustacheTag(html, document, position)) { return null; } return this.lang.doTagComplete(document, position, html); } isInsideMoustacheTag(html, document, position) { const offset = document.offsetAt(position); const node = html.findNodeAt(offset); return (0, utils$3.isInsideMoustacheTag)(document.getText(), node.start, offset); } getDocumentSymbols(document) { if (!this.featureEnabled('documentSymbols')) { return []; } const html = this.documents.get(document); if (!html) { return []; } return this.lang.findDocumentSymbols(document, html); } rename(document, position, newName) { const html = this.documents.get(document); if (!html) { return null; } const node = html.findNodeAt(document.offsetAt(position)); if (!node || (0, utils$4.possiblyComponent)(node)) { return null; } return this.lang.doRename(document, position, newName, html); } prepareRename(document, position) { const html = this.documents.get(document); if (!html) { return null; } const offset = document.offsetAt(position); const node = html.findNodeAt(offset); if (!node || (0, utils$4.possiblyComponent)(node) || !node.tag || !this.isRenameAtTag(node, offset)) { return null; } const tagNameStart = node.start + '<'.length; return (0, utils$3.toRange)(document.getText(), tagNameStart, tagNameStart + node.tag.length); } getLinkedEditingRanges(document, position) { if (!this.featureEnabled('linkedEditing')) { return null; } const html = this.documents.get(document); if (!html) { return null; } const ranges = this.lang.findLinkedEditingRanges(document, position, html); if (!ranges) { return null; } return { ranges }; } isRenameAtTag(node, offset) { if (!node.tag) { return false; } const startTagNameEnd = node.start + `<${node.tag}`.length; const isAtStartTag = offset > node.start && offset <= startTagNameEnd; const isAtEndTag = node.endTagStart !== undefined && offset >= node.endTagStart && offset < node.end; return isAtStartTag || isAtEndTag; } featureEnabled(feature) { return (this.configManager.enabled('html.enable') && this.configManager.enabled(`html.${feature}.enable`)); } } exports.HTMLPlugin = HTMLPlugin; }); getDefaultExportFromCjs(HTMLPlugin_1); var PluginHost_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.PluginHost = void 0; var ExecuteMode; (function (ExecuteMode) { ExecuteMode[ExecuteMode["None"] = 0] = "None"; ExecuteMode[ExecuteMode["FirstNonNull"] = 1] = "FirstNonNull"; ExecuteMode[ExecuteMode["Collect"] = 2] = "Collect"; })(ExecuteMode || (ExecuteMode = {})); class PluginHost { constructor(documentsManager) { this.documentsManager = documentsManager; this.plugins = []; this.pluginHostConfig = { filterIncompleteCompletions: true, definitionLinkSupport: false }; this.deferredRequests = {}; } initialize(pluginHostConfig) { this.pluginHostConfig = pluginHostConfig; } register(plugin) { this.plugins.push(plugin); } didUpdateDocument() { this.deferredRequests = {}; } async getDiagnostics(textDocument) { var _a, _b, _c, _d; const document = this.getDocument(textDocument.uri); if ((((_a = document.getFilePath()) === null || _a === void 0 ? void 0 : _a.includes('/node_modules/')) || ((_b = document.getFilePath()) === null || _b === void 0 ? void 0 : _b.includes('\\node_modules\\'))) && !(((_c = document.getFilePath()) === null || _c === void 0 ? void 0 : _c.includes('/src/node_modules/')) || ((_d = document.getFilePath()) === null || _d === void 0 ? void 0 : _d.includes('\\src\\node_modules\\')))) { return []; } return (0, lodash.flatten)(await this.execute('getDiagnostics', [document], ExecuteMode.Collect, 'high')); } async doHover(textDocument, position) { const document = this.getDocument(textDocument.uri); return this.execute('doHover', [document, position], ExecuteMode.FirstNonNull, 'high'); } async getCompletions(textDocument, position, completionContext, cancellationToken) { const document = this.getDocument(textDocument.uri); const completions = await Promise.all(this.plugins.map(async (plugin) => { const result = await this.tryExecutePlugin(plugin, 'getCompletions', [document, position, completionContext, cancellationToken], null); if (result) { return { result: result, plugin: plugin.__name }; } })).then((completions) => completions.filter(utils$4.isNotNullOrUndefined)); const html = completions.find((completion) => completion.plugin === 'html'); const ts = completions.find((completion) => completion.plugin === 'ts'); if (html && ts && (0, documents.getNodeIfIsInHTMLStartTag)(document.html, document.offsetAt(position))) { const htmlCompletions = new Set(html.result.items.map((item) => item.label)); ts.result.items = ts.result.items.filter((item) => { const label = item.label; if (htmlCompletions.has(label)) { return false; } if (label[0] === '"' && label[label.length - 1] === '"') { item.label = item.label.slice(1, -1); if (htmlCompletions.has(item.label)) { return false; } } if (label.startsWith('on')) { if (htmlCompletions.has('on:' + label.slice(2))) { return false; } } item.sortText = 'Z' + (item.sortText || ''); return true; }); } let flattenedCompletions = (0, lodash.flatten)(completions.map((completion) => completion.result.items)); const isIncomplete = completions.reduce((incomplete, completion) => incomplete || completion.result.isIncomplete, false); if (isIncomplete && this.pluginHostConfig.filterIncompleteCompletions) { const offset = document.offsetAt(position); const text = document.getText().substring(Math.max(0, offset - 20), offset); const start = (0, utils$4.regexLastIndexOf)(text, /[\W\s]/g) + 1; const filterValue = text.substring(start).toLowerCase(); flattenedCompletions = flattenedCompletions.filter((comp) => comp.label.toLowerCase().includes(filterValue)); } return main$4.CompletionList.create(flattenedCompletions, isIncomplete); } async resolveCompletion(textDocument, completionItem, cancellationToken) { const document = this.getDocument(textDocument.uri); const result = await this.execute('resolveCompletion', [document, completionItem, cancellationToken], ExecuteMode.FirstNonNull, 'high'); return result !== null && result !== void 0 ? result : completionItem; } async formatDocument(textDocument, options) { const document = this.getDocument(textDocument.uri); return (0, lodash.flatten)(await this.execute('formatDocument', [document, options], ExecuteMode.Collect, 'high')); } async doTagComplete(textDocument, position) { const document = this.getDocument(textDocument.uri); return this.execute('doTagComplete', [document, position], ExecuteMode.FirstNonNull, 'high'); } async getDocumentColors(textDocument) { const document = this.getDocument(textDocument.uri); return (0, lodash.flatten)(await this.execute('getDocumentColors', [document], ExecuteMode.Collect, 'low')); } async getColorPresentations(textDocument, range, color) { const document = this.getDocument(textDocument.uri); return (0, lodash.flatten)(await this.execute('getColorPresentations', [document, range, color], ExecuteMode.Collect, 'high')); } async getDocumentSymbols(textDocument, cancellationToken) { const document = this.getDocument(textDocument.uri); return (0, lodash.flatten)(await this.execute('getDocumentSymbols', [document, cancellationToken], ExecuteMode.Collect, 'low')); } async getDefinitions(textDocument, position) { const document = this.getDocument(textDocument.uri); const definitions = (0, lodash.flatten)(await this.execute('getDefinitions', [document, position], ExecuteMode.Collect, 'high')); if (this.pluginHostConfig.definitionLinkSupport) { return definitions; } else { return definitions.map((def) => ({ range: def.targetSelectionRange, uri: def.targetUri })); } } async getCodeActions(textDocument, range, context, cancellationToken) { const document = this.getDocument(textDocument.uri); return (0, lodash.flatten)(await this.execute('getCodeActions', [document, range, context, cancellationToken], ExecuteMode.Collect, 'high')); } async executeCommand(textDocument, command, args) { const document = this.getDocument(textDocument.uri); return await this.execute('executeCommand', [document, command, args], ExecuteMode.FirstNonNull, 'high'); } async updateImports(fileRename) { return await this.execute('updateImports', [fileRename], ExecuteMode.FirstNonNull, 'high'); } async prepareRename(textDocument, position) { const document = this.getDocument(textDocument.uri); return await this.execute('prepareRename', [document, position], ExecuteMode.FirstNonNull, 'high'); } async rename(textDocument, position, newName) { const document = this.getDocument(textDocument.uri); return await this.execute('rename', [document, position, newName], ExecuteMode.FirstNonNull, 'high'); } async findReferences(textDocument, position, context) { const document = this.getDocument(textDocument.uri); return await this.execute('findReferences', [document, position, context], ExecuteMode.FirstNonNull, 'high'); } async fileReferences(uri) { return await this.execute('fileReferences', [uri], ExecuteMode.FirstNonNull, 'high'); } async findComponentReferences(uri) { return await this.execute('findComponentReferences', [uri], ExecuteMode.FirstNonNull, 'high'); } async getSignatureHelp(textDocument, position, context, cancellationToken) { const document = this.getDocument(textDocument.uri); return await this.execute('getSignatureHelp', [document, position, context, cancellationToken], ExecuteMode.FirstNonNull, 'high'); } async getSelectionRanges(textDocument, positions) { const document = this.getDocument(textDocument.uri); try { return Promise.all(positions.map(async (position) => { var _a; for (const plugin of this.plugins) { const range = await ((_a = plugin.getSelectionRange) === null || _a === void 0 ? void 0 : _a.call(plugin, document, position)); if (range) { return range; } } return main$4.SelectionRange.create(main$4.Range.create(position, position)); })); } catch (error) { logger.Logger.error(error); return null; } } async getSemanticTokens(textDocument, range, cancellationToken) { const document = this.getDocument(textDocument.uri); return await this.execute('getSemanticTokens', [document, range, cancellationToken], ExecuteMode.FirstNonNull, 'low'); } async getLinkedEditingRanges(textDocument, position) { const document = this.getDocument(textDocument.uri); return await this.execute('getLinkedEditingRanges', [document, position], ExecuteMode.FirstNonNull, 'high'); } getImplementation(textDocument, position) { const document = this.getDocument(textDocument.uri); return this.execute('getImplementation', [document, position], ExecuteMode.FirstNonNull, 'high'); } getTypeDefinition(textDocument, position) { const document = this.getDocument(textDocument.uri); return this.execute('getTypeDefinition', [document, position], ExecuteMode.FirstNonNull, 'high'); } onWatchFileChanges(onWatchFileChangesParas) { var _a; for (const support of this.plugins) { (_a = support.onWatchFileChanges) === null || _a === void 0 ? void 0 : _a.call(support, onWatchFileChangesParas); } } updateTsOrJsFile(fileName, changes) { var _a; for (const support of this.plugins) { (_a = support.updateTsOrJsFile) === null || _a === void 0 ? void 0 : _a.call(support, fileName, changes); } } getDocument(uri) { const document = this.documentsManager.get(uri); if (!document) { throw new Error('Cannot call methods on an unopened document'); } return document; } async execute(name, args, mode, priority) { const plugins = this.plugins.filter((plugin) => typeof plugin[name] === 'function'); if (priority === 'low') { const debounce = async () => { const id = Math.random(); this.deferredRequests[name] = [ id, new Promise((resolve, reject) => { setTimeout(() => { if (!this.deferredRequests[name] || this.deferredRequests[name][0] === id) { resolve(); } else { reject(); } }, 1000); }) ]; try { await this.deferredRequests[name][1]; if (!this.deferredRequests[name]) { return debounce(); } return true; } catch (e) { return false; } }; const shouldContinue = await debounce(); if (!shouldContinue) { return; } } switch (mode) { case ExecuteMode.FirstNonNull: for (const plugin of plugins) { const res = await this.tryExecutePlugin(plugin, name, args, null); if (res != null) { return res; } } return null; case ExecuteMode.Collect: return Promise.all(plugins.map((plugin) => this.tryExecutePlugin(plugin, name, args, []))); case ExecuteMode.None: await Promise.all(plugins.map((plugin) => this.tryExecutePlugin(plugin, name, args, null))); return; } } async tryExecutePlugin(plugin, fnName, args, failValue) { try { return await plugin[fnName](...args); } catch (e) { logger.Logger.error(e); return failValue; } } } exports.PluginHost = PluginHost; }); getDefaultExportFromCjs(PluginHost_1); var interfaces = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); }); getDefaultExportFromCjs(interfaces); var plugins = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(CSSPlugin_1, exports); __exportStar(TypeScriptPlugin_1, exports); __exportStar(LSAndTSDocResolver_1, exports); __exportStar(SveltePlugin_1, exports); __exportStar(HTMLPlugin_1, exports); __exportStar(PluginHost_1, exports); __exportStar(interfaces, exports); }); getDefaultExportFromCjs(plugins); var FallbackWatcher_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.FallbackWatcher = void 0; const DELAY = 50; class FallbackWatcher { constructor(glob, workspacePaths) { this.callbacks = []; this.undeliveredFileEvents = []; this.scheduleTrigger = (0, lodash.debounce)(() => { const para = { changes: this.undeliveredFileEvents }; this.undeliveredFileEvents = []; this.callbacks.forEach((callback) => callback(para)); }, DELAY); const gitOrNodeModules = /\.git|node_modules/; this.watcher = (0, chokidar_1__default['default'].watch)(workspacePaths.map((workspacePath) => (0, path__default['default'].join)(workspacePath, glob)), { ignored: (path) => gitOrNodeModules.test(path) && !path.includes('src/node_modules') && !path.includes('src\\node_modules'), ignoreInitial: true, ignorePermissionErrors: true }); this.watcher .on('add', (path) => this.onFSEvent(path, main$4.FileChangeType.Created)) .on('unlink', (path) => this.onFSEvent(path, main$4.FileChangeType.Deleted)) .on('change', (path) => this.onFSEvent(path, main$4.FileChangeType.Changed)); } convert(path, type) { return { type, uri: (0, utils$4.pathToUrl)(path) }; } onFSEvent(path, type) { const fileEvent = this.convert(path, type); this.undeliveredFileEvents.push(fileEvent); this.scheduleTrigger(); } onDidChangeWatchedFiles(callback) { this.callbacks.push(callback); } dispose() { this.watcher.close(); } } exports.FallbackWatcher = FallbackWatcher; }); getDefaultExportFromCjs(FallbackWatcher_1); var FileSystemProvider_1 = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.FileSystemProvider = void 0; class FileSystemProvider { constructor() { this.promisifyStat = (0, util_1__default['default'].promisify)(fs__default['default'].stat); this.promisifyReaddir = (0, util_1__default['default'].promisify)(fs__default['default'].readdir); this.readDirectory = this.readDirectory.bind(this); this.stat = this.stat.bind(this); } async stat(uri) { const path = (0, utils$4.urlToPath)(uri); if (!path) { return this.unknownStat(); } let stat; try { stat = await this.promisifyStat(path); } catch (error) { if (error != null && typeof error === 'object' && 'code' in error && error.code === 'ENOENT') { return { type: vscode_css_languageservice_1.FileType.Unknown, ctime: -1, mtime: -1, size: -1 }; } throw error; } return { ctime: stat.ctimeMs, mtime: stat.mtimeMs, size: stat.size, type: this.getFileType(stat) }; } unknownStat() { return { type: vscode_css_languageservice_1.FileType.Unknown, ctime: -1, mtime: -1, size: -1 }; } getFileType(stat) { return stat.isDirectory() ? vscode_css_languageservice_1.FileType.Directory : stat.isFile() ? vscode_css_languageservice_1.FileType.File : stat.isSymbolicLink() ? vscode_css_languageservice_1.FileType.SymbolicLink : vscode_css_languageservice_1.FileType.Unknown; } async readDirectory(uri) { const path = (0, utils$4.urlToPath)(uri); if (!path) { return []; } const files = await this.promisifyReaddir(path, { withFileTypes: true }); return files.map((file) => [file.name, this.getFileType(file)]); } } exports.FileSystemProvider = FileSystemProvider; }); getDefaultExportFromCjs(FileSystemProvider_1); var server = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.startServer = void 0; var TagCloseRequest; (function (TagCloseRequest) { TagCloseRequest.type = new main$4.RequestType('html/tag'); })(TagCloseRequest || (TagCloseRequest = {})); function startServer(options) { let connection = options === null || options === void 0 ? void 0 : options.connection; if (!connection) { if (process.argv.includes('--stdio')) { console.log = (...args) => { console.warn(...args); }; connection = (0, node$1.createConnection)(process.stdin, process.stdout); } else { connection = (0, node$1.createConnection)(new node$1.IPCMessageReader(process), new node$1.IPCMessageWriter(process)); } } if ((options === null || options === void 0 ? void 0 : options.logErrorsOnly) !== undefined) { logger.Logger.setLogErrorsOnly(options.logErrorsOnly); } const docManager = new documents.DocumentManager((textDocument) => new documents.Document(textDocument.uri, textDocument.text)); const configManager = new lsConfig.LSConfigManager(); const pluginHost = new plugins.PluginHost(docManager); let sveltePlugin = undefined; let watcher; connection.onInitialize((evt) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10; const workspaceUris = (_b = (_a = evt.workspaceFolders) === null || _a === void 0 ? void 0 : _a.map((folder) => folder.uri.toString())) !== null && _b !== void 0 ? _b : [ (_c = evt.rootUri) !== null && _c !== void 0 ? _c : '' ]; logger.Logger.log('Initialize language server at ', workspaceUris.join(', ')); if (workspaceUris.length === 0) { logger.Logger.error('No workspace path set'); } if (!((_d = evt.capabilities.workspace) === null || _d === void 0 ? void 0 : _d.didChangeWatchedFiles)) { const workspacePaths = workspaceUris.map(utils$4.urlToPath).filter(utils$4.isNotNullOrUndefined); watcher = new FallbackWatcher_1.FallbackWatcher('**/*.{ts,js}', workspacePaths); watcher.onDidChangeWatchedFiles(onDidChangeWatchedFiles); } const isTrusted = (_f = (_e = evt.initializationOptions) === null || _e === void 0 ? void 0 : _e.isTrusted) !== null && _f !== void 0 ? _f : true; configLoader.configLoader.setDisabled(!isTrusted); (0, importPackage.setIsTrusted)(isTrusted); configManager.updateIsTrusted(isTrusted); if (!isTrusted) { logger.Logger.log('Workspace is not trusted, running with reduced capabilities.'); } configManager.update(((_j = (_h = (_g = evt.initializationOptions) === null || _g === void 0 ? void 0 : _g.configuration) === null || _h === void 0 ? void 0 : _h.svelte) === null || _j === void 0 ? void 0 : _j.plugin) || ((_k = evt.initializationOptions) === null || _k === void 0 ? void 0 : _k.config) || {}); configManager.updateTsJsUserPreferences(((_l = evt.initializationOptions) === null || _l === void 0 ? void 0 : _l.configuration) || ((_m = evt.initializationOptions) === null || _m === void 0 ? void 0 : _m.typescriptConfig) || {}); configManager.updateEmmetConfig(((_p = (_o = evt.initializationOptions) === null || _o === void 0 ? void 0 : _o.configuration) === null || _p === void 0 ? void 0 : _p.emmet) || ((_q = evt.initializationOptions) === null || _q === void 0 ? void 0 : _q.emmetConfig) || {}); configManager.updatePrettierConfig(((_s = (_r = evt.initializationOptions) === null || _r === void 0 ? void 0 : _r.configuration) === null || _s === void 0 ? void 0 : _s.prettier) || ((_t = evt.initializationOptions) === null || _t === void 0 ? void 0 : _t.prettierConfig) || {}); configManager.updateCssConfig((_v = (_u = evt.initializationOptions) === null || _u === void 0 ? void 0 : _u.configuration) === null || _v === void 0 ? void 0 : _v.css); configManager.updateScssConfig((_x = (_w = evt.initializationOptions) === null || _w === void 0 ? void 0 : _w.configuration) === null || _x === void 0 ? void 0 : _x.scss); configManager.updateLessConfig((_z = (_y = evt.initializationOptions) === null || _y === void 0 ? void 0 : _y.configuration) === null || _z === void 0 ? void 0 : _z.less); pluginHost.initialize({ filterIncompleteCompletions: !((_0 = evt.initializationOptions) === null || _0 === void 0 ? void 0 : _0.dontFilterIncompleteCompletions), definitionLinkSupport: !!((_2 = (_1 = evt.capabilities.textDocument) === null || _1 === void 0 ? void 0 : _1.definition) === null || _2 === void 0 ? void 0 : _2.linkSupport) }); pluginHost.register((sveltePlugin = new plugins.SveltePlugin(configManager))); pluginHost.register(new plugins.HTMLPlugin(docManager, configManager)); const cssLanguageServices = (0, service.createLanguageServices)({ clientCapabilities: evt.capabilities, fileSystemProvider: new FileSystemProvider_1.FileSystemProvider() }); const workspaceFolders = (_3 = evt.workspaceFolders) !== null && _3 !== void 0 ? _3 : [{ name: '', uri: (_4 = evt.rootUri) !== null && _4 !== void 0 ? _4 : '' }]; pluginHost.register(new plugins.CSSPlugin(docManager, configManager, workspaceFolders, cssLanguageServices)); pluginHost.register(new plugins.TypeScriptPlugin(configManager, new plugins.LSAndTSDocResolver(docManager, workspaceUris.map(utils$4.normalizeUri), configManager, { notifyExceedSizeLimit: notifyTsServiceExceedSizeLimit, onProjectReloaded: updateAllDiagnostics, watchTsConfig: true }))); const clientSupportApplyEditCommand = !!((_5 = evt.capabilities.workspace) === null || _5 === void 0 ? void 0 : _5.applyEdit); const clientCodeActionCapabilities = (_6 = evt.capabilities.textDocument) === null || _6 === void 0 ? void 0 : _6.codeAction; const clientSupportedCodeActionKinds = (_7 = clientCodeActionCapabilities === null || clientCodeActionCapabilities === void 0 ? void 0 : clientCodeActionCapabilities.codeActionLiteralSupport) === null || _7 === void 0 ? void 0 : _7.codeActionKind.valueSet; return { capabilities: { textDocumentSync: { openClose: true, change: main$4.TextDocumentSyncKind.Incremental, save: { includeText: false } }, hoverProvider: true, completionProvider: { resolveProvider: true, triggerCharacters: [ '.', '"', "'", '`', '/', '@', '<', '>', '*', '#', '$', '+', '^', '(', '[', '@', '-', ':', '|' ] }, documentFormattingProvider: true, colorProvider: true, documentSymbolProvider: true, definitionProvider: true, codeActionProvider: (clientCodeActionCapabilities === null || clientCodeActionCapabilities === void 0 ? void 0 : clientCodeActionCapabilities.codeActionLiteralSupport) ? { codeActionKinds: [ main$4.CodeActionKind.QuickFix, main$4.CodeActionKind.SourceOrganizeImports, CodeActionsProvider.SORT_IMPORT_CODE_ACTION_KIND, ...(clientSupportApplyEditCommand ? [main$4.CodeActionKind.Refactor] : []) ].filter(clientSupportedCodeActionKinds && ((_8 = evt.initializationOptions) === null || _8 === void 0 ? void 0 : _8.shouldFilterCodeActionKind) ? (kind) => clientSupportedCodeActionKinds.includes(kind) : () => true) } : true, executeCommandProvider: clientSupportApplyEditCommand ? { commands: [ 'function_scope_0', 'function_scope_1', 'function_scope_2', 'function_scope_3', 'constant_scope_0', 'constant_scope_1', 'constant_scope_2', 'constant_scope_3', 'extract_to_svelte_component', 'Infer function return type' ] } : undefined, renameProvider: ((_10 = (_9 = evt.capabilities.textDocument) === null || _9 === void 0 ? void 0 : _9.rename) === null || _10 === void 0 ? void 0 : _10.prepareSupport) ? { prepareProvider: true } : true, referencesProvider: true, selectionRangeProvider: true, signatureHelpProvider: { triggerCharacters: ['(', ',', '<'], retriggerCharacters: [')'] }, semanticTokensProvider: { legend: (0, semanticTokenLegend.getSemanticTokenLegends)(), range: true, full: true }, linkedEditingRangeProvider: true, implementationProvider: true, typeDefinitionProvider: true } }; }); function notifyTsServiceExceedSizeLimit() { connection === null || connection === void 0 ? void 0 : connection.sendNotification(main$4.ShowMessageNotification.type, { message: 'Svelte language server detected a large amount of JS/Svelte files. ' + 'To enable project-wide JavaScript/TypeScript language features for Svelte files,' + 'exclude large folders in the tsconfig.json or jsconfig.json with source files that you do not work on.', type: main$4.MessageType.Warning }); } connection.onExit(() => { watcher === null || watcher === void 0 ? void 0 : watcher.dispose(); }); connection.onRenameRequest((req) => pluginHost.rename(req.textDocument, req.position, req.newName)); connection.onPrepareRename((req) => pluginHost.prepareRename(req.textDocument, req.position)); connection.onDidChangeConfiguration(({ settings }) => { var _a; configManager.update((_a = settings.svelte) === null || _a === void 0 ? void 0 : _a.plugin); configManager.updateTsJsUserPreferences(settings); configManager.updateEmmetConfig(settings.emmet); configManager.updatePrettierConfig(settings.prettier); configManager.updateCssConfig(settings.css); configManager.updateScssConfig(settings.scss); configManager.updateLessConfig(settings.less); }); connection.onDidOpenTextDocument((evt) => { docManager.openDocument(evt.textDocument); docManager.markAsOpenedInClient(evt.textDocument.uri); }); connection.onDidCloseTextDocument((evt) => docManager.closeDocument(evt.textDocument.uri)); connection.onDidChangeTextDocument((evt) => { docManager.updateDocument(evt.textDocument, evt.contentChanges); pluginHost.didUpdateDocument(); }); connection.onHover((evt) => pluginHost.doHover(evt.textDocument, evt.position)); connection.onCompletion((evt, cancellationToken) => pluginHost.getCompletions(evt.textDocument, evt.position, evt.context, cancellationToken)); connection.onDocumentFormatting((evt) => pluginHost.formatDocument(evt.textDocument, evt.options)); connection.onRequest(TagCloseRequest.type, (evt) => pluginHost.doTagComplete(evt.textDocument, evt.position)); connection.onDocumentColor((evt) => pluginHost.getDocumentColors(evt.textDocument)); connection.onColorPresentation((evt) => pluginHost.getColorPresentations(evt.textDocument, evt.range, evt.color)); connection.onDocumentSymbol((evt, cancellationToken) => pluginHost.getDocumentSymbols(evt.textDocument, cancellationToken)); connection.onDefinition((evt) => pluginHost.getDefinitions(evt.textDocument, evt.position)); connection.onReferences((evt) => pluginHost.findReferences(evt.textDocument, evt.position, evt.context)); connection.onCodeAction((evt, cancellationToken) => pluginHost.getCodeActions(evt.textDocument, evt.range, evt.context, cancellationToken)); connection.onExecuteCommand(async (evt) => { var _a; const result = await pluginHost.executeCommand({ uri: (_a = evt.arguments) === null || _a === void 0 ? void 0 : _a[0] }, evt.command, evt.arguments); if (main$4.WorkspaceEdit.is(result)) { const edit = { edit: result }; connection === null || connection === void 0 ? void 0 : connection.sendRequest(main$4.ApplyWorkspaceEditRequest.type.method, edit); } else if (result) { connection === null || connection === void 0 ? void 0 : connection.sendNotification(main$4.ShowMessageNotification.type.method, { message: result, type: main$4.MessageType.Error }); } }); connection.onCompletionResolve((completionItem, cancellationToken) => { const data = completionItem.data; if (!data) { return completionItem; } return pluginHost.resolveCompletion(data, completionItem, cancellationToken); }); connection.onSignatureHelp((evt, cancellationToken) => pluginHost.getSignatureHelp(evt.textDocument, evt.position, evt.context, cancellationToken)); connection.onSelectionRanges((evt) => pluginHost.getSelectionRanges(evt.textDocument, evt.positions)); connection.onImplementation((evt) => pluginHost.getImplementation(evt.textDocument, evt.position)); connection.onTypeDefinition((evt) => pluginHost.getTypeDefinition(evt.textDocument, evt.position)); const diagnosticsManager = new DiagnosticsManager_1.DiagnosticsManager(connection.sendDiagnostics, docManager, pluginHost.getDiagnostics.bind(pluginHost)); const updateAllDiagnostics = (0, utils$4.debounceThrottle)(() => diagnosticsManager.updateAll(), 1000); connection.onDidChangeWatchedFiles(onDidChangeWatchedFiles); function onDidChangeWatchedFiles(para) { const onWatchFileChangesParas = para.changes .map((change) => ({ fileName: (0, utils$4.urlToPath)(change.uri), changeType: change.type })) .filter((change) => !!change.fileName); pluginHost.onWatchFileChanges(onWatchFileChangesParas); updateAllDiagnostics(); } connection.onDidSaveTextDocument(updateAllDiagnostics); connection.onNotification('$/onDidChangeTsOrJsFile', async (e) => { const path = (0, utils$4.urlToPath)(e.uri); if (path) { pluginHost.updateTsOrJsFile(path, e.changes); } updateAllDiagnostics(); }); connection.onRequest(main$4.SemanticTokensRequest.type, (evt, cancellationToken) => pluginHost.getSemanticTokens(evt.textDocument, undefined, cancellationToken)); connection.onRequest(main$4.SemanticTokensRangeRequest.type, (evt, cancellationToken) => pluginHost.getSemanticTokens(evt.textDocument, evt.range, cancellationToken)); connection.onRequest(main$4.LinkedEditingRangeRequest.type, async (evt) => await pluginHost.getLinkedEditingRanges(evt.textDocument, evt.position)); docManager.on('documentChange', (0, utils$4.debounceThrottle)(async (document) => diagnosticsManager.update(document), 750)); docManager.on('documentClose', (document) => diagnosticsManager.removeDiagnostics(document)); connection.onRequest('$/getEditsForFileRename', async (fileRename) => pluginHost.updateImports(fileRename)); connection.onRequest('$/getFileReferences', async (uri) => { return pluginHost.fileReferences(uri); }); connection.onRequest('$/getComponentReferences', async (uri) => { return pluginHost.findComponentReferences(uri); }); connection.onRequest('$/getCompiledCode', async (uri) => { const doc = docManager.get(uri); if (!doc) { return null; } if (doc) { const compiled = await sveltePlugin.getCompiledResult(doc); if (compiled) { const js = compiled.js; const css = compiled.css; return { js, css }; } else { return null; } } }); connection.listen(); } exports.startServer = startServer; }); getDefaultExportFromCjs(server); var svelteCheck = createCommonjsModule(function (module, exports) { var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SvelteCheck = void 0; const typescript_1 = __importDefault(ts__default__default['default']); class SvelteCheck { constructor(workspacePath, options = {}) { this.options = options; this.docManager = new documents.DocumentManager((textDocument) => new documents.Document(textDocument.uri, textDocument.text)); this.configManager = new lsConfig.LSConfigManager(); this.pluginHost = new plugins.PluginHost(this.docManager); logger.Logger.setLogErrorsOnly(true); this.initialize(workspacePath, options); } async initialize(workspacePath, options) { var _a; if (options.tsconfig && !(0, path__default['default'].isAbsolute)(options.tsconfig)) { throw new Error('tsconfigPath needs to be absolute, got ' + options.tsconfig); } this.configManager.update({ svelte: { compilerWarnings: options.compilerWarnings, useNewTransformation: (_a = options.useNewTransformation) !== null && _a !== void 0 ? _a : false } }); if (shouldRegister('svelte')) { this.pluginHost.register(new plugins.SveltePlugin(this.configManager)); } if (shouldRegister('css')) { const services = (0, service.createLanguageServices)({ fileSystemProvider: new FileSystemProvider_1.FileSystemProvider() }); const workspaceFolders = [ { name: '', uri: (0, utils$4.pathToUrl)(workspacePath) } ]; this.pluginHost.register(new plugins.CSSPlugin(this.docManager, this.configManager, workspaceFolders, services)); } if (shouldRegister('js') || options.tsconfig) { this.lsAndTSDocResolver = new plugins.LSAndTSDocResolver(this.docManager, [(0, utils$4.pathToUrl)(workspacePath)], this.configManager, { tsconfigPath: options.tsconfig, isSvelteCheck: true, onProjectReloaded: options.onProjectReload, watchTsConfig: options.watch }); this.pluginHost.register(new plugins.TypeScriptPlugin(this.configManager, this.lsAndTSDocResolver)); } function shouldRegister(source) { return !options.diagnosticSources || options.diagnosticSources.includes(source); } } async upsertDocument(doc, isNew) { const filePath = (0, utils$4.urlToPath)(doc.uri) || ''; if (isNew && this.options.tsconfig) { const lsContainer = await this.getLSContainer(this.options.tsconfig); if (!lsContainer.fileBelongsToProject(filePath)) { return; } } if (doc.uri.endsWith('.ts') || doc.uri.endsWith('.js')) { this.pluginHost.updateTsOrJsFile(filePath, [ { range: main$4.Range.create(main$4.Position.create(0, 0), main$4.Position.create(Number.MAX_VALUE, Number.MAX_VALUE)), text: doc.text } ]); } else { this.docManager.openDocument({ text: doc.text, uri: doc.uri }); this.docManager.markAsOpenedInClient(doc.uri); } } async removeDocument(uri) { if (!this.docManager.get(uri)) { return; } this.docManager.closeDocument(uri); this.docManager.releaseDocument(uri); if (this.options.tsconfig) { const lsContainer = await this.getLSContainer(this.options.tsconfig); lsContainer.deleteSnapshot((0, utils$4.urlToPath)(uri) || ''); } } async getDiagnostics() { if (this.options.tsconfig) { return this.getDiagnosticsForTsconfig(this.options.tsconfig); } return await Promise.all(this.docManager.getAllOpenedByClient().map(async (doc) => { const uri = doc[1].uri; return await this.getDiagnosticsForFile(uri); })); } async getDiagnosticsForTsconfig(tsconfigPath) { var _a, _b; const lsContainer = await this.getLSContainer(tsconfigPath); const lang = lsContainer.getService(); const files = ((_a = lang.getProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFiles()) || []; const options = ((_b = lang.getProgram()) === null || _b === void 0 ? void 0 : _b.getCompilerOptions()) || {}; return await Promise.all(files.map((file) => { const uri = (0, utils$4.pathToUrl)(file.fileName); const doc = this.docManager.get(uri); if (doc) { this.docManager.markAsOpenedInClient(uri); return this.getDiagnosticsForFile(uri); } else { const skipDiagnosticsForFile = (options.skipLibCheck && file.isDeclarationFile) || (options.skipDefaultLibCheck && file.hasNoDefaultLib) || /\/node_modules\/.+\.(c|m)?js$/.test(file.fileName); const diagnostics = skipDiagnosticsForFile ? [] : [ ...lang.getSyntacticDiagnostics(file.fileName), ...lang.getSuggestionDiagnostics(file.fileName), ...lang.getSemanticDiagnostics(file.fileName) ].map((diagnostic) => ({ range: (0, utils$2.convertRange)({ positionAt: file.getLineAndCharacterOfPosition.bind(file) }, diagnostic), severity: (0, utils$2.mapSeverity)(diagnostic.category), source: diagnostic.source, message: typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, '\n'), code: diagnostic.code, tags: (0, utils$2.getDiagnosticTag)(diagnostic) })); return { filePath: file.fileName, text: file.text, diagnostics }; } })); } async getDiagnosticsForFile(uri) { var _a; const diagnostics = await this.pluginHost.getDiagnostics({ uri }); return { filePath: (0, utils$4.urlToPath)(uri) || '', text: ((_a = this.docManager.get(uri)) === null || _a === void 0 ? void 0 : _a.getText()) || '', diagnostics }; } getLSContainer(tsconfigPath) { if (!this.lsAndTSDocResolver) { throw new Error('Cannot run with tsconfig path without LS/TSdoc resolver'); } return this.lsAndTSDocResolver.getTSService(tsconfigPath); } } exports.SvelteCheck = SvelteCheck; }); getDefaultExportFromCjs(svelteCheck); var src = createCommonjsModule(function (module, exports) { var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SvelteCheck = exports.offsetAt = void 0; __exportStar(server, exports); Object.defineProperty(exports, "offsetAt", { enumerable: true, get: function () { return documents.offsetAt; } }); Object.defineProperty(exports, "SvelteCheck", { enumerable: true, get: function () { return svelteCheck.SvelteCheck; } }); }); getDefaultExportFromCjs(src); // eslint-disable max-len function parseOptions(cb) { const prog = sade__default['default']('svelte-check', true) .version('2.x') .option('--workspace', 'Path to your workspace. All subdirectories except node_modules and those listed in `--ignore` are checked') .option('--output', 'What output format to use. Options are human, human-verbose, machine.', 'human-verbose') .option('--watch', 'Will not exit after one pass but keep watching files for changes and rerun diagnostics', false) .option('--tsconfig', 'Pass a path to a tsconfig or jsconfig file. The path can be relative to the workspace path or absolute. Doing this means that only files matched by the files/include/exclude pattern of the config file are diagnosed. It also means that errors from TypeScript and JavaScript files are reported.') .option('--ignore', 'Files/folders to ignore - relative to workspace root, comma-separated, inside quotes. Example: `--ignore "dist,build"`') .option('--fail-on-warnings', 'Will also exit with error code when there are warnings', false) .option('--fail-on-hints', 'Will also exit with error code when there are hints', false) .option('--compiler-warnings', 'A list of Svelte compiler warning codes. Each entry defines whether that warning should be ignored or treated as an error. Warnings are comma-separated, between warning code and error level is a colon; all inside quotes. Example: `--compiler-warnings "css-unused-selector:ignore,unused-export-let:error"`') .option('--diagnostic-sources', 'A list of diagnostic sources which should run diagnostics on your code. Possible values are `js` (includes TS), `svelte`, `css`. Comma-separated, inside quotes. By default all are active. Example: `--diagnostic-sources "js,svelte"`') .option('--threshold', 'Filters the diagnostics to display. `error` will output only errors while `warning` will output warnings and errors.', 'hint') .option('--use-new-transformation', 'Svelte files need to be transformed to something that TypeScript understands for intellisense. Version 2.0 of this transformation can be enabled with this setting. It will be the default, soon.', false) .action((opts) => { const workspaceUri = getWorkspaceUri(opts); cb({ workspaceUri, outputFormat: getOutputFormat(opts), watch: !!opts.watch, tsconfig: getTsconfig(opts, workspaceUri.fsPath), filePathsToIgnore: getFilepathsToIgnore(opts), failOnWarnings: !!opts['fail-on-warnings'], failOnHints: !!opts['fail-on-hints'], compilerWarnings: getCompilerWarnings(opts), diagnosticSources: getDiagnosticSources(opts), threshold: getThreshold(opts), useNewTransformation: opts['use-new-transformation'] && opts['use-new-transformation'] !== 'false' }); }); prog.parse(process.argv); } // eslint-enable max-len const outputFormats = ['human', 'human-verbose', 'machine']; function getOutputFormat(opts) { return outputFormats.includes(opts.output) ? opts.output : 'human-verbose'; } function getWorkspaceUri(opts) { let workspaceUri; let workspacePath = opts.workspace; if (workspacePath) { if (!path__namespace.isAbsolute(workspacePath)) { workspacePath = path__namespace.resolve(process.cwd(), workspacePath); } workspaceUri = URI$1.file(workspacePath); } else { workspaceUri = URI$1.file(process.cwd()); } return workspaceUri; } function getTsconfig(myArgs, workspacePath) { let tsconfig = myArgs.tsconfig; if (tsconfig && !path__namespace.isAbsolute(tsconfig)) { tsconfig = path__namespace.join(workspacePath, tsconfig); } return tsconfig; } function getCompilerWarnings(opts) { return stringToObj(opts['compiler-warnings']); function stringToObj(str = '') { return str .split(',') .map((s) => s.trim()) .filter((s) => !!s) .reduce((settings, setting) => { const [name, val] = setting.split(':'); if (val === 'error' || val === 'ignore') { settings[name] = val; } return settings; }, {}); } } const diagnosticSources = ['js', 'css', 'svelte']; function getDiagnosticSources(opts) { var _a; const sources = opts['diagnostic-sources']; return sources ? (_a = sources .split(',')) === null || _a === void 0 ? void 0 : _a.map((s) => s.trim()).filter((s) => diagnosticSources.includes(s)) : diagnosticSources; } function getFilepathsToIgnore(opts) { var _a; return ((_a = opts.ignore) === null || _a === void 0 ? void 0 : _a.split(',')) || []; } const thresholds = ['hint', 'warning', 'error']; function getThreshold(opts) { return thresholds.includes(opts.threshold) ? opts.threshold : 'hint'; } const DEFAULT_FILTER = () => true; class HumanFriendlyWriter { constructor(stream, isVerbose = true, isWatchMode = false, diagnosticFilter = DEFAULT_FILTER) { this.stream = stream; this.isVerbose = isVerbose; this.isWatchMode = isWatchMode; this.diagnosticFilter = diagnosticFilter; } start(workspaceDir) { if (process.stdout.isTTY && this.isWatchMode) { // Clear screen const blank = '\n'.repeat(process.stdout.rows); this.stream.write(blank); process.stdout.cursorTo(0, 0); process.stdout.clearScreenDown(); } if (this.isVerbose) { this.stream.write('\n'); this.stream.write('====================================\n'); this.stream.write(`Loading svelte-check in workspace: ${workspaceDir}`); this.stream.write('\n'); this.stream.write('Getting Svelte diagnostics...\n'); this.stream.write('\n'); } } file(diagnostics, workspaceDir, filename, text) { diagnostics.filter(this.diagnosticFilter).forEach((diagnostic) => { const source = diagnostic.source ? `(${diagnostic.source})` : ''; // Display location in a format that IDEs will turn into file links const { line, character } = diagnostic.range.start; // eslint-disable-next-line max-len this.stream.write(`${workspaceDir}${path.sep}${pc__default['default'].green(filename)}:${line + 1}:${character + 1}\n`); // Show some context around diagnostic range const codePrevLine = this.getLine(diagnostic.range.start.line - 1, text); const codeLine = this.getCodeLine(diagnostic, text); const codeNextLine = this.getLine(diagnostic.range.end.line + 1, text); const code = codePrevLine + codeLine + codeNextLine; let msg; if (this.isVerbose) { msg = `${diagnostic.message} ${source}\n${pc__default['default'].cyan(code)}`; } else { msg = `${diagnostic.message} ${source}`; } if (diagnostic.severity === main.DiagnosticSeverity.Error) { this.stream.write(`${pc__default['default'].red('Error')}: ${msg}\n`); } else if (diagnostic.severity === main.DiagnosticSeverity.Warning) { this.stream.write(`${pc__default['default'].yellow('Warn')}: ${msg}\n`); } else { this.stream.write(`${pc__default['default'].gray('Hint')}: ${msg}\n`); } this.stream.write('\n'); }); } getCodeLine(diagnostic, text) { const startOffset = src.offsetAt(diagnostic.range.start, text); const endOffset = src.offsetAt(diagnostic.range.end, text); const codePrev = text.substring(src.offsetAt({ line: diagnostic.range.start.line, character: 0 }, text), startOffset); const codeHighlight = pc__default['default'].magenta(text.substring(startOffset, endOffset)); const codePost = text.substring(endOffset, src.offsetAt({ line: diagnostic.range.end.line, character: Number.MAX_SAFE_INTEGER }, text)); return codePrev + codeHighlight + codePost; } getLine(line, text) { return text.substring(src.offsetAt({ line, character: 0 }, text), src.offsetAt({ line, character: Number.MAX_SAFE_INTEGER }, text)); } completion(_f, errorCount, warningCount, hintCount) { this.stream.write('====================================\n'); const message = [ 'svelte-check found ', `${errorCount} ${errorCount === 1 ? 'error' : 'errors'}, `, `${warningCount} ${warningCount === 1 ? 'warning' : 'warnings'}, and `, `${hintCount} ${hintCount === 1 ? 'hint' : 'hints'}\n` ].join(''); if (errorCount !== 0) { this.stream.write(pc__default['default'].red(message)); } else if (warningCount !== 0) { this.stream.write(pc__default['default'].yellow(message)); } else if (hintCount !== 0) { this.stream.write(pc__default['default'].gray(message)); } else { this.stream.write(pc__default['default'].green(message)); } if (this.isWatchMode) { this.stream.write('Watching for file changes...'); } } failure(err) { this.stream.write(`${err}\n`); } } class MachineFriendlyWriter { constructor(stream, diagnosticFilter = DEFAULT_FILTER) { this.stream = stream; this.diagnosticFilter = diagnosticFilter; } log(msg) { this.stream.write(`${new Date().getTime()} ${msg}\n`); } start(workspaceDir) { this.log(`START ${JSON.stringify(workspaceDir)}`); } file(diagnostics, workspaceDir, filename, _text) { diagnostics.filter(this.diagnosticFilter).forEach((d) => { const { message, severity, range } = d; const type = severity === main.DiagnosticSeverity.Error ? 'ERROR' : severity === main.DiagnosticSeverity.Warning ? 'WARNING' : null; if (type) { const { line, character } = range.start; const fn = JSON.stringify(filename); const msg = JSON.stringify(message); this.log(`${type} ${fn} ${line + 1}:${character + 1} ${msg}`); } }); } completion(fileCount, errorCount, warningCount, hintCount) { this.log([ 'COMPLETED', `${fileCount} FILES`, `${errorCount} ERRORS`, `${warningCount} WARNINGS`, `${hintCount} HINTS` ].join(' ')); } failure(err) { this.log(`FAILURE ${JSON.stringify(err.message)}`); } } /** * This code's groundwork is taken from https://github.com/vuejs/vetur/tree/master/vti */ async function openAllDocuments(workspaceUri, filePathsToIgnore, svelteCheck) { const files = await out('**/*.svelte', { cwd: workspaceUri.fsPath, ignore: ['node_modules/**'].concat(filePathsToIgnore.map((ignore) => `${ignore}/**`)) }); const absFilePaths = files.map((f) => path__namespace.resolve(workspaceUri.fsPath, f)); for (const absFilePath of absFilePaths) { const text = fs__namespace.readFileSync(absFilePath, 'utf-8'); svelteCheck.upsertDocument({ uri: URI$1.file(absFilePath).toString(), text }, true); } } async function getDiagnostics(workspaceUri, writer, svelteCheck) { writer.start(workspaceUri.fsPath); try { const diagnostics = await svelteCheck.getDiagnostics(); const result = { fileCount: diagnostics.length, errorCount: 0, warningCount: 0, hintCount: 0 }; for (const diagnostic of diagnostics) { writer.file(diagnostic.diagnostics, workspaceUri.fsPath, path__namespace.relative(workspaceUri.fsPath, diagnostic.filePath), diagnostic.text); diagnostic.diagnostics.forEach((d) => { if (d.severity === main.DiagnosticSeverity.Error) { result.errorCount += 1; } else if (d.severity === main.DiagnosticSeverity.Warning) { result.warningCount += 1; } else if (d.severity === main.DiagnosticSeverity.Hint) { result.hintCount += 1; } }); } writer.completion(result.fileCount, result.errorCount, result.warningCount, result.hintCount); return result; } catch (err) { writer.failure(err); return null; } } class DiagnosticsWatcher { constructor(workspaceUri, svelteCheck, writer, filePathsToIgnore, ignoreInitialAdd) { this.workspaceUri = workspaceUri; this.svelteCheck = svelteCheck; this.writer = writer; chokidar_1.watch(`${workspaceUri.fsPath}/**/*.{svelte,d.ts,ts,js}`, { ignored: ['node_modules'] .concat(filePathsToIgnore) .map((ignore) => path__namespace.join(workspaceUri.fsPath, ignore)), ignoreInitial: ignoreInitialAdd }) .on('add', (path) => this.updateDocument(path, true)) .on('unlink', (path) => this.removeDocument(path)) .on('change', (path) => this.updateDocument(path, false)); if (ignoreInitialAdd) { this.scheduleDiagnostics(); } } async updateDocument(path, isNew) { const text = fs__namespace.readFileSync(path, 'utf-8'); await this.svelteCheck.upsertDocument({ text, uri: URI$1.file(path).toString() }, isNew); this.scheduleDiagnostics(); } async removeDocument(path) { await this.svelteCheck.removeDocument(URI$1.file(path).toString()); this.scheduleDiagnostics(); } scheduleDiagnostics() { clearTimeout(this.updateDiagnostics); this.updateDiagnostics = setTimeout(() => getDiagnostics(this.workspaceUri, this.writer, this.svelteCheck), 1000); } } function createFilter(opts) { switch (opts.threshold) { case 'error': return (d) => d.severity === main.DiagnosticSeverity.Error; case 'warning': return (d) => d.severity === main.DiagnosticSeverity.Error || d.severity === main.DiagnosticSeverity.Warning; default: return DEFAULT_FILTER; } } function instantiateWriter(opts) { const filter = createFilter(opts); if (opts.outputFormat === 'human-verbose' || opts.outputFormat === 'human') { return new HumanFriendlyWriter(process.stdout, opts.outputFormat === 'human-verbose', opts.watch, filter); } else { return new MachineFriendlyWriter(process.stdout, filter); } } parseOptions(async (opts) => { try { const writer = instantiateWriter(opts); const svelteCheckOptions = { compilerWarnings: opts.compilerWarnings, diagnosticSources: opts.diagnosticSources, tsconfig: opts.tsconfig, useNewTransformation: opts.useNewTransformation, watch: opts.watch }; if (opts.watch) { svelteCheckOptions.onProjectReload = () => watcher.scheduleDiagnostics(); const watcher = new DiagnosticsWatcher(opts.workspaceUri, new src.SvelteCheck(opts.workspaceUri.fsPath, svelteCheckOptions), writer, opts.filePathsToIgnore, !!opts.tsconfig); } else { const svelteCheck = new src.SvelteCheck(opts.workspaceUri.fsPath, svelteCheckOptions); if (!opts.tsconfig) { await openAllDocuments(opts.workspaceUri, opts.filePathsToIgnore, svelteCheck); } const result = await getDiagnostics(opts.workspaceUri, writer, svelteCheck); if (result && result.errorCount === 0 && (!opts.failOnWarnings || result.warningCount === 0) && (!opts.failOnHints || result.hintCount === 0)) { process.exit(0); } else { process.exit(1); } } } catch (_err) { console.error(_err); console.error('svelte-check failed'); } });