mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-12 11:30:01 -04:00
30145 lines
No EOL
1.2 MiB
30145 lines
No EOL
1.2 MiB
/******/ (() => { // webpackBootstrap
|
||
/******/ var __webpack_modules__ = ([
|
||
/* 0 */,
|
||
/* 1 */
|
||
/***/ ((module) => {
|
||
|
||
function createDocumentRewriter(ctx) {
|
||
return function rewriteDocument() {
|
||
if (ctx.serviceWorker) return;
|
||
const {
|
||
HTMLMediaElement,
|
||
HTMLScriptElement,
|
||
HTMLAudioElement,
|
||
HTMLVideoElement,
|
||
HTMLInputElement,
|
||
HTMLEmbedElement,
|
||
HTMLTrackElement,
|
||
HTMLAnchorElement,
|
||
HTMLIFrameElement,
|
||
HTMLAreaElement,
|
||
HTMLLinkElement,
|
||
HTMLBaseElement,
|
||
HTMLFormElement,
|
||
HTMLImageElement,
|
||
HTMLSourceElement,
|
||
} = ctx.window;
|
||
const cookie = Object.getOwnPropertyDescriptor(ctx.window.Document.prototype, 'cookie');
|
||
const domain = Object.getOwnPropertyDescriptor(ctx.window.Document.prototype, 'domain');
|
||
const title = Object.getOwnPropertyDescriptor(ctx.window.Document.prototype, 'title');
|
||
const baseURI = Object.getOwnPropertyDescriptor(ctx.window.Node.prototype, 'baseURI');
|
||
const cookieEnabled = Object.getOwnPropertyDescriptor(ctx.window.Navigator.prototype, 'cookieEnabled');
|
||
let spoofTitle = '';
|
||
let spoofDomain = ctx.location.hostname;
|
||
|
||
if (ctx.window.Document.prototype.write) {
|
||
ctx.window.Document.prototype.write = new Proxy(ctx.window.Document.prototype.write, {
|
||
apply: (target, that , args) => {
|
||
if (args.length) args = [ ctx.html.process(args.join(''), ctx.meta) ];
|
||
return Reflect.apply(target, that, args);
|
||
},
|
||
});
|
||
};
|
||
if (ctx.window.Document.prototype.hasOwnProperty('cookie')) {
|
||
Object.defineProperty(ctx.window.Document.prototype, 'cookie', {
|
||
get: new Proxy(cookie.get, {
|
||
apply: (target, that, args) => {
|
||
const cookies = Reflect.apply(target, that, args);
|
||
return ctx.config.cookie ? ctx.cookies.decode(cookies, ctx.meta) : '';
|
||
},
|
||
}),
|
||
set: new Proxy(cookie.set, {
|
||
apply: (target, that, [ val ]) => {
|
||
return Reflect.apply(target, that, [ ctx.config.cookie ? ctx.cookies.encode(val, ctx.meta) : '' ]);
|
||
},
|
||
}),
|
||
});
|
||
};
|
||
if (ctx.window.Document.prototype.writeln) {
|
||
ctx.window.Document.prototype.writeln = new Proxy(ctx.window.Document.prototype.writeln, {
|
||
apply: (target, that , args) => {
|
||
if (args.length) args = [ ctx.html.process(args.join(''), ctx.meta) ];
|
||
return Reflect.apply(target, that, args);
|
||
},
|
||
});
|
||
};
|
||
if (ctx.window.Element.prototype.setAttribute) {
|
||
ctx.window.Element.prototype.setAttribute = new Proxy(ctx.window.Element.prototype.setAttribute, {
|
||
apply: (target, that, args) => {
|
||
if (args[0] && args[1]) {
|
||
const handler = ctx.html.attributeRoute({
|
||
name: args[0],
|
||
value: args[1],
|
||
node: that,
|
||
});
|
||
switch(handler) {
|
||
case 'url':
|
||
Reflect.apply(target, that, [`corrosion-${args[0]}`, args[1]]);
|
||
//if (that.tagName == 'SCRIPT' && args[0] == 'src') flags.push('js');
|
||
args[1] = ctx.url.wrap(args[1], ctx.meta);
|
||
break;
|
||
case 'srcset':
|
||
Reflect.apply(target, that, [`corrosion-${args[0]}`, args[1]]);
|
||
args[1] = ctx.html.srcset(args[1], ctx.meta);
|
||
break;
|
||
case 'css':
|
||
Reflect.apply(target, that, [`corrosion-${args[0]}`, args[1]]);
|
||
args[1] = ctx.css.process(args[1], { ...ctx.meta, context: 'declarationList' });
|
||
break;
|
||
case 'html':
|
||
Reflect.apply(target, that, [`corrosion-${args[0]}`, args[1]]);
|
||
args[1] = ctx.html.process(args[1], ctx.meta);
|
||
break;
|
||
case 'delete':
|
||
return Reflect.apply(target, that, [`corrosion-${args[0]}`, args[1]]);
|
||
};
|
||
};
|
||
return Reflect.apply(target, that, args);
|
||
},
|
||
});
|
||
};
|
||
if (ctx.window.Element.prototype.getAttribute) {
|
||
ctx.window.Element.prototype.getAttribute = new Proxy(ctx.window.Element.prototype.getAttribute, {
|
||
apply: (target, that, args) => {
|
||
if (args[0] && that.hasAttribute(`corrosion-${args[0]}`)) args[0] = `corrosion-${args[0]}`;
|
||
return Reflect.apply(target, that, args);
|
||
},
|
||
});
|
||
};
|
||
ctx.window.CSSStyleDeclaration.prototype.setProperty = new Proxy(ctx.window.CSSStyleDeclaration.prototype.setProperty, {
|
||
apply: (target, that, args) => {
|
||
if (args[1]) args[1] = ctx.css.process(args[1], { context: 'value', ...ctx.meta, });
|
||
return Reflect.apply(target, that, args);
|
||
},
|
||
});
|
||
if (ctx.window.Audio) {
|
||
ctx.window.Audio = new Proxy(ctx.window.Audio, {
|
||
construct: (target, args) => {
|
||
if (args[0]) args[0] = ctx.url.wrap(args[0], ctx.meta);
|
||
return Reflect.construct(target, args);
|
||
},
|
||
});
|
||
};
|
||
[
|
||
'innerHTML',
|
||
'outerHTML',
|
||
].forEach(html => {
|
||
const descriptor = Object.getOwnPropertyDescriptor(ctx.window.Element.prototype, html);
|
||
Object.defineProperty(ctx.window.Element.prototype, html, {
|
||
get: new Proxy(descriptor.get, {
|
||
apply: (target, that, args) => {
|
||
const body = Reflect.apply(target, that, args);
|
||
if (!body || html == 'innerHTML' && that.tagName == 'SCRIPT') return body;
|
||
return ctx.html.source(body, ctx.meta);
|
||
},
|
||
}),
|
||
set: new Proxy(descriptor.set, {
|
||
apply(target, that, [ val ]) {
|
||
return Reflect.apply(target, that, [ val ? ctx.html.process(val.toString(), ctx.meta) : val, ]);
|
||
},
|
||
}),
|
||
});
|
||
});
|
||
[
|
||
['background', 'background'],
|
||
['backgroundImage', 'background-image'],
|
||
['listStyleImage', 'list-style-image'],
|
||
].forEach(([key, cssProperty]) => {
|
||
Object.defineProperty(ctx.window.CSS2Properties ? ctx.window.CSS2Properties.prototype : ctx.window.CSSStyleDeclaration.prototype, key, {
|
||
get() {
|
||
return this.getPropertyValue(cssProperty);
|
||
},
|
||
set(val) {
|
||
return this.setProperty(cssProperty, val);
|
||
},
|
||
});
|
||
});
|
||
Object.defineProperty(ctx.window.Document.prototype, 'domain', {
|
||
get: new Proxy(domain.get, {
|
||
apply: () => spoofDomain,
|
||
}),
|
||
set: new Proxy(domain.set, {
|
||
apply: (target, that, [ val ]) => {
|
||
if (!val.toString().endsWith(ctx.location.hostname.split('.').slice(-2).join('.'))) return Reflect.apply(target, that, ['']);
|
||
return spoofDomain = val;
|
||
},
|
||
}),
|
||
});
|
||
if (ctx.config.title) Object.defineProperty(ctx.window.Document.prototype, 'title', {
|
||
get: new Proxy(title.get, {
|
||
apply: () => spoofTitle,
|
||
}),
|
||
set: new Proxy(title.set, {
|
||
apply: (target, that, [ val ]) => spoofTitle = val,
|
||
}),
|
||
});
|
||
Object.defineProperty(ctx.window.Navigator.prototype, 'cookieEnabled', {
|
||
get: new Proxy(cookieEnabled.get, {
|
||
apply: () => ctx.config.cookie,
|
||
}),
|
||
});
|
||
Object.defineProperty(ctx.window.Node.prototype, 'baseURI', {
|
||
get: new Proxy(baseURI.get, {
|
||
apply: (target, that, args) => {
|
||
const val = Reflect.apply(target, that, args);
|
||
return val.startsWith(ctx.meta.origin) ? ctx.url.unwrap(val, ctx.meta) : val;
|
||
},
|
||
}),
|
||
});
|
||
[
|
||
{
|
||
elements: [ HTMLScriptElement, HTMLMediaElement, HTMLImageElement, HTMLAudioElement, HTMLVideoElement, HTMLInputElement, HTMLEmbedElement, HTMLIFrameElement, HTMLTrackElement, HTMLSourceElement],
|
||
properties: ['src'],
|
||
handler: 'url',
|
||
},
|
||
{
|
||
elements: [ HTMLFormElement ],
|
||
properties: ['action'],
|
||
handler: 'url',
|
||
},
|
||
{
|
||
elements: [ HTMLAnchorElement, HTMLAreaElement, HTMLLinkElement, HTMLBaseElement ],
|
||
properties: ['href'],
|
||
handler: 'url',
|
||
},
|
||
{
|
||
elements: [ HTMLImageElement, HTMLSourceElement ],
|
||
properties: ['srcset'],
|
||
handler: 'srcset',
|
||
},
|
||
{
|
||
elements: [ HTMLScriptElement ],
|
||
properties: ['integrity'],
|
||
handler: 'delete',
|
||
},
|
||
{
|
||
elements: [ HTMLIFrameElement ],
|
||
properties: ['contentWindow'],
|
||
handler: 'window',
|
||
},
|
||
].forEach(entry => {
|
||
entry.elements.forEach(element => {
|
||
if (!element) return;
|
||
entry.properties.forEach(property => {
|
||
if (!element.prototype.hasOwnProperty(property)) return;
|
||
const descriptor = Object.getOwnPropertyDescriptor(element.prototype, property);
|
||
Object.defineProperty(element.prototype, property, {
|
||
get: descriptor.get ? new Proxy(descriptor.get, {
|
||
apply: (target, that, args) => {
|
||
let val = Reflect.apply(target, that, args);
|
||
let flags = [];
|
||
switch(entry.handler) {
|
||
case 'url':
|
||
//if (that.tagName == 'SCRIPT' && property == 'src') flags.push('js');
|
||
val = ctx.url.unwrap(val, ctx.meta);
|
||
break;
|
||
case 'srcset':
|
||
val = ctx.html.unsrcset(val, ctx.meta);
|
||
break;
|
||
case 'delete':
|
||
val = that.getAttribute(`corrosion-${property}`);
|
||
break;
|
||
case 'window':
|
||
try {
|
||
if (!val.$corrosion) {
|
||
val.$corrosion = new ctx.constructor({ ...ctx.config, window: val, });
|
||
val.$corrosion.init();
|
||
val.$corrosion.meta = ctx.meta;
|
||
};
|
||
} catch(e) {};
|
||
};
|
||
return val;
|
||
},
|
||
}) : undefined,
|
||
set: descriptor.set ? new Proxy(descriptor.set, {
|
||
apply(target, that, [ val ]) {
|
||
let newVal = val;
|
||
switch(entry.handler) {
|
||
case 'url':
|
||
newVal = ctx.url.wrap(newVal, ctx.meta);
|
||
break;
|
||
case 'srcset':
|
||
newVal = ctx.html.srcset(newVal, ctx.meta);
|
||
break;
|
||
case 'delete':
|
||
that.setAttribute(property, newVal);
|
||
return newVal;
|
||
};
|
||
return Reflect.apply(target, that, [ newVal ]);
|
||
},
|
||
}) : undefined,
|
||
});
|
||
});
|
||
});
|
||
});
|
||
};
|
||
};
|
||
module.exports = createDocumentRewriter;
|
||
|
||
/***/ }),
|
||
/* 2 */
|
||
/***/ ((module) => {
|
||
|
||
function createHistoryRewriter(ctx) {
|
||
return function rewriteHistory() {
|
||
if (ctx.serviceWorker) return;
|
||
if (ctx.window.History.prototype.pushState) {
|
||
ctx.window.History.prototype.pushState = new Proxy(ctx.window.History.prototype.pushState, {
|
||
apply: (target, that, args) => {
|
||
if (args[2]) args[2] = ctx.url.wrap(args[2], ctx.meta);
|
||
const ret = Reflect.apply(target, that, args);
|
||
ctx.updateLocation();
|
||
return ret;
|
||
},
|
||
});
|
||
};
|
||
if (ctx.window.History.prototype.replaceState) {
|
||
ctx.window.History.prototype.replaceState = new Proxy(ctx.window.History.prototype.replaceState, {
|
||
apply: (target, that, args) => {
|
||
if (args[2]) args[2] = ctx.url.wrap(args[2], ctx.meta);
|
||
const ret = Reflect.apply(target, that, args);
|
||
ctx.updateLocation();
|
||
return ret;
|
||
},
|
||
});
|
||
};
|
||
};
|
||
};
|
||
module.exports = createHistoryRewriter;
|
||
|
||
/***/ }),
|
||
/* 3 */
|
||
/***/ ((module) => {
|
||
|
||
function createHttpRewriter(ctx = {}) {
|
||
return function rewriteHttp() {
|
||
if (ctx.window.Request) {
|
||
const requestURL = Object.getOwnPropertyDescriptor(ctx.window.Request.prototype, 'url');
|
||
ctx.window.Request = new Proxy(ctx.window.Request, {
|
||
construct(target, args) {
|
||
if (args[0]) args[0] = ctx.url.wrap(args[0], { ...ctx.meta, flags: ['xhr'], })
|
||
return Reflect.construct(target, args);
|
||
},
|
||
});
|
||
Object.defineProperty(ctx.window.Request.prototype, 'url', {
|
||
get: new Proxy(requestURL.get, {
|
||
apply: (target, that, args) => {
|
||
var url = Reflect.apply(target, that, args);
|
||
return url ? ctx.url.unwrap(url, ctx.meta) : url;
|
||
},
|
||
}),
|
||
});
|
||
};
|
||
if (ctx.window.Response) {
|
||
const responseURL = Object.getOwnPropertyDescriptor(ctx.window.Response.prototype, 'url');
|
||
Object.defineProperty(ctx.window.Response.prototype, 'url', {
|
||
get: new Proxy(responseURL.get, {
|
||
apply: (target, that, args) => {
|
||
var url = Reflect.apply(target, that, args);
|
||
return url ? ctx.url.unwrap(url, ctx.meta) : url;
|
||
},
|
||
}),
|
||
});
|
||
};
|
||
if (ctx.window.open) {
|
||
ctx.window.open = new Proxy(ctx.window.open, {
|
||
apply: (target, that, args) => {
|
||
if (args[0]) args[0] = ctx.url.wrap(args[0], ctx.meta);
|
||
return Reflect.apply(target, that, args)
|
||
},
|
||
});
|
||
};
|
||
if (ctx.window.fetch) {
|
||
ctx.window.fetch = new Proxy(ctx.window.fetch, {
|
||
apply: (target, that, args) => {
|
||
if (args[0] instanceof ctx.window.Request) return Reflect.apply(target, that, args);
|
||
if (args[0]) args[0] = ctx.url.wrap(args[0], { ...ctx.meta, flags: ['xhr'], });
|
||
return Reflect.apply(target, that, args);
|
||
},
|
||
});
|
||
};
|
||
if (ctx.window.Navigator && ctx.window.Navigator.prototype.sendBeacon) {
|
||
ctx.window.Navigator.prototype.sendBeacon = new Proxy(ctx.window.Navigator.prototype.sendBeacon, {
|
||
apply: (target, that, args) => {
|
||
if (args[0]) ctx.url.wrap(args[0], { ...ctx.meta, flags: ['xhr'], });
|
||
return Reflect.apply(target, that, args);
|
||
},
|
||
});
|
||
};
|
||
if (ctx.window.XMLHttpRequest) {
|
||
const responseURL = Object.getOwnPropertyDescriptor(ctx.window.XMLHttpRequest.prototype, 'responseURL');
|
||
ctx.window.XMLHttpRequest.prototype.open = new Proxy(ctx.window.XMLHttpRequest.prototype.open, {
|
||
apply: (target, that, args) => {
|
||
if (args[1]) args[1] = ctx.url.wrap(args[1], { ...ctx.meta, flags: ['xhr'], });
|
||
return Reflect.apply(target, that, args);
|
||
},
|
||
});
|
||
Object.defineProperty(ctx.window.XMLHttpRequest.prototype, 'responseURL', {
|
||
get: new Proxy(responseURL.get, {
|
||
apply: (target, that, args) => {
|
||
const url = Reflect.apply(target, that, args);
|
||
return url ? ctx.url.unwrap(url, ctx.meta) : url;
|
||
},
|
||
}),
|
||
});
|
||
};
|
||
if (ctx.window.postMessage) {
|
||
ctx.window.postMessage = new Proxy(ctx.window.postMessage, {
|
||
apply: (target, that, args) => {
|
||
if (!ctx.serviceWorker && args[1]) args[1] = ctx.meta.origin;
|
||
return Reflect.apply(target, that, args);
|
||
},
|
||
});
|
||
};
|
||
if (ctx.window.WebSocket && ctx.config.ws) {
|
||
ctx.window.WebSocket = new Proxy(ctx.window.WebSocket, {
|
||
construct: (target, args) => {
|
||
if (args[0]) args[0] = ctx.url.wrap(args[0].toString().replace('ws', 'http'), ctx.meta).replace('http', 'ws') + '?origin=' + ctx.location.origin;
|
||
return Reflect.construct(target, args);
|
||
},
|
||
});
|
||
};
|
||
};
|
||
};
|
||
|
||
module.exports = createHttpRewriter;
|
||
|
||
/***/ }),
|
||
/* 4 */
|
||
/***/ ((module) => {
|
||
|
||
class Location {
|
||
get [Symbol.toPrimitive]() {
|
||
return () => this.href;
|
||
};
|
||
};
|
||
|
||
function createLocation(ctx, url) {
|
||
const _location = new Location();
|
||
const _url = new URL(url);
|
||
[
|
||
'hash',
|
||
'host',
|
||
'hostname',
|
||
'href',
|
||
'pathname',
|
||
'port',
|
||
'protocol',
|
||
'search',
|
||
'origin',
|
||
].forEach(property => {
|
||
Object.defineProperty(_location, property, {
|
||
get() {
|
||
return _url[property];
|
||
},
|
||
set(val) {
|
||
if (ctx.serviceWorker || property == 'origin') return;
|
||
if (property == 'href') {
|
||
return ctx.window.location.href = ctx.url.wrap(new URL(val, _url).href);
|
||
};
|
||
_url[property] = val;
|
||
return ctx.window.location.href = ctx.url.wrap(_url);
|
||
},
|
||
});
|
||
});
|
||
if (!ctx.serviceWorker) [
|
||
'assign',
|
||
'replace',
|
||
'reload',
|
||
].forEach(method => {
|
||
_location[method] = new Proxy(ctx.window.location[method], {
|
||
apply(target, that, args) {
|
||
if (args[0]) args[0] = ctx.url.wrap(args[0], ctx.meta);
|
||
return Reflect.apply(target.bind(ctx.window.location), that, args);
|
||
},
|
||
});
|
||
});
|
||
_location.toString = new Proxy(_url.toString, {
|
||
apply(target, that, args) {
|
||
return Reflect.apply(target.bind(_url), that, args);
|
||
},
|
||
});
|
||
return _location;
|
||
};
|
||
|
||
createLocation.Location = Location;
|
||
module.exports = createLocation;
|
||
|
||
/***/ }),
|
||
/* 5 */
|
||
/***/ ((module) => {
|
||
|
||
function createWorkerRewriter(ctx = {}) {
|
||
return function rewriteWorker() {
|
||
if (ctx.window.Worker) {
|
||
ctx.window.Worker = new Proxy(ctx.window.Worker, {
|
||
construct: (target, args) => {
|
||
if (args[0]) {
|
||
if (args[0].trim().startsWith(`blob:${ctx.window.location.origin}`)) {
|
||
const xhr = new ctx.originalXhr();
|
||
xhr.open('GET', args[0], false);
|
||
xhr.send();
|
||
const script = ctx.js.process(xhr.responseText, ctx.location.origin + args[0].trim().slice(`blob:${ctx.window.location.origin}`.length));
|
||
const blob = new Blob([ script ], { type: 'application/javascript' });
|
||
args[0] = URL.createObjectURL(blob);
|
||
} else {
|
||
args[0] = ctx.url.wrap(args[0], ctx.meta);
|
||
};
|
||
};
|
||
return Reflect.construct(target, args);
|
||
},
|
||
});
|
||
};
|
||
if (ctx.serviceWorker && ctx.window.importScripts) {
|
||
ctx.window.importScripts = new Proxy(ctx.window.importScripts, {
|
||
apply: (target, that, args) => {
|
||
if (args[0]) args[0] = ctx.url.wrap(args[0], ctx.meta);
|
||
return Reflect.apply(target, that, args);
|
||
},
|
||
});
|
||
};
|
||
};
|
||
};
|
||
|
||
module.exports = createWorkerRewriter;
|
||
|
||
/***/ }),
|
||
/* 6 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
// -------------------------------------------------------------
|
||
// WARNING: this file is used by both the client and the server.
|
||
// Do not use any browser or node-specific API!
|
||
// -------------------------------------------------------------
|
||
const URLWrapper = __webpack_require__(7);
|
||
const CookieRewriter = __webpack_require__(9);
|
||
const CSSRewriter = __webpack_require__(11);
|
||
const HTMLRewriter = __webpack_require__(134);
|
||
const JSRewriter = __webpack_require__(159);
|
||
const defaultConfig = {
|
||
prefix: '/service/',
|
||
codec: 'plain',
|
||
ws: true,
|
||
cookie: true,
|
||
title: 'Service',
|
||
};
|
||
|
||
class Rewrite {
|
||
constructor(config = defaultConfig) {
|
||
this.config = Object.assign(defaultConfig, config);
|
||
this.prefix = this.config.prefix;
|
||
this.forceHttps = this.config.forceHttps;
|
||
this.url = new URLWrapper(this.config || {});
|
||
this.codec = this.url.codec;
|
||
this.cookies = new CookieRewriter(this);
|
||
this.css = new CSSRewriter(this);
|
||
this.js = new JSRewriter(this);
|
||
this.html = new HTMLRewriter(this);
|
||
};
|
||
};
|
||
|
||
module.exports = Rewrite;
|
||
|
||
|
||
/***/ }),
|
||
/* 7 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
// -------------------------------------------------------------
|
||
// WARNING: this file is used by both the client and the server.
|
||
// Do not use any browser or node-specific API!
|
||
// -------------------------------------------------------------
|
||
const codec = __webpack_require__(8);
|
||
const defaultConfig = {
|
||
prefix: '/service/',
|
||
codec: 'plain'
|
||
};
|
||
|
||
class URLWrapper {
|
||
constructor(config = defaultConfig) {
|
||
this.prefix = config.prefix || defaultConfig.prefix;
|
||
this.codec = codec[config.codec || 'plain'] || codec['plain'];
|
||
this.regex = /^(#|about:|data:|blob:|mailto:|javascript:)/;
|
||
};
|
||
wrap(val, config = {}) {
|
||
if (!val || this.regex.test(val)) return val;
|
||
let flags = '';
|
||
(config.flags || []).forEach(flag => flags += `${flag}_/`);
|
||
if (config.base) try {
|
||
if (!['http:', 'https:', 'ws:', 'wss:'].includes(new URL(val, config.base).protocol)) return val;
|
||
} catch(e) {
|
||
return val;
|
||
};
|
||
return (config.origin || '') + this.prefix + flags + this.codec.encode(config.base ? new URL(val, config.base) : val) + '/';
|
||
};
|
||
unwrap(val, config = {}) {
|
||
if (!val || this.regex.test(val)) return val;
|
||
let processed = val.slice((config.origin || '').length + this.prefix.length);
|
||
const flags = ('/' + processed).match(/(?<=\/)(.*?)(?=_\/)/g) || [];
|
||
flags.forEach(flag => processed = processed.slice(`${flag}_/`.length));
|
||
let [ url, leftovers ] = processed.split(/\/(.+)?/);
|
||
return config.flags ? { value: this.codec.decode((url || '')) + (config.leftovers && leftovers ? leftovers : ''), flags } : this.codec.decode((url || '')) + (config.leftovers && leftovers ? leftovers : '');
|
||
};
|
||
};
|
||
|
||
module.exports = URLWrapper;
|
||
|
||
|
||
/***/ }),
|
||
/* 8 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
// -------------------------------------------------------------
|
||
// WARNING: this file is used by both the client and the server.
|
||
// Do not use any browser or node-specific API!
|
||
// -------------------------------------------------------------
|
||
exports.xor = {
|
||
encode(str){
|
||
if (!str) return str;
|
||
return encodeURIComponent(str.toString().split('').map((char, ind) => ind % 2 ? String.fromCharCode(char.charCodeAt() ^ 2) : char).join(''));
|
||
},
|
||
decode(str){
|
||
if (!str) return str;
|
||
return decodeURIComponent(str).split('').map((char, ind) => ind % 2 ? String.fromCharCode(char.charCodeAt() ^ 2) : char).join('');
|
||
},
|
||
};
|
||
exports.plain = {
|
||
encode(str) {
|
||
if (!str) return str;
|
||
return encodeURIComponent(str);
|
||
},
|
||
decode(str) {
|
||
if (!str) return str;
|
||
return decodeURIComponent(str);
|
||
},
|
||
};
|
||
exports.base64 = {
|
||
encode(str){
|
||
if (!str) return str;
|
||
str = str.toString();
|
||
const b64chs = Array.from('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=');
|
||
let u32;
|
||
let c0;
|
||
let c1;
|
||
let c2;
|
||
let asc = '';
|
||
let pad = str.length % 3;
|
||
|
||
for (let i = 0; i < str.length;) {
|
||
if((c0 = str.charCodeAt(i++)) > 255 || (c1 = str.charCodeAt(i++)) > 255 || (c2 = str.charCodeAt(i++)) > 255)throw new TypeError('invalid character found');
|
||
u32 = (c0 << 16) | (c1 << 8) | c2;
|
||
asc += b64chs[u32 >> 18 & 63]
|
||
+ b64chs[u32 >> 12 & 63]
|
||
+ b64chs[u32 >> 6 & 63]
|
||
+ b64chs[u32 & 63];
|
||
}
|
||
|
||
return encodeURIComponent(pad ? asc.slice(0, pad - 3) + '==='.substr(pad) : asc);
|
||
},
|
||
decode(str){
|
||
if (!str) return str;
|
||
str = decodeURIComponent(str.toString());
|
||
const b64tab = {"0":52,"1":53,"2":54,"3":55,"4":56,"5":57,"6":58,"7":59,"8":60,"9":61,"A":0,"B":1,"C":2,"D":3,"E":4,"F":5,"G":6,"H":7,"I":8,"J":9,"K":10,"L":11,"M":12,"N":13,"O":14,"P":15,"Q":16,"R":17,"S":18,"T":19,"U":20,"V":21,"W":22,"X":23,"Y":24,"Z":25,"a":26,"b":27,"c":28,"d":29,"e":30,"f":31,"g":32,"h":33,"i":34,"j":35,"k":36,"l":37,"m":38,"n":39,"o":40,"p":41,"q":42,"r":43,"s":44,"t":45,"u":46,"v":47,"w":48,"x":49,"y":50,"z":51,"+":62,"/":63,"=":64};
|
||
str = str.replace(/\s+/g, '');
|
||
str += '=='.slice(2 - (str.length & 3));
|
||
let u24;
|
||
let bin = '';
|
||
let r1;
|
||
let r2;
|
||
|
||
for (let i = 0; i < str.length;) {
|
||
u24 = b64tab[str.charAt(i++)] << 18
|
||
| b64tab[str.charAt(i++)] << 12
|
||
| (r1 = b64tab[str.charAt(i++)]) << 6
|
||
| (r2 = b64tab[str.charAt(i++)]);
|
||
bin += r1 === 64 ? String.fromCharCode(u24 >> 16 & 255)
|
||
: r2 === 64 ? String.fromCharCode(u24 >> 16 & 255, u24 >> 8 & 255)
|
||
: String.fromCharCode(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
|
||
};
|
||
return bin;
|
||
},
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 9 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
// -------------------------------------------------------------
|
||
// WARNING: this file is used by both the client and the server.
|
||
// Do not use any browser or node-specific API!
|
||
// -------------------------------------------------------------
|
||
const { SetCookie, CookieStore } = __webpack_require__(10);
|
||
|
||
class CookieRewriter {
|
||
constructor(ctx) {
|
||
this.ctx = ctx;
|
||
};
|
||
decode(store, config = {}) {
|
||
const url = new URL(config.url);
|
||
const cookies = new CookieStore(store);
|
||
cookies.forEach((val, key) => {
|
||
if (!key.includes('@') || key.slice(key.length - url.hostname.length) != url.hostname) return cookies.delete(key);
|
||
cookies.delete(key);
|
||
cookies.set(key.substr(0, key.length - url.hostname.length - 1), val);
|
||
});
|
||
return cookies.serialize();
|
||
};
|
||
encode(input, config = {}) {
|
||
if (Array.isArray(input)) {
|
||
const rw = [ ...input ];
|
||
for (let i in rw) rw[i] = this.encode(rw[i], config);
|
||
return rw;
|
||
};
|
||
const url = new URL(config.url);
|
||
const cookie = new SetCookie(input);
|
||
if (!cookie.name) return null;
|
||
cookie.domain = config.domain;
|
||
cookie.secure = config.secure;
|
||
cookie.name += `@${url.hostname}`;
|
||
cookie.path = this.ctx.prefix;
|
||
return cookie.serialize() || '';
|
||
};
|
||
};
|
||
|
||
module.exports = CookieRewriter;
|
||
|
||
|
||
/***/ }),
|
||
/* 10 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
// -------------------------------------------------------------
|
||
// WARNING: this file is used by both the client and the server.
|
||
// Do not use any browser or node-specific API!
|
||
// -------------------------------------------------------------
|
||
class CookieStore {
|
||
constructor(val = ''){
|
||
this.data = {};
|
||
val.split(';').map(cookie => {
|
||
var [ name, val = ''] = cookie.trimStart().split('=');
|
||
if (name) this.data[name] = val;
|
||
});
|
||
};
|
||
has(name){
|
||
if (!name || !this.data[name]) return false;
|
||
return true;
|
||
};
|
||
get(name){
|
||
return this.has(name) ? this.data[name] : null;
|
||
};
|
||
set(name, val){
|
||
if (!name || !val) return;
|
||
return this.data[name] = val;
|
||
};
|
||
delete(name){
|
||
if (!name) return;
|
||
return delete this.data[name];
|
||
};
|
||
forEach(action = (node, key) => null){
|
||
for (let prop in this.data) action(this.data[prop], prop);
|
||
};
|
||
serialize(){
|
||
var str = '';
|
||
for (let i in this.data) str += ` ${i}=${this.data[i]};`;
|
||
return str.substr(1);
|
||
};
|
||
};
|
||
|
||
class SetCookie {
|
||
constructor(val = ''){
|
||
|
||
var [ [ name, value = '' ], ...data ] = val.split(';').map(str => str.trimStart().split('='));
|
||
|
||
this.name = name;
|
||
this.value = value;
|
||
this.expires = null;
|
||
this.maxAge = null;
|
||
this.domain = null;
|
||
this.secure = false;
|
||
this.httpOnly = false;
|
||
this.path = null;
|
||
this.sameSite = null;
|
||
|
||
data.forEach(([name = null, value = null]) => {
|
||
if (typeof name == 'string') switch(name.toLowerCase()){
|
||
case 'domain':
|
||
this.domain = value;
|
||
break;
|
||
case 'secure':
|
||
this.secure = true;
|
||
break;
|
||
case 'httponly':
|
||
this.httpOnly = true;
|
||
break;
|
||
case 'samesite':
|
||
this.sameSite = value;
|
||
break;
|
||
case 'path':
|
||
this.path = value;
|
||
break;
|
||
case 'expires':
|
||
this.expires = value;
|
||
break;
|
||
case 'maxage':
|
||
this.maxAge = value;
|
||
break;
|
||
};
|
||
});
|
||
};
|
||
serialize(){
|
||
if (!this.name) return;
|
||
var str = `${this.name}=${this.value};`;
|
||
if (this.expires) str += ` Expires=${this.expires};`;
|
||
if (this.maxAge) str += ` Max-Age=${this.max_age};`;
|
||
if (this.domain) str += ` Domain=${this.domain};`;
|
||
if (this.secure) str += ` Secure;`;
|
||
if (this.httpOnly) str += ` HttpOnly;`;
|
||
if (this.path) str += ` Path=${this.path};`;
|
||
if (this.sameSite) str += ` SameSite=${this.sameSite};`;
|
||
return str;
|
||
};
|
||
};
|
||
|
||
exports.CookieStore = CookieStore;
|
||
exports.SetCookie = SetCookie;
|
||
|
||
|
||
/***/ }),
|
||
/* 11 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
// -------------------------------------------------------------
|
||
// WARNING: this file is used by both the client and the server.
|
||
// Do not use any browser or node-specific API!
|
||
// -------------------------------------------------------------
|
||
const csstree = __webpack_require__(12);
|
||
|
||
class CSSRewriter {
|
||
constructor(ctx) {
|
||
this.ctx = ctx;
|
||
};
|
||
process(source, config = {}) {
|
||
const ast = csstree.parse(source, {
|
||
context: config.context || 'stylesheet',
|
||
parseCustomProperty: true,
|
||
});
|
||
const urls = csstree.findAll(ast, node =>
|
||
node.type == 'Url'
|
||
);
|
||
const imports = csstree.findAll(ast, node =>
|
||
node.type == 'Atrule' && node.name == 'import' && node.prelude && node.prelude.type == 'AtrulePrelude' && node.prelude.children.head.data.type == 'String'
|
||
);
|
||
urls.forEach(({ value }) => {
|
||
switch(value.type) {
|
||
case 'String':
|
||
const quote = value.value.substring(0, 1);
|
||
value.value = quote + this.ctx.url.wrap(value.value.slice(1).slice(0, -1), config) + quote;
|
||
break;
|
||
case 'Raw':
|
||
value.value = this.ctx.url.wrap(value.value, config);
|
||
break;
|
||
};
|
||
});
|
||
imports.forEach(({ prelude }) => {
|
||
const { data } = prelude.children.head;
|
||
const quote = data.value.substring(0, 1);
|
||
data.value = quote + this.ctx.url.wrap(data.value.slice(1).slice(0, -1), config) + quote;
|
||
});
|
||
return csstree.generate(ast);
|
||
};
|
||
source(processed, config = {}) {
|
||
const ast = csstree.parse(processed, {
|
||
context: config.context || 'stylesheet',
|
||
parseCustomProperty: true,
|
||
});
|
||
const urls = csstree.findAll(ast, node =>
|
||
node.type == 'Url'
|
||
);
|
||
const imports = csstree.findAll(ast, node =>
|
||
node.type == 'Atrule' && node.name == 'import' && node.prelude && node.prelude.type == 'AtrulePrelude' && node.prelude.children.head.data.type == 'String'
|
||
);
|
||
urls.forEach(({ value }) => {
|
||
switch(value.type) {
|
||
case 'String':
|
||
const quote = value.value.substring(0, 1);
|
||
value.value = quote + this.ctx.url.unwrap(value.value.slice(1).slice(0, -1), config) + quote;
|
||
break;
|
||
case 'Raw':
|
||
value.value = this.ctx.url.unwrap(value.value, config);
|
||
break;
|
||
};
|
||
});
|
||
imports.forEach(({ prelude }) => {
|
||
const { data } = prelude.children.head;
|
||
const quote = data.value.substring(0, 1);
|
||
data.value = quote + this.ctx.url.unwrap(data.value.slice(1).slice(0, -1), config) + quote;
|
||
});
|
||
return csstree.generate(ast);
|
||
};
|
||
};
|
||
|
||
module.exports = CSSRewriter;
|
||
|
||
|
||
/***/ }),
|
||
/* 12 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = __webpack_require__(13);
|
||
|
||
|
||
/***/ }),
|
||
/* 13 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
function merge() {
|
||
var dest = {};
|
||
|
||
for (var i = 0; i < arguments.length; i++) {
|
||
var src = arguments[i];
|
||
for (var key in src) {
|
||
dest[key] = src[key];
|
||
}
|
||
}
|
||
|
||
return dest;
|
||
}
|
||
|
||
module.exports = __webpack_require__(14).create(
|
||
merge(
|
||
__webpack_require__(57),
|
||
__webpack_require__(104),
|
||
__webpack_require__(132)
|
||
)
|
||
);
|
||
module.exports.version = __webpack_require__(133).version;
|
||
|
||
|
||
/***/ }),
|
||
/* 14 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
var List = __webpack_require__(15);
|
||
var SyntaxError = __webpack_require__(16);
|
||
var TokenStream = __webpack_require__(18);
|
||
var Lexer = __webpack_require__(22);
|
||
var definitionSyntax = __webpack_require__(41);
|
||
var tokenize = __webpack_require__(27);
|
||
var createParser = __webpack_require__(42);
|
||
var createGenerator = __webpack_require__(45);
|
||
var createConvertor = __webpack_require__(53);
|
||
var createWalker = __webpack_require__(54);
|
||
var clone = __webpack_require__(55);
|
||
var names = __webpack_require__(25);
|
||
var mix = __webpack_require__(56);
|
||
|
||
function createSyntax(config) {
|
||
var parse = createParser(config);
|
||
var walk = createWalker(config);
|
||
var generate = createGenerator(config);
|
||
var convert = createConvertor(walk);
|
||
|
||
var syntax = {
|
||
List: List,
|
||
SyntaxError: SyntaxError,
|
||
TokenStream: TokenStream,
|
||
Lexer: Lexer,
|
||
|
||
vendorPrefix: names.vendorPrefix,
|
||
keyword: names.keyword,
|
||
property: names.property,
|
||
isCustomProperty: names.isCustomProperty,
|
||
|
||
definitionSyntax: definitionSyntax,
|
||
lexer: null,
|
||
createLexer: function(config) {
|
||
return new Lexer(config, syntax, syntax.lexer.structure);
|
||
},
|
||
|
||
tokenize: tokenize,
|
||
parse: parse,
|
||
walk: walk,
|
||
generate: generate,
|
||
|
||
find: walk.find,
|
||
findLast: walk.findLast,
|
||
findAll: walk.findAll,
|
||
|
||
clone: clone,
|
||
fromPlainObject: convert.fromPlainObject,
|
||
toPlainObject: convert.toPlainObject,
|
||
|
||
createSyntax: function(config) {
|
||
return createSyntax(mix({}, config));
|
||
},
|
||
fork: function(extension) {
|
||
var base = mix({}, config); // copy of config
|
||
return createSyntax(
|
||
typeof extension === 'function'
|
||
? extension(base, Object.assign)
|
||
: mix(base, extension)
|
||
);
|
||
}
|
||
};
|
||
|
||
syntax.lexer = new Lexer({
|
||
generic: true,
|
||
types: config.types,
|
||
atrules: config.atrules,
|
||
properties: config.properties,
|
||
node: config.node
|
||
}, syntax);
|
||
|
||
return syntax;
|
||
};
|
||
|
||
exports.create = function(config) {
|
||
return createSyntax(mix({}, config));
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 15 */
|
||
/***/ ((module) => {
|
||
|
||
//
|
||
// list
|
||
// ┌──────┐
|
||
// ┌──────────────┼─head │
|
||
// │ │ tail─┼──────────────┐
|
||
// │ └──────┘ │
|
||
// ▼ ▼
|
||
// item item item item
|
||
// ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
|
||
// null ◀──┼─prev │◀───┼─prev │◀───┼─prev │◀───┼─prev │
|
||
// │ next─┼───▶│ next─┼───▶│ next─┼───▶│ next─┼──▶ null
|
||
// ├──────┤ ├──────┤ ├──────┤ ├──────┤
|
||
// │ data │ │ data │ │ data │ │ data │
|
||
// └──────┘ └──────┘ └──────┘ └──────┘
|
||
//
|
||
|
||
function createItem(data) {
|
||
return {
|
||
prev: null,
|
||
next: null,
|
||
data: data
|
||
};
|
||
}
|
||
|
||
function allocateCursor(node, prev, next) {
|
||
var cursor;
|
||
|
||
if (cursors !== null) {
|
||
cursor = cursors;
|
||
cursors = cursors.cursor;
|
||
cursor.prev = prev;
|
||
cursor.next = next;
|
||
cursor.cursor = node.cursor;
|
||
} else {
|
||
cursor = {
|
||
prev: prev,
|
||
next: next,
|
||
cursor: node.cursor
|
||
};
|
||
}
|
||
|
||
node.cursor = cursor;
|
||
|
||
return cursor;
|
||
}
|
||
|
||
function releaseCursor(node) {
|
||
var cursor = node.cursor;
|
||
|
||
node.cursor = cursor.cursor;
|
||
cursor.prev = null;
|
||
cursor.next = null;
|
||
cursor.cursor = cursors;
|
||
cursors = cursor;
|
||
}
|
||
|
||
var cursors = null;
|
||
var List = function() {
|
||
this.cursor = null;
|
||
this.head = null;
|
||
this.tail = null;
|
||
};
|
||
|
||
List.createItem = createItem;
|
||
List.prototype.createItem = createItem;
|
||
|
||
List.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) {
|
||
var cursor = this.cursor;
|
||
|
||
while (cursor !== null) {
|
||
if (cursor.prev === prevOld) {
|
||
cursor.prev = prevNew;
|
||
}
|
||
|
||
if (cursor.next === nextOld) {
|
||
cursor.next = nextNew;
|
||
}
|
||
|
||
cursor = cursor.cursor;
|
||
}
|
||
};
|
||
|
||
List.prototype.getSize = function() {
|
||
var size = 0;
|
||
var cursor = this.head;
|
||
|
||
while (cursor) {
|
||
size++;
|
||
cursor = cursor.next;
|
||
}
|
||
|
||
return size;
|
||
};
|
||
|
||
List.prototype.fromArray = function(array) {
|
||
var cursor = null;
|
||
|
||
this.head = null;
|
||
|
||
for (var i = 0; i < array.length; i++) {
|
||
var item = createItem(array[i]);
|
||
|
||
if (cursor !== null) {
|
||
cursor.next = item;
|
||
} else {
|
||
this.head = item;
|
||
}
|
||
|
||
item.prev = cursor;
|
||
cursor = item;
|
||
}
|
||
|
||
this.tail = cursor;
|
||
|
||
return this;
|
||
};
|
||
|
||
List.prototype.toArray = function() {
|
||
var cursor = this.head;
|
||
var result = [];
|
||
|
||
while (cursor) {
|
||
result.push(cursor.data);
|
||
cursor = cursor.next;
|
||
}
|
||
|
||
return result;
|
||
};
|
||
|
||
List.prototype.toJSON = List.prototype.toArray;
|
||
|
||
List.prototype.isEmpty = function() {
|
||
return this.head === null;
|
||
};
|
||
|
||
List.prototype.first = function() {
|
||
return this.head && this.head.data;
|
||
};
|
||
|
||
List.prototype.last = function() {
|
||
return this.tail && this.tail.data;
|
||
};
|
||
|
||
List.prototype.each = function(fn, context) {
|
||
var item;
|
||
|
||
if (context === undefined) {
|
||
context = this;
|
||
}
|
||
|
||
// push cursor
|
||
var cursor = allocateCursor(this, null, this.head);
|
||
|
||
while (cursor.next !== null) {
|
||
item = cursor.next;
|
||
cursor.next = item.next;
|
||
|
||
fn.call(context, item.data, item, this);
|
||
}
|
||
|
||
// pop cursor
|
||
releaseCursor(this);
|
||
};
|
||
|
||
List.prototype.forEach = List.prototype.each;
|
||
|
||
List.prototype.eachRight = function(fn, context) {
|
||
var item;
|
||
|
||
if (context === undefined) {
|
||
context = this;
|
||
}
|
||
|
||
// push cursor
|
||
var cursor = allocateCursor(this, this.tail, null);
|
||
|
||
while (cursor.prev !== null) {
|
||
item = cursor.prev;
|
||
cursor.prev = item.prev;
|
||
|
||
fn.call(context, item.data, item, this);
|
||
}
|
||
|
||
// pop cursor
|
||
releaseCursor(this);
|
||
};
|
||
|
||
List.prototype.forEachRight = List.prototype.eachRight;
|
||
|
||
List.prototype.reduce = function(fn, initialValue, context) {
|
||
var item;
|
||
|
||
if (context === undefined) {
|
||
context = this;
|
||
}
|
||
|
||
// push cursor
|
||
var cursor = allocateCursor(this, null, this.head);
|
||
var acc = initialValue;
|
||
|
||
while (cursor.next !== null) {
|
||
item = cursor.next;
|
||
cursor.next = item.next;
|
||
|
||
acc = fn.call(context, acc, item.data, item, this);
|
||
}
|
||
|
||
// pop cursor
|
||
releaseCursor(this);
|
||
|
||
return acc;
|
||
};
|
||
|
||
List.prototype.reduceRight = function(fn, initialValue, context) {
|
||
var item;
|
||
|
||
if (context === undefined) {
|
||
context = this;
|
||
}
|
||
|
||
// push cursor
|
||
var cursor = allocateCursor(this, this.tail, null);
|
||
var acc = initialValue;
|
||
|
||
while (cursor.prev !== null) {
|
||
item = cursor.prev;
|
||
cursor.prev = item.prev;
|
||
|
||
acc = fn.call(context, acc, item.data, item, this);
|
||
}
|
||
|
||
// pop cursor
|
||
releaseCursor(this);
|
||
|
||
return acc;
|
||
};
|
||
|
||
List.prototype.nextUntil = function(start, fn, context) {
|
||
if (start === null) {
|
||
return;
|
||
}
|
||
|
||
var item;
|
||
|
||
if (context === undefined) {
|
||
context = this;
|
||
}
|
||
|
||
// push cursor
|
||
var cursor = allocateCursor(this, null, start);
|
||
|
||
while (cursor.next !== null) {
|
||
item = cursor.next;
|
||
cursor.next = item.next;
|
||
|
||
if (fn.call(context, item.data, item, this)) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
// pop cursor
|
||
releaseCursor(this);
|
||
};
|
||
|
||
List.prototype.prevUntil = function(start, fn, context) {
|
||
if (start === null) {
|
||
return;
|
||
}
|
||
|
||
var item;
|
||
|
||
if (context === undefined) {
|
||
context = this;
|
||
}
|
||
|
||
// push cursor
|
||
var cursor = allocateCursor(this, start, null);
|
||
|
||
while (cursor.prev !== null) {
|
||
item = cursor.prev;
|
||
cursor.prev = item.prev;
|
||
|
||
if (fn.call(context, item.data, item, this)) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
// pop cursor
|
||
releaseCursor(this);
|
||
};
|
||
|
||
List.prototype.some = function(fn, context) {
|
||
var cursor = this.head;
|
||
|
||
if (context === undefined) {
|
||
context = this;
|
||
}
|
||
|
||
while (cursor !== null) {
|
||
if (fn.call(context, cursor.data, cursor, this)) {
|
||
return true;
|
||
}
|
||
|
||
cursor = cursor.next;
|
||
}
|
||
|
||
return false;
|
||
};
|
||
|
||
List.prototype.map = function(fn, context) {
|
||
var result = new List();
|
||
var cursor = this.head;
|
||
|
||
if (context === undefined) {
|
||
context = this;
|
||
}
|
||
|
||
while (cursor !== null) {
|
||
result.appendData(fn.call(context, cursor.data, cursor, this));
|
||
cursor = cursor.next;
|
||
}
|
||
|
||
return result;
|
||
};
|
||
|
||
List.prototype.filter = function(fn, context) {
|
||
var result = new List();
|
||
var cursor = this.head;
|
||
|
||
if (context === undefined) {
|
||
context = this;
|
||
}
|
||
|
||
while (cursor !== null) {
|
||
if (fn.call(context, cursor.data, cursor, this)) {
|
||
result.appendData(cursor.data);
|
||
}
|
||
cursor = cursor.next;
|
||
}
|
||
|
||
return result;
|
||
};
|
||
|
||
List.prototype.clear = function() {
|
||
this.head = null;
|
||
this.tail = null;
|
||
};
|
||
|
||
List.prototype.copy = function() {
|
||
var result = new List();
|
||
var cursor = this.head;
|
||
|
||
while (cursor !== null) {
|
||
result.insert(createItem(cursor.data));
|
||
cursor = cursor.next;
|
||
}
|
||
|
||
return result;
|
||
};
|
||
|
||
List.prototype.prepend = function(item) {
|
||
// head
|
||
// ^
|
||
// item
|
||
this.updateCursors(null, item, this.head, item);
|
||
|
||
// insert to the beginning of the list
|
||
if (this.head !== null) {
|
||
// new item <- first item
|
||
this.head.prev = item;
|
||
|
||
// new item -> first item
|
||
item.next = this.head;
|
||
} else {
|
||
// if list has no head, then it also has no tail
|
||
// in this case tail points to the new item
|
||
this.tail = item;
|
||
}
|
||
|
||
// head always points to new item
|
||
this.head = item;
|
||
|
||
return this;
|
||
};
|
||
|
||
List.prototype.prependData = function(data) {
|
||
return this.prepend(createItem(data));
|
||
};
|
||
|
||
List.prototype.append = function(item) {
|
||
return this.insert(item);
|
||
};
|
||
|
||
List.prototype.appendData = function(data) {
|
||
return this.insert(createItem(data));
|
||
};
|
||
|
||
List.prototype.insert = function(item, before) {
|
||
if (before !== undefined && before !== null) {
|
||
// prev before
|
||
// ^
|
||
// item
|
||
this.updateCursors(before.prev, item, before, item);
|
||
|
||
if (before.prev === null) {
|
||
// insert to the beginning of list
|
||
if (this.head !== before) {
|
||
throw new Error('before doesn\'t belong to list');
|
||
}
|
||
|
||
// since head points to before therefore list doesn't empty
|
||
// no need to check tail
|
||
this.head = item;
|
||
before.prev = item;
|
||
item.next = before;
|
||
|
||
this.updateCursors(null, item);
|
||
} else {
|
||
|
||
// insert between two items
|
||
before.prev.next = item;
|
||
item.prev = before.prev;
|
||
|
||
before.prev = item;
|
||
item.next = before;
|
||
}
|
||
} else {
|
||
// tail
|
||
// ^
|
||
// item
|
||
this.updateCursors(this.tail, item, null, item);
|
||
|
||
// insert to the ending of the list
|
||
if (this.tail !== null) {
|
||
// last item -> new item
|
||
this.tail.next = item;
|
||
|
||
// last item <- new item
|
||
item.prev = this.tail;
|
||
} else {
|
||
// if list has no tail, then it also has no head
|
||
// in this case head points to new item
|
||
this.head = item;
|
||
}
|
||
|
||
// tail always points to new item
|
||
this.tail = item;
|
||
}
|
||
|
||
return this;
|
||
};
|
||
|
||
List.prototype.insertData = function(data, before) {
|
||
return this.insert(createItem(data), before);
|
||
};
|
||
|
||
List.prototype.remove = function(item) {
|
||
// item
|
||
// ^
|
||
// prev next
|
||
this.updateCursors(item, item.prev, item, item.next);
|
||
|
||
if (item.prev !== null) {
|
||
item.prev.next = item.next;
|
||
} else {
|
||
if (this.head !== item) {
|
||
throw new Error('item doesn\'t belong to list');
|
||
}
|
||
|
||
this.head = item.next;
|
||
}
|
||
|
||
if (item.next !== null) {
|
||
item.next.prev = item.prev;
|
||
} else {
|
||
if (this.tail !== item) {
|
||
throw new Error('item doesn\'t belong to list');
|
||
}
|
||
|
||
this.tail = item.prev;
|
||
}
|
||
|
||
item.prev = null;
|
||
item.next = null;
|
||
|
||
return item;
|
||
};
|
||
|
||
List.prototype.push = function(data) {
|
||
this.insert(createItem(data));
|
||
};
|
||
|
||
List.prototype.pop = function() {
|
||
if (this.tail !== null) {
|
||
return this.remove(this.tail);
|
||
}
|
||
};
|
||
|
||
List.prototype.unshift = function(data) {
|
||
this.prepend(createItem(data));
|
||
};
|
||
|
||
List.prototype.shift = function() {
|
||
if (this.head !== null) {
|
||
return this.remove(this.head);
|
||
}
|
||
};
|
||
|
||
List.prototype.prependList = function(list) {
|
||
return this.insertList(list, this.head);
|
||
};
|
||
|
||
List.prototype.appendList = function(list) {
|
||
return this.insertList(list);
|
||
};
|
||
|
||
List.prototype.insertList = function(list, before) {
|
||
// ignore empty lists
|
||
if (list.head === null) {
|
||
return this;
|
||
}
|
||
|
||
if (before !== undefined && before !== null) {
|
||
this.updateCursors(before.prev, list.tail, before, list.head);
|
||
|
||
// insert in the middle of dist list
|
||
if (before.prev !== null) {
|
||
// before.prev <-> list.head
|
||
before.prev.next = list.head;
|
||
list.head.prev = before.prev;
|
||
} else {
|
||
this.head = list.head;
|
||
}
|
||
|
||
before.prev = list.tail;
|
||
list.tail.next = before;
|
||
} else {
|
||
this.updateCursors(this.tail, list.tail, null, list.head);
|
||
|
||
// insert to end of the list
|
||
if (this.tail !== null) {
|
||
// if destination list has a tail, then it also has a head,
|
||
// but head doesn't change
|
||
|
||
// dest tail -> source head
|
||
this.tail.next = list.head;
|
||
|
||
// dest tail <- source head
|
||
list.head.prev = this.tail;
|
||
} else {
|
||
// if list has no a tail, then it also has no a head
|
||
// in this case points head to new item
|
||
this.head = list.head;
|
||
}
|
||
|
||
// tail always start point to new item
|
||
this.tail = list.tail;
|
||
}
|
||
|
||
list.head = null;
|
||
list.tail = null;
|
||
|
||
return this;
|
||
};
|
||
|
||
List.prototype.replace = function(oldItem, newItemOrList) {
|
||
if ('head' in newItemOrList) {
|
||
this.insertList(newItemOrList, oldItem);
|
||
} else {
|
||
this.insert(newItemOrList, oldItem);
|
||
}
|
||
|
||
this.remove(oldItem);
|
||
};
|
||
|
||
module.exports = List;
|
||
|
||
|
||
/***/ }),
|
||
/* 16 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var createCustomError = __webpack_require__(17);
|
||
var MAX_LINE_LENGTH = 100;
|
||
var OFFSET_CORRECTION = 60;
|
||
var TAB_REPLACEMENT = ' ';
|
||
|
||
function sourceFragment(error, extraLines) {
|
||
function processLines(start, end) {
|
||
return lines.slice(start, end).map(function(line, idx) {
|
||
var num = String(start + idx + 1);
|
||
|
||
while (num.length < maxNumLength) {
|
||
num = ' ' + num;
|
||
}
|
||
|
||
return num + ' |' + line;
|
||
}).join('\n');
|
||
}
|
||
|
||
var lines = error.source.split(/\r\n?|\n|\f/);
|
||
var line = error.line;
|
||
var column = error.column;
|
||
var startLine = Math.max(1, line - extraLines) - 1;
|
||
var endLine = Math.min(line + extraLines, lines.length + 1);
|
||
var maxNumLength = Math.max(4, String(endLine).length) + 1;
|
||
var cutLeft = 0;
|
||
|
||
// column correction according to replaced tab before column
|
||
column += (TAB_REPLACEMENT.length - 1) * (lines[line - 1].substr(0, column - 1).match(/\t/g) || []).length;
|
||
|
||
if (column > MAX_LINE_LENGTH) {
|
||
cutLeft = column - OFFSET_CORRECTION + 3;
|
||
column = OFFSET_CORRECTION - 2;
|
||
}
|
||
|
||
for (var i = startLine; i <= endLine; i++) {
|
||
if (i >= 0 && i < lines.length) {
|
||
lines[i] = lines[i].replace(/\t/g, TAB_REPLACEMENT);
|
||
lines[i] =
|
||
(cutLeft > 0 && lines[i].length > cutLeft ? '\u2026' : '') +
|
||
lines[i].substr(cutLeft, MAX_LINE_LENGTH - 2) +
|
||
(lines[i].length > cutLeft + MAX_LINE_LENGTH - 1 ? '\u2026' : '');
|
||
}
|
||
}
|
||
|
||
return [
|
||
processLines(startLine, line),
|
||
new Array(column + maxNumLength + 2).join('-') + '^',
|
||
processLines(line, endLine)
|
||
].filter(Boolean).join('\n');
|
||
}
|
||
|
||
var SyntaxError = function(message, source, offset, line, column) {
|
||
var error = createCustomError('SyntaxError', message);
|
||
|
||
error.source = source;
|
||
error.offset = offset;
|
||
error.line = line;
|
||
error.column = column;
|
||
|
||
error.sourceFragment = function(extraLines) {
|
||
return sourceFragment(error, isNaN(extraLines) ? 0 : extraLines);
|
||
};
|
||
Object.defineProperty(error, 'formattedMessage', {
|
||
get: function() {
|
||
return (
|
||
'Parse error: ' + error.message + '\n' +
|
||
sourceFragment(error, 2)
|
||
);
|
||
}
|
||
});
|
||
|
||
// for backward capability
|
||
error.parseError = {
|
||
offset: offset,
|
||
line: line,
|
||
column: column
|
||
};
|
||
|
||
return error;
|
||
};
|
||
|
||
module.exports = SyntaxError;
|
||
|
||
|
||
/***/ }),
|
||
/* 17 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = function createCustomError(name, message) {
|
||
// use Object.create(), because some VMs prevent setting line/column otherwise
|
||
// (iOS Safari 10 even throws an exception)
|
||
var error = Object.create(SyntaxError.prototype);
|
||
var errorStack = new Error();
|
||
|
||
error.name = name;
|
||
error.message = message;
|
||
|
||
Object.defineProperty(error, 'stack', {
|
||
get: function() {
|
||
return (errorStack.stack || '').replace(/^(.+\n){1,3}/, name + ': ' + message + '\n');
|
||
}
|
||
});
|
||
|
||
return error;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 18 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var constants = __webpack_require__(19);
|
||
var TYPE = constants.TYPE;
|
||
var NAME = constants.NAME;
|
||
|
||
var utils = __webpack_require__(20);
|
||
var cmpStr = utils.cmpStr;
|
||
|
||
var EOF = TYPE.EOF;
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var COMMENT = TYPE.Comment;
|
||
|
||
var OFFSET_MASK = 0x00FFFFFF;
|
||
var TYPE_SHIFT = 24;
|
||
|
||
var TokenStream = function() {
|
||
this.offsetAndType = null;
|
||
this.balance = null;
|
||
|
||
this.reset();
|
||
};
|
||
|
||
TokenStream.prototype = {
|
||
reset: function() {
|
||
this.eof = false;
|
||
this.tokenIndex = -1;
|
||
this.tokenType = 0;
|
||
this.tokenStart = this.firstCharOffset;
|
||
this.tokenEnd = this.firstCharOffset;
|
||
},
|
||
|
||
lookupType: function(offset) {
|
||
offset += this.tokenIndex;
|
||
|
||
if (offset < this.tokenCount) {
|
||
return this.offsetAndType[offset] >> TYPE_SHIFT;
|
||
}
|
||
|
||
return EOF;
|
||
},
|
||
lookupOffset: function(offset) {
|
||
offset += this.tokenIndex;
|
||
|
||
if (offset < this.tokenCount) {
|
||
return this.offsetAndType[offset - 1] & OFFSET_MASK;
|
||
}
|
||
|
||
return this.source.length;
|
||
},
|
||
lookupValue: function(offset, referenceStr) {
|
||
offset += this.tokenIndex;
|
||
|
||
if (offset < this.tokenCount) {
|
||
return cmpStr(
|
||
this.source,
|
||
this.offsetAndType[offset - 1] & OFFSET_MASK,
|
||
this.offsetAndType[offset] & OFFSET_MASK,
|
||
referenceStr
|
||
);
|
||
}
|
||
|
||
return false;
|
||
},
|
||
getTokenStart: function(tokenIndex) {
|
||
if (tokenIndex === this.tokenIndex) {
|
||
return this.tokenStart;
|
||
}
|
||
|
||
if (tokenIndex > 0) {
|
||
return tokenIndex < this.tokenCount
|
||
? this.offsetAndType[tokenIndex - 1] & OFFSET_MASK
|
||
: this.offsetAndType[this.tokenCount] & OFFSET_MASK;
|
||
}
|
||
|
||
return this.firstCharOffset;
|
||
},
|
||
|
||
// TODO: -> skipUntilBalanced
|
||
getRawLength: function(startToken, mode) {
|
||
var cursor = startToken;
|
||
var balanceEnd;
|
||
var offset = this.offsetAndType[Math.max(cursor - 1, 0)] & OFFSET_MASK;
|
||
var type;
|
||
|
||
loop:
|
||
for (; cursor < this.tokenCount; cursor++) {
|
||
balanceEnd = this.balance[cursor];
|
||
|
||
// stop scanning on balance edge that points to offset before start token
|
||
if (balanceEnd < startToken) {
|
||
break loop;
|
||
}
|
||
|
||
type = this.offsetAndType[cursor] >> TYPE_SHIFT;
|
||
|
||
// check token is stop type
|
||
switch (mode(type, this.source, offset)) {
|
||
case 1:
|
||
break loop;
|
||
|
||
case 2:
|
||
cursor++;
|
||
break loop;
|
||
|
||
default:
|
||
// fast forward to the end of balanced block
|
||
if (this.balance[balanceEnd] === cursor) {
|
||
cursor = balanceEnd;
|
||
}
|
||
|
||
offset = this.offsetAndType[cursor] & OFFSET_MASK;
|
||
}
|
||
}
|
||
|
||
return cursor - this.tokenIndex;
|
||
},
|
||
isBalanceEdge: function(pos) {
|
||
return this.balance[this.tokenIndex] < pos;
|
||
},
|
||
isDelim: function(code, offset) {
|
||
if (offset) {
|
||
return (
|
||
this.lookupType(offset) === TYPE.Delim &&
|
||
this.source.charCodeAt(this.lookupOffset(offset)) === code
|
||
);
|
||
}
|
||
|
||
return (
|
||
this.tokenType === TYPE.Delim &&
|
||
this.source.charCodeAt(this.tokenStart) === code
|
||
);
|
||
},
|
||
|
||
getTokenValue: function() {
|
||
return this.source.substring(this.tokenStart, this.tokenEnd);
|
||
},
|
||
getTokenLength: function() {
|
||
return this.tokenEnd - this.tokenStart;
|
||
},
|
||
substrToCursor: function(start) {
|
||
return this.source.substring(start, this.tokenStart);
|
||
},
|
||
|
||
skipWS: function() {
|
||
for (var i = this.tokenIndex, skipTokenCount = 0; i < this.tokenCount; i++, skipTokenCount++) {
|
||
if ((this.offsetAndType[i] >> TYPE_SHIFT) !== WHITESPACE) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (skipTokenCount > 0) {
|
||
this.skip(skipTokenCount);
|
||
}
|
||
},
|
||
skipSC: function() {
|
||
while (this.tokenType === WHITESPACE || this.tokenType === COMMENT) {
|
||
this.next();
|
||
}
|
||
},
|
||
skip: function(tokenCount) {
|
||
var next = this.tokenIndex + tokenCount;
|
||
|
||
if (next < this.tokenCount) {
|
||
this.tokenIndex = next;
|
||
this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK;
|
||
next = this.offsetAndType[next];
|
||
this.tokenType = next >> TYPE_SHIFT;
|
||
this.tokenEnd = next & OFFSET_MASK;
|
||
} else {
|
||
this.tokenIndex = this.tokenCount;
|
||
this.next();
|
||
}
|
||
},
|
||
next: function() {
|
||
var next = this.tokenIndex + 1;
|
||
|
||
if (next < this.tokenCount) {
|
||
this.tokenIndex = next;
|
||
this.tokenStart = this.tokenEnd;
|
||
next = this.offsetAndType[next];
|
||
this.tokenType = next >> TYPE_SHIFT;
|
||
this.tokenEnd = next & OFFSET_MASK;
|
||
} else {
|
||
this.tokenIndex = this.tokenCount;
|
||
this.eof = true;
|
||
this.tokenType = EOF;
|
||
this.tokenStart = this.tokenEnd = this.source.length;
|
||
}
|
||
},
|
||
|
||
forEachToken(fn) {
|
||
for (var i = 0, offset = this.firstCharOffset; i < this.tokenCount; i++) {
|
||
var start = offset;
|
||
var item = this.offsetAndType[i];
|
||
var end = item & OFFSET_MASK;
|
||
var type = item >> TYPE_SHIFT;
|
||
|
||
offset = end;
|
||
|
||
fn(type, start, end, i);
|
||
}
|
||
},
|
||
|
||
dump() {
|
||
var tokens = new Array(this.tokenCount);
|
||
|
||
this.forEachToken((type, start, end, index) => {
|
||
tokens[index] = {
|
||
idx: index,
|
||
type: NAME[type],
|
||
chunk: this.source.substring(start, end),
|
||
balance: this.balance[index]
|
||
};
|
||
});
|
||
|
||
return tokens;
|
||
}
|
||
};
|
||
|
||
module.exports = TokenStream;
|
||
|
||
|
||
/***/ }),
|
||
/* 19 */
|
||
/***/ ((module) => {
|
||
|
||
// CSS Syntax Module Level 3
|
||
// https://www.w3.org/TR/css-syntax-3/
|
||
var TYPE = {
|
||
EOF: 0, // <EOF-token>
|
||
Ident: 1, // <ident-token>
|
||
Function: 2, // <function-token>
|
||
AtKeyword: 3, // <at-keyword-token>
|
||
Hash: 4, // <hash-token>
|
||
String: 5, // <string-token>
|
||
BadString: 6, // <bad-string-token>
|
||
Url: 7, // <url-token>
|
||
BadUrl: 8, // <bad-url-token>
|
||
Delim: 9, // <delim-token>
|
||
Number: 10, // <number-token>
|
||
Percentage: 11, // <percentage-token>
|
||
Dimension: 12, // <dimension-token>
|
||
WhiteSpace: 13, // <whitespace-token>
|
||
CDO: 14, // <CDO-token>
|
||
CDC: 15, // <CDC-token>
|
||
Colon: 16, // <colon-token> :
|
||
Semicolon: 17, // <semicolon-token> ;
|
||
Comma: 18, // <comma-token> ,
|
||
LeftSquareBracket: 19, // <[-token>
|
||
RightSquareBracket: 20, // <]-token>
|
||
LeftParenthesis: 21, // <(-token>
|
||
RightParenthesis: 22, // <)-token>
|
||
LeftCurlyBracket: 23, // <{-token>
|
||
RightCurlyBracket: 24, // <}-token>
|
||
Comment: 25
|
||
};
|
||
|
||
var NAME = Object.keys(TYPE).reduce(function(result, key) {
|
||
result[TYPE[key]] = key;
|
||
return result;
|
||
}, {});
|
||
|
||
module.exports = {
|
||
TYPE: TYPE,
|
||
NAME: NAME
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 20 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var charCodeDef = __webpack_require__(21);
|
||
var isDigit = charCodeDef.isDigit;
|
||
var isHexDigit = charCodeDef.isHexDigit;
|
||
var isUppercaseLetter = charCodeDef.isUppercaseLetter;
|
||
var isName = charCodeDef.isName;
|
||
var isWhiteSpace = charCodeDef.isWhiteSpace;
|
||
var isValidEscape = charCodeDef.isValidEscape;
|
||
|
||
function getCharCode(source, offset) {
|
||
return offset < source.length ? source.charCodeAt(offset) : 0;
|
||
}
|
||
|
||
function getNewlineLength(source, offset, code) {
|
||
if (code === 13 /* \r */ && getCharCode(source, offset + 1) === 10 /* \n */) {
|
||
return 2;
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
|
||
function cmpChar(testStr, offset, referenceCode) {
|
||
var code = testStr.charCodeAt(offset);
|
||
|
||
// code.toLowerCase() for A..Z
|
||
if (isUppercaseLetter(code)) {
|
||
code = code | 32;
|
||
}
|
||
|
||
return code === referenceCode;
|
||
}
|
||
|
||
function cmpStr(testStr, start, end, referenceStr) {
|
||
if (end - start !== referenceStr.length) {
|
||
return false;
|
||
}
|
||
|
||
if (start < 0 || end > testStr.length) {
|
||
return false;
|
||
}
|
||
|
||
for (var i = start; i < end; i++) {
|
||
var testCode = testStr.charCodeAt(i);
|
||
var referenceCode = referenceStr.charCodeAt(i - start);
|
||
|
||
// testCode.toLowerCase() for A..Z
|
||
if (isUppercaseLetter(testCode)) {
|
||
testCode = testCode | 32;
|
||
}
|
||
|
||
if (testCode !== referenceCode) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
function findWhiteSpaceStart(source, offset) {
|
||
for (; offset >= 0; offset--) {
|
||
if (!isWhiteSpace(source.charCodeAt(offset))) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
return offset + 1;
|
||
}
|
||
|
||
function findWhiteSpaceEnd(source, offset) {
|
||
for (; offset < source.length; offset++) {
|
||
if (!isWhiteSpace(source.charCodeAt(offset))) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
return offset;
|
||
}
|
||
|
||
function findDecimalNumberEnd(source, offset) {
|
||
for (; offset < source.length; offset++) {
|
||
if (!isDigit(source.charCodeAt(offset))) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
return offset;
|
||
}
|
||
|
||
// § 4.3.7. Consume an escaped code point
|
||
function consumeEscaped(source, offset) {
|
||
// It assumes that the U+005C REVERSE SOLIDUS (\) has already been consumed and
|
||
// that the next input code point has already been verified to be part of a valid escape.
|
||
offset += 2;
|
||
|
||
// hex digit
|
||
if (isHexDigit(getCharCode(source, offset - 1))) {
|
||
// Consume as many hex digits as possible, but no more than 5.
|
||
// Note that this means 1-6 hex digits have been consumed in total.
|
||
for (var maxOffset = Math.min(source.length, offset + 5); offset < maxOffset; offset++) {
|
||
if (!isHexDigit(getCharCode(source, offset))) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
// If the next input code point is whitespace, consume it as well.
|
||
var code = getCharCode(source, offset);
|
||
if (isWhiteSpace(code)) {
|
||
offset += getNewlineLength(source, offset, code);
|
||
}
|
||
}
|
||
|
||
return offset;
|
||
}
|
||
|
||
// §4.3.11. Consume a name
|
||
// Note: This algorithm does not do the verification of the first few code points that are necessary
|
||
// to ensure the returned code points would constitute an <ident-token>. If that is the intended use,
|
||
// ensure that the stream starts with an identifier before calling this algorithm.
|
||
function consumeName(source, offset) {
|
||
// Let result initially be an empty string.
|
||
// Repeatedly consume the next input code point from the stream:
|
||
for (; offset < source.length; offset++) {
|
||
var code = source.charCodeAt(offset);
|
||
|
||
// name code point
|
||
if (isName(code)) {
|
||
// Append the code point to result.
|
||
continue;
|
||
}
|
||
|
||
// the stream starts with a valid escape
|
||
if (isValidEscape(code, getCharCode(source, offset + 1))) {
|
||
// Consume an escaped code point. Append the returned code point to result.
|
||
offset = consumeEscaped(source, offset) - 1;
|
||
continue;
|
||
}
|
||
|
||
// anything else
|
||
// Reconsume the current input code point. Return result.
|
||
break;
|
||
}
|
||
|
||
return offset;
|
||
}
|
||
|
||
// §4.3.12. Consume a number
|
||
function consumeNumber(source, offset) {
|
||
var code = source.charCodeAt(offset);
|
||
|
||
// 2. If the next input code point is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-),
|
||
// consume it and append it to repr.
|
||
if (code === 0x002B || code === 0x002D) {
|
||
code = source.charCodeAt(offset += 1);
|
||
}
|
||
|
||
// 3. While the next input code point is a digit, consume it and append it to repr.
|
||
if (isDigit(code)) {
|
||
offset = findDecimalNumberEnd(source, offset + 1);
|
||
code = source.charCodeAt(offset);
|
||
}
|
||
|
||
// 4. If the next 2 input code points are U+002E FULL STOP (.) followed by a digit, then:
|
||
if (code === 0x002E && isDigit(source.charCodeAt(offset + 1))) {
|
||
// 4.1 Consume them.
|
||
// 4.2 Append them to repr.
|
||
code = source.charCodeAt(offset += 2);
|
||
|
||
// 4.3 Set type to "number".
|
||
// TODO
|
||
|
||
// 4.4 While the next input code point is a digit, consume it and append it to repr.
|
||
|
||
offset = findDecimalNumberEnd(source, offset);
|
||
}
|
||
|
||
// 5. If the next 2 or 3 input code points are U+0045 LATIN CAPITAL LETTER E (E)
|
||
// or U+0065 LATIN SMALL LETTER E (e), ... , followed by a digit, then:
|
||
if (cmpChar(source, offset, 101 /* e */)) {
|
||
var sign = 0;
|
||
code = source.charCodeAt(offset + 1);
|
||
|
||
// ... optionally followed by U+002D HYPHEN-MINUS (-) or U+002B PLUS SIGN (+) ...
|
||
if (code === 0x002D || code === 0x002B) {
|
||
sign = 1;
|
||
code = source.charCodeAt(offset + 2);
|
||
}
|
||
|
||
// ... followed by a digit
|
||
if (isDigit(code)) {
|
||
// 5.1 Consume them.
|
||
// 5.2 Append them to repr.
|
||
|
||
// 5.3 Set type to "number".
|
||
// TODO
|
||
|
||
// 5.4 While the next input code point is a digit, consume it and append it to repr.
|
||
offset = findDecimalNumberEnd(source, offset + 1 + sign + 1);
|
||
}
|
||
}
|
||
|
||
return offset;
|
||
}
|
||
|
||
// § 4.3.14. Consume the remnants of a bad url
|
||
// ... its sole use is to consume enough of the input stream to reach a recovery point
|
||
// where normal tokenizing can resume.
|
||
function consumeBadUrlRemnants(source, offset) {
|
||
// Repeatedly consume the next input code point from the stream:
|
||
for (; offset < source.length; offset++) {
|
||
var code = source.charCodeAt(offset);
|
||
|
||
// U+0029 RIGHT PARENTHESIS ())
|
||
// EOF
|
||
if (code === 0x0029) {
|
||
// Return.
|
||
offset++;
|
||
break;
|
||
}
|
||
|
||
if (isValidEscape(code, getCharCode(source, offset + 1))) {
|
||
// Consume an escaped code point.
|
||
// Note: This allows an escaped right parenthesis ("\)") to be encountered
|
||
// without ending the <bad-url-token>. This is otherwise identical to
|
||
// the "anything else" clause.
|
||
offset = consumeEscaped(source, offset);
|
||
}
|
||
}
|
||
|
||
return offset;
|
||
}
|
||
|
||
module.exports = {
|
||
consumeEscaped: consumeEscaped,
|
||
consumeName: consumeName,
|
||
consumeNumber: consumeNumber,
|
||
consumeBadUrlRemnants: consumeBadUrlRemnants,
|
||
|
||
cmpChar: cmpChar,
|
||
cmpStr: cmpStr,
|
||
|
||
getNewlineLength: getNewlineLength,
|
||
findWhiteSpaceStart: findWhiteSpaceStart,
|
||
findWhiteSpaceEnd: findWhiteSpaceEnd
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 21 */
|
||
/***/ ((module) => {
|
||
|
||
var EOF = 0;
|
||
|
||
// https://drafts.csswg.org/css-syntax-3/
|
||
// § 4.2. Definitions
|
||
|
||
// digit
|
||
// A code point between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9).
|
||
function isDigit(code) {
|
||
return code >= 0x0030 && code <= 0x0039;
|
||
}
|
||
|
||
// hex digit
|
||
// A digit, or a code point between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F),
|
||
// or a code point between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f).
|
||
function isHexDigit(code) {
|
||
return (
|
||
isDigit(code) || // 0 .. 9
|
||
(code >= 0x0041 && code <= 0x0046) || // A .. F
|
||
(code >= 0x0061 && code <= 0x0066) // a .. f
|
||
);
|
||
}
|
||
|
||
// uppercase letter
|
||
// A code point between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z).
|
||
function isUppercaseLetter(code) {
|
||
return code >= 0x0041 && code <= 0x005A;
|
||
}
|
||
|
||
// lowercase letter
|
||
// A code point between U+0061 LATIN SMALL LETTER A (a) and U+007A LATIN SMALL LETTER Z (z).
|
||
function isLowercaseLetter(code) {
|
||
return code >= 0x0061 && code <= 0x007A;
|
||
}
|
||
|
||
// letter
|
||
// An uppercase letter or a lowercase letter.
|
||
function isLetter(code) {
|
||
return isUppercaseLetter(code) || isLowercaseLetter(code);
|
||
}
|
||
|
||
// non-ASCII code point
|
||
// A code point with a value equal to or greater than U+0080 <control>.
|
||
function isNonAscii(code) {
|
||
return code >= 0x0080;
|
||
}
|
||
|
||
// name-start code point
|
||
// A letter, a non-ASCII code point, or U+005F LOW LINE (_).
|
||
function isNameStart(code) {
|
||
return isLetter(code) || isNonAscii(code) || code === 0x005F;
|
||
}
|
||
|
||
// name code point
|
||
// A name-start code point, a digit, or U+002D HYPHEN-MINUS (-).
|
||
function isName(code) {
|
||
return isNameStart(code) || isDigit(code) || code === 0x002D;
|
||
}
|
||
|
||
// non-printable code point
|
||
// A code point between U+0000 NULL and U+0008 BACKSPACE, or U+000B LINE TABULATION,
|
||
// or a code point between U+000E SHIFT OUT and U+001F INFORMATION SEPARATOR ONE, or U+007F DELETE.
|
||
function isNonPrintable(code) {
|
||
return (
|
||
(code >= 0x0000 && code <= 0x0008) ||
|
||
(code === 0x000B) ||
|
||
(code >= 0x000E && code <= 0x001F) ||
|
||
(code === 0x007F)
|
||
);
|
||
}
|
||
|
||
// newline
|
||
// U+000A LINE FEED. Note that U+000D CARRIAGE RETURN and U+000C FORM FEED are not included in this definition,
|
||
// as they are converted to U+000A LINE FEED during preprocessing.
|
||
// TODO: we doesn't do a preprocessing, so check a code point for U+000D CARRIAGE RETURN and U+000C FORM FEED
|
||
function isNewline(code) {
|
||
return code === 0x000A || code === 0x000D || code === 0x000C;
|
||
}
|
||
|
||
// whitespace
|
||
// A newline, U+0009 CHARACTER TABULATION, or U+0020 SPACE.
|
||
function isWhiteSpace(code) {
|
||
return isNewline(code) || code === 0x0020 || code === 0x0009;
|
||
}
|
||
|
||
// § 4.3.8. Check if two code points are a valid escape
|
||
function isValidEscape(first, second) {
|
||
// If the first code point is not U+005C REVERSE SOLIDUS (\), return false.
|
||
if (first !== 0x005C) {
|
||
return false;
|
||
}
|
||
|
||
// Otherwise, if the second code point is a newline or EOF, return false.
|
||
if (isNewline(second) || second === EOF) {
|
||
return false;
|
||
}
|
||
|
||
// Otherwise, return true.
|
||
return true;
|
||
}
|
||
|
||
// § 4.3.9. Check if three code points would start an identifier
|
||
function isIdentifierStart(first, second, third) {
|
||
// Look at the first code point:
|
||
|
||
// U+002D HYPHEN-MINUS
|
||
if (first === 0x002D) {
|
||
// If the second code point is a name-start code point or a U+002D HYPHEN-MINUS,
|
||
// or the second and third code points are a valid escape, return true. Otherwise, return false.
|
||
return (
|
||
isNameStart(second) ||
|
||
second === 0x002D ||
|
||
isValidEscape(second, third)
|
||
);
|
||
}
|
||
|
||
// name-start code point
|
||
if (isNameStart(first)) {
|
||
// Return true.
|
||
return true;
|
||
}
|
||
|
||
// U+005C REVERSE SOLIDUS (\)
|
||
if (first === 0x005C) {
|
||
// If the first and second code points are a valid escape, return true. Otherwise, return false.
|
||
return isValidEscape(first, second);
|
||
}
|
||
|
||
// anything else
|
||
// Return false.
|
||
return false;
|
||
}
|
||
|
||
// § 4.3.10. Check if three code points would start a number
|
||
function isNumberStart(first, second, third) {
|
||
// Look at the first code point:
|
||
|
||
// U+002B PLUS SIGN (+)
|
||
// U+002D HYPHEN-MINUS (-)
|
||
if (first === 0x002B || first === 0x002D) {
|
||
// If the second code point is a digit, return true.
|
||
if (isDigit(second)) {
|
||
return 2;
|
||
}
|
||
|
||
// Otherwise, if the second code point is a U+002E FULL STOP (.)
|
||
// and the third code point is a digit, return true.
|
||
// Otherwise, return false.
|
||
return second === 0x002E && isDigit(third) ? 3 : 0;
|
||
}
|
||
|
||
// U+002E FULL STOP (.)
|
||
if (first === 0x002E) {
|
||
// If the second code point is a digit, return true. Otherwise, return false.
|
||
return isDigit(second) ? 2 : 0;
|
||
}
|
||
|
||
// digit
|
||
if (isDigit(first)) {
|
||
// Return true.
|
||
return 1;
|
||
}
|
||
|
||
// anything else
|
||
// Return false.
|
||
return 0;
|
||
}
|
||
|
||
//
|
||
// Misc
|
||
//
|
||
|
||
// detect BOM (https://en.wikipedia.org/wiki/Byte_order_mark)
|
||
function isBOM(code) {
|
||
// UTF-16BE
|
||
if (code === 0xFEFF) {
|
||
return 1;
|
||
}
|
||
|
||
// UTF-16LE
|
||
if (code === 0xFFFE) {
|
||
return 1;
|
||
}
|
||
|
||
return 0;
|
||
}
|
||
|
||
// Fast code category
|
||
//
|
||
// https://drafts.csswg.org/css-syntax/#tokenizer-definitions
|
||
// > non-ASCII code point
|
||
// > A code point with a value equal to or greater than U+0080 <control>
|
||
// > name-start code point
|
||
// > A letter, a non-ASCII code point, or U+005F LOW LINE (_).
|
||
// > name code point
|
||
// > A name-start code point, a digit, or U+002D HYPHEN-MINUS (-)
|
||
// That means only ASCII code points has a special meaning and we define a maps for 0..127 codes only
|
||
var CATEGORY = new Array(0x80);
|
||
charCodeCategory.Eof = 0x80;
|
||
charCodeCategory.WhiteSpace = 0x82;
|
||
charCodeCategory.Digit = 0x83;
|
||
charCodeCategory.NameStart = 0x84;
|
||
charCodeCategory.NonPrintable = 0x85;
|
||
|
||
for (var i = 0; i < CATEGORY.length; i++) {
|
||
switch (true) {
|
||
case isWhiteSpace(i):
|
||
CATEGORY[i] = charCodeCategory.WhiteSpace;
|
||
break;
|
||
|
||
case isDigit(i):
|
||
CATEGORY[i] = charCodeCategory.Digit;
|
||
break;
|
||
|
||
case isNameStart(i):
|
||
CATEGORY[i] = charCodeCategory.NameStart;
|
||
break;
|
||
|
||
case isNonPrintable(i):
|
||
CATEGORY[i] = charCodeCategory.NonPrintable;
|
||
break;
|
||
|
||
default:
|
||
CATEGORY[i] = i || charCodeCategory.Eof;
|
||
}
|
||
}
|
||
|
||
function charCodeCategory(code) {
|
||
return code < 0x80 ? CATEGORY[code] : charCodeCategory.NameStart;
|
||
};
|
||
|
||
module.exports = {
|
||
isDigit: isDigit,
|
||
isHexDigit: isHexDigit,
|
||
isUppercaseLetter: isUppercaseLetter,
|
||
isLowercaseLetter: isLowercaseLetter,
|
||
isLetter: isLetter,
|
||
isNonAscii: isNonAscii,
|
||
isNameStart: isNameStart,
|
||
isName: isName,
|
||
isNonPrintable: isNonPrintable,
|
||
isNewline: isNewline,
|
||
isWhiteSpace: isWhiteSpace,
|
||
isValidEscape: isValidEscape,
|
||
isIdentifierStart: isIdentifierStart,
|
||
isNumberStart: isNumberStart,
|
||
|
||
isBOM: isBOM,
|
||
charCodeCategory: charCodeCategory
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 22 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var SyntaxReferenceError = __webpack_require__(23).SyntaxReferenceError;
|
||
var SyntaxMatchError = __webpack_require__(23).SyntaxMatchError;
|
||
var names = __webpack_require__(25);
|
||
var generic = __webpack_require__(26);
|
||
var parse = __webpack_require__(31);
|
||
var generate = __webpack_require__(24);
|
||
var walk = __webpack_require__(34);
|
||
var prepareTokens = __webpack_require__(35);
|
||
var buildMatchGraph = __webpack_require__(36).buildMatchGraph;
|
||
var matchAsTree = __webpack_require__(37).matchAsTree;
|
||
var trace = __webpack_require__(38);
|
||
var search = __webpack_require__(39);
|
||
var getStructureFromConfig = __webpack_require__(40).getStructureFromConfig;
|
||
var cssWideKeywords = buildMatchGraph('inherit | initial | unset');
|
||
var cssWideKeywordsWithExpression = buildMatchGraph('inherit | initial | unset | <-ms-legacy-expression>');
|
||
|
||
function dumpMapSyntax(map, compact, syntaxAsAst) {
|
||
var result = {};
|
||
|
||
for (var name in map) {
|
||
if (map[name].syntax) {
|
||
result[name] = syntaxAsAst
|
||
? map[name].syntax
|
||
: generate(map[name].syntax, { compact: compact });
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function dumpAtruleMapSyntax(map, compact, syntaxAsAst) {
|
||
const result = {};
|
||
|
||
for (const [name, atrule] of Object.entries(map)) {
|
||
result[name] = {
|
||
prelude: atrule.prelude && (
|
||
syntaxAsAst
|
||
? atrule.prelude.syntax
|
||
: generate(atrule.prelude.syntax, { compact })
|
||
),
|
||
descriptors: atrule.descriptors && dumpMapSyntax(atrule.descriptors, compact, syntaxAsAst)
|
||
};
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function valueHasVar(tokens) {
|
||
for (var i = 0; i < tokens.length; i++) {
|
||
if (tokens[i].value.toLowerCase() === 'var(') {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
function buildMatchResult(match, error, iterations) {
|
||
return {
|
||
matched: match,
|
||
iterations: iterations,
|
||
error: error,
|
||
getTrace: trace.getTrace,
|
||
isType: trace.isType,
|
||
isProperty: trace.isProperty,
|
||
isKeyword: trace.isKeyword
|
||
};
|
||
}
|
||
|
||
function matchSyntax(lexer, syntax, value, useCommon) {
|
||
var tokens = prepareTokens(value, lexer.syntax);
|
||
var result;
|
||
|
||
if (valueHasVar(tokens)) {
|
||
return buildMatchResult(null, new Error('Matching for a tree with var() is not supported'));
|
||
}
|
||
|
||
if (useCommon) {
|
||
result = matchAsTree(tokens, lexer.valueCommonSyntax, lexer);
|
||
}
|
||
|
||
if (!useCommon || !result.match) {
|
||
result = matchAsTree(tokens, syntax.match, lexer);
|
||
if (!result.match) {
|
||
return buildMatchResult(
|
||
null,
|
||
new SyntaxMatchError(result.reason, syntax.syntax, value, result),
|
||
result.iterations
|
||
);
|
||
}
|
||
}
|
||
|
||
return buildMatchResult(result.match, null, result.iterations);
|
||
}
|
||
|
||
var Lexer = function(config, syntax, structure) {
|
||
this.valueCommonSyntax = cssWideKeywords;
|
||
this.syntax = syntax;
|
||
this.generic = false;
|
||
this.atrules = {};
|
||
this.properties = {};
|
||
this.types = {};
|
||
this.structure = structure || getStructureFromConfig(config);
|
||
|
||
if (config) {
|
||
if (config.types) {
|
||
for (var name in config.types) {
|
||
this.addType_(name, config.types[name]);
|
||
}
|
||
}
|
||
|
||
if (config.generic) {
|
||
this.generic = true;
|
||
for (var name in generic) {
|
||
this.addType_(name, generic[name]);
|
||
}
|
||
}
|
||
|
||
if (config.atrules) {
|
||
for (var name in config.atrules) {
|
||
this.addAtrule_(name, config.atrules[name]);
|
||
}
|
||
}
|
||
|
||
if (config.properties) {
|
||
for (var name in config.properties) {
|
||
this.addProperty_(name, config.properties[name]);
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
Lexer.prototype = {
|
||
structure: {},
|
||
checkStructure: function(ast) {
|
||
function collectWarning(node, message) {
|
||
warns.push({
|
||
node: node,
|
||
message: message
|
||
});
|
||
}
|
||
|
||
var structure = this.structure;
|
||
var warns = [];
|
||
|
||
this.syntax.walk(ast, function(node) {
|
||
if (structure.hasOwnProperty(node.type)) {
|
||
structure[node.type].check(node, collectWarning);
|
||
} else {
|
||
collectWarning(node, 'Unknown node type `' + node.type + '`');
|
||
}
|
||
});
|
||
|
||
return warns.length ? warns : false;
|
||
},
|
||
|
||
createDescriptor: function(syntax, type, name, parent = null) {
|
||
var ref = {
|
||
type: type,
|
||
name: name
|
||
};
|
||
var descriptor = {
|
||
type: type,
|
||
name: name,
|
||
parent: parent,
|
||
syntax: null,
|
||
match: null
|
||
};
|
||
|
||
if (typeof syntax === 'function') {
|
||
descriptor.match = buildMatchGraph(syntax, ref);
|
||
} else {
|
||
if (typeof syntax === 'string') {
|
||
// lazy parsing on first access
|
||
Object.defineProperty(descriptor, 'syntax', {
|
||
get: function() {
|
||
Object.defineProperty(descriptor, 'syntax', {
|
||
value: parse(syntax)
|
||
});
|
||
|
||
return descriptor.syntax;
|
||
}
|
||
});
|
||
} else {
|
||
descriptor.syntax = syntax;
|
||
}
|
||
|
||
// lazy graph build on first access
|
||
Object.defineProperty(descriptor, 'match', {
|
||
get: function() {
|
||
Object.defineProperty(descriptor, 'match', {
|
||
value: buildMatchGraph(descriptor.syntax, ref)
|
||
});
|
||
|
||
return descriptor.match;
|
||
}
|
||
});
|
||
}
|
||
|
||
return descriptor;
|
||
},
|
||
addAtrule_: function(name, syntax) {
|
||
if (!syntax) {
|
||
return;
|
||
}
|
||
|
||
this.atrules[name] = {
|
||
type: 'Atrule',
|
||
name: name,
|
||
prelude: syntax.prelude ? this.createDescriptor(syntax.prelude, 'AtrulePrelude', name) : null,
|
||
descriptors: syntax.descriptors
|
||
? Object.keys(syntax.descriptors).reduce((res, descName) => {
|
||
res[descName] = this.createDescriptor(syntax.descriptors[descName], 'AtruleDescriptor', descName, name);
|
||
return res;
|
||
}, {})
|
||
: null
|
||
};
|
||
},
|
||
addProperty_: function(name, syntax) {
|
||
if (!syntax) {
|
||
return;
|
||
}
|
||
|
||
this.properties[name] = this.createDescriptor(syntax, 'Property', name);
|
||
},
|
||
addType_: function(name, syntax) {
|
||
if (!syntax) {
|
||
return;
|
||
}
|
||
|
||
this.types[name] = this.createDescriptor(syntax, 'Type', name);
|
||
|
||
if (syntax === generic['-ms-legacy-expression']) {
|
||
this.valueCommonSyntax = cssWideKeywordsWithExpression;
|
||
}
|
||
},
|
||
|
||
checkAtruleName: function(atruleName) {
|
||
if (!this.getAtrule(atruleName)) {
|
||
return new SyntaxReferenceError('Unknown at-rule', '@' + atruleName);
|
||
}
|
||
},
|
||
checkAtrulePrelude: function(atruleName, prelude) {
|
||
let error = this.checkAtruleName(atruleName);
|
||
|
||
if (error) {
|
||
return error;
|
||
}
|
||
|
||
var atrule = this.getAtrule(atruleName);
|
||
|
||
if (!atrule.prelude && prelude) {
|
||
return new SyntaxError('At-rule `@' + atruleName + '` should not contain a prelude');
|
||
}
|
||
|
||
if (atrule.prelude && !prelude) {
|
||
return new SyntaxError('At-rule `@' + atruleName + '` should contain a prelude');
|
||
}
|
||
},
|
||
checkAtruleDescriptorName: function(atruleName, descriptorName) {
|
||
let error = this.checkAtruleName(atruleName);
|
||
|
||
if (error) {
|
||
return error;
|
||
}
|
||
|
||
var atrule = this.getAtrule(atruleName);
|
||
var descriptor = names.keyword(descriptorName);
|
||
|
||
if (!atrule.descriptors) {
|
||
return new SyntaxError('At-rule `@' + atruleName + '` has no known descriptors');
|
||
}
|
||
|
||
if (!atrule.descriptors[descriptor.name] &&
|
||
!atrule.descriptors[descriptor.basename]) {
|
||
return new SyntaxReferenceError('Unknown at-rule descriptor', descriptorName);
|
||
}
|
||
},
|
||
checkPropertyName: function(propertyName) {
|
||
var property = names.property(propertyName);
|
||
|
||
// don't match syntax for a custom property
|
||
if (property.custom) {
|
||
return new Error('Lexer matching doesn\'t applicable for custom properties');
|
||
}
|
||
|
||
if (!this.getProperty(propertyName)) {
|
||
return new SyntaxReferenceError('Unknown property', propertyName);
|
||
}
|
||
},
|
||
|
||
matchAtrulePrelude: function(atruleName, prelude) {
|
||
var error = this.checkAtrulePrelude(atruleName, prelude);
|
||
|
||
if (error) {
|
||
return buildMatchResult(null, error);
|
||
}
|
||
|
||
if (!prelude) {
|
||
return buildMatchResult(null, null);
|
||
}
|
||
|
||
return matchSyntax(this, this.getAtrule(atruleName).prelude, prelude, false);
|
||
},
|
||
matchAtruleDescriptor: function(atruleName, descriptorName, value) {
|
||
var error = this.checkAtruleDescriptorName(atruleName, descriptorName);
|
||
|
||
if (error) {
|
||
return buildMatchResult(null, error);
|
||
}
|
||
|
||
var atrule = this.getAtrule(atruleName);
|
||
var descriptor = names.keyword(descriptorName);
|
||
|
||
return matchSyntax(this, atrule.descriptors[descriptor.name] || atrule.descriptors[descriptor.basename], value, false);
|
||
},
|
||
matchDeclaration: function(node) {
|
||
if (node.type !== 'Declaration') {
|
||
return buildMatchResult(null, new Error('Not a Declaration node'));
|
||
}
|
||
|
||
return this.matchProperty(node.property, node.value);
|
||
},
|
||
matchProperty: function(propertyName, value) {
|
||
var error = this.checkPropertyName(propertyName);
|
||
|
||
if (error) {
|
||
return buildMatchResult(null, error);
|
||
}
|
||
|
||
return matchSyntax(this, this.getProperty(propertyName), value, true);
|
||
},
|
||
matchType: function(typeName, value) {
|
||
var typeSyntax = this.getType(typeName);
|
||
|
||
if (!typeSyntax) {
|
||
return buildMatchResult(null, new SyntaxReferenceError('Unknown type', typeName));
|
||
}
|
||
|
||
return matchSyntax(this, typeSyntax, value, false);
|
||
},
|
||
match: function(syntax, value) {
|
||
if (typeof syntax !== 'string' && (!syntax || !syntax.type)) {
|
||
return buildMatchResult(null, new SyntaxReferenceError('Bad syntax'));
|
||
}
|
||
|
||
if (typeof syntax === 'string' || !syntax.match) {
|
||
syntax = this.createDescriptor(syntax, 'Type', 'anonymous');
|
||
}
|
||
|
||
return matchSyntax(this, syntax, value, false);
|
||
},
|
||
|
||
findValueFragments: function(propertyName, value, type, name) {
|
||
return search.matchFragments(this, value, this.matchProperty(propertyName, value), type, name);
|
||
},
|
||
findDeclarationValueFragments: function(declaration, type, name) {
|
||
return search.matchFragments(this, declaration.value, this.matchDeclaration(declaration), type, name);
|
||
},
|
||
findAllFragments: function(ast, type, name) {
|
||
var result = [];
|
||
|
||
this.syntax.walk(ast, {
|
||
visit: 'Declaration',
|
||
enter: function(declaration) {
|
||
result.push.apply(result, this.findDeclarationValueFragments(declaration, type, name));
|
||
}.bind(this)
|
||
});
|
||
|
||
return result;
|
||
},
|
||
|
||
getAtrule: function(atruleName, fallbackBasename = true) {
|
||
var atrule = names.keyword(atruleName);
|
||
var atruleEntry = atrule.vendor && fallbackBasename
|
||
? this.atrules[atrule.name] || this.atrules[atrule.basename]
|
||
: this.atrules[atrule.name];
|
||
|
||
return atruleEntry || null;
|
||
},
|
||
getAtrulePrelude: function(atruleName, fallbackBasename = true) {
|
||
const atrule = this.getAtrule(atruleName, fallbackBasename);
|
||
|
||
return atrule && atrule.prelude || null;
|
||
},
|
||
getAtruleDescriptor: function(atruleName, name) {
|
||
return this.atrules.hasOwnProperty(atruleName) && this.atrules.declarators
|
||
? this.atrules[atruleName].declarators[name] || null
|
||
: null;
|
||
},
|
||
getProperty: function(propertyName, fallbackBasename = true) {
|
||
var property = names.property(propertyName);
|
||
var propertyEntry = property.vendor && fallbackBasename
|
||
? this.properties[property.name] || this.properties[property.basename]
|
||
: this.properties[property.name];
|
||
|
||
return propertyEntry || null;
|
||
},
|
||
getType: function(name) {
|
||
return this.types.hasOwnProperty(name) ? this.types[name] : null;
|
||
},
|
||
|
||
validate: function() {
|
||
function validate(syntax, name, broken, descriptor) {
|
||
if (broken.hasOwnProperty(name)) {
|
||
return broken[name];
|
||
}
|
||
|
||
broken[name] = false;
|
||
if (descriptor.syntax !== null) {
|
||
walk(descriptor.syntax, function(node) {
|
||
if (node.type !== 'Type' && node.type !== 'Property') {
|
||
return;
|
||
}
|
||
|
||
var map = node.type === 'Type' ? syntax.types : syntax.properties;
|
||
var brokenMap = node.type === 'Type' ? brokenTypes : brokenProperties;
|
||
|
||
if (!map.hasOwnProperty(node.name) || validate(syntax, node.name, brokenMap, map[node.name])) {
|
||
broken[name] = true;
|
||
}
|
||
}, this);
|
||
}
|
||
}
|
||
|
||
var brokenTypes = {};
|
||
var brokenProperties = {};
|
||
|
||
for (var key in this.types) {
|
||
validate(this, key, brokenTypes, this.types[key]);
|
||
}
|
||
|
||
for (var key in this.properties) {
|
||
validate(this, key, brokenProperties, this.properties[key]);
|
||
}
|
||
|
||
brokenTypes = Object.keys(brokenTypes).filter(function(name) {
|
||
return brokenTypes[name];
|
||
});
|
||
brokenProperties = Object.keys(brokenProperties).filter(function(name) {
|
||
return brokenProperties[name];
|
||
});
|
||
|
||
if (brokenTypes.length || brokenProperties.length) {
|
||
return {
|
||
types: brokenTypes,
|
||
properties: brokenProperties
|
||
};
|
||
}
|
||
|
||
return null;
|
||
},
|
||
dump: function(syntaxAsAst, pretty) {
|
||
return {
|
||
generic: this.generic,
|
||
types: dumpMapSyntax(this.types, !pretty, syntaxAsAst),
|
||
properties: dumpMapSyntax(this.properties, !pretty, syntaxAsAst),
|
||
atrules: dumpAtruleMapSyntax(this.atrules, !pretty, syntaxAsAst)
|
||
};
|
||
},
|
||
toString: function() {
|
||
return JSON.stringify(this.dump());
|
||
}
|
||
};
|
||
|
||
module.exports = Lexer;
|
||
|
||
|
||
/***/ }),
|
||
/* 23 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
const createCustomError = __webpack_require__(17);
|
||
const generate = __webpack_require__(24);
|
||
const defaultLoc = { offset: 0, line: 1, column: 1 };
|
||
|
||
function locateMismatch(matchResult, node) {
|
||
const tokens = matchResult.tokens;
|
||
const longestMatch = matchResult.longestMatch;
|
||
const mismatchNode = longestMatch < tokens.length ? tokens[longestMatch].node || null : null;
|
||
const badNode = mismatchNode !== node ? mismatchNode : null;
|
||
let mismatchOffset = 0;
|
||
let mismatchLength = 0;
|
||
let entries = 0;
|
||
let css = '';
|
||
let start;
|
||
let end;
|
||
|
||
for (let i = 0; i < tokens.length; i++) {
|
||
const token = tokens[i].value;
|
||
|
||
if (i === longestMatch) {
|
||
mismatchLength = token.length;
|
||
mismatchOffset = css.length;
|
||
}
|
||
|
||
if (badNode !== null && tokens[i].node === badNode) {
|
||
if (i <= longestMatch) {
|
||
entries++;
|
||
} else {
|
||
entries = 0;
|
||
}
|
||
}
|
||
|
||
css += token;
|
||
}
|
||
|
||
if (longestMatch === tokens.length || entries > 1) { // last
|
||
start = fromLoc(badNode || node, 'end') || buildLoc(defaultLoc, css);
|
||
end = buildLoc(start);
|
||
} else {
|
||
start = fromLoc(badNode, 'start') ||
|
||
buildLoc(fromLoc(node, 'start') || defaultLoc, css.slice(0, mismatchOffset));
|
||
end = fromLoc(badNode, 'end') ||
|
||
buildLoc(start, css.substr(mismatchOffset, mismatchLength));
|
||
}
|
||
|
||
return {
|
||
css,
|
||
mismatchOffset,
|
||
mismatchLength,
|
||
start,
|
||
end
|
||
};
|
||
}
|
||
|
||
function fromLoc(node, point) {
|
||
const value = node && node.loc && node.loc[point];
|
||
|
||
if (value) {
|
||
return 'line' in value ? buildLoc(value) : value;
|
||
}
|
||
|
||
return null;
|
||
}
|
||
|
||
function buildLoc({ offset, line, column }, extra) {
|
||
const loc = {
|
||
offset,
|
||
line,
|
||
column
|
||
};
|
||
|
||
if (extra) {
|
||
const lines = extra.split(/\n|\r\n?|\f/);
|
||
|
||
loc.offset += extra.length;
|
||
loc.line += lines.length - 1;
|
||
loc.column = lines.length === 1 ? loc.column + extra.length : lines.pop().length + 1;
|
||
}
|
||
|
||
return loc;
|
||
}
|
||
|
||
const SyntaxReferenceError = function(type, referenceName) {
|
||
const error = createCustomError(
|
||
'SyntaxReferenceError',
|
||
type + (referenceName ? ' `' + referenceName + '`' : '')
|
||
);
|
||
|
||
error.reference = referenceName;
|
||
|
||
return error;
|
||
};
|
||
|
||
const SyntaxMatchError = function(message, syntax, node, matchResult) {
|
||
const error = createCustomError('SyntaxMatchError', message);
|
||
const {
|
||
css,
|
||
mismatchOffset,
|
||
mismatchLength,
|
||
start,
|
||
end
|
||
} = locateMismatch(matchResult, node);
|
||
|
||
error.rawMessage = message;
|
||
error.syntax = syntax ? generate(syntax) : '<generic>';
|
||
error.css = css;
|
||
error.mismatchOffset = mismatchOffset;
|
||
error.mismatchLength = mismatchLength;
|
||
error.message = message + '\n' +
|
||
' syntax: ' + error.syntax + '\n' +
|
||
' value: ' + (css || '<empty string>') + '\n' +
|
||
' --------' + new Array(error.mismatchOffset + 1).join('-') + '^';
|
||
|
||
Object.assign(error, start);
|
||
error.loc = {
|
||
source: (node && node.loc && node.loc.source) || '<unknown>',
|
||
start,
|
||
end
|
||
};
|
||
|
||
return error;
|
||
};
|
||
|
||
module.exports = {
|
||
SyntaxReferenceError,
|
||
SyntaxMatchError
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 24 */
|
||
/***/ ((module) => {
|
||
|
||
function noop(value) {
|
||
return value;
|
||
}
|
||
|
||
function generateMultiplier(multiplier) {
|
||
if (multiplier.min === 0 && multiplier.max === 0) {
|
||
return '*';
|
||
}
|
||
|
||
if (multiplier.min === 0 && multiplier.max === 1) {
|
||
return '?';
|
||
}
|
||
|
||
if (multiplier.min === 1 && multiplier.max === 0) {
|
||
return multiplier.comma ? '#' : '+';
|
||
}
|
||
|
||
if (multiplier.min === 1 && multiplier.max === 1) {
|
||
return '';
|
||
}
|
||
|
||
return (
|
||
(multiplier.comma ? '#' : '') +
|
||
(multiplier.min === multiplier.max
|
||
? '{' + multiplier.min + '}'
|
||
: '{' + multiplier.min + ',' + (multiplier.max !== 0 ? multiplier.max : '') + '}'
|
||
)
|
||
);
|
||
}
|
||
|
||
function generateTypeOpts(node) {
|
||
switch (node.type) {
|
||
case 'Range':
|
||
return (
|
||
' [' +
|
||
(node.min === null ? '-∞' : node.min) +
|
||
',' +
|
||
(node.max === null ? '∞' : node.max) +
|
||
']'
|
||
);
|
||
|
||
default:
|
||
throw new Error('Unknown node type `' + node.type + '`');
|
||
}
|
||
}
|
||
|
||
function generateSequence(node, decorate, forceBraces, compact) {
|
||
var combinator = node.combinator === ' ' || compact ? node.combinator : ' ' + node.combinator + ' ';
|
||
var result = node.terms.map(function(term) {
|
||
return generate(term, decorate, forceBraces, compact);
|
||
}).join(combinator);
|
||
|
||
if (node.explicit || forceBraces) {
|
||
result = (compact || result[0] === ',' ? '[' : '[ ') + result + (compact ? ']' : ' ]');
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function generate(node, decorate, forceBraces, compact) {
|
||
var result;
|
||
|
||
switch (node.type) {
|
||
case 'Group':
|
||
result =
|
||
generateSequence(node, decorate, forceBraces, compact) +
|
||
(node.disallowEmpty ? '!' : '');
|
||
break;
|
||
|
||
case 'Multiplier':
|
||
// return since node is a composition
|
||
return (
|
||
generate(node.term, decorate, forceBraces, compact) +
|
||
decorate(generateMultiplier(node), node)
|
||
);
|
||
|
||
case 'Type':
|
||
result = '<' + node.name + (node.opts ? decorate(generateTypeOpts(node.opts), node.opts) : '') + '>';
|
||
break;
|
||
|
||
case 'Property':
|
||
result = '<\'' + node.name + '\'>';
|
||
break;
|
||
|
||
case 'Keyword':
|
||
result = node.name;
|
||
break;
|
||
|
||
case 'AtKeyword':
|
||
result = '@' + node.name;
|
||
break;
|
||
|
||
case 'Function':
|
||
result = node.name + '(';
|
||
break;
|
||
|
||
case 'String':
|
||
case 'Token':
|
||
result = node.value;
|
||
break;
|
||
|
||
case 'Comma':
|
||
result = ',';
|
||
break;
|
||
|
||
default:
|
||
throw new Error('Unknown node type `' + node.type + '`');
|
||
}
|
||
|
||
return decorate(result, node);
|
||
}
|
||
|
||
module.exports = function(node, options) {
|
||
var decorate = noop;
|
||
var forceBraces = false;
|
||
var compact = false;
|
||
|
||
if (typeof options === 'function') {
|
||
decorate = options;
|
||
} else if (options) {
|
||
forceBraces = Boolean(options.forceBraces);
|
||
compact = Boolean(options.compact);
|
||
if (typeof options.decorate === 'function') {
|
||
decorate = options.decorate;
|
||
}
|
||
}
|
||
|
||
return generate(node, decorate, forceBraces, compact);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 25 */
|
||
/***/ ((module) => {
|
||
|
||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
var keywords = Object.create(null);
|
||
var properties = Object.create(null);
|
||
var HYPHENMINUS = 45; // '-'.charCodeAt()
|
||
|
||
function isCustomProperty(str, offset) {
|
||
offset = offset || 0;
|
||
|
||
return str.length - offset >= 2 &&
|
||
str.charCodeAt(offset) === HYPHENMINUS &&
|
||
str.charCodeAt(offset + 1) === HYPHENMINUS;
|
||
}
|
||
|
||
function getVendorPrefix(str, offset) {
|
||
offset = offset || 0;
|
||
|
||
// verdor prefix should be at least 3 chars length
|
||
if (str.length - offset >= 3) {
|
||
// vendor prefix starts with hyper minus following non-hyper minus
|
||
if (str.charCodeAt(offset) === HYPHENMINUS &&
|
||
str.charCodeAt(offset + 1) !== HYPHENMINUS) {
|
||
// vendor prefix should contain a hyper minus at the ending
|
||
var secondDashIndex = str.indexOf('-', offset + 2);
|
||
|
||
if (secondDashIndex !== -1) {
|
||
return str.substring(offset, secondDashIndex + 1);
|
||
}
|
||
}
|
||
}
|
||
|
||
return '';
|
||
}
|
||
|
||
function getKeywordDescriptor(keyword) {
|
||
if (hasOwnProperty.call(keywords, keyword)) {
|
||
return keywords[keyword];
|
||
}
|
||
|
||
var name = keyword.toLowerCase();
|
||
|
||
if (hasOwnProperty.call(keywords, name)) {
|
||
return keywords[keyword] = keywords[name];
|
||
}
|
||
|
||
var custom = isCustomProperty(name, 0);
|
||
var vendor = !custom ? getVendorPrefix(name, 0) : '';
|
||
|
||
return keywords[keyword] = Object.freeze({
|
||
basename: name.substr(vendor.length),
|
||
name: name,
|
||
vendor: vendor,
|
||
prefix: vendor,
|
||
custom: custom
|
||
});
|
||
}
|
||
|
||
function getPropertyDescriptor(property) {
|
||
if (hasOwnProperty.call(properties, property)) {
|
||
return properties[property];
|
||
}
|
||
|
||
var name = property;
|
||
var hack = property[0];
|
||
|
||
if (hack === '/') {
|
||
hack = property[1] === '/' ? '//' : '/';
|
||
} else if (hack !== '_' &&
|
||
hack !== '*' &&
|
||
hack !== '$' &&
|
||
hack !== '#' &&
|
||
hack !== '+' &&
|
||
hack !== '&') {
|
||
hack = '';
|
||
}
|
||
|
||
var custom = isCustomProperty(name, hack.length);
|
||
|
||
// re-use result when possible (the same as for lower case)
|
||
if (!custom) {
|
||
name = name.toLowerCase();
|
||
if (hasOwnProperty.call(properties, name)) {
|
||
return properties[property] = properties[name];
|
||
}
|
||
}
|
||
|
||
var vendor = !custom ? getVendorPrefix(name, hack.length) : '';
|
||
var prefix = name.substr(0, hack.length + vendor.length);
|
||
|
||
return properties[property] = Object.freeze({
|
||
basename: name.substr(prefix.length),
|
||
name: name.substr(hack.length),
|
||
hack: hack,
|
||
vendor: vendor,
|
||
prefix: prefix,
|
||
custom: custom
|
||
});
|
||
}
|
||
|
||
module.exports = {
|
||
keyword: getKeywordDescriptor,
|
||
property: getPropertyDescriptor,
|
||
isCustomProperty: isCustomProperty,
|
||
vendorPrefix: getVendorPrefix
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 26 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var tokenizer = __webpack_require__(27);
|
||
var isIdentifierStart = tokenizer.isIdentifierStart;
|
||
var isHexDigit = tokenizer.isHexDigit;
|
||
var isDigit = tokenizer.isDigit;
|
||
var cmpStr = tokenizer.cmpStr;
|
||
var consumeNumber = tokenizer.consumeNumber;
|
||
var TYPE = tokenizer.TYPE;
|
||
var anPlusB = __webpack_require__(29);
|
||
var urange = __webpack_require__(30);
|
||
|
||
var cssWideKeywords = ['unset', 'initial', 'inherit'];
|
||
var calcFunctionNames = ['calc(', '-moz-calc(', '-webkit-calc('];
|
||
|
||
// https://www.w3.org/TR/css-values-3/#lengths
|
||
var LENGTH = {
|
||
// absolute length units
|
||
'px': true,
|
||
'mm': true,
|
||
'cm': true,
|
||
'in': true,
|
||
'pt': true,
|
||
'pc': true,
|
||
'q': true,
|
||
|
||
// relative length units
|
||
'em': true,
|
||
'ex': true,
|
||
'ch': true,
|
||
'rem': true,
|
||
|
||
// viewport-percentage lengths
|
||
'vh': true,
|
||
'vw': true,
|
||
'vmin': true,
|
||
'vmax': true,
|
||
'vm': true
|
||
};
|
||
|
||
var ANGLE = {
|
||
'deg': true,
|
||
'grad': true,
|
||
'rad': true,
|
||
'turn': true
|
||
};
|
||
|
||
var TIME = {
|
||
's': true,
|
||
'ms': true
|
||
};
|
||
|
||
var FREQUENCY = {
|
||
'hz': true,
|
||
'khz': true
|
||
};
|
||
|
||
// https://www.w3.org/TR/css-values-3/#resolution (https://drafts.csswg.org/css-values/#resolution)
|
||
var RESOLUTION = {
|
||
'dpi': true,
|
||
'dpcm': true,
|
||
'dppx': true,
|
||
'x': true // https://github.com/w3c/csswg-drafts/issues/461
|
||
};
|
||
|
||
// https://drafts.csswg.org/css-grid/#fr-unit
|
||
var FLEX = {
|
||
'fr': true
|
||
};
|
||
|
||
// https://www.w3.org/TR/css3-speech/#mixing-props-voice-volume
|
||
var DECIBEL = {
|
||
'db': true
|
||
};
|
||
|
||
// https://www.w3.org/TR/css3-speech/#voice-props-voice-pitch
|
||
var SEMITONES = {
|
||
'st': true
|
||
};
|
||
|
||
// safe char code getter
|
||
function charCode(str, index) {
|
||
return index < str.length ? str.charCodeAt(index) : 0;
|
||
}
|
||
|
||
function eqStr(actual, expected) {
|
||
return cmpStr(actual, 0, actual.length, expected);
|
||
}
|
||
|
||
function eqStrAny(actual, expected) {
|
||
for (var i = 0; i < expected.length; i++) {
|
||
if (eqStr(actual, expected[i])) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
// IE postfix hack, i.e. 123\0 or 123px\9
|
||
function isPostfixIeHack(str, offset) {
|
||
if (offset !== str.length - 2) {
|
||
return false;
|
||
}
|
||
|
||
return (
|
||
str.charCodeAt(offset) === 0x005C && // U+005C REVERSE SOLIDUS (\)
|
||
isDigit(str.charCodeAt(offset + 1))
|
||
);
|
||
}
|
||
|
||
function outOfRange(opts, value, numEnd) {
|
||
if (opts && opts.type === 'Range') {
|
||
var num = Number(
|
||
numEnd !== undefined && numEnd !== value.length
|
||
? value.substr(0, numEnd)
|
||
: value
|
||
);
|
||
|
||
if (isNaN(num)) {
|
||
return true;
|
||
}
|
||
|
||
if (opts.min !== null && num < opts.min) {
|
||
return true;
|
||
}
|
||
|
||
if (opts.max !== null && num > opts.max) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
function consumeFunction(token, getNextToken) {
|
||
var startIdx = token.index;
|
||
var length = 0;
|
||
|
||
// balanced token consuming
|
||
do {
|
||
length++;
|
||
|
||
if (token.balance <= startIdx) {
|
||
break;
|
||
}
|
||
} while (token = getNextToken(length));
|
||
|
||
return length;
|
||
}
|
||
|
||
// TODO: implement
|
||
// can be used wherever <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> values are allowed
|
||
// https://drafts.csswg.org/css-values/#calc-notation
|
||
function calc(next) {
|
||
return function(token, getNextToken, opts) {
|
||
if (token === null) {
|
||
return 0;
|
||
}
|
||
|
||
if (token.type === TYPE.Function && eqStrAny(token.value, calcFunctionNames)) {
|
||
return consumeFunction(token, getNextToken);
|
||
}
|
||
|
||
return next(token, getNextToken, opts);
|
||
};
|
||
}
|
||
|
||
function tokenType(expectedTokenType) {
|
||
return function(token) {
|
||
if (token === null || token.type !== expectedTokenType) {
|
||
return 0;
|
||
}
|
||
|
||
return 1;
|
||
};
|
||
}
|
||
|
||
function func(name) {
|
||
name = name + '(';
|
||
|
||
return function(token, getNextToken) {
|
||
if (token !== null && eqStr(token.value, name)) {
|
||
return consumeFunction(token, getNextToken);
|
||
}
|
||
|
||
return 0;
|
||
};
|
||
}
|
||
|
||
// =========================
|
||
// Complex types
|
||
//
|
||
|
||
// https://drafts.csswg.org/css-values-4/#custom-idents
|
||
// 4.2. Author-defined Identifiers: the <custom-ident> type
|
||
// Some properties accept arbitrary author-defined identifiers as a component value.
|
||
// This generic data type is denoted by <custom-ident>, and represents any valid CSS identifier
|
||
// that would not be misinterpreted as a pre-defined keyword in that property’s value definition.
|
||
//
|
||
// See also: https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident
|
||
function customIdent(token) {
|
||
if (token === null || token.type !== TYPE.Ident) {
|
||
return 0;
|
||
}
|
||
|
||
var name = token.value.toLowerCase();
|
||
|
||
// The CSS-wide keywords are not valid <custom-ident>s
|
||
if (eqStrAny(name, cssWideKeywords)) {
|
||
return 0;
|
||
}
|
||
|
||
// The default keyword is reserved and is also not a valid <custom-ident>
|
||
if (eqStr(name, 'default')) {
|
||
return 0;
|
||
}
|
||
|
||
// TODO: ignore property specific keywords (as described https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident)
|
||
// Specifications using <custom-ident> must specify clearly what other keywords
|
||
// are excluded from <custom-ident>, if any—for example by saying that any pre-defined keywords
|
||
// in that property’s value definition are excluded. Excluded keywords are excluded
|
||
// in all ASCII case permutations.
|
||
|
||
return 1;
|
||
}
|
||
|
||
// https://drafts.csswg.org/css-variables/#typedef-custom-property-name
|
||
// A custom property is any property whose name starts with two dashes (U+002D HYPHEN-MINUS), like --foo.
|
||
// The <custom-property-name> production corresponds to this: it’s defined as any valid identifier
|
||
// that starts with two dashes, except -- itself, which is reserved for future use by CSS.
|
||
// NOTE: Current implementation treat `--` as a valid name since most (all?) major browsers treat it as valid.
|
||
function customPropertyName(token) {
|
||
// ... defined as any valid identifier
|
||
if (token === null || token.type !== TYPE.Ident) {
|
||
return 0;
|
||
}
|
||
|
||
// ... that starts with two dashes (U+002D HYPHEN-MINUS)
|
||
if (charCode(token.value, 0) !== 0x002D || charCode(token.value, 1) !== 0x002D) {
|
||
return 0;
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
|
||
// https://drafts.csswg.org/css-color-4/#hex-notation
|
||
// The syntax of a <hex-color> is a <hash-token> token whose value consists of 3, 4, 6, or 8 hexadecimal digits.
|
||
// In other words, a hex color is written as a hash character, "#", followed by some number of digits 0-9 or
|
||
// letters a-f (the case of the letters doesn’t matter - #00ff00 is identical to #00FF00).
|
||
function hexColor(token) {
|
||
if (token === null || token.type !== TYPE.Hash) {
|
||
return 0;
|
||
}
|
||
|
||
var length = token.value.length;
|
||
|
||
// valid values (length): #rgb (4), #rgba (5), #rrggbb (7), #rrggbbaa (9)
|
||
if (length !== 4 && length !== 5 && length !== 7 && length !== 9) {
|
||
return 0;
|
||
}
|
||
|
||
for (var i = 1; i < length; i++) {
|
||
if (!isHexDigit(token.value.charCodeAt(i))) {
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
|
||
function idSelector(token) {
|
||
if (token === null || token.type !== TYPE.Hash) {
|
||
return 0;
|
||
}
|
||
|
||
if (!isIdentifierStart(charCode(token.value, 1), charCode(token.value, 2), charCode(token.value, 3))) {
|
||
return 0;
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
|
||
// https://drafts.csswg.org/css-syntax/#any-value
|
||
// It represents the entirety of what a valid declaration can have as its value.
|
||
function declarationValue(token, getNextToken) {
|
||
if (!token) {
|
||
return 0;
|
||
}
|
||
|
||
var length = 0;
|
||
var level = 0;
|
||
var startIdx = token.index;
|
||
|
||
// The <declaration-value> production matches any sequence of one or more tokens,
|
||
// so long as the sequence ...
|
||
scan:
|
||
do {
|
||
switch (token.type) {
|
||
// ... does not contain <bad-string-token>, <bad-url-token>,
|
||
case TYPE.BadString:
|
||
case TYPE.BadUrl:
|
||
break scan;
|
||
|
||
// ... unmatched <)-token>, <]-token>, or <}-token>,
|
||
case TYPE.RightCurlyBracket:
|
||
case TYPE.RightParenthesis:
|
||
case TYPE.RightSquareBracket:
|
||
if (token.balance > token.index || token.balance < startIdx) {
|
||
break scan;
|
||
}
|
||
|
||
level--;
|
||
break;
|
||
|
||
// ... or top-level <semicolon-token> tokens
|
||
case TYPE.Semicolon:
|
||
if (level === 0) {
|
||
break scan;
|
||
}
|
||
|
||
break;
|
||
|
||
// ... or <delim-token> tokens with a value of "!"
|
||
case TYPE.Delim:
|
||
if (token.value === '!' && level === 0) {
|
||
break scan;
|
||
}
|
||
|
||
break;
|
||
|
||
case TYPE.Function:
|
||
case TYPE.LeftParenthesis:
|
||
case TYPE.LeftSquareBracket:
|
||
case TYPE.LeftCurlyBracket:
|
||
level++;
|
||
break;
|
||
}
|
||
|
||
length++;
|
||
|
||
// until balance closing
|
||
if (token.balance <= startIdx) {
|
||
break;
|
||
}
|
||
} while (token = getNextToken(length));
|
||
|
||
return length;
|
||
}
|
||
|
||
// https://drafts.csswg.org/css-syntax/#any-value
|
||
// The <any-value> production is identical to <declaration-value>, but also
|
||
// allows top-level <semicolon-token> tokens and <delim-token> tokens
|
||
// with a value of "!". It represents the entirety of what valid CSS can be in any context.
|
||
function anyValue(token, getNextToken) {
|
||
if (!token) {
|
||
return 0;
|
||
}
|
||
|
||
var startIdx = token.index;
|
||
var length = 0;
|
||
|
||
// The <any-value> production matches any sequence of one or more tokens,
|
||
// so long as the sequence ...
|
||
scan:
|
||
do {
|
||
switch (token.type) {
|
||
// ... does not contain <bad-string-token>, <bad-url-token>,
|
||
case TYPE.BadString:
|
||
case TYPE.BadUrl:
|
||
break scan;
|
||
|
||
// ... unmatched <)-token>, <]-token>, or <}-token>,
|
||
case TYPE.RightCurlyBracket:
|
||
case TYPE.RightParenthesis:
|
||
case TYPE.RightSquareBracket:
|
||
if (token.balance > token.index || token.balance < startIdx) {
|
||
break scan;
|
||
}
|
||
|
||
break;
|
||
}
|
||
|
||
length++;
|
||
|
||
// until balance closing
|
||
if (token.balance <= startIdx) {
|
||
break;
|
||
}
|
||
} while (token = getNextToken(length));
|
||
|
||
return length;
|
||
}
|
||
|
||
// =========================
|
||
// Dimensions
|
||
//
|
||
|
||
function dimension(type) {
|
||
return function(token, getNextToken, opts) {
|
||
if (token === null || token.type !== TYPE.Dimension) {
|
||
return 0;
|
||
}
|
||
|
||
var numberEnd = consumeNumber(token.value, 0);
|
||
|
||
// check unit
|
||
if (type !== null) {
|
||
// check for IE postfix hack, i.e. 123px\0 or 123px\9
|
||
var reverseSolidusOffset = token.value.indexOf('\\', numberEnd);
|
||
var unit = reverseSolidusOffset === -1 || !isPostfixIeHack(token.value, reverseSolidusOffset)
|
||
? token.value.substr(numberEnd)
|
||
: token.value.substring(numberEnd, reverseSolidusOffset);
|
||
|
||
if (type.hasOwnProperty(unit.toLowerCase()) === false) {
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
// check range if specified
|
||
if (outOfRange(opts, token.value, numberEnd)) {
|
||
return 0;
|
||
}
|
||
|
||
return 1;
|
||
};
|
||
}
|
||
|
||
// =========================
|
||
// Percentage
|
||
//
|
||
|
||
// §5.5. Percentages: the <percentage> type
|
||
// https://drafts.csswg.org/css-values-4/#percentages
|
||
function percentage(token, getNextToken, opts) {
|
||
// ... corresponds to the <percentage-token> production
|
||
if (token === null || token.type !== TYPE.Percentage) {
|
||
return 0;
|
||
}
|
||
|
||
// check range if specified
|
||
if (outOfRange(opts, token.value, token.value.length - 1)) {
|
||
return 0;
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
|
||
// =========================
|
||
// Numeric
|
||
//
|
||
|
||
// https://drafts.csswg.org/css-values-4/#numbers
|
||
// The value <zero> represents a literal number with the value 0. Expressions that merely
|
||
// evaluate to a <number> with the value 0 (for example, calc(0)) do not match <zero>;
|
||
// only literal <number-token>s do.
|
||
function zero(next) {
|
||
if (typeof next !== 'function') {
|
||
next = function() {
|
||
return 0;
|
||
};
|
||
}
|
||
|
||
return function(token, getNextToken, opts) {
|
||
if (token !== null && token.type === TYPE.Number) {
|
||
if (Number(token.value) === 0) {
|
||
return 1;
|
||
}
|
||
}
|
||
|
||
return next(token, getNextToken, opts);
|
||
};
|
||
}
|
||
|
||
// § 5.3. Real Numbers: the <number> type
|
||
// https://drafts.csswg.org/css-values-4/#numbers
|
||
// Number values are denoted by <number>, and represent real numbers, possibly with a fractional component.
|
||
// ... It corresponds to the <number-token> production
|
||
function number(token, getNextToken, opts) {
|
||
if (token === null) {
|
||
return 0;
|
||
}
|
||
|
||
var numberEnd = consumeNumber(token.value, 0);
|
||
var isNumber = numberEnd === token.value.length;
|
||
if (!isNumber && !isPostfixIeHack(token.value, numberEnd)) {
|
||
return 0;
|
||
}
|
||
|
||
// check range if specified
|
||
if (outOfRange(opts, token.value, numberEnd)) {
|
||
return 0;
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
|
||
// §5.2. Integers: the <integer> type
|
||
// https://drafts.csswg.org/css-values-4/#integers
|
||
function integer(token, getNextToken, opts) {
|
||
// ... corresponds to a subset of the <number-token> production
|
||
if (token === null || token.type !== TYPE.Number) {
|
||
return 0;
|
||
}
|
||
|
||
// The first digit of an integer may be immediately preceded by `-` or `+` to indicate the integer’s sign.
|
||
var i = token.value.charCodeAt(0) === 0x002B || // U+002B PLUS SIGN (+)
|
||
token.value.charCodeAt(0) === 0x002D ? 1 : 0; // U+002D HYPHEN-MINUS (-)
|
||
|
||
// When written literally, an integer is one or more decimal digits 0 through 9 ...
|
||
for (; i < token.value.length; i++) {
|
||
if (!isDigit(token.value.charCodeAt(i))) {
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
// check range if specified
|
||
if (outOfRange(opts, token.value, i)) {
|
||
return 0;
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
|
||
module.exports = {
|
||
// token types
|
||
'ident-token': tokenType(TYPE.Ident),
|
||
'function-token': tokenType(TYPE.Function),
|
||
'at-keyword-token': tokenType(TYPE.AtKeyword),
|
||
'hash-token': tokenType(TYPE.Hash),
|
||
'string-token': tokenType(TYPE.String),
|
||
'bad-string-token': tokenType(TYPE.BadString),
|
||
'url-token': tokenType(TYPE.Url),
|
||
'bad-url-token': tokenType(TYPE.BadUrl),
|
||
'delim-token': tokenType(TYPE.Delim),
|
||
'number-token': tokenType(TYPE.Number),
|
||
'percentage-token': tokenType(TYPE.Percentage),
|
||
'dimension-token': tokenType(TYPE.Dimension),
|
||
'whitespace-token': tokenType(TYPE.WhiteSpace),
|
||
'CDO-token': tokenType(TYPE.CDO),
|
||
'CDC-token': tokenType(TYPE.CDC),
|
||
'colon-token': tokenType(TYPE.Colon),
|
||
'semicolon-token': tokenType(TYPE.Semicolon),
|
||
'comma-token': tokenType(TYPE.Comma),
|
||
'[-token': tokenType(TYPE.LeftSquareBracket),
|
||
']-token': tokenType(TYPE.RightSquareBracket),
|
||
'(-token': tokenType(TYPE.LeftParenthesis),
|
||
')-token': tokenType(TYPE.RightParenthesis),
|
||
'{-token': tokenType(TYPE.LeftCurlyBracket),
|
||
'}-token': tokenType(TYPE.RightCurlyBracket),
|
||
|
||
// token type aliases
|
||
'string': tokenType(TYPE.String),
|
||
'ident': tokenType(TYPE.Ident),
|
||
|
||
// complex types
|
||
'custom-ident': customIdent,
|
||
'custom-property-name': customPropertyName,
|
||
'hex-color': hexColor,
|
||
'id-selector': idSelector, // element( <id-selector> )
|
||
'an-plus-b': anPlusB,
|
||
'urange': urange,
|
||
'declaration-value': declarationValue,
|
||
'any-value': anyValue,
|
||
|
||
// dimensions
|
||
'dimension': calc(dimension(null)),
|
||
'angle': calc(dimension(ANGLE)),
|
||
'decibel': calc(dimension(DECIBEL)),
|
||
'frequency': calc(dimension(FREQUENCY)),
|
||
'flex': calc(dimension(FLEX)),
|
||
'length': calc(zero(dimension(LENGTH))),
|
||
'resolution': calc(dimension(RESOLUTION)),
|
||
'semitones': calc(dimension(SEMITONES)),
|
||
'time': calc(dimension(TIME)),
|
||
|
||
// percentage
|
||
'percentage': calc(percentage),
|
||
|
||
// numeric
|
||
'zero': zero(),
|
||
'number': calc(number),
|
||
'integer': calc(integer),
|
||
|
||
// old IE stuff
|
||
'-ms-legacy-expression': func('expression')
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 27 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TokenStream = __webpack_require__(18);
|
||
var adoptBuffer = __webpack_require__(28);
|
||
|
||
var constants = __webpack_require__(19);
|
||
var TYPE = constants.TYPE;
|
||
|
||
var charCodeDefinitions = __webpack_require__(21);
|
||
var isNewline = charCodeDefinitions.isNewline;
|
||
var isName = charCodeDefinitions.isName;
|
||
var isValidEscape = charCodeDefinitions.isValidEscape;
|
||
var isNumberStart = charCodeDefinitions.isNumberStart;
|
||
var isIdentifierStart = charCodeDefinitions.isIdentifierStart;
|
||
var charCodeCategory = charCodeDefinitions.charCodeCategory;
|
||
var isBOM = charCodeDefinitions.isBOM;
|
||
|
||
var utils = __webpack_require__(20);
|
||
var cmpStr = utils.cmpStr;
|
||
var getNewlineLength = utils.getNewlineLength;
|
||
var findWhiteSpaceEnd = utils.findWhiteSpaceEnd;
|
||
var consumeEscaped = utils.consumeEscaped;
|
||
var consumeName = utils.consumeName;
|
||
var consumeNumber = utils.consumeNumber;
|
||
var consumeBadUrlRemnants = utils.consumeBadUrlRemnants;
|
||
|
||
var OFFSET_MASK = 0x00FFFFFF;
|
||
var TYPE_SHIFT = 24;
|
||
|
||
function tokenize(source, stream) {
|
||
function getCharCode(offset) {
|
||
return offset < sourceLength ? source.charCodeAt(offset) : 0;
|
||
}
|
||
|
||
// § 4.3.3. Consume a numeric token
|
||
function consumeNumericToken() {
|
||
// Consume a number and let number be the result.
|
||
offset = consumeNumber(source, offset);
|
||
|
||
// If the next 3 input code points would start an identifier, then:
|
||
if (isIdentifierStart(getCharCode(offset), getCharCode(offset + 1), getCharCode(offset + 2))) {
|
||
// Create a <dimension-token> with the same value and type flag as number, and a unit set initially to the empty string.
|
||
// Consume a name. Set the <dimension-token>’s unit to the returned value.
|
||
// Return the <dimension-token>.
|
||
type = TYPE.Dimension;
|
||
offset = consumeName(source, offset);
|
||
return;
|
||
}
|
||
|
||
// Otherwise, if the next input code point is U+0025 PERCENTAGE SIGN (%), consume it.
|
||
if (getCharCode(offset) === 0x0025) {
|
||
// Create a <percentage-token> with the same value as number, and return it.
|
||
type = TYPE.Percentage;
|
||
offset++;
|
||
return;
|
||
}
|
||
|
||
// Otherwise, create a <number-token> with the same value and type flag as number, and return it.
|
||
type = TYPE.Number;
|
||
}
|
||
|
||
// § 4.3.4. Consume an ident-like token
|
||
function consumeIdentLikeToken() {
|
||
const nameStartOffset = offset;
|
||
|
||
// Consume a name, and let string be the result.
|
||
offset = consumeName(source, offset);
|
||
|
||
// If string’s value is an ASCII case-insensitive match for "url",
|
||
// and the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
|
||
if (cmpStr(source, nameStartOffset, offset, 'url') && getCharCode(offset) === 0x0028) {
|
||
// While the next two input code points are whitespace, consume the next input code point.
|
||
offset = findWhiteSpaceEnd(source, offset + 1);
|
||
|
||
// If the next one or two input code points are U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('),
|
||
// or whitespace followed by U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('),
|
||
// then create a <function-token> with its value set to string and return it.
|
||
if (getCharCode(offset) === 0x0022 ||
|
||
getCharCode(offset) === 0x0027) {
|
||
type = TYPE.Function;
|
||
offset = nameStartOffset + 4;
|
||
return;
|
||
}
|
||
|
||
// Otherwise, consume a url token, and return it.
|
||
consumeUrlToken();
|
||
return;
|
||
}
|
||
|
||
// Otherwise, if the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.
|
||
// Create a <function-token> with its value set to string and return it.
|
||
if (getCharCode(offset) === 0x0028) {
|
||
type = TYPE.Function;
|
||
offset++;
|
||
return;
|
||
}
|
||
|
||
// Otherwise, create an <ident-token> with its value set to string and return it.
|
||
type = TYPE.Ident;
|
||
}
|
||
|
||
// § 4.3.5. Consume a string token
|
||
function consumeStringToken(endingCodePoint) {
|
||
// This algorithm may be called with an ending code point, which denotes the code point
|
||
// that ends the string. If an ending code point is not specified,
|
||
// the current input code point is used.
|
||
if (!endingCodePoint) {
|
||
endingCodePoint = getCharCode(offset++);
|
||
}
|
||
|
||
// Initially create a <string-token> with its value set to the empty string.
|
||
type = TYPE.String;
|
||
|
||
// Repeatedly consume the next input code point from the stream:
|
||
for (; offset < source.length; offset++) {
|
||
var code = source.charCodeAt(offset);
|
||
|
||
switch (charCodeCategory(code)) {
|
||
// ending code point
|
||
case endingCodePoint:
|
||
// Return the <string-token>.
|
||
offset++;
|
||
return;
|
||
|
||
// EOF
|
||
case charCodeCategory.Eof:
|
||
// This is a parse error. Return the <string-token>.
|
||
return;
|
||
|
||
// newline
|
||
case charCodeCategory.WhiteSpace:
|
||
if (isNewline(code)) {
|
||
// This is a parse error. Reconsume the current input code point,
|
||
// create a <bad-string-token>, and return it.
|
||
offset += getNewlineLength(source, offset, code);
|
||
type = TYPE.BadString;
|
||
return;
|
||
}
|
||
break;
|
||
|
||
// U+005C REVERSE SOLIDUS (\)
|
||
case 0x005C:
|
||
// If the next input code point is EOF, do nothing.
|
||
if (offset === source.length - 1) {
|
||
break;
|
||
}
|
||
|
||
var nextCode = getCharCode(offset + 1);
|
||
|
||
// Otherwise, if the next input code point is a newline, consume it.
|
||
if (isNewline(nextCode)) {
|
||
offset += getNewlineLength(source, offset + 1, nextCode);
|
||
} else if (isValidEscape(code, nextCode)) {
|
||
// Otherwise, (the stream starts with a valid escape) consume
|
||
// an escaped code point and append the returned code point to
|
||
// the <string-token>’s value.
|
||
offset = consumeEscaped(source, offset) - 1;
|
||
}
|
||
break;
|
||
|
||
// anything else
|
||
// Append the current input code point to the <string-token>’s value.
|
||
}
|
||
}
|
||
}
|
||
|
||
// § 4.3.6. Consume a url token
|
||
// Note: This algorithm assumes that the initial "url(" has already been consumed.
|
||
// This algorithm also assumes that it’s being called to consume an "unquoted" value, like url(foo).
|
||
// A quoted value, like url("foo"), is parsed as a <function-token>. Consume an ident-like token
|
||
// automatically handles this distinction; this algorithm shouldn’t be called directly otherwise.
|
||
function consumeUrlToken() {
|
||
// Initially create a <url-token> with its value set to the empty string.
|
||
type = TYPE.Url;
|
||
|
||
// Consume as much whitespace as possible.
|
||
offset = findWhiteSpaceEnd(source, offset);
|
||
|
||
// Repeatedly consume the next input code point from the stream:
|
||
for (; offset < source.length; offset++) {
|
||
var code = source.charCodeAt(offset);
|
||
|
||
switch (charCodeCategory(code)) {
|
||
// U+0029 RIGHT PARENTHESIS ())
|
||
case 0x0029:
|
||
// Return the <url-token>.
|
||
offset++;
|
||
return;
|
||
|
||
// EOF
|
||
case charCodeCategory.Eof:
|
||
// This is a parse error. Return the <url-token>.
|
||
return;
|
||
|
||
// whitespace
|
||
case charCodeCategory.WhiteSpace:
|
||
// Consume as much whitespace as possible.
|
||
offset = findWhiteSpaceEnd(source, offset);
|
||
|
||
// If the next input code point is U+0029 RIGHT PARENTHESIS ()) or EOF,
|
||
// consume it and return the <url-token>
|
||
// (if EOF was encountered, this is a parse error);
|
||
if (getCharCode(offset) === 0x0029 || offset >= source.length) {
|
||
if (offset < source.length) {
|
||
offset++;
|
||
}
|
||
return;
|
||
}
|
||
|
||
// otherwise, consume the remnants of a bad url, create a <bad-url-token>,
|
||
// and return it.
|
||
offset = consumeBadUrlRemnants(source, offset);
|
||
type = TYPE.BadUrl;
|
||
return;
|
||
|
||
// U+0022 QUOTATION MARK (")
|
||
// U+0027 APOSTROPHE (')
|
||
// U+0028 LEFT PARENTHESIS (()
|
||
// non-printable code point
|
||
case 0x0022:
|
||
case 0x0027:
|
||
case 0x0028:
|
||
case charCodeCategory.NonPrintable:
|
||
// This is a parse error. Consume the remnants of a bad url,
|
||
// create a <bad-url-token>, and return it.
|
||
offset = consumeBadUrlRemnants(source, offset);
|
||
type = TYPE.BadUrl;
|
||
return;
|
||
|
||
// U+005C REVERSE SOLIDUS (\)
|
||
case 0x005C:
|
||
// If the stream starts with a valid escape, consume an escaped code point and
|
||
// append the returned code point to the <url-token>’s value.
|
||
if (isValidEscape(code, getCharCode(offset + 1))) {
|
||
offset = consumeEscaped(source, offset) - 1;
|
||
break;
|
||
}
|
||
|
||
// Otherwise, this is a parse error. Consume the remnants of a bad url,
|
||
// create a <bad-url-token>, and return it.
|
||
offset = consumeBadUrlRemnants(source, offset);
|
||
type = TYPE.BadUrl;
|
||
return;
|
||
|
||
// anything else
|
||
// Append the current input code point to the <url-token>’s value.
|
||
}
|
||
}
|
||
}
|
||
|
||
if (!stream) {
|
||
stream = new TokenStream();
|
||
}
|
||
|
||
// ensure source is a string
|
||
source = String(source || '');
|
||
|
||
var sourceLength = source.length;
|
||
var offsetAndType = adoptBuffer(stream.offsetAndType, sourceLength + 1); // +1 because of eof-token
|
||
var balance = adoptBuffer(stream.balance, sourceLength + 1);
|
||
var tokenCount = 0;
|
||
var start = isBOM(getCharCode(0));
|
||
var offset = start;
|
||
var balanceCloseType = 0;
|
||
var balanceStart = 0;
|
||
var balancePrev = 0;
|
||
|
||
// https://drafts.csswg.org/css-syntax-3/#consume-token
|
||
// § 4.3.1. Consume a token
|
||
while (offset < sourceLength) {
|
||
var code = source.charCodeAt(offset);
|
||
var type = 0;
|
||
|
||
balance[tokenCount] = sourceLength;
|
||
|
||
switch (charCodeCategory(code)) {
|
||
// whitespace
|
||
case charCodeCategory.WhiteSpace:
|
||
// Consume as much whitespace as possible. Return a <whitespace-token>.
|
||
type = TYPE.WhiteSpace;
|
||
offset = findWhiteSpaceEnd(source, offset + 1);
|
||
break;
|
||
|
||
// U+0022 QUOTATION MARK (")
|
||
case 0x0022:
|
||
// Consume a string token and return it.
|
||
consumeStringToken();
|
||
break;
|
||
|
||
// U+0023 NUMBER SIGN (#)
|
||
case 0x0023:
|
||
// If the next input code point is a name code point or the next two input code points are a valid escape, then:
|
||
if (isName(getCharCode(offset + 1)) || isValidEscape(getCharCode(offset + 1), getCharCode(offset + 2))) {
|
||
// Create a <hash-token>.
|
||
type = TYPE.Hash;
|
||
|
||
// If the next 3 input code points would start an identifier, set the <hash-token>’s type flag to "id".
|
||
// if (isIdentifierStart(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
|
||
// // TODO: set id flag
|
||
// }
|
||
|
||
// Consume a name, and set the <hash-token>’s value to the returned string.
|
||
offset = consumeName(source, offset + 1);
|
||
|
||
// Return the <hash-token>.
|
||
} else {
|
||
// Otherwise, return a <delim-token> with its value set to the current input code point.
|
||
type = TYPE.Delim;
|
||
offset++;
|
||
}
|
||
|
||
break;
|
||
|
||
// U+0027 APOSTROPHE (')
|
||
case 0x0027:
|
||
// Consume a string token and return it.
|
||
consumeStringToken();
|
||
break;
|
||
|
||
// U+0028 LEFT PARENTHESIS (()
|
||
case 0x0028:
|
||
// Return a <(-token>.
|
||
type = TYPE.LeftParenthesis;
|
||
offset++;
|
||
break;
|
||
|
||
// U+0029 RIGHT PARENTHESIS ())
|
||
case 0x0029:
|
||
// Return a <)-token>.
|
||
type = TYPE.RightParenthesis;
|
||
offset++;
|
||
break;
|
||
|
||
// U+002B PLUS SIGN (+)
|
||
case 0x002B:
|
||
// If the input stream starts with a number, ...
|
||
if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
|
||
// ... reconsume the current input code point, consume a numeric token, and return it.
|
||
consumeNumericToken();
|
||
} else {
|
||
// Otherwise, return a <delim-token> with its value set to the current input code point.
|
||
type = TYPE.Delim;
|
||
offset++;
|
||
}
|
||
break;
|
||
|
||
// U+002C COMMA (,)
|
||
case 0x002C:
|
||
// Return a <comma-token>.
|
||
type = TYPE.Comma;
|
||
offset++;
|
||
break;
|
||
|
||
// U+002D HYPHEN-MINUS (-)
|
||
case 0x002D:
|
||
// If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it.
|
||
if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
|
||
consumeNumericToken();
|
||
} else {
|
||
// Otherwise, if the next 2 input code points are U+002D HYPHEN-MINUS U+003E GREATER-THAN SIGN (->), consume them and return a <CDC-token>.
|
||
if (getCharCode(offset + 1) === 0x002D &&
|
||
getCharCode(offset + 2) === 0x003E) {
|
||
type = TYPE.CDC;
|
||
offset = offset + 3;
|
||
} else {
|
||
// Otherwise, if the input stream starts with an identifier, ...
|
||
if (isIdentifierStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
|
||
// ... reconsume the current input code point, consume an ident-like token, and return it.
|
||
consumeIdentLikeToken();
|
||
} else {
|
||
// Otherwise, return a <delim-token> with its value set to the current input code point.
|
||
type = TYPE.Delim;
|
||
offset++;
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
// U+002E FULL STOP (.)
|
||
case 0x002E:
|
||
// If the input stream starts with a number, ...
|
||
if (isNumberStart(code, getCharCode(offset + 1), getCharCode(offset + 2))) {
|
||
// ... reconsume the current input code point, consume a numeric token, and return it.
|
||
consumeNumericToken();
|
||
} else {
|
||
// Otherwise, return a <delim-token> with its value set to the current input code point.
|
||
type = TYPE.Delim;
|
||
offset++;
|
||
}
|
||
|
||
break;
|
||
|
||
// U+002F SOLIDUS (/)
|
||
case 0x002F:
|
||
// If the next two input code point are U+002F SOLIDUS (/) followed by a U+002A ASTERISK (*),
|
||
if (getCharCode(offset + 1) === 0x002A) {
|
||
// ... consume them and all following code points up to and including the first U+002A ASTERISK (*)
|
||
// followed by a U+002F SOLIDUS (/), or up to an EOF code point.
|
||
type = TYPE.Comment;
|
||
offset = source.indexOf('*/', offset + 2) + 2;
|
||
if (offset === 1) {
|
||
offset = source.length;
|
||
}
|
||
} else {
|
||
type = TYPE.Delim;
|
||
offset++;
|
||
}
|
||
break;
|
||
|
||
// U+003A COLON (:)
|
||
case 0x003A:
|
||
// Return a <colon-token>.
|
||
type = TYPE.Colon;
|
||
offset++;
|
||
break;
|
||
|
||
// U+003B SEMICOLON (;)
|
||
case 0x003B:
|
||
// Return a <semicolon-token>.
|
||
type = TYPE.Semicolon;
|
||
offset++;
|
||
break;
|
||
|
||
// U+003C LESS-THAN SIGN (<)
|
||
case 0x003C:
|
||
// If the next 3 input code points are U+0021 EXCLAMATION MARK U+002D HYPHEN-MINUS U+002D HYPHEN-MINUS (!--), ...
|
||
if (getCharCode(offset + 1) === 0x0021 &&
|
||
getCharCode(offset + 2) === 0x002D &&
|
||
getCharCode(offset + 3) === 0x002D) {
|
||
// ... consume them and return a <CDO-token>.
|
||
type = TYPE.CDO;
|
||
offset = offset + 4;
|
||
} else {
|
||
// Otherwise, return a <delim-token> with its value set to the current input code point.
|
||
type = TYPE.Delim;
|
||
offset++;
|
||
}
|
||
|
||
break;
|
||
|
||
// U+0040 COMMERCIAL AT (@)
|
||
case 0x0040:
|
||
// If the next 3 input code points would start an identifier, ...
|
||
if (isIdentifierStart(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) {
|
||
// ... consume a name, create an <at-keyword-token> with its value set to the returned value, and return it.
|
||
type = TYPE.AtKeyword;
|
||
offset = consumeName(source, offset + 1);
|
||
} else {
|
||
// Otherwise, return a <delim-token> with its value set to the current input code point.
|
||
type = TYPE.Delim;
|
||
offset++;
|
||
}
|
||
|
||
break;
|
||
|
||
// U+005B LEFT SQUARE BRACKET ([)
|
||
case 0x005B:
|
||
// Return a <[-token>.
|
||
type = TYPE.LeftSquareBracket;
|
||
offset++;
|
||
break;
|
||
|
||
// U+005C REVERSE SOLIDUS (\)
|
||
case 0x005C:
|
||
// If the input stream starts with a valid escape, ...
|
||
if (isValidEscape(code, getCharCode(offset + 1))) {
|
||
// ... reconsume the current input code point, consume an ident-like token, and return it.
|
||
consumeIdentLikeToken();
|
||
} else {
|
||
// Otherwise, this is a parse error. Return a <delim-token> with its value set to the current input code point.
|
||
type = TYPE.Delim;
|
||
offset++;
|
||
}
|
||
break;
|
||
|
||
// U+005D RIGHT SQUARE BRACKET (])
|
||
case 0x005D:
|
||
// Return a <]-token>.
|
||
type = TYPE.RightSquareBracket;
|
||
offset++;
|
||
break;
|
||
|
||
// U+007B LEFT CURLY BRACKET ({)
|
||
case 0x007B:
|
||
// Return a <{-token>.
|
||
type = TYPE.LeftCurlyBracket;
|
||
offset++;
|
||
break;
|
||
|
||
// U+007D RIGHT CURLY BRACKET (})
|
||
case 0x007D:
|
||
// Return a <}-token>.
|
||
type = TYPE.RightCurlyBracket;
|
||
offset++;
|
||
break;
|
||
|
||
// digit
|
||
case charCodeCategory.Digit:
|
||
// Reconsume the current input code point, consume a numeric token, and return it.
|
||
consumeNumericToken();
|
||
break;
|
||
|
||
// name-start code point
|
||
case charCodeCategory.NameStart:
|
||
// Reconsume the current input code point, consume an ident-like token, and return it.
|
||
consumeIdentLikeToken();
|
||
break;
|
||
|
||
// EOF
|
||
case charCodeCategory.Eof:
|
||
// Return an <EOF-token>.
|
||
break;
|
||
|
||
// anything else
|
||
default:
|
||
// Return a <delim-token> with its value set to the current input code point.
|
||
type = TYPE.Delim;
|
||
offset++;
|
||
}
|
||
|
||
switch (type) {
|
||
case balanceCloseType:
|
||
balancePrev = balanceStart & OFFSET_MASK;
|
||
balanceStart = balance[balancePrev];
|
||
balanceCloseType = balanceStart >> TYPE_SHIFT;
|
||
balance[tokenCount] = balancePrev;
|
||
balance[balancePrev++] = tokenCount;
|
||
for (; balancePrev < tokenCount; balancePrev++) {
|
||
if (balance[balancePrev] === sourceLength) {
|
||
balance[balancePrev] = tokenCount;
|
||
}
|
||
}
|
||
break;
|
||
|
||
case TYPE.LeftParenthesis:
|
||
case TYPE.Function:
|
||
balance[tokenCount] = balanceStart;
|
||
balanceCloseType = TYPE.RightParenthesis;
|
||
balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
|
||
break;
|
||
|
||
case TYPE.LeftSquareBracket:
|
||
balance[tokenCount] = balanceStart;
|
||
balanceCloseType = TYPE.RightSquareBracket;
|
||
balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
|
||
break;
|
||
|
||
case TYPE.LeftCurlyBracket:
|
||
balance[tokenCount] = balanceStart;
|
||
balanceCloseType = TYPE.RightCurlyBracket;
|
||
balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount;
|
||
break;
|
||
}
|
||
|
||
offsetAndType[tokenCount++] = (type << TYPE_SHIFT) | offset;
|
||
}
|
||
|
||
// finalize buffers
|
||
offsetAndType[tokenCount] = (TYPE.EOF << TYPE_SHIFT) | offset; // <EOF-token>
|
||
balance[tokenCount] = sourceLength;
|
||
balance[sourceLength] = sourceLength; // prevents false positive balance match with any token
|
||
while (balanceStart !== 0) {
|
||
balancePrev = balanceStart & OFFSET_MASK;
|
||
balanceStart = balance[balancePrev];
|
||
balance[balancePrev] = sourceLength;
|
||
}
|
||
|
||
// update stream
|
||
stream.source = source;
|
||
stream.firstCharOffset = start;
|
||
stream.offsetAndType = offsetAndType;
|
||
stream.tokenCount = tokenCount;
|
||
stream.balance = balance;
|
||
stream.reset();
|
||
stream.next();
|
||
|
||
return stream;
|
||
}
|
||
|
||
// extend tokenizer with constants
|
||
Object.keys(constants).forEach(function(key) {
|
||
tokenize[key] = constants[key];
|
||
});
|
||
|
||
// extend tokenizer with static methods from utils
|
||
Object.keys(charCodeDefinitions).forEach(function(key) {
|
||
tokenize[key] = charCodeDefinitions[key];
|
||
});
|
||
Object.keys(utils).forEach(function(key) {
|
||
tokenize[key] = utils[key];
|
||
});
|
||
|
||
module.exports = tokenize;
|
||
|
||
|
||
/***/ }),
|
||
/* 28 */
|
||
/***/ ((module) => {
|
||
|
||
var MIN_SIZE = 16 * 1024;
|
||
var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
|
||
|
||
module.exports = function adoptBuffer(buffer, size) {
|
||
if (buffer === null || buffer.length < size) {
|
||
return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE));
|
||
}
|
||
|
||
return buffer;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 29 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var isDigit = __webpack_require__(27).isDigit;
|
||
var cmpChar = __webpack_require__(27).cmpChar;
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var DELIM = TYPE.Delim;
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var COMMENT = TYPE.Comment;
|
||
var IDENT = TYPE.Ident;
|
||
var NUMBER = TYPE.Number;
|
||
var DIMENSION = TYPE.Dimension;
|
||
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||
var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
|
||
var N = 0x006E; // U+006E LATIN SMALL LETTER N (n)
|
||
var DISALLOW_SIGN = true;
|
||
var ALLOW_SIGN = false;
|
||
|
||
function isDelim(token, code) {
|
||
return token !== null && token.type === DELIM && token.value.charCodeAt(0) === code;
|
||
}
|
||
|
||
function skipSC(token, offset, getNextToken) {
|
||
while (token !== null && (token.type === WHITESPACE || token.type === COMMENT)) {
|
||
token = getNextToken(++offset);
|
||
}
|
||
|
||
return offset;
|
||
}
|
||
|
||
function checkInteger(token, valueOffset, disallowSign, offset) {
|
||
if (!token) {
|
||
return 0;
|
||
}
|
||
|
||
var code = token.value.charCodeAt(valueOffset);
|
||
|
||
if (code === PLUSSIGN || code === HYPHENMINUS) {
|
||
if (disallowSign) {
|
||
// Number sign is not allowed
|
||
return 0;
|
||
}
|
||
valueOffset++;
|
||
}
|
||
|
||
for (; valueOffset < token.value.length; valueOffset++) {
|
||
if (!isDigit(token.value.charCodeAt(valueOffset))) {
|
||
// Integer is expected
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
return offset + 1;
|
||
}
|
||
|
||
// ... <signed-integer>
|
||
// ... ['+' | '-'] <signless-integer>
|
||
function consumeB(token, offset_, getNextToken) {
|
||
var sign = false;
|
||
var offset = skipSC(token, offset_, getNextToken);
|
||
|
||
token = getNextToken(offset);
|
||
|
||
if (token === null) {
|
||
return offset_;
|
||
}
|
||
|
||
if (token.type !== NUMBER) {
|
||
if (isDelim(token, PLUSSIGN) || isDelim(token, HYPHENMINUS)) {
|
||
sign = true;
|
||
offset = skipSC(getNextToken(++offset), offset, getNextToken);
|
||
token = getNextToken(offset);
|
||
|
||
if (token === null && token.type !== NUMBER) {
|
||
return 0;
|
||
}
|
||
} else {
|
||
return offset_;
|
||
}
|
||
}
|
||
|
||
if (!sign) {
|
||
var code = token.value.charCodeAt(0);
|
||
if (code !== PLUSSIGN && code !== HYPHENMINUS) {
|
||
// Number sign is expected
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
return checkInteger(token, sign ? 0 : 1, sign, offset);
|
||
}
|
||
|
||
// An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
|
||
module.exports = function anPlusB(token, getNextToken) {
|
||
/* eslint-disable brace-style*/
|
||
var offset = 0;
|
||
|
||
if (!token) {
|
||
return 0;
|
||
}
|
||
|
||
// <integer>
|
||
if (token.type === NUMBER) {
|
||
return checkInteger(token, 0, ALLOW_SIGN, offset); // b
|
||
}
|
||
|
||
// -n
|
||
// -n <signed-integer>
|
||
// -n ['+' | '-'] <signless-integer>
|
||
// -n- <signless-integer>
|
||
// <dashndashdigit-ident>
|
||
else if (token.type === IDENT && token.value.charCodeAt(0) === HYPHENMINUS) {
|
||
// expect 1st char is N
|
||
if (!cmpChar(token.value, 1, N)) {
|
||
return 0;
|
||
}
|
||
|
||
switch (token.value.length) {
|
||
// -n
|
||
// -n <signed-integer>
|
||
// -n ['+' | '-'] <signless-integer>
|
||
case 2:
|
||
return consumeB(getNextToken(++offset), offset, getNextToken);
|
||
|
||
// -n- <signless-integer>
|
||
case 3:
|
||
if (token.value.charCodeAt(2) !== HYPHENMINUS) {
|
||
return 0;
|
||
}
|
||
|
||
offset = skipSC(getNextToken(++offset), offset, getNextToken);
|
||
token = getNextToken(offset);
|
||
|
||
return checkInteger(token, 0, DISALLOW_SIGN, offset);
|
||
|
||
// <dashndashdigit-ident>
|
||
default:
|
||
if (token.value.charCodeAt(2) !== HYPHENMINUS) {
|
||
return 0;
|
||
}
|
||
|
||
return checkInteger(token, 3, DISALLOW_SIGN, offset);
|
||
}
|
||
}
|
||
|
||
// '+'? n
|
||
// '+'? n <signed-integer>
|
||
// '+'? n ['+' | '-'] <signless-integer>
|
||
// '+'? n- <signless-integer>
|
||
// '+'? <ndashdigit-ident>
|
||
else if (token.type === IDENT || (isDelim(token, PLUSSIGN) && getNextToken(offset + 1).type === IDENT)) {
|
||
// just ignore a plus
|
||
if (token.type !== IDENT) {
|
||
token = getNextToken(++offset);
|
||
}
|
||
|
||
if (token === null || !cmpChar(token.value, 0, N)) {
|
||
return 0;
|
||
}
|
||
|
||
switch (token.value.length) {
|
||
// '+'? n
|
||
// '+'? n <signed-integer>
|
||
// '+'? n ['+' | '-'] <signless-integer>
|
||
case 1:
|
||
return consumeB(getNextToken(++offset), offset, getNextToken);
|
||
|
||
// '+'? n- <signless-integer>
|
||
case 2:
|
||
if (token.value.charCodeAt(1) !== HYPHENMINUS) {
|
||
return 0;
|
||
}
|
||
|
||
offset = skipSC(getNextToken(++offset), offset, getNextToken);
|
||
token = getNextToken(offset);
|
||
|
||
return checkInteger(token, 0, DISALLOW_SIGN, offset);
|
||
|
||
// '+'? <ndashdigit-ident>
|
||
default:
|
||
if (token.value.charCodeAt(1) !== HYPHENMINUS) {
|
||
return 0;
|
||
}
|
||
|
||
return checkInteger(token, 2, DISALLOW_SIGN, offset);
|
||
}
|
||
}
|
||
|
||
// <ndashdigit-dimension>
|
||
// <ndash-dimension> <signless-integer>
|
||
// <n-dimension>
|
||
// <n-dimension> <signed-integer>
|
||
// <n-dimension> ['+' | '-'] <signless-integer>
|
||
else if (token.type === DIMENSION) {
|
||
var code = token.value.charCodeAt(0);
|
||
var sign = code === PLUSSIGN || code === HYPHENMINUS ? 1 : 0;
|
||
|
||
for (var i = sign; i < token.value.length; i++) {
|
||
if (!isDigit(token.value.charCodeAt(i))) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (i === sign) {
|
||
// Integer is expected
|
||
return 0;
|
||
}
|
||
|
||
if (!cmpChar(token.value, i, N)) {
|
||
return 0;
|
||
}
|
||
|
||
// <n-dimension>
|
||
// <n-dimension> <signed-integer>
|
||
// <n-dimension> ['+' | '-'] <signless-integer>
|
||
if (i + 1 === token.value.length) {
|
||
return consumeB(getNextToken(++offset), offset, getNextToken);
|
||
} else {
|
||
if (token.value.charCodeAt(i + 1) !== HYPHENMINUS) {
|
||
return 0;
|
||
}
|
||
|
||
// <ndash-dimension> <signless-integer>
|
||
if (i + 2 === token.value.length) {
|
||
offset = skipSC(getNextToken(++offset), offset, getNextToken);
|
||
token = getNextToken(offset);
|
||
|
||
return checkInteger(token, 0, DISALLOW_SIGN, offset);
|
||
}
|
||
// <ndashdigit-dimension>
|
||
else {
|
||
return checkInteger(token, i + 2, DISALLOW_SIGN, offset);
|
||
}
|
||
}
|
||
}
|
||
|
||
return 0;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 30 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var isHexDigit = __webpack_require__(27).isHexDigit;
|
||
var cmpChar = __webpack_require__(27).cmpChar;
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var DELIM = TYPE.Delim;
|
||
var NUMBER = TYPE.Number;
|
||
var DIMENSION = TYPE.Dimension;
|
||
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||
var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
|
||
var QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)
|
||
var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
|
||
|
||
function isDelim(token, code) {
|
||
return token !== null && token.type === DELIM && token.value.charCodeAt(0) === code;
|
||
}
|
||
|
||
function startsWith(token, code) {
|
||
return token.value.charCodeAt(0) === code;
|
||
}
|
||
|
||
function hexSequence(token, offset, allowDash) {
|
||
for (var pos = offset, hexlen = 0; pos < token.value.length; pos++) {
|
||
var code = token.value.charCodeAt(pos);
|
||
|
||
if (code === HYPHENMINUS && allowDash && hexlen !== 0) {
|
||
if (hexSequence(token, offset + hexlen + 1, false) > 0) {
|
||
return 6; // dissallow following question marks
|
||
}
|
||
|
||
return 0; // dash at the ending of a hex sequence is not allowed
|
||
}
|
||
|
||
if (!isHexDigit(code)) {
|
||
return 0; // not a hex digit
|
||
}
|
||
|
||
if (++hexlen > 6) {
|
||
return 0; // too many hex digits
|
||
};
|
||
}
|
||
|
||
return hexlen;
|
||
}
|
||
|
||
function withQuestionMarkSequence(consumed, length, getNextToken) {
|
||
if (!consumed) {
|
||
return 0; // nothing consumed
|
||
}
|
||
|
||
while (isDelim(getNextToken(length), QUESTIONMARK)) {
|
||
if (++consumed > 6) {
|
||
return 0; // too many question marks
|
||
}
|
||
|
||
length++;
|
||
}
|
||
|
||
return length;
|
||
}
|
||
|
||
// https://drafts.csswg.org/css-syntax/#urange
|
||
// Informally, the <urange> production has three forms:
|
||
// U+0001
|
||
// Defines a range consisting of a single code point, in this case the code point "1".
|
||
// U+0001-00ff
|
||
// Defines a range of codepoints between the first and the second value, in this case
|
||
// the range between "1" and "ff" (255 in decimal) inclusive.
|
||
// U+00??
|
||
// Defines a range of codepoints where the "?" characters range over all hex digits,
|
||
// in this case defining the same as the value U+0000-00ff.
|
||
// In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
|
||
//
|
||
// <urange> =
|
||
// u '+' <ident-token> '?'* |
|
||
// u <dimension-token> '?'* |
|
||
// u <number-token> '?'* |
|
||
// u <number-token> <dimension-token> |
|
||
// u <number-token> <number-token> |
|
||
// u '+' '?'+
|
||
module.exports = function urange(token, getNextToken) {
|
||
var length = 0;
|
||
|
||
// should start with `u` or `U`
|
||
if (token === null || token.type !== IDENT || !cmpChar(token.value, 0, U)) {
|
||
return 0;
|
||
}
|
||
|
||
token = getNextToken(++length);
|
||
if (token === null) {
|
||
return 0;
|
||
}
|
||
|
||
// u '+' <ident-token> '?'*
|
||
// u '+' '?'+
|
||
if (isDelim(token, PLUSSIGN)) {
|
||
token = getNextToken(++length);
|
||
if (token === null) {
|
||
return 0;
|
||
}
|
||
|
||
if (token.type === IDENT) {
|
||
// u '+' <ident-token> '?'*
|
||
return withQuestionMarkSequence(hexSequence(token, 0, true), ++length, getNextToken);
|
||
}
|
||
|
||
if (isDelim(token, QUESTIONMARK)) {
|
||
// u '+' '?'+
|
||
return withQuestionMarkSequence(1, ++length, getNextToken);
|
||
}
|
||
|
||
// Hex digit or question mark is expected
|
||
return 0;
|
||
}
|
||
|
||
// u <number-token> '?'*
|
||
// u <number-token> <dimension-token>
|
||
// u <number-token> <number-token>
|
||
if (token.type === NUMBER) {
|
||
if (!startsWith(token, PLUSSIGN)) {
|
||
return 0;
|
||
}
|
||
|
||
var consumedHexLength = hexSequence(token, 1, true);
|
||
if (consumedHexLength === 0) {
|
||
return 0;
|
||
}
|
||
|
||
token = getNextToken(++length);
|
||
if (token === null) {
|
||
// u <number-token> <eof>
|
||
return length;
|
||
}
|
||
|
||
if (token.type === DIMENSION || token.type === NUMBER) {
|
||
// u <number-token> <dimension-token>
|
||
// u <number-token> <number-token>
|
||
if (!startsWith(token, HYPHENMINUS) || !hexSequence(token, 1, false)) {
|
||
return 0;
|
||
}
|
||
|
||
return length + 1;
|
||
}
|
||
|
||
// u <number-token> '?'*
|
||
return withQuestionMarkSequence(consumedHexLength, length, getNextToken);
|
||
}
|
||
|
||
// u <dimension-token> '?'*
|
||
if (token.type === DIMENSION) {
|
||
if (!startsWith(token, PLUSSIGN)) {
|
||
return 0;
|
||
}
|
||
|
||
return withQuestionMarkSequence(hexSequence(token, 1, true), ++length, getNextToken);
|
||
}
|
||
|
||
return 0;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 31 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var Tokenizer = __webpack_require__(32);
|
||
var TAB = 9;
|
||
var N = 10;
|
||
var F = 12;
|
||
var R = 13;
|
||
var SPACE = 32;
|
||
var EXCLAMATIONMARK = 33; // !
|
||
var NUMBERSIGN = 35; // #
|
||
var AMPERSAND = 38; // &
|
||
var APOSTROPHE = 39; // '
|
||
var LEFTPARENTHESIS = 40; // (
|
||
var RIGHTPARENTHESIS = 41; // )
|
||
var ASTERISK = 42; // *
|
||
var PLUSSIGN = 43; // +
|
||
var COMMA = 44; // ,
|
||
var HYPERMINUS = 45; // -
|
||
var LESSTHANSIGN = 60; // <
|
||
var GREATERTHANSIGN = 62; // >
|
||
var QUESTIONMARK = 63; // ?
|
||
var COMMERCIALAT = 64; // @
|
||
var LEFTSQUAREBRACKET = 91; // [
|
||
var RIGHTSQUAREBRACKET = 93; // ]
|
||
var LEFTCURLYBRACKET = 123; // {
|
||
var VERTICALLINE = 124; // |
|
||
var RIGHTCURLYBRACKET = 125; // }
|
||
var INFINITY = 8734; // ∞
|
||
var NAME_CHAR = createCharMap(function(ch) {
|
||
return /[a-zA-Z0-9\-]/.test(ch);
|
||
});
|
||
var COMBINATOR_PRECEDENCE = {
|
||
' ': 1,
|
||
'&&': 2,
|
||
'||': 3,
|
||
'|': 4
|
||
};
|
||
|
||
function createCharMap(fn) {
|
||
var array = typeof Uint32Array === 'function' ? new Uint32Array(128) : new Array(128);
|
||
for (var i = 0; i < 128; i++) {
|
||
array[i] = fn(String.fromCharCode(i)) ? 1 : 0;
|
||
}
|
||
return array;
|
||
}
|
||
|
||
function scanSpaces(tokenizer) {
|
||
return tokenizer.substringToPos(
|
||
tokenizer.findWsEnd(tokenizer.pos)
|
||
);
|
||
}
|
||
|
||
function scanWord(tokenizer) {
|
||
var end = tokenizer.pos;
|
||
|
||
for (; end < tokenizer.str.length; end++) {
|
||
var code = tokenizer.str.charCodeAt(end);
|
||
if (code >= 128 || NAME_CHAR[code] === 0) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (tokenizer.pos === end) {
|
||
tokenizer.error('Expect a keyword');
|
||
}
|
||
|
||
return tokenizer.substringToPos(end);
|
||
}
|
||
|
||
function scanNumber(tokenizer) {
|
||
var end = tokenizer.pos;
|
||
|
||
for (; end < tokenizer.str.length; end++) {
|
||
var code = tokenizer.str.charCodeAt(end);
|
||
if (code < 48 || code > 57) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (tokenizer.pos === end) {
|
||
tokenizer.error('Expect a number');
|
||
}
|
||
|
||
return tokenizer.substringToPos(end);
|
||
}
|
||
|
||
function scanString(tokenizer) {
|
||
var end = tokenizer.str.indexOf('\'', tokenizer.pos + 1);
|
||
|
||
if (end === -1) {
|
||
tokenizer.pos = tokenizer.str.length;
|
||
tokenizer.error('Expect an apostrophe');
|
||
}
|
||
|
||
return tokenizer.substringToPos(end + 1);
|
||
}
|
||
|
||
function readMultiplierRange(tokenizer) {
|
||
var min = null;
|
||
var max = null;
|
||
|
||
tokenizer.eat(LEFTCURLYBRACKET);
|
||
|
||
min = scanNumber(tokenizer);
|
||
|
||
if (tokenizer.charCode() === COMMA) {
|
||
tokenizer.pos++;
|
||
if (tokenizer.charCode() !== RIGHTCURLYBRACKET) {
|
||
max = scanNumber(tokenizer);
|
||
}
|
||
} else {
|
||
max = min;
|
||
}
|
||
|
||
tokenizer.eat(RIGHTCURLYBRACKET);
|
||
|
||
return {
|
||
min: Number(min),
|
||
max: max ? Number(max) : 0
|
||
};
|
||
}
|
||
|
||
function readMultiplier(tokenizer) {
|
||
var range = null;
|
||
var comma = false;
|
||
|
||
switch (tokenizer.charCode()) {
|
||
case ASTERISK:
|
||
tokenizer.pos++;
|
||
|
||
range = {
|
||
min: 0,
|
||
max: 0
|
||
};
|
||
|
||
break;
|
||
|
||
case PLUSSIGN:
|
||
tokenizer.pos++;
|
||
|
||
range = {
|
||
min: 1,
|
||
max: 0
|
||
};
|
||
|
||
break;
|
||
|
||
case QUESTIONMARK:
|
||
tokenizer.pos++;
|
||
|
||
range = {
|
||
min: 0,
|
||
max: 1
|
||
};
|
||
|
||
break;
|
||
|
||
case NUMBERSIGN:
|
||
tokenizer.pos++;
|
||
|
||
comma = true;
|
||
|
||
if (tokenizer.charCode() === LEFTCURLYBRACKET) {
|
||
range = readMultiplierRange(tokenizer);
|
||
} else {
|
||
range = {
|
||
min: 1,
|
||
max: 0
|
||
};
|
||
}
|
||
|
||
break;
|
||
|
||
case LEFTCURLYBRACKET:
|
||
range = readMultiplierRange(tokenizer);
|
||
break;
|
||
|
||
default:
|
||
return null;
|
||
}
|
||
|
||
return {
|
||
type: 'Multiplier',
|
||
comma: comma,
|
||
min: range.min,
|
||
max: range.max,
|
||
term: null
|
||
};
|
||
}
|
||
|
||
function maybeMultiplied(tokenizer, node) {
|
||
var multiplier = readMultiplier(tokenizer);
|
||
|
||
if (multiplier !== null) {
|
||
multiplier.term = node;
|
||
return multiplier;
|
||
}
|
||
|
||
return node;
|
||
}
|
||
|
||
function maybeToken(tokenizer) {
|
||
var ch = tokenizer.peek();
|
||
|
||
if (ch === '') {
|
||
return null;
|
||
}
|
||
|
||
return {
|
||
type: 'Token',
|
||
value: ch
|
||
};
|
||
}
|
||
|
||
function readProperty(tokenizer) {
|
||
var name;
|
||
|
||
tokenizer.eat(LESSTHANSIGN);
|
||
tokenizer.eat(APOSTROPHE);
|
||
|
||
name = scanWord(tokenizer);
|
||
|
||
tokenizer.eat(APOSTROPHE);
|
||
tokenizer.eat(GREATERTHANSIGN);
|
||
|
||
return maybeMultiplied(tokenizer, {
|
||
type: 'Property',
|
||
name: name
|
||
});
|
||
}
|
||
|
||
// https://drafts.csswg.org/css-values-3/#numeric-ranges
|
||
// 4.1. Range Restrictions and Range Definition Notation
|
||
//
|
||
// Range restrictions can be annotated in the numeric type notation using CSS bracketed
|
||
// range notation—[min,max]—within the angle brackets, after the identifying keyword,
|
||
// indicating a closed range between (and including) min and max.
|
||
// For example, <integer [0, 10]> indicates an integer between 0 and 10, inclusive.
|
||
function readTypeRange(tokenizer) {
|
||
// use null for Infinity to make AST format JSON serializable/deserializable
|
||
var min = null; // -Infinity
|
||
var max = null; // Infinity
|
||
var sign = 1;
|
||
|
||
tokenizer.eat(LEFTSQUAREBRACKET);
|
||
|
||
if (tokenizer.charCode() === HYPERMINUS) {
|
||
tokenizer.peek();
|
||
sign = -1;
|
||
}
|
||
|
||
if (sign == -1 && tokenizer.charCode() === INFINITY) {
|
||
tokenizer.peek();
|
||
} else {
|
||
min = sign * Number(scanNumber(tokenizer));
|
||
}
|
||
|
||
scanSpaces(tokenizer);
|
||
tokenizer.eat(COMMA);
|
||
scanSpaces(tokenizer);
|
||
|
||
if (tokenizer.charCode() === INFINITY) {
|
||
tokenizer.peek();
|
||
} else {
|
||
sign = 1;
|
||
|
||
if (tokenizer.charCode() === HYPERMINUS) {
|
||
tokenizer.peek();
|
||
sign = -1;
|
||
}
|
||
|
||
max = sign * Number(scanNumber(tokenizer));
|
||
}
|
||
|
||
tokenizer.eat(RIGHTSQUAREBRACKET);
|
||
|
||
// If no range is indicated, either by using the bracketed range notation
|
||
// or in the property description, then [−∞,∞] is assumed.
|
||
if (min === null && max === null) {
|
||
return null;
|
||
}
|
||
|
||
return {
|
||
type: 'Range',
|
||
min: min,
|
||
max: max
|
||
};
|
||
}
|
||
|
||
function readType(tokenizer) {
|
||
var name;
|
||
var opts = null;
|
||
|
||
tokenizer.eat(LESSTHANSIGN);
|
||
name = scanWord(tokenizer);
|
||
|
||
if (tokenizer.charCode() === LEFTPARENTHESIS &&
|
||
tokenizer.nextCharCode() === RIGHTPARENTHESIS) {
|
||
tokenizer.pos += 2;
|
||
name += '()';
|
||
}
|
||
|
||
if (tokenizer.charCodeAt(tokenizer.findWsEnd(tokenizer.pos)) === LEFTSQUAREBRACKET) {
|
||
scanSpaces(tokenizer);
|
||
opts = readTypeRange(tokenizer);
|
||
}
|
||
|
||
tokenizer.eat(GREATERTHANSIGN);
|
||
|
||
return maybeMultiplied(tokenizer, {
|
||
type: 'Type',
|
||
name: name,
|
||
opts: opts
|
||
});
|
||
}
|
||
|
||
function readKeywordOrFunction(tokenizer) {
|
||
var name;
|
||
|
||
name = scanWord(tokenizer);
|
||
|
||
if (tokenizer.charCode() === LEFTPARENTHESIS) {
|
||
tokenizer.pos++;
|
||
|
||
return {
|
||
type: 'Function',
|
||
name: name
|
||
};
|
||
}
|
||
|
||
return maybeMultiplied(tokenizer, {
|
||
type: 'Keyword',
|
||
name: name
|
||
});
|
||
}
|
||
|
||
function regroupTerms(terms, combinators) {
|
||
function createGroup(terms, combinator) {
|
||
return {
|
||
type: 'Group',
|
||
terms: terms,
|
||
combinator: combinator,
|
||
disallowEmpty: false,
|
||
explicit: false
|
||
};
|
||
}
|
||
|
||
combinators = Object.keys(combinators).sort(function(a, b) {
|
||
return COMBINATOR_PRECEDENCE[a] - COMBINATOR_PRECEDENCE[b];
|
||
});
|
||
|
||
while (combinators.length > 0) {
|
||
var combinator = combinators.shift();
|
||
for (var i = 0, subgroupStart = 0; i < terms.length; i++) {
|
||
var term = terms[i];
|
||
if (term.type === 'Combinator') {
|
||
if (term.value === combinator) {
|
||
if (subgroupStart === -1) {
|
||
subgroupStart = i - 1;
|
||
}
|
||
terms.splice(i, 1);
|
||
i--;
|
||
} else {
|
||
if (subgroupStart !== -1 && i - subgroupStart > 1) {
|
||
terms.splice(
|
||
subgroupStart,
|
||
i - subgroupStart,
|
||
createGroup(terms.slice(subgroupStart, i), combinator)
|
||
);
|
||
i = subgroupStart + 1;
|
||
}
|
||
subgroupStart = -1;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (subgroupStart !== -1 && combinators.length) {
|
||
terms.splice(
|
||
subgroupStart,
|
||
i - subgroupStart,
|
||
createGroup(terms.slice(subgroupStart, i), combinator)
|
||
);
|
||
}
|
||
}
|
||
|
||
return combinator;
|
||
}
|
||
|
||
function readImplicitGroup(tokenizer) {
|
||
var terms = [];
|
||
var combinators = {};
|
||
var token;
|
||
var prevToken = null;
|
||
var prevTokenPos = tokenizer.pos;
|
||
|
||
while (token = peek(tokenizer)) {
|
||
if (token.type !== 'Spaces') {
|
||
if (token.type === 'Combinator') {
|
||
// check for combinator in group beginning and double combinator sequence
|
||
if (prevToken === null || prevToken.type === 'Combinator') {
|
||
tokenizer.pos = prevTokenPos;
|
||
tokenizer.error('Unexpected combinator');
|
||
}
|
||
|
||
combinators[token.value] = true;
|
||
} else if (prevToken !== null && prevToken.type !== 'Combinator') {
|
||
combinators[' '] = true; // a b
|
||
terms.push({
|
||
type: 'Combinator',
|
||
value: ' '
|
||
});
|
||
}
|
||
|
||
terms.push(token);
|
||
prevToken = token;
|
||
prevTokenPos = tokenizer.pos;
|
||
}
|
||
}
|
||
|
||
// check for combinator in group ending
|
||
if (prevToken !== null && prevToken.type === 'Combinator') {
|
||
tokenizer.pos -= prevTokenPos;
|
||
tokenizer.error('Unexpected combinator');
|
||
}
|
||
|
||
return {
|
||
type: 'Group',
|
||
terms: terms,
|
||
combinator: regroupTerms(terms, combinators) || ' ',
|
||
disallowEmpty: false,
|
||
explicit: false
|
||
};
|
||
}
|
||
|
||
function readGroup(tokenizer) {
|
||
var result;
|
||
|
||
tokenizer.eat(LEFTSQUAREBRACKET);
|
||
result = readImplicitGroup(tokenizer);
|
||
tokenizer.eat(RIGHTSQUAREBRACKET);
|
||
|
||
result.explicit = true;
|
||
|
||
if (tokenizer.charCode() === EXCLAMATIONMARK) {
|
||
tokenizer.pos++;
|
||
result.disallowEmpty = true;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function peek(tokenizer) {
|
||
var code = tokenizer.charCode();
|
||
|
||
if (code < 128 && NAME_CHAR[code] === 1) {
|
||
return readKeywordOrFunction(tokenizer);
|
||
}
|
||
|
||
switch (code) {
|
||
case RIGHTSQUAREBRACKET:
|
||
// don't eat, stop scan a group
|
||
break;
|
||
|
||
case LEFTSQUAREBRACKET:
|
||
return maybeMultiplied(tokenizer, readGroup(tokenizer));
|
||
|
||
case LESSTHANSIGN:
|
||
return tokenizer.nextCharCode() === APOSTROPHE
|
||
? readProperty(tokenizer)
|
||
: readType(tokenizer);
|
||
|
||
case VERTICALLINE:
|
||
return {
|
||
type: 'Combinator',
|
||
value: tokenizer.substringToPos(
|
||
tokenizer.nextCharCode() === VERTICALLINE
|
||
? tokenizer.pos + 2
|
||
: tokenizer.pos + 1
|
||
)
|
||
};
|
||
|
||
case AMPERSAND:
|
||
tokenizer.pos++;
|
||
tokenizer.eat(AMPERSAND);
|
||
|
||
return {
|
||
type: 'Combinator',
|
||
value: '&&'
|
||
};
|
||
|
||
case COMMA:
|
||
tokenizer.pos++;
|
||
return {
|
||
type: 'Comma'
|
||
};
|
||
|
||
case APOSTROPHE:
|
||
return maybeMultiplied(tokenizer, {
|
||
type: 'String',
|
||
value: scanString(tokenizer)
|
||
});
|
||
|
||
case SPACE:
|
||
case TAB:
|
||
case N:
|
||
case R:
|
||
case F:
|
||
return {
|
||
type: 'Spaces',
|
||
value: scanSpaces(tokenizer)
|
||
};
|
||
|
||
case COMMERCIALAT:
|
||
code = tokenizer.nextCharCode();
|
||
|
||
if (code < 128 && NAME_CHAR[code] === 1) {
|
||
tokenizer.pos++;
|
||
return {
|
||
type: 'AtKeyword',
|
||
name: scanWord(tokenizer)
|
||
};
|
||
}
|
||
|
||
return maybeToken(tokenizer);
|
||
|
||
case ASTERISK:
|
||
case PLUSSIGN:
|
||
case QUESTIONMARK:
|
||
case NUMBERSIGN:
|
||
case EXCLAMATIONMARK:
|
||
// prohibited tokens (used as a multiplier start)
|
||
break;
|
||
|
||
case LEFTCURLYBRACKET:
|
||
// LEFTCURLYBRACKET is allowed since mdn/data uses it w/o quoting
|
||
// check next char isn't a number, because it's likely a disjoined multiplier
|
||
code = tokenizer.nextCharCode();
|
||
|
||
if (code < 48 || code > 57) {
|
||
return maybeToken(tokenizer);
|
||
}
|
||
|
||
break;
|
||
|
||
default:
|
||
return maybeToken(tokenizer);
|
||
}
|
||
}
|
||
|
||
function parse(source) {
|
||
var tokenizer = new Tokenizer(source);
|
||
var result = readImplicitGroup(tokenizer);
|
||
|
||
if (tokenizer.pos !== source.length) {
|
||
tokenizer.error('Unexpected input');
|
||
}
|
||
|
||
// reduce redundant groups with single group term
|
||
if (result.terms.length === 1 && result.terms[0].type === 'Group') {
|
||
result = result.terms[0];
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
// warm up parse to elimitate code branches that never execute
|
||
// fix soft deoptimizations (insufficient type feedback)
|
||
parse('[a&&<b>#|<\'c\'>*||e() f{2} /,(% g#{1,2} h{2,})]!');
|
||
|
||
module.exports = parse;
|
||
|
||
|
||
/***/ }),
|
||
/* 32 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var SyntaxError = __webpack_require__(33);
|
||
|
||
var TAB = 9;
|
||
var N = 10;
|
||
var F = 12;
|
||
var R = 13;
|
||
var SPACE = 32;
|
||
|
||
var Tokenizer = function(str) {
|
||
this.str = str;
|
||
this.pos = 0;
|
||
};
|
||
|
||
Tokenizer.prototype = {
|
||
charCodeAt: function(pos) {
|
||
return pos < this.str.length ? this.str.charCodeAt(pos) : 0;
|
||
},
|
||
charCode: function() {
|
||
return this.charCodeAt(this.pos);
|
||
},
|
||
nextCharCode: function() {
|
||
return this.charCodeAt(this.pos + 1);
|
||
},
|
||
nextNonWsCode: function(pos) {
|
||
return this.charCodeAt(this.findWsEnd(pos));
|
||
},
|
||
findWsEnd: function(pos) {
|
||
for (; pos < this.str.length; pos++) {
|
||
var code = this.str.charCodeAt(pos);
|
||
if (code !== R && code !== N && code !== F && code !== SPACE && code !== TAB) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
return pos;
|
||
},
|
||
substringToPos: function(end) {
|
||
return this.str.substring(this.pos, this.pos = end);
|
||
},
|
||
eat: function(code) {
|
||
if (this.charCode() !== code) {
|
||
this.error('Expect `' + String.fromCharCode(code) + '`');
|
||
}
|
||
|
||
this.pos++;
|
||
},
|
||
peek: function() {
|
||
return this.pos < this.str.length ? this.str.charAt(this.pos++) : '';
|
||
},
|
||
error: function(message) {
|
||
throw new SyntaxError(message, this.str, this.pos);
|
||
}
|
||
};
|
||
|
||
module.exports = Tokenizer;
|
||
|
||
|
||
/***/ }),
|
||
/* 33 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var createCustomError = __webpack_require__(17);
|
||
|
||
module.exports = function SyntaxError(message, input, offset) {
|
||
var error = createCustomError('SyntaxError', message);
|
||
|
||
error.input = input;
|
||
error.offset = offset;
|
||
error.rawMessage = message;
|
||
error.message = error.rawMessage + '\n' +
|
||
' ' + error.input + '\n' +
|
||
'--' + new Array((error.offset || error.input.length) + 1).join('-') + '^';
|
||
|
||
return error;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 34 */
|
||
/***/ ((module) => {
|
||
|
||
var noop = function() {};
|
||
|
||
function ensureFunction(value) {
|
||
return typeof value === 'function' ? value : noop;
|
||
}
|
||
|
||
module.exports = function(node, options, context) {
|
||
function walk(node) {
|
||
enter.call(context, node);
|
||
|
||
switch (node.type) {
|
||
case 'Group':
|
||
node.terms.forEach(walk);
|
||
break;
|
||
|
||
case 'Multiplier':
|
||
walk(node.term);
|
||
break;
|
||
|
||
case 'Type':
|
||
case 'Property':
|
||
case 'Keyword':
|
||
case 'AtKeyword':
|
||
case 'Function':
|
||
case 'String':
|
||
case 'Token':
|
||
case 'Comma':
|
||
break;
|
||
|
||
default:
|
||
throw new Error('Unknown type: ' + node.type);
|
||
}
|
||
|
||
leave.call(context, node);
|
||
}
|
||
|
||
var enter = noop;
|
||
var leave = noop;
|
||
|
||
if (typeof options === 'function') {
|
||
enter = options;
|
||
} else if (options) {
|
||
enter = ensureFunction(options.enter);
|
||
leave = ensureFunction(options.leave);
|
||
}
|
||
|
||
if (enter === noop && leave === noop) {
|
||
throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
|
||
}
|
||
|
||
walk(node, context);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 35 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var tokenize = __webpack_require__(27);
|
||
var TokenStream = __webpack_require__(18);
|
||
var tokenStream = new TokenStream();
|
||
var astToTokens = {
|
||
decorator: function(handlers) {
|
||
var curNode = null;
|
||
var prev = { len: 0, node: null };
|
||
var nodes = [prev];
|
||
var buffer = '';
|
||
|
||
return {
|
||
children: handlers.children,
|
||
node: function(node) {
|
||
var tmp = curNode;
|
||
curNode = node;
|
||
handlers.node.call(this, node);
|
||
curNode = tmp;
|
||
},
|
||
chunk: function(chunk) {
|
||
buffer += chunk;
|
||
if (prev.node !== curNode) {
|
||
nodes.push({
|
||
len: chunk.length,
|
||
node: curNode
|
||
});
|
||
} else {
|
||
prev.len += chunk.length;
|
||
}
|
||
},
|
||
result: function() {
|
||
return prepareTokens(buffer, nodes);
|
||
}
|
||
};
|
||
}
|
||
};
|
||
|
||
function prepareTokens(str, nodes) {
|
||
var tokens = [];
|
||
var nodesOffset = 0;
|
||
var nodesIndex = 0;
|
||
var currentNode = nodes ? nodes[nodesIndex].node : null;
|
||
|
||
tokenize(str, tokenStream);
|
||
|
||
while (!tokenStream.eof) {
|
||
if (nodes) {
|
||
while (nodesIndex < nodes.length && nodesOffset + nodes[nodesIndex].len <= tokenStream.tokenStart) {
|
||
nodesOffset += nodes[nodesIndex++].len;
|
||
currentNode = nodes[nodesIndex].node;
|
||
}
|
||
}
|
||
|
||
tokens.push({
|
||
type: tokenStream.tokenType,
|
||
value: tokenStream.getTokenValue(),
|
||
index: tokenStream.tokenIndex, // TODO: remove it, temporary solution
|
||
balance: tokenStream.balance[tokenStream.tokenIndex], // TODO: remove it, temporary solution
|
||
node: currentNode
|
||
});
|
||
tokenStream.next();
|
||
// console.log({ ...tokens[tokens.length - 1], node: undefined });
|
||
}
|
||
|
||
return tokens;
|
||
}
|
||
|
||
module.exports = function(value, syntax) {
|
||
if (typeof value === 'string') {
|
||
return prepareTokens(value, null);
|
||
}
|
||
|
||
return syntax.generate(value, astToTokens);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 36 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var parse = __webpack_require__(31);
|
||
|
||
var MATCH = { type: 'Match' };
|
||
var MISMATCH = { type: 'Mismatch' };
|
||
var DISALLOW_EMPTY = { type: 'DisallowEmpty' };
|
||
var LEFTPARENTHESIS = 40; // (
|
||
var RIGHTPARENTHESIS = 41; // )
|
||
|
||
function createCondition(match, thenBranch, elseBranch) {
|
||
// reduce node count
|
||
if (thenBranch === MATCH && elseBranch === MISMATCH) {
|
||
return match;
|
||
}
|
||
|
||
if (match === MATCH && thenBranch === MATCH && elseBranch === MATCH) {
|
||
return match;
|
||
}
|
||
|
||
if (match.type === 'If' && match.else === MISMATCH && thenBranch === MATCH) {
|
||
thenBranch = match.then;
|
||
match = match.match;
|
||
}
|
||
|
||
return {
|
||
type: 'If',
|
||
match: match,
|
||
then: thenBranch,
|
||
else: elseBranch
|
||
};
|
||
}
|
||
|
||
function isFunctionType(name) {
|
||
return (
|
||
name.length > 2 &&
|
||
name.charCodeAt(name.length - 2) === LEFTPARENTHESIS &&
|
||
name.charCodeAt(name.length - 1) === RIGHTPARENTHESIS
|
||
);
|
||
}
|
||
|
||
function isEnumCapatible(term) {
|
||
return (
|
||
term.type === 'Keyword' ||
|
||
term.type === 'AtKeyword' ||
|
||
term.type === 'Function' ||
|
||
term.type === 'Type' && isFunctionType(term.name)
|
||
);
|
||
}
|
||
|
||
function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||
switch (combinator) {
|
||
case ' ':
|
||
// Juxtaposing components means that all of them must occur, in the given order.
|
||
//
|
||
// a b c
|
||
// =
|
||
// match a
|
||
// then match b
|
||
// then match c
|
||
// then MATCH
|
||
// else MISMATCH
|
||
// else MISMATCH
|
||
// else MISMATCH
|
||
var result = MATCH;
|
||
|
||
for (var i = terms.length - 1; i >= 0; i--) {
|
||
var term = terms[i];
|
||
|
||
result = createCondition(
|
||
term,
|
||
result,
|
||
MISMATCH
|
||
);
|
||
};
|
||
|
||
return result;
|
||
|
||
case '|':
|
||
// A bar (|) separates two or more alternatives: exactly one of them must occur.
|
||
//
|
||
// a | b | c
|
||
// =
|
||
// match a
|
||
// then MATCH
|
||
// else match b
|
||
// then MATCH
|
||
// else match c
|
||
// then MATCH
|
||
// else MISMATCH
|
||
|
||
var result = MISMATCH;
|
||
var map = null;
|
||
|
||
for (var i = terms.length - 1; i >= 0; i--) {
|
||
var term = terms[i];
|
||
|
||
// reduce sequence of keywords into a Enum
|
||
if (isEnumCapatible(term)) {
|
||
if (map === null && i > 0 && isEnumCapatible(terms[i - 1])) {
|
||
map = Object.create(null);
|
||
result = createCondition(
|
||
{
|
||
type: 'Enum',
|
||
map: map
|
||
},
|
||
MATCH,
|
||
result
|
||
);
|
||
}
|
||
|
||
if (map !== null) {
|
||
var key = (isFunctionType(term.name) ? term.name.slice(0, -1) : term.name).toLowerCase();
|
||
if (key in map === false) {
|
||
map[key] = term;
|
||
continue;
|
||
}
|
||
}
|
||
}
|
||
|
||
map = null;
|
||
|
||
// create a new conditonal node
|
||
result = createCondition(
|
||
term,
|
||
MATCH,
|
||
result
|
||
);
|
||
};
|
||
|
||
return result;
|
||
|
||
case '&&':
|
||
// A double ampersand (&&) separates two or more components,
|
||
// all of which must occur, in any order.
|
||
|
||
// Use MatchOnce for groups with a large number of terms,
|
||
// since &&-groups produces at least N!-node trees
|
||
if (terms.length > 5) {
|
||
return {
|
||
type: 'MatchOnce',
|
||
terms: terms,
|
||
all: true
|
||
};
|
||
}
|
||
|
||
// Use a combination tree for groups with small number of terms
|
||
//
|
||
// a && b && c
|
||
// =
|
||
// match a
|
||
// then [b && c]
|
||
// else match b
|
||
// then [a && c]
|
||
// else match c
|
||
// then [a && b]
|
||
// else MISMATCH
|
||
//
|
||
// a && b
|
||
// =
|
||
// match a
|
||
// then match b
|
||
// then MATCH
|
||
// else MISMATCH
|
||
// else match b
|
||
// then match a
|
||
// then MATCH
|
||
// else MISMATCH
|
||
// else MISMATCH
|
||
var result = MISMATCH;
|
||
|
||
for (var i = terms.length - 1; i >= 0; i--) {
|
||
var term = terms[i];
|
||
var thenClause;
|
||
|
||
if (terms.length > 1) {
|
||
thenClause = buildGroupMatchGraph(
|
||
combinator,
|
||
terms.filter(function(newGroupTerm) {
|
||
return newGroupTerm !== term;
|
||
}),
|
||
false
|
||
);
|
||
} else {
|
||
thenClause = MATCH;
|
||
}
|
||
|
||
result = createCondition(
|
||
term,
|
||
thenClause,
|
||
result
|
||
);
|
||
};
|
||
|
||
return result;
|
||
|
||
case '||':
|
||
// A double bar (||) separates two or more options:
|
||
// one or more of them must occur, in any order.
|
||
|
||
// Use MatchOnce for groups with a large number of terms,
|
||
// since ||-groups produces at least N!-node trees
|
||
if (terms.length > 5) {
|
||
return {
|
||
type: 'MatchOnce',
|
||
terms: terms,
|
||
all: false
|
||
};
|
||
}
|
||
|
||
// Use a combination tree for groups with small number of terms
|
||
//
|
||
// a || b || c
|
||
// =
|
||
// match a
|
||
// then [b || c]
|
||
// else match b
|
||
// then [a || c]
|
||
// else match c
|
||
// then [a || b]
|
||
// else MISMATCH
|
||
//
|
||
// a || b
|
||
// =
|
||
// match a
|
||
// then match b
|
||
// then MATCH
|
||
// else MATCH
|
||
// else match b
|
||
// then match a
|
||
// then MATCH
|
||
// else MATCH
|
||
// else MISMATCH
|
||
var result = atLeastOneTermMatched ? MATCH : MISMATCH;
|
||
|
||
for (var i = terms.length - 1; i >= 0; i--) {
|
||
var term = terms[i];
|
||
var thenClause;
|
||
|
||
if (terms.length > 1) {
|
||
thenClause = buildGroupMatchGraph(
|
||
combinator,
|
||
terms.filter(function(newGroupTerm) {
|
||
return newGroupTerm !== term;
|
||
}),
|
||
true
|
||
);
|
||
} else {
|
||
thenClause = MATCH;
|
||
}
|
||
|
||
result = createCondition(
|
||
term,
|
||
thenClause,
|
||
result
|
||
);
|
||
};
|
||
|
||
return result;
|
||
}
|
||
}
|
||
|
||
function buildMultiplierMatchGraph(node) {
|
||
var result = MATCH;
|
||
var matchTerm = buildMatchGraph(node.term);
|
||
|
||
if (node.max === 0) {
|
||
// disable repeating of empty match to prevent infinite loop
|
||
matchTerm = createCondition(
|
||
matchTerm,
|
||
DISALLOW_EMPTY,
|
||
MISMATCH
|
||
);
|
||
|
||
// an occurrence count is not limited, make a cycle;
|
||
// to collect more terms on each following matching mismatch
|
||
result = createCondition(
|
||
matchTerm,
|
||
null, // will be a loop
|
||
MISMATCH
|
||
);
|
||
|
||
result.then = createCondition(
|
||
MATCH,
|
||
MATCH,
|
||
result // make a loop
|
||
);
|
||
|
||
if (node.comma) {
|
||
result.then.else = createCondition(
|
||
{ type: 'Comma', syntax: node },
|
||
result,
|
||
MISMATCH
|
||
);
|
||
}
|
||
} else {
|
||
// create a match node chain for [min .. max] interval with optional matches
|
||
for (var i = node.min || 1; i <= node.max; i++) {
|
||
if (node.comma && result !== MATCH) {
|
||
result = createCondition(
|
||
{ type: 'Comma', syntax: node },
|
||
result,
|
||
MISMATCH
|
||
);
|
||
}
|
||
|
||
result = createCondition(
|
||
matchTerm,
|
||
createCondition(
|
||
MATCH,
|
||
MATCH,
|
||
result
|
||
),
|
||
MISMATCH
|
||
);
|
||
}
|
||
}
|
||
|
||
if (node.min === 0) {
|
||
// allow zero match
|
||
result = createCondition(
|
||
MATCH,
|
||
MATCH,
|
||
result
|
||
);
|
||
} else {
|
||
// create a match node chain to collect [0 ... min - 1] required matches
|
||
for (var i = 0; i < node.min - 1; i++) {
|
||
if (node.comma && result !== MATCH) {
|
||
result = createCondition(
|
||
{ type: 'Comma', syntax: node },
|
||
result,
|
||
MISMATCH
|
||
);
|
||
}
|
||
|
||
result = createCondition(
|
||
matchTerm,
|
||
result,
|
||
MISMATCH
|
||
);
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function buildMatchGraph(node) {
|
||
if (typeof node === 'function') {
|
||
return {
|
||
type: 'Generic',
|
||
fn: node
|
||
};
|
||
}
|
||
|
||
switch (node.type) {
|
||
case 'Group':
|
||
var result = buildGroupMatchGraph(
|
||
node.combinator,
|
||
node.terms.map(buildMatchGraph),
|
||
false
|
||
);
|
||
|
||
if (node.disallowEmpty) {
|
||
result = createCondition(
|
||
result,
|
||
DISALLOW_EMPTY,
|
||
MISMATCH
|
||
);
|
||
}
|
||
|
||
return result;
|
||
|
||
case 'Multiplier':
|
||
return buildMultiplierMatchGraph(node);
|
||
|
||
case 'Type':
|
||
case 'Property':
|
||
return {
|
||
type: node.type,
|
||
name: node.name,
|
||
syntax: node
|
||
};
|
||
|
||
case 'Keyword':
|
||
return {
|
||
type: node.type,
|
||
name: node.name.toLowerCase(),
|
||
syntax: node
|
||
};
|
||
|
||
case 'AtKeyword':
|
||
return {
|
||
type: node.type,
|
||
name: '@' + node.name.toLowerCase(),
|
||
syntax: node
|
||
};
|
||
|
||
case 'Function':
|
||
return {
|
||
type: node.type,
|
||
name: node.name.toLowerCase() + '(',
|
||
syntax: node
|
||
};
|
||
|
||
case 'String':
|
||
// convert a one char length String to a Token
|
||
if (node.value.length === 3) {
|
||
return {
|
||
type: 'Token',
|
||
value: node.value.charAt(1),
|
||
syntax: node
|
||
};
|
||
}
|
||
|
||
// otherwise use it as is
|
||
return {
|
||
type: node.type,
|
||
value: node.value.substr(1, node.value.length - 2).replace(/\\'/g, '\''),
|
||
syntax: node
|
||
};
|
||
|
||
case 'Token':
|
||
return {
|
||
type: node.type,
|
||
value: node.value,
|
||
syntax: node
|
||
};
|
||
|
||
case 'Comma':
|
||
return {
|
||
type: node.type,
|
||
syntax: node
|
||
};
|
||
|
||
default:
|
||
throw new Error('Unknown node type:', node.type);
|
||
}
|
||
}
|
||
|
||
module.exports = {
|
||
MATCH: MATCH,
|
||
MISMATCH: MISMATCH,
|
||
DISALLOW_EMPTY: DISALLOW_EMPTY,
|
||
buildMatchGraph: function(syntaxTree, ref) {
|
||
if (typeof syntaxTree === 'string') {
|
||
syntaxTree = parse(syntaxTree);
|
||
}
|
||
|
||
return {
|
||
type: 'MatchGraph',
|
||
match: buildMatchGraph(syntaxTree),
|
||
syntax: ref || null,
|
||
source: syntaxTree
|
||
};
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 37 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
var matchGraph = __webpack_require__(36);
|
||
var MATCH = matchGraph.MATCH;
|
||
var MISMATCH = matchGraph.MISMATCH;
|
||
var DISALLOW_EMPTY = matchGraph.DISALLOW_EMPTY;
|
||
var TYPE = __webpack_require__(19).TYPE;
|
||
|
||
var STUB = 0;
|
||
var TOKEN = 1;
|
||
var OPEN_SYNTAX = 2;
|
||
var CLOSE_SYNTAX = 3;
|
||
|
||
var EXIT_REASON_MATCH = 'Match';
|
||
var EXIT_REASON_MISMATCH = 'Mismatch';
|
||
var EXIT_REASON_ITERATION_LIMIT = 'Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)';
|
||
|
||
var ITERATION_LIMIT = 15000;
|
||
var totalIterationCount = 0;
|
||
|
||
function reverseList(list) {
|
||
var prev = null;
|
||
var next = null;
|
||
var item = list;
|
||
|
||
while (item !== null) {
|
||
next = item.prev;
|
||
item.prev = prev;
|
||
prev = item;
|
||
item = next;
|
||
}
|
||
|
||
return prev;
|
||
}
|
||
|
||
function areStringsEqualCaseInsensitive(testStr, referenceStr) {
|
||
if (testStr.length !== referenceStr.length) {
|
||
return false;
|
||
}
|
||
|
||
for (var i = 0; i < testStr.length; i++) {
|
||
var testCode = testStr.charCodeAt(i);
|
||
var referenceCode = referenceStr.charCodeAt(i);
|
||
|
||
// testCode.toLowerCase() for U+0041 LATIN CAPITAL LETTER A (A) .. U+005A LATIN CAPITAL LETTER Z (Z).
|
||
if (testCode >= 0x0041 && testCode <= 0x005A) {
|
||
testCode = testCode | 32;
|
||
}
|
||
|
||
if (testCode !== referenceCode) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
function isContextEdgeDelim(token) {
|
||
if (token.type !== TYPE.Delim) {
|
||
return false;
|
||
}
|
||
|
||
// Fix matching for unicode-range: U+30??, U+FF00-FF9F
|
||
// Probably we need to check out previous match instead
|
||
return token.value !== '?';
|
||
}
|
||
|
||
function isCommaContextStart(token) {
|
||
if (token === null) {
|
||
return true;
|
||
}
|
||
|
||
return (
|
||
token.type === TYPE.Comma ||
|
||
token.type === TYPE.Function ||
|
||
token.type === TYPE.LeftParenthesis ||
|
||
token.type === TYPE.LeftSquareBracket ||
|
||
token.type === TYPE.LeftCurlyBracket ||
|
||
isContextEdgeDelim(token)
|
||
);
|
||
}
|
||
|
||
function isCommaContextEnd(token) {
|
||
if (token === null) {
|
||
return true;
|
||
}
|
||
|
||
return (
|
||
token.type === TYPE.RightParenthesis ||
|
||
token.type === TYPE.RightSquareBracket ||
|
||
token.type === TYPE.RightCurlyBracket ||
|
||
token.type === TYPE.Delim
|
||
);
|
||
}
|
||
|
||
function internalMatch(tokens, state, syntaxes) {
|
||
function moveToNextToken() {
|
||
do {
|
||
tokenIndex++;
|
||
token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
|
||
} while (token !== null && (token.type === TYPE.WhiteSpace || token.type === TYPE.Comment));
|
||
}
|
||
|
||
function getNextToken(offset) {
|
||
var nextIndex = tokenIndex + offset;
|
||
|
||
return nextIndex < tokens.length ? tokens[nextIndex] : null;
|
||
}
|
||
|
||
function stateSnapshotFromSyntax(nextState, prev) {
|
||
return {
|
||
nextState: nextState,
|
||
matchStack: matchStack,
|
||
syntaxStack: syntaxStack,
|
||
thenStack: thenStack,
|
||
tokenIndex: tokenIndex,
|
||
prev: prev
|
||
};
|
||
}
|
||
|
||
function pushThenStack(nextState) {
|
||
thenStack = {
|
||
nextState: nextState,
|
||
matchStack: matchStack,
|
||
syntaxStack: syntaxStack,
|
||
prev: thenStack
|
||
};
|
||
}
|
||
|
||
function pushElseStack(nextState) {
|
||
elseStack = stateSnapshotFromSyntax(nextState, elseStack);
|
||
}
|
||
|
||
function addTokenToMatch() {
|
||
matchStack = {
|
||
type: TOKEN,
|
||
syntax: state.syntax,
|
||
token: token,
|
||
prev: matchStack
|
||
};
|
||
|
||
moveToNextToken();
|
||
syntaxStash = null;
|
||
|
||
if (tokenIndex > longestMatch) {
|
||
longestMatch = tokenIndex;
|
||
}
|
||
}
|
||
|
||
function openSyntax() {
|
||
syntaxStack = {
|
||
syntax: state.syntax,
|
||
opts: state.syntax.opts || (syntaxStack !== null && syntaxStack.opts) || null,
|
||
prev: syntaxStack
|
||
};
|
||
|
||
matchStack = {
|
||
type: OPEN_SYNTAX,
|
||
syntax: state.syntax,
|
||
token: matchStack.token,
|
||
prev: matchStack
|
||
};
|
||
}
|
||
|
||
function closeSyntax() {
|
||
if (matchStack.type === OPEN_SYNTAX) {
|
||
matchStack = matchStack.prev;
|
||
} else {
|
||
matchStack = {
|
||
type: CLOSE_SYNTAX,
|
||
syntax: syntaxStack.syntax,
|
||
token: matchStack.token,
|
||
prev: matchStack
|
||
};
|
||
}
|
||
|
||
syntaxStack = syntaxStack.prev;
|
||
}
|
||
|
||
var syntaxStack = null;
|
||
var thenStack = null;
|
||
var elseStack = null;
|
||
|
||
// null – stashing allowed, nothing stashed
|
||
// false – stashing disabled, nothing stashed
|
||
// anithing else – fail stashable syntaxes, some syntax stashed
|
||
var syntaxStash = null;
|
||
|
||
var iterationCount = 0; // count iterations and prevent infinite loop
|
||
var exitReason = null;
|
||
|
||
var token = null;
|
||
var tokenIndex = -1;
|
||
var longestMatch = 0;
|
||
var matchStack = {
|
||
type: STUB,
|
||
syntax: null,
|
||
token: null,
|
||
prev: null
|
||
};
|
||
|
||
moveToNextToken();
|
||
|
||
while (exitReason === null && ++iterationCount < ITERATION_LIMIT) {
|
||
// function mapList(list, fn) {
|
||
// var result = [];
|
||
// while (list) {
|
||
// result.unshift(fn(list));
|
||
// list = list.prev;
|
||
// }
|
||
// return result;
|
||
// }
|
||
// console.log('--\n',
|
||
// '#' + iterationCount,
|
||
// require('util').inspect({
|
||
// match: mapList(matchStack, x => x.type === TOKEN ? x.token && x.token.value : x.syntax ? ({ [OPEN_SYNTAX]: '<', [CLOSE_SYNTAX]: '</' }[x.type] || x.type) + '!' + x.syntax.name : null),
|
||
// token: token && token.value,
|
||
// tokenIndex,
|
||
// syntax: syntax.type + (syntax.id ? ' #' + syntax.id : '')
|
||
// }, { depth: null })
|
||
// );
|
||
switch (state.type) {
|
||
case 'Match':
|
||
if (thenStack === null) {
|
||
// turn to MISMATCH when some tokens left unmatched
|
||
if (token !== null) {
|
||
// doesn't mismatch if just one token left and it's an IE hack
|
||
if (tokenIndex !== tokens.length - 1 || (token.value !== '\\0' && token.value !== '\\9')) {
|
||
state = MISMATCH;
|
||
break;
|
||
}
|
||
}
|
||
|
||
// break the main loop, return a result - MATCH
|
||
exitReason = EXIT_REASON_MATCH;
|
||
break;
|
||
}
|
||
|
||
// go to next syntax (`then` branch)
|
||
state = thenStack.nextState;
|
||
|
||
// check match is not empty
|
||
if (state === DISALLOW_EMPTY) {
|
||
if (thenStack.matchStack === matchStack) {
|
||
state = MISMATCH;
|
||
break;
|
||
} else {
|
||
state = MATCH;
|
||
}
|
||
}
|
||
|
||
// close syntax if needed
|
||
while (thenStack.syntaxStack !== syntaxStack) {
|
||
closeSyntax();
|
||
}
|
||
|
||
// pop stack
|
||
thenStack = thenStack.prev;
|
||
break;
|
||
|
||
case 'Mismatch':
|
||
// when some syntax is stashed
|
||
if (syntaxStash !== null && syntaxStash !== false) {
|
||
// there is no else branches or a branch reduce match stack
|
||
if (elseStack === null || tokenIndex > elseStack.tokenIndex) {
|
||
// restore state from the stash
|
||
elseStack = syntaxStash;
|
||
syntaxStash = false; // disable stashing
|
||
}
|
||
} else if (elseStack === null) {
|
||
// no else branches -> break the main loop
|
||
// return a result - MISMATCH
|
||
exitReason = EXIT_REASON_MISMATCH;
|
||
break;
|
||
}
|
||
|
||
// go to next syntax (`else` branch)
|
||
state = elseStack.nextState;
|
||
|
||
// restore all the rest stack states
|
||
thenStack = elseStack.thenStack;
|
||
syntaxStack = elseStack.syntaxStack;
|
||
matchStack = elseStack.matchStack;
|
||
tokenIndex = elseStack.tokenIndex;
|
||
token = tokenIndex < tokens.length ? tokens[tokenIndex] : null;
|
||
|
||
// pop stack
|
||
elseStack = elseStack.prev;
|
||
break;
|
||
|
||
case 'MatchGraph':
|
||
state = state.match;
|
||
break;
|
||
|
||
case 'If':
|
||
// IMPORTANT: else stack push must go first,
|
||
// since it stores the state of thenStack before changes
|
||
if (state.else !== MISMATCH) {
|
||
pushElseStack(state.else);
|
||
}
|
||
|
||
if (state.then !== MATCH) {
|
||
pushThenStack(state.then);
|
||
}
|
||
|
||
state = state.match;
|
||
break;
|
||
|
||
case 'MatchOnce':
|
||
state = {
|
||
type: 'MatchOnceBuffer',
|
||
syntax: state,
|
||
index: 0,
|
||
mask: 0
|
||
};
|
||
break;
|
||
|
||
case 'MatchOnceBuffer':
|
||
var terms = state.syntax.terms;
|
||
|
||
if (state.index === terms.length) {
|
||
// no matches at all or it's required all terms to be matched
|
||
if (state.mask === 0 || state.syntax.all) {
|
||
state = MISMATCH;
|
||
break;
|
||
}
|
||
|
||
// a partial match is ok
|
||
state = MATCH;
|
||
break;
|
||
}
|
||
|
||
// all terms are matched
|
||
if (state.mask === (1 << terms.length) - 1) {
|
||
state = MATCH;
|
||
break;
|
||
}
|
||
|
||
for (; state.index < terms.length; state.index++) {
|
||
var matchFlag = 1 << state.index;
|
||
|
||
if ((state.mask & matchFlag) === 0) {
|
||
// IMPORTANT: else stack push must go first,
|
||
// since it stores the state of thenStack before changes
|
||
pushElseStack(state);
|
||
pushThenStack({
|
||
type: 'AddMatchOnce',
|
||
syntax: state.syntax,
|
||
mask: state.mask | matchFlag
|
||
});
|
||
|
||
// match
|
||
state = terms[state.index++];
|
||
break;
|
||
}
|
||
}
|
||
break;
|
||
|
||
case 'AddMatchOnce':
|
||
state = {
|
||
type: 'MatchOnceBuffer',
|
||
syntax: state.syntax,
|
||
index: 0,
|
||
mask: state.mask
|
||
};
|
||
break;
|
||
|
||
case 'Enum':
|
||
if (token !== null) {
|
||
var name = token.value.toLowerCase();
|
||
|
||
// drop \0 and \9 hack from keyword name
|
||
if (name.indexOf('\\') !== -1) {
|
||
name = name.replace(/\\[09].*$/, '');
|
||
}
|
||
|
||
if (hasOwnProperty.call(state.map, name)) {
|
||
state = state.map[name];
|
||
break;
|
||
}
|
||
}
|
||
|
||
state = MISMATCH;
|
||
break;
|
||
|
||
case 'Generic':
|
||
var opts = syntaxStack !== null ? syntaxStack.opts : null;
|
||
var lastTokenIndex = tokenIndex + Math.floor(state.fn(token, getNextToken, opts));
|
||
|
||
if (!isNaN(lastTokenIndex) && lastTokenIndex > tokenIndex) {
|
||
while (tokenIndex < lastTokenIndex) {
|
||
addTokenToMatch();
|
||
}
|
||
|
||
state = MATCH;
|
||
} else {
|
||
state = MISMATCH;
|
||
}
|
||
|
||
break;
|
||
|
||
case 'Type':
|
||
case 'Property':
|
||
var syntaxDict = state.type === 'Type' ? 'types' : 'properties';
|
||
var dictSyntax = hasOwnProperty.call(syntaxes, syntaxDict) ? syntaxes[syntaxDict][state.name] : null;
|
||
|
||
if (!dictSyntax || !dictSyntax.match) {
|
||
throw new Error(
|
||
'Bad syntax reference: ' +
|
||
(state.type === 'Type'
|
||
? '<' + state.name + '>'
|
||
: '<\'' + state.name + '\'>')
|
||
);
|
||
}
|
||
|
||
// stash a syntax for types with low priority
|
||
if (syntaxStash !== false && token !== null && state.type === 'Type') {
|
||
var lowPriorityMatching =
|
||
// https://drafts.csswg.org/css-values-4/#custom-idents
|
||
// When parsing positionally-ambiguous keywords in a property value, a <custom-ident> production
|
||
// can only claim the keyword if no other unfulfilled production can claim it.
|
||
(state.name === 'custom-ident' && token.type === TYPE.Ident) ||
|
||
|
||
// https://drafts.csswg.org/css-values-4/#lengths
|
||
// ... if a `0` could be parsed as either a <number> or a <length> in a property (such as line-height),
|
||
// it must parse as a <number>
|
||
(state.name === 'length' && token.value === '0');
|
||
|
||
if (lowPriorityMatching) {
|
||
if (syntaxStash === null) {
|
||
syntaxStash = stateSnapshotFromSyntax(state, elseStack);
|
||
}
|
||
|
||
state = MISMATCH;
|
||
break;
|
||
}
|
||
}
|
||
|
||
openSyntax();
|
||
state = dictSyntax.match;
|
||
break;
|
||
|
||
case 'Keyword':
|
||
var name = state.name;
|
||
|
||
if (token !== null) {
|
||
var keywordName = token.value;
|
||
|
||
// drop \0 and \9 hack from keyword name
|
||
if (keywordName.indexOf('\\') !== -1) {
|
||
keywordName = keywordName.replace(/\\[09].*$/, '');
|
||
}
|
||
|
||
if (areStringsEqualCaseInsensitive(keywordName, name)) {
|
||
addTokenToMatch();
|
||
state = MATCH;
|
||
break;
|
||
}
|
||
}
|
||
|
||
state = MISMATCH;
|
||
break;
|
||
|
||
case 'AtKeyword':
|
||
case 'Function':
|
||
if (token !== null && areStringsEqualCaseInsensitive(token.value, state.name)) {
|
||
addTokenToMatch();
|
||
state = MATCH;
|
||
break;
|
||
}
|
||
|
||
state = MISMATCH;
|
||
break;
|
||
|
||
case 'Token':
|
||
if (token !== null && token.value === state.value) {
|
||
addTokenToMatch();
|
||
state = MATCH;
|
||
break;
|
||
}
|
||
|
||
state = MISMATCH;
|
||
break;
|
||
|
||
case 'Comma':
|
||
if (token !== null && token.type === TYPE.Comma) {
|
||
if (isCommaContextStart(matchStack.token)) {
|
||
state = MISMATCH;
|
||
} else {
|
||
addTokenToMatch();
|
||
state = isCommaContextEnd(token) ? MISMATCH : MATCH;
|
||
}
|
||
} else {
|
||
state = isCommaContextStart(matchStack.token) || isCommaContextEnd(token) ? MATCH : MISMATCH;
|
||
}
|
||
|
||
break;
|
||
|
||
case 'String':
|
||
var string = '';
|
||
|
||
for (var lastTokenIndex = tokenIndex; lastTokenIndex < tokens.length && string.length < state.value.length; lastTokenIndex++) {
|
||
string += tokens[lastTokenIndex].value;
|
||
}
|
||
|
||
if (areStringsEqualCaseInsensitive(string, state.value)) {
|
||
while (tokenIndex < lastTokenIndex) {
|
||
addTokenToMatch();
|
||
}
|
||
|
||
state = MATCH;
|
||
} else {
|
||
state = MISMATCH;
|
||
}
|
||
|
||
break;
|
||
|
||
default:
|
||
throw new Error('Unknown node type: ' + state.type);
|
||
}
|
||
}
|
||
|
||
totalIterationCount += iterationCount;
|
||
|
||
switch (exitReason) {
|
||
case null:
|
||
console.warn('[csstree-match] BREAK after ' + ITERATION_LIMIT + ' iterations');
|
||
exitReason = EXIT_REASON_ITERATION_LIMIT;
|
||
matchStack = null;
|
||
break;
|
||
|
||
case EXIT_REASON_MATCH:
|
||
while (syntaxStack !== null) {
|
||
closeSyntax();
|
||
}
|
||
break;
|
||
|
||
default:
|
||
matchStack = null;
|
||
}
|
||
|
||
return {
|
||
tokens: tokens,
|
||
reason: exitReason,
|
||
iterations: iterationCount,
|
||
match: matchStack,
|
||
longestMatch: longestMatch
|
||
};
|
||
}
|
||
|
||
function matchAsList(tokens, matchGraph, syntaxes) {
|
||
var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
|
||
|
||
if (matchResult.match !== null) {
|
||
var item = reverseList(matchResult.match).prev;
|
||
|
||
matchResult.match = [];
|
||
|
||
while (item !== null) {
|
||
switch (item.type) {
|
||
case STUB:
|
||
break;
|
||
|
||
case OPEN_SYNTAX:
|
||
case CLOSE_SYNTAX:
|
||
matchResult.match.push({
|
||
type: item.type,
|
||
syntax: item.syntax
|
||
});
|
||
break;
|
||
|
||
default:
|
||
matchResult.match.push({
|
||
token: item.token.value,
|
||
node: item.token.node
|
||
});
|
||
break;
|
||
}
|
||
|
||
item = item.prev;
|
||
}
|
||
}
|
||
|
||
return matchResult;
|
||
}
|
||
|
||
function matchAsTree(tokens, matchGraph, syntaxes) {
|
||
var matchResult = internalMatch(tokens, matchGraph, syntaxes || {});
|
||
|
||
if (matchResult.match === null) {
|
||
return matchResult;
|
||
}
|
||
|
||
var item = matchResult.match;
|
||
var host = matchResult.match = {
|
||
syntax: matchGraph.syntax || null,
|
||
match: []
|
||
};
|
||
var hostStack = [host];
|
||
|
||
// revert a list and start with 2nd item since 1st is a stub item
|
||
item = reverseList(item).prev;
|
||
|
||
// build a tree
|
||
while (item !== null) {
|
||
switch (item.type) {
|
||
case OPEN_SYNTAX:
|
||
host.match.push(host = {
|
||
syntax: item.syntax,
|
||
match: []
|
||
});
|
||
hostStack.push(host);
|
||
break;
|
||
|
||
case CLOSE_SYNTAX:
|
||
hostStack.pop();
|
||
host = hostStack[hostStack.length - 1];
|
||
break;
|
||
|
||
default:
|
||
host.match.push({
|
||
syntax: item.syntax || null,
|
||
token: item.token.value,
|
||
node: item.token.node
|
||
});
|
||
}
|
||
|
||
item = item.prev;
|
||
}
|
||
|
||
return matchResult;
|
||
}
|
||
|
||
module.exports = {
|
||
matchAsList: matchAsList,
|
||
matchAsTree: matchAsTree,
|
||
getTotalIterationCount: function() {
|
||
return totalIterationCount;
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 38 */
|
||
/***/ ((module) => {
|
||
|
||
function getTrace(node) {
|
||
function shouldPutToTrace(syntax) {
|
||
if (syntax === null) {
|
||
return false;
|
||
}
|
||
|
||
return (
|
||
syntax.type === 'Type' ||
|
||
syntax.type === 'Property' ||
|
||
syntax.type === 'Keyword'
|
||
);
|
||
}
|
||
|
||
function hasMatch(matchNode) {
|
||
if (Array.isArray(matchNode.match)) {
|
||
// use for-loop for better perfomance
|
||
for (var i = 0; i < matchNode.match.length; i++) {
|
||
if (hasMatch(matchNode.match[i])) {
|
||
if (shouldPutToTrace(matchNode.syntax)) {
|
||
result.unshift(matchNode.syntax);
|
||
}
|
||
|
||
return true;
|
||
}
|
||
}
|
||
} else if (matchNode.node === node) {
|
||
result = shouldPutToTrace(matchNode.syntax)
|
||
? [matchNode.syntax]
|
||
: [];
|
||
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
var result = null;
|
||
|
||
if (this.matched !== null) {
|
||
hasMatch(this.matched);
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function testNode(match, node, fn) {
|
||
var trace = getTrace.call(match, node);
|
||
|
||
if (trace === null) {
|
||
return false;
|
||
}
|
||
|
||
return trace.some(fn);
|
||
}
|
||
|
||
function isType(node, type) {
|
||
return testNode(this, node, function(matchNode) {
|
||
return matchNode.type === 'Type' && matchNode.name === type;
|
||
});
|
||
}
|
||
|
||
function isProperty(node, property) {
|
||
return testNode(this, node, function(matchNode) {
|
||
return matchNode.type === 'Property' && matchNode.name === property;
|
||
});
|
||
}
|
||
|
||
function isKeyword(node) {
|
||
return testNode(this, node, function(matchNode) {
|
||
return matchNode.type === 'Keyword';
|
||
});
|
||
}
|
||
|
||
module.exports = {
|
||
getTrace: getTrace,
|
||
isType: isType,
|
||
isProperty: isProperty,
|
||
isKeyword: isKeyword
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 39 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var List = __webpack_require__(15);
|
||
|
||
function getFirstMatchNode(matchNode) {
|
||
if ('node' in matchNode) {
|
||
return matchNode.node;
|
||
}
|
||
|
||
return getFirstMatchNode(matchNode.match[0]);
|
||
}
|
||
|
||
function getLastMatchNode(matchNode) {
|
||
if ('node' in matchNode) {
|
||
return matchNode.node;
|
||
}
|
||
|
||
return getLastMatchNode(matchNode.match[matchNode.match.length - 1]);
|
||
}
|
||
|
||
function matchFragments(lexer, ast, match, type, name) {
|
||
function findFragments(matchNode) {
|
||
if (matchNode.syntax !== null &&
|
||
matchNode.syntax.type === type &&
|
||
matchNode.syntax.name === name) {
|
||
var start = getFirstMatchNode(matchNode);
|
||
var end = getLastMatchNode(matchNode);
|
||
|
||
lexer.syntax.walk(ast, function(node, item, list) {
|
||
if (node === start) {
|
||
var nodes = new List();
|
||
|
||
do {
|
||
nodes.appendData(item.data);
|
||
|
||
if (item.data === end) {
|
||
break;
|
||
}
|
||
|
||
item = item.next;
|
||
} while (item !== null);
|
||
|
||
fragments.push({
|
||
parent: list,
|
||
nodes: nodes
|
||
});
|
||
}
|
||
});
|
||
}
|
||
|
||
if (Array.isArray(matchNode.match)) {
|
||
matchNode.match.forEach(findFragments);
|
||
}
|
||
}
|
||
|
||
var fragments = [];
|
||
|
||
if (match.matched !== null) {
|
||
findFragments(match.matched);
|
||
}
|
||
|
||
return fragments;
|
||
}
|
||
|
||
module.exports = {
|
||
matchFragments: matchFragments
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 40 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var List = __webpack_require__(15);
|
||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
|
||
function isValidNumber(value) {
|
||
// Number.isInteger(value) && value >= 0
|
||
return (
|
||
typeof value === 'number' &&
|
||
isFinite(value) &&
|
||
Math.floor(value) === value &&
|
||
value >= 0
|
||
);
|
||
}
|
||
|
||
function isValidLocation(loc) {
|
||
return (
|
||
Boolean(loc) &&
|
||
isValidNumber(loc.offset) &&
|
||
isValidNumber(loc.line) &&
|
||
isValidNumber(loc.column)
|
||
);
|
||
}
|
||
|
||
function createNodeStructureChecker(type, fields) {
|
||
return function checkNode(node, warn) {
|
||
if (!node || node.constructor !== Object) {
|
||
return warn(node, 'Type of node should be an Object');
|
||
}
|
||
|
||
for (var key in node) {
|
||
var valid = true;
|
||
|
||
if (hasOwnProperty.call(node, key) === false) {
|
||
continue;
|
||
}
|
||
|
||
if (key === 'type') {
|
||
if (node.type !== type) {
|
||
warn(node, 'Wrong node type `' + node.type + '`, expected `' + type + '`');
|
||
}
|
||
} else if (key === 'loc') {
|
||
if (node.loc === null) {
|
||
continue;
|
||
} else if (node.loc && node.loc.constructor === Object) {
|
||
if (typeof node.loc.source !== 'string') {
|
||
key += '.source';
|
||
} else if (!isValidLocation(node.loc.start)) {
|
||
key += '.start';
|
||
} else if (!isValidLocation(node.loc.end)) {
|
||
key += '.end';
|
||
} else {
|
||
continue;
|
||
}
|
||
}
|
||
|
||
valid = false;
|
||
} else if (fields.hasOwnProperty(key)) {
|
||
for (var i = 0, valid = false; !valid && i < fields[key].length; i++) {
|
||
var fieldType = fields[key][i];
|
||
|
||
switch (fieldType) {
|
||
case String:
|
||
valid = typeof node[key] === 'string';
|
||
break;
|
||
|
||
case Boolean:
|
||
valid = typeof node[key] === 'boolean';
|
||
break;
|
||
|
||
case null:
|
||
valid = node[key] === null;
|
||
break;
|
||
|
||
default:
|
||
if (typeof fieldType === 'string') {
|
||
valid = node[key] && node[key].type === fieldType;
|
||
} else if (Array.isArray(fieldType)) {
|
||
valid = node[key] instanceof List;
|
||
}
|
||
}
|
||
}
|
||
} else {
|
||
warn(node, 'Unknown field `' + key + '` for ' + type + ' node type');
|
||
}
|
||
|
||
if (!valid) {
|
||
warn(node, 'Bad value for `' + type + '.' + key + '`');
|
||
}
|
||
}
|
||
|
||
for (var key in fields) {
|
||
if (hasOwnProperty.call(fields, key) &&
|
||
hasOwnProperty.call(node, key) === false) {
|
||
warn(node, 'Field `' + type + '.' + key + '` is missed');
|
||
}
|
||
}
|
||
};
|
||
}
|
||
|
||
function processStructure(name, nodeType) {
|
||
var structure = nodeType.structure;
|
||
var fields = {
|
||
type: String,
|
||
loc: true
|
||
};
|
||
var docs = {
|
||
type: '"' + name + '"'
|
||
};
|
||
|
||
for (var key in structure) {
|
||
if (hasOwnProperty.call(structure, key) === false) {
|
||
continue;
|
||
}
|
||
|
||
var docsTypes = [];
|
||
var fieldTypes = fields[key] = Array.isArray(structure[key])
|
||
? structure[key].slice()
|
||
: [structure[key]];
|
||
|
||
for (var i = 0; i < fieldTypes.length; i++) {
|
||
var fieldType = fieldTypes[i];
|
||
if (fieldType === String || fieldType === Boolean) {
|
||
docsTypes.push(fieldType.name);
|
||
} else if (fieldType === null) {
|
||
docsTypes.push('null');
|
||
} else if (typeof fieldType === 'string') {
|
||
docsTypes.push('<' + fieldType + '>');
|
||
} else if (Array.isArray(fieldType)) {
|
||
docsTypes.push('List'); // TODO: use type enum
|
||
} else {
|
||
throw new Error('Wrong value `' + fieldType + '` in `' + name + '.' + key + '` structure definition');
|
||
}
|
||
}
|
||
|
||
docs[key] = docsTypes.join(' | ');
|
||
}
|
||
|
||
return {
|
||
docs: docs,
|
||
check: createNodeStructureChecker(name, fields)
|
||
};
|
||
}
|
||
|
||
module.exports = {
|
||
getStructureFromConfig: function(config) {
|
||
var structure = {};
|
||
|
||
if (config.node) {
|
||
for (var name in config.node) {
|
||
if (hasOwnProperty.call(config.node, name)) {
|
||
var nodeType = config.node[name];
|
||
|
||
if (nodeType.structure) {
|
||
structure[name] = processStructure(name, nodeType);
|
||
} else {
|
||
throw new Error('Missed `structure` field in `' + name + '` node type definition');
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
return structure;
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 41 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = {
|
||
SyntaxError: __webpack_require__(33),
|
||
parse: __webpack_require__(31),
|
||
generate: __webpack_require__(24),
|
||
walk: __webpack_require__(34)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 42 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var OffsetToLocation = __webpack_require__(43);
|
||
var SyntaxError = __webpack_require__(16);
|
||
var TokenStream = __webpack_require__(18);
|
||
var List = __webpack_require__(15);
|
||
var tokenize = __webpack_require__(27);
|
||
var constants = __webpack_require__(19);
|
||
var { findWhiteSpaceStart, cmpStr } = __webpack_require__(20);
|
||
var sequence = __webpack_require__(44);
|
||
var noop = function() {};
|
||
|
||
var TYPE = constants.TYPE;
|
||
var NAME = constants.NAME;
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var COMMENT = TYPE.Comment;
|
||
var IDENT = TYPE.Ident;
|
||
var FUNCTION = TYPE.Function;
|
||
var URL = TYPE.Url;
|
||
var HASH = TYPE.Hash;
|
||
var PERCENTAGE = TYPE.Percentage;
|
||
var NUMBER = TYPE.Number;
|
||
var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
|
||
var NULL = 0;
|
||
|
||
function createParseContext(name) {
|
||
return function() {
|
||
return this[name]();
|
||
};
|
||
}
|
||
|
||
function processConfig(config) {
|
||
var parserConfig = {
|
||
context: {},
|
||
scope: {},
|
||
atrule: {},
|
||
pseudo: {}
|
||
};
|
||
|
||
if (config.parseContext) {
|
||
for (var name in config.parseContext) {
|
||
switch (typeof config.parseContext[name]) {
|
||
case 'function':
|
||
parserConfig.context[name] = config.parseContext[name];
|
||
break;
|
||
|
||
case 'string':
|
||
parserConfig.context[name] = createParseContext(config.parseContext[name]);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (config.scope) {
|
||
for (var name in config.scope) {
|
||
parserConfig.scope[name] = config.scope[name];
|
||
}
|
||
}
|
||
|
||
if (config.atrule) {
|
||
for (var name in config.atrule) {
|
||
var atrule = config.atrule[name];
|
||
|
||
if (atrule.parse) {
|
||
parserConfig.atrule[name] = atrule.parse;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (config.pseudo) {
|
||
for (var name in config.pseudo) {
|
||
var pseudo = config.pseudo[name];
|
||
|
||
if (pseudo.parse) {
|
||
parserConfig.pseudo[name] = pseudo.parse;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (config.node) {
|
||
for (var name in config.node) {
|
||
parserConfig[name] = config.node[name].parse;
|
||
}
|
||
}
|
||
|
||
return parserConfig;
|
||
}
|
||
|
||
module.exports = function createParser(config) {
|
||
var parser = {
|
||
scanner: new TokenStream(),
|
||
locationMap: new OffsetToLocation(),
|
||
|
||
filename: '<unknown>',
|
||
needPositions: false,
|
||
onParseError: noop,
|
||
onParseErrorThrow: false,
|
||
parseAtrulePrelude: true,
|
||
parseRulePrelude: true,
|
||
parseValue: true,
|
||
parseCustomProperty: false,
|
||
|
||
readSequence: sequence,
|
||
|
||
createList: function() {
|
||
return new List();
|
||
},
|
||
createSingleNodeList: function(node) {
|
||
return new List().appendData(node);
|
||
},
|
||
getFirstListNode: function(list) {
|
||
return list && list.first();
|
||
},
|
||
getLastListNode: function(list) {
|
||
return list.last();
|
||
},
|
||
|
||
parseWithFallback: function(consumer, fallback) {
|
||
var startToken = this.scanner.tokenIndex;
|
||
|
||
try {
|
||
return consumer.call(this);
|
||
} catch (e) {
|
||
if (this.onParseErrorThrow) {
|
||
throw e;
|
||
}
|
||
|
||
var fallbackNode = fallback.call(this, startToken);
|
||
|
||
this.onParseErrorThrow = true;
|
||
this.onParseError(e, fallbackNode);
|
||
this.onParseErrorThrow = false;
|
||
|
||
return fallbackNode;
|
||
}
|
||
},
|
||
|
||
lookupNonWSType: function(offset) {
|
||
do {
|
||
var type = this.scanner.lookupType(offset++);
|
||
if (type !== WHITESPACE) {
|
||
return type;
|
||
}
|
||
} while (type !== NULL);
|
||
|
||
return NULL;
|
||
},
|
||
|
||
eat: function(tokenType) {
|
||
if (this.scanner.tokenType !== tokenType) {
|
||
var offset = this.scanner.tokenStart;
|
||
var message = NAME[tokenType] + ' is expected';
|
||
|
||
// tweak message and offset
|
||
switch (tokenType) {
|
||
case IDENT:
|
||
// when identifier is expected but there is a function or url
|
||
if (this.scanner.tokenType === FUNCTION || this.scanner.tokenType === URL) {
|
||
offset = this.scanner.tokenEnd - 1;
|
||
message = 'Identifier is expected but function found';
|
||
} else {
|
||
message = 'Identifier is expected';
|
||
}
|
||
break;
|
||
|
||
case HASH:
|
||
if (this.scanner.isDelim(NUMBERSIGN)) {
|
||
this.scanner.next();
|
||
offset++;
|
||
message = 'Name is expected';
|
||
}
|
||
break;
|
||
|
||
case PERCENTAGE:
|
||
if (this.scanner.tokenType === NUMBER) {
|
||
offset = this.scanner.tokenEnd;
|
||
message = 'Percent sign is expected';
|
||
}
|
||
break;
|
||
|
||
default:
|
||
// when test type is part of another token show error for current position + 1
|
||
// e.g. eat(HYPHENMINUS) will fail on "-foo", but pointing on "-" is odd
|
||
if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === tokenType) {
|
||
offset = offset + 1;
|
||
}
|
||
}
|
||
|
||
this.error(message, offset);
|
||
}
|
||
|
||
this.scanner.next();
|
||
},
|
||
|
||
consume: function(tokenType) {
|
||
var value = this.scanner.getTokenValue();
|
||
|
||
this.eat(tokenType);
|
||
|
||
return value;
|
||
},
|
||
consumeFunctionName: function() {
|
||
var name = this.scanner.source.substring(this.scanner.tokenStart, this.scanner.tokenEnd - 1);
|
||
|
||
this.eat(FUNCTION);
|
||
|
||
return name;
|
||
},
|
||
|
||
getLocation: function(start, end) {
|
||
if (this.needPositions) {
|
||
return this.locationMap.getLocationRange(
|
||
start,
|
||
end,
|
||
this.filename
|
||
);
|
||
}
|
||
|
||
return null;
|
||
},
|
||
getLocationFromList: function(list) {
|
||
if (this.needPositions) {
|
||
var head = this.getFirstListNode(list);
|
||
var tail = this.getLastListNode(list);
|
||
return this.locationMap.getLocationRange(
|
||
head !== null ? head.loc.start.offset - this.locationMap.startOffset : this.scanner.tokenStart,
|
||
tail !== null ? tail.loc.end.offset - this.locationMap.startOffset : this.scanner.tokenStart,
|
||
this.filename
|
||
);
|
||
}
|
||
|
||
return null;
|
||
},
|
||
|
||
error: function(message, offset) {
|
||
var location = typeof offset !== 'undefined' && offset < this.scanner.source.length
|
||
? this.locationMap.getLocation(offset)
|
||
: this.scanner.eof
|
||
? this.locationMap.getLocation(findWhiteSpaceStart(this.scanner.source, this.scanner.source.length - 1))
|
||
: this.locationMap.getLocation(this.scanner.tokenStart);
|
||
|
||
throw new SyntaxError(
|
||
message || 'Unexpected input',
|
||
this.scanner.source,
|
||
location.offset,
|
||
location.line,
|
||
location.column
|
||
);
|
||
}
|
||
};
|
||
|
||
config = processConfig(config || {});
|
||
for (var key in config) {
|
||
parser[key] = config[key];
|
||
}
|
||
|
||
return function(source, options) {
|
||
options = options || {};
|
||
|
||
var context = options.context || 'default';
|
||
var onComment = options.onComment;
|
||
var ast;
|
||
|
||
tokenize(source, parser.scanner);
|
||
parser.locationMap.setSource(
|
||
source,
|
||
options.offset,
|
||
options.line,
|
||
options.column
|
||
);
|
||
|
||
parser.filename = options.filename || '<unknown>';
|
||
parser.needPositions = Boolean(options.positions);
|
||
parser.onParseError = typeof options.onParseError === 'function' ? options.onParseError : noop;
|
||
parser.onParseErrorThrow = false;
|
||
parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true;
|
||
parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true;
|
||
parser.parseValue = 'parseValue' in options ? Boolean(options.parseValue) : true;
|
||
parser.parseCustomProperty = 'parseCustomProperty' in options ? Boolean(options.parseCustomProperty) : false;
|
||
|
||
if (!parser.context.hasOwnProperty(context)) {
|
||
throw new Error('Unknown context `' + context + '`');
|
||
}
|
||
|
||
if (typeof onComment === 'function') {
|
||
parser.scanner.forEachToken((type, start, end) => {
|
||
if (type === COMMENT) {
|
||
const loc = parser.getLocation(start, end);
|
||
const value = cmpStr(source, end - 2, end, '*/')
|
||
? source.slice(start + 2, end - 2)
|
||
: source.slice(start + 2, end);
|
||
|
||
onComment(value, loc);
|
||
}
|
||
});
|
||
}
|
||
|
||
ast = parser.context[context].call(parser, options);
|
||
|
||
if (!parser.scanner.eof) {
|
||
parser.error();
|
||
}
|
||
|
||
return ast;
|
||
};
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 43 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var adoptBuffer = __webpack_require__(28);
|
||
var isBOM = __webpack_require__(27).isBOM;
|
||
|
||
var N = 10;
|
||
var F = 12;
|
||
var R = 13;
|
||
|
||
function computeLinesAndColumns(host, source) {
|
||
var sourceLength = source.length;
|
||
var lines = adoptBuffer(host.lines, sourceLength); // +1
|
||
var line = host.startLine;
|
||
var columns = adoptBuffer(host.columns, sourceLength);
|
||
var column = host.startColumn;
|
||
var startOffset = source.length > 0 ? isBOM(source.charCodeAt(0)) : 0;
|
||
|
||
for (var i = startOffset; i < sourceLength; i++) { // -1
|
||
var code = source.charCodeAt(i);
|
||
|
||
lines[i] = line;
|
||
columns[i] = column++;
|
||
|
||
if (code === N || code === R || code === F) {
|
||
if (code === R && i + 1 < sourceLength && source.charCodeAt(i + 1) === N) {
|
||
i++;
|
||
lines[i] = line;
|
||
columns[i] = column;
|
||
}
|
||
|
||
line++;
|
||
column = 1;
|
||
}
|
||
}
|
||
|
||
lines[i] = line;
|
||
columns[i] = column;
|
||
|
||
host.lines = lines;
|
||
host.columns = columns;
|
||
}
|
||
|
||
var OffsetToLocation = function() {
|
||
this.lines = null;
|
||
this.columns = null;
|
||
this.linesAndColumnsComputed = false;
|
||
};
|
||
|
||
OffsetToLocation.prototype = {
|
||
setSource: function(source, startOffset, startLine, startColumn) {
|
||
this.source = source;
|
||
this.startOffset = typeof startOffset === 'undefined' ? 0 : startOffset;
|
||
this.startLine = typeof startLine === 'undefined' ? 1 : startLine;
|
||
this.startColumn = typeof startColumn === 'undefined' ? 1 : startColumn;
|
||
this.linesAndColumnsComputed = false;
|
||
},
|
||
|
||
ensureLinesAndColumnsComputed: function() {
|
||
if (!this.linesAndColumnsComputed) {
|
||
computeLinesAndColumns(this, this.source);
|
||
this.linesAndColumnsComputed = true;
|
||
}
|
||
},
|
||
getLocation: function(offset, filename) {
|
||
this.ensureLinesAndColumnsComputed();
|
||
|
||
return {
|
||
source: filename,
|
||
offset: this.startOffset + offset,
|
||
line: this.lines[offset],
|
||
column: this.columns[offset]
|
||
};
|
||
},
|
||
getLocationRange: function(start, end, filename) {
|
||
this.ensureLinesAndColumnsComputed();
|
||
|
||
return {
|
||
source: filename,
|
||
start: {
|
||
offset: this.startOffset + start,
|
||
line: this.lines[start],
|
||
column: this.columns[start]
|
||
},
|
||
end: {
|
||
offset: this.startOffset + end,
|
||
line: this.lines[end],
|
||
column: this.columns[end]
|
||
}
|
||
};
|
||
}
|
||
};
|
||
|
||
module.exports = OffsetToLocation;
|
||
|
||
|
||
/***/ }),
|
||
/* 44 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var COMMENT = TYPE.Comment;
|
||
|
||
module.exports = function readSequence(recognizer) {
|
||
var children = this.createList();
|
||
var child = null;
|
||
var context = {
|
||
recognizer: recognizer,
|
||
space: null,
|
||
ignoreWS: false,
|
||
ignoreWSAfter: false
|
||
};
|
||
|
||
this.scanner.skipSC();
|
||
|
||
while (!this.scanner.eof) {
|
||
switch (this.scanner.tokenType) {
|
||
case COMMENT:
|
||
this.scanner.next();
|
||
continue;
|
||
|
||
case WHITESPACE:
|
||
if (context.ignoreWS) {
|
||
this.scanner.next();
|
||
} else {
|
||
context.space = this.WhiteSpace();
|
||
}
|
||
continue;
|
||
}
|
||
|
||
child = recognizer.getNode.call(this, context);
|
||
|
||
if (child === undefined) {
|
||
break;
|
||
}
|
||
|
||
if (context.space !== null) {
|
||
children.push(context.space);
|
||
context.space = null;
|
||
}
|
||
|
||
children.push(child);
|
||
|
||
if (context.ignoreWSAfter) {
|
||
context.ignoreWSAfter = false;
|
||
context.ignoreWS = true;
|
||
} else {
|
||
context.ignoreWS = false;
|
||
}
|
||
}
|
||
|
||
return children;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 45 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var sourceMap = __webpack_require__(46);
|
||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
|
||
function processChildren(node, delimeter) {
|
||
var list = node.children;
|
||
var prev = null;
|
||
|
||
if (typeof delimeter !== 'function') {
|
||
list.forEach(this.node, this);
|
||
} else {
|
||
list.forEach(function(node) {
|
||
if (prev !== null) {
|
||
delimeter.call(this, prev);
|
||
}
|
||
|
||
this.node(node);
|
||
prev = node;
|
||
}, this);
|
||
}
|
||
}
|
||
|
||
module.exports = function createGenerator(config) {
|
||
function processNode(node) {
|
||
if (hasOwnProperty.call(types, node.type)) {
|
||
types[node.type].call(this, node);
|
||
} else {
|
||
throw new Error('Unknown node type: ' + node.type);
|
||
}
|
||
}
|
||
|
||
var types = {};
|
||
|
||
if (config.node) {
|
||
for (var name in config.node) {
|
||
types[name] = config.node[name].generate;
|
||
}
|
||
}
|
||
|
||
return function(node, options) {
|
||
var buffer = '';
|
||
var handlers = {
|
||
children: processChildren,
|
||
node: processNode,
|
||
chunk: function(chunk) {
|
||
buffer += chunk;
|
||
},
|
||
result: function() {
|
||
return buffer;
|
||
}
|
||
};
|
||
|
||
if (options) {
|
||
if (typeof options.decorator === 'function') {
|
||
handlers = options.decorator(handlers);
|
||
}
|
||
|
||
if (options.sourceMap) {
|
||
handlers = sourceMap(handlers);
|
||
}
|
||
}
|
||
|
||
handlers.node(node);
|
||
|
||
return handlers.result();
|
||
};
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 46 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var SourceMapGenerator = __webpack_require__(47).SourceMapGenerator;
|
||
var trackNodes = {
|
||
Atrule: true,
|
||
Selector: true,
|
||
Declaration: true
|
||
};
|
||
|
||
module.exports = function generateSourceMap(handlers) {
|
||
var map = new SourceMapGenerator();
|
||
var line = 1;
|
||
var column = 0;
|
||
var generated = {
|
||
line: 1,
|
||
column: 0
|
||
};
|
||
var original = {
|
||
line: 0, // should be zero to add first mapping
|
||
column: 0
|
||
};
|
||
var sourceMappingActive = false;
|
||
var activatedGenerated = {
|
||
line: 1,
|
||
column: 0
|
||
};
|
||
var activatedMapping = {
|
||
generated: activatedGenerated
|
||
};
|
||
|
||
var handlersNode = handlers.node;
|
||
handlers.node = function(node) {
|
||
if (node.loc && node.loc.start && trackNodes.hasOwnProperty(node.type)) {
|
||
var nodeLine = node.loc.start.line;
|
||
var nodeColumn = node.loc.start.column - 1;
|
||
|
||
if (original.line !== nodeLine ||
|
||
original.column !== nodeColumn) {
|
||
original.line = nodeLine;
|
||
original.column = nodeColumn;
|
||
|
||
generated.line = line;
|
||
generated.column = column;
|
||
|
||
if (sourceMappingActive) {
|
||
sourceMappingActive = false;
|
||
if (generated.line !== activatedGenerated.line ||
|
||
generated.column !== activatedGenerated.column) {
|
||
map.addMapping(activatedMapping);
|
||
}
|
||
}
|
||
|
||
sourceMappingActive = true;
|
||
map.addMapping({
|
||
source: node.loc.source,
|
||
original: original,
|
||
generated: generated
|
||
});
|
||
}
|
||
}
|
||
|
||
handlersNode.call(this, node);
|
||
|
||
if (sourceMappingActive && trackNodes.hasOwnProperty(node.type)) {
|
||
activatedGenerated.line = line;
|
||
activatedGenerated.column = column;
|
||
}
|
||
};
|
||
|
||
var handlersChunk = handlers.chunk;
|
||
handlers.chunk = function(chunk) {
|
||
for (var i = 0; i < chunk.length; i++) {
|
||
if (chunk.charCodeAt(i) === 10) { // \n
|
||
line++;
|
||
column = 0;
|
||
} else {
|
||
column++;
|
||
}
|
||
}
|
||
|
||
handlersChunk(chunk);
|
||
};
|
||
|
||
var handlersResult = handlers.result;
|
||
handlers.result = function() {
|
||
if (sourceMappingActive) {
|
||
map.addMapping(activatedMapping);
|
||
}
|
||
|
||
return {
|
||
css: handlersResult(),
|
||
map: map
|
||
};
|
||
};
|
||
|
||
return handlers;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 47 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||
/*
|
||
* Copyright 2011 Mozilla Foundation and contributors
|
||
* Licensed under the New BSD license. See LICENSE or:
|
||
* http://opensource.org/licenses/BSD-3-Clause
|
||
*/
|
||
|
||
var base64VLQ = __webpack_require__(48);
|
||
var util = __webpack_require__(50);
|
||
var ArraySet = __webpack_require__(51).ArraySet;
|
||
var MappingList = __webpack_require__(52).MappingList;
|
||
|
||
/**
|
||
* An instance of the SourceMapGenerator represents a source map which is
|
||
* being built incrementally. You may pass an object with the following
|
||
* properties:
|
||
*
|
||
* - file: The filename of the generated source.
|
||
* - sourceRoot: A root for all relative URLs in this source map.
|
||
*/
|
||
function SourceMapGenerator(aArgs) {
|
||
if (!aArgs) {
|
||
aArgs = {};
|
||
}
|
||
this._file = util.getArg(aArgs, 'file', null);
|
||
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
|
||
this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
|
||
this._sources = new ArraySet();
|
||
this._names = new ArraySet();
|
||
this._mappings = new MappingList();
|
||
this._sourcesContents = null;
|
||
}
|
||
|
||
SourceMapGenerator.prototype._version = 3;
|
||
|
||
/**
|
||
* Creates a new SourceMapGenerator based on a SourceMapConsumer
|
||
*
|
||
* @param aSourceMapConsumer The SourceMap.
|
||
*/
|
||
SourceMapGenerator.fromSourceMap =
|
||
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
|
||
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
||
var generator = new SourceMapGenerator({
|
||
file: aSourceMapConsumer.file,
|
||
sourceRoot: sourceRoot
|
||
});
|
||
aSourceMapConsumer.eachMapping(function (mapping) {
|
||
var newMapping = {
|
||
generated: {
|
||
line: mapping.generatedLine,
|
||
column: mapping.generatedColumn
|
||
}
|
||
};
|
||
|
||
if (mapping.source != null) {
|
||
newMapping.source = mapping.source;
|
||
if (sourceRoot != null) {
|
||
newMapping.source = util.relative(sourceRoot, newMapping.source);
|
||
}
|
||
|
||
newMapping.original = {
|
||
line: mapping.originalLine,
|
||
column: mapping.originalColumn
|
||
};
|
||
|
||
if (mapping.name != null) {
|
||
newMapping.name = mapping.name;
|
||
}
|
||
}
|
||
|
||
generator.addMapping(newMapping);
|
||
});
|
||
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
||
var sourceRelative = sourceFile;
|
||
if (sourceRoot !== null) {
|
||
sourceRelative = util.relative(sourceRoot, sourceFile);
|
||
}
|
||
|
||
if (!generator._sources.has(sourceRelative)) {
|
||
generator._sources.add(sourceRelative);
|
||
}
|
||
|
||
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
||
if (content != null) {
|
||
generator.setSourceContent(sourceFile, content);
|
||
}
|
||
});
|
||
return generator;
|
||
};
|
||
|
||
/**
|
||
* Add a single mapping from original source line and column to the generated
|
||
* source's line and column for this source map being created. The mapping
|
||
* object should have the following properties:
|
||
*
|
||
* - generated: An object with the generated line and column positions.
|
||
* - original: An object with the original line and column positions.
|
||
* - source: The original source file (relative to the sourceRoot).
|
||
* - name: An optional original token name for this mapping.
|
||
*/
|
||
SourceMapGenerator.prototype.addMapping =
|
||
function SourceMapGenerator_addMapping(aArgs) {
|
||
var generated = util.getArg(aArgs, 'generated');
|
||
var original = util.getArg(aArgs, 'original', null);
|
||
var source = util.getArg(aArgs, 'source', null);
|
||
var name = util.getArg(aArgs, 'name', null);
|
||
|
||
if (!this._skipValidation) {
|
||
this._validateMapping(generated, original, source, name);
|
||
}
|
||
|
||
if (source != null) {
|
||
source = String(source);
|
||
if (!this._sources.has(source)) {
|
||
this._sources.add(source);
|
||
}
|
||
}
|
||
|
||
if (name != null) {
|
||
name = String(name);
|
||
if (!this._names.has(name)) {
|
||
this._names.add(name);
|
||
}
|
||
}
|
||
|
||
this._mappings.add({
|
||
generatedLine: generated.line,
|
||
generatedColumn: generated.column,
|
||
originalLine: original != null && original.line,
|
||
originalColumn: original != null && original.column,
|
||
source: source,
|
||
name: name
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Set the source content for a source file.
|
||
*/
|
||
SourceMapGenerator.prototype.setSourceContent =
|
||
function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
|
||
var source = aSourceFile;
|
||
if (this._sourceRoot != null) {
|
||
source = util.relative(this._sourceRoot, source);
|
||
}
|
||
|
||
if (aSourceContent != null) {
|
||
// Add the source content to the _sourcesContents map.
|
||
// Create a new _sourcesContents map if the property is null.
|
||
if (!this._sourcesContents) {
|
||
this._sourcesContents = Object.create(null);
|
||
}
|
||
this._sourcesContents[util.toSetString(source)] = aSourceContent;
|
||
} else if (this._sourcesContents) {
|
||
// Remove the source file from the _sourcesContents map.
|
||
// If the _sourcesContents map is empty, set the property to null.
|
||
delete this._sourcesContents[util.toSetString(source)];
|
||
if (Object.keys(this._sourcesContents).length === 0) {
|
||
this._sourcesContents = null;
|
||
}
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Applies the mappings of a sub-source-map for a specific source file to the
|
||
* source map being generated. Each mapping to the supplied source file is
|
||
* rewritten using the supplied source map. Note: The resolution for the
|
||
* resulting mappings is the minimium of this map and the supplied map.
|
||
*
|
||
* @param aSourceMapConsumer The source map to be applied.
|
||
* @param aSourceFile Optional. The filename of the source file.
|
||
* If omitted, SourceMapConsumer's file property will be used.
|
||
* @param aSourceMapPath Optional. The dirname of the path to the source map
|
||
* to be applied. If relative, it is relative to the SourceMapConsumer.
|
||
* This parameter is needed when the two source maps aren't in the same
|
||
* directory, and the source map to be applied contains relative source
|
||
* paths. If so, those relative source paths need to be rewritten
|
||
* relative to the SourceMapGenerator.
|
||
*/
|
||
SourceMapGenerator.prototype.applySourceMap =
|
||
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
|
||
var sourceFile = aSourceFile;
|
||
// If aSourceFile is omitted, we will use the file property of the SourceMap
|
||
if (aSourceFile == null) {
|
||
if (aSourceMapConsumer.file == null) {
|
||
throw new Error(
|
||
'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
|
||
'or the source map\'s "file" property. Both were omitted.'
|
||
);
|
||
}
|
||
sourceFile = aSourceMapConsumer.file;
|
||
}
|
||
var sourceRoot = this._sourceRoot;
|
||
// Make "sourceFile" relative if an absolute Url is passed.
|
||
if (sourceRoot != null) {
|
||
sourceFile = util.relative(sourceRoot, sourceFile);
|
||
}
|
||
// Applying the SourceMap can add and remove items from the sources and
|
||
// the names array.
|
||
var newSources = new ArraySet();
|
||
var newNames = new ArraySet();
|
||
|
||
// Find mappings for the "sourceFile"
|
||
this._mappings.unsortedForEach(function (mapping) {
|
||
if (mapping.source === sourceFile && mapping.originalLine != null) {
|
||
// Check if it can be mapped by the source map, then update the mapping.
|
||
var original = aSourceMapConsumer.originalPositionFor({
|
||
line: mapping.originalLine,
|
||
column: mapping.originalColumn
|
||
});
|
||
if (original.source != null) {
|
||
// Copy mapping
|
||
mapping.source = original.source;
|
||
if (aSourceMapPath != null) {
|
||
mapping.source = util.join(aSourceMapPath, mapping.source)
|
||
}
|
||
if (sourceRoot != null) {
|
||
mapping.source = util.relative(sourceRoot, mapping.source);
|
||
}
|
||
mapping.originalLine = original.line;
|
||
mapping.originalColumn = original.column;
|
||
if (original.name != null) {
|
||
mapping.name = original.name;
|
||
}
|
||
}
|
||
}
|
||
|
||
var source = mapping.source;
|
||
if (source != null && !newSources.has(source)) {
|
||
newSources.add(source);
|
||
}
|
||
|
||
var name = mapping.name;
|
||
if (name != null && !newNames.has(name)) {
|
||
newNames.add(name);
|
||
}
|
||
|
||
}, this);
|
||
this._sources = newSources;
|
||
this._names = newNames;
|
||
|
||
// Copy sourcesContents of applied map.
|
||
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
||
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
||
if (content != null) {
|
||
if (aSourceMapPath != null) {
|
||
sourceFile = util.join(aSourceMapPath, sourceFile);
|
||
}
|
||
if (sourceRoot != null) {
|
||
sourceFile = util.relative(sourceRoot, sourceFile);
|
||
}
|
||
this.setSourceContent(sourceFile, content);
|
||
}
|
||
}, this);
|
||
};
|
||
|
||
/**
|
||
* A mapping can have one of the three levels of data:
|
||
*
|
||
* 1. Just the generated position.
|
||
* 2. The Generated position, original position, and original source.
|
||
* 3. Generated and original position, original source, as well as a name
|
||
* token.
|
||
*
|
||
* To maintain consistency, we validate that any new mapping being added falls
|
||
* in to one of these categories.
|
||
*/
|
||
SourceMapGenerator.prototype._validateMapping =
|
||
function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
|
||
aName) {
|
||
// When aOriginal is truthy but has empty values for .line and .column,
|
||
// it is most likely a programmer error. In this case we throw a very
|
||
// specific error message to try to guide them the right way.
|
||
// For example: https://github.com/Polymer/polymer-bundler/pull/519
|
||
if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
|
||
throw new Error(
|
||
'original.line and original.column are not numbers -- you probably meant to omit ' +
|
||
'the original mapping entirely and only map the generated position. If so, pass ' +
|
||
'null for the original mapping instead of an object with empty or null values.'
|
||
);
|
||
}
|
||
|
||
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
|
||
&& aGenerated.line > 0 && aGenerated.column >= 0
|
||
&& !aOriginal && !aSource && !aName) {
|
||
// Case 1.
|
||
return;
|
||
}
|
||
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
|
||
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
|
||
&& aGenerated.line > 0 && aGenerated.column >= 0
|
||
&& aOriginal.line > 0 && aOriginal.column >= 0
|
||
&& aSource) {
|
||
// Cases 2 and 3.
|
||
return;
|
||
}
|
||
else {
|
||
throw new Error('Invalid mapping: ' + JSON.stringify({
|
||
generated: aGenerated,
|
||
source: aSource,
|
||
original: aOriginal,
|
||
name: aName
|
||
}));
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Serialize the accumulated mappings in to the stream of base 64 VLQs
|
||
* specified by the source map format.
|
||
*/
|
||
SourceMapGenerator.prototype._serializeMappings =
|
||
function SourceMapGenerator_serializeMappings() {
|
||
var previousGeneratedColumn = 0;
|
||
var previousGeneratedLine = 1;
|
||
var previousOriginalColumn = 0;
|
||
var previousOriginalLine = 0;
|
||
var previousName = 0;
|
||
var previousSource = 0;
|
||
var result = '';
|
||
var next;
|
||
var mapping;
|
||
var nameIdx;
|
||
var sourceIdx;
|
||
|
||
var mappings = this._mappings.toArray();
|
||
for (var i = 0, len = mappings.length; i < len; i++) {
|
||
mapping = mappings[i];
|
||
next = ''
|
||
|
||
if (mapping.generatedLine !== previousGeneratedLine) {
|
||
previousGeneratedColumn = 0;
|
||
while (mapping.generatedLine !== previousGeneratedLine) {
|
||
next += ';';
|
||
previousGeneratedLine++;
|
||
}
|
||
}
|
||
else {
|
||
if (i > 0) {
|
||
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
|
||
continue;
|
||
}
|
||
next += ',';
|
||
}
|
||
}
|
||
|
||
next += base64VLQ.encode(mapping.generatedColumn
|
||
- previousGeneratedColumn);
|
||
previousGeneratedColumn = mapping.generatedColumn;
|
||
|
||
if (mapping.source != null) {
|
||
sourceIdx = this._sources.indexOf(mapping.source);
|
||
next += base64VLQ.encode(sourceIdx - previousSource);
|
||
previousSource = sourceIdx;
|
||
|
||
// lines are stored 0-based in SourceMap spec version 3
|
||
next += base64VLQ.encode(mapping.originalLine - 1
|
||
- previousOriginalLine);
|
||
previousOriginalLine = mapping.originalLine - 1;
|
||
|
||
next += base64VLQ.encode(mapping.originalColumn
|
||
- previousOriginalColumn);
|
||
previousOriginalColumn = mapping.originalColumn;
|
||
|
||
if (mapping.name != null) {
|
||
nameIdx = this._names.indexOf(mapping.name);
|
||
next += base64VLQ.encode(nameIdx - previousName);
|
||
previousName = nameIdx;
|
||
}
|
||
}
|
||
|
||
result += next;
|
||
}
|
||
|
||
return result;
|
||
};
|
||
|
||
SourceMapGenerator.prototype._generateSourcesContent =
|
||
function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
|
||
return aSources.map(function (source) {
|
||
if (!this._sourcesContents) {
|
||
return null;
|
||
}
|
||
if (aSourceRoot != null) {
|
||
source = util.relative(aSourceRoot, source);
|
||
}
|
||
var key = util.toSetString(source);
|
||
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
|
||
? this._sourcesContents[key]
|
||
: null;
|
||
}, this);
|
||
};
|
||
|
||
/**
|
||
* Externalize the source map.
|
||
*/
|
||
SourceMapGenerator.prototype.toJSON =
|
||
function SourceMapGenerator_toJSON() {
|
||
var map = {
|
||
version: this._version,
|
||
sources: this._sources.toArray(),
|
||
names: this._names.toArray(),
|
||
mappings: this._serializeMappings()
|
||
};
|
||
if (this._file != null) {
|
||
map.file = this._file;
|
||
}
|
||
if (this._sourceRoot != null) {
|
||
map.sourceRoot = this._sourceRoot;
|
||
}
|
||
if (this._sourcesContents) {
|
||
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
|
||
}
|
||
|
||
return map;
|
||
};
|
||
|
||
/**
|
||
* Render the source map being generated to a string.
|
||
*/
|
||
SourceMapGenerator.prototype.toString =
|
||
function SourceMapGenerator_toString() {
|
||
return JSON.stringify(this.toJSON());
|
||
};
|
||
|
||
exports.SourceMapGenerator = SourceMapGenerator;
|
||
|
||
|
||
/***/ }),
|
||
/* 48 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||
/*
|
||
* Copyright 2011 Mozilla Foundation and contributors
|
||
* Licensed under the New BSD license. See LICENSE or:
|
||
* http://opensource.org/licenses/BSD-3-Clause
|
||
*
|
||
* Based on the Base 64 VLQ implementation in Closure Compiler:
|
||
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
|
||
*
|
||
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
|
||
* Redistribution and use in source and binary forms, with or without
|
||
* modification, are permitted provided that the following conditions are
|
||
* met:
|
||
*
|
||
* * Redistributions of source code must retain the above copyright
|
||
* notice, this list of conditions and the following disclaimer.
|
||
* * Redistributions in binary form must reproduce the above
|
||
* copyright notice, this list of conditions and the following
|
||
* disclaimer in the documentation and/or other materials provided
|
||
* with the distribution.
|
||
* * Neither the name of Google Inc. nor the names of its
|
||
* contributors may be used to endorse or promote products derived
|
||
* from this software without specific prior written permission.
|
||
*
|
||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
*/
|
||
|
||
var base64 = __webpack_require__(49);
|
||
|
||
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
|
||
// length quantities we use in the source map spec, the first bit is the sign,
|
||
// the next four bits are the actual value, and the 6th bit is the
|
||
// continuation bit. The continuation bit tells us whether there are more
|
||
// digits in this value following this digit.
|
||
//
|
||
// Continuation
|
||
// | Sign
|
||
// | |
|
||
// V V
|
||
// 101011
|
||
|
||
var VLQ_BASE_SHIFT = 5;
|
||
|
||
// binary: 100000
|
||
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
|
||
|
||
// binary: 011111
|
||
var VLQ_BASE_MASK = VLQ_BASE - 1;
|
||
|
||
// binary: 100000
|
||
var VLQ_CONTINUATION_BIT = VLQ_BASE;
|
||
|
||
/**
|
||
* Converts from a two-complement value to a value where the sign bit is
|
||
* placed in the least significant bit. For example, as decimals:
|
||
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
|
||
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
|
||
*/
|
||
function toVLQSigned(aValue) {
|
||
return aValue < 0
|
||
? ((-aValue) << 1) + 1
|
||
: (aValue << 1) + 0;
|
||
}
|
||
|
||
/**
|
||
* Converts to a two-complement value from a value where the sign bit is
|
||
* placed in the least significant bit. For example, as decimals:
|
||
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
|
||
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
|
||
*/
|
||
function fromVLQSigned(aValue) {
|
||
var isNegative = (aValue & 1) === 1;
|
||
var shifted = aValue >> 1;
|
||
return isNegative
|
||
? -shifted
|
||
: shifted;
|
||
}
|
||
|
||
/**
|
||
* Returns the base 64 VLQ encoded value.
|
||
*/
|
||
exports.encode = function base64VLQ_encode(aValue) {
|
||
var encoded = "";
|
||
var digit;
|
||
|
||
var vlq = toVLQSigned(aValue);
|
||
|
||
do {
|
||
digit = vlq & VLQ_BASE_MASK;
|
||
vlq >>>= VLQ_BASE_SHIFT;
|
||
if (vlq > 0) {
|
||
// There are still more digits in this value, so we must make sure the
|
||
// continuation bit is marked.
|
||
digit |= VLQ_CONTINUATION_BIT;
|
||
}
|
||
encoded += base64.encode(digit);
|
||
} while (vlq > 0);
|
||
|
||
return encoded;
|
||
};
|
||
|
||
/**
|
||
* Decodes the next base 64 VLQ value from the given string and returns the
|
||
* value and the rest of the string via the out parameter.
|
||
*/
|
||
exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
|
||
var strLen = aStr.length;
|
||
var result = 0;
|
||
var shift = 0;
|
||
var continuation, digit;
|
||
|
||
do {
|
||
if (aIndex >= strLen) {
|
||
throw new Error("Expected more digits in base 64 VLQ value.");
|
||
}
|
||
|
||
digit = base64.decode(aStr.charCodeAt(aIndex++));
|
||
if (digit === -1) {
|
||
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
|
||
}
|
||
|
||
continuation = !!(digit & VLQ_CONTINUATION_BIT);
|
||
digit &= VLQ_BASE_MASK;
|
||
result = result + (digit << shift);
|
||
shift += VLQ_BASE_SHIFT;
|
||
} while (continuation);
|
||
|
||
aOutParam.value = fromVLQSigned(result);
|
||
aOutParam.rest = aIndex;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 49 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||
/*
|
||
* Copyright 2011 Mozilla Foundation and contributors
|
||
* Licensed under the New BSD license. See LICENSE or:
|
||
* http://opensource.org/licenses/BSD-3-Clause
|
||
*/
|
||
|
||
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
||
|
||
/**
|
||
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
|
||
*/
|
||
exports.encode = function (number) {
|
||
if (0 <= number && number < intToCharMap.length) {
|
||
return intToCharMap[number];
|
||
}
|
||
throw new TypeError("Must be between 0 and 63: " + number);
|
||
};
|
||
|
||
/**
|
||
* Decode a single base 64 character code digit to an integer. Returns -1 on
|
||
* failure.
|
||
*/
|
||
exports.decode = function (charCode) {
|
||
var bigA = 65; // 'A'
|
||
var bigZ = 90; // 'Z'
|
||
|
||
var littleA = 97; // 'a'
|
||
var littleZ = 122; // 'z'
|
||
|
||
var zero = 48; // '0'
|
||
var nine = 57; // '9'
|
||
|
||
var plus = 43; // '+'
|
||
var slash = 47; // '/'
|
||
|
||
var littleOffset = 26;
|
||
var numberOffset = 52;
|
||
|
||
// 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||
if (bigA <= charCode && charCode <= bigZ) {
|
||
return (charCode - bigA);
|
||
}
|
||
|
||
// 26 - 51: abcdefghijklmnopqrstuvwxyz
|
||
if (littleA <= charCode && charCode <= littleZ) {
|
||
return (charCode - littleA + littleOffset);
|
||
}
|
||
|
||
// 52 - 61: 0123456789
|
||
if (zero <= charCode && charCode <= nine) {
|
||
return (charCode - zero + numberOffset);
|
||
}
|
||
|
||
// 62: +
|
||
if (charCode == plus) {
|
||
return 62;
|
||
}
|
||
|
||
// 63: /
|
||
if (charCode == slash) {
|
||
return 63;
|
||
}
|
||
|
||
// Invalid base64 digit.
|
||
return -1;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 50 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||
/*
|
||
* Copyright 2011 Mozilla Foundation and contributors
|
||
* Licensed under the New BSD license. See LICENSE or:
|
||
* http://opensource.org/licenses/BSD-3-Clause
|
||
*/
|
||
|
||
/**
|
||
* This is a helper function for getting values from parameter/options
|
||
* objects.
|
||
*
|
||
* @param args The object we are extracting values from
|
||
* @param name The name of the property we are getting.
|
||
* @param defaultValue An optional value to return if the property is missing
|
||
* from the object. If this is not specified and the property is missing, an
|
||
* error will be thrown.
|
||
*/
|
||
function getArg(aArgs, aName, aDefaultValue) {
|
||
if (aName in aArgs) {
|
||
return aArgs[aName];
|
||
} else if (arguments.length === 3) {
|
||
return aDefaultValue;
|
||
} else {
|
||
throw new Error('"' + aName + '" is a required argument.');
|
||
}
|
||
}
|
||
exports.getArg = getArg;
|
||
|
||
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
||
var dataUrlRegexp = /^data:.+\,.+$/;
|
||
|
||
function urlParse(aUrl) {
|
||
var match = aUrl.match(urlRegexp);
|
||
if (!match) {
|
||
return null;
|
||
}
|
||
return {
|
||
scheme: match[1],
|
||
auth: match[2],
|
||
host: match[3],
|
||
port: match[4],
|
||
path: match[5]
|
||
};
|
||
}
|
||
exports.urlParse = urlParse;
|
||
|
||
function urlGenerate(aParsedUrl) {
|
||
var url = '';
|
||
if (aParsedUrl.scheme) {
|
||
url += aParsedUrl.scheme + ':';
|
||
}
|
||
url += '//';
|
||
if (aParsedUrl.auth) {
|
||
url += aParsedUrl.auth + '@';
|
||
}
|
||
if (aParsedUrl.host) {
|
||
url += aParsedUrl.host;
|
||
}
|
||
if (aParsedUrl.port) {
|
||
url += ":" + aParsedUrl.port
|
||
}
|
||
if (aParsedUrl.path) {
|
||
url += aParsedUrl.path;
|
||
}
|
||
return url;
|
||
}
|
||
exports.urlGenerate = urlGenerate;
|
||
|
||
/**
|
||
* Normalizes a path, or the path portion of a URL:
|
||
*
|
||
* - Replaces consecutive slashes with one slash.
|
||
* - Removes unnecessary '.' parts.
|
||
* - Removes unnecessary '<dir>/..' parts.
|
||
*
|
||
* Based on code in the Node.js 'path' core module.
|
||
*
|
||
* @param aPath The path or url to normalize.
|
||
*/
|
||
function normalize(aPath) {
|
||
var path = aPath;
|
||
var url = urlParse(aPath);
|
||
if (url) {
|
||
if (!url.path) {
|
||
return aPath;
|
||
}
|
||
path = url.path;
|
||
}
|
||
var isAbsolute = exports.isAbsolute(path);
|
||
|
||
var parts = path.split(/\/+/);
|
||
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
|
||
part = parts[i];
|
||
if (part === '.') {
|
||
parts.splice(i, 1);
|
||
} else if (part === '..') {
|
||
up++;
|
||
} else if (up > 0) {
|
||
if (part === '') {
|
||
// The first part is blank if the path is absolute. Trying to go
|
||
// above the root is a no-op. Therefore we can remove all '..' parts
|
||
// directly after the root.
|
||
parts.splice(i + 1, up);
|
||
up = 0;
|
||
} else {
|
||
parts.splice(i, 2);
|
||
up--;
|
||
}
|
||
}
|
||
}
|
||
path = parts.join('/');
|
||
|
||
if (path === '') {
|
||
path = isAbsolute ? '/' : '.';
|
||
}
|
||
|
||
if (url) {
|
||
url.path = path;
|
||
return urlGenerate(url);
|
||
}
|
||
return path;
|
||
}
|
||
exports.normalize = normalize;
|
||
|
||
/**
|
||
* Joins two paths/URLs.
|
||
*
|
||
* @param aRoot The root path or URL.
|
||
* @param aPath The path or URL to be joined with the root.
|
||
*
|
||
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
|
||
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended
|
||
* first.
|
||
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion
|
||
* is updated with the result and aRoot is returned. Otherwise the result
|
||
* is returned.
|
||
* - If aPath is absolute, the result is aPath.
|
||
* - Otherwise the two paths are joined with a slash.
|
||
* - Joining for example 'http://' and 'www.example.com' is also supported.
|
||
*/
|
||
function join(aRoot, aPath) {
|
||
if (aRoot === "") {
|
||
aRoot = ".";
|
||
}
|
||
if (aPath === "") {
|
||
aPath = ".";
|
||
}
|
||
var aPathUrl = urlParse(aPath);
|
||
var aRootUrl = urlParse(aRoot);
|
||
if (aRootUrl) {
|
||
aRoot = aRootUrl.path || '/';
|
||
}
|
||
|
||
// `join(foo, '//www.example.org')`
|
||
if (aPathUrl && !aPathUrl.scheme) {
|
||
if (aRootUrl) {
|
||
aPathUrl.scheme = aRootUrl.scheme;
|
||
}
|
||
return urlGenerate(aPathUrl);
|
||
}
|
||
|
||
if (aPathUrl || aPath.match(dataUrlRegexp)) {
|
||
return aPath;
|
||
}
|
||
|
||
// `join('http://', 'www.example.com')`
|
||
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
|
||
aRootUrl.host = aPath;
|
||
return urlGenerate(aRootUrl);
|
||
}
|
||
|
||
var joined = aPath.charAt(0) === '/'
|
||
? aPath
|
||
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
|
||
|
||
if (aRootUrl) {
|
||
aRootUrl.path = joined;
|
||
return urlGenerate(aRootUrl);
|
||
}
|
||
return joined;
|
||
}
|
||
exports.join = join;
|
||
|
||
exports.isAbsolute = function (aPath) {
|
||
return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
|
||
};
|
||
|
||
/**
|
||
* Make a path relative to a URL or another path.
|
||
*
|
||
* @param aRoot The root path or URL.
|
||
* @param aPath The path or URL to be made relative to aRoot.
|
||
*/
|
||
function relative(aRoot, aPath) {
|
||
if (aRoot === "") {
|
||
aRoot = ".";
|
||
}
|
||
|
||
aRoot = aRoot.replace(/\/$/, '');
|
||
|
||
// It is possible for the path to be above the root. In this case, simply
|
||
// checking whether the root is a prefix of the path won't work. Instead, we
|
||
// need to remove components from the root one by one, until either we find
|
||
// a prefix that fits, or we run out of components to remove.
|
||
var level = 0;
|
||
while (aPath.indexOf(aRoot + '/') !== 0) {
|
||
var index = aRoot.lastIndexOf("/");
|
||
if (index < 0) {
|
||
return aPath;
|
||
}
|
||
|
||
// If the only part of the root that is left is the scheme (i.e. http://,
|
||
// file:///, etc.), one or more slashes (/), or simply nothing at all, we
|
||
// have exhausted all components, so the path is not relative to the root.
|
||
aRoot = aRoot.slice(0, index);
|
||
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
|
||
return aPath;
|
||
}
|
||
|
||
++level;
|
||
}
|
||
|
||
// Make sure we add a "../" for each component we removed from the root.
|
||
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
||
}
|
||
exports.relative = relative;
|
||
|
||
var supportsNullProto = (function () {
|
||
var obj = Object.create(null);
|
||
return !('__proto__' in obj);
|
||
}());
|
||
|
||
function identity (s) {
|
||
return s;
|
||
}
|
||
|
||
/**
|
||
* Because behavior goes wacky when you set `__proto__` on objects, we
|
||
* have to prefix all the strings in our set with an arbitrary character.
|
||
*
|
||
* See https://github.com/mozilla/source-map/pull/31 and
|
||
* https://github.com/mozilla/source-map/issues/30
|
||
*
|
||
* @param String aStr
|
||
*/
|
||
function toSetString(aStr) {
|
||
if (isProtoString(aStr)) {
|
||
return '$' + aStr;
|
||
}
|
||
|
||
return aStr;
|
||
}
|
||
exports.toSetString = supportsNullProto ? identity : toSetString;
|
||
|
||
function fromSetString(aStr) {
|
||
if (isProtoString(aStr)) {
|
||
return aStr.slice(1);
|
||
}
|
||
|
||
return aStr;
|
||
}
|
||
exports.fromSetString = supportsNullProto ? identity : fromSetString;
|
||
|
||
function isProtoString(s) {
|
||
if (!s) {
|
||
return false;
|
||
}
|
||
|
||
var length = s.length;
|
||
|
||
if (length < 9 /* "__proto__".length */) {
|
||
return false;
|
||
}
|
||
|
||
if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
|
||
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
|
||
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
|
||
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
|
||
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
|
||
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
|
||
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
|
||
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
|
||
s.charCodeAt(length - 9) !== 95 /* '_' */) {
|
||
return false;
|
||
}
|
||
|
||
for (var i = length - 10; i >= 0; i--) {
|
||
if (s.charCodeAt(i) !== 36 /* '$' */) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
/**
|
||
* Comparator between two mappings where the original positions are compared.
|
||
*
|
||
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
||
* mappings with the same original source/line/column, but different generated
|
||
* line and column the same. Useful when searching for a mapping with a
|
||
* stubbed out mapping.
|
||
*/
|
||
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
||
var cmp = strcmp(mappingA.source, mappingB.source);
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = mappingA.originalLine - mappingB.originalLine;
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
||
if (cmp !== 0 || onlyCompareOriginal) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
return strcmp(mappingA.name, mappingB.name);
|
||
}
|
||
exports.compareByOriginalPositions = compareByOriginalPositions;
|
||
|
||
/**
|
||
* Comparator between two mappings with deflated source and name indices where
|
||
* the generated positions are compared.
|
||
*
|
||
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
||
* mappings with the same generated line and column, but different
|
||
* source/name/original line and column the same. Useful when searching for a
|
||
* mapping with a stubbed out mapping.
|
||
*/
|
||
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
|
||
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
||
if (cmp !== 0 || onlyCompareGenerated) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = strcmp(mappingA.source, mappingB.source);
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = mappingA.originalLine - mappingB.originalLine;
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
return strcmp(mappingA.name, mappingB.name);
|
||
}
|
||
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
||
|
||
function strcmp(aStr1, aStr2) {
|
||
if (aStr1 === aStr2) {
|
||
return 0;
|
||
}
|
||
|
||
if (aStr1 === null) {
|
||
return 1; // aStr2 !== null
|
||
}
|
||
|
||
if (aStr2 === null) {
|
||
return -1; // aStr1 !== null
|
||
}
|
||
|
||
if (aStr1 > aStr2) {
|
||
return 1;
|
||
}
|
||
|
||
return -1;
|
||
}
|
||
|
||
/**
|
||
* Comparator between two mappings with inflated source and name strings where
|
||
* the generated positions are compared.
|
||
*/
|
||
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
||
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = strcmp(mappingA.source, mappingB.source);
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = mappingA.originalLine - mappingB.originalLine;
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
||
if (cmp !== 0) {
|
||
return cmp;
|
||
}
|
||
|
||
return strcmp(mappingA.name, mappingB.name);
|
||
}
|
||
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
||
|
||
/**
|
||
* Strip any JSON XSSI avoidance prefix from the string (as documented
|
||
* in the source maps specification), and then parse the string as
|
||
* JSON.
|
||
*/
|
||
function parseSourceMapInput(str) {
|
||
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
|
||
}
|
||
exports.parseSourceMapInput = parseSourceMapInput;
|
||
|
||
/**
|
||
* Compute the URL of a source given the the source root, the source's
|
||
* URL, and the source map's URL.
|
||
*/
|
||
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
|
||
sourceURL = sourceURL || '';
|
||
|
||
if (sourceRoot) {
|
||
// This follows what Chrome does.
|
||
if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
|
||
sourceRoot += '/';
|
||
}
|
||
// The spec says:
|
||
// Line 4: An optional source root, useful for relocating source
|
||
// files on a server or removing repeated values in the
|
||
// “sources” entry. This value is prepended to the individual
|
||
// entries in the “source” field.
|
||
sourceURL = sourceRoot + sourceURL;
|
||
}
|
||
|
||
// Historically, SourceMapConsumer did not take the sourceMapURL as
|
||
// a parameter. This mode is still somewhat supported, which is why
|
||
// this code block is conditional. However, it's preferable to pass
|
||
// the source map URL to SourceMapConsumer, so that this function
|
||
// can implement the source URL resolution algorithm as outlined in
|
||
// the spec. This block is basically the equivalent of:
|
||
// new URL(sourceURL, sourceMapURL).toString()
|
||
// ... except it avoids using URL, which wasn't available in the
|
||
// older releases of node still supported by this library.
|
||
//
|
||
// The spec says:
|
||
// If the sources are not absolute URLs after prepending of the
|
||
// “sourceRoot”, the sources are resolved relative to the
|
||
// SourceMap (like resolving script src in a html document).
|
||
if (sourceMapURL) {
|
||
var parsed = urlParse(sourceMapURL);
|
||
if (!parsed) {
|
||
throw new Error("sourceMapURL could not be parsed");
|
||
}
|
||
if (parsed.path) {
|
||
// Strip the last path component, but keep the "/".
|
||
var index = parsed.path.lastIndexOf('/');
|
||
if (index >= 0) {
|
||
parsed.path = parsed.path.substring(0, index + 1);
|
||
}
|
||
}
|
||
sourceURL = join(urlGenerate(parsed), sourceURL);
|
||
}
|
||
|
||
return normalize(sourceURL);
|
||
}
|
||
exports.computeSourceURL = computeSourceURL;
|
||
|
||
|
||
/***/ }),
|
||
/* 51 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||
/*
|
||
* Copyright 2011 Mozilla Foundation and contributors
|
||
* Licensed under the New BSD license. See LICENSE or:
|
||
* http://opensource.org/licenses/BSD-3-Clause
|
||
*/
|
||
|
||
var util = __webpack_require__(50);
|
||
var has = Object.prototype.hasOwnProperty;
|
||
var hasNativeMap = typeof Map !== "undefined";
|
||
|
||
/**
|
||
* A data structure which is a combination of an array and a set. Adding a new
|
||
* member is O(1), testing for membership is O(1), and finding the index of an
|
||
* element is O(1). Removing elements from the set is not supported. Only
|
||
* strings are supported for membership.
|
||
*/
|
||
function ArraySet() {
|
||
this._array = [];
|
||
this._set = hasNativeMap ? new Map() : Object.create(null);
|
||
}
|
||
|
||
/**
|
||
* Static method for creating ArraySet instances from an existing array.
|
||
*/
|
||
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
|
||
var set = new ArraySet();
|
||
for (var i = 0, len = aArray.length; i < len; i++) {
|
||
set.add(aArray[i], aAllowDuplicates);
|
||
}
|
||
return set;
|
||
};
|
||
|
||
/**
|
||
* Return how many unique items are in this ArraySet. If duplicates have been
|
||
* added, than those do not count towards the size.
|
||
*
|
||
* @returns Number
|
||
*/
|
||
ArraySet.prototype.size = function ArraySet_size() {
|
||
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
|
||
};
|
||
|
||
/**
|
||
* Add the given string to this set.
|
||
*
|
||
* @param String aStr
|
||
*/
|
||
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
|
||
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
|
||
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
|
||
var idx = this._array.length;
|
||
if (!isDuplicate || aAllowDuplicates) {
|
||
this._array.push(aStr);
|
||
}
|
||
if (!isDuplicate) {
|
||
if (hasNativeMap) {
|
||
this._set.set(aStr, idx);
|
||
} else {
|
||
this._set[sStr] = idx;
|
||
}
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Is the given string a member of this set?
|
||
*
|
||
* @param String aStr
|
||
*/
|
||
ArraySet.prototype.has = function ArraySet_has(aStr) {
|
||
if (hasNativeMap) {
|
||
return this._set.has(aStr);
|
||
} else {
|
||
var sStr = util.toSetString(aStr);
|
||
return has.call(this._set, sStr);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* What is the index of the given string in the array?
|
||
*
|
||
* @param String aStr
|
||
*/
|
||
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
|
||
if (hasNativeMap) {
|
||
var idx = this._set.get(aStr);
|
||
if (idx >= 0) {
|
||
return idx;
|
||
}
|
||
} else {
|
||
var sStr = util.toSetString(aStr);
|
||
if (has.call(this._set, sStr)) {
|
||
return this._set[sStr];
|
||
}
|
||
}
|
||
|
||
throw new Error('"' + aStr + '" is not in the set.');
|
||
};
|
||
|
||
/**
|
||
* What is the element at the given index?
|
||
*
|
||
* @param Number aIdx
|
||
*/
|
||
ArraySet.prototype.at = function ArraySet_at(aIdx) {
|
||
if (aIdx >= 0 && aIdx < this._array.length) {
|
||
return this._array[aIdx];
|
||
}
|
||
throw new Error('No element indexed by ' + aIdx);
|
||
};
|
||
|
||
/**
|
||
* Returns the array representation of this set (which has the proper indices
|
||
* indicated by indexOf). Note that this is a copy of the internal array used
|
||
* for storing the members so that no one can mess with internal state.
|
||
*/
|
||
ArraySet.prototype.toArray = function ArraySet_toArray() {
|
||
return this._array.slice();
|
||
};
|
||
|
||
exports.ArraySet = ArraySet;
|
||
|
||
|
||
/***/ }),
|
||
/* 52 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||
/*
|
||
* Copyright 2014 Mozilla Foundation and contributors
|
||
* Licensed under the New BSD license. See LICENSE or:
|
||
* http://opensource.org/licenses/BSD-3-Clause
|
||
*/
|
||
|
||
var util = __webpack_require__(50);
|
||
|
||
/**
|
||
* Determine whether mappingB is after mappingA with respect to generated
|
||
* position.
|
||
*/
|
||
function generatedPositionAfter(mappingA, mappingB) {
|
||
// Optimized for most common case
|
||
var lineA = mappingA.generatedLine;
|
||
var lineB = mappingB.generatedLine;
|
||
var columnA = mappingA.generatedColumn;
|
||
var columnB = mappingB.generatedColumn;
|
||
return lineB > lineA || lineB == lineA && columnB >= columnA ||
|
||
util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
|
||
}
|
||
|
||
/**
|
||
* A data structure to provide a sorted view of accumulated mappings in a
|
||
* performance conscious manner. It trades a neglibable overhead in general
|
||
* case for a large speedup in case of mappings being added in order.
|
||
*/
|
||
function MappingList() {
|
||
this._array = [];
|
||
this._sorted = true;
|
||
// Serves as infimum
|
||
this._last = {generatedLine: -1, generatedColumn: 0};
|
||
}
|
||
|
||
/**
|
||
* Iterate through internal items. This method takes the same arguments that
|
||
* `Array.prototype.forEach` takes.
|
||
*
|
||
* NOTE: The order of the mappings is NOT guaranteed.
|
||
*/
|
||
MappingList.prototype.unsortedForEach =
|
||
function MappingList_forEach(aCallback, aThisArg) {
|
||
this._array.forEach(aCallback, aThisArg);
|
||
};
|
||
|
||
/**
|
||
* Add the given source mapping.
|
||
*
|
||
* @param Object aMapping
|
||
*/
|
||
MappingList.prototype.add = function MappingList_add(aMapping) {
|
||
if (generatedPositionAfter(this._last, aMapping)) {
|
||
this._last = aMapping;
|
||
this._array.push(aMapping);
|
||
} else {
|
||
this._sorted = false;
|
||
this._array.push(aMapping);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Returns the flat, sorted array of mappings. The mappings are sorted by
|
||
* generated position.
|
||
*
|
||
* WARNING: This method returns internal data without copying, for
|
||
* performance. The return value must NOT be mutated, and should be treated as
|
||
* an immutable borrow. If you want to take ownership, you must make your own
|
||
* copy.
|
||
*/
|
||
MappingList.prototype.toArray = function MappingList_toArray() {
|
||
if (!this._sorted) {
|
||
this._array.sort(util.compareByGeneratedPositionsInflated);
|
||
this._sorted = true;
|
||
}
|
||
return this._array;
|
||
};
|
||
|
||
exports.MappingList = MappingList;
|
||
|
||
|
||
/***/ }),
|
||
/* 53 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var List = __webpack_require__(15);
|
||
|
||
module.exports = function createConvertors(walk) {
|
||
return {
|
||
fromPlainObject: function(ast) {
|
||
walk(ast, {
|
||
enter: function(node) {
|
||
if (node.children && node.children instanceof List === false) {
|
||
node.children = new List().fromArray(node.children);
|
||
}
|
||
}
|
||
});
|
||
|
||
return ast;
|
||
},
|
||
toPlainObject: function(ast) {
|
||
walk(ast, {
|
||
leave: function(node) {
|
||
if (node.children && node.children instanceof List) {
|
||
node.children = node.children.toArray();
|
||
}
|
||
}
|
||
});
|
||
|
||
return ast;
|
||
}
|
||
};
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 54 */
|
||
/***/ ((module) => {
|
||
|
||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
var noop = function() {};
|
||
|
||
function ensureFunction(value) {
|
||
return typeof value === 'function' ? value : noop;
|
||
}
|
||
|
||
function invokeForType(fn, type) {
|
||
return function(node, item, list) {
|
||
if (node.type === type) {
|
||
fn.call(this, node, item, list);
|
||
}
|
||
};
|
||
}
|
||
|
||
function getWalkersFromStructure(name, nodeType) {
|
||
var structure = nodeType.structure;
|
||
var walkers = [];
|
||
|
||
for (var key in structure) {
|
||
if (hasOwnProperty.call(structure, key) === false) {
|
||
continue;
|
||
}
|
||
|
||
var fieldTypes = structure[key];
|
||
var walker = {
|
||
name: key,
|
||
type: false,
|
||
nullable: false
|
||
};
|
||
|
||
if (!Array.isArray(structure[key])) {
|
||
fieldTypes = [structure[key]];
|
||
}
|
||
|
||
for (var i = 0; i < fieldTypes.length; i++) {
|
||
var fieldType = fieldTypes[i];
|
||
if (fieldType === null) {
|
||
walker.nullable = true;
|
||
} else if (typeof fieldType === 'string') {
|
||
walker.type = 'node';
|
||
} else if (Array.isArray(fieldType)) {
|
||
walker.type = 'list';
|
||
}
|
||
}
|
||
|
||
if (walker.type) {
|
||
walkers.push(walker);
|
||
}
|
||
}
|
||
|
||
if (walkers.length) {
|
||
return {
|
||
context: nodeType.walkContext,
|
||
fields: walkers
|
||
};
|
||
}
|
||
|
||
return null;
|
||
}
|
||
|
||
function getTypesFromConfig(config) {
|
||
var types = {};
|
||
|
||
for (var name in config.node) {
|
||
if (hasOwnProperty.call(config.node, name)) {
|
||
var nodeType = config.node[name];
|
||
|
||
if (!nodeType.structure) {
|
||
throw new Error('Missed `structure` field in `' + name + '` node type definition');
|
||
}
|
||
|
||
types[name] = getWalkersFromStructure(name, nodeType);
|
||
}
|
||
}
|
||
|
||
return types;
|
||
}
|
||
|
||
function createTypeIterator(config, reverse) {
|
||
var fields = config.fields.slice();
|
||
var contextName = config.context;
|
||
var useContext = typeof contextName === 'string';
|
||
|
||
if (reverse) {
|
||
fields.reverse();
|
||
}
|
||
|
||
return function(node, context, walk, walkReducer) {
|
||
var prevContextValue;
|
||
|
||
if (useContext) {
|
||
prevContextValue = context[contextName];
|
||
context[contextName] = node;
|
||
}
|
||
|
||
for (var i = 0; i < fields.length; i++) {
|
||
var field = fields[i];
|
||
var ref = node[field.name];
|
||
|
||
if (!field.nullable || ref) {
|
||
if (field.type === 'list') {
|
||
var breakWalk = reverse
|
||
? ref.reduceRight(walkReducer, false)
|
||
: ref.reduce(walkReducer, false);
|
||
|
||
if (breakWalk) {
|
||
return true;
|
||
}
|
||
} else if (walk(ref)) {
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (useContext) {
|
||
context[contextName] = prevContextValue;
|
||
}
|
||
};
|
||
}
|
||
|
||
function createFastTraveralMap(iterators) {
|
||
return {
|
||
Atrule: {
|
||
StyleSheet: iterators.StyleSheet,
|
||
Atrule: iterators.Atrule,
|
||
Rule: iterators.Rule,
|
||
Block: iterators.Block
|
||
},
|
||
Rule: {
|
||
StyleSheet: iterators.StyleSheet,
|
||
Atrule: iterators.Atrule,
|
||
Rule: iterators.Rule,
|
||
Block: iterators.Block
|
||
},
|
||
Declaration: {
|
||
StyleSheet: iterators.StyleSheet,
|
||
Atrule: iterators.Atrule,
|
||
Rule: iterators.Rule,
|
||
Block: iterators.Block,
|
||
DeclarationList: iterators.DeclarationList
|
||
}
|
||
};
|
||
}
|
||
|
||
module.exports = function createWalker(config) {
|
||
var types = getTypesFromConfig(config);
|
||
var iteratorsNatural = {};
|
||
var iteratorsReverse = {};
|
||
var breakWalk = Symbol('break-walk');
|
||
var skipNode = Symbol('skip-node');
|
||
|
||
for (var name in types) {
|
||
if (hasOwnProperty.call(types, name) && types[name] !== null) {
|
||
iteratorsNatural[name] = createTypeIterator(types[name], false);
|
||
iteratorsReverse[name] = createTypeIterator(types[name], true);
|
||
}
|
||
}
|
||
|
||
var fastTraversalIteratorsNatural = createFastTraveralMap(iteratorsNatural);
|
||
var fastTraversalIteratorsReverse = createFastTraveralMap(iteratorsReverse);
|
||
|
||
var walk = function(root, options) {
|
||
function walkNode(node, item, list) {
|
||
var enterRet = enter.call(context, node, item, list);
|
||
|
||
if (enterRet === breakWalk) {
|
||
debugger;
|
||
return true;
|
||
}
|
||
|
||
if (enterRet === skipNode) {
|
||
return false;
|
||
}
|
||
|
||
if (iterators.hasOwnProperty(node.type)) {
|
||
if (iterators[node.type](node, context, walkNode, walkReducer)) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
if (leave.call(context, node, item, list) === breakWalk) {
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
var walkReducer = (ret, data, item, list) => ret || walkNode(data, item, list);
|
||
var enter = noop;
|
||
var leave = noop;
|
||
var iterators = iteratorsNatural;
|
||
var context = {
|
||
break: breakWalk,
|
||
skip: skipNode,
|
||
|
||
root: root,
|
||
stylesheet: null,
|
||
atrule: null,
|
||
atrulePrelude: null,
|
||
rule: null,
|
||
selector: null,
|
||
block: null,
|
||
declaration: null,
|
||
function: null
|
||
};
|
||
|
||
if (typeof options === 'function') {
|
||
enter = options;
|
||
} else if (options) {
|
||
enter = ensureFunction(options.enter);
|
||
leave = ensureFunction(options.leave);
|
||
|
||
if (options.reverse) {
|
||
iterators = iteratorsReverse;
|
||
}
|
||
|
||
if (options.visit) {
|
||
if (fastTraversalIteratorsNatural.hasOwnProperty(options.visit)) {
|
||
iterators = options.reverse
|
||
? fastTraversalIteratorsReverse[options.visit]
|
||
: fastTraversalIteratorsNatural[options.visit];
|
||
} else if (!types.hasOwnProperty(options.visit)) {
|
||
throw new Error('Bad value `' + options.visit + '` for `visit` option (should be: ' + Object.keys(types).join(', ') + ')');
|
||
}
|
||
|
||
enter = invokeForType(enter, options.visit);
|
||
leave = invokeForType(leave, options.visit);
|
||
}
|
||
}
|
||
|
||
if (enter === noop && leave === noop) {
|
||
throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
|
||
}
|
||
|
||
walkNode(root);
|
||
};
|
||
|
||
walk.break = breakWalk;
|
||
walk.skip = skipNode;
|
||
|
||
walk.find = function(ast, fn) {
|
||
var found = null;
|
||
|
||
walk(ast, function(node, item, list) {
|
||
if (fn.call(this, node, item, list)) {
|
||
found = node;
|
||
return breakWalk;
|
||
}
|
||
});
|
||
|
||
return found;
|
||
};
|
||
|
||
walk.findLast = function(ast, fn) {
|
||
var found = null;
|
||
|
||
walk(ast, {
|
||
reverse: true,
|
||
enter: function(node, item, list) {
|
||
if (fn.call(this, node, item, list)) {
|
||
found = node;
|
||
return breakWalk;
|
||
}
|
||
}
|
||
});
|
||
|
||
return found;
|
||
};
|
||
|
||
walk.findAll = function(ast, fn) {
|
||
var found = [];
|
||
|
||
walk(ast, function(node, item, list) {
|
||
if (fn.call(this, node, item, list)) {
|
||
found.push(node);
|
||
}
|
||
});
|
||
|
||
return found;
|
||
};
|
||
|
||
return walk;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 55 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var List = __webpack_require__(15);
|
||
|
||
module.exports = function clone(node) {
|
||
var result = {};
|
||
|
||
for (var key in node) {
|
||
var value = node[key];
|
||
|
||
if (value) {
|
||
if (Array.isArray(value) || value instanceof List) {
|
||
value = value.map(clone);
|
||
} else if (value.constructor === Object) {
|
||
value = clone(value);
|
||
}
|
||
}
|
||
|
||
result[key] = value;
|
||
}
|
||
|
||
return result;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 56 */
|
||
/***/ ((module) => {
|
||
|
||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
const shape = {
|
||
generic: true,
|
||
types: appendOrAssign,
|
||
atrules: {
|
||
prelude: appendOrAssignOrNull,
|
||
descriptors: appendOrAssignOrNull
|
||
},
|
||
properties: appendOrAssign,
|
||
parseContext: assign,
|
||
scope: deepAssign,
|
||
atrule: ['parse'],
|
||
pseudo: ['parse'],
|
||
node: ['name', 'structure', 'parse', 'generate', 'walkContext']
|
||
};
|
||
|
||
function isObject(value) {
|
||
return value && value.constructor === Object;
|
||
}
|
||
|
||
function copy(value) {
|
||
return isObject(value)
|
||
? Object.assign({}, value)
|
||
: value;
|
||
}
|
||
|
||
function assign(dest, src) {
|
||
return Object.assign(dest, src);
|
||
}
|
||
|
||
function deepAssign(dest, src) {
|
||
for (const key in src) {
|
||
if (hasOwnProperty.call(src, key)) {
|
||
if (isObject(dest[key])) {
|
||
deepAssign(dest[key], copy(src[key]));
|
||
} else {
|
||
dest[key] = copy(src[key]);
|
||
}
|
||
}
|
||
}
|
||
|
||
return dest;
|
||
}
|
||
|
||
function append(a, b) {
|
||
if (typeof b === 'string' && /^\s*\|/.test(b)) {
|
||
return typeof a === 'string'
|
||
? a + b
|
||
: b.replace(/^\s*\|\s*/, '');
|
||
}
|
||
|
||
return b || null;
|
||
}
|
||
|
||
function appendOrAssign(a, b) {
|
||
if (typeof b === 'string') {
|
||
return append(a, b);
|
||
}
|
||
|
||
const result = Object.assign({}, a);
|
||
for (let key in b) {
|
||
if (hasOwnProperty.call(b, key)) {
|
||
result[key] = append(hasOwnProperty.call(a, key) ? a[key] : undefined, b[key]);
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function appendOrAssignOrNull(a, b) {
|
||
const result = appendOrAssign(a, b);
|
||
|
||
return !isObject(result) || Object.keys(result).length
|
||
? result
|
||
: null;
|
||
}
|
||
|
||
function mix(dest, src, shape) {
|
||
for (const key in shape) {
|
||
if (hasOwnProperty.call(shape, key) === false) {
|
||
continue;
|
||
}
|
||
|
||
if (shape[key] === true) {
|
||
if (key in src) {
|
||
if (hasOwnProperty.call(src, key)) {
|
||
dest[key] = copy(src[key]);
|
||
}
|
||
}
|
||
} else if (shape[key]) {
|
||
if (typeof shape[key] === 'function') {
|
||
const fn = shape[key];
|
||
dest[key] = fn({}, dest[key]);
|
||
dest[key] = fn(dest[key] || {}, src[key]);
|
||
} else if (isObject(shape[key])) {
|
||
const result = {};
|
||
|
||
for (let name in dest[key]) {
|
||
result[name] = mix({}, dest[key][name], shape[key]);
|
||
}
|
||
|
||
for (let name in src[key]) {
|
||
result[name] = mix(result[name] || {}, src[key][name], shape[key]);
|
||
}
|
||
|
||
dest[key] = result;
|
||
} else if (Array.isArray(shape[key])) {
|
||
const res = {};
|
||
const innerShape = shape[key].reduce(function(s, k) {
|
||
s[k] = true;
|
||
return s;
|
||
}, {});
|
||
|
||
for (const [name, value] of Object.entries(dest[key] || {})) {
|
||
res[name] = {};
|
||
if (value) {
|
||
mix(res[name], value, innerShape);
|
||
}
|
||
}
|
||
|
||
for (const name in src[key]) {
|
||
if (hasOwnProperty.call(src[key], name)) {
|
||
if (!res[name]) {
|
||
res[name] = {};
|
||
}
|
||
|
||
if (src[key] && src[key][name]) {
|
||
mix(res[name], src[key][name], innerShape);
|
||
}
|
||
}
|
||
}
|
||
|
||
dest[key] = res;
|
||
}
|
||
}
|
||
}
|
||
return dest;
|
||
}
|
||
|
||
module.exports = (dest, src) => mix(dest, src, shape);
|
||
|
||
|
||
/***/ }),
|
||
/* 57 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var data = __webpack_require__(58);
|
||
|
||
module.exports = {
|
||
generic: true,
|
||
types: data.types,
|
||
atrules: data.atrules,
|
||
properties: data.properties,
|
||
node: __webpack_require__(63)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 58 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
const mdnAtrules = __webpack_require__(59);
|
||
const mdnProperties = __webpack_require__(60);
|
||
const mdnSyntaxes = __webpack_require__(61);
|
||
const patch = __webpack_require__(62);
|
||
const extendSyntax = /^\s*\|\s*/;
|
||
|
||
function preprocessAtrules(dict) {
|
||
const result = Object.create(null);
|
||
|
||
for (const atruleName in dict) {
|
||
const atrule = dict[atruleName];
|
||
let descriptors = null;
|
||
|
||
if (atrule.descriptors) {
|
||
descriptors = Object.create(null);
|
||
|
||
for (const descriptor in atrule.descriptors) {
|
||
descriptors[descriptor] = atrule.descriptors[descriptor].syntax;
|
||
}
|
||
}
|
||
|
||
result[atruleName.substr(1)] = {
|
||
prelude: atrule.syntax.trim().match(/^@\S+\s+([^;\{]*)/)[1].trim() || null,
|
||
descriptors
|
||
};
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function patchDictionary(dict, patchDict) {
|
||
const result = {};
|
||
|
||
// copy all syntaxes for an original dict
|
||
for (const key in dict) {
|
||
result[key] = dict[key].syntax || dict[key];
|
||
}
|
||
|
||
// apply a patch
|
||
for (const key in patchDict) {
|
||
if (key in dict) {
|
||
if (patchDict[key].syntax) {
|
||
result[key] = extendSyntax.test(patchDict[key].syntax)
|
||
? result[key] + ' ' + patchDict[key].syntax.trim()
|
||
: patchDict[key].syntax;
|
||
} else {
|
||
delete result[key];
|
||
}
|
||
} else {
|
||
if (patchDict[key].syntax) {
|
||
result[key] = patchDict[key].syntax.replace(extendSyntax, '');
|
||
}
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function unpackSyntaxes(dict) {
|
||
const result = {};
|
||
|
||
for (const key in dict) {
|
||
result[key] = dict[key].syntax;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function patchAtrules(dict, patchDict) {
|
||
const result = {};
|
||
|
||
// copy all syntaxes for an original dict
|
||
for (const key in dict) {
|
||
const patchDescriptors = (patchDict[key] && patchDict[key].descriptors) || null;
|
||
|
||
result[key] = {
|
||
prelude: key in patchDict && 'prelude' in patchDict[key]
|
||
? patchDict[key].prelude
|
||
: dict[key].prelude || null,
|
||
descriptors: dict[key].descriptors
|
||
? patchDictionary(dict[key].descriptors, patchDescriptors || {})
|
||
: patchDescriptors && unpackSyntaxes(patchDescriptors)
|
||
};
|
||
}
|
||
|
||
// apply a patch
|
||
for (const key in patchDict) {
|
||
if (!hasOwnProperty.call(dict, key)) {
|
||
result[key] = {
|
||
prelude: patchDict[key].prelude || null,
|
||
descriptors: patchDict[key].descriptors && unpackSyntaxes(patchDict[key].descriptors)
|
||
};
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
module.exports = {
|
||
types: patchDictionary(mdnSyntaxes, patch.syntaxes),
|
||
atrules: patchAtrules(preprocessAtrules(mdnAtrules), patch.atrules),
|
||
properties: patchDictionary(mdnProperties, patch.properties)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 59 */
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = JSON.parse('{"@charset":{"syntax":"@charset \\"<charset>\\";","groups":["CSS Charsets"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@charset"},"@counter-style":{"syntax":"@counter-style <counter-style-name> {\\n [ system: <counter-system>; ] ||\\n [ symbols: <counter-symbols>; ] ||\\n [ additive-symbols: <additive-symbols>; ] ||\\n [ negative: <negative-symbol>; ] ||\\n [ prefix: <prefix>; ] ||\\n [ suffix: <suffix>; ] ||\\n [ range: <range>; ] ||\\n [ pad: <padding>; ] ||\\n [ speak-as: <speak-as>; ] ||\\n [ fallback: <counter-style-name>; ]\\n}","interfaces":["CSSCounterStyleRule"],"groups":["CSS Counter Styles"],"descriptors":{"additive-symbols":{"syntax":"[ <integer> && <symbol> ]#","media":"all","initial":"n/a (required)","percentages":"no","computed":"asSpecified","order":"orderOfAppearance","status":"standard"},"fallback":{"syntax":"<counter-style-name>","media":"all","initial":"decimal","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"negative":{"syntax":"<symbol> <symbol>?","media":"all","initial":"\\"-\\" hyphen-minus","percentages":"no","computed":"asSpecified","order":"orderOfAppearance","status":"standard"},"pad":{"syntax":"<integer> && <symbol>","media":"all","initial":"0 \\"\\"","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"prefix":{"syntax":"<symbol>","media":"all","initial":"\\"\\"","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"range":{"syntax":"[ [ <integer> | infinite ]{2} ]# | auto","media":"all","initial":"auto","percentages":"no","computed":"asSpecified","order":"orderOfAppearance","status":"standard"},"speak-as":{"syntax":"auto | bullets | numbers | words | spell-out | <counter-style-name>","media":"all","initial":"auto","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"suffix":{"syntax":"<symbol>","media":"all","initial":"\\". \\"","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"symbols":{"syntax":"<symbol>+","media":"all","initial":"n/a (required)","percentages":"no","computed":"asSpecified","order":"orderOfAppearance","status":"standard"},"system":{"syntax":"cyclic | numeric | alphabetic | symbolic | additive | [ fixed <integer>? ] | [ extends <counter-style-name> ]","media":"all","initial":"symbolic","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"}},"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@counter-style"},"@document":{"syntax":"@document [ <url> | url-prefix(<string>) | domain(<string>) | media-document(<string>) | regexp(<string>) ]# {\\n <group-rule-body>\\n}","interfaces":["CSSGroupingRule","CSSConditionRule"],"groups":["CSS Conditional Rules"],"status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@document"},"@font-face":{"syntax":"@font-face {\\n [ font-family: <family-name>; ] ||\\n [ src: <src>; ] ||\\n [ unicode-range: <unicode-range>; ] ||\\n [ font-variant: <font-variant>; ] ||\\n [ font-feature-settings: <font-feature-settings>; ] ||\\n [ font-variation-settings: <font-variation-settings>; ] ||\\n [ font-stretch: <font-stretch>; ] ||\\n [ font-weight: <font-weight>; ] ||\\n [ font-style: <font-style>; ]\\n}","interfaces":["CSSFontFaceRule"],"groups":["CSS Fonts"],"descriptors":{"font-display":{"syntax":"[ auto | block | swap | fallback | optional ]","media":"visual","percentages":"no","initial":"auto","computed":"asSpecified","order":"uniqueOrder","status":"experimental"},"font-family":{"syntax":"<family-name>","media":"all","initial":"n/a (required)","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"font-feature-settings":{"syntax":"normal | <feature-tag-value>#","media":"all","initial":"normal","percentages":"no","computed":"asSpecified","order":"orderOfAppearance","status":"standard"},"font-variation-settings":{"syntax":"normal | [ <string> <number> ]#","media":"all","initial":"normal","percentages":"no","computed":"asSpecified","order":"orderOfAppearance","status":"standard"},"font-stretch":{"syntax":"<font-stretch-absolute>{1,2}","media":"all","initial":"normal","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"font-style":{"syntax":"normal | italic | oblique <angle>{0,2}","media":"all","initial":"normal","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"font-weight":{"syntax":"<font-weight-absolute>{1,2}","media":"all","initial":"normal","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"font-variant":{"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 ]","media":"all","initial":"normal","percentages":"no","computed":"asSpecified","order":"orderOfAppearance","status":"standard"},"src":{"syntax":"[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#","media":"all","initial":"n/a (required)","percentages":"no","computed":"asSpecified","order":"orderOfAppearance","status":"standard"},"unicode-range":{"syntax":"<unicode-range>#","media":"all","initial":"U+0-10FFFF","percentages":"no","computed":"asSpecified","order":"orderOfAppearance","status":"standard"}},"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@font-face"},"@font-feature-values":{"syntax":"@font-feature-values <family-name># {\\n <feature-value-block-list>\\n}","interfaces":["CSSFontFeatureValuesRule"],"groups":["CSS Fonts"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@font-feature-values"},"@import":{"syntax":"@import [ <string> | <url> ] [ <media-query-list> ]?;","groups":["Media Queries"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@import"},"@keyframes":{"syntax":"@keyframes <keyframes-name> {\\n <keyframe-block-list>\\n}","interfaces":["CSSKeyframeRule","CSSKeyframesRule"],"groups":["CSS Animations"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@keyframes"},"@media":{"syntax":"@media <media-query-list> {\\n <group-rule-body>\\n}","interfaces":["CSSGroupingRule","CSSConditionRule","CSSMediaRule","CSSCustomMediaRule"],"groups":["CSS Conditional Rules","Media Queries"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@media"},"@namespace":{"syntax":"@namespace <namespace-prefix>? [ <string> | <url> ];","groups":["CSS Namespaces"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@namespace"},"@page":{"syntax":"@page <page-selector-list> {\\n <page-body>\\n}","interfaces":["CSSPageRule"],"groups":["CSS Pages"],"descriptors":{"bleed":{"syntax":"auto | <length>","media":["visual","paged"],"initial":"auto","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"marks":{"syntax":"none | [ crop || cross ]","media":["visual","paged"],"initial":"none","percentages":"no","computed":"asSpecified","order":"orderOfAppearance","status":"standard"},"size":{"syntax":"<length>{1,2} | auto | [ <page-size> || [ portrait | landscape ] ]","media":["visual","paged"],"initial":"auto","percentages":"no","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"orderOfAppearance","status":"standard"}},"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@page"},"@property":{"syntax":"@property <custom-property-name> {\\n <declaration-list>\\n}","interfaces":["CSS","CSSPropertyRule"],"groups":["CSS Houdini"],"descriptors":{"syntax":{"syntax":"<string>","media":"all","percentages":"no","initial":"n/a (required)","computed":"asSpecified","order":"uniqueOrder","status":"experimental"},"inherits":{"syntax":"true | false","media":"all","percentages":"no","initial":"auto","computed":"asSpecified","order":"uniqueOrder","status":"experimental"},"initial-value":{"syntax":"<string>","media":"all","initial":"n/a (required)","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"experimental"}},"status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@property"},"@supports":{"syntax":"@supports <supports-condition> {\\n <group-rule-body>\\n}","interfaces":["CSSGroupingRule","CSSConditionRule","CSSSupportsRule"],"groups":["CSS Conditional Rules"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@supports"},"@viewport":{"syntax":"@viewport {\\n <group-rule-body>\\n}","interfaces":["CSSViewportRule"],"groups":["CSS Device Adaptation"],"descriptors":{"height":{"syntax":"<viewport-length>{1,2}","media":["visual","continuous"],"initial":["min-height","max-height"],"percentages":["min-height","max-height"],"computed":["min-height","max-height"],"order":"orderOfAppearance","status":"standard"},"max-height":{"syntax":"<viewport-length>","media":["visual","continuous"],"initial":"auto","percentages":"referToHeightOfInitialViewport","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard"},"max-width":{"syntax":"<viewport-length>","media":["visual","continuous"],"initial":"auto","percentages":"referToWidthOfInitialViewport","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard"},"max-zoom":{"syntax":"auto | <number> | <percentage>","media":["visual","continuous"],"initial":"auto","percentages":"the zoom factor itself","computed":"autoNonNegativeOrPercentage","order":"uniqueOrder","status":"standard"},"min-height":{"syntax":"<viewport-length>","media":["visual","continuous"],"initial":"auto","percentages":"referToHeightOfInitialViewport","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard"},"min-width":{"syntax":"<viewport-length>","media":["visual","continuous"],"initial":"auto","percentages":"referToWidthOfInitialViewport","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard"},"min-zoom":{"syntax":"auto | <number> | <percentage>","media":["visual","continuous"],"initial":"auto","percentages":"the zoom factor itself","computed":"autoNonNegativeOrPercentage","order":"uniqueOrder","status":"standard"},"orientation":{"syntax":"auto | portrait | landscape","media":["visual","continuous"],"initial":"auto","percentages":"referToSizeOfBoundingBox","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"user-zoom":{"syntax":"zoom | fixed","media":["visual","continuous"],"initial":"zoom","percentages":"referToSizeOfBoundingBox","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"viewport-fit":{"syntax":"auto | contain | cover","media":["visual","continuous"],"initial":"auto","percentages":"no","computed":"asSpecified","order":"uniqueOrder","status":"standard"},"width":{"syntax":"<viewport-length>{1,2}","media":["visual","continuous"],"initial":["min-width","max-width"],"percentages":["min-width","max-width"],"computed":["min-width","max-width"],"order":"orderOfAppearance","status":"standard"},"zoom":{"syntax":"auto | <number> | <percentage>","media":["visual","continuous"],"initial":"auto","percentages":"the zoom factor itself","computed":"autoNonNegativeOrPercentage","order":"uniqueOrder","status":"standard"}},"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/@viewport"}}');
|
||
|
||
/***/ }),
|
||
/* 60 */
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = JSON.parse('{"--*":{"syntax":"<declaration-value>","media":"all","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Variables"],"initial":"seeProse","appliesto":"allElements","computed":"asSpecifiedWithVarsSubstituted","order":"perGrammar","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/--*"},"-ms-accelerator":{"syntax":"false | true","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"false","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-accelerator"},"-ms-block-progression":{"syntax":"tb | rl | bt | lr","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"tb","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-block-progression"},"-ms-content-zoom-chaining":{"syntax":"none | chained","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"none","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-chaining"},"-ms-content-zooming":{"syntax":"none | zoom","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"zoomForTheTopLevelNoneForTheRest","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-content-zooming"},"-ms-content-zoom-limit":{"syntax":"<\'-ms-content-zoom-limit-min\'> <\'-ms-content-zoom-limit-max\'>","media":"interactive","inherited":false,"animationType":"discrete","percentages":["-ms-content-zoom-limit-max","-ms-content-zoom-limit-min"],"groups":["Microsoft Extensions"],"initial":["-ms-content-zoom-limit-max","-ms-content-zoom-limit-min"],"appliesto":"nonReplacedBlockAndInlineBlockElements","computed":["-ms-content-zoom-limit-max","-ms-content-zoom-limit-min"],"order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit"},"-ms-content-zoom-limit-max":{"syntax":"<percentage>","media":"interactive","inherited":false,"animationType":"discrete","percentages":"maxZoomFactor","groups":["Microsoft Extensions"],"initial":"400%","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-max"},"-ms-content-zoom-limit-min":{"syntax":"<percentage>","media":"interactive","inherited":false,"animationType":"discrete","percentages":"minZoomFactor","groups":["Microsoft Extensions"],"initial":"100%","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-limit-min"},"-ms-content-zoom-snap":{"syntax":"<\'-ms-content-zoom-snap-type\'> || <\'-ms-content-zoom-snap-points\'>","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":["-ms-content-zoom-snap-type","-ms-content-zoom-snap-points"],"appliesto":"nonReplacedBlockAndInlineBlockElements","computed":["-ms-content-zoom-snap-type","-ms-content-zoom-snap-points"],"order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap"},"-ms-content-zoom-snap-points":{"syntax":"snapInterval( <percentage>, <percentage> ) | snapList( <percentage># )","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"snapInterval(0%, 100%)","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-points"},"-ms-content-zoom-snap-type":{"syntax":"none | proximity | mandatory","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"none","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-content-zoom-snap-type"},"-ms-filter":{"syntax":"<string>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"\\"\\"","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-filter"},"-ms-flow-from":{"syntax":"[ none | <custom-ident> ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"none","appliesto":"nonReplacedElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-flow-from"},"-ms-flow-into":{"syntax":"[ none | <custom-ident> ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"none","appliesto":"iframeElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-flow-into"},"-ms-grid-columns":{"syntax":"none | <track-list> | <auto-track-list>","media":"visual","inherited":false,"animationType":"simpleListOfLpcDifferenceLpc","percentages":"referToDimensionOfContentArea","groups":["CSS Grid Layout"],"initial":"none","appliesto":"gridContainers","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-grid-columns"},"-ms-grid-rows":{"syntax":"none | <track-list> | <auto-track-list>","media":"visual","inherited":false,"animationType":"simpleListOfLpcDifferenceLpc","percentages":"referToDimensionOfContentArea","groups":["CSS Grid Layout"],"initial":"none","appliesto":"gridContainers","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-grid-rows"},"-ms-high-contrast-adjust":{"syntax":"auto | none","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-high-contrast-adjust"},"-ms-hyphenate-limit-chars":{"syntax":"auto | <integer>{1,3}","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-chars"},"-ms-hyphenate-limit-lines":{"syntax":"no-limit | <integer>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"no-limit","appliesto":"blockContainerElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-lines"},"-ms-hyphenate-limit-zone":{"syntax":"<percentage> | <length>","media":"visual","inherited":true,"animationType":"discrete","percentages":"referToLineBoxWidth","groups":["Microsoft Extensions"],"initial":"0","appliesto":"blockContainerElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-hyphenate-limit-zone"},"-ms-ime-align":{"syntax":"auto | after","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-ime-align"},"-ms-overflow-style":{"syntax":"auto | none | scrollbar | -ms-autohiding-scrollbar","media":"interactive","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"auto","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-overflow-style"},"-ms-scrollbar-3dlight-color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"dependsOnUserAgent","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-3dlight-color"},"-ms-scrollbar-arrow-color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"ButtonText","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-arrow-color"},"-ms-scrollbar-base-color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"dependsOnUserAgent","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-base-color"},"-ms-scrollbar-darkshadow-color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"ThreeDDarkShadow","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-darkshadow-color"},"-ms-scrollbar-face-color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"ThreeDFace","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-face-color"},"-ms-scrollbar-highlight-color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"ThreeDHighlight","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-highlight-color"},"-ms-scrollbar-shadow-color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"ThreeDDarkShadow","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-shadow-color"},"-ms-scrollbar-track-color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"Scrollbar","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scrollbar-track-color"},"-ms-scroll-chaining":{"syntax":"chained | none","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"chained","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-chaining"},"-ms-scroll-limit":{"syntax":"<\'-ms-scroll-limit-x-min\'> <\'-ms-scroll-limit-y-min\'> <\'-ms-scroll-limit-x-max\'> <\'-ms-scroll-limit-y-max\'>","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":["-ms-scroll-limit-x-min","-ms-scroll-limit-y-min","-ms-scroll-limit-x-max","-ms-scroll-limit-y-max"],"appliesto":"nonReplacedBlockAndInlineBlockElements","computed":["-ms-scroll-limit-x-min","-ms-scroll-limit-y-min","-ms-scroll-limit-x-max","-ms-scroll-limit-y-max"],"order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit"},"-ms-scroll-limit-x-max":{"syntax":"auto | <length>","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"auto","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-max"},"-ms-scroll-limit-x-min":{"syntax":"<length>","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"0","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-x-min"},"-ms-scroll-limit-y-max":{"syntax":"auto | <length>","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"auto","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-max"},"-ms-scroll-limit-y-min":{"syntax":"<length>","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"0","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-limit-y-min"},"-ms-scroll-rails":{"syntax":"none | railed","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"railed","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-rails"},"-ms-scroll-snap-points-x":{"syntax":"snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"snapInterval(0px, 100%)","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-x"},"-ms-scroll-snap-points-y":{"syntax":"snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"snapInterval(0px, 100%)","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-points-y"},"-ms-scroll-snap-type":{"syntax":"none | proximity | mandatory","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"none","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-type"},"-ms-scroll-snap-x":{"syntax":"<\'-ms-scroll-snap-type\'> <\'-ms-scroll-snap-points-x\'>","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":["-ms-scroll-snap-type","-ms-scroll-snap-points-x"],"appliesto":"nonReplacedBlockAndInlineBlockElements","computed":["-ms-scroll-snap-type","-ms-scroll-snap-points-x"],"order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-x"},"-ms-scroll-snap-y":{"syntax":"<\'-ms-scroll-snap-type\'> <\'-ms-scroll-snap-points-y\'>","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":["-ms-scroll-snap-type","-ms-scroll-snap-points-y"],"appliesto":"nonReplacedBlockAndInlineBlockElements","computed":["-ms-scroll-snap-type","-ms-scroll-snap-points-y"],"order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-snap-y"},"-ms-scroll-translation":{"syntax":"none | vertical-to-horizontal","media":"interactive","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-scroll-translation"},"-ms-text-autospace":{"syntax":"none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-text-autospace"},"-ms-touch-select":{"syntax":"grippers | none","media":"interactive","inherited":true,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"grippers","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-touch-select"},"-ms-user-select":{"syntax":"none | element | text","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"text","appliesto":"nonReplacedElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-user-select"},"-ms-wrap-flow":{"syntax":"auto | both | start | end | maximum | clear","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"auto","appliesto":"blockLevelElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-flow"},"-ms-wrap-margin":{"syntax":"<length>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"0","appliesto":"exclusionElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-margin"},"-ms-wrap-through":{"syntax":"wrap | none","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Microsoft Extensions"],"initial":"wrap","appliesto":"blockLevelElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-ms-wrap-through"},"-moz-appearance":{"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","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions","WebKit Extensions"],"initial":"noneButOverriddenInUserAgentCSS","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/appearance"},"-moz-binding":{"syntax":"<url> | none","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"none","appliesto":"allElementsExceptGeneratedContentOrPseudoElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-binding"},"-moz-border-bottom-colors":{"syntax":"<color>+ | none","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-border-bottom-colors"},"-moz-border-left-colors":{"syntax":"<color>+ | none","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-border-left-colors"},"-moz-border-right-colors":{"syntax":"<color>+ | none","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-border-right-colors"},"-moz-border-top-colors":{"syntax":"<color>+ | none","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-border-top-colors"},"-moz-context-properties":{"syntax":"none | [ fill | fill-opacity | stroke | stroke-opacity ]#","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"none","appliesto":"allElementsThatCanReferenceImages","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-context-properties"},"-moz-float-edge":{"syntax":"border-box | content-box | margin-box | padding-box","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"content-box","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-float-edge"},"-moz-force-broken-image-icon":{"syntax":"<integer [0,1]>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"0","appliesto":"images","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-force-broken-image-icon"},"-moz-image-region":{"syntax":"<shape> | auto","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"auto","appliesto":"xulImageElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-image-region"},"-moz-orient":{"syntax":"inline | block | horizontal | vertical","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"inline","appliesto":"anyElementEffectOnProgressAndMeter","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-orient"},"-moz-outline-radius":{"syntax":"<outline-radius>{1,4} [ / <outline-radius>{1,4} ]?","media":"visual","inherited":false,"animationType":["-moz-outline-radius-topleft","-moz-outline-radius-topright","-moz-outline-radius-bottomright","-moz-outline-radius-bottomleft"],"percentages":["-moz-outline-radius-topleft","-moz-outline-radius-topright","-moz-outline-radius-bottomright","-moz-outline-radius-bottomleft"],"groups":["Mozilla Extensions"],"initial":["-moz-outline-radius-topleft","-moz-outline-radius-topright","-moz-outline-radius-bottomright","-moz-outline-radius-bottomleft"],"appliesto":"allElements","computed":["-moz-outline-radius-topleft","-moz-outline-radius-topright","-moz-outline-radius-bottomright","-moz-outline-radius-bottomleft"],"order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius"},"-moz-outline-radius-bottomleft":{"syntax":"<outline-radius>","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["Mozilla Extensions"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomleft"},"-moz-outline-radius-bottomright":{"syntax":"<outline-radius>","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["Mozilla Extensions"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-bottomright"},"-moz-outline-radius-topleft":{"syntax":"<outline-radius>","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["Mozilla Extensions"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topleft"},"-moz-outline-radius-topright":{"syntax":"<outline-radius>","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["Mozilla Extensions"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-outline-radius-topright"},"-moz-stack-sizing":{"syntax":"ignore | stretch-to-fit","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"stretch-to-fit","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-stack-sizing"},"-moz-text-blink":{"syntax":"none | blink","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-text-blink"},"-moz-user-focus":{"syntax":"ignore | normal | select-after | select-before | select-menu | select-same | select-all | none","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-user-focus"},"-moz-user-input":{"syntax":"auto | none | enabled | disabled","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-user-input"},"-moz-user-modify":{"syntax":"read-only | read-write | write-only","media":"interactive","inherited":true,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"read-only","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-user-modify"},"-moz-window-dragging":{"syntax":"drag | no-drag","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"drag","appliesto":"allElementsCreatingNativeWindows","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-window-dragging"},"-moz-window-shadow":{"syntax":"default | menu | tooltip | sheet | none","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"default","appliesto":"allElementsCreatingNativeWindows","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-moz-window-shadow"},"-webkit-appearance":{"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","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"noneButOverriddenInUserAgentCSS","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/appearance"},"-webkit-border-before":{"syntax":"<\'border-width\'> || <\'border-style\'> || <\'color\'>","media":"visual","inherited":true,"animationType":"discrete","percentages":["-webkit-border-before-width"],"groups":["WebKit Extensions"],"initial":["border-width","border-style","color"],"appliesto":"allElements","computed":["border-width","border-style","color"],"order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-border-before"},"-webkit-border-before-color":{"syntax":"<\'color\'>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","status":"nonstandard"},"-webkit-border-before-style":{"syntax":"<\'border-style\'>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard"},"-webkit-border-before-width":{"syntax":"<\'border-width\'>","media":"visual","inherited":true,"animationType":"discrete","percentages":"logicalWidthOfContainingBlock","groups":["WebKit Extensions"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthZeroIfBorderStyleNoneOrHidden","order":"uniqueOrder","status":"nonstandard"},"-webkit-box-reflect":{"syntax":"[ above | below | right | left ]? <length>? <image>?","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-box-reflect"},"-webkit-line-clamp":{"syntax":"none | <integer>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["WebKit Extensions","CSS Overflow"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-line-clamp"},"-webkit-mask":{"syntax":"[ <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || [ <box> | border | padding | content | text ] || [ <box> | border | padding | content ] ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":["-webkit-mask-image","-webkit-mask-repeat","-webkit-mask-attachment","-webkit-mask-position","-webkit-mask-origin","-webkit-mask-clip"],"appliesto":"allElements","computed":["-webkit-mask-image","-webkit-mask-repeat","-webkit-mask-attachment","-webkit-mask-position","-webkit-mask-origin","-webkit-mask-clip"],"order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask"},"-webkit-mask-attachment":{"syntax":"<attachment>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"scroll","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-attachment"},"-webkit-mask-clip":{"syntax":"[ <box> | border | padding | content | text ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"border","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-clip"},"-webkit-mask-composite":{"syntax":"<composite-style>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"source-over","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-composite"},"-webkit-mask-image":{"syntax":"<mask-reference>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"none","appliesto":"allElements","computed":"absoluteURIOrNone","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-image"},"-webkit-mask-origin":{"syntax":"[ <box> | border | padding | content ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"padding","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-origin"},"-webkit-mask-position":{"syntax":"<position>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"referToSizeOfElement","groups":["WebKit Extensions"],"initial":"0% 0%","appliesto":"allElements","computed":"absoluteLengthOrPercentage","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-position"},"-webkit-mask-position-x":{"syntax":"[ <length-percentage> | left | center | right ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"referToSizeOfElement","groups":["WebKit Extensions"],"initial":"0%","appliesto":"allElements","computed":"absoluteLengthOrPercentage","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-x"},"-webkit-mask-position-y":{"syntax":"[ <length-percentage> | top | center | bottom ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"referToSizeOfElement","groups":["WebKit Extensions"],"initial":"0%","appliesto":"allElements","computed":"absoluteLengthOrPercentage","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-position-y"},"-webkit-mask-repeat":{"syntax":"<repeat-style>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"repeat","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-repeat"},"-webkit-mask-repeat-x":{"syntax":"repeat | no-repeat | space | round","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"repeat","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-x"},"-webkit-mask-repeat-y":{"syntax":"repeat | no-repeat | space | round","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"repeat","appliesto":"allElements","computed":"absoluteLengthOrPercentage","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-repeat-y"},"-webkit-mask-size":{"syntax":"<bg-size>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"relativeToBackgroundPositioningArea","groups":["WebKit Extensions"],"initial":"auto auto","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-size"},"-webkit-overflow-scrolling":{"syntax":"auto | touch","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"auto","appliesto":"scrollingBoxes","computed":"asSpecified","order":"orderOfAppearance","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-overflow-scrolling"},"-webkit-tap-highlight-color":{"syntax":"<color>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"black","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-tap-highlight-color"},"-webkit-text-fill-color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"color","percentages":"no","groups":["WebKit Extensions"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-text-fill-color"},"-webkit-text-stroke":{"syntax":"<length> || <color>","media":"visual","inherited":true,"animationType":["-webkit-text-stroke-width","-webkit-text-stroke-color"],"percentages":"no","groups":["WebKit Extensions"],"initial":["-webkit-text-stroke-width","-webkit-text-stroke-color"],"appliesto":"allElements","computed":["-webkit-text-stroke-width","-webkit-text-stroke-color"],"order":"canonicalOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke"},"-webkit-text-stroke-color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"color","percentages":"no","groups":["WebKit Extensions"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-color"},"-webkit-text-stroke-width":{"syntax":"<length>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"0","appliesto":"allElements","computed":"absoluteLength","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-width"},"-webkit-touch-callout":{"syntax":"default | none","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"default","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/-webkit-touch-callout"},"-webkit-user-modify":{"syntax":"read-only | read-write | read-write-plaintext-only","media":"interactive","inherited":true,"animationType":"discrete","percentages":"no","groups":["WebKit Extensions"],"initial":"read-only","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard"},"align-content":{"syntax":"normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Alignment"],"initial":"normal","appliesto":"multilineFlexContainers","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/align-content"},"align-items":{"syntax":"normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ]","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Alignment"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/align-items"},"align-self":{"syntax":"auto | normal | stretch | <baseline-position> | <overflow-position>? <self-position>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Alignment"],"initial":"auto","appliesto":"flexItemsGridItemsAndAbsolutelyPositionedBoxes","computed":"autoOnAbsolutelyPositionedElementsValueOfAlignItemsOnParent","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/align-self"},"align-tracks":{"syntax":"[ normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position> ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":"normal","appliesto":"gridContainersWithMasonryLayoutInTheirBlockAxis","computed":"asSpecified","order":"uniqueOrder","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/align-tracks"},"all":{"syntax":"initial | inherit | unset | revert","media":"noPracticalMedia","inherited":false,"animationType":"eachOfShorthandPropertiesExceptUnicodeBiDiAndDirection","percentages":"no","groups":["CSS Miscellaneous"],"initial":"noPracticalInitialValue","appliesto":"allElements","computed":"asSpecifiedAppliesToEachProperty","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/all"},"animation":{"syntax":"<single-animation>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Animations"],"initial":["animation-name","animation-duration","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","animation-fill-mode","animation-play-state"],"appliesto":"allElementsAndPseudos","computed":["animation-name","animation-duration","animation-timing-function","animation-delay","animation-direction","animation-iteration-count","animation-fill-mode","animation-play-state"],"order":"orderOfAppearance","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/animation"},"animation-delay":{"syntax":"<time>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Animations"],"initial":"0s","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/animation-delay"},"animation-direction":{"syntax":"<single-animation-direction>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Animations"],"initial":"normal","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/animation-direction"},"animation-duration":{"syntax":"<time>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Animations"],"initial":"0s","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/animation-duration"},"animation-fill-mode":{"syntax":"<single-animation-fill-mode>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Animations"],"initial":"none","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode"},"animation-iteration-count":{"syntax":"<single-animation-iteration-count>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Animations"],"initial":"1","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count"},"animation-name":{"syntax":"[ none | <keyframes-name> ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Animations"],"initial":"none","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/animation-name"},"animation-play-state":{"syntax":"<single-animation-play-state>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Animations"],"initial":"running","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/animation-play-state"},"animation-timing-function":{"syntax":"<timing-function>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Animations"],"initial":"ease","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/animation-timing-function"},"appearance":{"syntax":"none | auto | textfield | menulist-button | <compat-auto>","media":"all","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Basic User Interface"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/appearance"},"aspect-ratio":{"syntax":"auto | <ratio>","media":"all","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Basic User Interface"],"initial":"auto","appliesto":"allElementsExceptInlineBoxesAndInternalRubyOrTableBoxes","computed":"asSpecified","order":"perGrammar","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/aspect-ratio"},"azimuth":{"syntax":"<angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards","media":"aural","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Speech"],"initial":"center","appliesto":"allElements","computed":"normalizedAngle","order":"orderOfAppearance","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/azimuth"},"backdrop-filter":{"syntax":"none | <filter-function-list>","media":"visual","inherited":false,"animationType":"filterList","percentages":"no","groups":["Filter Effects"],"initial":"none","appliesto":"allElementsSVGContainerElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/backdrop-filter"},"backface-visibility":{"syntax":"visible | hidden","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Transforms"],"initial":"visible","appliesto":"transformableElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/backface-visibility"},"background":{"syntax":"[ <bg-layer> , ]* <final-bg-layer>","media":"visual","inherited":false,"animationType":["background-color","background-image","background-clip","background-position","background-size","background-repeat","background-attachment"],"percentages":["background-position","background-size"],"groups":["CSS Backgrounds and Borders"],"initial":["background-image","background-position","background-size","background-repeat","background-origin","background-clip","background-attachment","background-color"],"appliesto":"allElements","computed":["background-image","background-position","background-size","background-repeat","background-origin","background-clip","background-attachment","background-color"],"order":"orderOfAppearance","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background"},"background-attachment":{"syntax":"<attachment>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"scroll","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-attachment"},"background-blend-mode":{"syntax":"<blend-mode>#","media":"none","inherited":false,"animationType":"discrete","percentages":"no","groups":["Compositing and Blending"],"initial":"normal","appliesto":"allElementsSVGContainerGraphicsAndGraphicsReferencingElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-blend-mode"},"background-clip":{"syntax":"<box>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"border-box","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-clip"},"background-color":{"syntax":"<color>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"transparent","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-color"},"background-image":{"syntax":"<bg-image>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"none","appliesto":"allElements","computed":"asSpecifiedURLsAbsolute","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-image"},"background-origin":{"syntax":"<box>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"padding-box","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-origin"},"background-position":{"syntax":"<bg-position>#","media":"visual","inherited":false,"animationType":"repeatableListOfSimpleListOfLpc","percentages":"referToSizeOfBackgroundPositioningAreaMinusBackgroundImageSize","groups":["CSS Backgrounds and Borders"],"initial":"0% 0%","appliesto":"allElements","computed":"listEachItemTwoKeywordsOriginOffsets","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-position"},"background-position-x":{"syntax":"[ center | [ [ left | right | x-start | x-end ]? <length-percentage>? ]! ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"referToWidthOfBackgroundPositioningAreaMinusBackgroundImageHeight","groups":["CSS Backgrounds and Borders"],"initial":"left","appliesto":"allElements","computed":"listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin","order":"uniqueOrder","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-position-x"},"background-position-y":{"syntax":"[ center | [ [ top | bottom | y-start | y-end ]? <length-percentage>? ]! ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"referToHeightOfBackgroundPositioningAreaMinusBackgroundImageHeight","groups":["CSS Backgrounds and Borders"],"initial":"top","appliesto":"allElements","computed":"listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin","order":"uniqueOrder","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-position-y"},"background-repeat":{"syntax":"<repeat-style>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"repeat","appliesto":"allElements","computed":"listEachItemHasTwoKeywordsOnePerDimension","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-repeat"},"background-size":{"syntax":"<bg-size>#","media":"visual","inherited":false,"animationType":"repeatableListOfSimpleListOfLpc","percentages":"relativeToBackgroundPositioningArea","groups":["CSS Backgrounds and Borders"],"initial":"auto auto","appliesto":"allElements","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/background-size"},"block-overflow":{"syntax":"clip | ellipsis | <string>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Overflow"],"initial":"clip","appliesto":"blockContainers","computed":"asSpecified","order":"perGrammar","status":"experimental"},"block-size":{"syntax":"<\'width\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"blockSizeOfContainingBlock","groups":["CSS Logical Properties"],"initial":"auto","appliesto":"sameAsWidthAndHeight","computed":"sameAsWidthAndHeight","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/block-size"},"border":{"syntax":"<line-width> || <line-style> || <color>","media":"visual","inherited":false,"animationType":["border-color","border-style","border-width"],"percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":["border-width","border-style","border-color"],"appliesto":"allElements","computed":["border-width","border-style","border-color"],"order":"orderOfAppearance","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border"},"border-block":{"syntax":"<\'border-top-width\'> || <\'border-top-style\'> || <\'color\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Logical Properties"],"initial":["border-top-width","border-top-style","border-top-color"],"appliesto":"allElements","computed":["border-top-width","border-top-style","border-top-color"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block"},"border-block-color":{"syntax":"<\'border-top-color\'>{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Logical Properties"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-color"},"border-block-style":{"syntax":"<\'border-top-style\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Logical Properties"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-style"},"border-block-width":{"syntax":"<\'border-top-width\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthZeroIfBorderStyleNoneOrHidden","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-width"},"border-block-end":{"syntax":"<\'border-top-width\'> || <\'border-top-style\'> || <\'color\'>","media":"visual","inherited":false,"animationType":["border-block-end-color","border-block-end-style","border-block-end-width"],"percentages":"no","groups":["CSS Logical Properties"],"initial":["border-top-width","border-top-style","border-top-color"],"appliesto":"allElements","computed":["border-top-width","border-top-style","border-top-color"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-end"},"border-block-end-color":{"syntax":"<\'border-top-color\'>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Logical Properties"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-end-color"},"border-block-end-style":{"syntax":"<\'border-top-style\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Logical Properties"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-end-style"},"border-block-end-width":{"syntax":"<\'border-top-width\'>","media":"visual","inherited":false,"animationType":"length","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthZeroIfBorderStyleNoneOrHidden","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-end-width"},"border-block-start":{"syntax":"<\'border-top-width\'> || <\'border-top-style\'> || <\'color\'>","media":"visual","inherited":false,"animationType":["border-block-start-color","border-block-start-style","border-block-start-width"],"percentages":"no","groups":["CSS Logical Properties"],"initial":["border-width","border-style","color"],"appliesto":"allElements","computed":["border-width","border-style","border-block-start-color"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-start"},"border-block-start-color":{"syntax":"<\'border-top-color\'>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Logical Properties"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-start-color"},"border-block-start-style":{"syntax":"<\'border-top-style\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Logical Properties"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-start-style"},"border-block-start-width":{"syntax":"<\'border-top-width\'>","media":"visual","inherited":false,"animationType":"length","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthZeroIfBorderStyleNoneOrHidden","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-block-start-width"},"border-bottom":{"syntax":"<line-width> || <line-style> || <color>","media":"visual","inherited":false,"animationType":["border-bottom-color","border-bottom-style","border-bottom-width"],"percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":["border-bottom-width","border-bottom-style","border-bottom-color"],"appliesto":"allElements","computed":["border-bottom-width","border-bottom-style","border-bottom-color"],"order":"orderOfAppearance","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-bottom"},"border-bottom-color":{"syntax":"<\'border-top-color\'>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-bottom-color"},"border-bottom-left-radius":{"syntax":"<length-percentage>{1,2}","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["CSS Backgrounds and Borders"],"initial":"0","appliesto":"allElementsUAsNotRequiredWhenCollapse","computed":"twoAbsoluteLengthOrPercentages","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius"},"border-bottom-right-radius":{"syntax":"<length-percentage>{1,2}","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["CSS Backgrounds and Borders"],"initial":"0","appliesto":"allElementsUAsNotRequiredWhenCollapse","computed":"twoAbsoluteLengthOrPercentages","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius"},"border-bottom-style":{"syntax":"<line-style>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-bottom-style"},"border-bottom-width":{"syntax":"<line-width>","media":"visual","inherited":false,"animationType":"length","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthOr0IfBorderBottomStyleNoneOrHidden","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-bottom-width"},"border-collapse":{"syntax":"collapse | separate","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Table"],"initial":"separate","appliesto":"tableElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-collapse"},"border-color":{"syntax":"<color>{1,4}","media":"visual","inherited":false,"animationType":["border-bottom-color","border-left-color","border-right-color","border-top-color"],"percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":["border-top-color","border-right-color","border-bottom-color","border-left-color"],"appliesto":"allElements","computed":["border-bottom-color","border-left-color","border-right-color","border-top-color"],"order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-color"},"border-end-end-radius":{"syntax":"<length-percentage>{1,2}","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["CSS Logical Properties"],"initial":"0","appliesto":"allElementsUAsNotRequiredWhenCollapse","computed":"twoAbsoluteLengthOrPercentages","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-end-end-radius"},"border-end-start-radius":{"syntax":"<length-percentage>{1,2}","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["CSS Logical Properties"],"initial":"0","appliesto":"allElementsUAsNotRequiredWhenCollapse","computed":"twoAbsoluteLengthOrPercentages","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-end-start-radius"},"border-image":{"syntax":"<\'border-image-source\'> || <\'border-image-slice\'> [ / <\'border-image-width\'> | / <\'border-image-width\'>? / <\'border-image-outset\'> ]? || <\'border-image-repeat\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":["border-image-slice","border-image-width"],"groups":["CSS Backgrounds and Borders"],"initial":["border-image-source","border-image-slice","border-image-width","border-image-outset","border-image-repeat"],"appliesto":"allElementsExceptTableElementsWhenCollapse","computed":["border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width"],"order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-image"},"border-image-outset":{"syntax":"[ <length> | <number> ]{1,4}","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"0","appliesto":"allElementsExceptTableElementsWhenCollapse","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-image-outset"},"border-image-repeat":{"syntax":"[ stretch | repeat | round | space ]{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"stretch","appliesto":"allElementsExceptTableElementsWhenCollapse","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-image-repeat"},"border-image-slice":{"syntax":"<number-percentage>{1,4} && fill?","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"referToSizeOfBorderImage","groups":["CSS Backgrounds and Borders"],"initial":"100%","appliesto":"allElementsExceptTableElementsWhenCollapse","computed":"oneToFourPercentagesOrAbsoluteLengthsPlusFill","order":"percentagesOrLengthsFollowedByFill","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-image-slice"},"border-image-source":{"syntax":"none | <image>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"none","appliesto":"allElementsExceptTableElementsWhenCollapse","computed":"noneOrImageWithAbsoluteURI","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-image-source"},"border-image-width":{"syntax":"[ <length-percentage> | <number> | auto ]{1,4}","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"referToWidthOrHeightOfBorderImageArea","groups":["CSS Backgrounds and Borders"],"initial":"1","appliesto":"allElementsExceptTableElementsWhenCollapse","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-image-width"},"border-inline":{"syntax":"<\'border-top-width\'> || <\'border-top-style\'> || <\'color\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Logical Properties"],"initial":["border-top-width","border-top-style","border-top-color"],"appliesto":"allElements","computed":["border-top-width","border-top-style","border-top-color"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline"},"border-inline-end":{"syntax":"<\'border-top-width\'> || <\'border-top-style\'> || <\'color\'>","media":"visual","inherited":false,"animationType":["border-inline-end-color","border-inline-end-style","border-inline-end-width"],"percentages":"no","groups":["CSS Logical Properties"],"initial":["border-width","border-style","color"],"appliesto":"allElements","computed":["border-width","border-style","border-inline-end-color"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-end"},"border-inline-color":{"syntax":"<\'border-top-color\'>{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Logical Properties"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-color"},"border-inline-style":{"syntax":"<\'border-top-style\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Logical Properties"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-style"},"border-inline-width":{"syntax":"<\'border-top-width\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthZeroIfBorderStyleNoneOrHidden","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-width"},"border-inline-end-color":{"syntax":"<\'border-top-color\'>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Logical Properties"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-end-color"},"border-inline-end-style":{"syntax":"<\'border-top-style\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Logical Properties"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-end-style"},"border-inline-end-width":{"syntax":"<\'border-top-width\'>","media":"visual","inherited":false,"animationType":"length","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthZeroIfBorderStyleNoneOrHidden","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-end-width"},"border-inline-start":{"syntax":"<\'border-top-width\'> || <\'border-top-style\'> || <\'color\'>","media":"visual","inherited":false,"animationType":["border-inline-start-color","border-inline-start-style","border-inline-start-width"],"percentages":"no","groups":["CSS Logical Properties"],"initial":["border-width","border-style","color"],"appliesto":"allElements","computed":["border-width","border-style","border-inline-start-color"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-start"},"border-inline-start-color":{"syntax":"<\'border-top-color\'>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Logical Properties"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-start-color"},"border-inline-start-style":{"syntax":"<\'border-top-style\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Logical Properties"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-start-style"},"border-inline-start-width":{"syntax":"<\'border-top-width\'>","media":"visual","inherited":false,"animationType":"length","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthZeroIfBorderStyleNoneOrHidden","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-inline-start-width"},"border-left":{"syntax":"<line-width> || <line-style> || <color>","media":"visual","inherited":false,"animationType":["border-left-color","border-left-style","border-left-width"],"percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":["border-left-width","border-left-style","border-left-color"],"appliesto":"allElements","computed":["border-left-width","border-left-style","border-left-color"],"order":"orderOfAppearance","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-left"},"border-left-color":{"syntax":"<color>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-left-color"},"border-left-style":{"syntax":"<line-style>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-left-style"},"border-left-width":{"syntax":"<line-width>","media":"visual","inherited":false,"animationType":"length","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthOr0IfBorderLeftStyleNoneOrHidden","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-left-width"},"border-radius":{"syntax":"<length-percentage>{1,4} [ / <length-percentage>{1,4} ]?","media":"visual","inherited":false,"animationType":["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"],"percentages":"referToDimensionOfBorderBox","groups":["CSS Backgrounds and Borders"],"initial":["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"],"appliesto":"allElementsUAsNotRequiredWhenCollapse","computed":["border-bottom-left-radius","border-bottom-right-radius","border-top-left-radius","border-top-right-radius"],"order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-radius"},"border-right":{"syntax":"<line-width> || <line-style> || <color>","media":"visual","inherited":false,"animationType":["border-right-color","border-right-style","border-right-width"],"percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":["border-right-width","border-right-style","border-right-color"],"appliesto":"allElements","computed":["border-right-width","border-right-style","border-right-color"],"order":"orderOfAppearance","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-right"},"border-right-color":{"syntax":"<color>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-right-color"},"border-right-style":{"syntax":"<line-style>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-right-style"},"border-right-width":{"syntax":"<line-width>","media":"visual","inherited":false,"animationType":"length","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthOr0IfBorderRightStyleNoneOrHidden","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-right-width"},"border-spacing":{"syntax":"<length> <length>?","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Table"],"initial":"0","appliesto":"tableElements","computed":"twoAbsoluteLengths","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-spacing"},"border-start-end-radius":{"syntax":"<length-percentage>{1,2}","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["CSS Logical Properties"],"initial":"0","appliesto":"allElementsUAsNotRequiredWhenCollapse","computed":"twoAbsoluteLengthOrPercentages","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-start-end-radius"},"border-start-start-radius":{"syntax":"<length-percentage>{1,2}","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["CSS Logical Properties"],"initial":"0","appliesto":"allElementsUAsNotRequiredWhenCollapse","computed":"twoAbsoluteLengthOrPercentages","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-start-start-radius"},"border-style":{"syntax":"<line-style>{1,4}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":["border-top-style","border-right-style","border-bottom-style","border-left-style"],"appliesto":"allElements","computed":["border-bottom-style","border-left-style","border-right-style","border-top-style"],"order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-style"},"border-top":{"syntax":"<line-width> || <line-style> || <color>","media":"visual","inherited":false,"animationType":["border-top-color","border-top-style","border-top-width"],"percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":["border-top-width","border-top-style","border-top-color"],"appliesto":"allElements","computed":["border-top-width","border-top-style","border-top-color"],"order":"orderOfAppearance","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-top"},"border-top-color":{"syntax":"<color>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-top-color"},"border-top-left-radius":{"syntax":"<length-percentage>{1,2}","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["CSS Backgrounds and Borders"],"initial":"0","appliesto":"allElementsUAsNotRequiredWhenCollapse","computed":"twoAbsoluteLengthOrPercentages","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius"},"border-top-right-radius":{"syntax":"<length-percentage>{1,2}","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfBorderBox","groups":["CSS Backgrounds and Borders"],"initial":"0","appliesto":"allElementsUAsNotRequiredWhenCollapse","computed":"twoAbsoluteLengthOrPercentages","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius"},"border-top-style":{"syntax":"<line-style>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-top-style"},"border-top-width":{"syntax":"<line-width>","media":"visual","inherited":false,"animationType":"length","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"medium","appliesto":"allElements","computed":"absoluteLengthOr0IfBorderTopStyleNoneOrHidden","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-top-width"},"border-width":{"syntax":"<line-width>{1,4}","media":"visual","inherited":false,"animationType":["border-bottom-width","border-left-width","border-right-width","border-top-width"],"percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":["border-top-width","border-right-width","border-bottom-width","border-left-width"],"appliesto":"allElements","computed":["border-bottom-width","border-left-width","border-right-width","border-top-width"],"order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/border-width"},"bottom":{"syntax":"<length> | <percentage> | auto","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToContainingBlockHeight","groups":["CSS Positioning"],"initial":"auto","appliesto":"positionedElements","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/bottom"},"box-align":{"syntax":"start | center | end | baseline | stretch","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions","WebKit Extensions"],"initial":"stretch","appliesto":"elementsWithDisplayBoxOrInlineBox","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-align"},"box-decoration-break":{"syntax":"slice | clone","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Fragmentation"],"initial":"slice","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-decoration-break"},"box-direction":{"syntax":"normal | reverse | inherit","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions","WebKit Extensions"],"initial":"normal","appliesto":"elementsWithDisplayBoxOrInlineBox","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-direction"},"box-flex":{"syntax":"<number>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions","WebKit Extensions"],"initial":"0","appliesto":"directChildrenOfElementsWithDisplayMozBoxMozInlineBox","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-flex"},"box-flex-group":{"syntax":"<integer>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions","WebKit Extensions"],"initial":"1","appliesto":"inFlowChildrenOfBoxElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-flex-group"},"box-lines":{"syntax":"single | multiple","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions","WebKit Extensions"],"initial":"single","appliesto":"boxElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-lines"},"box-ordinal-group":{"syntax":"<integer>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions","WebKit Extensions"],"initial":"1","appliesto":"childrenOfBoxElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-ordinal-group"},"box-orient":{"syntax":"horizontal | vertical | inline-axis | block-axis | inherit","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions","WebKit Extensions"],"initial":"inlineAxisHorizontalInXUL","appliesto":"elementsWithDisplayBoxOrInlineBox","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-orient"},"box-pack":{"syntax":"start | center | end | justify","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions","WebKit Extensions"],"initial":"start","appliesto":"elementsWithDisplayMozBoxMozInlineBox","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-pack"},"box-shadow":{"syntax":"none | <shadow>#","media":"visual","inherited":false,"animationType":"shadowList","percentages":"no","groups":["CSS Backgrounds and Borders"],"initial":"none","appliesto":"allElements","computed":"absoluteLengthsSpecifiedColorAsSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-shadow"},"box-sizing":{"syntax":"content-box | border-box","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Basic User Interface"],"initial":"content-box","appliesto":"allElementsAcceptingWidthOrHeight","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/box-sizing"},"break-after":{"syntax":"auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Fragmentation"],"initial":"auto","appliesto":"blockLevelElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/break-after"},"break-before":{"syntax":"auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Fragmentation"],"initial":"auto","appliesto":"blockLevelElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/break-before"},"break-inside":{"syntax":"auto | avoid | avoid-page | avoid-column | avoid-region","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Fragmentation"],"initial":"auto","appliesto":"blockLevelElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/break-inside"},"caption-side":{"syntax":"top | bottom | block-start | block-end | inline-start | inline-end","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Table"],"initial":"top","appliesto":"tableCaptionElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/caption-side"},"caret-color":{"syntax":"auto | <color>","media":"interactive","inherited":true,"animationType":"color","percentages":"no","groups":["CSS Basic User Interface"],"initial":"auto","appliesto":"allElements","computed":"asAutoOrColor","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/caret-color"},"clear":{"syntax":"none | left | right | both | inline-start | inline-end","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Positioning"],"initial":"none","appliesto":"blockLevelElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/clear"},"clip":{"syntax":"<shape> | auto","media":"visual","inherited":false,"animationType":"rectangle","percentages":"no","groups":["CSS Masking"],"initial":"auto","appliesto":"absolutelyPositionedElements","computed":"autoOrRectangle","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/clip"},"clip-path":{"syntax":"<clip-source> | [ <basic-shape> || <geometry-box> ] | none","media":"visual","inherited":false,"animationType":"basicShapeOtherwiseNo","percentages":"referToReferenceBoxWhenSpecifiedOtherwiseBorderBox","groups":["CSS Masking"],"initial":"none","appliesto":"allElementsSVGContainerElements","computed":"asSpecifiedURLsAbsolute","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/clip-path"},"color":{"syntax":"<color>","media":"visual","inherited":true,"animationType":"color","percentages":"no","groups":["CSS Color"],"initial":"variesFromBrowserToBrowser","appliesto":"allElements","computed":"translucentValuesRGBAOtherwiseRGB","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/color"},"color-adjust":{"syntax":"economy | exact","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Color"],"initial":"economy","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/color-adjust"},"column-count":{"syntax":"<integer> | auto","media":"visual","inherited":false,"animationType":"integer","percentages":"no","groups":["CSS Columns"],"initial":"auto","appliesto":"blockContainersExceptTableWrappers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/column-count"},"column-fill":{"syntax":"auto | balance | balance-all","media":"visualInContinuousMediaNoEffectInOverflowColumns","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Columns"],"initial":"balance","appliesto":"multicolElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/column-fill"},"column-gap":{"syntax":"normal | <length-percentage>","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfContentArea","groups":["CSS Box Alignment"],"initial":"normal","appliesto":"multiColumnElementsFlexContainersGridContainers","computed":"asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/column-gap"},"column-rule":{"syntax":"<\'column-rule-width\'> || <\'column-rule-style\'> || <\'column-rule-color\'>","media":"visual","inherited":false,"animationType":["column-rule-color","column-rule-style","column-rule-width"],"percentages":"no","groups":["CSS Columns"],"initial":["column-rule-width","column-rule-style","column-rule-color"],"appliesto":"multicolElements","computed":["column-rule-color","column-rule-style","column-rule-width"],"order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/column-rule"},"column-rule-color":{"syntax":"<color>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Columns"],"initial":"currentcolor","appliesto":"multicolElements","computed":"computedColor","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/column-rule-color"},"column-rule-style":{"syntax":"<\'border-style\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Columns"],"initial":"none","appliesto":"multicolElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/column-rule-style"},"column-rule-width":{"syntax":"<\'border-width\'>","media":"visual","inherited":false,"animationType":"length","percentages":"no","groups":["CSS Columns"],"initial":"medium","appliesto":"multicolElements","computed":"absoluteLength0IfColumnRuleStyleNoneOrHidden","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/column-rule-width"},"column-span":{"syntax":"none | all","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Columns"],"initial":"none","appliesto":"inFlowBlockLevelElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/column-span"},"column-width":{"syntax":"<length> | auto","media":"visual","inherited":false,"animationType":"length","percentages":"no","groups":["CSS Columns"],"initial":"auto","appliesto":"blockContainersExceptTableWrappers","computed":"absoluteLengthZeroOrLarger","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/column-width"},"columns":{"syntax":"<\'column-width\'> || <\'column-count\'>","media":"visual","inherited":false,"animationType":["column-width","column-count"],"percentages":"no","groups":["CSS Columns"],"initial":["column-width","column-count"],"appliesto":"blockContainersExceptTableWrappers","computed":["column-width","column-count"],"order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/columns"},"contain":{"syntax":"none | strict | content | [ size || layout || style || paint ]","media":"all","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Containment"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/contain"},"content":{"syntax":"normal | none | [ <content-replacement> | <content-list> ] [/ <string> ]?","media":"all","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Generated Content"],"initial":"normal","appliesto":"beforeAndAfterPseudos","computed":"normalOnElementsForPseudosNoneAbsoluteURIStringOrAsSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/content"},"counter-increment":{"syntax":"[ <custom-ident> <integer>? ]+ | none","media":"all","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Counter Styles"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/counter-increment"},"counter-reset":{"syntax":"[ <custom-ident> <integer>? ]+ | none","media":"all","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Counter Styles"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/counter-reset"},"counter-set":{"syntax":"[ <custom-ident> <integer>? ]+ | none","media":"all","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Counter Styles"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/counter-set"},"cursor":{"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 ] ]","media":["visual","interactive"],"inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Basic User Interface"],"initial":"auto","appliesto":"allElements","computed":"asSpecifiedURLsAbsolute","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/cursor"},"direction":{"syntax":"ltr | rtl","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Writing Modes"],"initial":"ltr","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/direction"},"display":{"syntax":"[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>","media":"all","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Display"],"initial":"inline","appliesto":"allElements","computed":"asSpecifiedExceptPositionedFloatingAndRootElementsKeywordMaybeDifferent","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/display"},"empty-cells":{"syntax":"show | hide","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Table"],"initial":"show","appliesto":"tableCellElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/empty-cells"},"filter":{"syntax":"none | <filter-function-list>","media":"visual","inherited":false,"animationType":"filterList","percentages":"no","groups":["Filter Effects"],"initial":"none","appliesto":"allElementsSVGContainerElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/filter"},"flex":{"syntax":"none | [ <\'flex-grow\'> <\'flex-shrink\'>? || <\'flex-basis\'> ]","media":"visual","inherited":false,"animationType":["flex-grow","flex-shrink","flex-basis"],"percentages":"no","groups":["CSS Flexible Box Layout"],"initial":["flex-grow","flex-shrink","flex-basis"],"appliesto":"flexItemsAndInFlowPseudos","computed":["flex-grow","flex-shrink","flex-basis"],"order":"orderOfAppearance","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/flex"},"flex-basis":{"syntax":"content | <\'width\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToFlexContainersInnerMainSize","groups":["CSS Flexible Box Layout"],"initial":"auto","appliesto":"flexItemsAndInFlowPseudos","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"lengthOrPercentageBeforeKeywordIfBothPresent","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/flex-basis"},"flex-direction":{"syntax":"row | row-reverse | column | column-reverse","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Flexible Box Layout"],"initial":"row","appliesto":"flexContainers","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/flex-direction"},"flex-flow":{"syntax":"<\'flex-direction\'> || <\'flex-wrap\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Flexible Box Layout"],"initial":["flex-direction","flex-wrap"],"appliesto":"flexContainers","computed":["flex-direction","flex-wrap"],"order":"orderOfAppearance","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/flex-flow"},"flex-grow":{"syntax":"<number>","media":"visual","inherited":false,"animationType":"number","percentages":"no","groups":["CSS Flexible Box Layout"],"initial":"0","appliesto":"flexItemsAndInFlowPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/flex-grow"},"flex-shrink":{"syntax":"<number>","media":"visual","inherited":false,"animationType":"number","percentages":"no","groups":["CSS Flexible Box Layout"],"initial":"1","appliesto":"flexItemsAndInFlowPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/flex-shrink"},"flex-wrap":{"syntax":"nowrap | wrap | wrap-reverse","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Flexible Box Layout"],"initial":"nowrap","appliesto":"flexContainers","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/flex-wrap"},"float":{"syntax":"left | right | none | inline-start | inline-end","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Positioning"],"initial":"none","appliesto":"allElementsNoEffectIfDisplayNone","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/float"},"font":{"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","media":"visual","inherited":true,"animationType":["font-style","font-variant","font-weight","font-stretch","font-size","line-height","font-family"],"percentages":["font-size","line-height"],"groups":["CSS Fonts"],"initial":["font-style","font-variant","font-weight","font-stretch","font-size","line-height","font-family"],"appliesto":"allElements","computed":["font-style","font-variant","font-weight","font-stretch","font-size","line-height","font-family"],"order":"orderOfAppearance","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font"},"font-family":{"syntax":"[ <family-name> | <generic-family> ]#","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"dependsOnUserAgent","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-family"},"font-feature-settings":{"syntax":"normal | <feature-tag-value>#","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-feature-settings"},"font-kerning":{"syntax":"auto | normal | none","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-kerning"},"font-language-override":{"syntax":"normal | <string>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-language-override"},"font-optical-sizing":{"syntax":"auto | none","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-optical-sizing"},"font-variation-settings":{"syntax":"normal | [ <string> <number> ]#","media":"visual","inherited":true,"animationType":"transform","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-variation-settings"},"font-size":{"syntax":"<absolute-size> | <relative-size> | <length-percentage>","media":"visual","inherited":true,"animationType":"length","percentages":"referToParentElementsFontSize","groups":["CSS Fonts"],"initial":"medium","appliesto":"allElements","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-size"},"font-size-adjust":{"syntax":"none | <number>","media":"visual","inherited":true,"animationType":"number","percentages":"no","groups":["CSS Fonts"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-size-adjust"},"font-smooth":{"syntax":"auto | never | always | <absolute-size> | <length>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-smooth"},"font-stretch":{"syntax":"<font-stretch-absolute>","media":"visual","inherited":true,"animationType":"fontStretch","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-stretch"},"font-style":{"syntax":"normal | italic | oblique <angle>?","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-style"},"font-synthesis":{"syntax":"none | [ weight || style ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"weight style","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-synthesis"},"font-variant":{"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 ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-variant"},"font-variant-alternates":{"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> ) ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-variant-alternates"},"font-variant-caps":{"syntax":"normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-variant-caps"},"font-variant-east-asian":{"syntax":"normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-variant-east-asian"},"font-variant-ligatures":{"syntax":"normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-variant-ligatures"},"font-variant-numeric":{"syntax":"normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-variant-numeric"},"font-variant-position":{"syntax":"normal | sub | super","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-variant-position"},"font-weight":{"syntax":"<font-weight-absolute> | bolder | lighter","media":"visual","inherited":true,"animationType":"fontWeight","percentages":"no","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"keywordOrNumericalValueBolderLighterTransformedToRealValue","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/font-weight"},"gap":{"syntax":"<\'row-gap\'> <\'column-gap\'>?","media":"visual","inherited":false,"animationType":["row-gap","column-gap"],"percentages":"no","groups":["CSS Box Alignment"],"initial":["row-gap","column-gap"],"appliesto":"multiColumnElementsFlexContainersGridContainers","computed":["row-gap","column-gap"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/gap"},"grid":{"syntax":"<\'grid-template\'> | <\'grid-template-rows\'> / [ auto-flow && dense? ] <\'grid-auto-columns\'>? | [ auto-flow && dense? ] <\'grid-auto-rows\'>? / <\'grid-template-columns\'>","media":"visual","inherited":false,"animationType":"discrete","percentages":["grid-template-rows","grid-template-columns","grid-auto-rows","grid-auto-columns"],"groups":["CSS Grid Layout"],"initial":["grid-template-rows","grid-template-columns","grid-template-areas","grid-auto-rows","grid-auto-columns","grid-auto-flow","grid-column-gap","grid-row-gap","column-gap","row-gap"],"appliesto":"gridContainers","computed":["grid-template-rows","grid-template-columns","grid-template-areas","grid-auto-rows","grid-auto-columns","grid-auto-flow","grid-column-gap","grid-row-gap","column-gap","row-gap"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid"},"grid-area":{"syntax":"<grid-line> [ / <grid-line> ]{0,3}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":["grid-row-start","grid-column-start","grid-row-end","grid-column-end"],"appliesto":"gridItemsAndBoxesWithinGridContainer","computed":["grid-row-start","grid-column-start","grid-row-end","grid-column-end"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-area"},"grid-auto-columns":{"syntax":"<track-size>+","media":"visual","inherited":false,"animationType":"discrete","percentages":"referToDimensionOfContentArea","groups":["CSS Grid Layout"],"initial":"auto","appliesto":"gridContainers","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-auto-columns"},"grid-auto-flow":{"syntax":"[ row | column ] || dense","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":"row","appliesto":"gridContainers","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-auto-flow"},"grid-auto-rows":{"syntax":"<track-size>+","media":"visual","inherited":false,"animationType":"discrete","percentages":"referToDimensionOfContentArea","groups":["CSS Grid Layout"],"initial":"auto","appliesto":"gridContainers","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-auto-rows"},"grid-column":{"syntax":"<grid-line> [ / <grid-line> ]?","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":["grid-column-start","grid-column-end"],"appliesto":"gridItemsAndBoxesWithinGridContainer","computed":["grid-column-start","grid-column-end"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-column"},"grid-column-end":{"syntax":"<grid-line>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":"auto","appliesto":"gridItemsAndBoxesWithinGridContainer","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-column-end"},"grid-column-gap":{"syntax":"<length-percentage>","media":"visual","inherited":false,"animationType":"length","percentages":"referToDimensionOfContentArea","groups":["CSS Grid Layout"],"initial":"0","appliesto":"gridContainers","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/column-gap"},"grid-column-start":{"syntax":"<grid-line>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":"auto","appliesto":"gridItemsAndBoxesWithinGridContainer","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-column-start"},"grid-gap":{"syntax":"<\'grid-row-gap\'> <\'grid-column-gap\'>?","media":"visual","inherited":false,"animationType":["grid-row-gap","grid-column-gap"],"percentages":"no","groups":["CSS Grid Layout"],"initial":["grid-row-gap","grid-column-gap"],"appliesto":"gridContainers","computed":["grid-row-gap","grid-column-gap"],"order":"uniqueOrder","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/gap"},"grid-row":{"syntax":"<grid-line> [ / <grid-line> ]?","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":["grid-row-start","grid-row-end"],"appliesto":"gridItemsAndBoxesWithinGridContainer","computed":["grid-row-start","grid-row-end"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-row"},"grid-row-end":{"syntax":"<grid-line>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":"auto","appliesto":"gridItemsAndBoxesWithinGridContainer","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-row-end"},"grid-row-gap":{"syntax":"<length-percentage>","media":"visual","inherited":false,"animationType":"length","percentages":"referToDimensionOfContentArea","groups":["CSS Grid Layout"],"initial":"0","appliesto":"gridContainers","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/row-gap"},"grid-row-start":{"syntax":"<grid-line>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":"auto","appliesto":"gridItemsAndBoxesWithinGridContainer","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-row-start"},"grid-template":{"syntax":"none | [ <\'grid-template-rows\'> / <\'grid-template-columns\'> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?","media":"visual","inherited":false,"animationType":"discrete","percentages":["grid-template-columns","grid-template-rows"],"groups":["CSS Grid Layout"],"initial":["grid-template-columns","grid-template-rows","grid-template-areas"],"appliesto":"gridContainers","computed":["grid-template-columns","grid-template-rows","grid-template-areas"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-template"},"grid-template-areas":{"syntax":"none | <string>+","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":"none","appliesto":"gridContainers","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-template-areas"},"grid-template-columns":{"syntax":"none | <track-list> | <auto-track-list> | subgrid <line-name-list>?","media":"visual","inherited":false,"animationType":"simpleListOfLpcDifferenceLpc","percentages":"referToDimensionOfContentArea","groups":["CSS Grid Layout"],"initial":"none","appliesto":"gridContainers","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-template-columns"},"grid-template-rows":{"syntax":"none | <track-list> | <auto-track-list> | subgrid <line-name-list>?","media":"visual","inherited":false,"animationType":"simpleListOfLpcDifferenceLpc","percentages":"referToDimensionOfContentArea","groups":["CSS Grid Layout"],"initial":"none","appliesto":"gridContainers","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/grid-template-rows"},"hanging-punctuation":{"syntax":"none | [ first || [ force-end | allow-end ] || last ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/hanging-punctuation"},"height":{"syntax":"auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)","media":"visual","inherited":false,"animationType":"lpc","percentages":"regardingHeightOfGeneratedBoxContainingBlockPercentagesRelativeToContainingBlock","groups":["CSS Box Model"],"initial":"auto","appliesto":"allElementsButNonReplacedAndTableColumns","computed":"percentageAutoOrAbsoluteLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/height"},"hyphens":{"syntax":"none | manual | auto","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"manual","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/hyphens"},"image-orientation":{"syntax":"from-image | <angle> | [ <angle>? flip ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Images"],"initial":"from-image","appliesto":"allElements","computed":"angleRoundedToNextQuarter","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/image-orientation"},"image-rendering":{"syntax":"auto | crisp-edges | pixelated","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Images"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/image-rendering"},"image-resolution":{"syntax":"[ from-image || <resolution> ] && snap?","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Images"],"initial":"1dppx","appliesto":"allElements","computed":"asSpecifiedWithExceptionOfResolution","order":"uniqueOrder","status":"experimental"},"ime-mode":{"syntax":"auto | normal | active | inactive | disabled","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Basic User Interface"],"initial":"auto","appliesto":"textFields","computed":"asSpecified","order":"uniqueOrder","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/ime-mode"},"initial-letter":{"syntax":"normal | [ <number> <integer>? ]","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Inline"],"initial":"normal","appliesto":"firstLetterPseudoElementsAndInlineLevelFirstChildren","computed":"asSpecified","order":"uniqueOrder","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/initial-letter"},"initial-letter-align":{"syntax":"[ auto | alphabetic | hanging | ideographic ]","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Inline"],"initial":"auto","appliesto":"firstLetterPseudoElementsAndInlineLevelFirstChildren","computed":"asSpecified","order":"uniqueOrder","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/initial-letter-align"},"inline-size":{"syntax":"<\'width\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"inlineSizeOfContainingBlock","groups":["CSS Logical Properties"],"initial":"auto","appliesto":"sameAsWidthAndHeight","computed":"sameAsWidthAndHeight","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/inline-size"},"inset":{"syntax":"<\'top\'>{1,4}","media":"visual","inherited":false,"animationType":"lpc","percentages":"logicalHeightOfContainingBlock","groups":["CSS Logical Properties"],"initial":"auto","appliesto":"positionedElements","computed":"sameAsBoxOffsets","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/inset"},"inset-block":{"syntax":"<\'top\'>{1,2}","media":"visual","inherited":false,"animationType":"lpc","percentages":"logicalHeightOfContainingBlock","groups":["CSS Logical Properties"],"initial":"auto","appliesto":"positionedElements","computed":"sameAsBoxOffsets","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/inset-block"},"inset-block-end":{"syntax":"<\'top\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"logicalHeightOfContainingBlock","groups":["CSS Logical Properties"],"initial":"auto","appliesto":"positionedElements","computed":"sameAsBoxOffsets","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/inset-block-end"},"inset-block-start":{"syntax":"<\'top\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"logicalHeightOfContainingBlock","groups":["CSS Logical Properties"],"initial":"auto","appliesto":"positionedElements","computed":"sameAsBoxOffsets","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/inset-block-start"},"inset-inline":{"syntax":"<\'top\'>{1,2}","media":"visual","inherited":false,"animationType":"lpc","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"auto","appliesto":"positionedElements","computed":"sameAsBoxOffsets","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/inset-inline"},"inset-inline-end":{"syntax":"<\'top\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"auto","appliesto":"positionedElements","computed":"sameAsBoxOffsets","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/inset-inline-end"},"inset-inline-start":{"syntax":"<\'top\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"auto","appliesto":"positionedElements","computed":"sameAsBoxOffsets","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/inset-inline-start"},"isolation":{"syntax":"auto | isolate","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Compositing and Blending"],"initial":"auto","appliesto":"allElementsSVGContainerGraphicsAndGraphicsReferencingElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/isolation"},"justify-content":{"syntax":"normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Alignment"],"initial":"normal","appliesto":"flexContainers","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/justify-content"},"justify-items":{"syntax":"normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | legacy | legacy && [ left | right | center ]","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Alignment"],"initial":"legacy","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/justify-items"},"justify-self":{"syntax":"auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ]","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Alignment"],"initial":"auto","appliesto":"blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/justify-self"},"justify-tracks":{"syntax":"[ normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ] ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":"normal","appliesto":"gridContainersWithMasonryLayoutInTheirInlineAxis","computed":"asSpecified","order":"uniqueOrder","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/justify-tracks"},"left":{"syntax":"<length> | <percentage> | auto","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToWidthOfContainingBlock","groups":["CSS Positioning"],"initial":"auto","appliesto":"positionedElements","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/left"},"letter-spacing":{"syntax":"normal | <length>","media":"visual","inherited":true,"animationType":"length","percentages":"no","groups":["CSS Text"],"initial":"normal","appliesto":"allElements","computed":"optimumValueOfAbsoluteLengthOrNormal","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/letter-spacing"},"line-break":{"syntax":"auto | loose | normal | strict | anywhere","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/line-break"},"line-clamp":{"syntax":"none | <integer>","media":"visual","inherited":false,"animationType":"integer","percentages":"no","groups":["CSS Overflow"],"initial":"none","appliesto":"blockContainersExceptMultiColumnContainers","computed":"asSpecified","order":"perGrammar","status":"experimental"},"line-height":{"syntax":"normal | <number> | <length> | <percentage>","media":"visual","inherited":true,"animationType":"numberOrLength","percentages":"referToElementFontSize","groups":["CSS Fonts"],"initial":"normal","appliesto":"allElements","computed":"absoluteLengthOrAsSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/line-height"},"line-height-step":{"syntax":"<length>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fonts"],"initial":"0","appliesto":"blockContainers","computed":"absoluteLength","order":"perGrammar","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/line-height-step"},"list-style":{"syntax":"<\'list-style-type\'> || <\'list-style-position\'> || <\'list-style-image\'>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Lists and Counters"],"initial":["list-style-type","list-style-position","list-style-image"],"appliesto":"listItems","computed":["list-style-image","list-style-position","list-style-type"],"order":"orderOfAppearance","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/list-style"},"list-style-image":{"syntax":"<url> | none","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Lists and Counters"],"initial":"none","appliesto":"listItems","computed":"noneOrImageWithAbsoluteURI","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/list-style-image"},"list-style-position":{"syntax":"inside | outside","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Lists and Counters"],"initial":"outside","appliesto":"listItems","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/list-style-position"},"list-style-type":{"syntax":"<counter-style> | <string> | none","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Lists and Counters"],"initial":"disc","appliesto":"listItems","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/list-style-type"},"margin":{"syntax":"[ <length> | <percentage> | auto ]{1,4}","media":"visual","inherited":false,"animationType":"length","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":["margin-bottom","margin-left","margin-right","margin-top"],"appliesto":"allElementsExceptTableDisplayTypes","computed":["margin-bottom","margin-left","margin-right","margin-top"],"order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin"},"margin-block":{"syntax":"<\'margin-left\'>{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"dependsOnLayoutModel","groups":["CSS Logical Properties"],"initial":"0","appliesto":"sameAsMargin","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-block"},"margin-block-end":{"syntax":"<\'margin-left\'>","media":"visual","inherited":false,"animationType":"length","percentages":"dependsOnLayoutModel","groups":["CSS Logical Properties"],"initial":"0","appliesto":"sameAsMargin","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-block-end"},"margin-block-start":{"syntax":"<\'margin-left\'>","media":"visual","inherited":false,"animationType":"length","percentages":"dependsOnLayoutModel","groups":["CSS Logical Properties"],"initial":"0","appliesto":"sameAsMargin","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-block-start"},"margin-bottom":{"syntax":"<length> | <percentage> | auto","media":"visual","inherited":false,"animationType":"length","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"0","appliesto":"allElementsExceptTableDisplayTypes","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-bottom"},"margin-inline":{"syntax":"<\'margin-left\'>{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"dependsOnLayoutModel","groups":["CSS Logical Properties"],"initial":"0","appliesto":"sameAsMargin","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-inline"},"margin-inline-end":{"syntax":"<\'margin-left\'>","media":"visual","inherited":false,"animationType":"length","percentages":"dependsOnLayoutModel","groups":["CSS Logical Properties"],"initial":"0","appliesto":"sameAsMargin","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-inline-end"},"margin-inline-start":{"syntax":"<\'margin-left\'>","media":"visual","inherited":false,"animationType":"length","percentages":"dependsOnLayoutModel","groups":["CSS Logical Properties"],"initial":"0","appliesto":"sameAsMargin","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-inline-start"},"margin-left":{"syntax":"<length> | <percentage> | auto","media":"visual","inherited":false,"animationType":"length","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"0","appliesto":"allElementsExceptTableDisplayTypes","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-left"},"margin-right":{"syntax":"<length> | <percentage> | auto","media":"visual","inherited":false,"animationType":"length","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"0","appliesto":"allElementsExceptTableDisplayTypes","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-right"},"margin-top":{"syntax":"<length> | <percentage> | auto","media":"visual","inherited":false,"animationType":"length","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"0","appliesto":"allElementsExceptTableDisplayTypes","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-top"},"margin-trim":{"syntax":"none | in-flow | all","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Model"],"initial":"none","appliesto":"blockContainersAndMultiColumnContainers","computed":"asSpecified","order":"perGrammar","alsoAppliesTo":["::first-letter","::first-line"],"status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/margin-trim"},"mask":{"syntax":"<mask-layer>#","media":"visual","inherited":false,"animationType":["mask-image","mask-mode","mask-repeat","mask-position","mask-clip","mask-origin","mask-size","mask-composite"],"percentages":["mask-position"],"groups":["CSS Masking"],"initial":["mask-image","mask-mode","mask-repeat","mask-position","mask-clip","mask-origin","mask-size","mask-composite"],"appliesto":"allElementsSVGContainerElements","computed":["mask-image","mask-mode","mask-repeat","mask-position","mask-clip","mask-origin","mask-size","mask-composite"],"order":"perGrammar","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask"},"mask-border":{"syntax":"<\'mask-border-source\'> || <\'mask-border-slice\'> [ / <\'mask-border-width\'>? [ / <\'mask-border-outset\'> ]? ]? || <\'mask-border-repeat\'> || <\'mask-border-mode\'>","media":"visual","inherited":false,"animationType":["mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width"],"percentages":["mask-border-slice","mask-border-width"],"groups":["CSS Masking"],"initial":["mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width"],"appliesto":"allElementsSVGContainerElements","computed":["mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width"],"order":"perGrammar","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-border"},"mask-border-mode":{"syntax":"luminance | alpha","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"alpha","appliesto":"allElementsSVGContainerElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-border-mode"},"mask-border-outset":{"syntax":"[ <length> | <number> ]{1,4}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"0","appliesto":"allElementsSVGContainerElements","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-border-outset"},"mask-border-repeat":{"syntax":"[ stretch | repeat | round | space ]{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"stretch","appliesto":"allElementsSVGContainerElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-border-repeat"},"mask-border-slice":{"syntax":"<number-percentage>{1,4} fill?","media":"visual","inherited":false,"animationType":"discrete","percentages":"referToSizeOfMaskBorderImage","groups":["CSS Masking"],"initial":"0","appliesto":"allElementsSVGContainerElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-border-slice"},"mask-border-source":{"syntax":"none | <image>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"none","appliesto":"allElementsSVGContainerElements","computed":"asSpecifiedURLsAbsolute","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-border-source"},"mask-border-width":{"syntax":"[ <length-percentage> | <number> | auto ]{1,4}","media":"visual","inherited":false,"animationType":"discrete","percentages":"relativeToMaskBorderImageArea","groups":["CSS Masking"],"initial":"auto","appliesto":"allElementsSVGContainerElements","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-border-width"},"mask-clip":{"syntax":"[ <geometry-box> | no-clip ]#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"border-box","appliesto":"allElementsSVGContainerElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-clip"},"mask-composite":{"syntax":"<compositing-operator>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"add","appliesto":"allElementsSVGContainerElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-composite"},"mask-image":{"syntax":"<mask-reference>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"none","appliesto":"allElementsSVGContainerElements","computed":"asSpecifiedURLsAbsolute","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-image"},"mask-mode":{"syntax":"<masking-mode>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"match-source","appliesto":"allElementsSVGContainerElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-mode"},"mask-origin":{"syntax":"<geometry-box>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"border-box","appliesto":"allElementsSVGContainerElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-origin"},"mask-position":{"syntax":"<position>#","media":"visual","inherited":false,"animationType":"repeatableListOfSimpleListOfLpc","percentages":"referToSizeOfMaskPaintingArea","groups":["CSS Masking"],"initial":"center","appliesto":"allElementsSVGContainerElements","computed":"consistsOfTwoKeywordsForOriginAndOffsets","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-position"},"mask-repeat":{"syntax":"<repeat-style>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"no-repeat","appliesto":"allElementsSVGContainerElements","computed":"consistsOfTwoDimensionKeywords","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-repeat"},"mask-size":{"syntax":"<bg-size>#","media":"visual","inherited":false,"animationType":"repeatableListOfSimpleListOfLpc","percentages":"no","groups":["CSS Masking"],"initial":"auto","appliesto":"allElementsSVGContainerElements","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-size"},"mask-type":{"syntax":"luminance | alpha","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Masking"],"initial":"luminance","appliesto":"maskElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mask-type"},"masonry-auto-flow":{"syntax":"[ pack | next ] || [ definite-first | ordered ]","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Grid Layout"],"initial":"pack","appliesto":"gridContainersWithMasonryLayout","computed":"asSpecified","order":"uniqueOrder","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/masonry-auto-flow"},"math-style":{"syntax":"normal | compact","media":"visual","inherited":true,"animationType":"notAnimatable","percentages":"no","groups":["MathML"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/math-style"},"max-block-size":{"syntax":"<\'max-width\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"blockSizeOfContainingBlock","groups":["CSS Logical Properties"],"initial":"0","appliesto":"sameAsWidthAndHeight","computed":"sameAsMaxWidthAndMaxHeight","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/max-block-size"},"max-height":{"syntax":"none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>)","media":"visual","inherited":false,"animationType":"lpc","percentages":"regardingHeightOfGeneratedBoxContainingBlockPercentagesNone","groups":["CSS Box Model"],"initial":"none","appliesto":"allElementsButNonReplacedAndTableColumns","computed":"percentageAsSpecifiedAbsoluteLengthOrNone","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/max-height"},"max-inline-size":{"syntax":"<\'max-width\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"inlineSizeOfContainingBlock","groups":["CSS Logical Properties"],"initial":"0","appliesto":"sameAsWidthAndHeight","computed":"sameAsMaxWidthAndMaxHeight","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/max-inline-size"},"max-lines":{"syntax":"none | <integer>","media":"visual","inherited":false,"animationType":"integer","percentages":"no","groups":["CSS Overflow"],"initial":"none","appliesto":"blockContainersExceptMultiColumnContainers","computed":"asSpecified","order":"perGrammar","status":"experimental"},"max-width":{"syntax":"none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>)","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"none","appliesto":"allElementsButNonReplacedAndTableRows","computed":"percentageAsSpecifiedAbsoluteLengthOrNone","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/max-width"},"min-block-size":{"syntax":"<\'min-width\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"blockSizeOfContainingBlock","groups":["CSS Logical Properties"],"initial":"0","appliesto":"sameAsWidthAndHeight","computed":"sameAsMinWidthAndMinHeight","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/min-block-size"},"min-height":{"syntax":"auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)","media":"visual","inherited":false,"animationType":"lpc","percentages":"regardingHeightOfGeneratedBoxContainingBlockPercentages0","groups":["CSS Box Model"],"initial":"auto","appliesto":"allElementsButNonReplacedAndTableColumns","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/min-height"},"min-inline-size":{"syntax":"<\'min-width\'>","media":"visual","inherited":false,"animationType":"lpc","percentages":"inlineSizeOfContainingBlock","groups":["CSS Logical Properties"],"initial":"0","appliesto":"sameAsWidthAndHeight","computed":"sameAsMinWidthAndMinHeight","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/min-inline-size"},"min-width":{"syntax":"auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"auto","appliesto":"allElementsButNonReplacedAndTableRows","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/min-width"},"mix-blend-mode":{"syntax":"<blend-mode>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Compositing and Blending"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/mix-blend-mode"},"object-fit":{"syntax":"fill | contain | cover | none | scale-down","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Images"],"initial":"fill","appliesto":"replacedElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/object-fit"},"object-position":{"syntax":"<position>","media":"visual","inherited":true,"animationType":"repeatableListOfSimpleListOfLpc","percentages":"referToWidthAndHeightOfElement","groups":["CSS Images"],"initial":"50% 50%","appliesto":"replacedElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/object-position"},"offset":{"syntax":"[ <\'offset-position\'>? [ <\'offset-path\'> [ <\'offset-distance\'> || <\'offset-rotate\'> ]? ]? ]! [ / <\'offset-anchor\'> ]?","media":"visual","inherited":false,"animationType":["offset-position","offset-path","offset-distance","offset-anchor","offset-rotate"],"percentages":["offset-position","offset-distance","offset-anchor"],"groups":["CSS Motion Path"],"initial":["offset-position","offset-path","offset-distance","offset-anchor","offset-rotate"],"appliesto":"transformableElements","computed":["offset-position","offset-path","offset-distance","offset-anchor","offset-rotate"],"order":"perGrammar","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/offset"},"offset-anchor":{"syntax":"auto | <position>","media":"visual","inherited":false,"animationType":"position","percentages":"relativeToWidthAndHeight","groups":["CSS Motion Path"],"initial":"auto","appliesto":"transformableElements","computed":"forLengthAbsoluteValueOtherwisePercentage","order":"perGrammar","status":"standard"},"offset-distance":{"syntax":"<length-percentage>","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToTotalPathLength","groups":["CSS Motion Path"],"initial":"0","appliesto":"transformableElements","computed":"forLengthAbsoluteValueOtherwisePercentage","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/offset-distance"},"offset-path":{"syntax":"none | ray( [ <angle> && <size> && contain? ] ) | <path()> | <url> | [ <basic-shape> || <geometry-box> ]","media":"visual","inherited":false,"animationType":"angleOrBasicShapeOrPath","percentages":"no","groups":["CSS Motion Path"],"initial":"none","appliesto":"transformableElements","computed":"asSpecified","order":"perGrammar","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/offset-path"},"offset-position":{"syntax":"auto | <position>","media":"visual","inherited":false,"animationType":"position","percentages":"referToSizeOfContainingBlock","groups":["CSS Motion Path"],"initial":"auto","appliesto":"transformableElements","computed":"forLengthAbsoluteValueOtherwisePercentage","order":"perGrammar","status":"experimental"},"offset-rotate":{"syntax":"[ auto | reverse ] || <angle>","media":"visual","inherited":false,"animationType":"angleOrBasicShapeOrPath","percentages":"no","groups":["CSS Motion Path"],"initial":"auto","appliesto":"transformableElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/offset-rotate"},"opacity":{"syntax":"<alpha-value>","media":"visual","inherited":false,"animationType":"number","percentages":"no","groups":["CSS Color"],"initial":"1.0","appliesto":"allElements","computed":"specifiedValueClipped0To1","order":"uniqueOrder","alsoAppliesTo":["::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/opacity"},"order":{"syntax":"<integer>","media":"visual","inherited":false,"animationType":"integer","percentages":"no","groups":["CSS Flexible Box Layout"],"initial":"0","appliesto":"flexItemsGridItemsAbsolutelyPositionedContainerChildren","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/order"},"orphans":{"syntax":"<integer>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fragmentation"],"initial":"2","appliesto":"blockContainerElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/orphans"},"outline":{"syntax":"[ <\'outline-color\'> || <\'outline-style\'> || <\'outline-width\'> ]","media":["visual","interactive"],"inherited":false,"animationType":["outline-color","outline-width","outline-style"],"percentages":"no","groups":["CSS Basic User Interface"],"initial":["outline-color","outline-style","outline-width"],"appliesto":"allElements","computed":["outline-color","outline-width","outline-style"],"order":"orderOfAppearance","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/outline"},"outline-color":{"syntax":"<color> | invert","media":["visual","interactive"],"inherited":false,"animationType":"color","percentages":"no","groups":["CSS Basic User Interface"],"initial":"invertOrCurrentColor","appliesto":"allElements","computed":"invertForTranslucentColorRGBAOtherwiseRGB","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/outline-color"},"outline-offset":{"syntax":"<length>","media":["visual","interactive"],"inherited":false,"animationType":"length","percentages":"no","groups":["CSS Basic User Interface"],"initial":"0","appliesto":"allElements","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/outline-offset"},"outline-style":{"syntax":"auto | <\'border-style\'>","media":["visual","interactive"],"inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Basic User Interface"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/outline-style"},"outline-width":{"syntax":"<line-width>","media":["visual","interactive"],"inherited":false,"animationType":"length","percentages":"no","groups":["CSS Basic User Interface"],"initial":"medium","appliesto":"allElements","computed":"absoluteLength0ForNone","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/outline-width"},"overflow":{"syntax":"[ visible | hidden | clip | scroll | auto ]{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Overflow"],"initial":"visible","appliesto":"blockContainersFlexContainersGridContainers","computed":["overflow-x","overflow-y"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/overflow"},"overflow-anchor":{"syntax":"auto | none","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Scroll Anchoring"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard"},"overflow-block":{"syntax":"visible | hidden | clip | scroll | auto","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Overflow"],"initial":"auto","appliesto":"blockContainersFlexContainersGridContainers","computed":"asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent","order":"perGrammar","status":"standard"},"overflow-clip-box":{"syntax":"padding-box | content-box","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Mozilla Extensions"],"initial":"padding-box","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Mozilla/CSS/overflow-clip-box"},"overflow-inline":{"syntax":"visible | hidden | clip | scroll | auto","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Overflow"],"initial":"auto","appliesto":"blockContainersFlexContainersGridContainers","computed":"asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent","order":"perGrammar","status":"standard"},"overflow-wrap":{"syntax":"normal | break-word | anywhere","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"normal","appliesto":"nonReplacedInlineElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"},"overflow-x":{"syntax":"visible | hidden | clip | scroll | auto","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Overflow"],"initial":"visible","appliesto":"blockContainersFlexContainersGridContainers","computed":"asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/overflow-x"},"overflow-y":{"syntax":"visible | hidden | clip | scroll | auto","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Overflow"],"initial":"visible","appliesto":"blockContainersFlexContainersGridContainers","computed":"asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/overflow-y"},"overscroll-behavior":{"syntax":"[ contain | none | auto ]{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Model"],"initial":"auto","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior"},"overscroll-behavior-block":{"syntax":"contain | none | auto","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Model"],"initial":"auto","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-block"},"overscroll-behavior-inline":{"syntax":"contain | none | auto","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Model"],"initial":"auto","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-inline"},"overscroll-behavior-x":{"syntax":"contain | none | auto","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Model"],"initial":"auto","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-x"},"overscroll-behavior-y":{"syntax":"contain | none | auto","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Model"],"initial":"auto","appliesto":"nonReplacedBlockAndInlineBlockElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-y"},"padding":{"syntax":"[ <length> | <percentage> ]{1,4}","media":"visual","inherited":false,"animationType":"length","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":["padding-bottom","padding-left","padding-right","padding-top"],"appliesto":"allElementsExceptInternalTableDisplayTypes","computed":["padding-bottom","padding-left","padding-right","padding-top"],"order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding"},"padding-block":{"syntax":"<\'padding-left\'>{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"0","appliesto":"allElements","computed":"asLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding-block"},"padding-block-end":{"syntax":"<\'padding-left\'>","media":"visual","inherited":false,"animationType":"length","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"0","appliesto":"allElements","computed":"asLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding-block-end"},"padding-block-start":{"syntax":"<\'padding-left\'>","media":"visual","inherited":false,"animationType":"length","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"0","appliesto":"allElements","computed":"asLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding-block-start"},"padding-bottom":{"syntax":"<length> | <percentage>","media":"visual","inherited":false,"animationType":"length","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"0","appliesto":"allElementsExceptInternalTableDisplayTypes","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding-bottom"},"padding-inline":{"syntax":"<\'padding-left\'>{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"0","appliesto":"allElements","computed":"asLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding-inline"},"padding-inline-end":{"syntax":"<\'padding-left\'>","media":"visual","inherited":false,"animationType":"length","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"0","appliesto":"allElements","computed":"asLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding-inline-end"},"padding-inline-start":{"syntax":"<\'padding-left\'>","media":"visual","inherited":false,"animationType":"length","percentages":"logicalWidthOfContainingBlock","groups":["CSS Logical Properties"],"initial":"0","appliesto":"allElements","computed":"asLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding-inline-start"},"padding-left":{"syntax":"<length> | <percentage>","media":"visual","inherited":false,"animationType":"length","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"0","appliesto":"allElementsExceptInternalTableDisplayTypes","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding-left"},"padding-right":{"syntax":"<length> | <percentage>","media":"visual","inherited":false,"animationType":"length","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"0","appliesto":"allElementsExceptInternalTableDisplayTypes","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding-right"},"padding-top":{"syntax":"<length> | <percentage>","media":"visual","inherited":false,"animationType":"length","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"0","appliesto":"allElementsExceptInternalTableDisplayTypes","computed":"percentageAsSpecifiedOrAbsoluteLength","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/padding-top"},"page-break-after":{"syntax":"auto | always | avoid | left | right | recto | verso","media":["visual","paged"],"inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Pages"],"initial":"auto","appliesto":"blockElementsInNormalFlow","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/page-break-after"},"page-break-before":{"syntax":"auto | always | avoid | left | right | recto | verso","media":["visual","paged"],"inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Pages"],"initial":"auto","appliesto":"blockElementsInNormalFlow","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/page-break-before"},"page-break-inside":{"syntax":"auto | avoid","media":["visual","paged"],"inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Pages"],"initial":"auto","appliesto":"blockElementsInNormalFlow","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/page-break-inside"},"paint-order":{"syntax":"normal | [ fill || stroke || markers ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"normal","appliesto":"textElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/paint-order"},"perspective":{"syntax":"none | <length>","media":"visual","inherited":false,"animationType":"length","percentages":"no","groups":["CSS Transforms"],"initial":"none","appliesto":"transformableElements","computed":"absoluteLengthOrNone","order":"uniqueOrder","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/perspective"},"perspective-origin":{"syntax":"<position>","media":"visual","inherited":false,"animationType":"simpleListOfLpc","percentages":"referToSizeOfBoundingBox","groups":["CSS Transforms"],"initial":"50% 50%","appliesto":"transformableElements","computed":"forLengthAbsoluteValueOtherwisePercentage","order":"oneOrTwoValuesLengthAbsoluteKeywordsPercentages","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/perspective-origin"},"place-content":{"syntax":"<\'align-content\'> <\'justify-content\'>?","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Alignment"],"initial":"normal","appliesto":"multilineFlexContainers","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/place-content"},"place-items":{"syntax":"<\'align-items\'> <\'justify-items\'>?","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Alignment"],"initial":["align-items","justify-items"],"appliesto":"allElements","computed":["align-items","justify-items"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/place-items"},"place-self":{"syntax":"<\'align-self\'> <\'justify-self\'>?","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Box Alignment"],"initial":["align-self","justify-self"],"appliesto":"blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems","computed":["align-self","justify-self"],"order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/place-self"},"pointer-events":{"syntax":"auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["Pointer Events"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/pointer-events"},"position":{"syntax":"static | relative | absolute | sticky | fixed","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Positioning"],"initial":"static","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/position"},"quotes":{"syntax":"none | auto | [ <string> <string> ]+","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Generated Content"],"initial":"dependsOnUserAgent","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/quotes"},"resize":{"syntax":"none | both | horizontal | vertical | block | inline","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Basic User Interface"],"initial":"none","appliesto":"elementsWithOverflowNotVisibleAndReplacedElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/resize"},"right":{"syntax":"<length> | <percentage> | auto","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToWidthOfContainingBlock","groups":["CSS Positioning"],"initial":"auto","appliesto":"positionedElements","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/right"},"rotate":{"syntax":"none | <angle> | [ x | y | z | <number>{3} ] && <angle>","media":"visual","inherited":false,"animationType":"transform","percentages":"no","groups":["CSS Transforms"],"initial":"none","appliesto":"transformableElements","computed":"asSpecified","order":"perGrammar","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/rotate"},"row-gap":{"syntax":"normal | <length-percentage>","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToDimensionOfContentArea","groups":["CSS Box Alignment"],"initial":"normal","appliesto":"multiColumnElementsFlexContainersGridContainers","computed":"asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/row-gap"},"ruby-align":{"syntax":"start | center | space-between | space-around","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Ruby"],"initial":"space-around","appliesto":"rubyBasesAnnotationsBaseAnnotationContainers","computed":"asSpecified","order":"uniqueOrder","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/ruby-align"},"ruby-merge":{"syntax":"separate | collapse | auto","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Ruby"],"initial":"separate","appliesto":"rubyAnnotationsContainers","computed":"asSpecified","order":"uniqueOrder","status":"experimental"},"ruby-position":{"syntax":"over | under | inter-character","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Ruby"],"initial":"over","appliesto":"rubyAnnotationsContainers","computed":"asSpecified","order":"uniqueOrder","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/ruby-position"},"scale":{"syntax":"none | <number>{1,3}","media":"visual","inherited":false,"animationType":"transform","percentages":"no","groups":["CSS Transforms"],"initial":"none","appliesto":"transformableElements","computed":"asSpecified","order":"perGrammar","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scale"},"scrollbar-color":{"syntax":"auto | dark | light | <color>{2}","media":"visual","inherited":true,"animationType":"color","percentages":"no","groups":["CSS Scrollbars"],"initial":"auto","appliesto":"scrollingBoxes","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scrollbar-color"},"scrollbar-gutter":{"syntax":"auto | [ stable | always ] && both? && force?","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Overflow"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scrollbar-gutter"},"scrollbar-width":{"syntax":"auto | thin | none","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Scrollbars"],"initial":"auto","appliesto":"scrollingBoxes","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scrollbar-width"},"scroll-behavior":{"syntax":"auto | smooth","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSSOM View"],"initial":"auto","appliesto":"scrollingBoxes","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-behavior"},"scroll-margin":{"syntax":"<length>{1,4}","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin"},"scroll-margin-block":{"syntax":"<length>{1,2}","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block"},"scroll-margin-block-start":{"syntax":"<length>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-start"},"scroll-margin-block-end":{"syntax":"<length>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-end"},"scroll-margin-bottom":{"syntax":"<length>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin-bottom"},"scroll-margin-inline":{"syntax":"<length>{1,2}","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline"},"scroll-margin-inline-start":{"syntax":"<length>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-start"},"scroll-margin-inline-end":{"syntax":"<length>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-end"},"scroll-margin-left":{"syntax":"<length>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin-left"},"scroll-margin-right":{"syntax":"<length>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin-right"},"scroll-margin-top":{"syntax":"<length>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"no","groups":["CSS Scroll Snap"],"initial":"0","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-margin-top"},"scroll-padding":{"syntax":"[ auto | <length-percentage> ]{1,4}","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding"},"scroll-padding-block":{"syntax":"[ auto | <length-percentage> ]{1,2}","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block"},"scroll-padding-block-start":{"syntax":"auto | <length-percentage>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-start"},"scroll-padding-block-end":{"syntax":"auto | <length-percentage>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-end"},"scroll-padding-bottom":{"syntax":"auto | <length-percentage>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding-bottom"},"scroll-padding-inline":{"syntax":"[ auto | <length-percentage> ]{1,2}","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline"},"scroll-padding-inline-start":{"syntax":"auto | <length-percentage>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-start"},"scroll-padding-inline-end":{"syntax":"auto | <length-percentage>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-end"},"scroll-padding-left":{"syntax":"auto | <length-percentage>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding-left"},"scroll-padding-right":{"syntax":"auto | <length-percentage>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding-right"},"scroll-padding-top":{"syntax":"auto | <length-percentage>","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"relativeToTheScrollContainersScrollport","groups":["CSS Scroll Snap"],"initial":"auto","appliesto":"scrollContainers","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-padding-top"},"scroll-snap-align":{"syntax":"[ none | start | end | center ]{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Scroll Snap"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-snap-align"},"scroll-snap-coordinate":{"syntax":"none | <position>#","media":"interactive","inherited":false,"animationType":"position","percentages":"referToBorderBox","groups":["CSS Scroll Snap"],"initial":"none","appliesto":"allElements","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-snap-coordinate"},"scroll-snap-destination":{"syntax":"<position>","media":"interactive","inherited":false,"animationType":"position","percentages":"relativeToScrollContainerPaddingBoxAxis","groups":["CSS Scroll Snap"],"initial":"0px 0px","appliesto":"scrollContainers","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-snap-destination"},"scroll-snap-points-x":{"syntax":"none | repeat( <length-percentage> )","media":"interactive","inherited":false,"animationType":"discrete","percentages":"relativeToScrollContainerPaddingBoxAxis","groups":["CSS Scroll Snap"],"initial":"none","appliesto":"scrollContainers","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-x"},"scroll-snap-points-y":{"syntax":"none | repeat( <length-percentage> )","media":"interactive","inherited":false,"animationType":"discrete","percentages":"relativeToScrollContainerPaddingBoxAxis","groups":["CSS Scroll Snap"],"initial":"none","appliesto":"scrollContainers","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-snap-points-y"},"scroll-snap-stop":{"syntax":"normal | always","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Scroll Snap"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-snap-stop"},"scroll-snap-type":{"syntax":"none | [ x | y | block | inline | both ] [ mandatory | proximity ]?","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Scroll Snap"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type"},"scroll-snap-type-x":{"syntax":"none | mandatory | proximity","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Scroll Snap"],"initial":"none","appliesto":"scrollContainers","computed":"asSpecified","order":"uniqueOrder","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-x"},"scroll-snap-type-y":{"syntax":"none | mandatory | proximity","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Scroll Snap"],"initial":"none","appliesto":"scrollContainers","computed":"asSpecified","order":"uniqueOrder","status":"obsolete","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type-y"},"shape-image-threshold":{"syntax":"<alpha-value>","media":"visual","inherited":false,"animationType":"number","percentages":"no","groups":["CSS Shapes"],"initial":"0.0","appliesto":"floats","computed":"specifiedValueNumberClipped0To1","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/shape-image-threshold"},"shape-margin":{"syntax":"<length-percentage>","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToWidthOfContainingBlock","groups":["CSS Shapes"],"initial":"0","appliesto":"floats","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/shape-margin"},"shape-outside":{"syntax":"none | <shape-box> || <basic-shape> | <image>","media":"visual","inherited":false,"animationType":"basicShapeOtherwiseNo","percentages":"no","groups":["CSS Shapes"],"initial":"none","appliesto":"floats","computed":"asDefinedForBasicShapeWithAbsoluteURIOtherwiseAsSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/shape-outside"},"tab-size":{"syntax":"<integer> | <length>","media":"visual","inherited":true,"animationType":"length","percentages":"no","groups":["CSS Text"],"initial":"8","appliesto":"blockContainers","computed":"specifiedIntegerOrAbsoluteLength","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/tab-size"},"table-layout":{"syntax":"auto | fixed","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Table"],"initial":"auto","appliesto":"tableElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/table-layout"},"text-align":{"syntax":"start | end | left | right | center | justify | match-parent","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"startOrNamelessValueIfLTRRightIfRTL","appliesto":"blockContainers","computed":"asSpecifiedExceptMatchParent","order":"orderOfAppearance","alsoAppliesTo":["::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-align"},"text-align-last":{"syntax":"auto | start | end | left | right | center | justify","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"auto","appliesto":"blockContainers","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-align-last"},"text-combine-upright":{"syntax":"none | all | [ digits <integer>? ]","media":"visual","inherited":true,"animationType":"notAnimatable","percentages":"no","groups":["CSS Writing Modes"],"initial":"none","appliesto":"nonReplacedInlineElements","computed":"keywordPlusIntegerIfDigits","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-combine-upright"},"text-decoration":{"syntax":"<\'text-decoration-line\'> || <\'text-decoration-style\'> || <\'text-decoration-color\'> || <\'text-decoration-thickness\'>","media":"visual","inherited":false,"animationType":["text-decoration-color","text-decoration-style","text-decoration-line","text-decoration-thickness"],"percentages":"no","groups":["CSS Text Decoration"],"initial":["text-decoration-color","text-decoration-style","text-decoration-line"],"appliesto":"allElements","computed":["text-decoration-line","text-decoration-style","text-decoration-color","text-decoration-thickness"],"order":"orderOfAppearance","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-decoration"},"text-decoration-color":{"syntax":"<color>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Text Decoration"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-decoration-color"},"text-decoration-line":{"syntax":"none | [ underline || overline || line-through || blink ] | spelling-error | grammar-error","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Text Decoration"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-decoration-line"},"text-decoration-skip":{"syntax":"none | [ objects || [ spaces | [ leading-spaces || trailing-spaces ] ] || edges || box-decoration ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text Decoration"],"initial":"objects","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip"},"text-decoration-skip-ink":{"syntax":"auto | all | none","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text Decoration"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip-ink"},"text-decoration-style":{"syntax":"solid | double | dotted | dashed | wavy","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Text Decoration"],"initial":"solid","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-decoration-style"},"text-decoration-thickness":{"syntax":"auto | from-font | <length> | <percentage> ","media":"visual","inherited":false,"animationType":"byComputedValueType","percentages":"referToElementFontSize","groups":["CSS Text Decoration"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-decoration-thickness"},"text-emphasis":{"syntax":"<\'text-emphasis-style\'> || <\'text-emphasis-color\'>","media":"visual","inherited":false,"animationType":["text-emphasis-color","text-emphasis-style"],"percentages":"no","groups":["CSS Text Decoration"],"initial":["text-emphasis-style","text-emphasis-color"],"appliesto":"allElements","computed":["text-emphasis-style","text-emphasis-color"],"order":"orderOfAppearance","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-emphasis"},"text-emphasis-color":{"syntax":"<color>","media":"visual","inherited":false,"animationType":"color","percentages":"no","groups":["CSS Text Decoration"],"initial":"currentcolor","appliesto":"allElements","computed":"computedColor","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-emphasis-color"},"text-emphasis-position":{"syntax":"[ over | under ] && [ right | left ]","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Text Decoration"],"initial":"over right","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-emphasis-position"},"text-emphasis-style":{"syntax":"none | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Text Decoration"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-emphasis-style"},"text-indent":{"syntax":"<length-percentage> && hanging? && each-line?","media":"visual","inherited":true,"animationType":"lpc","percentages":"referToWidthOfContainingBlock","groups":["CSS Text"],"initial":"0","appliesto":"blockContainers","computed":"percentageOrAbsoluteLengthPlusKeywords","order":"lengthOrPercentageBeforeKeywords","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-indent"},"text-justify":{"syntax":"auto | inter-character | inter-word | none","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"auto","appliesto":"inlineLevelAndTableCellElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-justify"},"text-orientation":{"syntax":"mixed | upright | sideways","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Writing Modes"],"initial":"mixed","appliesto":"allElementsExceptTableRowGroupsRowsColumnGroupsAndColumns","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-orientation"},"text-overflow":{"syntax":"[ clip | ellipsis | <string> ]{1,2}","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Basic User Interface"],"initial":"clip","appliesto":"blockContainerElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-overflow"},"text-rendering":{"syntax":"auto | optimizeSpeed | optimizeLegibility | geometricPrecision","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Miscellaneous"],"initial":"auto","appliesto":"textElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-rendering"},"text-shadow":{"syntax":"none | <shadow-t>#","media":"visual","inherited":true,"animationType":"shadowList","percentages":"no","groups":["CSS Text Decoration"],"initial":"none","appliesto":"allElements","computed":"colorPlusThreeAbsoluteLengths","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-shadow"},"text-size-adjust":{"syntax":"none | auto | <percentage>","media":"visual","inherited":true,"animationType":"discrete","percentages":"referToSizeOfFont","groups":["CSS Text"],"initial":"autoForSmartphoneBrowsersSupportingInflation","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"experimental","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-size-adjust"},"text-transform":{"syntax":"none | capitalize | uppercase | lowercase | full-width | full-size-kana","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"none","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-transform"},"text-underline-offset":{"syntax":"auto | <length> | <percentage> ","media":"visual","inherited":true,"animationType":"byComputedValueType","percentages":"referToElementFontSize","groups":["CSS Text Decoration"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-underline-offset"},"text-underline-position":{"syntax":"auto | from-font | [ under || [ left | right ] ]","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text Decoration"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"orderOfAppearance","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/text-underline-position"},"top":{"syntax":"<length> | <percentage> | auto","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToContainingBlockHeight","groups":["CSS Positioning"],"initial":"auto","appliesto":"positionedElements","computed":"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/top"},"touch-action":{"syntax":"auto | none | [ [ pan-x | pan-left | pan-right ] || [ pan-y | pan-up | pan-down ] || pinch-zoom ] | manipulation","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["Pointer Events"],"initial":"auto","appliesto":"allElementsExceptNonReplacedInlineElementsTableRowsColumnsRowColumnGroups","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/touch-action"},"transform":{"syntax":"none | <transform-list>","media":"visual","inherited":false,"animationType":"transform","percentages":"referToSizeOfBoundingBox","groups":["CSS Transforms"],"initial":"none","appliesto":"transformableElements","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"uniqueOrder","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/transform"},"transform-box":{"syntax":"content-box | border-box | fill-box | stroke-box | view-box","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Transforms"],"initial":"view-box","appliesto":"transformableElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/transform-box"},"transform-origin":{"syntax":"[ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?","media":"visual","inherited":false,"animationType":"simpleListOfLpc","percentages":"referToSizeOfBoundingBox","groups":["CSS Transforms"],"initial":"50% 50% 0","appliesto":"transformableElements","computed":"forLengthAbsoluteValueOtherwisePercentage","order":"oneOrTwoValuesLengthAbsoluteKeywordsPercentages","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/transform-origin"},"transform-style":{"syntax":"flat | preserve-3d","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Transforms"],"initial":"flat","appliesto":"transformableElements","computed":"asSpecified","order":"uniqueOrder","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/transform-style"},"transition":{"syntax":"<single-transition>#","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Transitions"],"initial":["transition-delay","transition-duration","transition-property","transition-timing-function"],"appliesto":"allElementsAndPseudos","computed":["transition-delay","transition-duration","transition-property","transition-timing-function"],"order":"orderOfAppearance","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/transition"},"transition-delay":{"syntax":"<time>#","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Transitions"],"initial":"0s","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/transition-delay"},"transition-duration":{"syntax":"<time>#","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Transitions"],"initial":"0s","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/transition-duration"},"transition-property":{"syntax":"none | <single-transition-property>#","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Transitions"],"initial":"all","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/transition-property"},"transition-timing-function":{"syntax":"<timing-function>#","media":"interactive","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Transitions"],"initial":"ease","appliesto":"allElementsAndPseudos","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/transition-timing-function"},"translate":{"syntax":"none | <length-percentage> [ <length-percentage> <length>? ]?","media":"visual","inherited":false,"animationType":"transform","percentages":"referToSizeOfBoundingBox","groups":["CSS Transforms"],"initial":"none","appliesto":"transformableElements","computed":"asSpecifiedRelativeToAbsoluteLengths","order":"perGrammar","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/translate"},"unicode-bidi":{"syntax":"normal | embed | isolate | bidi-override | isolate-override | plaintext","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Writing Modes"],"initial":"normal","appliesto":"allElementsSomeValuesNoEffectOnNonInlineElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/unicode-bidi"},"user-select":{"syntax":"auto | text | none | contain | all","media":"visual","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Basic User Interface"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/user-select"},"vertical-align":{"syntax":"baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length>","media":"visual","inherited":false,"animationType":"length","percentages":"referToLineHeight","groups":["CSS Table"],"initial":"baseline","appliesto":"inlineLevelAndTableCellElements","computed":"absoluteLengthOrKeyword","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/vertical-align"},"visibility":{"syntax":"visible | hidden | collapse","media":"visual","inherited":true,"animationType":"visibility","percentages":"no","groups":["CSS Box Model"],"initial":"visible","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/visibility"},"white-space":{"syntax":"normal | pre | nowrap | pre-wrap | pre-line | break-spaces","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/white-space"},"widows":{"syntax":"<integer>","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Fragmentation"],"initial":"2","appliesto":"blockContainerElements","computed":"asSpecified","order":"perGrammar","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/widows"},"width":{"syntax":"auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)","media":"visual","inherited":false,"animationType":"lpc","percentages":"referToWidthOfContainingBlock","groups":["CSS Box Model"],"initial":"auto","appliesto":"allElementsButNonReplacedAndTableRows","computed":"percentageAutoOrAbsoluteLength","order":"lengthOrPercentageBeforeKeywordIfBothPresent","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/width"},"will-change":{"syntax":"auto | <animateable-feature>#","media":"all","inherited":false,"animationType":"discrete","percentages":"no","groups":["CSS Will Change"],"initial":"auto","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/will-change"},"word-break":{"syntax":"normal | break-all | keep-all | break-word","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/word-break"},"word-spacing":{"syntax":"normal | <length-percentage>","media":"visual","inherited":true,"animationType":"length","percentages":"referToWidthOfAffectedGlyph","groups":["CSS Text"],"initial":"normal","appliesto":"allElements","computed":"optimumMinAndMaxValueOfAbsoluteLengthPercentageOrNormal","order":"uniqueOrder","alsoAppliesTo":["::first-letter","::first-line","::placeholder"],"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/word-spacing"},"word-wrap":{"syntax":"normal | break-word","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Text"],"initial":"normal","appliesto":"nonReplacedInlineElements","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/overflow-wrap"},"writing-mode":{"syntax":"horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr","media":"visual","inherited":true,"animationType":"discrete","percentages":"no","groups":["CSS Writing Modes"],"initial":"horizontal-tb","appliesto":"allElementsExceptTableRowColumnGroupsTableRowsColumns","computed":"asSpecified","order":"uniqueOrder","status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/writing-mode"},"z-index":{"syntax":"auto | <integer>","media":"visual","inherited":false,"animationType":"integer","percentages":"no","groups":["CSS Positioning"],"initial":"auto","appliesto":"positionedElements","computed":"asSpecified","order":"uniqueOrder","stacking":true,"status":"standard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/z-index"},"zoom":{"syntax":"normal | reset | <number> | <percentage>","media":"visual","inherited":false,"animationType":"integer","percentages":"no","groups":["Microsoft Extensions"],"initial":"normal","appliesto":"allElements","computed":"asSpecified","order":"uniqueOrder","status":"nonstandard","mdn_url":"https://developer.mozilla.org/docs/Web/CSS/zoom"}}');
|
||
|
||
/***/ }),
|
||
/* 61 */
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = JSON.parse('{"absolute-size":{"syntax":"xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large"},"alpha-value":{"syntax":"<number> | <percentage>"},"angle-percentage":{"syntax":"<angle> | <percentage>"},"angular-color-hint":{"syntax":"<angle-percentage>"},"angular-color-stop":{"syntax":"<color> && <color-stop-angle>?"},"angular-color-stop-list":{"syntax":"[ <angular-color-stop> [, <angular-color-hint>]? ]# , <angular-color-stop>"},"animateable-feature":{"syntax":"scroll-position | contents | <custom-ident>"},"attachment":{"syntax":"scroll | fixed | local"},"attr()":{"syntax":"attr( <attr-name> <type-or-unit>? [, <attr-fallback> ]? )"},"attr-matcher":{"syntax":"[ \'~\' | \'|\' | \'^\' | \'$\' | \'*\' ]? \'=\'"},"attr-modifier":{"syntax":"i | s"},"attribute-selector":{"syntax":"\'[\' <wq-name> \']\' | \'[\' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? \']\'"},"auto-repeat":{"syntax":"repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"},"auto-track-list":{"syntax":"[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>? <auto-repeat>\\n[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?"},"baseline-position":{"syntax":"[ first | last ]? baseline"},"basic-shape":{"syntax":"<inset()> | <circle()> | <ellipse()> | <polygon()> | <path()>"},"bg-image":{"syntax":"none | <image>"},"bg-layer":{"syntax":"<bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"},"bg-position":{"syntax":"[ [ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] | [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ] ]"},"bg-size":{"syntax":"[ <length-percentage> | auto ]{1,2} | cover | contain"},"blur()":{"syntax":"blur( <length> )"},"blend-mode":{"syntax":"normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity"},"box":{"syntax":"border-box | padding-box | content-box"},"brightness()":{"syntax":"brightness( <number-percentage> )"},"calc()":{"syntax":"calc( <calc-sum> )"},"calc-sum":{"syntax":"<calc-product> [ [ \'+\' | \'-\' ] <calc-product> ]*"},"calc-product":{"syntax":"<calc-value> [ \'*\' <calc-value> | \'/\' <number> ]*"},"calc-value":{"syntax":"<number> | <dimension> | <percentage> | ( <calc-sum> )"},"cf-final-image":{"syntax":"<image> | <color>"},"cf-mixing-image":{"syntax":"<percentage>? && <image>"},"circle()":{"syntax":"circle( [ <shape-radius> ]? [ at <position> ]? )"},"clamp()":{"syntax":"clamp( <calc-sum>#{3} )"},"class-selector":{"syntax":"\'.\' <ident-token>"},"clip-source":{"syntax":"<url>"},"color":{"syntax":"<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>"},"color-stop":{"syntax":"<color-stop-length> | <color-stop-angle>"},"color-stop-angle":{"syntax":"<angle-percentage>{1,2}"},"color-stop-length":{"syntax":"<length-percentage>{1,2}"},"color-stop-list":{"syntax":"[ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop>"},"combinator":{"syntax":"\'>\' | \'+\' | \'~\' | [ \'||\' ]"},"common-lig-values":{"syntax":"[ common-ligatures | no-common-ligatures ]"},"compat-auto":{"syntax":"searchfield | textarea | push-button | slider-horizontal | checkbox | radio | square-button | menulist | listbox | meter | progress-bar | button"},"composite-style":{"syntax":"clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor"},"compositing-operator":{"syntax":"add | subtract | intersect | exclude"},"compound-selector":{"syntax":"[ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!"},"compound-selector-list":{"syntax":"<compound-selector>#"},"complex-selector":{"syntax":"<compound-selector> [ <combinator>? <compound-selector> ]*"},"complex-selector-list":{"syntax":"<complex-selector>#"},"conic-gradient()":{"syntax":"conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )"},"contextual-alt-values":{"syntax":"[ contextual | no-contextual ]"},"content-distribution":{"syntax":"space-between | space-around | space-evenly | stretch"},"content-list":{"syntax":"[ <string> | contents | <image> | <quote> | <target> | <leader()> ]+"},"content-position":{"syntax":"center | start | end | flex-start | flex-end"},"content-replacement":{"syntax":"<image>"},"contrast()":{"syntax":"contrast( [ <number-percentage> ] )"},"counter()":{"syntax":"counter( <custom-ident>, <counter-style>? )"},"counter-style":{"syntax":"<counter-style-name> | symbols()"},"counter-style-name":{"syntax":"<custom-ident>"},"counters()":{"syntax":"counters( <custom-ident>, <string>, <counter-style>? )"},"cross-fade()":{"syntax":"cross-fade( <cf-mixing-image> , <cf-final-image>? )"},"cubic-bezier-timing-function":{"syntax":"ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number [0,1]>, <number>, <number [0,1]>, <number>)"},"deprecated-system-color":{"syntax":"ActiveBorder | ActiveCaption | AppWorkspace | Background | ButtonFace | ButtonHighlight | ButtonShadow | ButtonText | CaptionText | GrayText | Highlight | HighlightText | InactiveBorder | InactiveCaption | InactiveCaptionText | InfoBackground | InfoText | Menu | MenuText | Scrollbar | ThreeDDarkShadow | ThreeDFace | ThreeDHighlight | ThreeDLightShadow | ThreeDShadow | Window | WindowFrame | WindowText"},"discretionary-lig-values":{"syntax":"[ discretionary-ligatures | no-discretionary-ligatures ]"},"display-box":{"syntax":"contents | none"},"display-inside":{"syntax":"flow | flow-root | table | flex | grid | ruby"},"display-internal":{"syntax":"table-row-group | table-header-group | table-footer-group | table-row | table-cell | table-column-group | table-column | table-caption | ruby-base | ruby-text | ruby-base-container | ruby-text-container"},"display-legacy":{"syntax":"inline-block | inline-list-item | inline-table | inline-flex | inline-grid"},"display-listitem":{"syntax":"<display-outside>? && [ flow | flow-root ]? && list-item"},"display-outside":{"syntax":"block | inline | run-in"},"drop-shadow()":{"syntax":"drop-shadow( <length>{2,3} <color>? )"},"east-asian-variant-values":{"syntax":"[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]"},"east-asian-width-values":{"syntax":"[ full-width | proportional-width ]"},"element()":{"syntax":"element( <id-selector> )"},"ellipse()":{"syntax":"ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )"},"ending-shape":{"syntax":"circle | ellipse"},"env()":{"syntax":"env( <custom-ident> , <declaration-value>? )"},"explicit-track-list":{"syntax":"[ <line-names>? <track-size> ]+ <line-names>?"},"family-name":{"syntax":"<string> | <custom-ident>+"},"feature-tag-value":{"syntax":"<string> [ <integer> | on | off ]?"},"feature-type":{"syntax":"@stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation"},"feature-value-block":{"syntax":"<feature-type> \'{\' <feature-value-declaration-list> \'}\'"},"feature-value-block-list":{"syntax":"<feature-value-block>+"},"feature-value-declaration":{"syntax":"<custom-ident>: <integer>+;"},"feature-value-declaration-list":{"syntax":"<feature-value-declaration>"},"feature-value-name":{"syntax":"<custom-ident>"},"fill-rule":{"syntax":"nonzero | evenodd"},"filter-function":{"syntax":"<blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>"},"filter-function-list":{"syntax":"[ <filter-function> | <url> ]+"},"final-bg-layer":{"syntax":"<\'background-color\'> || <bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"},"fit-content()":{"syntax":"fit-content( [ <length> | <percentage> ] )"},"fixed-breadth":{"syntax":"<length-percentage>"},"fixed-repeat":{"syntax":"repeat( [ <positive-integer> ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"},"fixed-size":{"syntax":"<fixed-breadth> | minmax( <fixed-breadth> , <track-breadth> ) | minmax( <inflexible-breadth> , <fixed-breadth> )"},"font-stretch-absolute":{"syntax":"normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage>"},"font-variant-css21":{"syntax":"[ normal | small-caps ]"},"font-weight-absolute":{"syntax":"normal | bold | <number [1,1000]>"},"frequency-percentage":{"syntax":"<frequency> | <percentage>"},"general-enclosed":{"syntax":"[ <function-token> <any-value> ) ] | ( <ident> <any-value> )"},"generic-family":{"syntax":"serif | sans-serif | cursive | fantasy | monospace"},"generic-name":{"syntax":"serif | sans-serif | cursive | fantasy | monospace"},"geometry-box":{"syntax":"<shape-box> | fill-box | stroke-box | view-box"},"gradient":{"syntax":"<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()>"},"grayscale()":{"syntax":"grayscale( <number-percentage> )"},"grid-line":{"syntax":"auto | <custom-ident> | [ <integer> && <custom-ident>? ] | [ span && [ <integer> || <custom-ident> ] ]"},"historical-lig-values":{"syntax":"[ historical-ligatures | no-historical-ligatures ]"},"hsl()":{"syntax":"hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )"},"hsla()":{"syntax":"hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )"},"hue":{"syntax":"<number> | <angle>"},"hue-rotate()":{"syntax":"hue-rotate( <angle> )"},"id-selector":{"syntax":"<hash-token>"},"image":{"syntax":"<url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>"},"image()":{"syntax":"image( <image-tags>? [ <image-src>? , <color>? ]! )"},"image-set()":{"syntax":"image-set( <image-set-option># )"},"image-set-option":{"syntax":"[ <image> | <string> ] <resolution>"},"image-src":{"syntax":"<url> | <string>"},"image-tags":{"syntax":"ltr | rtl"},"inflexible-breadth":{"syntax":"<length> | <percentage> | min-content | max-content | auto"},"inset()":{"syntax":"inset( <length-percentage>{1,4} [ round <\'border-radius\'> ]? )"},"invert()":{"syntax":"invert( <number-percentage> )"},"keyframes-name":{"syntax":"<custom-ident> | <string>"},"keyframe-block":{"syntax":"<keyframe-selector># {\\n <declaration-list>\\n}"},"keyframe-block-list":{"syntax":"<keyframe-block>+"},"keyframe-selector":{"syntax":"from | to | <percentage>"},"leader()":{"syntax":"leader( <leader-type> )"},"leader-type":{"syntax":"dotted | solid | space | <string>"},"length-percentage":{"syntax":"<length> | <percentage>"},"line-names":{"syntax":"\'[\' <custom-ident>* \']\'"},"line-name-list":{"syntax":"[ <line-names> | <name-repeat> ]+"},"line-style":{"syntax":"none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset"},"line-width":{"syntax":"<length> | thin | medium | thick"},"linear-color-hint":{"syntax":"<length-percentage>"},"linear-color-stop":{"syntax":"<color> <color-stop-length>?"},"linear-gradient()":{"syntax":"linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"},"mask-layer":{"syntax":"<mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode>"},"mask-position":{"syntax":"[ <length-percentage> | left | center | right ] [ <length-percentage> | top | center | bottom ]?"},"mask-reference":{"syntax":"none | <image> | <mask-source>"},"mask-source":{"syntax":"<url>"},"masking-mode":{"syntax":"alpha | luminance | match-source"},"matrix()":{"syntax":"matrix( <number>#{6} )"},"matrix3d()":{"syntax":"matrix3d( <number>#{16} )"},"max()":{"syntax":"max( <calc-sum># )"},"media-and":{"syntax":"<media-in-parens> [ and <media-in-parens> ]+"},"media-condition":{"syntax":"<media-not> | <media-and> | <media-or> | <media-in-parens>"},"media-condition-without-or":{"syntax":"<media-not> | <media-and> | <media-in-parens>"},"media-feature":{"syntax":"( [ <mf-plain> | <mf-boolean> | <mf-range> ] )"},"media-in-parens":{"syntax":"( <media-condition> ) | <media-feature> | <general-enclosed>"},"media-not":{"syntax":"not <media-in-parens>"},"media-or":{"syntax":"<media-in-parens> [ or <media-in-parens> ]+"},"media-query":{"syntax":"<media-condition> | [ not | only ]? <media-type> [ and <media-condition-without-or> ]?"},"media-query-list":{"syntax":"<media-query>#"},"media-type":{"syntax":"<ident>"},"mf-boolean":{"syntax":"<mf-name>"},"mf-name":{"syntax":"<ident>"},"mf-plain":{"syntax":"<mf-name> : <mf-value>"},"mf-range":{"syntax":"<mf-name> [ \'<\' | \'>\' ]? \'=\'? <mf-value>\\n| <mf-value> [ \'<\' | \'>\' ]? \'=\'? <mf-name>\\n| <mf-value> \'<\' \'=\'? <mf-name> \'<\' \'=\'? <mf-value>\\n| <mf-value> \'>\' \'=\'? <mf-name> \'>\' \'=\'? <mf-value>"},"mf-value":{"syntax":"<number> | <dimension> | <ident> | <ratio>"},"min()":{"syntax":"min( <calc-sum># )"},"minmax()":{"syntax":"minmax( [ <length> | <percentage> | min-content | max-content | auto ] , [ <length> | <percentage> | <flex> | min-content | max-content | auto ] )"},"named-color":{"syntax":"transparent | aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen"},"namespace-prefix":{"syntax":"<ident>"},"ns-prefix":{"syntax":"[ <ident-token> | \'*\' ]? \'|\'"},"number-percentage":{"syntax":"<number> | <percentage>"},"numeric-figure-values":{"syntax":"[ lining-nums | oldstyle-nums ]"},"numeric-fraction-values":{"syntax":"[ diagonal-fractions | stacked-fractions ]"},"numeric-spacing-values":{"syntax":"[ proportional-nums | tabular-nums ]"},"nth":{"syntax":"<an-plus-b> | even | odd"},"opacity()":{"syntax":"opacity( [ <number-percentage> ] )"},"overflow-position":{"syntax":"unsafe | safe"},"outline-radius":{"syntax":"<length> | <percentage>"},"page-body":{"syntax":"<declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>"},"page-margin-box":{"syntax":"<page-margin-box-type> \'{\' <declaration-list> \'}\'"},"page-margin-box-type":{"syntax":"@top-left-corner | @top-left | @top-center | @top-right | @top-right-corner | @bottom-left-corner | @bottom-left | @bottom-center | @bottom-right | @bottom-right-corner | @left-top | @left-middle | @left-bottom | @right-top | @right-middle | @right-bottom"},"page-selector-list":{"syntax":"[ <page-selector># ]?"},"page-selector":{"syntax":"<pseudo-page>+ | <ident> <pseudo-page>*"},"path()":{"syntax":"path( [ <fill-rule>, ]? <string> )"},"paint()":{"syntax":"paint( <ident>, <declaration-value>? )"},"perspective()":{"syntax":"perspective( <length> )"},"polygon()":{"syntax":"polygon( <fill-rule>? , [ <length-percentage> <length-percentage> ]# )"},"position":{"syntax":"[ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]"},"pseudo-class-selector":{"syntax":"\':\' <ident-token> | \':\' <function-token> <any-value> \')\'"},"pseudo-element-selector":{"syntax":"\':\' <pseudo-class-selector>"},"pseudo-page":{"syntax":": [ left | right | first | blank ]"},"quote":{"syntax":"open-quote | close-quote | no-open-quote | no-close-quote"},"radial-gradient()":{"syntax":"radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"},"relative-selector":{"syntax":"<combinator>? <complex-selector>"},"relative-selector-list":{"syntax":"<relative-selector>#"},"relative-size":{"syntax":"larger | smaller"},"repeat-style":{"syntax":"repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}"},"repeating-linear-gradient()":{"syntax":"repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"},"repeating-radial-gradient()":{"syntax":"repeating-radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"},"rgb()":{"syntax":"rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )"},"rgba()":{"syntax":"rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )"},"rotate()":{"syntax":"rotate( [ <angle> | <zero> ] )"},"rotate3d()":{"syntax":"rotate3d( <number> , <number> , <number> , [ <angle> | <zero> ] )"},"rotateX()":{"syntax":"rotateX( [ <angle> | <zero> ] )"},"rotateY()":{"syntax":"rotateY( [ <angle> | <zero> ] )"},"rotateZ()":{"syntax":"rotateZ( [ <angle> | <zero> ] )"},"saturate()":{"syntax":"saturate( <number-percentage> )"},"scale()":{"syntax":"scale( <number> , <number>? )"},"scale3d()":{"syntax":"scale3d( <number> , <number> , <number> )"},"scaleX()":{"syntax":"scaleX( <number> )"},"scaleY()":{"syntax":"scaleY( <number> )"},"scaleZ()":{"syntax":"scaleZ( <number> )"},"self-position":{"syntax":"center | start | end | self-start | self-end | flex-start | flex-end"},"shape-radius":{"syntax":"<length-percentage> | closest-side | farthest-side"},"skew()":{"syntax":"skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? )"},"skewX()":{"syntax":"skewX( [ <angle> | <zero> ] )"},"skewY()":{"syntax":"skewY( [ <angle> | <zero> ] )"},"sepia()":{"syntax":"sepia( <number-percentage> )"},"shadow":{"syntax":"inset? && <length>{2,4} && <color>?"},"shadow-t":{"syntax":"[ <length>{2,3} && <color>? ]"},"shape":{"syntax":"rect(<top>, <right>, <bottom>, <left>)"},"shape-box":{"syntax":"<box> | margin-box"},"side-or-corner":{"syntax":"[ left | right ] || [ top | bottom ]"},"single-animation":{"syntax":"<time> || <timing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ]"},"single-animation-direction":{"syntax":"normal | reverse | alternate | alternate-reverse"},"single-animation-fill-mode":{"syntax":"none | forwards | backwards | both"},"single-animation-iteration-count":{"syntax":"infinite | <number>"},"single-animation-play-state":{"syntax":"running | paused"},"single-transition":{"syntax":"[ none | <single-transition-property> ] || <time> || <timing-function> || <time>"},"single-transition-property":{"syntax":"all | <custom-ident>"},"size":{"syntax":"closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}"},"step-position":{"syntax":"jump-start | jump-end | jump-none | jump-both | start | end"},"step-timing-function":{"syntax":"step-start | step-end | steps(<integer>[, <step-position>]?)"},"subclass-selector":{"syntax":"<id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector>"},"supports-condition":{"syntax":"not <supports-in-parens> | <supports-in-parens> [ and <supports-in-parens> ]* | <supports-in-parens> [ or <supports-in-parens> ]*"},"supports-in-parens":{"syntax":"( <supports-condition> ) | <supports-feature> | <general-enclosed>"},"supports-feature":{"syntax":"<supports-decl> | <supports-selector-fn>"},"supports-decl":{"syntax":"( <declaration> )"},"supports-selector-fn":{"syntax":"selector( <complex-selector> )"},"symbol":{"syntax":"<string> | <image> | <custom-ident>"},"target":{"syntax":"<target-counter()> | <target-counters()> | <target-text()>"},"target-counter()":{"syntax":"target-counter( [ <string> | <url> ] , <custom-ident> , <counter-style>? )"},"target-counters()":{"syntax":"target-counters( [ <string> | <url> ] , <custom-ident> , <string> , <counter-style>? )"},"target-text()":{"syntax":"target-text( [ <string> | <url> ] , [ content | before | after | first-letter ]? )"},"time-percentage":{"syntax":"<time> | <percentage>"},"timing-function":{"syntax":"linear | <cubic-bezier-timing-function> | <step-timing-function>"},"track-breadth":{"syntax":"<length-percentage> | <flex> | min-content | max-content | auto"},"track-list":{"syntax":"[ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?"},"track-repeat":{"syntax":"repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )"},"track-size":{"syntax":"<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )"},"transform-function":{"syntax":"<matrix()> | <translate()> | <translateX()> | <translateY()> | <scale()> | <scaleX()> | <scaleY()> | <rotate()> | <skew()> | <skewX()> | <skewY()> | <matrix3d()> | <translate3d()> | <translateZ()> | <scale3d()> | <scaleZ()> | <rotate3d()> | <rotateX()> | <rotateY()> | <rotateZ()> | <perspective()>"},"transform-list":{"syntax":"<transform-function>+"},"translate()":{"syntax":"translate( <length-percentage> , <length-percentage>? )"},"translate3d()":{"syntax":"translate3d( <length-percentage> , <length-percentage> , <length> )"},"translateX()":{"syntax":"translateX( <length-percentage> )"},"translateY()":{"syntax":"translateY( <length-percentage> )"},"translateZ()":{"syntax":"translateZ( <length> )"},"type-or-unit":{"syntax":"string | color | url | integer | number | length | angle | time | frequency | cap | ch | em | ex | ic | lh | rlh | rem | vb | vi | vw | vh | vmin | vmax | mm | Q | cm | in | pt | pc | px | deg | grad | rad | turn | ms | s | Hz | kHz | %"},"type-selector":{"syntax":"<wq-name> | <ns-prefix>? \'*\'"},"var()":{"syntax":"var( <custom-property-name> , <declaration-value>? )"},"viewport-length":{"syntax":"auto | <length-percentage>"},"wq-name":{"syntax":"<ns-prefix>? <ident-token>"}}');
|
||
|
||
/***/ }),
|
||
/* 62 */
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = JSON.parse('{"atrules":{"charset":{"prelude":"<string>"},"font-face":{"descriptors":{"unicode-range":{"comment":"replaces <unicode-range>, an old production name","syntax":"<urange>#"}}}},"properties":{"-moz-background-clip":{"comment":"deprecated syntax in old Firefox, https://developer.mozilla.org/en/docs/Web/CSS/background-clip","syntax":"padding | border"},"-moz-border-radius-bottomleft":{"comment":"https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-left-radius","syntax":"<\'border-bottom-left-radius\'>"},"-moz-border-radius-bottomright":{"comment":"https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius","syntax":"<\'border-bottom-right-radius\'>"},"-moz-border-radius-topleft":{"comment":"https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-left-radius","syntax":"<\'border-top-left-radius\'>"},"-moz-border-radius-topright":{"comment":"https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius","syntax":"<\'border-bottom-right-radius\'>"},"-moz-control-character-visibility":{"comment":"firefox specific keywords, https://bugzilla.mozilla.org/show_bug.cgi?id=947588","syntax":"visible | hidden"},"-moz-osx-font-smoothing":{"comment":"misssed old syntax https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth","syntax":"auto | grayscale"},"-moz-user-select":{"comment":"https://developer.mozilla.org/en-US/docs/Web/CSS/user-select","syntax":"none | text | all | -moz-none"},"-ms-flex-align":{"comment":"misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align","syntax":"start | end | center | baseline | stretch"},"-ms-flex-item-align":{"comment":"misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align","syntax":"auto | start | end | center | baseline | stretch"},"-ms-flex-line-pack":{"comment":"misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-line-pack","syntax":"start | end | center | justify | distribute | stretch"},"-ms-flex-negative":{"comment":"misssed old syntax implemented in IE; TODO: find references for comfirmation","syntax":"<\'flex-shrink\'>"},"-ms-flex-pack":{"comment":"misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-pack","syntax":"start | end | center | justify | distribute"},"-ms-flex-order":{"comment":"misssed old syntax implemented in IE; https://msdn.microsoft.com/en-us/library/jj127303(v=vs.85).aspx","syntax":"<integer>"},"-ms-flex-positive":{"comment":"misssed old syntax implemented in IE; TODO: find references for comfirmation","syntax":"<\'flex-grow\'>"},"-ms-flex-preferred-size":{"comment":"misssed old syntax implemented in IE; TODO: find references for comfirmation","syntax":"<\'flex-basis\'>"},"-ms-interpolation-mode":{"comment":"https://msdn.microsoft.com/en-us/library/ff521095(v=vs.85).aspx","syntax":"nearest-neighbor | bicubic"},"-ms-grid-column-align":{"comment":"add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466338.aspx","syntax":"start | end | center | stretch"},"-ms-grid-row-align":{"comment":"add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466348.aspx","syntax":"start | end | center | stretch"},"-ms-hyphenate-limit-last":{"comment":"misssed old syntax implemented in IE; https://www.w3.org/TR/css-text-4/#hyphenate-line-limits","syntax":"none | always | column | page | spread"},"-webkit-appearance":{"comment":"webkit specific keywords","references":["http://css-infos.net/property/-webkit-appearance"],"syntax":"none | button | button-bevel | caps-lock-indicator | 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 | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbargripper-horizontal | scrollbargripper-vertical | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | 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"},"-webkit-background-clip":{"comment":"https://developer.mozilla.org/en/docs/Web/CSS/background-clip","syntax":"[ <box> | border | padding | content | text ]#"},"-webkit-column-break-after":{"comment":"added, http://help.dottoro.com/lcrthhhv.php","syntax":"always | auto | avoid"},"-webkit-column-break-before":{"comment":"added, http://help.dottoro.com/lcxquvkf.php","syntax":"always | auto | avoid"},"-webkit-column-break-inside":{"comment":"added, http://help.dottoro.com/lclhnthl.php","syntax":"always | auto | avoid"},"-webkit-font-smoothing":{"comment":"https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth","syntax":"auto | none | antialiased | subpixel-antialiased"},"-webkit-mask-box-image":{"comment":"missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image","syntax":"[ <url> | <gradient> | none ] [ <length-percentage>{4} <-webkit-mask-box-repeat>{2} ]?"},"-webkit-print-color-adjust":{"comment":"missed","references":["https://developer.mozilla.org/en/docs/Web/CSS/-webkit-print-color-adjust"],"syntax":"economy | exact"},"-webkit-text-security":{"comment":"missed; http://help.dottoro.com/lcbkewgt.php","syntax":"none | circle | disc | square"},"-webkit-user-drag":{"comment":"missed; http://help.dottoro.com/lcbixvwm.php","syntax":"none | element | auto"},"-webkit-user-select":{"comment":"auto is supported by old webkit, https://developer.mozilla.org/en-US/docs/Web/CSS/user-select","syntax":"auto | none | text | all"},"alignment-baseline":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/text.html#AlignmentBaselineProperty"],"syntax":"auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical"},"baseline-shift":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/text.html#BaselineShiftProperty"],"syntax":"baseline | sub | super | <svg-length>"},"behavior":{"comment":"added old IE property https://msdn.microsoft.com/en-us/library/ms530723(v=vs.85).aspx","syntax":"<url>+"},"clip-rule":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/masking.html#ClipRuleProperty"],"syntax":"nonzero | evenodd"},"cue":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<\'cue-before\'> <\'cue-after\'>?"},"cue-after":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<url> <decibel>? | none"},"cue-before":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<url> <decibel>? | none"},"cursor":{"comment":"added legacy keywords: hand, -webkit-grab. -webkit-grabbing, -webkit-zoom-in, -webkit-zoom-out, -moz-grab, -moz-grabbing, -moz-zoom-in, -moz-zoom-out","references":["https://www.sitepoint.com/css3-cursor-styles/"],"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 | hand | -webkit-grab | -webkit-grabbing | -webkit-zoom-in | -webkit-zoom-out | -moz-grab | -moz-grabbing | -moz-zoom-in | -moz-zoom-out ] ]"},"display":{"comment":"extended with -ms-flexbox","syntax":"| <-non-standard-display>"},"position":{"comment":"extended with -webkit-sticky","syntax":"| -webkit-sticky"},"dominant-baseline":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/text.html#DominantBaselineProperty"],"syntax":"auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge"},"image-rendering":{"comment":"extended with <-non-standard-image-rendering>, added SVG keywords optimizeSpeed and optimizeQuality","references":["https://developer.mozilla.org/en/docs/Web/CSS/image-rendering","https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty"],"syntax":"| optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"},"fill":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#FillProperty"],"syntax":"<paint>"},"fill-opacity":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#FillProperty"],"syntax":"<number-zero-one>"},"fill-rule":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#FillProperty"],"syntax":"nonzero | evenodd"},"filter":{"comment":"extend with IE legacy syntaxes","syntax":"| <-ms-filter-function-list>"},"glyph-orientation-horizontal":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/text.html#GlyphOrientationHorizontalProperty"],"syntax":"<angle>"},"glyph-orientation-vertical":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/text.html#GlyphOrientationVerticalProperty"],"syntax":"<angle>"},"kerning":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/text.html#KerningProperty"],"syntax":"auto | <svg-length>"},"letter-spacing":{"comment":"fix syntax <length> -> <length-percentage>","references":["https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing"],"syntax":"normal | <length-percentage>"},"marker":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#MarkerProperties"],"syntax":"none | <url>"},"marker-end":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#MarkerProperties"],"syntax":"none | <url>"},"marker-mid":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#MarkerProperties"],"syntax":"none | <url>"},"marker-start":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#MarkerProperties"],"syntax":"none | <url>"},"max-width":{"comment":"fix auto -> none (https://github.com/mdn/data/pull/431); extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/max-width","syntax":"none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>) | <-non-standard-width>"},"width":{"comment":"per spec fit-content should be a function, however browsers are supporting it as a keyword (https://github.com/csstree/stylelint-validator/issues/29)","syntax":"| fit-content | -moz-fit-content | -webkit-fit-content"},"min-width":{"comment":"extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width","syntax":"auto | <length-percentage> | min-content | max-content | fit-content(<length-percentage>) | <-non-standard-width>"},"overflow":{"comment":"extend by vendor keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow","syntax":"| <-non-standard-overflow>"},"pause":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<\'pause-before\'> <\'pause-after\'>?"},"pause-after":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<time> | none | x-weak | weak | medium | strong | x-strong"},"pause-before":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<time> | none | x-weak | weak | medium | strong | x-strong"},"rest":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<\'rest-before\'> <\'rest-after\'>?"},"rest-after":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<time> | none | x-weak | weak | medium | strong | x-strong"},"rest-before":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<time> | none | x-weak | weak | medium | strong | x-strong"},"shape-rendering":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#ShapeRenderingPropert"],"syntax":"auto | optimizeSpeed | crispEdges | geometricPrecision"},"src":{"comment":"added @font-face\'s src property https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src","syntax":"[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#"},"speak":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"auto | none | normal"},"speak-as":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"normal | spell-out || digits || [ literal-punctuation | no-punctuation ]"},"stroke":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#StrokeProperties"],"syntax":"<paint>"},"stroke-dasharray":{"comment":"added SVG property; a list of comma and/or white space separated <length>s and <percentage>s","references":["https://www.w3.org/TR/SVG/painting.html#StrokeProperties"],"syntax":"none | [ <svg-length>+ ]#"},"stroke-dashoffset":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#StrokeProperties"],"syntax":"<svg-length>"},"stroke-linecap":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#StrokeProperties"],"syntax":"butt | round | square"},"stroke-linejoin":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#StrokeProperties"],"syntax":"miter | round | bevel"},"stroke-miterlimit":{"comment":"added SVG property (<miterlimit> = <number-one-or-greater>) ","references":["https://www.w3.org/TR/SVG/painting.html#StrokeProperties"],"syntax":"<number-one-or-greater>"},"stroke-opacity":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#StrokeProperties"],"syntax":"<number-zero-one>"},"stroke-width":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/painting.html#StrokeProperties"],"syntax":"<svg-length>"},"text-anchor":{"comment":"added SVG property","references":["https://www.w3.org/TR/SVG/text.html#TextAlignmentProperties"],"syntax":"start | middle | end"},"unicode-bidi":{"comment":"added prefixed keywords https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-bidi","syntax":"| -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate | -webkit-isolate-override | -webkit-plaintext"},"unicode-range":{"comment":"added missed property https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face/unicode-range","syntax":"<urange>#"},"voice-balance":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<number> | left | center | right | leftwards | rightwards"},"voice-duration":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"auto | <time>"},"voice-family":{"comment":"<name> -> <family-name>, https://www.w3.org/TR/css3-speech/#property-index","syntax":"[ [ <family-name> | <generic-voice> ] , ]* [ <family-name> | <generic-voice> ] | preserve"},"voice-pitch":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"},"voice-range":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"},"voice-rate":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"[ normal | x-slow | slow | medium | fast | x-fast ] || <percentage>"},"voice-stress":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"normal | strong | moderate | none | reduced"},"voice-volume":{"comment":"https://www.w3.org/TR/css3-speech/#property-index","syntax":"silent | [ [ x-soft | soft | medium | loud | x-loud ] || <decibel> ]"},"writing-mode":{"comment":"extend with SVG keywords","syntax":"| <svg-writing-mode>"}},"syntaxes":{"-legacy-gradient":{"comment":"added collection of legacy gradient syntaxes","syntax":"<-webkit-gradient()> | <-legacy-linear-gradient> | <-legacy-repeating-linear-gradient> | <-legacy-radial-gradient> | <-legacy-repeating-radial-gradient>"},"-legacy-linear-gradient":{"comment":"like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient","syntax":"-moz-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-linear-gradient( <-legacy-linear-gradient-arguments> )"},"-legacy-repeating-linear-gradient":{"comment":"like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient","syntax":"-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )"},"-legacy-linear-gradient-arguments":{"comment":"like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient","syntax":"[ <angle> | <side-or-corner> ]? , <color-stop-list>"},"-legacy-radial-gradient":{"comment":"deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients","syntax":"-moz-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-radial-gradient( <-legacy-radial-gradient-arguments> )"},"-legacy-repeating-radial-gradient":{"comment":"deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients","syntax":"-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )"},"-legacy-radial-gradient-arguments":{"comment":"deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients","syntax":"[ <position> , ]? [ [ [ <-legacy-radial-gradient-shape> || <-legacy-radial-gradient-size> ] | [ <length> | <percentage> ]{2} ] , ]? <color-stop-list>"},"-legacy-radial-gradient-size":{"comment":"before a standard it contains 2 extra keywords (`contain` and `cover`) https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltsize","syntax":"closest-side | closest-corner | farthest-side | farthest-corner | contain | cover"},"-legacy-radial-gradient-shape":{"comment":"define to double sure it doesn\'t extends in future https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltshape","syntax":"circle | ellipse"},"-non-standard-font":{"comment":"non standard fonts","references":["https://webkit.org/blog/3709/using-the-system-font-in-web-content/"],"syntax":"-apple-system-body | -apple-system-headline | -apple-system-subheadline | -apple-system-caption1 | -apple-system-caption2 | -apple-system-footnote | -apple-system-short-body | -apple-system-short-headline | -apple-system-short-subheadline | -apple-system-short-caption1 | -apple-system-short-footnote | -apple-system-tall-body"},"-non-standard-color":{"comment":"non standard colors","references":["http://cssdot.ru/%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D1%87%D0%BD%D0%B8%D0%BA_CSS/color-i305.html","https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Mozilla_Color_Preference_Extensions"],"syntax":"-moz-ButtonDefault | -moz-ButtonHoverFace | -moz-ButtonHoverText | -moz-CellHighlight | -moz-CellHighlightText | -moz-Combobox | -moz-ComboboxText | -moz-Dialog | -moz-DialogText | -moz-dragtargetzone | -moz-EvenTreeRow | -moz-Field | -moz-FieldText | -moz-html-CellHighlight | -moz-html-CellHighlightText | -moz-mac-accentdarkestshadow | -moz-mac-accentdarkshadow | -moz-mac-accentface | -moz-mac-accentlightesthighlight | -moz-mac-accentlightshadow | -moz-mac-accentregularhighlight | -moz-mac-accentregularshadow | -moz-mac-chrome-active | -moz-mac-chrome-inactive | -moz-mac-focusring | -moz-mac-menuselect | -moz-mac-menushadow | -moz-mac-menutextselect | -moz-MenuHover | -moz-MenuHoverText | -moz-MenuBarText | -moz-MenuBarHoverText | -moz-nativehyperlinktext | -moz-OddTreeRow | -moz-win-communicationstext | -moz-win-mediatext | -moz-activehyperlinktext | -moz-default-background-color | -moz-default-color | -moz-hyperlinktext | -moz-visitedhyperlinktext | -webkit-activelink | -webkit-focus-ring-color | -webkit-link | -webkit-text"},"-non-standard-image-rendering":{"comment":"non-standard keywords http://phrogz.net/tmp/canvas_image_zoom.html","syntax":"optimize-contrast | -moz-crisp-edges | -o-crisp-edges | -webkit-optimize-contrast"},"-non-standard-overflow":{"comment":"non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow","syntax":"-moz-scrollbars-none | -moz-scrollbars-horizontal | -moz-scrollbars-vertical | -moz-hidden-unscrollable"},"-non-standard-width":{"comment":"non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width","syntax":"fill-available | min-intrinsic | intrinsic | -moz-available | -moz-fit-content | -moz-min-content | -moz-max-content | -webkit-min-content | -webkit-max-content"},"-webkit-gradient()":{"comment":"first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/ - TODO: simplify when after match algorithm improvement ( [, point, radius | , point] -> [, radius]? , point )","syntax":"-webkit-gradient( <-webkit-gradient-type>, <-webkit-gradient-point> [, <-webkit-gradient-point> | , <-webkit-gradient-radius>, <-webkit-gradient-point> ] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )"},"-webkit-gradient-color-stop":{"comment":"first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/","syntax":"from( <color> ) | color-stop( [ <number-zero-one> | <percentage> ] , <color> ) | to( <color> )"},"-webkit-gradient-point":{"comment":"first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/","syntax":"[ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]"},"-webkit-gradient-radius":{"comment":"first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/","syntax":"<length> | <percentage>"},"-webkit-gradient-type":{"comment":"first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/","syntax":"linear | radial"},"-webkit-mask-box-repeat":{"comment":"missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image","syntax":"repeat | stretch | round"},"-webkit-mask-clip-style":{"comment":"missed; there is no enough information about `-webkit-mask-clip` property, but looks like all those keywords are working","syntax":"border | border-box | padding | padding-box | content | content-box | text"},"-ms-filter-function-list":{"comment":"https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter","syntax":"<-ms-filter-function>+"},"-ms-filter-function":{"comment":"https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter","syntax":"<-ms-filter-function-progid> | <-ms-filter-function-legacy>"},"-ms-filter-function-progid":{"comment":"https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter","syntax":"\'progid:\' [ <ident-token> \'.\' ]* [ <ident-token> | <function-token> <any-value>? ) ]"},"-ms-filter-function-legacy":{"comment":"https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter","syntax":"<ident-token> | <function-token> <any-value>? )"},"-ms-filter":{"syntax":"<string>"},"age":{"comment":"https://www.w3.org/TR/css3-speech/#voice-family","syntax":"child | young | old"},"attr-name":{"syntax":"<wq-name>"},"attr-fallback":{"syntax":"<any-value>"},"border-radius":{"comment":"missed, https://drafts.csswg.org/css-backgrounds-3/#the-border-radius","syntax":"<length-percentage>{1,2}"},"bottom":{"comment":"missed; not sure we should add it, but no others except `shape` is using it so it\'s ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect","syntax":"<length> | auto"},"content-list":{"comment":"missed -> https://drafts.csswg.org/css-content/#typedef-content-list (document-url, <target> and leader() is omitted util stabilization)","syntax":"[ <string> | contents | <image> | <quote> | <target> | <leader()> | <attr()> | counter( <ident>, <\'list-style-type\'>? ) ]+"},"element()":{"comment":"https://drafts.csswg.org/css-gcpm/#element-syntax & https://drafts.csswg.org/css-images-4/#element-notation","syntax":"element( <custom-ident> , [ first | start | last | first-except ]? ) | element( <id-selector> )"},"generic-voice":{"comment":"https://www.w3.org/TR/css3-speech/#voice-family","syntax":"[ <age>? <gender> <integer>? ]"},"gender":{"comment":"https://www.w3.org/TR/css3-speech/#voice-family","syntax":"male | female | neutral"},"generic-family":{"comment":"added -apple-system","references":["https://webkit.org/blog/3709/using-the-system-font-in-web-content/"],"syntax":"| -apple-system"},"gradient":{"comment":"added legacy syntaxes support","syntax":"| <-legacy-gradient>"},"left":{"comment":"missed; not sure we should add it, but no others except `shape` is using it so it\'s ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect","syntax":"<length> | auto"},"mask-image":{"comment":"missed; https://drafts.fxtf.org/css-masking-1/#the-mask-image","syntax":"<mask-reference>#"},"name-repeat":{"comment":"missed, and looks like obsolete, keep it as is since other property syntaxes should be changed too; https://www.w3.org/TR/2015/WD-css-grid-1-20150917/#typedef-name-repeat","syntax":"repeat( [ <positive-integer> | auto-fill ], <line-names>+)"},"named-color":{"comment":"added non standard color names","syntax":"| <-non-standard-color>"},"paint":{"comment":"used by SVG https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint","syntax":"none | <color> | <url> [ none | <color> ]? | context-fill | context-stroke"},"page-size":{"comment":"https://www.w3.org/TR/css-page-3/#typedef-page-size-page-size","syntax":"A5 | A4 | A3 | B5 | B4 | JIS-B5 | JIS-B4 | letter | legal | ledger"},"ratio":{"comment":"missed, https://drafts.csswg.org/mediaqueries-4/#typedef-ratio","syntax":"<integer> / <integer>"},"right":{"comment":"missed; not sure we should add it, but no others except `shape` is using it so it\'s ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect","syntax":"<length> | auto"},"shape":{"comment":"missed spaces in function body and add backwards compatible syntax","syntax":"rect( <top>, <right>, <bottom>, <left> ) | rect( <top> <right> <bottom> <left> )"},"svg-length":{"comment":"All coordinates and lengths in SVG can be specified with or without a unit identifier","references":["https://www.w3.org/TR/SVG11/coords.html#Units"],"syntax":"<percentage> | <length> | <number>"},"svg-writing-mode":{"comment":"SVG specific keywords (deprecated for CSS)","references":["https://developer.mozilla.org/en/docs/Web/CSS/writing-mode","https://www.w3.org/TR/SVG/text.html#WritingModeProperty"],"syntax":"lr-tb | rl-tb | tb-rl | lr | rl | tb"},"top":{"comment":"missed; not sure we should add it, but no others except `shape` is using it so it\'s ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect","syntax":"<length> | auto"},"track-group":{"comment":"used by old grid-columns and grid-rows syntax v0","syntax":"\'(\' [ <string>* <track-minmax> <string>* ]+ \')\' [ \'[\' <positive-integer> \']\' ]? | <track-minmax>"},"track-list-v0":{"comment":"used by old grid-columns and grid-rows syntax v0","syntax":"[ <string>* <track-group> <string>* ]+ | none"},"track-minmax":{"comment":"used by old grid-columns and grid-rows syntax v0","syntax":"minmax( <track-breadth> , <track-breadth> ) | auto | <track-breadth> | fit-content"},"x":{"comment":"missed; not sure we should add it, but no others except `cursor` is using it so it\'s ok for now; https://drafts.csswg.org/css-ui-3/#cursor","syntax":"<number>"},"y":{"comment":"missed; not sure we should add it, but no others except `cursor` is using so it\'s ok for now; https://drafts.csswg.org/css-ui-3/#cursor","syntax":"<number>"},"declaration":{"comment":"missed, restored by https://drafts.csswg.org/css-syntax","syntax":"<ident-token> : <declaration-value>? [ \'!\' important ]?"},"declaration-list":{"comment":"missed, restored by https://drafts.csswg.org/css-syntax","syntax":"[ <declaration>? \';\' ]* <declaration>?"},"url":{"comment":"https://drafts.csswg.org/css-values-4/#urls","syntax":"url( <string> <url-modifier>* ) | <url-token>"},"url-modifier":{"comment":"https://drafts.csswg.org/css-values-4/#typedef-url-modifier","syntax":"<ident> | <function-token> <any-value> )"},"number-zero-one":{"syntax":"<number [0,1]>"},"number-one-or-greater":{"syntax":"<number [1,∞]>"},"positive-integer":{"syntax":"<integer [0,∞]>"},"-non-standard-display":{"syntax":"-ms-inline-flexbox | -ms-grid | -ms-inline-grid | -webkit-flex | -webkit-inline-flex | -webkit-box | -webkit-inline-box | -moz-inline-stack | -moz-box | -moz-inline-box"}}}');
|
||
|
||
/***/ }),
|
||
/* 63 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = {
|
||
AnPlusB: __webpack_require__(64),
|
||
Atrule: __webpack_require__(65),
|
||
AtrulePrelude: __webpack_require__(67),
|
||
AttributeSelector: __webpack_require__(68),
|
||
Block: __webpack_require__(69),
|
||
Brackets: __webpack_require__(70),
|
||
CDC: __webpack_require__(71),
|
||
CDO: __webpack_require__(72),
|
||
ClassSelector: __webpack_require__(73),
|
||
Combinator: __webpack_require__(74),
|
||
Comment: __webpack_require__(75),
|
||
Declaration: __webpack_require__(76),
|
||
DeclarationList: __webpack_require__(77),
|
||
Dimension: __webpack_require__(78),
|
||
Function: __webpack_require__(79),
|
||
Hash: __webpack_require__(80),
|
||
Identifier: __webpack_require__(81),
|
||
IdSelector: __webpack_require__(82),
|
||
MediaFeature: __webpack_require__(83),
|
||
MediaQuery: __webpack_require__(84),
|
||
MediaQueryList: __webpack_require__(85),
|
||
Nth: __webpack_require__(86),
|
||
Number: __webpack_require__(87),
|
||
Operator: __webpack_require__(88),
|
||
Parentheses: __webpack_require__(89),
|
||
Percentage: __webpack_require__(90),
|
||
PseudoClassSelector: __webpack_require__(91),
|
||
PseudoElementSelector: __webpack_require__(92),
|
||
Ratio: __webpack_require__(93),
|
||
Raw: __webpack_require__(66),
|
||
Rule: __webpack_require__(94),
|
||
Selector: __webpack_require__(95),
|
||
SelectorList: __webpack_require__(96),
|
||
String: __webpack_require__(97),
|
||
StyleSheet: __webpack_require__(98),
|
||
TypeSelector: __webpack_require__(99),
|
||
UnicodeRange: __webpack_require__(100),
|
||
Url: __webpack_require__(101),
|
||
Value: __webpack_require__(102),
|
||
WhiteSpace: __webpack_require__(103)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 64 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var cmpChar = __webpack_require__(27).cmpChar;
|
||
var isDigit = __webpack_require__(27).isDigit;
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var COMMENT = TYPE.Comment;
|
||
var IDENT = TYPE.Ident;
|
||
var NUMBER = TYPE.Number;
|
||
var DIMENSION = TYPE.Dimension;
|
||
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||
var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
|
||
var N = 0x006E; // U+006E LATIN SMALL LETTER N (n)
|
||
var DISALLOW_SIGN = true;
|
||
var ALLOW_SIGN = false;
|
||
|
||
function checkInteger(offset, disallowSign) {
|
||
var pos = this.scanner.tokenStart + offset;
|
||
var code = this.scanner.source.charCodeAt(pos);
|
||
|
||
if (code === PLUSSIGN || code === HYPHENMINUS) {
|
||
if (disallowSign) {
|
||
this.error('Number sign is not allowed');
|
||
}
|
||
pos++;
|
||
}
|
||
|
||
for (; pos < this.scanner.tokenEnd; pos++) {
|
||
if (!isDigit(this.scanner.source.charCodeAt(pos))) {
|
||
this.error('Integer is expected', pos);
|
||
}
|
||
}
|
||
}
|
||
|
||
function checkTokenIsInteger(disallowSign) {
|
||
return checkInteger.call(this, 0, disallowSign);
|
||
}
|
||
|
||
function expectCharCode(offset, code) {
|
||
if (!cmpChar(this.scanner.source, this.scanner.tokenStart + offset, code)) {
|
||
var msg = '';
|
||
|
||
switch (code) {
|
||
case N:
|
||
msg = 'N is expected';
|
||
break;
|
||
case HYPHENMINUS:
|
||
msg = 'HyphenMinus is expected';
|
||
break;
|
||
}
|
||
|
||
this.error(msg, this.scanner.tokenStart + offset);
|
||
}
|
||
}
|
||
|
||
// ... <signed-integer>
|
||
// ... ['+' | '-'] <signless-integer>
|
||
function consumeB() {
|
||
var offset = 0;
|
||
var sign = 0;
|
||
var type = this.scanner.tokenType;
|
||
|
||
while (type === WHITESPACE || type === COMMENT) {
|
||
type = this.scanner.lookupType(++offset);
|
||
}
|
||
|
||
if (type !== NUMBER) {
|
||
if (this.scanner.isDelim(PLUSSIGN, offset) ||
|
||
this.scanner.isDelim(HYPHENMINUS, offset)) {
|
||
sign = this.scanner.isDelim(PLUSSIGN, offset) ? PLUSSIGN : HYPHENMINUS;
|
||
|
||
do {
|
||
type = this.scanner.lookupType(++offset);
|
||
} while (type === WHITESPACE || type === COMMENT);
|
||
|
||
if (type !== NUMBER) {
|
||
this.scanner.skip(offset);
|
||
checkTokenIsInteger.call(this, DISALLOW_SIGN);
|
||
}
|
||
} else {
|
||
return null;
|
||
}
|
||
}
|
||
|
||
if (offset > 0) {
|
||
this.scanner.skip(offset);
|
||
}
|
||
|
||
if (sign === 0) {
|
||
type = this.scanner.source.charCodeAt(this.scanner.tokenStart);
|
||
if (type !== PLUSSIGN && type !== HYPHENMINUS) {
|
||
this.error('Number sign is expected');
|
||
}
|
||
}
|
||
|
||
checkTokenIsInteger.call(this, sign !== 0);
|
||
return sign === HYPHENMINUS ? '-' + this.consume(NUMBER) : this.consume(NUMBER);
|
||
}
|
||
|
||
// An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
|
||
module.exports = {
|
||
name: 'AnPlusB',
|
||
structure: {
|
||
a: [String, null],
|
||
b: [String, null]
|
||
},
|
||
parse: function() {
|
||
/* eslint-disable brace-style*/
|
||
var start = this.scanner.tokenStart;
|
||
var a = null;
|
||
var b = null;
|
||
|
||
// <integer>
|
||
if (this.scanner.tokenType === NUMBER) {
|
||
checkTokenIsInteger.call(this, ALLOW_SIGN);
|
||
b = this.consume(NUMBER);
|
||
}
|
||
|
||
// -n
|
||
// -n <signed-integer>
|
||
// -n ['+' | '-'] <signless-integer>
|
||
// -n- <signless-integer>
|
||
// <dashndashdigit-ident>
|
||
else if (this.scanner.tokenType === IDENT && cmpChar(this.scanner.source, this.scanner.tokenStart, HYPHENMINUS)) {
|
||
a = '-1';
|
||
|
||
expectCharCode.call(this, 1, N);
|
||
|
||
switch (this.scanner.getTokenLength()) {
|
||
// -n
|
||
// -n <signed-integer>
|
||
// -n ['+' | '-'] <signless-integer>
|
||
case 2:
|
||
this.scanner.next();
|
||
b = consumeB.call(this);
|
||
break;
|
||
|
||
// -n- <signless-integer>
|
||
case 3:
|
||
expectCharCode.call(this, 2, HYPHENMINUS);
|
||
|
||
this.scanner.next();
|
||
this.scanner.skipSC();
|
||
|
||
checkTokenIsInteger.call(this, DISALLOW_SIGN);
|
||
|
||
b = '-' + this.consume(NUMBER);
|
||
break;
|
||
|
||
// <dashndashdigit-ident>
|
||
default:
|
||
expectCharCode.call(this, 2, HYPHENMINUS);
|
||
checkInteger.call(this, 3, DISALLOW_SIGN);
|
||
this.scanner.next();
|
||
|
||
b = this.scanner.substrToCursor(start + 2);
|
||
}
|
||
}
|
||
|
||
// '+'? n
|
||
// '+'? n <signed-integer>
|
||
// '+'? n ['+' | '-'] <signless-integer>
|
||
// '+'? n- <signless-integer>
|
||
// '+'? <ndashdigit-ident>
|
||
else if (this.scanner.tokenType === IDENT || (this.scanner.isDelim(PLUSSIGN) && this.scanner.lookupType(1) === IDENT)) {
|
||
var sign = 0;
|
||
a = '1';
|
||
|
||
// just ignore a plus
|
||
if (this.scanner.isDelim(PLUSSIGN)) {
|
||
sign = 1;
|
||
this.scanner.next();
|
||
}
|
||
|
||
expectCharCode.call(this, 0, N);
|
||
|
||
switch (this.scanner.getTokenLength()) {
|
||
// '+'? n
|
||
// '+'? n <signed-integer>
|
||
// '+'? n ['+' | '-'] <signless-integer>
|
||
case 1:
|
||
this.scanner.next();
|
||
b = consumeB.call(this);
|
||
break;
|
||
|
||
// '+'? n- <signless-integer>
|
||
case 2:
|
||
expectCharCode.call(this, 1, HYPHENMINUS);
|
||
|
||
this.scanner.next();
|
||
this.scanner.skipSC();
|
||
|
||
checkTokenIsInteger.call(this, DISALLOW_SIGN);
|
||
|
||
b = '-' + this.consume(NUMBER);
|
||
break;
|
||
|
||
// '+'? <ndashdigit-ident>
|
||
default:
|
||
expectCharCode.call(this, 1, HYPHENMINUS);
|
||
checkInteger.call(this, 2, DISALLOW_SIGN);
|
||
this.scanner.next();
|
||
|
||
b = this.scanner.substrToCursor(start + sign + 1);
|
||
}
|
||
}
|
||
|
||
// <ndashdigit-dimension>
|
||
// <ndash-dimension> <signless-integer>
|
||
// <n-dimension>
|
||
// <n-dimension> <signed-integer>
|
||
// <n-dimension> ['+' | '-'] <signless-integer>
|
||
else if (this.scanner.tokenType === DIMENSION) {
|
||
var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
|
||
var sign = code === PLUSSIGN || code === HYPHENMINUS;
|
||
|
||
for (var i = this.scanner.tokenStart + sign; i < this.scanner.tokenEnd; i++) {
|
||
if (!isDigit(this.scanner.source.charCodeAt(i))) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (i === this.scanner.tokenStart + sign) {
|
||
this.error('Integer is expected', this.scanner.tokenStart + sign);
|
||
}
|
||
|
||
expectCharCode.call(this, i - this.scanner.tokenStart, N);
|
||
a = this.scanner.source.substring(start, i);
|
||
|
||
// <n-dimension>
|
||
// <n-dimension> <signed-integer>
|
||
// <n-dimension> ['+' | '-'] <signless-integer>
|
||
if (i + 1 === this.scanner.tokenEnd) {
|
||
this.scanner.next();
|
||
b = consumeB.call(this);
|
||
} else {
|
||
expectCharCode.call(this, i - this.scanner.tokenStart + 1, HYPHENMINUS);
|
||
|
||
// <ndash-dimension> <signless-integer>
|
||
if (i + 2 === this.scanner.tokenEnd) {
|
||
this.scanner.next();
|
||
this.scanner.skipSC();
|
||
checkTokenIsInteger.call(this, DISALLOW_SIGN);
|
||
b = '-' + this.consume(NUMBER);
|
||
}
|
||
// <ndashdigit-dimension>
|
||
else {
|
||
checkInteger.call(this, i - this.scanner.tokenStart + 2, DISALLOW_SIGN);
|
||
this.scanner.next();
|
||
b = this.scanner.substrToCursor(i + 1);
|
||
}
|
||
}
|
||
} else {
|
||
this.error();
|
||
}
|
||
|
||
if (a !== null && a.charCodeAt(0) === PLUSSIGN) {
|
||
a = a.substr(1);
|
||
}
|
||
|
||
if (b !== null && b.charCodeAt(0) === PLUSSIGN) {
|
||
b = b.substr(1);
|
||
}
|
||
|
||
return {
|
||
type: 'AnPlusB',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
a: a,
|
||
b: b
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
var a = node.a !== null && node.a !== undefined;
|
||
var b = node.b !== null && node.b !== undefined;
|
||
|
||
if (a) {
|
||
this.chunk(
|
||
node.a === '+1' ? '+n' : // eslint-disable-line operator-linebreak, indent
|
||
node.a === '1' ? 'n' : // eslint-disable-line operator-linebreak, indent
|
||
node.a === '-1' ? '-n' : // eslint-disable-line operator-linebreak, indent
|
||
node.a + 'n' // eslint-disable-line operator-linebreak, indent
|
||
);
|
||
|
||
if (b) {
|
||
b = String(node.b);
|
||
if (b.charAt(0) === '-' || b.charAt(0) === '+') {
|
||
this.chunk(b.charAt(0));
|
||
this.chunk(b.substr(1));
|
||
} else {
|
||
this.chunk('+');
|
||
this.chunk(b);
|
||
}
|
||
}
|
||
} else {
|
||
this.chunk(String(node.b));
|
||
}
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 65 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
var rawMode = __webpack_require__(66).mode;
|
||
|
||
var ATKEYWORD = TYPE.AtKeyword;
|
||
var SEMICOLON = TYPE.Semicolon;
|
||
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
|
||
var RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;
|
||
|
||
function consumeRaw(startToken) {
|
||
return this.Raw(startToken, rawMode.leftCurlyBracketOrSemicolon, true);
|
||
}
|
||
|
||
function isDeclarationBlockAtrule() {
|
||
for (var offset = 1, type; type = this.scanner.lookupType(offset); offset++) {
|
||
if (type === RIGHTCURLYBRACKET) {
|
||
return true;
|
||
}
|
||
|
||
if (type === LEFTCURLYBRACKET ||
|
||
type === ATKEYWORD) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
module.exports = {
|
||
name: 'Atrule',
|
||
structure: {
|
||
name: String,
|
||
prelude: ['AtrulePrelude', 'Raw', null],
|
||
block: ['Block', null]
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var name;
|
||
var nameLowerCase;
|
||
var prelude = null;
|
||
var block = null;
|
||
|
||
this.eat(ATKEYWORD);
|
||
|
||
name = this.scanner.substrToCursor(start + 1);
|
||
nameLowerCase = name.toLowerCase();
|
||
this.scanner.skipSC();
|
||
|
||
// parse prelude
|
||
if (this.scanner.eof === false &&
|
||
this.scanner.tokenType !== LEFTCURLYBRACKET &&
|
||
this.scanner.tokenType !== SEMICOLON) {
|
||
if (this.parseAtrulePrelude) {
|
||
prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name), consumeRaw);
|
||
|
||
// turn empty AtrulePrelude into null
|
||
if (prelude.type === 'AtrulePrelude' && prelude.children.head === null) {
|
||
prelude = null;
|
||
}
|
||
} else {
|
||
prelude = consumeRaw.call(this, this.scanner.tokenIndex);
|
||
}
|
||
|
||
this.scanner.skipSC();
|
||
}
|
||
|
||
switch (this.scanner.tokenType) {
|
||
case SEMICOLON:
|
||
this.scanner.next();
|
||
break;
|
||
|
||
case LEFTCURLYBRACKET:
|
||
if (this.atrule.hasOwnProperty(nameLowerCase) &&
|
||
typeof this.atrule[nameLowerCase].block === 'function') {
|
||
block = this.atrule[nameLowerCase].block.call(this);
|
||
} else {
|
||
// TODO: should consume block content as Raw?
|
||
block = this.Block(isDeclarationBlockAtrule.call(this));
|
||
}
|
||
|
||
break;
|
||
}
|
||
|
||
return {
|
||
type: 'Atrule',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
name: name,
|
||
prelude: prelude,
|
||
block: block
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('@');
|
||
this.chunk(node.name);
|
||
|
||
if (node.prelude !== null) {
|
||
this.chunk(' ');
|
||
this.node(node.prelude);
|
||
}
|
||
|
||
if (node.block) {
|
||
this.node(node.block);
|
||
} else {
|
||
this.chunk(';');
|
||
}
|
||
},
|
||
walkContext: 'atrule'
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 66 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var tokenizer = __webpack_require__(27);
|
||
var TYPE = tokenizer.TYPE;
|
||
|
||
var WhiteSpace = TYPE.WhiteSpace;
|
||
var Semicolon = TYPE.Semicolon;
|
||
var LeftCurlyBracket = TYPE.LeftCurlyBracket;
|
||
var Delim = TYPE.Delim;
|
||
var EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
|
||
|
||
function getOffsetExcludeWS() {
|
||
if (this.scanner.tokenIndex > 0) {
|
||
if (this.scanner.lookupType(-1) === WhiteSpace) {
|
||
return this.scanner.tokenIndex > 1
|
||
? this.scanner.getTokenStart(this.scanner.tokenIndex - 1)
|
||
: this.scanner.firstCharOffset;
|
||
}
|
||
}
|
||
|
||
return this.scanner.tokenStart;
|
||
}
|
||
|
||
// 0, 0, false
|
||
function balanceEnd() {
|
||
return 0;
|
||
}
|
||
|
||
// LEFTCURLYBRACKET, 0, false
|
||
function leftCurlyBracket(tokenType) {
|
||
return tokenType === LeftCurlyBracket ? 1 : 0;
|
||
}
|
||
|
||
// LEFTCURLYBRACKET, SEMICOLON, false
|
||
function leftCurlyBracketOrSemicolon(tokenType) {
|
||
return tokenType === LeftCurlyBracket || tokenType === Semicolon ? 1 : 0;
|
||
}
|
||
|
||
// EXCLAMATIONMARK, SEMICOLON, false
|
||
function exclamationMarkOrSemicolon(tokenType, source, offset) {
|
||
if (tokenType === Delim && source.charCodeAt(offset) === EXCLAMATIONMARK) {
|
||
return 1;
|
||
}
|
||
|
||
return tokenType === Semicolon ? 1 : 0;
|
||
}
|
||
|
||
// 0, SEMICOLON, true
|
||
function semicolonIncluded(tokenType) {
|
||
return tokenType === Semicolon ? 2 : 0;
|
||
}
|
||
|
||
module.exports = {
|
||
name: 'Raw',
|
||
structure: {
|
||
value: String
|
||
},
|
||
parse: function(startToken, mode, excludeWhiteSpace) {
|
||
var startOffset = this.scanner.getTokenStart(startToken);
|
||
var endOffset;
|
||
|
||
this.scanner.skip(
|
||
this.scanner.getRawLength(startToken, mode || balanceEnd)
|
||
);
|
||
|
||
if (excludeWhiteSpace && this.scanner.tokenStart > startOffset) {
|
||
endOffset = getOffsetExcludeWS.call(this);
|
||
} else {
|
||
endOffset = this.scanner.tokenStart;
|
||
}
|
||
|
||
return {
|
||
type: 'Raw',
|
||
loc: this.getLocation(startOffset, endOffset),
|
||
value: this.scanner.source.substring(startOffset, endOffset)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.value);
|
||
},
|
||
|
||
mode: {
|
||
default: balanceEnd,
|
||
leftCurlyBracket: leftCurlyBracket,
|
||
leftCurlyBracketOrSemicolon: leftCurlyBracketOrSemicolon,
|
||
exclamationMarkOrSemicolon: exclamationMarkOrSemicolon,
|
||
semicolonIncluded: semicolonIncluded
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 67 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var SEMICOLON = TYPE.Semicolon;
|
||
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
|
||
|
||
module.exports = {
|
||
name: 'AtrulePrelude',
|
||
structure: {
|
||
children: [[]]
|
||
},
|
||
parse: function(name) {
|
||
var children = null;
|
||
|
||
if (name !== null) {
|
||
name = name.toLowerCase();
|
||
}
|
||
|
||
this.scanner.skipSC();
|
||
|
||
if (this.atrule.hasOwnProperty(name) &&
|
||
typeof this.atrule[name].prelude === 'function') {
|
||
// custom consumer
|
||
children = this.atrule[name].prelude.call(this);
|
||
} else {
|
||
// default consumer
|
||
children = this.readSequence(this.scope.AtrulePrelude);
|
||
}
|
||
|
||
this.scanner.skipSC();
|
||
|
||
if (this.scanner.eof !== true &&
|
||
this.scanner.tokenType !== LEFTCURLYBRACKET &&
|
||
this.scanner.tokenType !== SEMICOLON) {
|
||
this.error('Semicolon or block is expected');
|
||
}
|
||
|
||
if (children === null) {
|
||
children = this.createList();
|
||
}
|
||
|
||
return {
|
||
type: 'AtrulePrelude',
|
||
loc: this.getLocationFromList(children),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.children(node);
|
||
},
|
||
walkContext: 'atrulePrelude'
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 68 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var STRING = TYPE.String;
|
||
var COLON = TYPE.Colon;
|
||
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
|
||
var RIGHTSQUAREBRACKET = TYPE.RightSquareBracket;
|
||
var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
|
||
var ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||
var EQUALSSIGN = 0x003D; // U+003D EQUALS SIGN (=)
|
||
var CIRCUMFLEXACCENT = 0x005E; // U+005E (^)
|
||
var VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
|
||
var TILDE = 0x007E; // U+007E TILDE (~)
|
||
|
||
function getAttributeName() {
|
||
if (this.scanner.eof) {
|
||
this.error('Unexpected end of input');
|
||
}
|
||
|
||
var start = this.scanner.tokenStart;
|
||
var expectIdent = false;
|
||
var checkColon = true;
|
||
|
||
if (this.scanner.isDelim(ASTERISK)) {
|
||
expectIdent = true;
|
||
checkColon = false;
|
||
this.scanner.next();
|
||
} else if (!this.scanner.isDelim(VERTICALLINE)) {
|
||
this.eat(IDENT);
|
||
}
|
||
|
||
if (this.scanner.isDelim(VERTICALLINE)) {
|
||
if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 1) !== EQUALSSIGN) {
|
||
this.scanner.next();
|
||
this.eat(IDENT);
|
||
} else if (expectIdent) {
|
||
this.error('Identifier is expected', this.scanner.tokenEnd);
|
||
}
|
||
} else if (expectIdent) {
|
||
this.error('Vertical line is expected');
|
||
}
|
||
|
||
if (checkColon && this.scanner.tokenType === COLON) {
|
||
this.scanner.next();
|
||
this.eat(IDENT);
|
||
}
|
||
|
||
return {
|
||
type: 'Identifier',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
name: this.scanner.substrToCursor(start)
|
||
};
|
||
}
|
||
|
||
function getOperator() {
|
||
var start = this.scanner.tokenStart;
|
||
var code = this.scanner.source.charCodeAt(start);
|
||
|
||
if (code !== EQUALSSIGN && // =
|
||
code !== TILDE && // ~=
|
||
code !== CIRCUMFLEXACCENT && // ^=
|
||
code !== DOLLARSIGN && // $=
|
||
code !== ASTERISK && // *=
|
||
code !== VERTICALLINE // |=
|
||
) {
|
||
this.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');
|
||
}
|
||
|
||
this.scanner.next();
|
||
|
||
if (code !== EQUALSSIGN) {
|
||
if (!this.scanner.isDelim(EQUALSSIGN)) {
|
||
this.error('Equal sign is expected');
|
||
}
|
||
|
||
this.scanner.next();
|
||
}
|
||
|
||
return this.scanner.substrToCursor(start);
|
||
}
|
||
|
||
// '[' <wq-name> ']'
|
||
// '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'
|
||
module.exports = {
|
||
name: 'AttributeSelector',
|
||
structure: {
|
||
name: 'Identifier',
|
||
matcher: [String, null],
|
||
value: ['String', 'Identifier', null],
|
||
flags: [String, null]
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var name;
|
||
var matcher = null;
|
||
var value = null;
|
||
var flags = null;
|
||
|
||
this.eat(LEFTSQUAREBRACKET);
|
||
this.scanner.skipSC();
|
||
|
||
name = getAttributeName.call(this);
|
||
this.scanner.skipSC();
|
||
|
||
if (this.scanner.tokenType !== RIGHTSQUAREBRACKET) {
|
||
// avoid case `[name i]`
|
||
if (this.scanner.tokenType !== IDENT) {
|
||
matcher = getOperator.call(this);
|
||
|
||
this.scanner.skipSC();
|
||
|
||
value = this.scanner.tokenType === STRING
|
||
? this.String()
|
||
: this.Identifier();
|
||
|
||
this.scanner.skipSC();
|
||
}
|
||
|
||
// attribute flags
|
||
if (this.scanner.tokenType === IDENT) {
|
||
flags = this.scanner.getTokenValue();
|
||
this.scanner.next();
|
||
|
||
this.scanner.skipSC();
|
||
}
|
||
}
|
||
|
||
this.eat(RIGHTSQUAREBRACKET);
|
||
|
||
return {
|
||
type: 'AttributeSelector',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
name: name,
|
||
matcher: matcher,
|
||
value: value,
|
||
flags: flags
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
var flagsPrefix = ' ';
|
||
|
||
this.chunk('[');
|
||
this.node(node.name);
|
||
|
||
if (node.matcher !== null) {
|
||
this.chunk(node.matcher);
|
||
|
||
if (node.value !== null) {
|
||
this.node(node.value);
|
||
|
||
// space between string and flags is not required
|
||
if (node.value.type === 'String') {
|
||
flagsPrefix = '';
|
||
}
|
||
}
|
||
}
|
||
|
||
if (node.flags !== null) {
|
||
this.chunk(flagsPrefix);
|
||
this.chunk(node.flags);
|
||
}
|
||
|
||
this.chunk(']');
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 69 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
var rawMode = __webpack_require__(66).mode;
|
||
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var COMMENT = TYPE.Comment;
|
||
var SEMICOLON = TYPE.Semicolon;
|
||
var ATKEYWORD = TYPE.AtKeyword;
|
||
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
|
||
var RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;
|
||
|
||
function consumeRaw(startToken) {
|
||
return this.Raw(startToken, null, true);
|
||
}
|
||
function consumeRule() {
|
||
return this.parseWithFallback(this.Rule, consumeRaw);
|
||
}
|
||
function consumeRawDeclaration(startToken) {
|
||
return this.Raw(startToken, rawMode.semicolonIncluded, true);
|
||
}
|
||
function consumeDeclaration() {
|
||
if (this.scanner.tokenType === SEMICOLON) {
|
||
return consumeRawDeclaration.call(this, this.scanner.tokenIndex);
|
||
}
|
||
|
||
var node = this.parseWithFallback(this.Declaration, consumeRawDeclaration);
|
||
|
||
if (this.scanner.tokenType === SEMICOLON) {
|
||
this.scanner.next();
|
||
}
|
||
|
||
return node;
|
||
}
|
||
|
||
module.exports = {
|
||
name: 'Block',
|
||
structure: {
|
||
children: [[
|
||
'Atrule',
|
||
'Rule',
|
||
'Declaration'
|
||
]]
|
||
},
|
||
parse: function(isDeclaration) {
|
||
var consumer = isDeclaration ? consumeDeclaration : consumeRule;
|
||
|
||
var start = this.scanner.tokenStart;
|
||
var children = this.createList();
|
||
|
||
this.eat(LEFTCURLYBRACKET);
|
||
|
||
scan:
|
||
while (!this.scanner.eof) {
|
||
switch (this.scanner.tokenType) {
|
||
case RIGHTCURLYBRACKET:
|
||
break scan;
|
||
|
||
case WHITESPACE:
|
||
case COMMENT:
|
||
this.scanner.next();
|
||
break;
|
||
|
||
case ATKEYWORD:
|
||
children.push(this.parseWithFallback(this.Atrule, consumeRaw));
|
||
break;
|
||
|
||
default:
|
||
children.push(consumer.call(this));
|
||
}
|
||
}
|
||
|
||
if (!this.scanner.eof) {
|
||
this.eat(RIGHTCURLYBRACKET);
|
||
}
|
||
|
||
return {
|
||
type: 'Block',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('{');
|
||
this.children(node, function(prev) {
|
||
if (prev.type === 'Declaration') {
|
||
this.chunk(';');
|
||
}
|
||
});
|
||
this.chunk('}');
|
||
},
|
||
walkContext: 'block'
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 70 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
|
||
var RIGHTSQUAREBRACKET = TYPE.RightSquareBracket;
|
||
|
||
module.exports = {
|
||
name: 'Brackets',
|
||
structure: {
|
||
children: [[]]
|
||
},
|
||
parse: function(readSequence, recognizer) {
|
||
var start = this.scanner.tokenStart;
|
||
var children = null;
|
||
|
||
this.eat(LEFTSQUAREBRACKET);
|
||
|
||
children = readSequence.call(this, recognizer);
|
||
|
||
if (!this.scanner.eof) {
|
||
this.eat(RIGHTSQUAREBRACKET);
|
||
}
|
||
|
||
return {
|
||
type: 'Brackets',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('[');
|
||
this.children(node);
|
||
this.chunk(']');
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 71 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var CDC = __webpack_require__(27).TYPE.CDC;
|
||
|
||
module.exports = {
|
||
name: 'CDC',
|
||
structure: [],
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
|
||
this.eat(CDC); // -->
|
||
|
||
return {
|
||
type: 'CDC',
|
||
loc: this.getLocation(start, this.scanner.tokenStart)
|
||
};
|
||
},
|
||
generate: function() {
|
||
this.chunk('-->');
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 72 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var CDO = __webpack_require__(27).TYPE.CDO;
|
||
|
||
module.exports = {
|
||
name: 'CDO',
|
||
structure: [],
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
|
||
this.eat(CDO); // <!--
|
||
|
||
return {
|
||
type: 'CDO',
|
||
loc: this.getLocation(start, this.scanner.tokenStart)
|
||
};
|
||
},
|
||
generate: function() {
|
||
this.chunk('<!--');
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 73 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
|
||
|
||
// '.' ident
|
||
module.exports = {
|
||
name: 'ClassSelector',
|
||
structure: {
|
||
name: String
|
||
},
|
||
parse: function() {
|
||
if (!this.scanner.isDelim(FULLSTOP)) {
|
||
this.error('Full stop is expected');
|
||
}
|
||
|
||
this.scanner.next();
|
||
|
||
return {
|
||
type: 'ClassSelector',
|
||
loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
|
||
name: this.consume(IDENT)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('.');
|
||
this.chunk(node.name);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 74 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||
var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||
var GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>)
|
||
var TILDE = 0x007E; // U+007E TILDE (~)
|
||
|
||
// + | > | ~ | /deep/
|
||
module.exports = {
|
||
name: 'Combinator',
|
||
structure: {
|
||
name: String
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
|
||
|
||
switch (code) {
|
||
case GREATERTHANSIGN:
|
||
case PLUSSIGN:
|
||
case TILDE:
|
||
this.scanner.next();
|
||
break;
|
||
|
||
case SOLIDUS:
|
||
this.scanner.next();
|
||
|
||
if (this.scanner.tokenType !== IDENT || this.scanner.lookupValue(0, 'deep') === false) {
|
||
this.error('Identifier `deep` is expected');
|
||
}
|
||
|
||
this.scanner.next();
|
||
|
||
if (!this.scanner.isDelim(SOLIDUS)) {
|
||
this.error('Solidus is expected');
|
||
}
|
||
|
||
this.scanner.next();
|
||
break;
|
||
|
||
default:
|
||
this.error('Combinator is expected');
|
||
}
|
||
|
||
return {
|
||
type: 'Combinator',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
name: this.scanner.substrToCursor(start)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.name);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 75 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var COMMENT = TYPE.Comment;
|
||
var ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||
var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||
|
||
// '/*' .* '*/'
|
||
module.exports = {
|
||
name: 'Comment',
|
||
structure: {
|
||
value: String
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var end = this.scanner.tokenEnd;
|
||
|
||
this.eat(COMMENT);
|
||
|
||
if ((end - start + 2) >= 2 &&
|
||
this.scanner.source.charCodeAt(end - 2) === ASTERISK &&
|
||
this.scanner.source.charCodeAt(end - 1) === SOLIDUS) {
|
||
end -= 2;
|
||
}
|
||
|
||
return {
|
||
type: 'Comment',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
value: this.scanner.source.substring(start + 2, end)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('/*');
|
||
this.chunk(node.value);
|
||
this.chunk('*/');
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 76 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var isCustomProperty = __webpack_require__(25).isCustomProperty;
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
var rawMode = __webpack_require__(66).mode;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var HASH = TYPE.Hash;
|
||
var COLON = TYPE.Colon;
|
||
var SEMICOLON = TYPE.Semicolon;
|
||
var DELIM = TYPE.Delim;
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
|
||
var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
|
||
var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
|
||
var AMPERSAND = 0x0026; // U+0026 ANPERSAND (&)
|
||
var ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||
var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||
|
||
function consumeValueRaw(startToken) {
|
||
return this.Raw(startToken, rawMode.exclamationMarkOrSemicolon, true);
|
||
}
|
||
|
||
function consumeCustomPropertyRaw(startToken) {
|
||
return this.Raw(startToken, rawMode.exclamationMarkOrSemicolon, false);
|
||
}
|
||
|
||
function consumeValue() {
|
||
var startValueToken = this.scanner.tokenIndex;
|
||
var value = this.Value();
|
||
|
||
if (value.type !== 'Raw' &&
|
||
this.scanner.eof === false &&
|
||
this.scanner.tokenType !== SEMICOLON &&
|
||
this.scanner.isDelim(EXCLAMATIONMARK) === false &&
|
||
this.scanner.isBalanceEdge(startValueToken) === false) {
|
||
this.error();
|
||
}
|
||
|
||
return value;
|
||
}
|
||
|
||
module.exports = {
|
||
name: 'Declaration',
|
||
structure: {
|
||
important: [Boolean, String],
|
||
property: String,
|
||
value: ['Value', 'Raw']
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var startToken = this.scanner.tokenIndex;
|
||
var property = readProperty.call(this);
|
||
var customProperty = isCustomProperty(property);
|
||
var parseValue = customProperty ? this.parseCustomProperty : this.parseValue;
|
||
var consumeRaw = customProperty ? consumeCustomPropertyRaw : consumeValueRaw;
|
||
var important = false;
|
||
var value;
|
||
|
||
this.scanner.skipSC();
|
||
this.eat(COLON);
|
||
|
||
const valueStart = this.scanner.tokenIndex;
|
||
|
||
if (!customProperty) {
|
||
this.scanner.skipSC();
|
||
}
|
||
|
||
if (parseValue) {
|
||
value = this.parseWithFallback(consumeValue, consumeRaw);
|
||
} else {
|
||
value = consumeRaw.call(this, this.scanner.tokenIndex);
|
||
}
|
||
|
||
if (customProperty && value.type === 'Value' && value.children.isEmpty()) {
|
||
for (let offset = valueStart - this.scanner.tokenIndex; offset <= 0; offset++) {
|
||
if (this.scanner.lookupType(offset) === WHITESPACE) {
|
||
value.children.appendData({
|
||
type: 'WhiteSpace',
|
||
loc: null,
|
||
value: ' '
|
||
});
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (this.scanner.isDelim(EXCLAMATIONMARK)) {
|
||
important = getImportant.call(this);
|
||
this.scanner.skipSC();
|
||
}
|
||
|
||
// Do not include semicolon to range per spec
|
||
// https://drafts.csswg.org/css-syntax/#declaration-diagram
|
||
|
||
if (this.scanner.eof === false &&
|
||
this.scanner.tokenType !== SEMICOLON &&
|
||
this.scanner.isBalanceEdge(startToken) === false) {
|
||
this.error();
|
||
}
|
||
|
||
return {
|
||
type: 'Declaration',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
important: important,
|
||
property: property,
|
||
value: value
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.property);
|
||
this.chunk(':');
|
||
this.node(node.value);
|
||
|
||
if (node.important) {
|
||
this.chunk(node.important === true ? '!important' : '!' + node.important);
|
||
}
|
||
},
|
||
walkContext: 'declaration'
|
||
};
|
||
|
||
function readProperty() {
|
||
var start = this.scanner.tokenStart;
|
||
var prefix = 0;
|
||
|
||
// hacks
|
||
if (this.scanner.tokenType === DELIM) {
|
||
switch (this.scanner.source.charCodeAt(this.scanner.tokenStart)) {
|
||
case ASTERISK:
|
||
case DOLLARSIGN:
|
||
case PLUSSIGN:
|
||
case NUMBERSIGN:
|
||
case AMPERSAND:
|
||
this.scanner.next();
|
||
break;
|
||
|
||
// TODO: not sure we should support this hack
|
||
case SOLIDUS:
|
||
this.scanner.next();
|
||
if (this.scanner.isDelim(SOLIDUS)) {
|
||
this.scanner.next();
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (prefix) {
|
||
this.scanner.skip(prefix);
|
||
}
|
||
|
||
if (this.scanner.tokenType === HASH) {
|
||
this.eat(HASH);
|
||
} else {
|
||
this.eat(IDENT);
|
||
}
|
||
|
||
return this.scanner.substrToCursor(start);
|
||
}
|
||
|
||
// ! ws* important
|
||
function getImportant() {
|
||
this.eat(DELIM);
|
||
this.scanner.skipSC();
|
||
|
||
var important = this.consume(IDENT);
|
||
|
||
// store original value in case it differ from `important`
|
||
// for better original source restoring and hacks like `!ie` support
|
||
return important === 'important' ? true : important;
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
/* 77 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
var rawMode = __webpack_require__(66).mode;
|
||
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var COMMENT = TYPE.Comment;
|
||
var SEMICOLON = TYPE.Semicolon;
|
||
|
||
function consumeRaw(startToken) {
|
||
return this.Raw(startToken, rawMode.semicolonIncluded, true);
|
||
}
|
||
|
||
module.exports = {
|
||
name: 'DeclarationList',
|
||
structure: {
|
||
children: [[
|
||
'Declaration'
|
||
]]
|
||
},
|
||
parse: function() {
|
||
var children = this.createList();
|
||
|
||
scan:
|
||
while (!this.scanner.eof) {
|
||
switch (this.scanner.tokenType) {
|
||
case WHITESPACE:
|
||
case COMMENT:
|
||
case SEMICOLON:
|
||
this.scanner.next();
|
||
break;
|
||
|
||
default:
|
||
children.push(this.parseWithFallback(this.Declaration, consumeRaw));
|
||
}
|
||
}
|
||
|
||
return {
|
||
type: 'DeclarationList',
|
||
loc: this.getLocationFromList(children),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.children(node, function(prev) {
|
||
if (prev.type === 'Declaration') {
|
||
this.chunk(';');
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 78 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var consumeNumber = __webpack_require__(20).consumeNumber;
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var DIMENSION = TYPE.Dimension;
|
||
|
||
module.exports = {
|
||
name: 'Dimension',
|
||
structure: {
|
||
value: String,
|
||
unit: String
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var numberEnd = consumeNumber(this.scanner.source, start);
|
||
|
||
this.eat(DIMENSION);
|
||
|
||
return {
|
||
type: 'Dimension',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
value: this.scanner.source.substring(start, numberEnd),
|
||
unit: this.scanner.source.substring(numberEnd, this.scanner.tokenStart)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.value);
|
||
this.chunk(node.unit);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 79 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||
|
||
// <function-token> <sequence> )
|
||
module.exports = {
|
||
name: 'Function',
|
||
structure: {
|
||
name: String,
|
||
children: [[]]
|
||
},
|
||
parse: function(readSequence, recognizer) {
|
||
var start = this.scanner.tokenStart;
|
||
var name = this.consumeFunctionName();
|
||
var nameLowerCase = name.toLowerCase();
|
||
var children;
|
||
|
||
children = recognizer.hasOwnProperty(nameLowerCase)
|
||
? recognizer[nameLowerCase].call(this, recognizer)
|
||
: readSequence.call(this, recognizer);
|
||
|
||
if (!this.scanner.eof) {
|
||
this.eat(RIGHTPARENTHESIS);
|
||
}
|
||
|
||
return {
|
||
type: 'Function',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
name: name,
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.name);
|
||
this.chunk('(');
|
||
this.children(node);
|
||
this.chunk(')');
|
||
},
|
||
walkContext: 'function'
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 80 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var HASH = TYPE.Hash;
|
||
|
||
// '#' ident
|
||
module.exports = {
|
||
name: 'Hash',
|
||
structure: {
|
||
value: String
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
|
||
this.eat(HASH);
|
||
|
||
return {
|
||
type: 'Hash',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
value: this.scanner.substrToCursor(start + 1)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('#');
|
||
this.chunk(node.value);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 81 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
|
||
module.exports = {
|
||
name: 'Identifier',
|
||
structure: {
|
||
name: String
|
||
},
|
||
parse: function() {
|
||
return {
|
||
type: 'Identifier',
|
||
loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
|
||
name: this.consume(IDENT)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.name);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 82 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var HASH = TYPE.Hash;
|
||
|
||
// <hash-token>
|
||
module.exports = {
|
||
name: 'IdSelector',
|
||
structure: {
|
||
name: String
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
|
||
// TODO: check value is an ident
|
||
this.eat(HASH);
|
||
|
||
return {
|
||
type: 'IdSelector',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
name: this.scanner.substrToCursor(start + 1)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('#');
|
||
this.chunk(node.name);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 83 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var NUMBER = TYPE.Number;
|
||
var DIMENSION = TYPE.Dimension;
|
||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||
var COLON = TYPE.Colon;
|
||
var DELIM = TYPE.Delim;
|
||
|
||
module.exports = {
|
||
name: 'MediaFeature',
|
||
structure: {
|
||
name: String,
|
||
value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var name;
|
||
var value = null;
|
||
|
||
this.eat(LEFTPARENTHESIS);
|
||
this.scanner.skipSC();
|
||
|
||
name = this.consume(IDENT);
|
||
this.scanner.skipSC();
|
||
|
||
if (this.scanner.tokenType !== RIGHTPARENTHESIS) {
|
||
this.eat(COLON);
|
||
this.scanner.skipSC();
|
||
|
||
switch (this.scanner.tokenType) {
|
||
case NUMBER:
|
||
if (this.lookupNonWSType(1) === DELIM) {
|
||
value = this.Ratio();
|
||
} else {
|
||
value = this.Number();
|
||
}
|
||
|
||
break;
|
||
|
||
case DIMENSION:
|
||
value = this.Dimension();
|
||
break;
|
||
|
||
case IDENT:
|
||
value = this.Identifier();
|
||
|
||
break;
|
||
|
||
default:
|
||
this.error('Number, dimension, ratio or identifier is expected');
|
||
}
|
||
|
||
this.scanner.skipSC();
|
||
}
|
||
|
||
this.eat(RIGHTPARENTHESIS);
|
||
|
||
return {
|
||
type: 'MediaFeature',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
name: name,
|
||
value: value
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('(');
|
||
this.chunk(node.name);
|
||
if (node.value !== null) {
|
||
this.chunk(':');
|
||
this.node(node.value);
|
||
}
|
||
this.chunk(')');
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 84 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var COMMENT = TYPE.Comment;
|
||
var IDENT = TYPE.Ident;
|
||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||
|
||
module.exports = {
|
||
name: 'MediaQuery',
|
||
structure: {
|
||
children: [[
|
||
'Identifier',
|
||
'MediaFeature',
|
||
'WhiteSpace'
|
||
]]
|
||
},
|
||
parse: function() {
|
||
this.scanner.skipSC();
|
||
|
||
var children = this.createList();
|
||
var child = null;
|
||
var space = null;
|
||
|
||
scan:
|
||
while (!this.scanner.eof) {
|
||
switch (this.scanner.tokenType) {
|
||
case COMMENT:
|
||
this.scanner.next();
|
||
continue;
|
||
|
||
case WHITESPACE:
|
||
space = this.WhiteSpace();
|
||
continue;
|
||
|
||
case IDENT:
|
||
child = this.Identifier();
|
||
break;
|
||
|
||
case LEFTPARENTHESIS:
|
||
child = this.MediaFeature();
|
||
break;
|
||
|
||
default:
|
||
break scan;
|
||
}
|
||
|
||
if (space !== null) {
|
||
children.push(space);
|
||
space = null;
|
||
}
|
||
|
||
children.push(child);
|
||
}
|
||
|
||
if (child === null) {
|
||
this.error('Identifier or parenthesis is expected');
|
||
}
|
||
|
||
return {
|
||
type: 'MediaQuery',
|
||
loc: this.getLocationFromList(children),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.children(node);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 85 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var COMMA = __webpack_require__(27).TYPE.Comma;
|
||
|
||
module.exports = {
|
||
name: 'MediaQueryList',
|
||
structure: {
|
||
children: [[
|
||
'MediaQuery'
|
||
]]
|
||
},
|
||
parse: function(relative) {
|
||
var children = this.createList();
|
||
|
||
this.scanner.skipSC();
|
||
|
||
while (!this.scanner.eof) {
|
||
children.push(this.MediaQuery(relative));
|
||
|
||
if (this.scanner.tokenType !== COMMA) {
|
||
break;
|
||
}
|
||
|
||
this.scanner.next();
|
||
}
|
||
|
||
return {
|
||
type: 'MediaQueryList',
|
||
loc: this.getLocationFromList(children),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.children(node, function() {
|
||
this.chunk(',');
|
||
});
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 86 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
name: 'Nth',
|
||
structure: {
|
||
nth: ['AnPlusB', 'Identifier'],
|
||
selector: ['SelectorList', null]
|
||
},
|
||
parse: function(allowOfClause) {
|
||
this.scanner.skipSC();
|
||
|
||
var start = this.scanner.tokenStart;
|
||
var end = start;
|
||
var selector = null;
|
||
var query;
|
||
|
||
if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
|
||
query = this.Identifier();
|
||
} else {
|
||
query = this.AnPlusB();
|
||
}
|
||
|
||
this.scanner.skipSC();
|
||
|
||
if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
|
||
this.scanner.next();
|
||
|
||
selector = this.SelectorList();
|
||
|
||
if (this.needPositions) {
|
||
end = this.getLastListNode(selector.children).loc.end.offset;
|
||
}
|
||
} else {
|
||
if (this.needPositions) {
|
||
end = query.loc.end.offset;
|
||
}
|
||
}
|
||
|
||
return {
|
||
type: 'Nth',
|
||
loc: this.getLocation(start, end),
|
||
nth: query,
|
||
selector: selector
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.node(node.nth);
|
||
if (node.selector !== null) {
|
||
this.chunk(' of ');
|
||
this.node(node.selector);
|
||
}
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 87 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var NUMBER = __webpack_require__(27).TYPE.Number;
|
||
|
||
module.exports = {
|
||
name: 'Number',
|
||
structure: {
|
||
value: String
|
||
},
|
||
parse: function() {
|
||
return {
|
||
type: 'Number',
|
||
loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
|
||
value: this.consume(NUMBER)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.value);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 88 */
|
||
/***/ ((module) => {
|
||
|
||
// '/' | '*' | ',' | ':' | '+' | '-'
|
||
module.exports = {
|
||
name: 'Operator',
|
||
structure: {
|
||
value: String
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
|
||
this.scanner.next();
|
||
|
||
return {
|
||
type: 'Operator',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
value: this.scanner.substrToCursor(start)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.value);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 89 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||
|
||
module.exports = {
|
||
name: 'Parentheses',
|
||
structure: {
|
||
children: [[]]
|
||
},
|
||
parse: function(readSequence, recognizer) {
|
||
var start = this.scanner.tokenStart;
|
||
var children = null;
|
||
|
||
this.eat(LEFTPARENTHESIS);
|
||
|
||
children = readSequence.call(this, recognizer);
|
||
|
||
if (!this.scanner.eof) {
|
||
this.eat(RIGHTPARENTHESIS);
|
||
}
|
||
|
||
return {
|
||
type: 'Parentheses',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('(');
|
||
this.children(node);
|
||
this.chunk(')');
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 90 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var consumeNumber = __webpack_require__(20).consumeNumber;
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var PERCENTAGE = TYPE.Percentage;
|
||
|
||
module.exports = {
|
||
name: 'Percentage',
|
||
structure: {
|
||
value: String
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var numberEnd = consumeNumber(this.scanner.source, start);
|
||
|
||
this.eat(PERCENTAGE);
|
||
|
||
return {
|
||
type: 'Percentage',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
value: this.scanner.source.substring(start, numberEnd)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.value);
|
||
this.chunk('%');
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 91 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var FUNCTION = TYPE.Function;
|
||
var COLON = TYPE.Colon;
|
||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||
|
||
// : [ <ident> | <function-token> <any-value>? ) ]
|
||
module.exports = {
|
||
name: 'PseudoClassSelector',
|
||
structure: {
|
||
name: String,
|
||
children: [['Raw'], null]
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var children = null;
|
||
var name;
|
||
var nameLowerCase;
|
||
|
||
this.eat(COLON);
|
||
|
||
if (this.scanner.tokenType === FUNCTION) {
|
||
name = this.consumeFunctionName();
|
||
nameLowerCase = name.toLowerCase();
|
||
|
||
if (this.pseudo.hasOwnProperty(nameLowerCase)) {
|
||
this.scanner.skipSC();
|
||
children = this.pseudo[nameLowerCase].call(this);
|
||
this.scanner.skipSC();
|
||
} else {
|
||
children = this.createList();
|
||
children.push(
|
||
this.Raw(this.scanner.tokenIndex, null, false)
|
||
);
|
||
}
|
||
|
||
this.eat(RIGHTPARENTHESIS);
|
||
} else {
|
||
name = this.consume(IDENT);
|
||
}
|
||
|
||
return {
|
||
type: 'PseudoClassSelector',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
name: name,
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(':');
|
||
this.chunk(node.name);
|
||
|
||
if (node.children !== null) {
|
||
this.chunk('(');
|
||
this.children(node);
|
||
this.chunk(')');
|
||
}
|
||
},
|
||
walkContext: 'function'
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 92 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var FUNCTION = TYPE.Function;
|
||
var COLON = TYPE.Colon;
|
||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||
|
||
// :: [ <ident> | <function-token> <any-value>? ) ]
|
||
module.exports = {
|
||
name: 'PseudoElementSelector',
|
||
structure: {
|
||
name: String,
|
||
children: [['Raw'], null]
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var children = null;
|
||
var name;
|
||
var nameLowerCase;
|
||
|
||
this.eat(COLON);
|
||
this.eat(COLON);
|
||
|
||
if (this.scanner.tokenType === FUNCTION) {
|
||
name = this.consumeFunctionName();
|
||
nameLowerCase = name.toLowerCase();
|
||
|
||
if (this.pseudo.hasOwnProperty(nameLowerCase)) {
|
||
this.scanner.skipSC();
|
||
children = this.pseudo[nameLowerCase].call(this);
|
||
this.scanner.skipSC();
|
||
} else {
|
||
children = this.createList();
|
||
children.push(
|
||
this.Raw(this.scanner.tokenIndex, null, false)
|
||
);
|
||
}
|
||
|
||
this.eat(RIGHTPARENTHESIS);
|
||
} else {
|
||
name = this.consume(IDENT);
|
||
}
|
||
|
||
return {
|
||
type: 'PseudoElementSelector',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
name: name,
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('::');
|
||
this.chunk(node.name);
|
||
|
||
if (node.children !== null) {
|
||
this.chunk('(');
|
||
this.children(node);
|
||
this.chunk(')');
|
||
}
|
||
},
|
||
walkContext: 'function'
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 93 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var isDigit = __webpack_require__(27).isDigit;
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var NUMBER = TYPE.Number;
|
||
var DELIM = TYPE.Delim;
|
||
var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||
var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
|
||
|
||
// Terms of <ratio> should be a positive numbers (not zero or negative)
|
||
// (see https://drafts.csswg.org/mediaqueries-3/#values)
|
||
// However, -o-min-device-pixel-ratio takes fractional values as a ratio's term
|
||
// and this is using by various sites. Therefore we relax checking on parse
|
||
// to test a term is unsigned number without an exponent part.
|
||
// Additional checking may be applied on lexer validation.
|
||
function consumeNumber() {
|
||
this.scanner.skipWS();
|
||
|
||
var value = this.consume(NUMBER);
|
||
|
||
for (var i = 0; i < value.length; i++) {
|
||
var code = value.charCodeAt(i);
|
||
if (!isDigit(code) && code !== FULLSTOP) {
|
||
this.error('Unsigned number is expected', this.scanner.tokenStart - value.length + i);
|
||
}
|
||
}
|
||
|
||
if (Number(value) === 0) {
|
||
this.error('Zero number is not allowed', this.scanner.tokenStart - value.length);
|
||
}
|
||
|
||
return value;
|
||
}
|
||
|
||
// <positive-integer> S* '/' S* <positive-integer>
|
||
module.exports = {
|
||
name: 'Ratio',
|
||
structure: {
|
||
left: String,
|
||
right: String
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var left = consumeNumber.call(this);
|
||
var right;
|
||
|
||
this.scanner.skipWS();
|
||
|
||
if (!this.scanner.isDelim(SOLIDUS)) {
|
||
this.error('Solidus is expected');
|
||
}
|
||
this.eat(DELIM);
|
||
right = consumeNumber.call(this);
|
||
|
||
return {
|
||
type: 'Ratio',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
left: left,
|
||
right: right
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.left);
|
||
this.chunk('/');
|
||
this.chunk(node.right);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 94 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
var rawMode = __webpack_require__(66).mode;
|
||
|
||
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
|
||
|
||
function consumeRaw(startToken) {
|
||
return this.Raw(startToken, rawMode.leftCurlyBracket, true);
|
||
}
|
||
|
||
function consumePrelude() {
|
||
var prelude = this.SelectorList();
|
||
|
||
if (prelude.type !== 'Raw' &&
|
||
this.scanner.eof === false &&
|
||
this.scanner.tokenType !== LEFTCURLYBRACKET) {
|
||
this.error();
|
||
}
|
||
|
||
return prelude;
|
||
}
|
||
|
||
module.exports = {
|
||
name: 'Rule',
|
||
structure: {
|
||
prelude: ['SelectorList', 'Raw'],
|
||
block: ['Block']
|
||
},
|
||
parse: function() {
|
||
var startToken = this.scanner.tokenIndex;
|
||
var startOffset = this.scanner.tokenStart;
|
||
var prelude;
|
||
var block;
|
||
|
||
if (this.parseRulePrelude) {
|
||
prelude = this.parseWithFallback(consumePrelude, consumeRaw);
|
||
} else {
|
||
prelude = consumeRaw.call(this, startToken);
|
||
}
|
||
|
||
block = this.Block(true);
|
||
|
||
return {
|
||
type: 'Rule',
|
||
loc: this.getLocation(startOffset, this.scanner.tokenStart),
|
||
prelude: prelude,
|
||
block: block
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.node(node.prelude);
|
||
this.node(node.block);
|
||
},
|
||
walkContext: 'rule'
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 95 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
name: 'Selector',
|
||
structure: {
|
||
children: [[
|
||
'TypeSelector',
|
||
'IdSelector',
|
||
'ClassSelector',
|
||
'AttributeSelector',
|
||
'PseudoClassSelector',
|
||
'PseudoElementSelector',
|
||
'Combinator',
|
||
'WhiteSpace'
|
||
]]
|
||
},
|
||
parse: function() {
|
||
var children = this.readSequence(this.scope.Selector);
|
||
|
||
// nothing were consumed
|
||
if (this.getFirstListNode(children) === null) {
|
||
this.error('Selector is expected');
|
||
}
|
||
|
||
return {
|
||
type: 'Selector',
|
||
loc: this.getLocationFromList(children),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.children(node);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 96 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var COMMA = TYPE.Comma;
|
||
|
||
module.exports = {
|
||
name: 'SelectorList',
|
||
structure: {
|
||
children: [[
|
||
'Selector',
|
||
'Raw'
|
||
]]
|
||
},
|
||
parse: function() {
|
||
var children = this.createList();
|
||
|
||
while (!this.scanner.eof) {
|
||
children.push(this.Selector());
|
||
|
||
if (this.scanner.tokenType === COMMA) {
|
||
this.scanner.next();
|
||
continue;
|
||
}
|
||
|
||
break;
|
||
}
|
||
|
||
return {
|
||
type: 'SelectorList',
|
||
loc: this.getLocationFromList(children),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.children(node, function() {
|
||
this.chunk(',');
|
||
});
|
||
},
|
||
walkContext: 'selector'
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 97 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var STRING = __webpack_require__(27).TYPE.String;
|
||
|
||
module.exports = {
|
||
name: 'String',
|
||
structure: {
|
||
value: String
|
||
},
|
||
parse: function() {
|
||
return {
|
||
type: 'String',
|
||
loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
|
||
value: this.consume(STRING)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.value);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 98 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var COMMENT = TYPE.Comment;
|
||
var ATKEYWORD = TYPE.AtKeyword;
|
||
var CDO = TYPE.CDO;
|
||
var CDC = TYPE.CDC;
|
||
var EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
|
||
|
||
function consumeRaw(startToken) {
|
||
return this.Raw(startToken, null, false);
|
||
}
|
||
|
||
module.exports = {
|
||
name: 'StyleSheet',
|
||
structure: {
|
||
children: [[
|
||
'Comment',
|
||
'CDO',
|
||
'CDC',
|
||
'Atrule',
|
||
'Rule',
|
||
'Raw'
|
||
]]
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var children = this.createList();
|
||
var child;
|
||
|
||
scan:
|
||
while (!this.scanner.eof) {
|
||
switch (this.scanner.tokenType) {
|
||
case WHITESPACE:
|
||
this.scanner.next();
|
||
continue;
|
||
|
||
case COMMENT:
|
||
// ignore comments except exclamation comments (i.e. /*! .. */) on top level
|
||
if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 2) !== EXCLAMATIONMARK) {
|
||
this.scanner.next();
|
||
continue;
|
||
}
|
||
|
||
child = this.Comment();
|
||
break;
|
||
|
||
case CDO: // <!--
|
||
child = this.CDO();
|
||
break;
|
||
|
||
case CDC: // -->
|
||
child = this.CDC();
|
||
break;
|
||
|
||
// CSS Syntax Module Level 3
|
||
// §2.2 Error handling
|
||
// At the "top level" of a stylesheet, an <at-keyword-token> starts an at-rule.
|
||
case ATKEYWORD:
|
||
child = this.parseWithFallback(this.Atrule, consumeRaw);
|
||
break;
|
||
|
||
// Anything else starts a qualified rule ...
|
||
default:
|
||
child = this.parseWithFallback(this.Rule, consumeRaw);
|
||
}
|
||
|
||
children.push(child);
|
||
}
|
||
|
||
return {
|
||
type: 'StyleSheet',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.children(node);
|
||
},
|
||
walkContext: 'stylesheet'
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 99 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||
var VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
|
||
|
||
function eatIdentifierOrAsterisk() {
|
||
if (this.scanner.tokenType !== IDENT &&
|
||
this.scanner.isDelim(ASTERISK) === false) {
|
||
this.error('Identifier or asterisk is expected');
|
||
}
|
||
|
||
this.scanner.next();
|
||
}
|
||
|
||
// ident
|
||
// ident|ident
|
||
// ident|*
|
||
// *
|
||
// *|ident
|
||
// *|*
|
||
// |ident
|
||
// |*
|
||
module.exports = {
|
||
name: 'TypeSelector',
|
||
structure: {
|
||
name: String
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
|
||
if (this.scanner.isDelim(VERTICALLINE)) {
|
||
this.scanner.next();
|
||
eatIdentifierOrAsterisk.call(this);
|
||
} else {
|
||
eatIdentifierOrAsterisk.call(this);
|
||
|
||
if (this.scanner.isDelim(VERTICALLINE)) {
|
||
this.scanner.next();
|
||
eatIdentifierOrAsterisk.call(this);
|
||
}
|
||
}
|
||
|
||
return {
|
||
type: 'TypeSelector',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
name: this.scanner.substrToCursor(start)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.name);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 100 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var isHexDigit = __webpack_require__(27).isHexDigit;
|
||
var cmpChar = __webpack_require__(27).cmpChar;
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
var NAME = __webpack_require__(27).NAME;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var NUMBER = TYPE.Number;
|
||
var DIMENSION = TYPE.Dimension;
|
||
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||
var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
|
||
var QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)
|
||
var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
|
||
|
||
function eatHexSequence(offset, allowDash) {
|
||
for (var pos = this.scanner.tokenStart + offset, len = 0; pos < this.scanner.tokenEnd; pos++) {
|
||
var code = this.scanner.source.charCodeAt(pos);
|
||
|
||
if (code === HYPHENMINUS && allowDash && len !== 0) {
|
||
if (eatHexSequence.call(this, offset + len + 1, false) === 0) {
|
||
this.error();
|
||
}
|
||
|
||
return -1;
|
||
}
|
||
|
||
if (!isHexDigit(code)) {
|
||
this.error(
|
||
allowDash && len !== 0
|
||
? 'HyphenMinus' + (len < 6 ? ' or hex digit' : '') + ' is expected'
|
||
: (len < 6 ? 'Hex digit is expected' : 'Unexpected input'),
|
||
pos
|
||
);
|
||
}
|
||
|
||
if (++len > 6) {
|
||
this.error('Too many hex digits', pos);
|
||
};
|
||
}
|
||
|
||
this.scanner.next();
|
||
return len;
|
||
}
|
||
|
||
function eatQuestionMarkSequence(max) {
|
||
var count = 0;
|
||
|
||
while (this.scanner.isDelim(QUESTIONMARK)) {
|
||
if (++count > max) {
|
||
this.error('Too many question marks');
|
||
}
|
||
|
||
this.scanner.next();
|
||
}
|
||
}
|
||
|
||
function startsWith(code) {
|
||
if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== code) {
|
||
this.error(NAME[code] + ' is expected');
|
||
}
|
||
}
|
||
|
||
// https://drafts.csswg.org/css-syntax/#urange
|
||
// Informally, the <urange> production has three forms:
|
||
// U+0001
|
||
// Defines a range consisting of a single code point, in this case the code point "1".
|
||
// U+0001-00ff
|
||
// Defines a range of codepoints between the first and the second value, in this case
|
||
// the range between "1" and "ff" (255 in decimal) inclusive.
|
||
// U+00??
|
||
// Defines a range of codepoints where the "?" characters range over all hex digits,
|
||
// in this case defining the same as the value U+0000-00ff.
|
||
// In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
|
||
//
|
||
// <urange> =
|
||
// u '+' <ident-token> '?'* |
|
||
// u <dimension-token> '?'* |
|
||
// u <number-token> '?'* |
|
||
// u <number-token> <dimension-token> |
|
||
// u <number-token> <number-token> |
|
||
// u '+' '?'+
|
||
function scanUnicodeRange() {
|
||
var hexLength = 0;
|
||
|
||
// u '+' <ident-token> '?'*
|
||
// u '+' '?'+
|
||
if (this.scanner.isDelim(PLUSSIGN)) {
|
||
this.scanner.next();
|
||
|
||
if (this.scanner.tokenType === IDENT) {
|
||
hexLength = eatHexSequence.call(this, 0, true);
|
||
if (hexLength > 0) {
|
||
eatQuestionMarkSequence.call(this, 6 - hexLength);
|
||
}
|
||
return;
|
||
}
|
||
|
||
if (this.scanner.isDelim(QUESTIONMARK)) {
|
||
this.scanner.next();
|
||
eatQuestionMarkSequence.call(this, 5);
|
||
return;
|
||
}
|
||
|
||
this.error('Hex digit or question mark is expected');
|
||
return;
|
||
}
|
||
|
||
// u <number-token> '?'*
|
||
// u <number-token> <dimension-token>
|
||
// u <number-token> <number-token>
|
||
if (this.scanner.tokenType === NUMBER) {
|
||
startsWith.call(this, PLUSSIGN);
|
||
hexLength = eatHexSequence.call(this, 1, true);
|
||
|
||
if (this.scanner.isDelim(QUESTIONMARK)) {
|
||
eatQuestionMarkSequence.call(this, 6 - hexLength);
|
||
return;
|
||
}
|
||
|
||
if (this.scanner.tokenType === DIMENSION ||
|
||
this.scanner.tokenType === NUMBER) {
|
||
startsWith.call(this, HYPHENMINUS);
|
||
eatHexSequence.call(this, 1, false);
|
||
return;
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
// u <dimension-token> '?'*
|
||
if (this.scanner.tokenType === DIMENSION) {
|
||
startsWith.call(this, PLUSSIGN);
|
||
hexLength = eatHexSequence.call(this, 1, true);
|
||
|
||
if (hexLength > 0) {
|
||
eatQuestionMarkSequence.call(this, 6 - hexLength);
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
this.error();
|
||
}
|
||
|
||
module.exports = {
|
||
name: 'UnicodeRange',
|
||
structure: {
|
||
value: String
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
|
||
// U or u
|
||
if (!cmpChar(this.scanner.source, start, U)) {
|
||
this.error('U is expected');
|
||
}
|
||
|
||
if (!cmpChar(this.scanner.source, start + 1, PLUSSIGN)) {
|
||
this.error('Plus sign is expected');
|
||
}
|
||
|
||
this.scanner.next();
|
||
scanUnicodeRange.call(this);
|
||
|
||
return {
|
||
type: 'UnicodeRange',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
value: this.scanner.substrToCursor(start)
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.value);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 101 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var isWhiteSpace = __webpack_require__(27).isWhiteSpace;
|
||
var cmpStr = __webpack_require__(27).cmpStr;
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var FUNCTION = TYPE.Function;
|
||
var URL = TYPE.Url;
|
||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||
|
||
// <url-token> | <function-token> <string> )
|
||
module.exports = {
|
||
name: 'Url',
|
||
structure: {
|
||
value: ['String', 'Raw']
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var value;
|
||
|
||
switch (this.scanner.tokenType) {
|
||
case URL:
|
||
var rawStart = start + 4;
|
||
var rawEnd = this.scanner.tokenEnd - 1;
|
||
|
||
while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawStart))) {
|
||
rawStart++;
|
||
}
|
||
|
||
while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawEnd - 1))) {
|
||
rawEnd--;
|
||
}
|
||
|
||
value = {
|
||
type: 'Raw',
|
||
loc: this.getLocation(rawStart, rawEnd),
|
||
value: this.scanner.source.substring(rawStart, rawEnd)
|
||
};
|
||
|
||
this.eat(URL);
|
||
break;
|
||
|
||
case FUNCTION:
|
||
if (!cmpStr(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')) {
|
||
this.error('Function name must be `url`');
|
||
}
|
||
|
||
this.eat(FUNCTION);
|
||
this.scanner.skipSC();
|
||
value = this.String();
|
||
this.scanner.skipSC();
|
||
this.eat(RIGHTPARENTHESIS);
|
||
break;
|
||
|
||
default:
|
||
this.error('Url or Function is expected');
|
||
}
|
||
|
||
return {
|
||
type: 'Url',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
value: value
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.chunk('url');
|
||
this.chunk('(');
|
||
this.node(node.value);
|
||
this.chunk(')');
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 102 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
name: 'Value',
|
||
structure: {
|
||
children: [[]]
|
||
},
|
||
parse: function() {
|
||
var start = this.scanner.tokenStart;
|
||
var children = this.readSequence(this.scope.Value);
|
||
|
||
return {
|
||
type: 'Value',
|
||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||
children: children
|
||
};
|
||
},
|
||
generate: function(node) {
|
||
this.children(node);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 103 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var WHITESPACE = __webpack_require__(27).TYPE.WhiteSpace;
|
||
var SPACE = Object.freeze({
|
||
type: 'WhiteSpace',
|
||
loc: null,
|
||
value: ' '
|
||
});
|
||
|
||
module.exports = {
|
||
name: 'WhiteSpace',
|
||
structure: {
|
||
value: String
|
||
},
|
||
parse: function() {
|
||
this.eat(WHITESPACE);
|
||
return SPACE;
|
||
|
||
// return {
|
||
// type: 'WhiteSpace',
|
||
// loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
|
||
// value: this.consume(WHITESPACE)
|
||
// };
|
||
},
|
||
generate: function(node) {
|
||
this.chunk(node.value);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 104 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = {
|
||
parseContext: {
|
||
default: 'StyleSheet',
|
||
stylesheet: 'StyleSheet',
|
||
atrule: 'Atrule',
|
||
atrulePrelude: function(options) {
|
||
return this.AtrulePrelude(options.atrule ? String(options.atrule) : null);
|
||
},
|
||
mediaQueryList: 'MediaQueryList',
|
||
mediaQuery: 'MediaQuery',
|
||
rule: 'Rule',
|
||
selectorList: 'SelectorList',
|
||
selector: 'Selector',
|
||
block: function() {
|
||
return this.Block(true);
|
||
},
|
||
declarationList: 'DeclarationList',
|
||
declaration: 'Declaration',
|
||
value: 'Value'
|
||
},
|
||
scope: __webpack_require__(105),
|
||
atrule: __webpack_require__(112),
|
||
pseudo: __webpack_require__(118),
|
||
node: __webpack_require__(63)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 105 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = {
|
||
AtrulePrelude: __webpack_require__(106),
|
||
Selector: __webpack_require__(108),
|
||
Value: __webpack_require__(109)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 106 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = {
|
||
getNode: __webpack_require__(107)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 107 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var cmpChar = __webpack_require__(27).cmpChar;
|
||
var cmpStr = __webpack_require__(27).cmpStr;
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var IDENT = TYPE.Ident;
|
||
var STRING = TYPE.String;
|
||
var NUMBER = TYPE.Number;
|
||
var FUNCTION = TYPE.Function;
|
||
var URL = TYPE.Url;
|
||
var HASH = TYPE.Hash;
|
||
var DIMENSION = TYPE.Dimension;
|
||
var PERCENTAGE = TYPE.Percentage;
|
||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
|
||
var COMMA = TYPE.Comma;
|
||
var DELIM = TYPE.Delim;
|
||
var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
|
||
var ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||
var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
|
||
var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||
var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
|
||
|
||
module.exports = function defaultRecognizer(context) {
|
||
switch (this.scanner.tokenType) {
|
||
case HASH:
|
||
return this.Hash();
|
||
|
||
case COMMA:
|
||
context.space = null;
|
||
context.ignoreWSAfter = true;
|
||
return this.Operator();
|
||
|
||
case LEFTPARENTHESIS:
|
||
return this.Parentheses(this.readSequence, context.recognizer);
|
||
|
||
case LEFTSQUAREBRACKET:
|
||
return this.Brackets(this.readSequence, context.recognizer);
|
||
|
||
case STRING:
|
||
return this.String();
|
||
|
||
case DIMENSION:
|
||
return this.Dimension();
|
||
|
||
case PERCENTAGE:
|
||
return this.Percentage();
|
||
|
||
case NUMBER:
|
||
return this.Number();
|
||
|
||
case FUNCTION:
|
||
return cmpStr(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')
|
||
? this.Url()
|
||
: this.Function(this.readSequence, context.recognizer);
|
||
|
||
case URL:
|
||
return this.Url();
|
||
|
||
case IDENT:
|
||
// check for unicode range, it should start with u+ or U+
|
||
if (cmpChar(this.scanner.source, this.scanner.tokenStart, U) &&
|
||
cmpChar(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN)) {
|
||
return this.UnicodeRange();
|
||
} else {
|
||
return this.Identifier();
|
||
}
|
||
|
||
case DELIM:
|
||
var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
|
||
|
||
if (code === SOLIDUS ||
|
||
code === ASTERISK ||
|
||
code === PLUSSIGN ||
|
||
code === HYPHENMINUS) {
|
||
return this.Operator(); // TODO: replace with Delim
|
||
}
|
||
|
||
// TODO: produce a node with Delim node type
|
||
|
||
if (code === NUMBERSIGN) {
|
||
this.error('Hex or identifier is expected', this.scanner.tokenStart + 1);
|
||
}
|
||
|
||
break;
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 108 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var DELIM = TYPE.Delim;
|
||
var IDENT = TYPE.Ident;
|
||
var DIMENSION = TYPE.Dimension;
|
||
var PERCENTAGE = TYPE.Percentage;
|
||
var NUMBER = TYPE.Number;
|
||
var HASH = TYPE.Hash;
|
||
var COLON = TYPE.Colon;
|
||
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
|
||
var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
|
||
var ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||
var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||
var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
|
||
var GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>)
|
||
var VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
|
||
var TILDE = 0x007E; // U+007E TILDE (~)
|
||
|
||
function getNode(context) {
|
||
switch (this.scanner.tokenType) {
|
||
case LEFTSQUAREBRACKET:
|
||
return this.AttributeSelector();
|
||
|
||
case HASH:
|
||
return this.IdSelector();
|
||
|
||
case COLON:
|
||
if (this.scanner.lookupType(1) === COLON) {
|
||
return this.PseudoElementSelector();
|
||
} else {
|
||
return this.PseudoClassSelector();
|
||
}
|
||
|
||
case IDENT:
|
||
return this.TypeSelector();
|
||
|
||
case NUMBER:
|
||
case PERCENTAGE:
|
||
return this.Percentage();
|
||
|
||
case DIMENSION:
|
||
// throws when .123ident
|
||
if (this.scanner.source.charCodeAt(this.scanner.tokenStart) === FULLSTOP) {
|
||
this.error('Identifier is expected', this.scanner.tokenStart + 1);
|
||
}
|
||
break;
|
||
|
||
case DELIM:
|
||
var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
|
||
|
||
switch (code) {
|
||
case PLUSSIGN:
|
||
case GREATERTHANSIGN:
|
||
case TILDE:
|
||
context.space = null;
|
||
context.ignoreWSAfter = true;
|
||
return this.Combinator();
|
||
|
||
case SOLIDUS: // /deep/
|
||
return this.Combinator();
|
||
|
||
case FULLSTOP:
|
||
return this.ClassSelector();
|
||
|
||
case ASTERISK:
|
||
case VERTICALLINE:
|
||
return this.TypeSelector();
|
||
|
||
case NUMBERSIGN:
|
||
return this.IdSelector();
|
||
}
|
||
|
||
break;
|
||
}
|
||
};
|
||
|
||
module.exports = {
|
||
getNode: getNode
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 109 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = {
|
||
getNode: __webpack_require__(107),
|
||
'expression': __webpack_require__(110),
|
||
'var': __webpack_require__(111)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 110 */
|
||
/***/ ((module) => {
|
||
|
||
// legacy IE function
|
||
// expression( <any-value> )
|
||
module.exports = function() {
|
||
return this.createSingleNodeList(
|
||
this.Raw(this.scanner.tokenIndex, null, false)
|
||
);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 111 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
var rawMode = __webpack_require__(66).mode;
|
||
|
||
var COMMA = TYPE.Comma;
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
|
||
// var( <ident> , <value>? )
|
||
module.exports = function() {
|
||
var children = this.createList();
|
||
|
||
this.scanner.skipSC();
|
||
|
||
// NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
|
||
children.push(this.Identifier());
|
||
|
||
this.scanner.skipSC();
|
||
|
||
if (this.scanner.tokenType === COMMA) {
|
||
children.push(this.Operator());
|
||
|
||
const startIndex = this.scanner.tokenIndex;
|
||
const value = this.parseCustomProperty
|
||
? this.Value(null)
|
||
: this.Raw(this.scanner.tokenIndex, rawMode.exclamationMarkOrSemicolon, false);
|
||
|
||
if (value.type === 'Value' && value.children.isEmpty()) {
|
||
for (let offset = startIndex - this.scanner.tokenIndex; offset <= 0; offset++) {
|
||
if (this.scanner.lookupType(offset) === WHITESPACE) {
|
||
value.children.appendData({
|
||
type: 'WhiteSpace',
|
||
loc: null,
|
||
value: ' '
|
||
});
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
children.push(value);
|
||
}
|
||
|
||
return children;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 112 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = {
|
||
'font-face': __webpack_require__(113),
|
||
'import': __webpack_require__(114),
|
||
'media': __webpack_require__(115),
|
||
'page': __webpack_require__(116),
|
||
'supports': __webpack_require__(117)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 113 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
parse: {
|
||
prelude: null,
|
||
block: function() {
|
||
return this.Block(true);
|
||
}
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 114 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var STRING = TYPE.String;
|
||
var IDENT = TYPE.Ident;
|
||
var URL = TYPE.Url;
|
||
var FUNCTION = TYPE.Function;
|
||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||
|
||
module.exports = {
|
||
parse: {
|
||
prelude: function() {
|
||
var children = this.createList();
|
||
|
||
this.scanner.skipSC();
|
||
|
||
switch (this.scanner.tokenType) {
|
||
case STRING:
|
||
children.push(this.String());
|
||
break;
|
||
|
||
case URL:
|
||
case FUNCTION:
|
||
children.push(this.Url());
|
||
break;
|
||
|
||
default:
|
||
this.error('String or url() is expected');
|
||
}
|
||
|
||
if (this.lookupNonWSType(0) === IDENT ||
|
||
this.lookupNonWSType(0) === LEFTPARENTHESIS) {
|
||
children.push(this.WhiteSpace());
|
||
children.push(this.MediaQueryList());
|
||
}
|
||
|
||
return children;
|
||
},
|
||
block: null
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 115 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
parse: {
|
||
prelude: function() {
|
||
return this.createSingleNodeList(
|
||
this.MediaQueryList()
|
||
);
|
||
},
|
||
block: function() {
|
||
return this.Block(false);
|
||
}
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 116 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
parse: {
|
||
prelude: function() {
|
||
return this.createSingleNodeList(
|
||
this.SelectorList()
|
||
);
|
||
},
|
||
block: function() {
|
||
return this.Block(true);
|
||
}
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 117 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
var TYPE = __webpack_require__(27).TYPE;
|
||
|
||
var WHITESPACE = TYPE.WhiteSpace;
|
||
var COMMENT = TYPE.Comment;
|
||
var IDENT = TYPE.Ident;
|
||
var FUNCTION = TYPE.Function;
|
||
var COLON = TYPE.Colon;
|
||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||
|
||
function consumeRaw() {
|
||
return this.createSingleNodeList(
|
||
this.Raw(this.scanner.tokenIndex, null, false)
|
||
);
|
||
}
|
||
|
||
function parentheses() {
|
||
this.scanner.skipSC();
|
||
|
||
if (this.scanner.tokenType === IDENT &&
|
||
this.lookupNonWSType(1) === COLON) {
|
||
return this.createSingleNodeList(
|
||
this.Declaration()
|
||
);
|
||
}
|
||
|
||
return readSequence.call(this);
|
||
}
|
||
|
||
function readSequence() {
|
||
var children = this.createList();
|
||
var space = null;
|
||
var child;
|
||
|
||
this.scanner.skipSC();
|
||
|
||
scan:
|
||
while (!this.scanner.eof) {
|
||
switch (this.scanner.tokenType) {
|
||
case WHITESPACE:
|
||
space = this.WhiteSpace();
|
||
continue;
|
||
|
||
case COMMENT:
|
||
this.scanner.next();
|
||
continue;
|
||
|
||
case FUNCTION:
|
||
child = this.Function(consumeRaw, this.scope.AtrulePrelude);
|
||
break;
|
||
|
||
case IDENT:
|
||
child = this.Identifier();
|
||
break;
|
||
|
||
case LEFTPARENTHESIS:
|
||
child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
|
||
break;
|
||
|
||
default:
|
||
break scan;
|
||
}
|
||
|
||
if (space !== null) {
|
||
children.push(space);
|
||
space = null;
|
||
}
|
||
|
||
children.push(child);
|
||
}
|
||
|
||
return children;
|
||
}
|
||
|
||
module.exports = {
|
||
parse: {
|
||
prelude: function() {
|
||
var children = readSequence.call(this);
|
||
|
||
if (this.getFirstListNode(children) === null) {
|
||
this.error('Condition is expected');
|
||
}
|
||
|
||
return children;
|
||
},
|
||
block: function() {
|
||
return this.Block(false);
|
||
}
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 118 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = {
|
||
'dir': __webpack_require__(119),
|
||
'has': __webpack_require__(120),
|
||
'lang': __webpack_require__(121),
|
||
'matches': __webpack_require__(122),
|
||
'not': __webpack_require__(124),
|
||
'nth-child': __webpack_require__(125),
|
||
'nth-last-child': __webpack_require__(127),
|
||
'nth-last-of-type': __webpack_require__(128),
|
||
'nth-of-type': __webpack_require__(130),
|
||
'slotted': __webpack_require__(131)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 119 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
parse: function() {
|
||
return this.createSingleNodeList(
|
||
this.Identifier()
|
||
);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 120 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
parse: function() {
|
||
return this.createSingleNodeList(
|
||
this.SelectorList()
|
||
);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 121 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
parse: function() {
|
||
return this.createSingleNodeList(
|
||
this.Identifier()
|
||
);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 122 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = __webpack_require__(123);
|
||
|
||
|
||
/***/ }),
|
||
/* 123 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
parse: function selectorList() {
|
||
return this.createSingleNodeList(
|
||
this.SelectorList()
|
||
);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 124 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = __webpack_require__(123);
|
||
|
||
|
||
/***/ }),
|
||
/* 125 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = __webpack_require__(126);
|
||
|
||
|
||
/***/ }),
|
||
/* 126 */
|
||
/***/ ((module) => {
|
||
|
||
var ALLOW_OF_CLAUSE = true;
|
||
|
||
module.exports = {
|
||
parse: function nthWithOfClause() {
|
||
return this.createSingleNodeList(
|
||
this.Nth(ALLOW_OF_CLAUSE)
|
||
);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 127 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = __webpack_require__(126);
|
||
|
||
|
||
/***/ }),
|
||
/* 128 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = __webpack_require__(129);
|
||
|
||
|
||
/***/ }),
|
||
/* 129 */
|
||
/***/ ((module) => {
|
||
|
||
var DISALLOW_OF_CLAUSE = false;
|
||
|
||
module.exports = {
|
||
parse: function nth() {
|
||
return this.createSingleNodeList(
|
||
this.Nth(DISALLOW_OF_CLAUSE)
|
||
);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 130 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = __webpack_require__(129);
|
||
|
||
|
||
/***/ }),
|
||
/* 131 */
|
||
/***/ ((module) => {
|
||
|
||
module.exports = {
|
||
parse: function compoundSelector() {
|
||
return this.createSingleNodeList(
|
||
this.Selector()
|
||
);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 132 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
module.exports = {
|
||
node: __webpack_require__(63)
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 133 */
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = JSON.parse('{"_from":"css-tree@^1.1.3","_id":"css-tree@1.1.3","_inBundle":false,"_integrity":"sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==","_location":"/css-tree","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"css-tree@^1.1.3","name":"css-tree","escapedName":"css-tree","rawSpec":"^1.1.3","saveSpec":null,"fetchSpec":"^1.1.3"},"_requiredBy":["/corrosion"],"_resolved":"https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz","_shasum":"eb4870fb6fd7707327ec95c2ff2ab09b5e8db91d","_spec":"css-tree@^1.1.3","_where":"C:\\\\Users\\\\nasrullahe\\\\Documents\\\\Holy-Unblocker\\\\node_modules\\\\corrosion","author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com","url":"https://github.com/lahmatiy"},"bugs":{"url":"https://github.com/csstree/csstree/issues"},"bundleDependencies":false,"dependencies":{"mdn-data":"2.0.14","source-map":"^0.6.1"},"deprecated":false,"description":"A tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations","devDependencies":{"@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-json":"^4.0.2","@rollup/plugin-node-resolve":"^7.1.1","coveralls":"^3.0.9","eslint":"^6.8.0","json-to-ast":"^2.1.0","mocha":"^6.2.3","nyc":"^14.1.1","rollup":"^1.32.1","rollup-plugin-terser":"^5.3.0"},"engines":{"node":">=8.0.0"},"files":["data","dist","lib"],"homepage":"https://github.com/csstree/csstree#readme","jsdelivr":"dist/csstree.min.js","keywords":["css","ast","tokenizer","parser","walker","lexer","generator","utils","syntax","validation"],"license":"MIT","main":"lib/index.js","name":"css-tree","repository":{"type":"git","url":"git+https://github.com/csstree/csstree.git"},"scripts":{"build":"rollup --config","coverage":"nyc npm test","coveralls":"nyc report --reporter=text-lcov | coveralls","hydrogen":"node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --trace_hydrogen_file=code.cfg --print-opt-code bin/parse --stat -o /dev/null","lint":"eslint data lib scripts test && node scripts/review-syntax-patch --lint && node scripts/update-docs --lint","lint-and-test":"npm run lint && npm test","prepublishOnly":"npm run build","review:syntax-patch":"node scripts/review-syntax-patch","test":"mocha --reporter progress","travis":"nyc npm run lint-and-test && npm run coveralls","update:docs":"node scripts/update-docs"},"unpkg":"dist/csstree.min.js","version":"1.1.3"}');
|
||
|
||
/***/ }),
|
||
/* 134 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
// -------------------------------------------------------------
|
||
// WARNING: this file is used by both the client and the server.
|
||
// Do not use any browser or node-specific API!
|
||
// -------------------------------------------------------------
|
||
const parse5 = __webpack_require__(135);
|
||
|
||
class HTMLRewriter {
|
||
constructor(ctx) {
|
||
this.ctx = ctx;
|
||
this.attrs = [
|
||
{
|
||
tags: ['form', 'object', 'a', 'link', 'area', 'base', 'script', 'img', 'audio', 'video', 'input', 'embed', 'iframe', 'track', 'source', 'html', 'table', 'head'],
|
||
attrs: ['src', 'href', 'ping', 'data', 'movie', 'action', 'poster', 'profile', 'background'],
|
||
handler: 'url',
|
||
},
|
||
{
|
||
tags: ['iframe'],
|
||
attrs: ['srcdoc'],
|
||
handler: 'html',
|
||
},
|
||
{
|
||
tags: ['img', 'link', 'source'],
|
||
attrs: ['srcset', 'imagesrcset'],
|
||
handler: 'srcset',
|
||
},
|
||
{
|
||
tags: '*',
|
||
attrs: ['style'],
|
||
handler: 'css',
|
||
},
|
||
{
|
||
tags: '*',
|
||
attrs: ['http-equiv', 'integrity', 'nonce', 'crossorigin'],
|
||
handler: 'delete',
|
||
},
|
||
];
|
||
};
|
||
process(source, config = {}) {
|
||
const ast = parse5[config.document ? 'parse' : 'parseFragment'](source);
|
||
const meta = {
|
||
origin: config.origin,
|
||
base: new URL(config.base),
|
||
};
|
||
iterate(ast, node => {
|
||
if (!node.tagName) return;
|
||
switch(node.tagName) {
|
||
case 'STYLE':
|
||
if (node.textContent) node.textContent = this.ctx.css.process(node.textContent, meta);
|
||
break;
|
||
case 'TITLE':
|
||
if (node.textContent && this.ctx.config.title) node.textContent = this.ctx.config.title;
|
||
break;
|
||
case 'SCRIPT':
|
||
if (node.getAttribute('type') != 'application/json' && node.textContent) node.textContent = this.ctx.js.process(node.textContent);
|
||
break;
|
||
case 'BASE':
|
||
if (node.hasAttribute('href')) meta.base = new URL(node.getAttribute('href'), config.base);
|
||
break;
|
||
};
|
||
node.attrs.forEach(attr => {
|
||
const handler = this.attributeRoute({
|
||
...attr,
|
||
node,
|
||
});
|
||
let flags = [];
|
||
if (node.tagName == 'SCRIPT' && attr.name == 'src') flags.push('js');
|
||
if (node.tagName == 'LINK' && node.getAttribute('rel') == 'stylesheet') flags.push('css');
|
||
switch(handler) {
|
||
case 'url':
|
||
node.setAttribute(`corrosion-${attr.name}`, attr.value);
|
||
attr.value = this.ctx.url.wrap(attr.value, { ...meta, flags });
|
||
break;
|
||
case 'srcset':
|
||
node.setAttribute(`corrosion-${attr.name}`, attr.value);
|
||
attr.value = this.srcset(attr.value, meta);
|
||
break;
|
||
case 'css':
|
||
attr.value = this.ctx.css.process(attr.value, { ...meta, context: 'declarationList' });
|
||
break;
|
||
case 'html':
|
||
node.setAttribute(`corrosion-${attr.name}`, attr.value);
|
||
attr.value = this.process(attr.value, { ...config, ...meta });
|
||
break;
|
||
case 'delete':
|
||
node.removeAttribute(attr.name);
|
||
break;
|
||
};
|
||
});
|
||
});
|
||
if (config.document) {
|
||
for (let i in ast.childNodes) if (ast.childNodes[i].tagName == 'html') ast.childNodes[i].childNodes.forEach(node => {
|
||
if (node.tagName == 'head') {
|
||
node.childNodes.unshift(...this.injectHead(config.base));
|
||
};
|
||
});
|
||
};
|
||
return parse5.serialize(ast);
|
||
};
|
||
source(processed, config = {}) {
|
||
const ast = parse5[config.document ? 'parse' : 'parseFragment'](processed);
|
||
iterate(ast, node => {
|
||
if (!node.tagName) return;
|
||
node.attrs.forEach(attr => {
|
||
if (node.hasAttribute(`corrosion-${attr.name}`)) {
|
||
attr.value = node.getAttribute(`corrosion-${attr.name}`);
|
||
node.removeAttribute(`corrosion-${attr.name}`)
|
||
};
|
||
});
|
||
});
|
||
return parse5.serialize(ast);
|
||
};
|
||
injectHead() {
|
||
return [
|
||
{
|
||
nodeName: 'title',
|
||
tagName: 'title',
|
||
childNodes: [
|
||
{
|
||
nodeName: '#text',
|
||
value: this.ctx.config.title || '',
|
||
}
|
||
],
|
||
attrs: [],
|
||
},
|
||
{
|
||
nodeName: 'script',
|
||
tagName: 'script',
|
||
childNodes: [],
|
||
attrs: [
|
||
{
|
||
name: 'src',
|
||
value: this.ctx.prefix + 'index.js',
|
||
},
|
||
],
|
||
},
|
||
{
|
||
nodeName: 'script',
|
||
tagName: 'script',
|
||
childNodes: [
|
||
{
|
||
nodeName: '#text',
|
||
value: `window.$corrosion = new Corrosion({ window, codec: '${this.ctx.config.codec || 'plain'}', prefix: '${this.ctx.prefix}', ws: ${this.ctx.config.ws}, cookie: ${this.ctx.config.cookie}, title: ${typeof this.ctx.config.title == 'boolean' ? this.ctx.config.title : '\'' + this.ctx.config.title + '\''}, }); $corrosion.init(); document.currentScript.remove();`
|
||
},
|
||
],
|
||
attrs: [],
|
||
}
|
||
];
|
||
}
|
||
attributeRoute(data) {
|
||
const match = this.attrs.find(entry => entry.tags == '*' && entry.attrs.includes(data.name) || entry.tags.includes(data.node.tagName.toLowerCase()) && entry.attrs.includes(data.name));
|
||
return match ? match.handler : false;
|
||
};
|
||
srcset(val, config = {}) {
|
||
return val.split(',').map(src => {
|
||
const parts = src.trimStart().split(' ');
|
||
if (parts[0]) parts[0] = this.ctx.url.wrap(parts[0], config);
|
||
return parts.join(' ');
|
||
}).join(', ');
|
||
};
|
||
unsrcset(val, config = {}) {
|
||
return val.split(',').map(src => {
|
||
const parts = src.trimStart().split(' ');
|
||
if (parts[0]) parts[0] = this.ctx.url.unwrap(parts[0], config);
|
||
return parts.join(' ');
|
||
}).join(', ');
|
||
};
|
||
};
|
||
|
||
class Parse5Wrapper {
|
||
constructor(node){
|
||
this.raw = node || {
|
||
attrs: [],
|
||
childNodes: [],
|
||
namespaceURI: '',
|
||
nodeName: '',
|
||
parentNode: {},
|
||
tagName: '',
|
||
};
|
||
};
|
||
hasAttribute(name){
|
||
return this.raw.attrs.some(attr => attr.name == name);
|
||
};
|
||
removeAttribute(name){
|
||
if (!this.hasAttribute(name)) return;
|
||
this.raw.attrs.splice(this.raw.attrs.findIndex(attr => attr.name == name), 1);
|
||
};
|
||
setAttribute(name, val = ''){
|
||
if (!name) return;
|
||
this.removeAttribute(name);
|
||
this.raw.attrs.push({
|
||
name: name,
|
||
value: val,
|
||
});
|
||
};
|
||
getAttribute(name){
|
||
return (this.raw.attrs.find(attr => attr.name == name) || { value: null }).value;
|
||
};
|
||
get textContent(){
|
||
return (this.raw.childNodes.find(node => node.nodeName == '#text') || { value: '', }).value
|
||
};
|
||
set textContent(val){
|
||
if (this.raw.childNodes.some(node => node.nodeName == '#text')) return this.raw.childNodes[this.raw.childNodes.findIndex(node => node.nodeName == '#text')].value = val;
|
||
this.raw.childNodes.push({
|
||
nodeName: '#text',
|
||
value: val,
|
||
});
|
||
};
|
||
get tagName(){
|
||
return (this.raw.tagName || '').toUpperCase();
|
||
};
|
||
get nodeName(){
|
||
return this.raw.nodeName;
|
||
};
|
||
get parentNode(){
|
||
return this.raw.parentNode;
|
||
};
|
||
get childNodes(){
|
||
return this.raw.childNodes || [];
|
||
};
|
||
get attrs() {
|
||
return this.raw.attrs || [];
|
||
};
|
||
};
|
||
|
||
function iterate(ast, fn = (node = Parse5Wrapper.prototype) => null) {
|
||
fn(new Parse5Wrapper(ast));
|
||
if (ast.childNodes) for (let i in ast.childNodes) iterate(ast.childNodes[i], fn);
|
||
};
|
||
|
||
module.exports = HTMLRewriter;
|
||
|
||
|
||
/***/ }),
|
||
/* 135 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const Parser = __webpack_require__(136);
|
||
const Serializer = __webpack_require__(158);
|
||
|
||
// Shorthands
|
||
exports.parse = function parse(html, options) {
|
||
const parser = new Parser(options);
|
||
|
||
return parser.parse(html);
|
||
};
|
||
|
||
exports.parseFragment = function parseFragment(fragmentContext, html, options) {
|
||
if (typeof fragmentContext === 'string') {
|
||
options = html;
|
||
html = fragmentContext;
|
||
fragmentContext = null;
|
||
}
|
||
|
||
const parser = new Parser(options);
|
||
|
||
return parser.parseFragment(html, fragmentContext);
|
||
};
|
||
|
||
exports.serialize = function(node, options) {
|
||
const serializer = new Serializer(node, options);
|
||
|
||
return serializer.serialize();
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 136 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const Tokenizer = __webpack_require__(137);
|
||
const OpenElementStack = __webpack_require__(142);
|
||
const FormattingElementList = __webpack_require__(144);
|
||
const LocationInfoParserMixin = __webpack_require__(145);
|
||
const ErrorReportingParserMixin = __webpack_require__(150);
|
||
const Mixin = __webpack_require__(146);
|
||
const defaultTreeAdapter = __webpack_require__(154);
|
||
const mergeOptions = __webpack_require__(155);
|
||
const doctype = __webpack_require__(156);
|
||
const foreignContent = __webpack_require__(157);
|
||
const ERR = __webpack_require__(140);
|
||
const unicode = __webpack_require__(139);
|
||
const HTML = __webpack_require__(143);
|
||
|
||
//Aliases
|
||
const $ = HTML.TAG_NAMES;
|
||
const NS = HTML.NAMESPACES;
|
||
const ATTRS = HTML.ATTRS;
|
||
|
||
const DEFAULT_OPTIONS = {
|
||
scriptingEnabled: true,
|
||
sourceCodeLocationInfo: false,
|
||
onParseError: null,
|
||
treeAdapter: defaultTreeAdapter
|
||
};
|
||
|
||
//Misc constants
|
||
const HIDDEN_INPUT_TYPE = 'hidden';
|
||
|
||
//Adoption agency loops iteration count
|
||
const AA_OUTER_LOOP_ITER = 8;
|
||
const AA_INNER_LOOP_ITER = 3;
|
||
|
||
//Insertion modes
|
||
const INITIAL_MODE = 'INITIAL_MODE';
|
||
const BEFORE_HTML_MODE = 'BEFORE_HTML_MODE';
|
||
const BEFORE_HEAD_MODE = 'BEFORE_HEAD_MODE';
|
||
const IN_HEAD_MODE = 'IN_HEAD_MODE';
|
||
const IN_HEAD_NO_SCRIPT_MODE = 'IN_HEAD_NO_SCRIPT_MODE';
|
||
const AFTER_HEAD_MODE = 'AFTER_HEAD_MODE';
|
||
const IN_BODY_MODE = 'IN_BODY_MODE';
|
||
const TEXT_MODE = 'TEXT_MODE';
|
||
const IN_TABLE_MODE = 'IN_TABLE_MODE';
|
||
const IN_TABLE_TEXT_MODE = 'IN_TABLE_TEXT_MODE';
|
||
const IN_CAPTION_MODE = 'IN_CAPTION_MODE';
|
||
const IN_COLUMN_GROUP_MODE = 'IN_COLUMN_GROUP_MODE';
|
||
const IN_TABLE_BODY_MODE = 'IN_TABLE_BODY_MODE';
|
||
const IN_ROW_MODE = 'IN_ROW_MODE';
|
||
const IN_CELL_MODE = 'IN_CELL_MODE';
|
||
const IN_SELECT_MODE = 'IN_SELECT_MODE';
|
||
const IN_SELECT_IN_TABLE_MODE = 'IN_SELECT_IN_TABLE_MODE';
|
||
const IN_TEMPLATE_MODE = 'IN_TEMPLATE_MODE';
|
||
const AFTER_BODY_MODE = 'AFTER_BODY_MODE';
|
||
const IN_FRAMESET_MODE = 'IN_FRAMESET_MODE';
|
||
const AFTER_FRAMESET_MODE = 'AFTER_FRAMESET_MODE';
|
||
const AFTER_AFTER_BODY_MODE = 'AFTER_AFTER_BODY_MODE';
|
||
const AFTER_AFTER_FRAMESET_MODE = 'AFTER_AFTER_FRAMESET_MODE';
|
||
|
||
//Insertion mode reset map
|
||
const INSERTION_MODE_RESET_MAP = {
|
||
[$.TR]: IN_ROW_MODE,
|
||
[$.TBODY]: IN_TABLE_BODY_MODE,
|
||
[$.THEAD]: IN_TABLE_BODY_MODE,
|
||
[$.TFOOT]: IN_TABLE_BODY_MODE,
|
||
[$.CAPTION]: IN_CAPTION_MODE,
|
||
[$.COLGROUP]: IN_COLUMN_GROUP_MODE,
|
||
[$.TABLE]: IN_TABLE_MODE,
|
||
[$.BODY]: IN_BODY_MODE,
|
||
[$.FRAMESET]: IN_FRAMESET_MODE
|
||
};
|
||
|
||
//Template insertion mode switch map
|
||
const TEMPLATE_INSERTION_MODE_SWITCH_MAP = {
|
||
[$.CAPTION]: IN_TABLE_MODE,
|
||
[$.COLGROUP]: IN_TABLE_MODE,
|
||
[$.TBODY]: IN_TABLE_MODE,
|
||
[$.TFOOT]: IN_TABLE_MODE,
|
||
[$.THEAD]: IN_TABLE_MODE,
|
||
[$.COL]: IN_COLUMN_GROUP_MODE,
|
||
[$.TR]: IN_TABLE_BODY_MODE,
|
||
[$.TD]: IN_ROW_MODE,
|
||
[$.TH]: IN_ROW_MODE
|
||
};
|
||
|
||
//Token handlers map for insertion modes
|
||
const TOKEN_HANDLERS = {
|
||
[INITIAL_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: tokenInInitialMode,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: tokenInInitialMode,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: doctypeInInitialMode,
|
||
[Tokenizer.START_TAG_TOKEN]: tokenInInitialMode,
|
||
[Tokenizer.END_TAG_TOKEN]: tokenInInitialMode,
|
||
[Tokenizer.EOF_TOKEN]: tokenInInitialMode
|
||
},
|
||
[BEFORE_HTML_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: tokenBeforeHtml,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: tokenBeforeHtml,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagBeforeHtml,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagBeforeHtml,
|
||
[Tokenizer.EOF_TOKEN]: tokenBeforeHtml
|
||
},
|
||
[BEFORE_HEAD_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: tokenBeforeHead,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: tokenBeforeHead,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagBeforeHead,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagBeforeHead,
|
||
[Tokenizer.EOF_TOKEN]: tokenBeforeHead
|
||
},
|
||
[IN_HEAD_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: tokenInHead,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: tokenInHead,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInHead,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInHead,
|
||
[Tokenizer.EOF_TOKEN]: tokenInHead
|
||
},
|
||
[IN_HEAD_NO_SCRIPT_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: tokenInHeadNoScript,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: tokenInHeadNoScript,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInHeadNoScript,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInHeadNoScript,
|
||
[Tokenizer.EOF_TOKEN]: tokenInHeadNoScript
|
||
},
|
||
[AFTER_HEAD_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: tokenAfterHead,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterHead,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagAfterHead,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagAfterHead,
|
||
[Tokenizer.EOF_TOKEN]: tokenAfterHead
|
||
},
|
||
[IN_BODY_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: characterInBody,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInBody,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInBody,
|
||
[Tokenizer.EOF_TOKEN]: eofInBody
|
||
},
|
||
[TEXT_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.COMMENT_TOKEN]: ignoreToken,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: ignoreToken,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInText,
|
||
[Tokenizer.EOF_TOKEN]: eofInText
|
||
},
|
||
[IN_TABLE_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: characterInTable,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInTable,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInTable,
|
||
[Tokenizer.EOF_TOKEN]: eofInBody
|
||
},
|
||
[IN_TABLE_TEXT_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: characterInTableText,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInTableText,
|
||
[Tokenizer.COMMENT_TOKEN]: tokenInTableText,
|
||
[Tokenizer.DOCTYPE_TOKEN]: tokenInTableText,
|
||
[Tokenizer.START_TAG_TOKEN]: tokenInTableText,
|
||
[Tokenizer.END_TAG_TOKEN]: tokenInTableText,
|
||
[Tokenizer.EOF_TOKEN]: tokenInTableText
|
||
},
|
||
[IN_CAPTION_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: characterInBody,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInCaption,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInCaption,
|
||
[Tokenizer.EOF_TOKEN]: eofInBody
|
||
},
|
||
[IN_COLUMN_GROUP_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: tokenInColumnGroup,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: tokenInColumnGroup,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInColumnGroup,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInColumnGroup,
|
||
[Tokenizer.EOF_TOKEN]: eofInBody
|
||
},
|
||
[IN_TABLE_BODY_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: characterInTable,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInTableBody,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInTableBody,
|
||
[Tokenizer.EOF_TOKEN]: eofInBody
|
||
},
|
||
[IN_ROW_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: characterInTable,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInRow,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInRow,
|
||
[Tokenizer.EOF_TOKEN]: eofInBody
|
||
},
|
||
[IN_CELL_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: characterInBody,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInCell,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInCell,
|
||
[Tokenizer.EOF_TOKEN]: eofInBody
|
||
},
|
||
[IN_SELECT_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInSelect,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInSelect,
|
||
[Tokenizer.EOF_TOKEN]: eofInBody
|
||
},
|
||
[IN_SELECT_IN_TABLE_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInSelectInTable,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInSelectInTable,
|
||
[Tokenizer.EOF_TOKEN]: eofInBody
|
||
},
|
||
[IN_TEMPLATE_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: characterInBody,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInTemplate,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInTemplate,
|
||
[Tokenizer.EOF_TOKEN]: eofInTemplate
|
||
},
|
||
[AFTER_BODY_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: tokenAfterBody,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterBody,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody,
|
||
[Tokenizer.COMMENT_TOKEN]: appendCommentToRootHtmlElement,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagAfterBody,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagAfterBody,
|
||
[Tokenizer.EOF_TOKEN]: stopParsing
|
||
},
|
||
[IN_FRAMESET_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagInFrameset,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagInFrameset,
|
||
[Tokenizer.EOF_TOKEN]: stopParsing
|
||
},
|
||
[AFTER_FRAMESET_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters,
|
||
[Tokenizer.COMMENT_TOKEN]: appendComment,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagAfterFrameset,
|
||
[Tokenizer.END_TAG_TOKEN]: endTagAfterFrameset,
|
||
[Tokenizer.EOF_TOKEN]: stopParsing
|
||
},
|
||
[AFTER_AFTER_BODY_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: tokenAfterAfterBody,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterAfterBody,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody,
|
||
[Tokenizer.COMMENT_TOKEN]: appendCommentToDocument,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagAfterAfterBody,
|
||
[Tokenizer.END_TAG_TOKEN]: tokenAfterAfterBody,
|
||
[Tokenizer.EOF_TOKEN]: stopParsing
|
||
},
|
||
[AFTER_AFTER_FRAMESET_MODE]: {
|
||
[Tokenizer.CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken,
|
||
[Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody,
|
||
[Tokenizer.COMMENT_TOKEN]: appendCommentToDocument,
|
||
[Tokenizer.DOCTYPE_TOKEN]: ignoreToken,
|
||
[Tokenizer.START_TAG_TOKEN]: startTagAfterAfterFrameset,
|
||
[Tokenizer.END_TAG_TOKEN]: ignoreToken,
|
||
[Tokenizer.EOF_TOKEN]: stopParsing
|
||
}
|
||
};
|
||
|
||
//Parser
|
||
class Parser {
|
||
constructor(options) {
|
||
this.options = mergeOptions(DEFAULT_OPTIONS, options);
|
||
|
||
this.treeAdapter = this.options.treeAdapter;
|
||
this.pendingScript = null;
|
||
|
||
if (this.options.sourceCodeLocationInfo) {
|
||
Mixin.install(this, LocationInfoParserMixin);
|
||
}
|
||
|
||
if (this.options.onParseError) {
|
||
Mixin.install(this, ErrorReportingParserMixin, { onParseError: this.options.onParseError });
|
||
}
|
||
}
|
||
|
||
// API
|
||
parse(html) {
|
||
const document = this.treeAdapter.createDocument();
|
||
|
||
this._bootstrap(document, null);
|
||
this.tokenizer.write(html, true);
|
||
this._runParsingLoop(null);
|
||
|
||
return document;
|
||
}
|
||
|
||
parseFragment(html, fragmentContext) {
|
||
//NOTE: use <template> element as a fragment context if context element was not provided,
|
||
//so we will parse in "forgiving" manner
|
||
if (!fragmentContext) {
|
||
fragmentContext = this.treeAdapter.createElement($.TEMPLATE, NS.HTML, []);
|
||
}
|
||
|
||
//NOTE: create fake element which will be used as 'document' for fragment parsing.
|
||
//This is important for jsdom there 'document' can't be recreated, therefore
|
||
//fragment parsing causes messing of the main `document`.
|
||
const documentMock = this.treeAdapter.createElement('documentmock', NS.HTML, []);
|
||
|
||
this._bootstrap(documentMock, fragmentContext);
|
||
|
||
if (this.treeAdapter.getTagName(fragmentContext) === $.TEMPLATE) {
|
||
this._pushTmplInsertionMode(IN_TEMPLATE_MODE);
|
||
}
|
||
|
||
this._initTokenizerForFragmentParsing();
|
||
this._insertFakeRootElement();
|
||
this._resetInsertionMode();
|
||
this._findFormInFragmentContext();
|
||
this.tokenizer.write(html, true);
|
||
this._runParsingLoop(null);
|
||
|
||
const rootElement = this.treeAdapter.getFirstChild(documentMock);
|
||
const fragment = this.treeAdapter.createDocumentFragment();
|
||
|
||
this._adoptNodes(rootElement, fragment);
|
||
|
||
return fragment;
|
||
}
|
||
|
||
//Bootstrap parser
|
||
_bootstrap(document, fragmentContext) {
|
||
this.tokenizer = new Tokenizer(this.options);
|
||
|
||
this.stopped = false;
|
||
|
||
this.insertionMode = INITIAL_MODE;
|
||
this.originalInsertionMode = '';
|
||
|
||
this.document = document;
|
||
this.fragmentContext = fragmentContext;
|
||
|
||
this.headElement = null;
|
||
this.formElement = null;
|
||
|
||
this.openElements = new OpenElementStack(this.document, this.treeAdapter);
|
||
this.activeFormattingElements = new FormattingElementList(this.treeAdapter);
|
||
|
||
this.tmplInsertionModeStack = [];
|
||
this.tmplInsertionModeStackTop = -1;
|
||
this.currentTmplInsertionMode = null;
|
||
|
||
this.pendingCharacterTokens = [];
|
||
this.hasNonWhitespacePendingCharacterToken = false;
|
||
|
||
this.framesetOk = true;
|
||
this.skipNextNewLine = false;
|
||
this.fosterParentingEnabled = false;
|
||
}
|
||
|
||
//Errors
|
||
_err() {
|
||
// NOTE: err reporting is noop by default. Enabled by mixin.
|
||
}
|
||
|
||
//Parsing loop
|
||
_runParsingLoop(scriptHandler) {
|
||
while (!this.stopped) {
|
||
this._setupTokenizerCDATAMode();
|
||
|
||
const token = this.tokenizer.getNextToken();
|
||
|
||
if (token.type === Tokenizer.HIBERNATION_TOKEN) {
|
||
break;
|
||
}
|
||
|
||
if (this.skipNextNewLine) {
|
||
this.skipNextNewLine = false;
|
||
|
||
if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token.chars[0] === '\n') {
|
||
if (token.chars.length === 1) {
|
||
continue;
|
||
}
|
||
|
||
token.chars = token.chars.substr(1);
|
||
}
|
||
}
|
||
|
||
this._processInputToken(token);
|
||
|
||
if (scriptHandler && this.pendingScript) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
runParsingLoopForCurrentChunk(writeCallback, scriptHandler) {
|
||
this._runParsingLoop(scriptHandler);
|
||
|
||
if (scriptHandler && this.pendingScript) {
|
||
const script = this.pendingScript;
|
||
|
||
this.pendingScript = null;
|
||
|
||
scriptHandler(script);
|
||
|
||
return;
|
||
}
|
||
|
||
if (writeCallback) {
|
||
writeCallback();
|
||
}
|
||
}
|
||
|
||
//Text parsing
|
||
_setupTokenizerCDATAMode() {
|
||
const current = this._getAdjustedCurrentElement();
|
||
|
||
this.tokenizer.allowCDATA =
|
||
current &&
|
||
current !== this.document &&
|
||
this.treeAdapter.getNamespaceURI(current) !== NS.HTML &&
|
||
!this._isIntegrationPoint(current);
|
||
}
|
||
|
||
_switchToTextParsing(currentToken, nextTokenizerState) {
|
||
this._insertElement(currentToken, NS.HTML);
|
||
this.tokenizer.state = nextTokenizerState;
|
||
this.originalInsertionMode = this.insertionMode;
|
||
this.insertionMode = TEXT_MODE;
|
||
}
|
||
|
||
switchToPlaintextParsing() {
|
||
this.insertionMode = TEXT_MODE;
|
||
this.originalInsertionMode = IN_BODY_MODE;
|
||
this.tokenizer.state = Tokenizer.MODE.PLAINTEXT;
|
||
}
|
||
|
||
//Fragment parsing
|
||
_getAdjustedCurrentElement() {
|
||
return this.openElements.stackTop === 0 && this.fragmentContext
|
||
? this.fragmentContext
|
||
: this.openElements.current;
|
||
}
|
||
|
||
_findFormInFragmentContext() {
|
||
let node = this.fragmentContext;
|
||
|
||
do {
|
||
if (this.treeAdapter.getTagName(node) === $.FORM) {
|
||
this.formElement = node;
|
||
break;
|
||
}
|
||
|
||
node = this.treeAdapter.getParentNode(node);
|
||
} while (node);
|
||
}
|
||
|
||
_initTokenizerForFragmentParsing() {
|
||
if (this.treeAdapter.getNamespaceURI(this.fragmentContext) === NS.HTML) {
|
||
const tn = this.treeAdapter.getTagName(this.fragmentContext);
|
||
|
||
if (tn === $.TITLE || tn === $.TEXTAREA) {
|
||
this.tokenizer.state = Tokenizer.MODE.RCDATA;
|
||
} else if (
|
||
tn === $.STYLE ||
|
||
tn === $.XMP ||
|
||
tn === $.IFRAME ||
|
||
tn === $.NOEMBED ||
|
||
tn === $.NOFRAMES ||
|
||
tn === $.NOSCRIPT
|
||
) {
|
||
this.tokenizer.state = Tokenizer.MODE.RAWTEXT;
|
||
} else if (tn === $.SCRIPT) {
|
||
this.tokenizer.state = Tokenizer.MODE.SCRIPT_DATA;
|
||
} else if (tn === $.PLAINTEXT) {
|
||
this.tokenizer.state = Tokenizer.MODE.PLAINTEXT;
|
||
}
|
||
}
|
||
}
|
||
|
||
//Tree mutation
|
||
_setDocumentType(token) {
|
||
const name = token.name || '';
|
||
const publicId = token.publicId || '';
|
||
const systemId = token.systemId || '';
|
||
|
||
this.treeAdapter.setDocumentType(this.document, name, publicId, systemId);
|
||
}
|
||
|
||
_attachElementToTree(element) {
|
||
if (this._shouldFosterParentOnInsertion()) {
|
||
this._fosterParentElement(element);
|
||
} else {
|
||
const parent = this.openElements.currentTmplContent || this.openElements.current;
|
||
|
||
this.treeAdapter.appendChild(parent, element);
|
||
}
|
||
}
|
||
|
||
_appendElement(token, namespaceURI) {
|
||
const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
||
|
||
this._attachElementToTree(element);
|
||
}
|
||
|
||
_insertElement(token, namespaceURI) {
|
||
const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
|
||
|
||
this._attachElementToTree(element);
|
||
this.openElements.push(element);
|
||
}
|
||
|
||
_insertFakeElement(tagName) {
|
||
const element = this.treeAdapter.createElement(tagName, NS.HTML, []);
|
||
|
||
this._attachElementToTree(element);
|
||
this.openElements.push(element);
|
||
}
|
||
|
||
_insertTemplate(token) {
|
||
const tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs);
|
||
const content = this.treeAdapter.createDocumentFragment();
|
||
|
||
this.treeAdapter.setTemplateContent(tmpl, content);
|
||
this._attachElementToTree(tmpl);
|
||
this.openElements.push(tmpl);
|
||
}
|
||
|
||
_insertFakeRootElement() {
|
||
const element = this.treeAdapter.createElement($.HTML, NS.HTML, []);
|
||
|
||
this.treeAdapter.appendChild(this.openElements.current, element);
|
||
this.openElements.push(element);
|
||
}
|
||
|
||
_appendCommentNode(token, parent) {
|
||
const commentNode = this.treeAdapter.createCommentNode(token.data);
|
||
|
||
this.treeAdapter.appendChild(parent, commentNode);
|
||
}
|
||
|
||
_insertCharacters(token) {
|
||
if (this._shouldFosterParentOnInsertion()) {
|
||
this._fosterParentText(token.chars);
|
||
} else {
|
||
const parent = this.openElements.currentTmplContent || this.openElements.current;
|
||
|
||
this.treeAdapter.insertText(parent, token.chars);
|
||
}
|
||
}
|
||
|
||
_adoptNodes(donor, recipient) {
|
||
for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {
|
||
this.treeAdapter.detachNode(child);
|
||
this.treeAdapter.appendChild(recipient, child);
|
||
}
|
||
}
|
||
|
||
//Token processing
|
||
_shouldProcessTokenInForeignContent(token) {
|
||
const current = this._getAdjustedCurrentElement();
|
||
|
||
if (!current || current === this.document) {
|
||
return false;
|
||
}
|
||
|
||
const ns = this.treeAdapter.getNamespaceURI(current);
|
||
|
||
if (ns === NS.HTML) {
|
||
return false;
|
||
}
|
||
|
||
if (
|
||
this.treeAdapter.getTagName(current) === $.ANNOTATION_XML &&
|
||
ns === NS.MATHML &&
|
||
token.type === Tokenizer.START_TAG_TOKEN &&
|
||
token.tagName === $.SVG
|
||
) {
|
||
return false;
|
||
}
|
||
|
||
const isCharacterToken =
|
||
token.type === Tokenizer.CHARACTER_TOKEN ||
|
||
token.type === Tokenizer.NULL_CHARACTER_TOKEN ||
|
||
token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN;
|
||
|
||
const isMathMLTextStartTag =
|
||
token.type === Tokenizer.START_TAG_TOKEN && token.tagName !== $.MGLYPH && token.tagName !== $.MALIGNMARK;
|
||
|
||
if ((isMathMLTextStartTag || isCharacterToken) && this._isIntegrationPoint(current, NS.MATHML)) {
|
||
return false;
|
||
}
|
||
|
||
if (
|
||
(token.type === Tokenizer.START_TAG_TOKEN || isCharacterToken) &&
|
||
this._isIntegrationPoint(current, NS.HTML)
|
||
) {
|
||
return false;
|
||
}
|
||
|
||
return token.type !== Tokenizer.EOF_TOKEN;
|
||
}
|
||
|
||
_processToken(token) {
|
||
TOKEN_HANDLERS[this.insertionMode][token.type](this, token);
|
||
}
|
||
|
||
_processTokenInBodyMode(token) {
|
||
TOKEN_HANDLERS[IN_BODY_MODE][token.type](this, token);
|
||
}
|
||
|
||
_processTokenInForeignContent(token) {
|
||
if (token.type === Tokenizer.CHARACTER_TOKEN) {
|
||
characterInForeignContent(this, token);
|
||
} else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN) {
|
||
nullCharacterInForeignContent(this, token);
|
||
} else if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN) {
|
||
insertCharacters(this, token);
|
||
} else if (token.type === Tokenizer.COMMENT_TOKEN) {
|
||
appendComment(this, token);
|
||
} else if (token.type === Tokenizer.START_TAG_TOKEN) {
|
||
startTagInForeignContent(this, token);
|
||
} else if (token.type === Tokenizer.END_TAG_TOKEN) {
|
||
endTagInForeignContent(this, token);
|
||
}
|
||
}
|
||
|
||
_processInputToken(token) {
|
||
if (this._shouldProcessTokenInForeignContent(token)) {
|
||
this._processTokenInForeignContent(token);
|
||
} else {
|
||
this._processToken(token);
|
||
}
|
||
|
||
if (token.type === Tokenizer.START_TAG_TOKEN && token.selfClosing && !token.ackSelfClosing) {
|
||
this._err(ERR.nonVoidHtmlElementStartTagWithTrailingSolidus);
|
||
}
|
||
}
|
||
|
||
//Integration points
|
||
_isIntegrationPoint(element, foreignNS) {
|
||
const tn = this.treeAdapter.getTagName(element);
|
||
const ns = this.treeAdapter.getNamespaceURI(element);
|
||
const attrs = this.treeAdapter.getAttrList(element);
|
||
|
||
return foreignContent.isIntegrationPoint(tn, ns, attrs, foreignNS);
|
||
}
|
||
|
||
//Active formatting elements reconstruction
|
||
_reconstructActiveFormattingElements() {
|
||
const listLength = this.activeFormattingElements.length;
|
||
|
||
if (listLength) {
|
||
let unopenIdx = listLength;
|
||
let entry = null;
|
||
|
||
do {
|
||
unopenIdx--;
|
||
entry = this.activeFormattingElements.entries[unopenIdx];
|
||
|
||
if (entry.type === FormattingElementList.MARKER_ENTRY || this.openElements.contains(entry.element)) {
|
||
unopenIdx++;
|
||
break;
|
||
}
|
||
} while (unopenIdx > 0);
|
||
|
||
for (let i = unopenIdx; i < listLength; i++) {
|
||
entry = this.activeFormattingElements.entries[i];
|
||
this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element));
|
||
entry.element = this.openElements.current;
|
||
}
|
||
}
|
||
}
|
||
|
||
//Close elements
|
||
_closeTableCell() {
|
||
this.openElements.generateImpliedEndTags();
|
||
this.openElements.popUntilTableCellPopped();
|
||
this.activeFormattingElements.clearToLastMarker();
|
||
this.insertionMode = IN_ROW_MODE;
|
||
}
|
||
|
||
_closePElement() {
|
||
this.openElements.generateImpliedEndTagsWithExclusion($.P);
|
||
this.openElements.popUntilTagNamePopped($.P);
|
||
}
|
||
|
||
//Insertion modes
|
||
_resetInsertionMode() {
|
||
for (let i = this.openElements.stackTop, last = false; i >= 0; i--) {
|
||
let element = this.openElements.items[i];
|
||
|
||
if (i === 0) {
|
||
last = true;
|
||
|
||
if (this.fragmentContext) {
|
||
element = this.fragmentContext;
|
||
}
|
||
}
|
||
|
||
const tn = this.treeAdapter.getTagName(element);
|
||
const newInsertionMode = INSERTION_MODE_RESET_MAP[tn];
|
||
|
||
if (newInsertionMode) {
|
||
this.insertionMode = newInsertionMode;
|
||
break;
|
||
} else if (!last && (tn === $.TD || tn === $.TH)) {
|
||
this.insertionMode = IN_CELL_MODE;
|
||
break;
|
||
} else if (!last && tn === $.HEAD) {
|
||
this.insertionMode = IN_HEAD_MODE;
|
||
break;
|
||
} else if (tn === $.SELECT) {
|
||
this._resetInsertionModeForSelect(i);
|
||
break;
|
||
} else if (tn === $.TEMPLATE) {
|
||
this.insertionMode = this.currentTmplInsertionMode;
|
||
break;
|
||
} else if (tn === $.HTML) {
|
||
this.insertionMode = this.headElement ? AFTER_HEAD_MODE : BEFORE_HEAD_MODE;
|
||
break;
|
||
} else if (last) {
|
||
this.insertionMode = IN_BODY_MODE;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
_resetInsertionModeForSelect(selectIdx) {
|
||
if (selectIdx > 0) {
|
||
for (let i = selectIdx - 1; i > 0; i--) {
|
||
const ancestor = this.openElements.items[i];
|
||
const tn = this.treeAdapter.getTagName(ancestor);
|
||
|
||
if (tn === $.TEMPLATE) {
|
||
break;
|
||
} else if (tn === $.TABLE) {
|
||
this.insertionMode = IN_SELECT_IN_TABLE_MODE;
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
this.insertionMode = IN_SELECT_MODE;
|
||
}
|
||
|
||
_pushTmplInsertionMode(mode) {
|
||
this.tmplInsertionModeStack.push(mode);
|
||
this.tmplInsertionModeStackTop++;
|
||
this.currentTmplInsertionMode = mode;
|
||
}
|
||
|
||
_popTmplInsertionMode() {
|
||
this.tmplInsertionModeStack.pop();
|
||
this.tmplInsertionModeStackTop--;
|
||
this.currentTmplInsertionMode = this.tmplInsertionModeStack[this.tmplInsertionModeStackTop];
|
||
}
|
||
|
||
//Foster parenting
|
||
_isElementCausesFosterParenting(element) {
|
||
const tn = this.treeAdapter.getTagName(element);
|
||
|
||
return tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR;
|
||
}
|
||
|
||
_shouldFosterParentOnInsertion() {
|
||
return this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.current);
|
||
}
|
||
|
||
_findFosterParentingLocation() {
|
||
const location = {
|
||
parent: null,
|
||
beforeElement: null
|
||
};
|
||
|
||
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
||
const openElement = this.openElements.items[i];
|
||
const tn = this.treeAdapter.getTagName(openElement);
|
||
const ns = this.treeAdapter.getNamespaceURI(openElement);
|
||
|
||
if (tn === $.TEMPLATE && ns === NS.HTML) {
|
||
location.parent = this.treeAdapter.getTemplateContent(openElement);
|
||
break;
|
||
} else if (tn === $.TABLE) {
|
||
location.parent = this.treeAdapter.getParentNode(openElement);
|
||
|
||
if (location.parent) {
|
||
location.beforeElement = openElement;
|
||
} else {
|
||
location.parent = this.openElements.items[i - 1];
|
||
}
|
||
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!location.parent) {
|
||
location.parent = this.openElements.items[0];
|
||
}
|
||
|
||
return location;
|
||
}
|
||
|
||
_fosterParentElement(element) {
|
||
const location = this._findFosterParentingLocation();
|
||
|
||
if (location.beforeElement) {
|
||
this.treeAdapter.insertBefore(location.parent, element, location.beforeElement);
|
||
} else {
|
||
this.treeAdapter.appendChild(location.parent, element);
|
||
}
|
||
}
|
||
|
||
_fosterParentText(chars) {
|
||
const location = this._findFosterParentingLocation();
|
||
|
||
if (location.beforeElement) {
|
||
this.treeAdapter.insertTextBefore(location.parent, chars, location.beforeElement);
|
||
} else {
|
||
this.treeAdapter.insertText(location.parent, chars);
|
||
}
|
||
}
|
||
|
||
//Special elements
|
||
_isSpecialElement(element) {
|
||
const tn = this.treeAdapter.getTagName(element);
|
||
const ns = this.treeAdapter.getNamespaceURI(element);
|
||
|
||
return HTML.SPECIAL_ELEMENTS[ns][tn];
|
||
}
|
||
}
|
||
|
||
module.exports = Parser;
|
||
|
||
//Adoption agency algorithm
|
||
//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#adoptionAgency)
|
||
//------------------------------------------------------------------
|
||
|
||
//Steps 5-8 of the algorithm
|
||
function aaObtainFormattingElementEntry(p, token) {
|
||
let formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName);
|
||
|
||
if (formattingElementEntry) {
|
||
if (!p.openElements.contains(formattingElementEntry.element)) {
|
||
p.activeFormattingElements.removeEntry(formattingElementEntry);
|
||
formattingElementEntry = null;
|
||
} else if (!p.openElements.hasInScope(token.tagName)) {
|
||
formattingElementEntry = null;
|
||
}
|
||
} else {
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
|
||
return formattingElementEntry;
|
||
}
|
||
|
||
//Steps 9 and 10 of the algorithm
|
||
function aaObtainFurthestBlock(p, formattingElementEntry) {
|
||
let furthestBlock = null;
|
||
|
||
for (let i = p.openElements.stackTop; i >= 0; i--) {
|
||
const element = p.openElements.items[i];
|
||
|
||
if (element === formattingElementEntry.element) {
|
||
break;
|
||
}
|
||
|
||
if (p._isSpecialElement(element)) {
|
||
furthestBlock = element;
|
||
}
|
||
}
|
||
|
||
if (!furthestBlock) {
|
||
p.openElements.popUntilElementPopped(formattingElementEntry.element);
|
||
p.activeFormattingElements.removeEntry(formattingElementEntry);
|
||
}
|
||
|
||
return furthestBlock;
|
||
}
|
||
|
||
//Step 13 of the algorithm
|
||
function aaInnerLoop(p, furthestBlock, formattingElement) {
|
||
let lastElement = furthestBlock;
|
||
let nextElement = p.openElements.getCommonAncestor(furthestBlock);
|
||
|
||
for (let i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) {
|
||
//NOTE: store next element for the next loop iteration (it may be deleted from the stack by step 9.5)
|
||
nextElement = p.openElements.getCommonAncestor(element);
|
||
|
||
const elementEntry = p.activeFormattingElements.getElementEntry(element);
|
||
const counterOverflow = elementEntry && i >= AA_INNER_LOOP_ITER;
|
||
const shouldRemoveFromOpenElements = !elementEntry || counterOverflow;
|
||
|
||
if (shouldRemoveFromOpenElements) {
|
||
if (counterOverflow) {
|
||
p.activeFormattingElements.removeEntry(elementEntry);
|
||
}
|
||
|
||
p.openElements.remove(element);
|
||
} else {
|
||
element = aaRecreateElementFromEntry(p, elementEntry);
|
||
|
||
if (lastElement === furthestBlock) {
|
||
p.activeFormattingElements.bookmark = elementEntry;
|
||
}
|
||
|
||
p.treeAdapter.detachNode(lastElement);
|
||
p.treeAdapter.appendChild(element, lastElement);
|
||
lastElement = element;
|
||
}
|
||
}
|
||
|
||
return lastElement;
|
||
}
|
||
|
||
//Step 13.7 of the algorithm
|
||
function aaRecreateElementFromEntry(p, elementEntry) {
|
||
const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);
|
||
const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);
|
||
|
||
p.openElements.replace(elementEntry.element, newElement);
|
||
elementEntry.element = newElement;
|
||
|
||
return newElement;
|
||
}
|
||
|
||
//Step 14 of the algorithm
|
||
function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) {
|
||
if (p._isElementCausesFosterParenting(commonAncestor)) {
|
||
p._fosterParentElement(lastElement);
|
||
} else {
|
||
const tn = p.treeAdapter.getTagName(commonAncestor);
|
||
const ns = p.treeAdapter.getNamespaceURI(commonAncestor);
|
||
|
||
if (tn === $.TEMPLATE && ns === NS.HTML) {
|
||
commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor);
|
||
}
|
||
|
||
p.treeAdapter.appendChild(commonAncestor, lastElement);
|
||
}
|
||
}
|
||
|
||
//Steps 15-19 of the algorithm
|
||
function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) {
|
||
const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element);
|
||
const token = formattingElementEntry.token;
|
||
const newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs);
|
||
|
||
p._adoptNodes(furthestBlock, newElement);
|
||
p.treeAdapter.appendChild(furthestBlock, newElement);
|
||
|
||
p.activeFormattingElements.insertElementAfterBookmark(newElement, formattingElementEntry.token);
|
||
p.activeFormattingElements.removeEntry(formattingElementEntry);
|
||
|
||
p.openElements.remove(formattingElementEntry.element);
|
||
p.openElements.insertAfter(furthestBlock, newElement);
|
||
}
|
||
|
||
//Algorithm entry point
|
||
function callAdoptionAgency(p, token) {
|
||
let formattingElementEntry;
|
||
|
||
for (let i = 0; i < AA_OUTER_LOOP_ITER; i++) {
|
||
formattingElementEntry = aaObtainFormattingElementEntry(p, token, formattingElementEntry);
|
||
|
||
if (!formattingElementEntry) {
|
||
break;
|
||
}
|
||
|
||
const furthestBlock = aaObtainFurthestBlock(p, formattingElementEntry);
|
||
|
||
if (!furthestBlock) {
|
||
break;
|
||
}
|
||
|
||
p.activeFormattingElements.bookmark = formattingElementEntry;
|
||
|
||
const lastElement = aaInnerLoop(p, furthestBlock, formattingElementEntry.element);
|
||
const commonAncestor = p.openElements.getCommonAncestor(formattingElementEntry.element);
|
||
|
||
p.treeAdapter.detachNode(lastElement);
|
||
aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement);
|
||
aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry);
|
||
}
|
||
}
|
||
|
||
//Generic token handlers
|
||
//------------------------------------------------------------------
|
||
function ignoreToken() {
|
||
//NOTE: do nothing =)
|
||
}
|
||
|
||
function misplacedDoctype(p) {
|
||
p._err(ERR.misplacedDoctype);
|
||
}
|
||
|
||
function appendComment(p, token) {
|
||
p._appendCommentNode(token, p.openElements.currentTmplContent || p.openElements.current);
|
||
}
|
||
|
||
function appendCommentToRootHtmlElement(p, token) {
|
||
p._appendCommentNode(token, p.openElements.items[0]);
|
||
}
|
||
|
||
function appendCommentToDocument(p, token) {
|
||
p._appendCommentNode(token, p.document);
|
||
}
|
||
|
||
function insertCharacters(p, token) {
|
||
p._insertCharacters(token);
|
||
}
|
||
|
||
function stopParsing(p) {
|
||
p.stopped = true;
|
||
}
|
||
|
||
// The "initial" insertion mode
|
||
//------------------------------------------------------------------
|
||
function doctypeInInitialMode(p, token) {
|
||
p._setDocumentType(token);
|
||
|
||
const mode = token.forceQuirks ? HTML.DOCUMENT_MODE.QUIRKS : doctype.getDocumentMode(token);
|
||
|
||
if (!doctype.isConforming(token)) {
|
||
p._err(ERR.nonConformingDoctype);
|
||
}
|
||
|
||
p.treeAdapter.setDocumentMode(p.document, mode);
|
||
|
||
p.insertionMode = BEFORE_HTML_MODE;
|
||
}
|
||
|
||
function tokenInInitialMode(p, token) {
|
||
p._err(ERR.missingDoctype, { beforeToken: true });
|
||
p.treeAdapter.setDocumentMode(p.document, HTML.DOCUMENT_MODE.QUIRKS);
|
||
p.insertionMode = BEFORE_HTML_MODE;
|
||
p._processToken(token);
|
||
}
|
||
|
||
// The "before html" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagBeforeHtml(p, token) {
|
||
if (token.tagName === $.HTML) {
|
||
p._insertElement(token, NS.HTML);
|
||
p.insertionMode = BEFORE_HEAD_MODE;
|
||
} else {
|
||
tokenBeforeHtml(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagBeforeHtml(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HTML || tn === $.HEAD || tn === $.BODY || tn === $.BR) {
|
||
tokenBeforeHtml(p, token);
|
||
}
|
||
}
|
||
|
||
function tokenBeforeHtml(p, token) {
|
||
p._insertFakeRootElement();
|
||
p.insertionMode = BEFORE_HEAD_MODE;
|
||
p._processToken(token);
|
||
}
|
||
|
||
// The "before head" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagBeforeHead(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else if (tn === $.HEAD) {
|
||
p._insertElement(token, NS.HTML);
|
||
p.headElement = p.openElements.current;
|
||
p.insertionMode = IN_HEAD_MODE;
|
||
} else {
|
||
tokenBeforeHead(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagBeforeHead(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HEAD || tn === $.BODY || tn === $.HTML || tn === $.BR) {
|
||
tokenBeforeHead(p, token);
|
||
} else {
|
||
p._err(ERR.endTagWithoutMatchingOpenElement);
|
||
}
|
||
}
|
||
|
||
function tokenBeforeHead(p, token) {
|
||
p._insertFakeElement($.HEAD);
|
||
p.headElement = p.openElements.current;
|
||
p.insertionMode = IN_HEAD_MODE;
|
||
p._processToken(token);
|
||
}
|
||
|
||
// The "in head" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInHead(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META) {
|
||
p._appendElement(token, NS.HTML);
|
||
token.ackSelfClosing = true;
|
||
} else if (tn === $.TITLE) {
|
||
p._switchToTextParsing(token, Tokenizer.MODE.RCDATA);
|
||
} else if (tn === $.NOSCRIPT) {
|
||
if (p.options.scriptingEnabled) {
|
||
p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);
|
||
} else {
|
||
p._insertElement(token, NS.HTML);
|
||
p.insertionMode = IN_HEAD_NO_SCRIPT_MODE;
|
||
}
|
||
} else if (tn === $.NOFRAMES || tn === $.STYLE) {
|
||
p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);
|
||
} else if (tn === $.SCRIPT) {
|
||
p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA);
|
||
} else if (tn === $.TEMPLATE) {
|
||
p._insertTemplate(token, NS.HTML);
|
||
p.activeFormattingElements.insertMarker();
|
||
p.framesetOk = false;
|
||
p.insertionMode = IN_TEMPLATE_MODE;
|
||
p._pushTmplInsertionMode(IN_TEMPLATE_MODE);
|
||
} else if (tn === $.HEAD) {
|
||
p._err(ERR.misplacedStartTagForHeadElement);
|
||
} else {
|
||
tokenInHead(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInHead(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HEAD) {
|
||
p.openElements.pop();
|
||
p.insertionMode = AFTER_HEAD_MODE;
|
||
} else if (tn === $.BODY || tn === $.BR || tn === $.HTML) {
|
||
tokenInHead(p, token);
|
||
} else if (tn === $.TEMPLATE) {
|
||
if (p.openElements.tmplCount > 0) {
|
||
p.openElements.generateImpliedEndTagsThoroughly();
|
||
|
||
if (p.openElements.currentTagName !== $.TEMPLATE) {
|
||
p._err(ERR.closingOfElementWithOpenChildElements);
|
||
}
|
||
|
||
p.openElements.popUntilTagNamePopped($.TEMPLATE);
|
||
p.activeFormattingElements.clearToLastMarker();
|
||
p._popTmplInsertionMode();
|
||
p._resetInsertionMode();
|
||
} else {
|
||
p._err(ERR.endTagWithoutMatchingOpenElement);
|
||
}
|
||
} else {
|
||
p._err(ERR.endTagWithoutMatchingOpenElement);
|
||
}
|
||
}
|
||
|
||
function tokenInHead(p, token) {
|
||
p.openElements.pop();
|
||
p.insertionMode = AFTER_HEAD_MODE;
|
||
p._processToken(token);
|
||
}
|
||
|
||
// The "in head no script" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInHeadNoScript(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else if (
|
||
tn === $.BASEFONT ||
|
||
tn === $.BGSOUND ||
|
||
tn === $.HEAD ||
|
||
tn === $.LINK ||
|
||
tn === $.META ||
|
||
tn === $.NOFRAMES ||
|
||
tn === $.STYLE
|
||
) {
|
||
startTagInHead(p, token);
|
||
} else if (tn === $.NOSCRIPT) {
|
||
p._err(ERR.nestedNoscriptInHead);
|
||
} else {
|
||
tokenInHeadNoScript(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInHeadNoScript(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.NOSCRIPT) {
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_HEAD_MODE;
|
||
} else if (tn === $.BR) {
|
||
tokenInHeadNoScript(p, token);
|
||
} else {
|
||
p._err(ERR.endTagWithoutMatchingOpenElement);
|
||
}
|
||
}
|
||
|
||
function tokenInHeadNoScript(p, token) {
|
||
const errCode =
|
||
token.type === Tokenizer.EOF_TOKEN ? ERR.openElementsLeftAfterEof : ERR.disallowedContentInNoscriptInHead;
|
||
|
||
p._err(errCode);
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_HEAD_MODE;
|
||
p._processToken(token);
|
||
}
|
||
|
||
// The "after head" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagAfterHead(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else if (tn === $.BODY) {
|
||
p._insertElement(token, NS.HTML);
|
||
p.framesetOk = false;
|
||
p.insertionMode = IN_BODY_MODE;
|
||
} else if (tn === $.FRAMESET) {
|
||
p._insertElement(token, NS.HTML);
|
||
p.insertionMode = IN_FRAMESET_MODE;
|
||
} else if (
|
||
tn === $.BASE ||
|
||
tn === $.BASEFONT ||
|
||
tn === $.BGSOUND ||
|
||
tn === $.LINK ||
|
||
tn === $.META ||
|
||
tn === $.NOFRAMES ||
|
||
tn === $.SCRIPT ||
|
||
tn === $.STYLE ||
|
||
tn === $.TEMPLATE ||
|
||
tn === $.TITLE
|
||
) {
|
||
p._err(ERR.abandonedHeadElementChild);
|
||
p.openElements.push(p.headElement);
|
||
startTagInHead(p, token);
|
||
p.openElements.remove(p.headElement);
|
||
} else if (tn === $.HEAD) {
|
||
p._err(ERR.misplacedStartTagForHeadElement);
|
||
} else {
|
||
tokenAfterHead(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagAfterHead(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.BODY || tn === $.HTML || tn === $.BR) {
|
||
tokenAfterHead(p, token);
|
||
} else if (tn === $.TEMPLATE) {
|
||
endTagInHead(p, token);
|
||
} else {
|
||
p._err(ERR.endTagWithoutMatchingOpenElement);
|
||
}
|
||
}
|
||
|
||
function tokenAfterHead(p, token) {
|
||
p._insertFakeElement($.BODY);
|
||
p.insertionMode = IN_BODY_MODE;
|
||
p._processToken(token);
|
||
}
|
||
|
||
// The "in body" insertion mode
|
||
//------------------------------------------------------------------
|
||
function whitespaceCharacterInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
p._insertCharacters(token);
|
||
}
|
||
|
||
function characterInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
p._insertCharacters(token);
|
||
p.framesetOk = false;
|
||
}
|
||
|
||
function htmlStartTagInBody(p, token) {
|
||
if (p.openElements.tmplCount === 0) {
|
||
p.treeAdapter.adoptAttributes(p.openElements.items[0], token.attrs);
|
||
}
|
||
}
|
||
|
||
function bodyStartTagInBody(p, token) {
|
||
const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
|
||
|
||
if (bodyElement && p.openElements.tmplCount === 0) {
|
||
p.framesetOk = false;
|
||
p.treeAdapter.adoptAttributes(bodyElement, token.attrs);
|
||
}
|
||
}
|
||
|
||
function framesetStartTagInBody(p, token) {
|
||
const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
|
||
|
||
if (p.framesetOk && bodyElement) {
|
||
p.treeAdapter.detachNode(bodyElement);
|
||
p.openElements.popAllUpToHtmlElement();
|
||
p._insertElement(token, NS.HTML);
|
||
p.insertionMode = IN_FRAMESET_MODE;
|
||
}
|
||
}
|
||
|
||
function addressStartTagInBody(p, token) {
|
||
if (p.openElements.hasInButtonScope($.P)) {
|
||
p._closePElement();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
}
|
||
|
||
function numberedHeaderStartTagInBody(p, token) {
|
||
if (p.openElements.hasInButtonScope($.P)) {
|
||
p._closePElement();
|
||
}
|
||
|
||
const tn = p.openElements.currentTagName;
|
||
|
||
if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) {
|
||
p.openElements.pop();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
}
|
||
|
||
function preStartTagInBody(p, token) {
|
||
if (p.openElements.hasInButtonScope($.P)) {
|
||
p._closePElement();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
//NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move
|
||
//on to the next one. (Newlines at the start of pre blocks are ignored as an authoring convenience.)
|
||
p.skipNextNewLine = true;
|
||
p.framesetOk = false;
|
||
}
|
||
|
||
function formStartTagInBody(p, token) {
|
||
const inTemplate = p.openElements.tmplCount > 0;
|
||
|
||
if (!p.formElement || inTemplate) {
|
||
if (p.openElements.hasInButtonScope($.P)) {
|
||
p._closePElement();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
|
||
if (!inTemplate) {
|
||
p.formElement = p.openElements.current;
|
||
}
|
||
}
|
||
}
|
||
|
||
function listItemStartTagInBody(p, token) {
|
||
p.framesetOk = false;
|
||
|
||
const tn = token.tagName;
|
||
|
||
for (let i = p.openElements.stackTop; i >= 0; i--) {
|
||
const element = p.openElements.items[i];
|
||
const elementTn = p.treeAdapter.getTagName(element);
|
||
let closeTn = null;
|
||
|
||
if (tn === $.LI && elementTn === $.LI) {
|
||
closeTn = $.LI;
|
||
} else if ((tn === $.DD || tn === $.DT) && (elementTn === $.DD || elementTn === $.DT)) {
|
||
closeTn = elementTn;
|
||
}
|
||
|
||
if (closeTn) {
|
||
p.openElements.generateImpliedEndTagsWithExclusion(closeTn);
|
||
p.openElements.popUntilTagNamePopped(closeTn);
|
||
break;
|
||
}
|
||
|
||
if (elementTn !== $.ADDRESS && elementTn !== $.DIV && elementTn !== $.P && p._isSpecialElement(element)) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (p.openElements.hasInButtonScope($.P)) {
|
||
p._closePElement();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
}
|
||
|
||
function plaintextStartTagInBody(p, token) {
|
||
if (p.openElements.hasInButtonScope($.P)) {
|
||
p._closePElement();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
p.tokenizer.state = Tokenizer.MODE.PLAINTEXT;
|
||
}
|
||
|
||
function buttonStartTagInBody(p, token) {
|
||
if (p.openElements.hasInScope($.BUTTON)) {
|
||
p.openElements.generateImpliedEndTags();
|
||
p.openElements.popUntilTagNamePopped($.BUTTON);
|
||
}
|
||
|
||
p._reconstructActiveFormattingElements();
|
||
p._insertElement(token, NS.HTML);
|
||
p.framesetOk = false;
|
||
}
|
||
|
||
function aStartTagInBody(p, token) {
|
||
const activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName($.A);
|
||
|
||
if (activeElementEntry) {
|
||
callAdoptionAgency(p, token);
|
||
p.openElements.remove(activeElementEntry.element);
|
||
p.activeFormattingElements.removeEntry(activeElementEntry);
|
||
}
|
||
|
||
p._reconstructActiveFormattingElements();
|
||
p._insertElement(token, NS.HTML);
|
||
p.activeFormattingElements.pushElement(p.openElements.current, token);
|
||
}
|
||
|
||
function bStartTagInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
p._insertElement(token, NS.HTML);
|
||
p.activeFormattingElements.pushElement(p.openElements.current, token);
|
||
}
|
||
|
||
function nobrStartTagInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
|
||
if (p.openElements.hasInScope($.NOBR)) {
|
||
callAdoptionAgency(p, token);
|
||
p._reconstructActiveFormattingElements();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
p.activeFormattingElements.pushElement(p.openElements.current, token);
|
||
}
|
||
|
||
function appletStartTagInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
p._insertElement(token, NS.HTML);
|
||
p.activeFormattingElements.insertMarker();
|
||
p.framesetOk = false;
|
||
}
|
||
|
||
function tableStartTagInBody(p, token) {
|
||
if (
|
||
p.treeAdapter.getDocumentMode(p.document) !== HTML.DOCUMENT_MODE.QUIRKS &&
|
||
p.openElements.hasInButtonScope($.P)
|
||
) {
|
||
p._closePElement();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
p.framesetOk = false;
|
||
p.insertionMode = IN_TABLE_MODE;
|
||
}
|
||
|
||
function areaStartTagInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
p._appendElement(token, NS.HTML);
|
||
p.framesetOk = false;
|
||
token.ackSelfClosing = true;
|
||
}
|
||
|
||
function inputStartTagInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
p._appendElement(token, NS.HTML);
|
||
|
||
const inputType = Tokenizer.getTokenAttr(token, ATTRS.TYPE);
|
||
|
||
if (!inputType || inputType.toLowerCase() !== HIDDEN_INPUT_TYPE) {
|
||
p.framesetOk = false;
|
||
}
|
||
|
||
token.ackSelfClosing = true;
|
||
}
|
||
|
||
function paramStartTagInBody(p, token) {
|
||
p._appendElement(token, NS.HTML);
|
||
token.ackSelfClosing = true;
|
||
}
|
||
|
||
function hrStartTagInBody(p, token) {
|
||
if (p.openElements.hasInButtonScope($.P)) {
|
||
p._closePElement();
|
||
}
|
||
|
||
p._appendElement(token, NS.HTML);
|
||
p.framesetOk = false;
|
||
token.ackSelfClosing = true;
|
||
}
|
||
|
||
function imageStartTagInBody(p, token) {
|
||
token.tagName = $.IMG;
|
||
areaStartTagInBody(p, token);
|
||
}
|
||
|
||
function textareaStartTagInBody(p, token) {
|
||
p._insertElement(token, NS.HTML);
|
||
//NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move
|
||
//on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.)
|
||
p.skipNextNewLine = true;
|
||
p.tokenizer.state = Tokenizer.MODE.RCDATA;
|
||
p.originalInsertionMode = p.insertionMode;
|
||
p.framesetOk = false;
|
||
p.insertionMode = TEXT_MODE;
|
||
}
|
||
|
||
function xmpStartTagInBody(p, token) {
|
||
if (p.openElements.hasInButtonScope($.P)) {
|
||
p._closePElement();
|
||
}
|
||
|
||
p._reconstructActiveFormattingElements();
|
||
p.framesetOk = false;
|
||
p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);
|
||
}
|
||
|
||
function iframeStartTagInBody(p, token) {
|
||
p.framesetOk = false;
|
||
p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);
|
||
}
|
||
|
||
//NOTE: here we assume that we always act as an user agent with enabled plugins, so we parse
|
||
//<noembed> as a rawtext.
|
||
function noembedStartTagInBody(p, token) {
|
||
p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT);
|
||
}
|
||
|
||
function selectStartTagInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
p._insertElement(token, NS.HTML);
|
||
p.framesetOk = false;
|
||
|
||
if (
|
||
p.insertionMode === IN_TABLE_MODE ||
|
||
p.insertionMode === IN_CAPTION_MODE ||
|
||
p.insertionMode === IN_TABLE_BODY_MODE ||
|
||
p.insertionMode === IN_ROW_MODE ||
|
||
p.insertionMode === IN_CELL_MODE
|
||
) {
|
||
p.insertionMode = IN_SELECT_IN_TABLE_MODE;
|
||
} else {
|
||
p.insertionMode = IN_SELECT_MODE;
|
||
}
|
||
}
|
||
|
||
function optgroupStartTagInBody(p, token) {
|
||
if (p.openElements.currentTagName === $.OPTION) {
|
||
p.openElements.pop();
|
||
}
|
||
|
||
p._reconstructActiveFormattingElements();
|
||
p._insertElement(token, NS.HTML);
|
||
}
|
||
|
||
function rbStartTagInBody(p, token) {
|
||
if (p.openElements.hasInScope($.RUBY)) {
|
||
p.openElements.generateImpliedEndTags();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
}
|
||
|
||
function rtStartTagInBody(p, token) {
|
||
if (p.openElements.hasInScope($.RUBY)) {
|
||
p.openElements.generateImpliedEndTagsWithExclusion($.RTC);
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
}
|
||
|
||
function menuStartTagInBody(p, token) {
|
||
if (p.openElements.hasInButtonScope($.P)) {
|
||
p._closePElement();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
}
|
||
|
||
function mathStartTagInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
|
||
foreignContent.adjustTokenMathMLAttrs(token);
|
||
foreignContent.adjustTokenXMLAttrs(token);
|
||
|
||
if (token.selfClosing) {
|
||
p._appendElement(token, NS.MATHML);
|
||
} else {
|
||
p._insertElement(token, NS.MATHML);
|
||
}
|
||
|
||
token.ackSelfClosing = true;
|
||
}
|
||
|
||
function svgStartTagInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
|
||
foreignContent.adjustTokenSVGAttrs(token);
|
||
foreignContent.adjustTokenXMLAttrs(token);
|
||
|
||
if (token.selfClosing) {
|
||
p._appendElement(token, NS.SVG);
|
||
} else {
|
||
p._insertElement(token, NS.SVG);
|
||
}
|
||
|
||
token.ackSelfClosing = true;
|
||
}
|
||
|
||
function genericStartTagInBody(p, token) {
|
||
p._reconstructActiveFormattingElements();
|
||
p._insertElement(token, NS.HTML);
|
||
}
|
||
|
||
//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here.
|
||
//It's faster than using dictionary.
|
||
function startTagInBody(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
switch (tn.length) {
|
||
case 1:
|
||
if (tn === $.I || tn === $.S || tn === $.B || tn === $.U) {
|
||
bStartTagInBody(p, token);
|
||
} else if (tn === $.P) {
|
||
addressStartTagInBody(p, token);
|
||
} else if (tn === $.A) {
|
||
aStartTagInBody(p, token);
|
||
} else {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 2:
|
||
if (tn === $.DL || tn === $.OL || tn === $.UL) {
|
||
addressStartTagInBody(p, token);
|
||
} else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) {
|
||
numberedHeaderStartTagInBody(p, token);
|
||
} else if (tn === $.LI || tn === $.DD || tn === $.DT) {
|
||
listItemStartTagInBody(p, token);
|
||
} else if (tn === $.EM || tn === $.TT) {
|
||
bStartTagInBody(p, token);
|
||
} else if (tn === $.BR) {
|
||
areaStartTagInBody(p, token);
|
||
} else if (tn === $.HR) {
|
||
hrStartTagInBody(p, token);
|
||
} else if (tn === $.RB) {
|
||
rbStartTagInBody(p, token);
|
||
} else if (tn === $.RT || tn === $.RP) {
|
||
rtStartTagInBody(p, token);
|
||
} else if (tn !== $.TH && tn !== $.TD && tn !== $.TR) {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 3:
|
||
if (tn === $.DIV || tn === $.DIR || tn === $.NAV) {
|
||
addressStartTagInBody(p, token);
|
||
} else if (tn === $.PRE) {
|
||
preStartTagInBody(p, token);
|
||
} else if (tn === $.BIG) {
|
||
bStartTagInBody(p, token);
|
||
} else if (tn === $.IMG || tn === $.WBR) {
|
||
areaStartTagInBody(p, token);
|
||
} else if (tn === $.XMP) {
|
||
xmpStartTagInBody(p, token);
|
||
} else if (tn === $.SVG) {
|
||
svgStartTagInBody(p, token);
|
||
} else if (tn === $.RTC) {
|
||
rbStartTagInBody(p, token);
|
||
} else if (tn !== $.COL) {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 4:
|
||
if (tn === $.HTML) {
|
||
htmlStartTagInBody(p, token);
|
||
} else if (tn === $.BASE || tn === $.LINK || tn === $.META) {
|
||
startTagInHead(p, token);
|
||
} else if (tn === $.BODY) {
|
||
bodyStartTagInBody(p, token);
|
||
} else if (tn === $.MAIN || tn === $.MENU) {
|
||
addressStartTagInBody(p, token);
|
||
} else if (tn === $.FORM) {
|
||
formStartTagInBody(p, token);
|
||
} else if (tn === $.CODE || tn === $.FONT) {
|
||
bStartTagInBody(p, token);
|
||
} else if (tn === $.NOBR) {
|
||
nobrStartTagInBody(p, token);
|
||
} else if (tn === $.AREA) {
|
||
areaStartTagInBody(p, token);
|
||
} else if (tn === $.MATH) {
|
||
mathStartTagInBody(p, token);
|
||
} else if (tn === $.MENU) {
|
||
menuStartTagInBody(p, token);
|
||
} else if (tn !== $.HEAD) {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 5:
|
||
if (tn === $.STYLE || tn === $.TITLE) {
|
||
startTagInHead(p, token);
|
||
} else if (tn === $.ASIDE) {
|
||
addressStartTagInBody(p, token);
|
||
} else if (tn === $.SMALL) {
|
||
bStartTagInBody(p, token);
|
||
} else if (tn === $.TABLE) {
|
||
tableStartTagInBody(p, token);
|
||
} else if (tn === $.EMBED) {
|
||
areaStartTagInBody(p, token);
|
||
} else if (tn === $.INPUT) {
|
||
inputStartTagInBody(p, token);
|
||
} else if (tn === $.PARAM || tn === $.TRACK) {
|
||
paramStartTagInBody(p, token);
|
||
} else if (tn === $.IMAGE) {
|
||
imageStartTagInBody(p, token);
|
||
} else if (tn !== $.FRAME && tn !== $.TBODY && tn !== $.TFOOT && tn !== $.THEAD) {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 6:
|
||
if (tn === $.SCRIPT) {
|
||
startTagInHead(p, token);
|
||
} else if (
|
||
tn === $.CENTER ||
|
||
tn === $.FIGURE ||
|
||
tn === $.FOOTER ||
|
||
tn === $.HEADER ||
|
||
tn === $.HGROUP ||
|
||
tn === $.DIALOG
|
||
) {
|
||
addressStartTagInBody(p, token);
|
||
} else if (tn === $.BUTTON) {
|
||
buttonStartTagInBody(p, token);
|
||
} else if (tn === $.STRIKE || tn === $.STRONG) {
|
||
bStartTagInBody(p, token);
|
||
} else if (tn === $.APPLET || tn === $.OBJECT) {
|
||
appletStartTagInBody(p, token);
|
||
} else if (tn === $.KEYGEN) {
|
||
areaStartTagInBody(p, token);
|
||
} else if (tn === $.SOURCE) {
|
||
paramStartTagInBody(p, token);
|
||
} else if (tn === $.IFRAME) {
|
||
iframeStartTagInBody(p, token);
|
||
} else if (tn === $.SELECT) {
|
||
selectStartTagInBody(p, token);
|
||
} else if (tn === $.OPTION) {
|
||
optgroupStartTagInBody(p, token);
|
||
} else {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 7:
|
||
if (tn === $.BGSOUND) {
|
||
startTagInHead(p, token);
|
||
} else if (
|
||
tn === $.DETAILS ||
|
||
tn === $.ADDRESS ||
|
||
tn === $.ARTICLE ||
|
||
tn === $.SECTION ||
|
||
tn === $.SUMMARY
|
||
) {
|
||
addressStartTagInBody(p, token);
|
||
} else if (tn === $.LISTING) {
|
||
preStartTagInBody(p, token);
|
||
} else if (tn === $.MARQUEE) {
|
||
appletStartTagInBody(p, token);
|
||
} else if (tn === $.NOEMBED) {
|
||
noembedStartTagInBody(p, token);
|
||
} else if (tn !== $.CAPTION) {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 8:
|
||
if (tn === $.BASEFONT) {
|
||
startTagInHead(p, token);
|
||
} else if (tn === $.FRAMESET) {
|
||
framesetStartTagInBody(p, token);
|
||
} else if (tn === $.FIELDSET) {
|
||
addressStartTagInBody(p, token);
|
||
} else if (tn === $.TEXTAREA) {
|
||
textareaStartTagInBody(p, token);
|
||
} else if (tn === $.TEMPLATE) {
|
||
startTagInHead(p, token);
|
||
} else if (tn === $.NOSCRIPT) {
|
||
if (p.options.scriptingEnabled) {
|
||
noembedStartTagInBody(p, token);
|
||
} else {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
} else if (tn === $.OPTGROUP) {
|
||
optgroupStartTagInBody(p, token);
|
||
} else if (tn !== $.COLGROUP) {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 9:
|
||
if (tn === $.PLAINTEXT) {
|
||
plaintextStartTagInBody(p, token);
|
||
} else {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 10:
|
||
if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) {
|
||
addressStartTagInBody(p, token);
|
||
} else {
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
default:
|
||
genericStartTagInBody(p, token);
|
||
}
|
||
}
|
||
|
||
function bodyEndTagInBody(p) {
|
||
if (p.openElements.hasInScope($.BODY)) {
|
||
p.insertionMode = AFTER_BODY_MODE;
|
||
}
|
||
}
|
||
|
||
function htmlEndTagInBody(p, token) {
|
||
if (p.openElements.hasInScope($.BODY)) {
|
||
p.insertionMode = AFTER_BODY_MODE;
|
||
p._processToken(token);
|
||
}
|
||
}
|
||
|
||
function addressEndTagInBody(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (p.openElements.hasInScope(tn)) {
|
||
p.openElements.generateImpliedEndTags();
|
||
p.openElements.popUntilTagNamePopped(tn);
|
||
}
|
||
}
|
||
|
||
function formEndTagInBody(p) {
|
||
const inTemplate = p.openElements.tmplCount > 0;
|
||
const formElement = p.formElement;
|
||
|
||
if (!inTemplate) {
|
||
p.formElement = null;
|
||
}
|
||
|
||
if ((formElement || inTemplate) && p.openElements.hasInScope($.FORM)) {
|
||
p.openElements.generateImpliedEndTags();
|
||
|
||
if (inTemplate) {
|
||
p.openElements.popUntilTagNamePopped($.FORM);
|
||
} else {
|
||
p.openElements.remove(formElement);
|
||
}
|
||
}
|
||
}
|
||
|
||
function pEndTagInBody(p) {
|
||
if (!p.openElements.hasInButtonScope($.P)) {
|
||
p._insertFakeElement($.P);
|
||
}
|
||
|
||
p._closePElement();
|
||
}
|
||
|
||
function liEndTagInBody(p) {
|
||
if (p.openElements.hasInListItemScope($.LI)) {
|
||
p.openElements.generateImpliedEndTagsWithExclusion($.LI);
|
||
p.openElements.popUntilTagNamePopped($.LI);
|
||
}
|
||
}
|
||
|
||
function ddEndTagInBody(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (p.openElements.hasInScope(tn)) {
|
||
p.openElements.generateImpliedEndTagsWithExclusion(tn);
|
||
p.openElements.popUntilTagNamePopped(tn);
|
||
}
|
||
}
|
||
|
||
function numberedHeaderEndTagInBody(p) {
|
||
if (p.openElements.hasNumberedHeaderInScope()) {
|
||
p.openElements.generateImpliedEndTags();
|
||
p.openElements.popUntilNumberedHeaderPopped();
|
||
}
|
||
}
|
||
|
||
function appletEndTagInBody(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (p.openElements.hasInScope(tn)) {
|
||
p.openElements.generateImpliedEndTags();
|
||
p.openElements.popUntilTagNamePopped(tn);
|
||
p.activeFormattingElements.clearToLastMarker();
|
||
}
|
||
}
|
||
|
||
function brEndTagInBody(p) {
|
||
p._reconstructActiveFormattingElements();
|
||
p._insertFakeElement($.BR);
|
||
p.openElements.pop();
|
||
p.framesetOk = false;
|
||
}
|
||
|
||
function genericEndTagInBody(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
for (let i = p.openElements.stackTop; i > 0; i--) {
|
||
const element = p.openElements.items[i];
|
||
|
||
if (p.treeAdapter.getTagName(element) === tn) {
|
||
p.openElements.generateImpliedEndTagsWithExclusion(tn);
|
||
p.openElements.popUntilElementPopped(element);
|
||
break;
|
||
}
|
||
|
||
if (p._isSpecialElement(element)) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here.
|
||
//It's faster than using dictionary.
|
||
function endTagInBody(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
switch (tn.length) {
|
||
case 1:
|
||
if (tn === $.A || tn === $.B || tn === $.I || tn === $.S || tn === $.U) {
|
||
callAdoptionAgency(p, token);
|
||
} else if (tn === $.P) {
|
||
pEndTagInBody(p, token);
|
||
} else {
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 2:
|
||
if (tn === $.DL || tn === $.UL || tn === $.OL) {
|
||
addressEndTagInBody(p, token);
|
||
} else if (tn === $.LI) {
|
||
liEndTagInBody(p, token);
|
||
} else if (tn === $.DD || tn === $.DT) {
|
||
ddEndTagInBody(p, token);
|
||
} else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) {
|
||
numberedHeaderEndTagInBody(p, token);
|
||
} else if (tn === $.BR) {
|
||
brEndTagInBody(p, token);
|
||
} else if (tn === $.EM || tn === $.TT) {
|
||
callAdoptionAgency(p, token);
|
||
} else {
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 3:
|
||
if (tn === $.BIG) {
|
||
callAdoptionAgency(p, token);
|
||
} else if (tn === $.DIR || tn === $.DIV || tn === $.NAV || tn === $.PRE) {
|
||
addressEndTagInBody(p, token);
|
||
} else {
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 4:
|
||
if (tn === $.BODY) {
|
||
bodyEndTagInBody(p, token);
|
||
} else if (tn === $.HTML) {
|
||
htmlEndTagInBody(p, token);
|
||
} else if (tn === $.FORM) {
|
||
formEndTagInBody(p, token);
|
||
} else if (tn === $.CODE || tn === $.FONT || tn === $.NOBR) {
|
||
callAdoptionAgency(p, token);
|
||
} else if (tn === $.MAIN || tn === $.MENU) {
|
||
addressEndTagInBody(p, token);
|
||
} else {
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 5:
|
||
if (tn === $.ASIDE) {
|
||
addressEndTagInBody(p, token);
|
||
} else if (tn === $.SMALL) {
|
||
callAdoptionAgency(p, token);
|
||
} else {
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 6:
|
||
if (
|
||
tn === $.CENTER ||
|
||
tn === $.FIGURE ||
|
||
tn === $.FOOTER ||
|
||
tn === $.HEADER ||
|
||
tn === $.HGROUP ||
|
||
tn === $.DIALOG
|
||
) {
|
||
addressEndTagInBody(p, token);
|
||
} else if (tn === $.APPLET || tn === $.OBJECT) {
|
||
appletEndTagInBody(p, token);
|
||
} else if (tn === $.STRIKE || tn === $.STRONG) {
|
||
callAdoptionAgency(p, token);
|
||
} else {
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 7:
|
||
if (
|
||
tn === $.ADDRESS ||
|
||
tn === $.ARTICLE ||
|
||
tn === $.DETAILS ||
|
||
tn === $.SECTION ||
|
||
tn === $.SUMMARY ||
|
||
tn === $.LISTING
|
||
) {
|
||
addressEndTagInBody(p, token);
|
||
} else if (tn === $.MARQUEE) {
|
||
appletEndTagInBody(p, token);
|
||
} else {
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 8:
|
||
if (tn === $.FIELDSET) {
|
||
addressEndTagInBody(p, token);
|
||
} else if (tn === $.TEMPLATE) {
|
||
endTagInHead(p, token);
|
||
} else {
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 10:
|
||
if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) {
|
||
addressEndTagInBody(p, token);
|
||
} else {
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
default:
|
||
genericEndTagInBody(p, token);
|
||
}
|
||
}
|
||
|
||
function eofInBody(p, token) {
|
||
if (p.tmplInsertionModeStackTop > -1) {
|
||
eofInTemplate(p, token);
|
||
} else {
|
||
p.stopped = true;
|
||
}
|
||
}
|
||
|
||
// The "text" insertion mode
|
||
//------------------------------------------------------------------
|
||
function endTagInText(p, token) {
|
||
if (token.tagName === $.SCRIPT) {
|
||
p.pendingScript = p.openElements.current;
|
||
}
|
||
|
||
p.openElements.pop();
|
||
p.insertionMode = p.originalInsertionMode;
|
||
}
|
||
|
||
function eofInText(p, token) {
|
||
p._err(ERR.eofInElementThatCanContainOnlyText);
|
||
p.openElements.pop();
|
||
p.insertionMode = p.originalInsertionMode;
|
||
p._processToken(token);
|
||
}
|
||
|
||
// The "in table" insertion mode
|
||
//------------------------------------------------------------------
|
||
function characterInTable(p, token) {
|
||
const curTn = p.openElements.currentTagName;
|
||
|
||
if (curTn === $.TABLE || curTn === $.TBODY || curTn === $.TFOOT || curTn === $.THEAD || curTn === $.TR) {
|
||
p.pendingCharacterTokens = [];
|
||
p.hasNonWhitespacePendingCharacterToken = false;
|
||
p.originalInsertionMode = p.insertionMode;
|
||
p.insertionMode = IN_TABLE_TEXT_MODE;
|
||
p._processToken(token);
|
||
} else {
|
||
tokenInTable(p, token);
|
||
}
|
||
}
|
||
|
||
function captionStartTagInTable(p, token) {
|
||
p.openElements.clearBackToTableContext();
|
||
p.activeFormattingElements.insertMarker();
|
||
p._insertElement(token, NS.HTML);
|
||
p.insertionMode = IN_CAPTION_MODE;
|
||
}
|
||
|
||
function colgroupStartTagInTable(p, token) {
|
||
p.openElements.clearBackToTableContext();
|
||
p._insertElement(token, NS.HTML);
|
||
p.insertionMode = IN_COLUMN_GROUP_MODE;
|
||
}
|
||
|
||
function colStartTagInTable(p, token) {
|
||
p.openElements.clearBackToTableContext();
|
||
p._insertFakeElement($.COLGROUP);
|
||
p.insertionMode = IN_COLUMN_GROUP_MODE;
|
||
p._processToken(token);
|
||
}
|
||
|
||
function tbodyStartTagInTable(p, token) {
|
||
p.openElements.clearBackToTableContext();
|
||
p._insertElement(token, NS.HTML);
|
||
p.insertionMode = IN_TABLE_BODY_MODE;
|
||
}
|
||
|
||
function tdStartTagInTable(p, token) {
|
||
p.openElements.clearBackToTableContext();
|
||
p._insertFakeElement($.TBODY);
|
||
p.insertionMode = IN_TABLE_BODY_MODE;
|
||
p._processToken(token);
|
||
}
|
||
|
||
function tableStartTagInTable(p, token) {
|
||
if (p.openElements.hasInTableScope($.TABLE)) {
|
||
p.openElements.popUntilTagNamePopped($.TABLE);
|
||
p._resetInsertionMode();
|
||
p._processToken(token);
|
||
}
|
||
}
|
||
|
||
function inputStartTagInTable(p, token) {
|
||
const inputType = Tokenizer.getTokenAttr(token, ATTRS.TYPE);
|
||
|
||
if (inputType && inputType.toLowerCase() === HIDDEN_INPUT_TYPE) {
|
||
p._appendElement(token, NS.HTML);
|
||
} else {
|
||
tokenInTable(p, token);
|
||
}
|
||
|
||
token.ackSelfClosing = true;
|
||
}
|
||
|
||
function formStartTagInTable(p, token) {
|
||
if (!p.formElement && p.openElements.tmplCount === 0) {
|
||
p._insertElement(token, NS.HTML);
|
||
p.formElement = p.openElements.current;
|
||
p.openElements.pop();
|
||
}
|
||
}
|
||
|
||
function startTagInTable(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
switch (tn.length) {
|
||
case 2:
|
||
if (tn === $.TD || tn === $.TH || tn === $.TR) {
|
||
tdStartTagInTable(p, token);
|
||
} else {
|
||
tokenInTable(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 3:
|
||
if (tn === $.COL) {
|
||
colStartTagInTable(p, token);
|
||
} else {
|
||
tokenInTable(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 4:
|
||
if (tn === $.FORM) {
|
||
formStartTagInTable(p, token);
|
||
} else {
|
||
tokenInTable(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 5:
|
||
if (tn === $.TABLE) {
|
||
tableStartTagInTable(p, token);
|
||
} else if (tn === $.STYLE) {
|
||
startTagInHead(p, token);
|
||
} else if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) {
|
||
tbodyStartTagInTable(p, token);
|
||
} else if (tn === $.INPUT) {
|
||
inputStartTagInTable(p, token);
|
||
} else {
|
||
tokenInTable(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 6:
|
||
if (tn === $.SCRIPT) {
|
||
startTagInHead(p, token);
|
||
} else {
|
||
tokenInTable(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 7:
|
||
if (tn === $.CAPTION) {
|
||
captionStartTagInTable(p, token);
|
||
} else {
|
||
tokenInTable(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
case 8:
|
||
if (tn === $.COLGROUP) {
|
||
colgroupStartTagInTable(p, token);
|
||
} else if (tn === $.TEMPLATE) {
|
||
startTagInHead(p, token);
|
||
} else {
|
||
tokenInTable(p, token);
|
||
}
|
||
|
||
break;
|
||
|
||
default:
|
||
tokenInTable(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInTable(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.TABLE) {
|
||
if (p.openElements.hasInTableScope($.TABLE)) {
|
||
p.openElements.popUntilTagNamePopped($.TABLE);
|
||
p._resetInsertionMode();
|
||
}
|
||
} else if (tn === $.TEMPLATE) {
|
||
endTagInHead(p, token);
|
||
} else if (
|
||
tn !== $.BODY &&
|
||
tn !== $.CAPTION &&
|
||
tn !== $.COL &&
|
||
tn !== $.COLGROUP &&
|
||
tn !== $.HTML &&
|
||
tn !== $.TBODY &&
|
||
tn !== $.TD &&
|
||
tn !== $.TFOOT &&
|
||
tn !== $.TH &&
|
||
tn !== $.THEAD &&
|
||
tn !== $.TR
|
||
) {
|
||
tokenInTable(p, token);
|
||
}
|
||
}
|
||
|
||
function tokenInTable(p, token) {
|
||
const savedFosterParentingState = p.fosterParentingEnabled;
|
||
|
||
p.fosterParentingEnabled = true;
|
||
p._processTokenInBodyMode(token);
|
||
p.fosterParentingEnabled = savedFosterParentingState;
|
||
}
|
||
|
||
// The "in table text" insertion mode
|
||
//------------------------------------------------------------------
|
||
function whitespaceCharacterInTableText(p, token) {
|
||
p.pendingCharacterTokens.push(token);
|
||
}
|
||
|
||
function characterInTableText(p, token) {
|
||
p.pendingCharacterTokens.push(token);
|
||
p.hasNonWhitespacePendingCharacterToken = true;
|
||
}
|
||
|
||
function tokenInTableText(p, token) {
|
||
let i = 0;
|
||
|
||
if (p.hasNonWhitespacePendingCharacterToken) {
|
||
for (; i < p.pendingCharacterTokens.length; i++) {
|
||
tokenInTable(p, p.pendingCharacterTokens[i]);
|
||
}
|
||
} else {
|
||
for (; i < p.pendingCharacterTokens.length; i++) {
|
||
p._insertCharacters(p.pendingCharacterTokens[i]);
|
||
}
|
||
}
|
||
|
||
p.insertionMode = p.originalInsertionMode;
|
||
p._processToken(token);
|
||
}
|
||
|
||
// The "in caption" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInCaption(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (
|
||
tn === $.CAPTION ||
|
||
tn === $.COL ||
|
||
tn === $.COLGROUP ||
|
||
tn === $.TBODY ||
|
||
tn === $.TD ||
|
||
tn === $.TFOOT ||
|
||
tn === $.TH ||
|
||
tn === $.THEAD ||
|
||
tn === $.TR
|
||
) {
|
||
if (p.openElements.hasInTableScope($.CAPTION)) {
|
||
p.openElements.generateImpliedEndTags();
|
||
p.openElements.popUntilTagNamePopped($.CAPTION);
|
||
p.activeFormattingElements.clearToLastMarker();
|
||
p.insertionMode = IN_TABLE_MODE;
|
||
p._processToken(token);
|
||
}
|
||
} else {
|
||
startTagInBody(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInCaption(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.CAPTION || tn === $.TABLE) {
|
||
if (p.openElements.hasInTableScope($.CAPTION)) {
|
||
p.openElements.generateImpliedEndTags();
|
||
p.openElements.popUntilTagNamePopped($.CAPTION);
|
||
p.activeFormattingElements.clearToLastMarker();
|
||
p.insertionMode = IN_TABLE_MODE;
|
||
|
||
if (tn === $.TABLE) {
|
||
p._processToken(token);
|
||
}
|
||
}
|
||
} else if (
|
||
tn !== $.BODY &&
|
||
tn !== $.COL &&
|
||
tn !== $.COLGROUP &&
|
||
tn !== $.HTML &&
|
||
tn !== $.TBODY &&
|
||
tn !== $.TD &&
|
||
tn !== $.TFOOT &&
|
||
tn !== $.TH &&
|
||
tn !== $.THEAD &&
|
||
tn !== $.TR
|
||
) {
|
||
endTagInBody(p, token);
|
||
}
|
||
}
|
||
|
||
// The "in column group" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInColumnGroup(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else if (tn === $.COL) {
|
||
p._appendElement(token, NS.HTML);
|
||
token.ackSelfClosing = true;
|
||
} else if (tn === $.TEMPLATE) {
|
||
startTagInHead(p, token);
|
||
} else {
|
||
tokenInColumnGroup(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInColumnGroup(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.COLGROUP) {
|
||
if (p.openElements.currentTagName === $.COLGROUP) {
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_TABLE_MODE;
|
||
}
|
||
} else if (tn === $.TEMPLATE) {
|
||
endTagInHead(p, token);
|
||
} else if (tn !== $.COL) {
|
||
tokenInColumnGroup(p, token);
|
||
}
|
||
}
|
||
|
||
function tokenInColumnGroup(p, token) {
|
||
if (p.openElements.currentTagName === $.COLGROUP) {
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_TABLE_MODE;
|
||
p._processToken(token);
|
||
}
|
||
}
|
||
|
||
// The "in table body" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInTableBody(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.TR) {
|
||
p.openElements.clearBackToTableBodyContext();
|
||
p._insertElement(token, NS.HTML);
|
||
p.insertionMode = IN_ROW_MODE;
|
||
} else if (tn === $.TH || tn === $.TD) {
|
||
p.openElements.clearBackToTableBodyContext();
|
||
p._insertFakeElement($.TR);
|
||
p.insertionMode = IN_ROW_MODE;
|
||
p._processToken(token);
|
||
} else if (
|
||
tn === $.CAPTION ||
|
||
tn === $.COL ||
|
||
tn === $.COLGROUP ||
|
||
tn === $.TBODY ||
|
||
tn === $.TFOOT ||
|
||
tn === $.THEAD
|
||
) {
|
||
if (p.openElements.hasTableBodyContextInTableScope()) {
|
||
p.openElements.clearBackToTableBodyContext();
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_TABLE_MODE;
|
||
p._processToken(token);
|
||
}
|
||
} else {
|
||
startTagInTable(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInTableBody(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) {
|
||
if (p.openElements.hasInTableScope(tn)) {
|
||
p.openElements.clearBackToTableBodyContext();
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_TABLE_MODE;
|
||
}
|
||
} else if (tn === $.TABLE) {
|
||
if (p.openElements.hasTableBodyContextInTableScope()) {
|
||
p.openElements.clearBackToTableBodyContext();
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_TABLE_MODE;
|
||
p._processToken(token);
|
||
}
|
||
} else if (
|
||
(tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP) ||
|
||
(tn !== $.HTML && tn !== $.TD && tn !== $.TH && tn !== $.TR)
|
||
) {
|
||
endTagInTable(p, token);
|
||
}
|
||
}
|
||
|
||
// The "in row" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInRow(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.TH || tn === $.TD) {
|
||
p.openElements.clearBackToTableRowContext();
|
||
p._insertElement(token, NS.HTML);
|
||
p.insertionMode = IN_CELL_MODE;
|
||
p.activeFormattingElements.insertMarker();
|
||
} else if (
|
||
tn === $.CAPTION ||
|
||
tn === $.COL ||
|
||
tn === $.COLGROUP ||
|
||
tn === $.TBODY ||
|
||
tn === $.TFOOT ||
|
||
tn === $.THEAD ||
|
||
tn === $.TR
|
||
) {
|
||
if (p.openElements.hasInTableScope($.TR)) {
|
||
p.openElements.clearBackToTableRowContext();
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_TABLE_BODY_MODE;
|
||
p._processToken(token);
|
||
}
|
||
} else {
|
||
startTagInTable(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInRow(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.TR) {
|
||
if (p.openElements.hasInTableScope($.TR)) {
|
||
p.openElements.clearBackToTableRowContext();
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_TABLE_BODY_MODE;
|
||
}
|
||
} else if (tn === $.TABLE) {
|
||
if (p.openElements.hasInTableScope($.TR)) {
|
||
p.openElements.clearBackToTableRowContext();
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_TABLE_BODY_MODE;
|
||
p._processToken(token);
|
||
}
|
||
} else if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) {
|
||
if (p.openElements.hasInTableScope(tn) || p.openElements.hasInTableScope($.TR)) {
|
||
p.openElements.clearBackToTableRowContext();
|
||
p.openElements.pop();
|
||
p.insertionMode = IN_TABLE_BODY_MODE;
|
||
p._processToken(token);
|
||
}
|
||
} else if (
|
||
(tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP) ||
|
||
(tn !== $.HTML && tn !== $.TD && tn !== $.TH)
|
||
) {
|
||
endTagInTable(p, token);
|
||
}
|
||
}
|
||
|
||
// The "in cell" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInCell(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (
|
||
tn === $.CAPTION ||
|
||
tn === $.COL ||
|
||
tn === $.COLGROUP ||
|
||
tn === $.TBODY ||
|
||
tn === $.TD ||
|
||
tn === $.TFOOT ||
|
||
tn === $.TH ||
|
||
tn === $.THEAD ||
|
||
tn === $.TR
|
||
) {
|
||
if (p.openElements.hasInTableScope($.TD) || p.openElements.hasInTableScope($.TH)) {
|
||
p._closeTableCell();
|
||
p._processToken(token);
|
||
}
|
||
} else {
|
||
startTagInBody(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInCell(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.TD || tn === $.TH) {
|
||
if (p.openElements.hasInTableScope(tn)) {
|
||
p.openElements.generateImpliedEndTags();
|
||
p.openElements.popUntilTagNamePopped(tn);
|
||
p.activeFormattingElements.clearToLastMarker();
|
||
p.insertionMode = IN_ROW_MODE;
|
||
}
|
||
} else if (tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR) {
|
||
if (p.openElements.hasInTableScope(tn)) {
|
||
p._closeTableCell();
|
||
p._processToken(token);
|
||
}
|
||
} else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML) {
|
||
endTagInBody(p, token);
|
||
}
|
||
}
|
||
|
||
// The "in select" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInSelect(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else if (tn === $.OPTION) {
|
||
if (p.openElements.currentTagName === $.OPTION) {
|
||
p.openElements.pop();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
} else if (tn === $.OPTGROUP) {
|
||
if (p.openElements.currentTagName === $.OPTION) {
|
||
p.openElements.pop();
|
||
}
|
||
|
||
if (p.openElements.currentTagName === $.OPTGROUP) {
|
||
p.openElements.pop();
|
||
}
|
||
|
||
p._insertElement(token, NS.HTML);
|
||
} else if (tn === $.INPUT || tn === $.KEYGEN || tn === $.TEXTAREA || tn === $.SELECT) {
|
||
if (p.openElements.hasInSelectScope($.SELECT)) {
|
||
p.openElements.popUntilTagNamePopped($.SELECT);
|
||
p._resetInsertionMode();
|
||
|
||
if (tn !== $.SELECT) {
|
||
p._processToken(token);
|
||
}
|
||
}
|
||
} else if (tn === $.SCRIPT || tn === $.TEMPLATE) {
|
||
startTagInHead(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInSelect(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.OPTGROUP) {
|
||
const prevOpenElement = p.openElements.items[p.openElements.stackTop - 1];
|
||
const prevOpenElementTn = prevOpenElement && p.treeAdapter.getTagName(prevOpenElement);
|
||
|
||
if (p.openElements.currentTagName === $.OPTION && prevOpenElementTn === $.OPTGROUP) {
|
||
p.openElements.pop();
|
||
}
|
||
|
||
if (p.openElements.currentTagName === $.OPTGROUP) {
|
||
p.openElements.pop();
|
||
}
|
||
} else if (tn === $.OPTION) {
|
||
if (p.openElements.currentTagName === $.OPTION) {
|
||
p.openElements.pop();
|
||
}
|
||
} else if (tn === $.SELECT && p.openElements.hasInSelectScope($.SELECT)) {
|
||
p.openElements.popUntilTagNamePopped($.SELECT);
|
||
p._resetInsertionMode();
|
||
} else if (tn === $.TEMPLATE) {
|
||
endTagInHead(p, token);
|
||
}
|
||
}
|
||
|
||
//12.2.5.4.17 The "in select in table" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInSelectInTable(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (
|
||
tn === $.CAPTION ||
|
||
tn === $.TABLE ||
|
||
tn === $.TBODY ||
|
||
tn === $.TFOOT ||
|
||
tn === $.THEAD ||
|
||
tn === $.TR ||
|
||
tn === $.TD ||
|
||
tn === $.TH
|
||
) {
|
||
p.openElements.popUntilTagNamePopped($.SELECT);
|
||
p._resetInsertionMode();
|
||
p._processToken(token);
|
||
} else {
|
||
startTagInSelect(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInSelectInTable(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (
|
||
tn === $.CAPTION ||
|
||
tn === $.TABLE ||
|
||
tn === $.TBODY ||
|
||
tn === $.TFOOT ||
|
||
tn === $.THEAD ||
|
||
tn === $.TR ||
|
||
tn === $.TD ||
|
||
tn === $.TH
|
||
) {
|
||
if (p.openElements.hasInTableScope(tn)) {
|
||
p.openElements.popUntilTagNamePopped($.SELECT);
|
||
p._resetInsertionMode();
|
||
p._processToken(token);
|
||
}
|
||
} else {
|
||
endTagInSelect(p, token);
|
||
}
|
||
}
|
||
|
||
// The "in template" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInTemplate(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (
|
||
tn === $.BASE ||
|
||
tn === $.BASEFONT ||
|
||
tn === $.BGSOUND ||
|
||
tn === $.LINK ||
|
||
tn === $.META ||
|
||
tn === $.NOFRAMES ||
|
||
tn === $.SCRIPT ||
|
||
tn === $.STYLE ||
|
||
tn === $.TEMPLATE ||
|
||
tn === $.TITLE
|
||
) {
|
||
startTagInHead(p, token);
|
||
} else {
|
||
const newInsertionMode = TEMPLATE_INSERTION_MODE_SWITCH_MAP[tn] || IN_BODY_MODE;
|
||
|
||
p._popTmplInsertionMode();
|
||
p._pushTmplInsertionMode(newInsertionMode);
|
||
p.insertionMode = newInsertionMode;
|
||
p._processToken(token);
|
||
}
|
||
}
|
||
|
||
function endTagInTemplate(p, token) {
|
||
if (token.tagName === $.TEMPLATE) {
|
||
endTagInHead(p, token);
|
||
}
|
||
}
|
||
|
||
function eofInTemplate(p, token) {
|
||
if (p.openElements.tmplCount > 0) {
|
||
p.openElements.popUntilTagNamePopped($.TEMPLATE);
|
||
p.activeFormattingElements.clearToLastMarker();
|
||
p._popTmplInsertionMode();
|
||
p._resetInsertionMode();
|
||
p._processToken(token);
|
||
} else {
|
||
p.stopped = true;
|
||
}
|
||
}
|
||
|
||
// The "after body" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagAfterBody(p, token) {
|
||
if (token.tagName === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else {
|
||
tokenAfterBody(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagAfterBody(p, token) {
|
||
if (token.tagName === $.HTML) {
|
||
if (!p.fragmentContext) {
|
||
p.insertionMode = AFTER_AFTER_BODY_MODE;
|
||
}
|
||
} else {
|
||
tokenAfterBody(p, token);
|
||
}
|
||
}
|
||
|
||
function tokenAfterBody(p, token) {
|
||
p.insertionMode = IN_BODY_MODE;
|
||
p._processToken(token);
|
||
}
|
||
|
||
// The "in frameset" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagInFrameset(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else if (tn === $.FRAMESET) {
|
||
p._insertElement(token, NS.HTML);
|
||
} else if (tn === $.FRAME) {
|
||
p._appendElement(token, NS.HTML);
|
||
token.ackSelfClosing = true;
|
||
} else if (tn === $.NOFRAMES) {
|
||
startTagInHead(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagInFrameset(p, token) {
|
||
if (token.tagName === $.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) {
|
||
p.openElements.pop();
|
||
|
||
if (!p.fragmentContext && p.openElements.currentTagName !== $.FRAMESET) {
|
||
p.insertionMode = AFTER_FRAMESET_MODE;
|
||
}
|
||
}
|
||
}
|
||
|
||
// The "after frameset" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagAfterFrameset(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else if (tn === $.NOFRAMES) {
|
||
startTagInHead(p, token);
|
||
}
|
||
}
|
||
|
||
function endTagAfterFrameset(p, token) {
|
||
if (token.tagName === $.HTML) {
|
||
p.insertionMode = AFTER_AFTER_FRAMESET_MODE;
|
||
}
|
||
}
|
||
|
||
// The "after after body" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagAfterAfterBody(p, token) {
|
||
if (token.tagName === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else {
|
||
tokenAfterAfterBody(p, token);
|
||
}
|
||
}
|
||
|
||
function tokenAfterAfterBody(p, token) {
|
||
p.insertionMode = IN_BODY_MODE;
|
||
p._processToken(token);
|
||
}
|
||
|
||
// The "after after frameset" insertion mode
|
||
//------------------------------------------------------------------
|
||
function startTagAfterAfterFrameset(p, token) {
|
||
const tn = token.tagName;
|
||
|
||
if (tn === $.HTML) {
|
||
startTagInBody(p, token);
|
||
} else if (tn === $.NOFRAMES) {
|
||
startTagInHead(p, token);
|
||
}
|
||
}
|
||
|
||
// The rules for parsing tokens in foreign content
|
||
//------------------------------------------------------------------
|
||
function nullCharacterInForeignContent(p, token) {
|
||
token.chars = unicode.REPLACEMENT_CHARACTER;
|
||
p._insertCharacters(token);
|
||
}
|
||
|
||
function characterInForeignContent(p, token) {
|
||
p._insertCharacters(token);
|
||
p.framesetOk = false;
|
||
}
|
||
|
||
function startTagInForeignContent(p, token) {
|
||
if (foreignContent.causesExit(token) && !p.fragmentContext) {
|
||
while (
|
||
p.treeAdapter.getNamespaceURI(p.openElements.current) !== NS.HTML &&
|
||
!p._isIntegrationPoint(p.openElements.current)
|
||
) {
|
||
p.openElements.pop();
|
||
}
|
||
|
||
p._processToken(token);
|
||
} else {
|
||
const current = p._getAdjustedCurrentElement();
|
||
const currentNs = p.treeAdapter.getNamespaceURI(current);
|
||
|
||
if (currentNs === NS.MATHML) {
|
||
foreignContent.adjustTokenMathMLAttrs(token);
|
||
} else if (currentNs === NS.SVG) {
|
||
foreignContent.adjustTokenSVGTagName(token);
|
||
foreignContent.adjustTokenSVGAttrs(token);
|
||
}
|
||
|
||
foreignContent.adjustTokenXMLAttrs(token);
|
||
|
||
if (token.selfClosing) {
|
||
p._appendElement(token, currentNs);
|
||
} else {
|
||
p._insertElement(token, currentNs);
|
||
}
|
||
|
||
token.ackSelfClosing = true;
|
||
}
|
||
}
|
||
|
||
function endTagInForeignContent(p, token) {
|
||
for (let i = p.openElements.stackTop; i > 0; i--) {
|
||
const element = p.openElements.items[i];
|
||
|
||
if (p.treeAdapter.getNamespaceURI(element) === NS.HTML) {
|
||
p._processToken(token);
|
||
break;
|
||
}
|
||
|
||
if (p.treeAdapter.getTagName(element).toLowerCase() === token.tagName) {
|
||
p.openElements.popUntilElementPopped(element);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
/* 137 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const Preprocessor = __webpack_require__(138);
|
||
const unicode = __webpack_require__(139);
|
||
const neTree = __webpack_require__(141);
|
||
const ERR = __webpack_require__(140);
|
||
|
||
//Aliases
|
||
const $ = unicode.CODE_POINTS;
|
||
const $$ = unicode.CODE_POINT_SEQUENCES;
|
||
|
||
//C1 Unicode control character reference replacements
|
||
const C1_CONTROLS_REFERENCE_REPLACEMENTS = {
|
||
0x80: 0x20ac,
|
||
0x82: 0x201a,
|
||
0x83: 0x0192,
|
||
0x84: 0x201e,
|
||
0x85: 0x2026,
|
||
0x86: 0x2020,
|
||
0x87: 0x2021,
|
||
0x88: 0x02c6,
|
||
0x89: 0x2030,
|
||
0x8a: 0x0160,
|
||
0x8b: 0x2039,
|
||
0x8c: 0x0152,
|
||
0x8e: 0x017d,
|
||
0x91: 0x2018,
|
||
0x92: 0x2019,
|
||
0x93: 0x201c,
|
||
0x94: 0x201d,
|
||
0x95: 0x2022,
|
||
0x96: 0x2013,
|
||
0x97: 0x2014,
|
||
0x98: 0x02dc,
|
||
0x99: 0x2122,
|
||
0x9a: 0x0161,
|
||
0x9b: 0x203a,
|
||
0x9c: 0x0153,
|
||
0x9e: 0x017e,
|
||
0x9f: 0x0178
|
||
};
|
||
|
||
// Named entity tree flags
|
||
const HAS_DATA_FLAG = 1 << 0;
|
||
const DATA_DUPLET_FLAG = 1 << 1;
|
||
const HAS_BRANCHES_FLAG = 1 << 2;
|
||
const MAX_BRANCH_MARKER_VALUE = HAS_DATA_FLAG | DATA_DUPLET_FLAG | HAS_BRANCHES_FLAG;
|
||
|
||
//States
|
||
const DATA_STATE = 'DATA_STATE';
|
||
const RCDATA_STATE = 'RCDATA_STATE';
|
||
const RAWTEXT_STATE = 'RAWTEXT_STATE';
|
||
const SCRIPT_DATA_STATE = 'SCRIPT_DATA_STATE';
|
||
const PLAINTEXT_STATE = 'PLAINTEXT_STATE';
|
||
const TAG_OPEN_STATE = 'TAG_OPEN_STATE';
|
||
const END_TAG_OPEN_STATE = 'END_TAG_OPEN_STATE';
|
||
const TAG_NAME_STATE = 'TAG_NAME_STATE';
|
||
const RCDATA_LESS_THAN_SIGN_STATE = 'RCDATA_LESS_THAN_SIGN_STATE';
|
||
const RCDATA_END_TAG_OPEN_STATE = 'RCDATA_END_TAG_OPEN_STATE';
|
||
const RCDATA_END_TAG_NAME_STATE = 'RCDATA_END_TAG_NAME_STATE';
|
||
const RAWTEXT_LESS_THAN_SIGN_STATE = 'RAWTEXT_LESS_THAN_SIGN_STATE';
|
||
const RAWTEXT_END_TAG_OPEN_STATE = 'RAWTEXT_END_TAG_OPEN_STATE';
|
||
const RAWTEXT_END_TAG_NAME_STATE = 'RAWTEXT_END_TAG_NAME_STATE';
|
||
const SCRIPT_DATA_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_LESS_THAN_SIGN_STATE';
|
||
const SCRIPT_DATA_END_TAG_OPEN_STATE = 'SCRIPT_DATA_END_TAG_OPEN_STATE';
|
||
const SCRIPT_DATA_END_TAG_NAME_STATE = 'SCRIPT_DATA_END_TAG_NAME_STATE';
|
||
const SCRIPT_DATA_ESCAPE_START_STATE = 'SCRIPT_DATA_ESCAPE_START_STATE';
|
||
const SCRIPT_DATA_ESCAPE_START_DASH_STATE = 'SCRIPT_DATA_ESCAPE_START_DASH_STATE';
|
||
const SCRIPT_DATA_ESCAPED_STATE = 'SCRIPT_DATA_ESCAPED_STATE';
|
||
const SCRIPT_DATA_ESCAPED_DASH_STATE = 'SCRIPT_DATA_ESCAPED_DASH_STATE';
|
||
const SCRIPT_DATA_ESCAPED_DASH_DASH_STATE = 'SCRIPT_DATA_ESCAPED_DASH_DASH_STATE';
|
||
const SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE';
|
||
const SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE = 'SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE';
|
||
const SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE = 'SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE';
|
||
const SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE';
|
||
const SCRIPT_DATA_DOUBLE_ESCAPED_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_STATE';
|
||
const SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE';
|
||
const SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE';
|
||
const SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE';
|
||
const SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE';
|
||
const BEFORE_ATTRIBUTE_NAME_STATE = 'BEFORE_ATTRIBUTE_NAME_STATE';
|
||
const ATTRIBUTE_NAME_STATE = 'ATTRIBUTE_NAME_STATE';
|
||
const AFTER_ATTRIBUTE_NAME_STATE = 'AFTER_ATTRIBUTE_NAME_STATE';
|
||
const BEFORE_ATTRIBUTE_VALUE_STATE = 'BEFORE_ATTRIBUTE_VALUE_STATE';
|
||
const ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE = 'ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE';
|
||
const ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE = 'ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE';
|
||
const ATTRIBUTE_VALUE_UNQUOTED_STATE = 'ATTRIBUTE_VALUE_UNQUOTED_STATE';
|
||
const AFTER_ATTRIBUTE_VALUE_QUOTED_STATE = 'AFTER_ATTRIBUTE_VALUE_QUOTED_STATE';
|
||
const SELF_CLOSING_START_TAG_STATE = 'SELF_CLOSING_START_TAG_STATE';
|
||
const BOGUS_COMMENT_STATE = 'BOGUS_COMMENT_STATE';
|
||
const MARKUP_DECLARATION_OPEN_STATE = 'MARKUP_DECLARATION_OPEN_STATE';
|
||
const COMMENT_START_STATE = 'COMMENT_START_STATE';
|
||
const COMMENT_START_DASH_STATE = 'COMMENT_START_DASH_STATE';
|
||
const COMMENT_STATE = 'COMMENT_STATE';
|
||
const COMMENT_LESS_THAN_SIGN_STATE = 'COMMENT_LESS_THAN_SIGN_STATE';
|
||
const COMMENT_LESS_THAN_SIGN_BANG_STATE = 'COMMENT_LESS_THAN_SIGN_BANG_STATE';
|
||
const COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE = 'COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE';
|
||
const COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE = 'COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE';
|
||
const COMMENT_END_DASH_STATE = 'COMMENT_END_DASH_STATE';
|
||
const COMMENT_END_STATE = 'COMMENT_END_STATE';
|
||
const COMMENT_END_BANG_STATE = 'COMMENT_END_BANG_STATE';
|
||
const DOCTYPE_STATE = 'DOCTYPE_STATE';
|
||
const BEFORE_DOCTYPE_NAME_STATE = 'BEFORE_DOCTYPE_NAME_STATE';
|
||
const DOCTYPE_NAME_STATE = 'DOCTYPE_NAME_STATE';
|
||
const AFTER_DOCTYPE_NAME_STATE = 'AFTER_DOCTYPE_NAME_STATE';
|
||
const AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE = 'AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE';
|
||
const BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE = 'BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE';
|
||
const DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE = 'DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE';
|
||
const DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE = 'DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE';
|
||
const AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE = 'AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE';
|
||
const BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE = 'BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE';
|
||
const AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE = 'AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE';
|
||
const BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE = 'BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE';
|
||
const DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE = 'DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE';
|
||
const DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE = 'DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE';
|
||
const AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE = 'AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE';
|
||
const BOGUS_DOCTYPE_STATE = 'BOGUS_DOCTYPE_STATE';
|
||
const CDATA_SECTION_STATE = 'CDATA_SECTION_STATE';
|
||
const CDATA_SECTION_BRACKET_STATE = 'CDATA_SECTION_BRACKET_STATE';
|
||
const CDATA_SECTION_END_STATE = 'CDATA_SECTION_END_STATE';
|
||
const CHARACTER_REFERENCE_STATE = 'CHARACTER_REFERENCE_STATE';
|
||
const NAMED_CHARACTER_REFERENCE_STATE = 'NAMED_CHARACTER_REFERENCE_STATE';
|
||
const AMBIGUOUS_AMPERSAND_STATE = 'AMBIGUOS_AMPERSAND_STATE';
|
||
const NUMERIC_CHARACTER_REFERENCE_STATE = 'NUMERIC_CHARACTER_REFERENCE_STATE';
|
||
const HEXADEMICAL_CHARACTER_REFERENCE_START_STATE = 'HEXADEMICAL_CHARACTER_REFERENCE_START_STATE';
|
||
const DECIMAL_CHARACTER_REFERENCE_START_STATE = 'DECIMAL_CHARACTER_REFERENCE_START_STATE';
|
||
const HEXADEMICAL_CHARACTER_REFERENCE_STATE = 'HEXADEMICAL_CHARACTER_REFERENCE_STATE';
|
||
const DECIMAL_CHARACTER_REFERENCE_STATE = 'DECIMAL_CHARACTER_REFERENCE_STATE';
|
||
const NUMERIC_CHARACTER_REFERENCE_END_STATE = 'NUMERIC_CHARACTER_REFERENCE_END_STATE';
|
||
|
||
//Utils
|
||
|
||
//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline
|
||
//this functions if they will be situated in another module due to context switch.
|
||
//Always perform inlining check before modifying this functions ('node --trace-inlining').
|
||
function isWhitespace(cp) {
|
||
return cp === $.SPACE || cp === $.LINE_FEED || cp === $.TABULATION || cp === $.FORM_FEED;
|
||
}
|
||
|
||
function isAsciiDigit(cp) {
|
||
return cp >= $.DIGIT_0 && cp <= $.DIGIT_9;
|
||
}
|
||
|
||
function isAsciiUpper(cp) {
|
||
return cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_Z;
|
||
}
|
||
|
||
function isAsciiLower(cp) {
|
||
return cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_Z;
|
||
}
|
||
|
||
function isAsciiLetter(cp) {
|
||
return isAsciiLower(cp) || isAsciiUpper(cp);
|
||
}
|
||
|
||
function isAsciiAlphaNumeric(cp) {
|
||
return isAsciiLetter(cp) || isAsciiDigit(cp);
|
||
}
|
||
|
||
function isAsciiUpperHexDigit(cp) {
|
||
return cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_F;
|
||
}
|
||
|
||
function isAsciiLowerHexDigit(cp) {
|
||
return cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_F;
|
||
}
|
||
|
||
function isAsciiHexDigit(cp) {
|
||
return isAsciiDigit(cp) || isAsciiUpperHexDigit(cp) || isAsciiLowerHexDigit(cp);
|
||
}
|
||
|
||
function toAsciiLowerCodePoint(cp) {
|
||
return cp + 0x0020;
|
||
}
|
||
|
||
//NOTE: String.fromCharCode() function can handle only characters from BMP subset.
|
||
//So, we need to workaround this manually.
|
||
//(see: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode#Getting_it_to_work_with_higher_values)
|
||
function toChar(cp) {
|
||
if (cp <= 0xffff) {
|
||
return String.fromCharCode(cp);
|
||
}
|
||
|
||
cp -= 0x10000;
|
||
return String.fromCharCode(((cp >>> 10) & 0x3ff) | 0xd800) + String.fromCharCode(0xdc00 | (cp & 0x3ff));
|
||
}
|
||
|
||
function toAsciiLowerChar(cp) {
|
||
return String.fromCharCode(toAsciiLowerCodePoint(cp));
|
||
}
|
||
|
||
function findNamedEntityTreeBranch(nodeIx, cp) {
|
||
const branchCount = neTree[++nodeIx];
|
||
let lo = ++nodeIx;
|
||
let hi = lo + branchCount - 1;
|
||
|
||
while (lo <= hi) {
|
||
const mid = (lo + hi) >>> 1;
|
||
const midCp = neTree[mid];
|
||
|
||
if (midCp < cp) {
|
||
lo = mid + 1;
|
||
} else if (midCp > cp) {
|
||
hi = mid - 1;
|
||
} else {
|
||
return neTree[mid + branchCount];
|
||
}
|
||
}
|
||
|
||
return -1;
|
||
}
|
||
|
||
//Tokenizer
|
||
class Tokenizer {
|
||
constructor() {
|
||
this.preprocessor = new Preprocessor();
|
||
|
||
this.tokenQueue = [];
|
||
|
||
this.allowCDATA = false;
|
||
|
||
this.state = DATA_STATE;
|
||
this.returnState = '';
|
||
|
||
this.charRefCode = -1;
|
||
this.tempBuff = [];
|
||
this.lastStartTagName = '';
|
||
|
||
this.consumedAfterSnapshot = -1;
|
||
this.active = false;
|
||
|
||
this.currentCharacterToken = null;
|
||
this.currentToken = null;
|
||
this.currentAttr = null;
|
||
}
|
||
|
||
//Errors
|
||
_err() {
|
||
// NOTE: err reporting is noop by default. Enabled by mixin.
|
||
}
|
||
|
||
_errOnNextCodePoint(err) {
|
||
this._consume();
|
||
this._err(err);
|
||
this._unconsume();
|
||
}
|
||
|
||
//API
|
||
getNextToken() {
|
||
while (!this.tokenQueue.length && this.active) {
|
||
this.consumedAfterSnapshot = 0;
|
||
|
||
const cp = this._consume();
|
||
|
||
if (!this._ensureHibernation()) {
|
||
this[this.state](cp);
|
||
}
|
||
}
|
||
|
||
return this.tokenQueue.shift();
|
||
}
|
||
|
||
write(chunk, isLastChunk) {
|
||
this.active = true;
|
||
this.preprocessor.write(chunk, isLastChunk);
|
||
}
|
||
|
||
insertHtmlAtCurrentPos(chunk) {
|
||
this.active = true;
|
||
this.preprocessor.insertHtmlAtCurrentPos(chunk);
|
||
}
|
||
|
||
//Hibernation
|
||
_ensureHibernation() {
|
||
if (this.preprocessor.endOfChunkHit) {
|
||
for (; this.consumedAfterSnapshot > 0; this.consumedAfterSnapshot--) {
|
||
this.preprocessor.retreat();
|
||
}
|
||
|
||
this.active = false;
|
||
this.tokenQueue.push({ type: Tokenizer.HIBERNATION_TOKEN });
|
||
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
//Consumption
|
||
_consume() {
|
||
this.consumedAfterSnapshot++;
|
||
return this.preprocessor.advance();
|
||
}
|
||
|
||
_unconsume() {
|
||
this.consumedAfterSnapshot--;
|
||
this.preprocessor.retreat();
|
||
}
|
||
|
||
_reconsumeInState(state) {
|
||
this.state = state;
|
||
this._unconsume();
|
||
}
|
||
|
||
_consumeSequenceIfMatch(pattern, startCp, caseSensitive) {
|
||
let consumedCount = 0;
|
||
let isMatch = true;
|
||
const patternLength = pattern.length;
|
||
let patternPos = 0;
|
||
let cp = startCp;
|
||
let patternCp = void 0;
|
||
|
||
for (; patternPos < patternLength; patternPos++) {
|
||
if (patternPos > 0) {
|
||
cp = this._consume();
|
||
consumedCount++;
|
||
}
|
||
|
||
if (cp === $.EOF) {
|
||
isMatch = false;
|
||
break;
|
||
}
|
||
|
||
patternCp = pattern[patternPos];
|
||
|
||
if (cp !== patternCp && (caseSensitive || cp !== toAsciiLowerCodePoint(patternCp))) {
|
||
isMatch = false;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!isMatch) {
|
||
while (consumedCount--) {
|
||
this._unconsume();
|
||
}
|
||
}
|
||
|
||
return isMatch;
|
||
}
|
||
|
||
//Temp buffer
|
||
_isTempBufferEqualToScriptString() {
|
||
if (this.tempBuff.length !== $$.SCRIPT_STRING.length) {
|
||
return false;
|
||
}
|
||
|
||
for (let i = 0; i < this.tempBuff.length; i++) {
|
||
if (this.tempBuff[i] !== $$.SCRIPT_STRING[i]) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
//Token creation
|
||
_createStartTagToken() {
|
||
this.currentToken = {
|
||
type: Tokenizer.START_TAG_TOKEN,
|
||
tagName: '',
|
||
selfClosing: false,
|
||
ackSelfClosing: false,
|
||
attrs: []
|
||
};
|
||
}
|
||
|
||
_createEndTagToken() {
|
||
this.currentToken = {
|
||
type: Tokenizer.END_TAG_TOKEN,
|
||
tagName: '',
|
||
selfClosing: false,
|
||
attrs: []
|
||
};
|
||
}
|
||
|
||
_createCommentToken() {
|
||
this.currentToken = {
|
||
type: Tokenizer.COMMENT_TOKEN,
|
||
data: ''
|
||
};
|
||
}
|
||
|
||
_createDoctypeToken(initialName) {
|
||
this.currentToken = {
|
||
type: Tokenizer.DOCTYPE_TOKEN,
|
||
name: initialName,
|
||
forceQuirks: false,
|
||
publicId: null,
|
||
systemId: null
|
||
};
|
||
}
|
||
|
||
_createCharacterToken(type, ch) {
|
||
this.currentCharacterToken = {
|
||
type: type,
|
||
chars: ch
|
||
};
|
||
}
|
||
|
||
_createEOFToken() {
|
||
this.currentToken = { type: Tokenizer.EOF_TOKEN };
|
||
}
|
||
|
||
//Tag attributes
|
||
_createAttr(attrNameFirstCh) {
|
||
this.currentAttr = {
|
||
name: attrNameFirstCh,
|
||
value: ''
|
||
};
|
||
}
|
||
|
||
_leaveAttrName(toState) {
|
||
if (Tokenizer.getTokenAttr(this.currentToken, this.currentAttr.name) === null) {
|
||
this.currentToken.attrs.push(this.currentAttr);
|
||
} else {
|
||
this._err(ERR.duplicateAttribute);
|
||
}
|
||
|
||
this.state = toState;
|
||
}
|
||
|
||
_leaveAttrValue(toState) {
|
||
this.state = toState;
|
||
}
|
||
|
||
//Token emission
|
||
_emitCurrentToken() {
|
||
this._emitCurrentCharacterToken();
|
||
|
||
const ct = this.currentToken;
|
||
|
||
this.currentToken = null;
|
||
|
||
//NOTE: store emited start tag's tagName to determine is the following end tag token is appropriate.
|
||
if (ct.type === Tokenizer.START_TAG_TOKEN) {
|
||
this.lastStartTagName = ct.tagName;
|
||
} else if (ct.type === Tokenizer.END_TAG_TOKEN) {
|
||
if (ct.attrs.length > 0) {
|
||
this._err(ERR.endTagWithAttributes);
|
||
}
|
||
|
||
if (ct.selfClosing) {
|
||
this._err(ERR.endTagWithTrailingSolidus);
|
||
}
|
||
}
|
||
|
||
this.tokenQueue.push(ct);
|
||
}
|
||
|
||
_emitCurrentCharacterToken() {
|
||
if (this.currentCharacterToken) {
|
||
this.tokenQueue.push(this.currentCharacterToken);
|
||
this.currentCharacterToken = null;
|
||
}
|
||
}
|
||
|
||
_emitEOFToken() {
|
||
this._createEOFToken();
|
||
this._emitCurrentToken();
|
||
}
|
||
|
||
//Characters emission
|
||
|
||
//OPTIMIZATION: specification uses only one type of character tokens (one token per character).
|
||
//This causes a huge memory overhead and a lot of unnecessary parser loops. parse5 uses 3 groups of characters.
|
||
//If we have a sequence of characters that belong to the same group, parser can process it
|
||
//as a single solid character token.
|
||
//So, there are 3 types of character tokens in parse5:
|
||
//1)NULL_CHARACTER_TOKEN - \u0000-character sequences (e.g. '\u0000\u0000\u0000')
|
||
//2)WHITESPACE_CHARACTER_TOKEN - any whitespace/new-line character sequences (e.g. '\n \r\t \f')
|
||
//3)CHARACTER_TOKEN - any character sequence which don't belong to groups 1 and 2 (e.g. 'abcdef1234@@#$%^')
|
||
_appendCharToCurrentCharacterToken(type, ch) {
|
||
if (this.currentCharacterToken && this.currentCharacterToken.type !== type) {
|
||
this._emitCurrentCharacterToken();
|
||
}
|
||
|
||
if (this.currentCharacterToken) {
|
||
this.currentCharacterToken.chars += ch;
|
||
} else {
|
||
this._createCharacterToken(type, ch);
|
||
}
|
||
}
|
||
|
||
_emitCodePoint(cp) {
|
||
let type = Tokenizer.CHARACTER_TOKEN;
|
||
|
||
if (isWhitespace(cp)) {
|
||
type = Tokenizer.WHITESPACE_CHARACTER_TOKEN;
|
||
} else if (cp === $.NULL) {
|
||
type = Tokenizer.NULL_CHARACTER_TOKEN;
|
||
}
|
||
|
||
this._appendCharToCurrentCharacterToken(type, toChar(cp));
|
||
}
|
||
|
||
_emitSeveralCodePoints(codePoints) {
|
||
for (let i = 0; i < codePoints.length; i++) {
|
||
this._emitCodePoint(codePoints[i]);
|
||
}
|
||
}
|
||
|
||
//NOTE: used then we emit character explicitly. This is always a non-whitespace and a non-null character.
|
||
//So we can avoid additional checks here.
|
||
_emitChars(ch) {
|
||
this._appendCharToCurrentCharacterToken(Tokenizer.CHARACTER_TOKEN, ch);
|
||
}
|
||
|
||
// Character reference helpers
|
||
_matchNamedCharacterReference(startCp) {
|
||
let result = null;
|
||
let excess = 1;
|
||
let i = findNamedEntityTreeBranch(0, startCp);
|
||
|
||
this.tempBuff.push(startCp);
|
||
|
||
while (i > -1) {
|
||
const current = neTree[i];
|
||
const inNode = current < MAX_BRANCH_MARKER_VALUE;
|
||
const nodeWithData = inNode && current & HAS_DATA_FLAG;
|
||
|
||
if (nodeWithData) {
|
||
//NOTE: we use greedy search, so we continue lookup at this point
|
||
result = current & DATA_DUPLET_FLAG ? [neTree[++i], neTree[++i]] : [neTree[++i]];
|
||
excess = 0;
|
||
}
|
||
|
||
const cp = this._consume();
|
||
|
||
this.tempBuff.push(cp);
|
||
excess++;
|
||
|
||
if (cp === $.EOF) {
|
||
break;
|
||
}
|
||
|
||
if (inNode) {
|
||
i = current & HAS_BRANCHES_FLAG ? findNamedEntityTreeBranch(i, cp) : -1;
|
||
} else {
|
||
i = cp === current ? ++i : -1;
|
||
}
|
||
}
|
||
|
||
while (excess--) {
|
||
this.tempBuff.pop();
|
||
this._unconsume();
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
_isCharacterReferenceInAttribute() {
|
||
return (
|
||
this.returnState === ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE ||
|
||
this.returnState === ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE ||
|
||
this.returnState === ATTRIBUTE_VALUE_UNQUOTED_STATE
|
||
);
|
||
}
|
||
|
||
_isCharacterReferenceAttributeQuirk(withSemicolon) {
|
||
if (!withSemicolon && this._isCharacterReferenceInAttribute()) {
|
||
const nextCp = this._consume();
|
||
|
||
this._unconsume();
|
||
|
||
return nextCp === $.EQUALS_SIGN || isAsciiAlphaNumeric(nextCp);
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
_flushCodePointsConsumedAsCharacterReference() {
|
||
if (this._isCharacterReferenceInAttribute()) {
|
||
for (let i = 0; i < this.tempBuff.length; i++) {
|
||
this.currentAttr.value += toChar(this.tempBuff[i]);
|
||
}
|
||
} else {
|
||
this._emitSeveralCodePoints(this.tempBuff);
|
||
}
|
||
|
||
this.tempBuff = [];
|
||
}
|
||
|
||
// State machine
|
||
|
||
// Data state
|
||
//------------------------------------------------------------------
|
||
[DATA_STATE](cp) {
|
||
this.preprocessor.dropParsedChunk();
|
||
|
||
if (cp === $.LESS_THAN_SIGN) {
|
||
this.state = TAG_OPEN_STATE;
|
||
} else if (cp === $.AMPERSAND) {
|
||
this.returnState = DATA_STATE;
|
||
this.state = CHARACTER_REFERENCE_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this._emitCodePoint(cp);
|
||
} else if (cp === $.EOF) {
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// RCDATA state
|
||
//------------------------------------------------------------------
|
||
[RCDATA_STATE](cp) {
|
||
this.preprocessor.dropParsedChunk();
|
||
|
||
if (cp === $.AMPERSAND) {
|
||
this.returnState = RCDATA_STATE;
|
||
this.state = CHARACTER_REFERENCE_STATE;
|
||
} else if (cp === $.LESS_THAN_SIGN) {
|
||
this.state = RCDATA_LESS_THAN_SIGN_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
||
} else if (cp === $.EOF) {
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// RAWTEXT state
|
||
//------------------------------------------------------------------
|
||
[RAWTEXT_STATE](cp) {
|
||
this.preprocessor.dropParsedChunk();
|
||
|
||
if (cp === $.LESS_THAN_SIGN) {
|
||
this.state = RAWTEXT_LESS_THAN_SIGN_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
||
} else if (cp === $.EOF) {
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// Script data state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_STATE](cp) {
|
||
this.preprocessor.dropParsedChunk();
|
||
|
||
if (cp === $.LESS_THAN_SIGN) {
|
||
this.state = SCRIPT_DATA_LESS_THAN_SIGN_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
||
} else if (cp === $.EOF) {
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// PLAINTEXT state
|
||
//------------------------------------------------------------------
|
||
[PLAINTEXT_STATE](cp) {
|
||
this.preprocessor.dropParsedChunk();
|
||
|
||
if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
||
} else if (cp === $.EOF) {
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// Tag open state
|
||
//------------------------------------------------------------------
|
||
[TAG_OPEN_STATE](cp) {
|
||
if (cp === $.EXCLAMATION_MARK) {
|
||
this.state = MARKUP_DECLARATION_OPEN_STATE;
|
||
} else if (cp === $.SOLIDUS) {
|
||
this.state = END_TAG_OPEN_STATE;
|
||
} else if (isAsciiLetter(cp)) {
|
||
this._createStartTagToken();
|
||
this._reconsumeInState(TAG_NAME_STATE);
|
||
} else if (cp === $.QUESTION_MARK) {
|
||
this._err(ERR.unexpectedQuestionMarkInsteadOfTagName);
|
||
this._createCommentToken();
|
||
this._reconsumeInState(BOGUS_COMMENT_STATE);
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofBeforeTagName);
|
||
this._emitChars('<');
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.invalidFirstCharacterOfTagName);
|
||
this._emitChars('<');
|
||
this._reconsumeInState(DATA_STATE);
|
||
}
|
||
}
|
||
|
||
// End tag open state
|
||
//------------------------------------------------------------------
|
||
[END_TAG_OPEN_STATE](cp) {
|
||
if (isAsciiLetter(cp)) {
|
||
this._createEndTagToken();
|
||
this._reconsumeInState(TAG_NAME_STATE);
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.missingEndTagName);
|
||
this.state = DATA_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofBeforeTagName);
|
||
this._emitChars('</');
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.invalidFirstCharacterOfTagName);
|
||
this._createCommentToken();
|
||
this._reconsumeInState(BOGUS_COMMENT_STATE);
|
||
}
|
||
}
|
||
|
||
// Tag name state
|
||
//------------------------------------------------------------------
|
||
[TAG_NAME_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
this.state = BEFORE_ATTRIBUTE_NAME_STATE;
|
||
} else if (cp === $.SOLIDUS) {
|
||
this.state = SELF_CLOSING_START_TAG_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (isAsciiUpper(cp)) {
|
||
this.currentToken.tagName += toAsciiLowerChar(cp);
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentToken.tagName += unicode.REPLACEMENT_CHARACTER;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInTag);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.tagName += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// RCDATA less-than sign state
|
||
//------------------------------------------------------------------
|
||
[RCDATA_LESS_THAN_SIGN_STATE](cp) {
|
||
if (cp === $.SOLIDUS) {
|
||
this.tempBuff = [];
|
||
this.state = RCDATA_END_TAG_OPEN_STATE;
|
||
} else {
|
||
this._emitChars('<');
|
||
this._reconsumeInState(RCDATA_STATE);
|
||
}
|
||
}
|
||
|
||
// RCDATA end tag open state
|
||
//------------------------------------------------------------------
|
||
[RCDATA_END_TAG_OPEN_STATE](cp) {
|
||
if (isAsciiLetter(cp)) {
|
||
this._createEndTagToken();
|
||
this._reconsumeInState(RCDATA_END_TAG_NAME_STATE);
|
||
} else {
|
||
this._emitChars('</');
|
||
this._reconsumeInState(RCDATA_STATE);
|
||
}
|
||
}
|
||
|
||
// RCDATA end tag name state
|
||
//------------------------------------------------------------------
|
||
[RCDATA_END_TAG_NAME_STATE](cp) {
|
||
if (isAsciiUpper(cp)) {
|
||
this.currentToken.tagName += toAsciiLowerChar(cp);
|
||
this.tempBuff.push(cp);
|
||
} else if (isAsciiLower(cp)) {
|
||
this.currentToken.tagName += toChar(cp);
|
||
this.tempBuff.push(cp);
|
||
} else {
|
||
if (this.lastStartTagName === this.currentToken.tagName) {
|
||
if (isWhitespace(cp)) {
|
||
this.state = BEFORE_ATTRIBUTE_NAME_STATE;
|
||
return;
|
||
}
|
||
|
||
if (cp === $.SOLIDUS) {
|
||
this.state = SELF_CLOSING_START_TAG_STATE;
|
||
return;
|
||
}
|
||
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
return;
|
||
}
|
||
}
|
||
|
||
this._emitChars('</');
|
||
this._emitSeveralCodePoints(this.tempBuff);
|
||
this._reconsumeInState(RCDATA_STATE);
|
||
}
|
||
}
|
||
|
||
// RAWTEXT less-than sign state
|
||
//------------------------------------------------------------------
|
||
[RAWTEXT_LESS_THAN_SIGN_STATE](cp) {
|
||
if (cp === $.SOLIDUS) {
|
||
this.tempBuff = [];
|
||
this.state = RAWTEXT_END_TAG_OPEN_STATE;
|
||
} else {
|
||
this._emitChars('<');
|
||
this._reconsumeInState(RAWTEXT_STATE);
|
||
}
|
||
}
|
||
|
||
// RAWTEXT end tag open state
|
||
//------------------------------------------------------------------
|
||
[RAWTEXT_END_TAG_OPEN_STATE](cp) {
|
||
if (isAsciiLetter(cp)) {
|
||
this._createEndTagToken();
|
||
this._reconsumeInState(RAWTEXT_END_TAG_NAME_STATE);
|
||
} else {
|
||
this._emitChars('</');
|
||
this._reconsumeInState(RAWTEXT_STATE);
|
||
}
|
||
}
|
||
|
||
// RAWTEXT end tag name state
|
||
//------------------------------------------------------------------
|
||
[RAWTEXT_END_TAG_NAME_STATE](cp) {
|
||
if (isAsciiUpper(cp)) {
|
||
this.currentToken.tagName += toAsciiLowerChar(cp);
|
||
this.tempBuff.push(cp);
|
||
} else if (isAsciiLower(cp)) {
|
||
this.currentToken.tagName += toChar(cp);
|
||
this.tempBuff.push(cp);
|
||
} else {
|
||
if (this.lastStartTagName === this.currentToken.tagName) {
|
||
if (isWhitespace(cp)) {
|
||
this.state = BEFORE_ATTRIBUTE_NAME_STATE;
|
||
return;
|
||
}
|
||
|
||
if (cp === $.SOLIDUS) {
|
||
this.state = SELF_CLOSING_START_TAG_STATE;
|
||
return;
|
||
}
|
||
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
return;
|
||
}
|
||
}
|
||
|
||
this._emitChars('</');
|
||
this._emitSeveralCodePoints(this.tempBuff);
|
||
this._reconsumeInState(RAWTEXT_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data less-than sign state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_LESS_THAN_SIGN_STATE](cp) {
|
||
if (cp === $.SOLIDUS) {
|
||
this.tempBuff = [];
|
||
this.state = SCRIPT_DATA_END_TAG_OPEN_STATE;
|
||
} else if (cp === $.EXCLAMATION_MARK) {
|
||
this.state = SCRIPT_DATA_ESCAPE_START_STATE;
|
||
this._emitChars('<!');
|
||
} else {
|
||
this._emitChars('<');
|
||
this._reconsumeInState(SCRIPT_DATA_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data end tag open state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_END_TAG_OPEN_STATE](cp) {
|
||
if (isAsciiLetter(cp)) {
|
||
this._createEndTagToken();
|
||
this._reconsumeInState(SCRIPT_DATA_END_TAG_NAME_STATE);
|
||
} else {
|
||
this._emitChars('</');
|
||
this._reconsumeInState(SCRIPT_DATA_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data end tag name state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_END_TAG_NAME_STATE](cp) {
|
||
if (isAsciiUpper(cp)) {
|
||
this.currentToken.tagName += toAsciiLowerChar(cp);
|
||
this.tempBuff.push(cp);
|
||
} else if (isAsciiLower(cp)) {
|
||
this.currentToken.tagName += toChar(cp);
|
||
this.tempBuff.push(cp);
|
||
} else {
|
||
if (this.lastStartTagName === this.currentToken.tagName) {
|
||
if (isWhitespace(cp)) {
|
||
this.state = BEFORE_ATTRIBUTE_NAME_STATE;
|
||
return;
|
||
} else if (cp === $.SOLIDUS) {
|
||
this.state = SELF_CLOSING_START_TAG_STATE;
|
||
return;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
return;
|
||
}
|
||
}
|
||
|
||
this._emitChars('</');
|
||
this._emitSeveralCodePoints(this.tempBuff);
|
||
this._reconsumeInState(SCRIPT_DATA_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data escape start state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_ESCAPE_START_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = SCRIPT_DATA_ESCAPE_START_DASH_STATE;
|
||
this._emitChars('-');
|
||
} else {
|
||
this._reconsumeInState(SCRIPT_DATA_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data escape start dash state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_ESCAPE_START_DASH_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = SCRIPT_DATA_ESCAPED_DASH_DASH_STATE;
|
||
this._emitChars('-');
|
||
} else {
|
||
this._reconsumeInState(SCRIPT_DATA_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data escaped state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_ESCAPED_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = SCRIPT_DATA_ESCAPED_DASH_STATE;
|
||
this._emitChars('-');
|
||
} else if (cp === $.LESS_THAN_SIGN) {
|
||
this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInScriptHtmlCommentLikeText);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// Script data escaped dash state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_ESCAPED_DASH_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = SCRIPT_DATA_ESCAPED_DASH_DASH_STATE;
|
||
this._emitChars('-');
|
||
} else if (cp === $.LESS_THAN_SIGN) {
|
||
this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.state = SCRIPT_DATA_ESCAPED_STATE;
|
||
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInScriptHtmlCommentLikeText);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.state = SCRIPT_DATA_ESCAPED_STATE;
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// Script data escaped dash dash state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_ESCAPED_DASH_DASH_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this._emitChars('-');
|
||
} else if (cp === $.LESS_THAN_SIGN) {
|
||
this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = SCRIPT_DATA_STATE;
|
||
this._emitChars('>');
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.state = SCRIPT_DATA_ESCAPED_STATE;
|
||
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInScriptHtmlCommentLikeText);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.state = SCRIPT_DATA_ESCAPED_STATE;
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// Script data escaped less-than sign state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE](cp) {
|
||
if (cp === $.SOLIDUS) {
|
||
this.tempBuff = [];
|
||
this.state = SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE;
|
||
} else if (isAsciiLetter(cp)) {
|
||
this.tempBuff = [];
|
||
this._emitChars('<');
|
||
this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE);
|
||
} else {
|
||
this._emitChars('<');
|
||
this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data escaped end tag open state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE](cp) {
|
||
if (isAsciiLetter(cp)) {
|
||
this._createEndTagToken();
|
||
this._reconsumeInState(SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE);
|
||
} else {
|
||
this._emitChars('</');
|
||
this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data escaped end tag name state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE](cp) {
|
||
if (isAsciiUpper(cp)) {
|
||
this.currentToken.tagName += toAsciiLowerChar(cp);
|
||
this.tempBuff.push(cp);
|
||
} else if (isAsciiLower(cp)) {
|
||
this.currentToken.tagName += toChar(cp);
|
||
this.tempBuff.push(cp);
|
||
} else {
|
||
if (this.lastStartTagName === this.currentToken.tagName) {
|
||
if (isWhitespace(cp)) {
|
||
this.state = BEFORE_ATTRIBUTE_NAME_STATE;
|
||
return;
|
||
}
|
||
|
||
if (cp === $.SOLIDUS) {
|
||
this.state = SELF_CLOSING_START_TAG_STATE;
|
||
return;
|
||
}
|
||
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
return;
|
||
}
|
||
}
|
||
|
||
this._emitChars('</');
|
||
this._emitSeveralCodePoints(this.tempBuff);
|
||
this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data double escape start state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE](cp) {
|
||
if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN) {
|
||
this.state = this._isTempBufferEqualToScriptString()
|
||
? SCRIPT_DATA_DOUBLE_ESCAPED_STATE
|
||
: SCRIPT_DATA_ESCAPED_STATE;
|
||
this._emitCodePoint(cp);
|
||
} else if (isAsciiUpper(cp)) {
|
||
this.tempBuff.push(toAsciiLowerCodePoint(cp));
|
||
this._emitCodePoint(cp);
|
||
} else if (isAsciiLower(cp)) {
|
||
this.tempBuff.push(cp);
|
||
this._emitCodePoint(cp);
|
||
} else {
|
||
this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data double escaped state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_DOUBLE_ESCAPED_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE;
|
||
this._emitChars('-');
|
||
} else if (cp === $.LESS_THAN_SIGN) {
|
||
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE;
|
||
this._emitChars('<');
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInScriptHtmlCommentLikeText);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// Script data double escaped dash state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE;
|
||
this._emitChars('-');
|
||
} else if (cp === $.LESS_THAN_SIGN) {
|
||
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE;
|
||
this._emitChars('<');
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE;
|
||
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInScriptHtmlCommentLikeText);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE;
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// Script data double escaped dash dash state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this._emitChars('-');
|
||
} else if (cp === $.LESS_THAN_SIGN) {
|
||
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE;
|
||
this._emitChars('<');
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = SCRIPT_DATA_STATE;
|
||
this._emitChars('>');
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE;
|
||
this._emitChars(unicode.REPLACEMENT_CHARACTER);
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInScriptHtmlCommentLikeText);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE;
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// Script data double escaped less-than sign state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE](cp) {
|
||
if (cp === $.SOLIDUS) {
|
||
this.tempBuff = [];
|
||
this.state = SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE;
|
||
this._emitChars('/');
|
||
} else {
|
||
this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE);
|
||
}
|
||
}
|
||
|
||
// Script data double escape end state
|
||
//------------------------------------------------------------------
|
||
[SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE](cp) {
|
||
if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN) {
|
||
this.state = this._isTempBufferEqualToScriptString()
|
||
? SCRIPT_DATA_ESCAPED_STATE
|
||
: SCRIPT_DATA_DOUBLE_ESCAPED_STATE;
|
||
|
||
this._emitCodePoint(cp);
|
||
} else if (isAsciiUpper(cp)) {
|
||
this.tempBuff.push(toAsciiLowerCodePoint(cp));
|
||
this._emitCodePoint(cp);
|
||
} else if (isAsciiLower(cp)) {
|
||
this.tempBuff.push(cp);
|
||
this._emitCodePoint(cp);
|
||
} else {
|
||
this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE);
|
||
}
|
||
}
|
||
|
||
// Before attribute name state
|
||
//------------------------------------------------------------------
|
||
[BEFORE_ATTRIBUTE_NAME_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
return;
|
||
}
|
||
|
||
if (cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN || cp === $.EOF) {
|
||
this._reconsumeInState(AFTER_ATTRIBUTE_NAME_STATE);
|
||
} else if (cp === $.EQUALS_SIGN) {
|
||
this._err(ERR.unexpectedEqualsSignBeforeAttributeName);
|
||
this._createAttr('=');
|
||
this.state = ATTRIBUTE_NAME_STATE;
|
||
} else {
|
||
this._createAttr('');
|
||
this._reconsumeInState(ATTRIBUTE_NAME_STATE);
|
||
}
|
||
}
|
||
|
||
// Attribute name state
|
||
//------------------------------------------------------------------
|
||
[ATTRIBUTE_NAME_STATE](cp) {
|
||
if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN || cp === $.EOF) {
|
||
this._leaveAttrName(AFTER_ATTRIBUTE_NAME_STATE);
|
||
this._unconsume();
|
||
} else if (cp === $.EQUALS_SIGN) {
|
||
this._leaveAttrName(BEFORE_ATTRIBUTE_VALUE_STATE);
|
||
} else if (isAsciiUpper(cp)) {
|
||
this.currentAttr.name += toAsciiLowerChar(cp);
|
||
} else if (cp === $.QUOTATION_MARK || cp === $.APOSTROPHE || cp === $.LESS_THAN_SIGN) {
|
||
this._err(ERR.unexpectedCharacterInAttributeName);
|
||
this.currentAttr.name += toChar(cp);
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentAttr.name += unicode.REPLACEMENT_CHARACTER;
|
||
} else {
|
||
this.currentAttr.name += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// After attribute name state
|
||
//------------------------------------------------------------------
|
||
[AFTER_ATTRIBUTE_NAME_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
return;
|
||
}
|
||
|
||
if (cp === $.SOLIDUS) {
|
||
this.state = SELF_CLOSING_START_TAG_STATE;
|
||
} else if (cp === $.EQUALS_SIGN) {
|
||
this.state = BEFORE_ATTRIBUTE_VALUE_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInTag);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._createAttr('');
|
||
this._reconsumeInState(ATTRIBUTE_NAME_STATE);
|
||
}
|
||
}
|
||
|
||
// Before attribute value state
|
||
//------------------------------------------------------------------
|
||
[BEFORE_ATTRIBUTE_VALUE_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
return;
|
||
}
|
||
|
||
if (cp === $.QUOTATION_MARK) {
|
||
this.state = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE;
|
||
} else if (cp === $.APOSTROPHE) {
|
||
this.state = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.missingAttributeValue);
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else {
|
||
this._reconsumeInState(ATTRIBUTE_VALUE_UNQUOTED_STATE);
|
||
}
|
||
}
|
||
|
||
// Attribute value (double-quoted) state
|
||
//------------------------------------------------------------------
|
||
[ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE](cp) {
|
||
if (cp === $.QUOTATION_MARK) {
|
||
this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE;
|
||
} else if (cp === $.AMPERSAND) {
|
||
this.returnState = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE;
|
||
this.state = CHARACTER_REFERENCE_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentAttr.value += unicode.REPLACEMENT_CHARACTER;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInTag);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentAttr.value += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// Attribute value (single-quoted) state
|
||
//------------------------------------------------------------------
|
||
[ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE](cp) {
|
||
if (cp === $.APOSTROPHE) {
|
||
this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE;
|
||
} else if (cp === $.AMPERSAND) {
|
||
this.returnState = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE;
|
||
this.state = CHARACTER_REFERENCE_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentAttr.value += unicode.REPLACEMENT_CHARACTER;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInTag);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentAttr.value += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// Attribute value (unquoted) state
|
||
//------------------------------------------------------------------
|
||
[ATTRIBUTE_VALUE_UNQUOTED_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE);
|
||
} else if (cp === $.AMPERSAND) {
|
||
this.returnState = ATTRIBUTE_VALUE_UNQUOTED_STATE;
|
||
this.state = CHARACTER_REFERENCE_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._leaveAttrValue(DATA_STATE);
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentAttr.value += unicode.REPLACEMENT_CHARACTER;
|
||
} else if (
|
||
cp === $.QUOTATION_MARK ||
|
||
cp === $.APOSTROPHE ||
|
||
cp === $.LESS_THAN_SIGN ||
|
||
cp === $.EQUALS_SIGN ||
|
||
cp === $.GRAVE_ACCENT
|
||
) {
|
||
this._err(ERR.unexpectedCharacterInUnquotedAttributeValue);
|
||
this.currentAttr.value += toChar(cp);
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInTag);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentAttr.value += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// After attribute value (quoted) state
|
||
//------------------------------------------------------------------
|
||
[AFTER_ATTRIBUTE_VALUE_QUOTED_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE);
|
||
} else if (cp === $.SOLIDUS) {
|
||
this._leaveAttrValue(SELF_CLOSING_START_TAG_STATE);
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._leaveAttrValue(DATA_STATE);
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInTag);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.missingWhitespaceBetweenAttributes);
|
||
this._reconsumeInState(BEFORE_ATTRIBUTE_NAME_STATE);
|
||
}
|
||
}
|
||
|
||
// Self-closing start tag state
|
||
//------------------------------------------------------------------
|
||
[SELF_CLOSING_START_TAG_STATE](cp) {
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this.currentToken.selfClosing = true;
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInTag);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.unexpectedSolidusInTag);
|
||
this._reconsumeInState(BEFORE_ATTRIBUTE_NAME_STATE);
|
||
}
|
||
}
|
||
|
||
// Bogus comment state
|
||
//------------------------------------------------------------------
|
||
[BOGUS_COMMENT_STATE](cp) {
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentToken.data += unicode.REPLACEMENT_CHARACTER;
|
||
} else {
|
||
this.currentToken.data += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// Markup declaration open state
|
||
//------------------------------------------------------------------
|
||
[MARKUP_DECLARATION_OPEN_STATE](cp) {
|
||
if (this._consumeSequenceIfMatch($$.DASH_DASH_STRING, cp, true)) {
|
||
this._createCommentToken();
|
||
this.state = COMMENT_START_STATE;
|
||
} else if (this._consumeSequenceIfMatch($$.DOCTYPE_STRING, cp, false)) {
|
||
this.state = DOCTYPE_STATE;
|
||
} else if (this._consumeSequenceIfMatch($$.CDATA_START_STRING, cp, true)) {
|
||
if (this.allowCDATA) {
|
||
this.state = CDATA_SECTION_STATE;
|
||
} else {
|
||
this._err(ERR.cdataInHtmlContent);
|
||
this._createCommentToken();
|
||
this.currentToken.data = '[CDATA[';
|
||
this.state = BOGUS_COMMENT_STATE;
|
||
}
|
||
}
|
||
|
||
//NOTE: sequence lookup can be abrupted by hibernation. In that case lookup
|
||
//results are no longer valid and we will need to start over.
|
||
else if (!this._ensureHibernation()) {
|
||
this._err(ERR.incorrectlyOpenedComment);
|
||
this._createCommentToken();
|
||
this._reconsumeInState(BOGUS_COMMENT_STATE);
|
||
}
|
||
}
|
||
|
||
// Comment start state
|
||
//------------------------------------------------------------------
|
||
[COMMENT_START_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = COMMENT_START_DASH_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.abruptClosingOfEmptyComment);
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else {
|
||
this._reconsumeInState(COMMENT_STATE);
|
||
}
|
||
}
|
||
|
||
// Comment start dash state
|
||
//------------------------------------------------------------------
|
||
[COMMENT_START_DASH_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = COMMENT_END_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.abruptClosingOfEmptyComment);
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInComment);
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.data += '-';
|
||
this._reconsumeInState(COMMENT_STATE);
|
||
}
|
||
}
|
||
|
||
// Comment state
|
||
//------------------------------------------------------------------
|
||
[COMMENT_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = COMMENT_END_DASH_STATE;
|
||
} else if (cp === $.LESS_THAN_SIGN) {
|
||
this.currentToken.data += '<';
|
||
this.state = COMMENT_LESS_THAN_SIGN_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentToken.data += unicode.REPLACEMENT_CHARACTER;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInComment);
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.data += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// Comment less-than sign state
|
||
//------------------------------------------------------------------
|
||
[COMMENT_LESS_THAN_SIGN_STATE](cp) {
|
||
if (cp === $.EXCLAMATION_MARK) {
|
||
this.currentToken.data += '!';
|
||
this.state = COMMENT_LESS_THAN_SIGN_BANG_STATE;
|
||
} else if (cp === $.LESS_THAN_SIGN) {
|
||
this.currentToken.data += '!';
|
||
} else {
|
||
this._reconsumeInState(COMMENT_STATE);
|
||
}
|
||
}
|
||
|
||
// Comment less-than sign bang state
|
||
//------------------------------------------------------------------
|
||
[COMMENT_LESS_THAN_SIGN_BANG_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE;
|
||
} else {
|
||
this._reconsumeInState(COMMENT_STATE);
|
||
}
|
||
}
|
||
|
||
// Comment less-than sign bang dash state
|
||
//------------------------------------------------------------------
|
||
[COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE;
|
||
} else {
|
||
this._reconsumeInState(COMMENT_END_DASH_STATE);
|
||
}
|
||
}
|
||
|
||
// Comment less-than sign bang dash dash state
|
||
//------------------------------------------------------------------
|
||
[COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE](cp) {
|
||
if (cp !== $.GREATER_THAN_SIGN && cp !== $.EOF) {
|
||
this._err(ERR.nestedComment);
|
||
}
|
||
|
||
this._reconsumeInState(COMMENT_END_STATE);
|
||
}
|
||
|
||
// Comment end dash state
|
||
//------------------------------------------------------------------
|
||
[COMMENT_END_DASH_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.state = COMMENT_END_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInComment);
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.data += '-';
|
||
this._reconsumeInState(COMMENT_STATE);
|
||
}
|
||
}
|
||
|
||
// Comment end state
|
||
//------------------------------------------------------------------
|
||
[COMMENT_END_STATE](cp) {
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EXCLAMATION_MARK) {
|
||
this.state = COMMENT_END_BANG_STATE;
|
||
} else if (cp === $.HYPHEN_MINUS) {
|
||
this.currentToken.data += '-';
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInComment);
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.data += '--';
|
||
this._reconsumeInState(COMMENT_STATE);
|
||
}
|
||
}
|
||
|
||
// Comment end bang state
|
||
//------------------------------------------------------------------
|
||
[COMMENT_END_BANG_STATE](cp) {
|
||
if (cp === $.HYPHEN_MINUS) {
|
||
this.currentToken.data += '--!';
|
||
this.state = COMMENT_END_DASH_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.incorrectlyClosedComment);
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInComment);
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.data += '--!';
|
||
this._reconsumeInState(COMMENT_STATE);
|
||
}
|
||
}
|
||
|
||
// DOCTYPE state
|
||
//------------------------------------------------------------------
|
||
[DOCTYPE_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
this.state = BEFORE_DOCTYPE_NAME_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._reconsumeInState(BEFORE_DOCTYPE_NAME_STATE);
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this._createDoctypeToken(null);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.missingWhitespaceBeforeDoctypeName);
|
||
this._reconsumeInState(BEFORE_DOCTYPE_NAME_STATE);
|
||
}
|
||
}
|
||
|
||
// Before DOCTYPE name state
|
||
//------------------------------------------------------------------
|
||
[BEFORE_DOCTYPE_NAME_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
return;
|
||
}
|
||
|
||
if (isAsciiUpper(cp)) {
|
||
this._createDoctypeToken(toAsciiLowerChar(cp));
|
||
this.state = DOCTYPE_NAME_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this._createDoctypeToken(unicode.REPLACEMENT_CHARACTER);
|
||
this.state = DOCTYPE_NAME_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.missingDoctypeName);
|
||
this._createDoctypeToken(null);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this._createDoctypeToken(null);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._createDoctypeToken(toChar(cp));
|
||
this.state = DOCTYPE_NAME_STATE;
|
||
}
|
||
}
|
||
|
||
// DOCTYPE name state
|
||
//------------------------------------------------------------------
|
||
[DOCTYPE_NAME_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
this.state = AFTER_DOCTYPE_NAME_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (isAsciiUpper(cp)) {
|
||
this.currentToken.name += toAsciiLowerChar(cp);
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentToken.name += unicode.REPLACEMENT_CHARACTER;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.name += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// After DOCTYPE name state
|
||
//------------------------------------------------------------------
|
||
[AFTER_DOCTYPE_NAME_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
return;
|
||
}
|
||
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else if (this._consumeSequenceIfMatch($$.PUBLIC_STRING, cp, false)) {
|
||
this.state = AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE;
|
||
} else if (this._consumeSequenceIfMatch($$.SYSTEM_STRING, cp, false)) {
|
||
this.state = AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE;
|
||
}
|
||
//NOTE: sequence lookup can be abrupted by hibernation. In that case lookup
|
||
//results are no longer valid and we will need to start over.
|
||
else if (!this._ensureHibernation()) {
|
||
this._err(ERR.invalidCharacterSequenceAfterDoctypeName);
|
||
this.currentToken.forceQuirks = true;
|
||
this._reconsumeInState(BOGUS_DOCTYPE_STATE);
|
||
}
|
||
}
|
||
|
||
// After DOCTYPE public keyword state
|
||
//------------------------------------------------------------------
|
||
[AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
this.state = BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE;
|
||
} else if (cp === $.QUOTATION_MARK) {
|
||
this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);
|
||
this.currentToken.publicId = '';
|
||
this.state = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE;
|
||
} else if (cp === $.APOSTROPHE) {
|
||
this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);
|
||
this.currentToken.publicId = '';
|
||
this.state = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.missingDoctypePublicIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this._reconsumeInState(BOGUS_DOCTYPE_STATE);
|
||
}
|
||
}
|
||
|
||
// Before DOCTYPE public identifier state
|
||
//------------------------------------------------------------------
|
||
[BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
return;
|
||
}
|
||
|
||
if (cp === $.QUOTATION_MARK) {
|
||
this.currentToken.publicId = '';
|
||
this.state = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE;
|
||
} else if (cp === $.APOSTROPHE) {
|
||
this.currentToken.publicId = '';
|
||
this.state = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.missingDoctypePublicIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this._reconsumeInState(BOGUS_DOCTYPE_STATE);
|
||
}
|
||
}
|
||
|
||
// DOCTYPE public identifier (double-quoted) state
|
||
//------------------------------------------------------------------
|
||
[DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE](cp) {
|
||
if (cp === $.QUOTATION_MARK) {
|
||
this.state = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentToken.publicId += unicode.REPLACEMENT_CHARACTER;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.abruptDoctypePublicIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.publicId += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// DOCTYPE public identifier (single-quoted) state
|
||
//------------------------------------------------------------------
|
||
[DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE](cp) {
|
||
if (cp === $.APOSTROPHE) {
|
||
this.state = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentToken.publicId += unicode.REPLACEMENT_CHARACTER;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.abruptDoctypePublicIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.publicId += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// After DOCTYPE public identifier state
|
||
//------------------------------------------------------------------
|
||
[AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
this.state = BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.QUOTATION_MARK) {
|
||
this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
|
||
this.currentToken.systemId = '';
|
||
this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE;
|
||
} else if (cp === $.APOSTROPHE) {
|
||
this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
|
||
this.currentToken.systemId = '';
|
||
this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this._reconsumeInState(BOGUS_DOCTYPE_STATE);
|
||
}
|
||
}
|
||
|
||
// Between DOCTYPE public and system identifiers state
|
||
//------------------------------------------------------------------
|
||
[BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
return;
|
||
}
|
||
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
} else if (cp === $.QUOTATION_MARK) {
|
||
this.currentToken.systemId = '';
|
||
this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE;
|
||
} else if (cp === $.APOSTROPHE) {
|
||
this.currentToken.systemId = '';
|
||
this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this._reconsumeInState(BOGUS_DOCTYPE_STATE);
|
||
}
|
||
}
|
||
|
||
// After DOCTYPE system keyword state
|
||
//------------------------------------------------------------------
|
||
[AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
this.state = BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE;
|
||
} else if (cp === $.QUOTATION_MARK) {
|
||
this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);
|
||
this.currentToken.systemId = '';
|
||
this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE;
|
||
} else if (cp === $.APOSTROPHE) {
|
||
this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);
|
||
this.currentToken.systemId = '';
|
||
this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.missingDoctypeSystemIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this._reconsumeInState(BOGUS_DOCTYPE_STATE);
|
||
}
|
||
}
|
||
|
||
// Before DOCTYPE system identifier state
|
||
//------------------------------------------------------------------
|
||
[BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
return;
|
||
}
|
||
|
||
if (cp === $.QUOTATION_MARK) {
|
||
this.currentToken.systemId = '';
|
||
this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE;
|
||
} else if (cp === $.APOSTROPHE) {
|
||
this.currentToken.systemId = '';
|
||
this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.missingDoctypeSystemIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this.state = DATA_STATE;
|
||
this._emitCurrentToken();
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this._reconsumeInState(BOGUS_DOCTYPE_STATE);
|
||
}
|
||
}
|
||
|
||
// DOCTYPE system identifier (double-quoted) state
|
||
//------------------------------------------------------------------
|
||
[DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE](cp) {
|
||
if (cp === $.QUOTATION_MARK) {
|
||
this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentToken.systemId += unicode.REPLACEMENT_CHARACTER;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.abruptDoctypeSystemIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.systemId += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// DOCTYPE system identifier (single-quoted) state
|
||
//------------------------------------------------------------------
|
||
[DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE](cp) {
|
||
if (cp === $.APOSTROPHE) {
|
||
this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
this.currentToken.systemId += unicode.REPLACEMENT_CHARACTER;
|
||
} else if (cp === $.GREATER_THAN_SIGN) {
|
||
this._err(ERR.abruptDoctypeSystemIdentifier);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this.currentToken.systemId += toChar(cp);
|
||
}
|
||
}
|
||
|
||
// After DOCTYPE system identifier state
|
||
//------------------------------------------------------------------
|
||
[AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE](cp) {
|
||
if (isWhitespace(cp)) {
|
||
return;
|
||
}
|
||
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInDoctype);
|
||
this.currentToken.forceQuirks = true;
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier);
|
||
this._reconsumeInState(BOGUS_DOCTYPE_STATE);
|
||
}
|
||
}
|
||
|
||
// Bogus DOCTYPE state
|
||
//------------------------------------------------------------------
|
||
[BOGUS_DOCTYPE_STATE](cp) {
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this._emitCurrentToken();
|
||
this.state = DATA_STATE;
|
||
} else if (cp === $.NULL) {
|
||
this._err(ERR.unexpectedNullCharacter);
|
||
} else if (cp === $.EOF) {
|
||
this._emitCurrentToken();
|
||
this._emitEOFToken();
|
||
}
|
||
}
|
||
|
||
// CDATA section state
|
||
//------------------------------------------------------------------
|
||
[CDATA_SECTION_STATE](cp) {
|
||
if (cp === $.RIGHT_SQUARE_BRACKET) {
|
||
this.state = CDATA_SECTION_BRACKET_STATE;
|
||
} else if (cp === $.EOF) {
|
||
this._err(ERR.eofInCdata);
|
||
this._emitEOFToken();
|
||
} else {
|
||
this._emitCodePoint(cp);
|
||
}
|
||
}
|
||
|
||
// CDATA section bracket state
|
||
//------------------------------------------------------------------
|
||
[CDATA_SECTION_BRACKET_STATE](cp) {
|
||
if (cp === $.RIGHT_SQUARE_BRACKET) {
|
||
this.state = CDATA_SECTION_END_STATE;
|
||
} else {
|
||
this._emitChars(']');
|
||
this._reconsumeInState(CDATA_SECTION_STATE);
|
||
}
|
||
}
|
||
|
||
// CDATA section end state
|
||
//------------------------------------------------------------------
|
||
[CDATA_SECTION_END_STATE](cp) {
|
||
if (cp === $.GREATER_THAN_SIGN) {
|
||
this.state = DATA_STATE;
|
||
} else if (cp === $.RIGHT_SQUARE_BRACKET) {
|
||
this._emitChars(']');
|
||
} else {
|
||
this._emitChars(']]');
|
||
this._reconsumeInState(CDATA_SECTION_STATE);
|
||
}
|
||
}
|
||
|
||
// Character reference state
|
||
//------------------------------------------------------------------
|
||
[CHARACTER_REFERENCE_STATE](cp) {
|
||
this.tempBuff = [$.AMPERSAND];
|
||
|
||
if (cp === $.NUMBER_SIGN) {
|
||
this.tempBuff.push(cp);
|
||
this.state = NUMERIC_CHARACTER_REFERENCE_STATE;
|
||
} else if (isAsciiAlphaNumeric(cp)) {
|
||
this._reconsumeInState(NAMED_CHARACTER_REFERENCE_STATE);
|
||
} else {
|
||
this._flushCodePointsConsumedAsCharacterReference();
|
||
this._reconsumeInState(this.returnState);
|
||
}
|
||
}
|
||
|
||
// Named character reference state
|
||
//------------------------------------------------------------------
|
||
[NAMED_CHARACTER_REFERENCE_STATE](cp) {
|
||
const matchResult = this._matchNamedCharacterReference(cp);
|
||
|
||
//NOTE: matching can be abrupted by hibernation. In that case match
|
||
//results are no longer valid and we will need to start over.
|
||
if (this._ensureHibernation()) {
|
||
this.tempBuff = [$.AMPERSAND];
|
||
} else if (matchResult) {
|
||
const withSemicolon = this.tempBuff[this.tempBuff.length - 1] === $.SEMICOLON;
|
||
|
||
if (!this._isCharacterReferenceAttributeQuirk(withSemicolon)) {
|
||
if (!withSemicolon) {
|
||
this._errOnNextCodePoint(ERR.missingSemicolonAfterCharacterReference);
|
||
}
|
||
|
||
this.tempBuff = matchResult;
|
||
}
|
||
|
||
this._flushCodePointsConsumedAsCharacterReference();
|
||
this.state = this.returnState;
|
||
} else {
|
||
this._flushCodePointsConsumedAsCharacterReference();
|
||
this.state = AMBIGUOUS_AMPERSAND_STATE;
|
||
}
|
||
}
|
||
|
||
// Ambiguos ampersand state
|
||
//------------------------------------------------------------------
|
||
[AMBIGUOUS_AMPERSAND_STATE](cp) {
|
||
if (isAsciiAlphaNumeric(cp)) {
|
||
if (this._isCharacterReferenceInAttribute()) {
|
||
this.currentAttr.value += toChar(cp);
|
||
} else {
|
||
this._emitCodePoint(cp);
|
||
}
|
||
} else {
|
||
if (cp === $.SEMICOLON) {
|
||
this._err(ERR.unknownNamedCharacterReference);
|
||
}
|
||
|
||
this._reconsumeInState(this.returnState);
|
||
}
|
||
}
|
||
|
||
// Numeric character reference state
|
||
//------------------------------------------------------------------
|
||
[NUMERIC_CHARACTER_REFERENCE_STATE](cp) {
|
||
this.charRefCode = 0;
|
||
|
||
if (cp === $.LATIN_SMALL_X || cp === $.LATIN_CAPITAL_X) {
|
||
this.tempBuff.push(cp);
|
||
this.state = HEXADEMICAL_CHARACTER_REFERENCE_START_STATE;
|
||
} else {
|
||
this._reconsumeInState(DECIMAL_CHARACTER_REFERENCE_START_STATE);
|
||
}
|
||
}
|
||
|
||
// Hexademical character reference start state
|
||
//------------------------------------------------------------------
|
||
[HEXADEMICAL_CHARACTER_REFERENCE_START_STATE](cp) {
|
||
if (isAsciiHexDigit(cp)) {
|
||
this._reconsumeInState(HEXADEMICAL_CHARACTER_REFERENCE_STATE);
|
||
} else {
|
||
this._err(ERR.absenceOfDigitsInNumericCharacterReference);
|
||
this._flushCodePointsConsumedAsCharacterReference();
|
||
this._reconsumeInState(this.returnState);
|
||
}
|
||
}
|
||
|
||
// Decimal character reference start state
|
||
//------------------------------------------------------------------
|
||
[DECIMAL_CHARACTER_REFERENCE_START_STATE](cp) {
|
||
if (isAsciiDigit(cp)) {
|
||
this._reconsumeInState(DECIMAL_CHARACTER_REFERENCE_STATE);
|
||
} else {
|
||
this._err(ERR.absenceOfDigitsInNumericCharacterReference);
|
||
this._flushCodePointsConsumedAsCharacterReference();
|
||
this._reconsumeInState(this.returnState);
|
||
}
|
||
}
|
||
|
||
// Hexademical character reference state
|
||
//------------------------------------------------------------------
|
||
[HEXADEMICAL_CHARACTER_REFERENCE_STATE](cp) {
|
||
if (isAsciiUpperHexDigit(cp)) {
|
||
this.charRefCode = this.charRefCode * 16 + cp - 0x37;
|
||
} else if (isAsciiLowerHexDigit(cp)) {
|
||
this.charRefCode = this.charRefCode * 16 + cp - 0x57;
|
||
} else if (isAsciiDigit(cp)) {
|
||
this.charRefCode = this.charRefCode * 16 + cp - 0x30;
|
||
} else if (cp === $.SEMICOLON) {
|
||
this.state = NUMERIC_CHARACTER_REFERENCE_END_STATE;
|
||
} else {
|
||
this._err(ERR.missingSemicolonAfterCharacterReference);
|
||
this._reconsumeInState(NUMERIC_CHARACTER_REFERENCE_END_STATE);
|
||
}
|
||
}
|
||
|
||
// Decimal character reference state
|
||
//------------------------------------------------------------------
|
||
[DECIMAL_CHARACTER_REFERENCE_STATE](cp) {
|
||
if (isAsciiDigit(cp)) {
|
||
this.charRefCode = this.charRefCode * 10 + cp - 0x30;
|
||
} else if (cp === $.SEMICOLON) {
|
||
this.state = NUMERIC_CHARACTER_REFERENCE_END_STATE;
|
||
} else {
|
||
this._err(ERR.missingSemicolonAfterCharacterReference);
|
||
this._reconsumeInState(NUMERIC_CHARACTER_REFERENCE_END_STATE);
|
||
}
|
||
}
|
||
|
||
// Numeric character reference end state
|
||
//------------------------------------------------------------------
|
||
[NUMERIC_CHARACTER_REFERENCE_END_STATE]() {
|
||
if (this.charRefCode === $.NULL) {
|
||
this._err(ERR.nullCharacterReference);
|
||
this.charRefCode = $.REPLACEMENT_CHARACTER;
|
||
} else if (this.charRefCode > 0x10ffff) {
|
||
this._err(ERR.characterReferenceOutsideUnicodeRange);
|
||
this.charRefCode = $.REPLACEMENT_CHARACTER;
|
||
} else if (unicode.isSurrogate(this.charRefCode)) {
|
||
this._err(ERR.surrogateCharacterReference);
|
||
this.charRefCode = $.REPLACEMENT_CHARACTER;
|
||
} else if (unicode.isUndefinedCodePoint(this.charRefCode)) {
|
||
this._err(ERR.noncharacterCharacterReference);
|
||
} else if (unicode.isControlCodePoint(this.charRefCode) || this.charRefCode === $.CARRIAGE_RETURN) {
|
||
this._err(ERR.controlCharacterReference);
|
||
|
||
const replacement = C1_CONTROLS_REFERENCE_REPLACEMENTS[this.charRefCode];
|
||
|
||
if (replacement) {
|
||
this.charRefCode = replacement;
|
||
}
|
||
}
|
||
|
||
this.tempBuff = [this.charRefCode];
|
||
|
||
this._flushCodePointsConsumedAsCharacterReference();
|
||
this._reconsumeInState(this.returnState);
|
||
}
|
||
}
|
||
|
||
//Token types
|
||
Tokenizer.CHARACTER_TOKEN = 'CHARACTER_TOKEN';
|
||
Tokenizer.NULL_CHARACTER_TOKEN = 'NULL_CHARACTER_TOKEN';
|
||
Tokenizer.WHITESPACE_CHARACTER_TOKEN = 'WHITESPACE_CHARACTER_TOKEN';
|
||
Tokenizer.START_TAG_TOKEN = 'START_TAG_TOKEN';
|
||
Tokenizer.END_TAG_TOKEN = 'END_TAG_TOKEN';
|
||
Tokenizer.COMMENT_TOKEN = 'COMMENT_TOKEN';
|
||
Tokenizer.DOCTYPE_TOKEN = 'DOCTYPE_TOKEN';
|
||
Tokenizer.EOF_TOKEN = 'EOF_TOKEN';
|
||
Tokenizer.HIBERNATION_TOKEN = 'HIBERNATION_TOKEN';
|
||
|
||
//Tokenizer initial states for different modes
|
||
Tokenizer.MODE = {
|
||
DATA: DATA_STATE,
|
||
RCDATA: RCDATA_STATE,
|
||
RAWTEXT: RAWTEXT_STATE,
|
||
SCRIPT_DATA: SCRIPT_DATA_STATE,
|
||
PLAINTEXT: PLAINTEXT_STATE
|
||
};
|
||
|
||
//Static
|
||
Tokenizer.getTokenAttr = function(token, attrName) {
|
||
for (let i = token.attrs.length - 1; i >= 0; i--) {
|
||
if (token.attrs[i].name === attrName) {
|
||
return token.attrs[i].value;
|
||
}
|
||
}
|
||
|
||
return null;
|
||
};
|
||
|
||
module.exports = Tokenizer;
|
||
|
||
|
||
/***/ }),
|
||
/* 138 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const unicode = __webpack_require__(139);
|
||
const ERR = __webpack_require__(140);
|
||
|
||
//Aliases
|
||
const $ = unicode.CODE_POINTS;
|
||
|
||
//Const
|
||
const DEFAULT_BUFFER_WATERLINE = 1 << 16;
|
||
|
||
//Preprocessor
|
||
//NOTE: HTML input preprocessing
|
||
//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream)
|
||
class Preprocessor {
|
||
constructor() {
|
||
this.html = null;
|
||
|
||
this.pos = -1;
|
||
this.lastGapPos = -1;
|
||
this.lastCharPos = -1;
|
||
|
||
this.gapStack = [];
|
||
|
||
this.skipNextNewLine = false;
|
||
|
||
this.lastChunkWritten = false;
|
||
this.endOfChunkHit = false;
|
||
this.bufferWaterline = DEFAULT_BUFFER_WATERLINE;
|
||
}
|
||
|
||
_err() {
|
||
// NOTE: err reporting is noop by default. Enabled by mixin.
|
||
}
|
||
|
||
_addGap() {
|
||
this.gapStack.push(this.lastGapPos);
|
||
this.lastGapPos = this.pos;
|
||
}
|
||
|
||
_processSurrogate(cp) {
|
||
//NOTE: try to peek a surrogate pair
|
||
if (this.pos !== this.lastCharPos) {
|
||
const nextCp = this.html.charCodeAt(this.pos + 1);
|
||
|
||
if (unicode.isSurrogatePair(nextCp)) {
|
||
//NOTE: we have a surrogate pair. Peek pair character and recalculate code point.
|
||
this.pos++;
|
||
|
||
//NOTE: add gap that should be avoided during retreat
|
||
this._addGap();
|
||
|
||
return unicode.getSurrogatePairCodePoint(cp, nextCp);
|
||
}
|
||
}
|
||
|
||
//NOTE: we are at the end of a chunk, therefore we can't infer surrogate pair yet.
|
||
else if (!this.lastChunkWritten) {
|
||
this.endOfChunkHit = true;
|
||
return $.EOF;
|
||
}
|
||
|
||
//NOTE: isolated surrogate
|
||
this._err(ERR.surrogateInInputStream);
|
||
|
||
return cp;
|
||
}
|
||
|
||
dropParsedChunk() {
|
||
if (this.pos > this.bufferWaterline) {
|
||
this.lastCharPos -= this.pos;
|
||
this.html = this.html.substring(this.pos);
|
||
this.pos = 0;
|
||
this.lastGapPos = -1;
|
||
this.gapStack = [];
|
||
}
|
||
}
|
||
|
||
write(chunk, isLastChunk) {
|
||
if (this.html) {
|
||
this.html += chunk;
|
||
} else {
|
||
this.html = chunk;
|
||
}
|
||
|
||
this.lastCharPos = this.html.length - 1;
|
||
this.endOfChunkHit = false;
|
||
this.lastChunkWritten = isLastChunk;
|
||
}
|
||
|
||
insertHtmlAtCurrentPos(chunk) {
|
||
this.html = this.html.substring(0, this.pos + 1) + chunk + this.html.substring(this.pos + 1, this.html.length);
|
||
|
||
this.lastCharPos = this.html.length - 1;
|
||
this.endOfChunkHit = false;
|
||
}
|
||
|
||
advance() {
|
||
this.pos++;
|
||
|
||
if (this.pos > this.lastCharPos) {
|
||
this.endOfChunkHit = !this.lastChunkWritten;
|
||
return $.EOF;
|
||
}
|
||
|
||
let cp = this.html.charCodeAt(this.pos);
|
||
|
||
//NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character
|
||
//must be ignored.
|
||
if (this.skipNextNewLine && cp === $.LINE_FEED) {
|
||
this.skipNextNewLine = false;
|
||
this._addGap();
|
||
return this.advance();
|
||
}
|
||
|
||
//NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters
|
||
if (cp === $.CARRIAGE_RETURN) {
|
||
this.skipNextNewLine = true;
|
||
return $.LINE_FEED;
|
||
}
|
||
|
||
this.skipNextNewLine = false;
|
||
|
||
if (unicode.isSurrogate(cp)) {
|
||
cp = this._processSurrogate(cp);
|
||
}
|
||
|
||
//OPTIMIZATION: first check if code point is in the common allowed
|
||
//range (ASCII alphanumeric, whitespaces, big chunk of BMP)
|
||
//before going into detailed performance cost validation.
|
||
const isCommonValidRange =
|
||
(cp > 0x1f && cp < 0x7f) || cp === $.LINE_FEED || cp === $.CARRIAGE_RETURN || (cp > 0x9f && cp < 0xfdd0);
|
||
|
||
if (!isCommonValidRange) {
|
||
this._checkForProblematicCharacters(cp);
|
||
}
|
||
|
||
return cp;
|
||
}
|
||
|
||
_checkForProblematicCharacters(cp) {
|
||
if (unicode.isControlCodePoint(cp)) {
|
||
this._err(ERR.controlCharacterInInputStream);
|
||
} else if (unicode.isUndefinedCodePoint(cp)) {
|
||
this._err(ERR.noncharacterInInputStream);
|
||
}
|
||
}
|
||
|
||
retreat() {
|
||
if (this.pos === this.lastGapPos) {
|
||
this.lastGapPos = this.gapStack.pop();
|
||
this.pos--;
|
||
}
|
||
|
||
this.pos--;
|
||
}
|
||
}
|
||
|
||
module.exports = Preprocessor;
|
||
|
||
|
||
/***/ }),
|
||
/* 139 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const UNDEFINED_CODE_POINTS = [
|
||
0xfffe,
|
||
0xffff,
|
||
0x1fffe,
|
||
0x1ffff,
|
||
0x2fffe,
|
||
0x2ffff,
|
||
0x3fffe,
|
||
0x3ffff,
|
||
0x4fffe,
|
||
0x4ffff,
|
||
0x5fffe,
|
||
0x5ffff,
|
||
0x6fffe,
|
||
0x6ffff,
|
||
0x7fffe,
|
||
0x7ffff,
|
||
0x8fffe,
|
||
0x8ffff,
|
||
0x9fffe,
|
||
0x9ffff,
|
||
0xafffe,
|
||
0xaffff,
|
||
0xbfffe,
|
||
0xbffff,
|
||
0xcfffe,
|
||
0xcffff,
|
||
0xdfffe,
|
||
0xdffff,
|
||
0xefffe,
|
||
0xeffff,
|
||
0xffffe,
|
||
0xfffff,
|
||
0x10fffe,
|
||
0x10ffff
|
||
];
|
||
|
||
exports.REPLACEMENT_CHARACTER = '\uFFFD';
|
||
|
||
exports.CODE_POINTS = {
|
||
EOF: -1,
|
||
NULL: 0x00,
|
||
TABULATION: 0x09,
|
||
CARRIAGE_RETURN: 0x0d,
|
||
LINE_FEED: 0x0a,
|
||
FORM_FEED: 0x0c,
|
||
SPACE: 0x20,
|
||
EXCLAMATION_MARK: 0x21,
|
||
QUOTATION_MARK: 0x22,
|
||
NUMBER_SIGN: 0x23,
|
||
AMPERSAND: 0x26,
|
||
APOSTROPHE: 0x27,
|
||
HYPHEN_MINUS: 0x2d,
|
||
SOLIDUS: 0x2f,
|
||
DIGIT_0: 0x30,
|
||
DIGIT_9: 0x39,
|
||
SEMICOLON: 0x3b,
|
||
LESS_THAN_SIGN: 0x3c,
|
||
EQUALS_SIGN: 0x3d,
|
||
GREATER_THAN_SIGN: 0x3e,
|
||
QUESTION_MARK: 0x3f,
|
||
LATIN_CAPITAL_A: 0x41,
|
||
LATIN_CAPITAL_F: 0x46,
|
||
LATIN_CAPITAL_X: 0x58,
|
||
LATIN_CAPITAL_Z: 0x5a,
|
||
RIGHT_SQUARE_BRACKET: 0x5d,
|
||
GRAVE_ACCENT: 0x60,
|
||
LATIN_SMALL_A: 0x61,
|
||
LATIN_SMALL_F: 0x66,
|
||
LATIN_SMALL_X: 0x78,
|
||
LATIN_SMALL_Z: 0x7a,
|
||
REPLACEMENT_CHARACTER: 0xfffd
|
||
};
|
||
|
||
exports.CODE_POINT_SEQUENCES = {
|
||
DASH_DASH_STRING: [0x2d, 0x2d], //--
|
||
DOCTYPE_STRING: [0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45], //DOCTYPE
|
||
CDATA_START_STRING: [0x5b, 0x43, 0x44, 0x41, 0x54, 0x41, 0x5b], //[CDATA[
|
||
SCRIPT_STRING: [0x73, 0x63, 0x72, 0x69, 0x70, 0x74], //script
|
||
PUBLIC_STRING: [0x50, 0x55, 0x42, 0x4c, 0x49, 0x43], //PUBLIC
|
||
SYSTEM_STRING: [0x53, 0x59, 0x53, 0x54, 0x45, 0x4d] //SYSTEM
|
||
};
|
||
|
||
//Surrogates
|
||
exports.isSurrogate = function(cp) {
|
||
return cp >= 0xd800 && cp <= 0xdfff;
|
||
};
|
||
|
||
exports.isSurrogatePair = function(cp) {
|
||
return cp >= 0xdc00 && cp <= 0xdfff;
|
||
};
|
||
|
||
exports.getSurrogatePairCodePoint = function(cp1, cp2) {
|
||
return (cp1 - 0xd800) * 0x400 + 0x2400 + cp2;
|
||
};
|
||
|
||
//NOTE: excluding NULL and ASCII whitespace
|
||
exports.isControlCodePoint = function(cp) {
|
||
return (
|
||
(cp !== 0x20 && cp !== 0x0a && cp !== 0x0d && cp !== 0x09 && cp !== 0x0c && cp >= 0x01 && cp <= 0x1f) ||
|
||
(cp >= 0x7f && cp <= 0x9f)
|
||
);
|
||
};
|
||
|
||
exports.isUndefinedCodePoint = function(cp) {
|
||
return (cp >= 0xfdd0 && cp <= 0xfdef) || UNDEFINED_CODE_POINTS.indexOf(cp) > -1;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 140 */
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
module.exports = {
|
||
controlCharacterInInputStream: 'control-character-in-input-stream',
|
||
noncharacterInInputStream: 'noncharacter-in-input-stream',
|
||
surrogateInInputStream: 'surrogate-in-input-stream',
|
||
nonVoidHtmlElementStartTagWithTrailingSolidus: 'non-void-html-element-start-tag-with-trailing-solidus',
|
||
endTagWithAttributes: 'end-tag-with-attributes',
|
||
endTagWithTrailingSolidus: 'end-tag-with-trailing-solidus',
|
||
unexpectedSolidusInTag: 'unexpected-solidus-in-tag',
|
||
unexpectedNullCharacter: 'unexpected-null-character',
|
||
unexpectedQuestionMarkInsteadOfTagName: 'unexpected-question-mark-instead-of-tag-name',
|
||
invalidFirstCharacterOfTagName: 'invalid-first-character-of-tag-name',
|
||
unexpectedEqualsSignBeforeAttributeName: 'unexpected-equals-sign-before-attribute-name',
|
||
missingEndTagName: 'missing-end-tag-name',
|
||
unexpectedCharacterInAttributeName: 'unexpected-character-in-attribute-name',
|
||
unknownNamedCharacterReference: 'unknown-named-character-reference',
|
||
missingSemicolonAfterCharacterReference: 'missing-semicolon-after-character-reference',
|
||
unexpectedCharacterAfterDoctypeSystemIdentifier: 'unexpected-character-after-doctype-system-identifier',
|
||
unexpectedCharacterInUnquotedAttributeValue: 'unexpected-character-in-unquoted-attribute-value',
|
||
eofBeforeTagName: 'eof-before-tag-name',
|
||
eofInTag: 'eof-in-tag',
|
||
missingAttributeValue: 'missing-attribute-value',
|
||
missingWhitespaceBetweenAttributes: 'missing-whitespace-between-attributes',
|
||
missingWhitespaceAfterDoctypePublicKeyword: 'missing-whitespace-after-doctype-public-keyword',
|
||
missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:
|
||
'missing-whitespace-between-doctype-public-and-system-identifiers',
|
||
missingWhitespaceAfterDoctypeSystemKeyword: 'missing-whitespace-after-doctype-system-keyword',
|
||
missingQuoteBeforeDoctypePublicIdentifier: 'missing-quote-before-doctype-public-identifier',
|
||
missingQuoteBeforeDoctypeSystemIdentifier: 'missing-quote-before-doctype-system-identifier',
|
||
missingDoctypePublicIdentifier: 'missing-doctype-public-identifier',
|
||
missingDoctypeSystemIdentifier: 'missing-doctype-system-identifier',
|
||
abruptDoctypePublicIdentifier: 'abrupt-doctype-public-identifier',
|
||
abruptDoctypeSystemIdentifier: 'abrupt-doctype-system-identifier',
|
||
cdataInHtmlContent: 'cdata-in-html-content',
|
||
incorrectlyOpenedComment: 'incorrectly-opened-comment',
|
||
eofInScriptHtmlCommentLikeText: 'eof-in-script-html-comment-like-text',
|
||
eofInDoctype: 'eof-in-doctype',
|
||
nestedComment: 'nested-comment',
|
||
abruptClosingOfEmptyComment: 'abrupt-closing-of-empty-comment',
|
||
eofInComment: 'eof-in-comment',
|
||
incorrectlyClosedComment: 'incorrectly-closed-comment',
|
||
eofInCdata: 'eof-in-cdata',
|
||
absenceOfDigitsInNumericCharacterReference: 'absence-of-digits-in-numeric-character-reference',
|
||
nullCharacterReference: 'null-character-reference',
|
||
surrogateCharacterReference: 'surrogate-character-reference',
|
||
characterReferenceOutsideUnicodeRange: 'character-reference-outside-unicode-range',
|
||
controlCharacterReference: 'control-character-reference',
|
||
noncharacterCharacterReference: 'noncharacter-character-reference',
|
||
missingWhitespaceBeforeDoctypeName: 'missing-whitespace-before-doctype-name',
|
||
missingDoctypeName: 'missing-doctype-name',
|
||
invalidCharacterSequenceAfterDoctypeName: 'invalid-character-sequence-after-doctype-name',
|
||
duplicateAttribute: 'duplicate-attribute',
|
||
nonConformingDoctype: 'non-conforming-doctype',
|
||
missingDoctype: 'missing-doctype',
|
||
misplacedDoctype: 'misplaced-doctype',
|
||
endTagWithoutMatchingOpenElement: 'end-tag-without-matching-open-element',
|
||
closingOfElementWithOpenChildElements: 'closing-of-element-with-open-child-elements',
|
||
disallowedContentInNoscriptInHead: 'disallowed-content-in-noscript-in-head',
|
||
openElementsLeftAfterEof: 'open-elements-left-after-eof',
|
||
abandonedHeadElementChild: 'abandoned-head-element-child',
|
||
misplacedStartTagForHeadElement: 'misplaced-start-tag-for-head-element',
|
||
nestedNoscriptInHead: 'nested-noscript-in-head',
|
||
eofInElementThatCanContainOnlyText: 'eof-in-element-that-can-contain-only-text'
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 141 */
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
//NOTE: this file contains auto-generated array mapped radix tree that is used for the named entity references consumption
|
||
//(details: https://github.com/inikulin/parse5/tree/master/scripts/generate-named-entity-data/README.md)
|
||
module.exports = new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4000,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,10000,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13000,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]);
|
||
|
||
/***/ }),
|
||
/* 142 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const HTML = __webpack_require__(143);
|
||
|
||
//Aliases
|
||
const $ = HTML.TAG_NAMES;
|
||
const NS = HTML.NAMESPACES;
|
||
|
||
//Element utils
|
||
|
||
//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here.
|
||
//It's faster than using dictionary.
|
||
function isImpliedEndTagRequired(tn) {
|
||
switch (tn.length) {
|
||
case 1:
|
||
return tn === $.P;
|
||
|
||
case 2:
|
||
return tn === $.RB || tn === $.RP || tn === $.RT || tn === $.DD || tn === $.DT || tn === $.LI;
|
||
|
||
case 3:
|
||
return tn === $.RTC;
|
||
|
||
case 6:
|
||
return tn === $.OPTION;
|
||
|
||
case 8:
|
||
return tn === $.OPTGROUP;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
function isImpliedEndTagRequiredThoroughly(tn) {
|
||
switch (tn.length) {
|
||
case 1:
|
||
return tn === $.P;
|
||
|
||
case 2:
|
||
return (
|
||
tn === $.RB ||
|
||
tn === $.RP ||
|
||
tn === $.RT ||
|
||
tn === $.DD ||
|
||
tn === $.DT ||
|
||
tn === $.LI ||
|
||
tn === $.TD ||
|
||
tn === $.TH ||
|
||
tn === $.TR
|
||
);
|
||
|
||
case 3:
|
||
return tn === $.RTC;
|
||
|
||
case 5:
|
||
return tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD;
|
||
|
||
case 6:
|
||
return tn === $.OPTION;
|
||
|
||
case 7:
|
||
return tn === $.CAPTION;
|
||
|
||
case 8:
|
||
return tn === $.OPTGROUP || tn === $.COLGROUP;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
function isScopingElement(tn, ns) {
|
||
switch (tn.length) {
|
||
case 2:
|
||
if (tn === $.TD || tn === $.TH) {
|
||
return ns === NS.HTML;
|
||
} else if (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS) {
|
||
return ns === NS.MATHML;
|
||
}
|
||
|
||
break;
|
||
|
||
case 4:
|
||
if (tn === $.HTML) {
|
||
return ns === NS.HTML;
|
||
} else if (tn === $.DESC) {
|
||
return ns === NS.SVG;
|
||
}
|
||
|
||
break;
|
||
|
||
case 5:
|
||
if (tn === $.TABLE) {
|
||
return ns === NS.HTML;
|
||
} else if (tn === $.MTEXT) {
|
||
return ns === NS.MATHML;
|
||
} else if (tn === $.TITLE) {
|
||
return ns === NS.SVG;
|
||
}
|
||
|
||
break;
|
||
|
||
case 6:
|
||
return (tn === $.APPLET || tn === $.OBJECT) && ns === NS.HTML;
|
||
|
||
case 7:
|
||
return (tn === $.CAPTION || tn === $.MARQUEE) && ns === NS.HTML;
|
||
|
||
case 8:
|
||
return tn === $.TEMPLATE && ns === NS.HTML;
|
||
|
||
case 13:
|
||
return tn === $.FOREIGN_OBJECT && ns === NS.SVG;
|
||
|
||
case 14:
|
||
return tn === $.ANNOTATION_XML && ns === NS.MATHML;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
//Stack of open elements
|
||
class OpenElementStack {
|
||
constructor(document, treeAdapter) {
|
||
this.stackTop = -1;
|
||
this.items = [];
|
||
this.current = document;
|
||
this.currentTagName = null;
|
||
this.currentTmplContent = null;
|
||
this.tmplCount = 0;
|
||
this.treeAdapter = treeAdapter;
|
||
}
|
||
|
||
//Index of element
|
||
_indexOf(element) {
|
||
let idx = -1;
|
||
|
||
for (let i = this.stackTop; i >= 0; i--) {
|
||
if (this.items[i] === element) {
|
||
idx = i;
|
||
break;
|
||
}
|
||
}
|
||
return idx;
|
||
}
|
||
|
||
//Update current element
|
||
_isInTemplate() {
|
||
return this.currentTagName === $.TEMPLATE && this.treeAdapter.getNamespaceURI(this.current) === NS.HTML;
|
||
}
|
||
|
||
_updateCurrentElement() {
|
||
this.current = this.items[this.stackTop];
|
||
this.currentTagName = this.current && this.treeAdapter.getTagName(this.current);
|
||
|
||
this.currentTmplContent = this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : null;
|
||
}
|
||
|
||
//Mutations
|
||
push(element) {
|
||
this.items[++this.stackTop] = element;
|
||
this._updateCurrentElement();
|
||
|
||
if (this._isInTemplate()) {
|
||
this.tmplCount++;
|
||
}
|
||
}
|
||
|
||
pop() {
|
||
this.stackTop--;
|
||
|
||
if (this.tmplCount > 0 && this._isInTemplate()) {
|
||
this.tmplCount--;
|
||
}
|
||
|
||
this._updateCurrentElement();
|
||
}
|
||
|
||
replace(oldElement, newElement) {
|
||
const idx = this._indexOf(oldElement);
|
||
|
||
this.items[idx] = newElement;
|
||
|
||
if (idx === this.stackTop) {
|
||
this._updateCurrentElement();
|
||
}
|
||
}
|
||
|
||
insertAfter(referenceElement, newElement) {
|
||
const insertionIdx = this._indexOf(referenceElement) + 1;
|
||
|
||
this.items.splice(insertionIdx, 0, newElement);
|
||
|
||
if (insertionIdx === ++this.stackTop) {
|
||
this._updateCurrentElement();
|
||
}
|
||
}
|
||
|
||
popUntilTagNamePopped(tagName) {
|
||
while (this.stackTop > -1) {
|
||
const tn = this.currentTagName;
|
||
const ns = this.treeAdapter.getNamespaceURI(this.current);
|
||
|
||
this.pop();
|
||
|
||
if (tn === tagName && ns === NS.HTML) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
popUntilElementPopped(element) {
|
||
while (this.stackTop > -1) {
|
||
const poppedElement = this.current;
|
||
|
||
this.pop();
|
||
|
||
if (poppedElement === element) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
popUntilNumberedHeaderPopped() {
|
||
while (this.stackTop > -1) {
|
||
const tn = this.currentTagName;
|
||
const ns = this.treeAdapter.getNamespaceURI(this.current);
|
||
|
||
this.pop();
|
||
|
||
if (
|
||
tn === $.H1 ||
|
||
tn === $.H2 ||
|
||
tn === $.H3 ||
|
||
tn === $.H4 ||
|
||
tn === $.H5 ||
|
||
(tn === $.H6 && ns === NS.HTML)
|
||
) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
popUntilTableCellPopped() {
|
||
while (this.stackTop > -1) {
|
||
const tn = this.currentTagName;
|
||
const ns = this.treeAdapter.getNamespaceURI(this.current);
|
||
|
||
this.pop();
|
||
|
||
if (tn === $.TD || (tn === $.TH && ns === NS.HTML)) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
popAllUpToHtmlElement() {
|
||
//NOTE: here we assume that root <html> element is always first in the open element stack, so
|
||
//we perform this fast stack clean up.
|
||
this.stackTop = 0;
|
||
this._updateCurrentElement();
|
||
}
|
||
|
||
clearBackToTableContext() {
|
||
while (
|
||
(this.currentTagName !== $.TABLE && this.currentTagName !== $.TEMPLATE && this.currentTagName !== $.HTML) ||
|
||
this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML
|
||
) {
|
||
this.pop();
|
||
}
|
||
}
|
||
|
||
clearBackToTableBodyContext() {
|
||
while (
|
||
(this.currentTagName !== $.TBODY &&
|
||
this.currentTagName !== $.TFOOT &&
|
||
this.currentTagName !== $.THEAD &&
|
||
this.currentTagName !== $.TEMPLATE &&
|
||
this.currentTagName !== $.HTML) ||
|
||
this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML
|
||
) {
|
||
this.pop();
|
||
}
|
||
}
|
||
|
||
clearBackToTableRowContext() {
|
||
while (
|
||
(this.currentTagName !== $.TR && this.currentTagName !== $.TEMPLATE && this.currentTagName !== $.HTML) ||
|
||
this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML
|
||
) {
|
||
this.pop();
|
||
}
|
||
}
|
||
|
||
remove(element) {
|
||
for (let i = this.stackTop; i >= 0; i--) {
|
||
if (this.items[i] === element) {
|
||
this.items.splice(i, 1);
|
||
this.stackTop--;
|
||
this._updateCurrentElement();
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
//Search
|
||
tryPeekProperlyNestedBodyElement() {
|
||
//Properly nested <body> element (should be second element in stack).
|
||
const element = this.items[1];
|
||
|
||
return element && this.treeAdapter.getTagName(element) === $.BODY ? element : null;
|
||
}
|
||
|
||
contains(element) {
|
||
return this._indexOf(element) > -1;
|
||
}
|
||
|
||
getCommonAncestor(element) {
|
||
let elementIdx = this._indexOf(element);
|
||
|
||
return --elementIdx >= 0 ? this.items[elementIdx] : null;
|
||
}
|
||
|
||
isRootHtmlElementCurrent() {
|
||
return this.stackTop === 0 && this.currentTagName === $.HTML;
|
||
}
|
||
|
||
//Element in scope
|
||
hasInScope(tagName) {
|
||
for (let i = this.stackTop; i >= 0; i--) {
|
||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||
|
||
if (tn === tagName && ns === NS.HTML) {
|
||
return true;
|
||
}
|
||
|
||
if (isScopingElement(tn, ns)) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
hasNumberedHeaderInScope() {
|
||
for (let i = this.stackTop; i >= 0; i--) {
|
||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||
|
||
if (
|
||
(tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) &&
|
||
ns === NS.HTML
|
||
) {
|
||
return true;
|
||
}
|
||
|
||
if (isScopingElement(tn, ns)) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
hasInListItemScope(tagName) {
|
||
for (let i = this.stackTop; i >= 0; i--) {
|
||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||
|
||
if (tn === tagName && ns === NS.HTML) {
|
||
return true;
|
||
}
|
||
|
||
if (((tn === $.UL || tn === $.OL) && ns === NS.HTML) || isScopingElement(tn, ns)) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
hasInButtonScope(tagName) {
|
||
for (let i = this.stackTop; i >= 0; i--) {
|
||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||
|
||
if (tn === tagName && ns === NS.HTML) {
|
||
return true;
|
||
}
|
||
|
||
if ((tn === $.BUTTON && ns === NS.HTML) || isScopingElement(tn, ns)) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
hasInTableScope(tagName) {
|
||
for (let i = this.stackTop; i >= 0; i--) {
|
||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||
|
||
if (ns !== NS.HTML) {
|
||
continue;
|
||
}
|
||
|
||
if (tn === tagName) {
|
||
return true;
|
||
}
|
||
|
||
if (tn === $.TABLE || tn === $.TEMPLATE || tn === $.HTML) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
hasTableBodyContextInTableScope() {
|
||
for (let i = this.stackTop; i >= 0; i--) {
|
||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||
|
||
if (ns !== NS.HTML) {
|
||
continue;
|
||
}
|
||
|
||
if (tn === $.TBODY || tn === $.THEAD || tn === $.TFOOT) {
|
||
return true;
|
||
}
|
||
|
||
if (tn === $.TABLE || tn === $.HTML) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
hasInSelectScope(tagName) {
|
||
for (let i = this.stackTop; i >= 0; i--) {
|
||
const tn = this.treeAdapter.getTagName(this.items[i]);
|
||
const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
|
||
|
||
if (ns !== NS.HTML) {
|
||
continue;
|
||
}
|
||
|
||
if (tn === tagName) {
|
||
return true;
|
||
}
|
||
|
||
if (tn !== $.OPTION && tn !== $.OPTGROUP) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
//Implied end tags
|
||
generateImpliedEndTags() {
|
||
while (isImpliedEndTagRequired(this.currentTagName)) {
|
||
this.pop();
|
||
}
|
||
}
|
||
|
||
generateImpliedEndTagsThoroughly() {
|
||
while (isImpliedEndTagRequiredThoroughly(this.currentTagName)) {
|
||
this.pop();
|
||
}
|
||
}
|
||
|
||
generateImpliedEndTagsWithExclusion(exclusionTagName) {
|
||
while (isImpliedEndTagRequired(this.currentTagName) && this.currentTagName !== exclusionTagName) {
|
||
this.pop();
|
||
}
|
||
}
|
||
}
|
||
|
||
module.exports = OpenElementStack;
|
||
|
||
|
||
/***/ }),
|
||
/* 143 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const NS = (exports.NAMESPACES = {
|
||
HTML: 'http://www.w3.org/1999/xhtml',
|
||
MATHML: 'http://www.w3.org/1998/Math/MathML',
|
||
SVG: 'http://www.w3.org/2000/svg',
|
||
XLINK: 'http://www.w3.org/1999/xlink',
|
||
XML: 'http://www.w3.org/XML/1998/namespace',
|
||
XMLNS: 'http://www.w3.org/2000/xmlns/'
|
||
});
|
||
|
||
exports.ATTRS = {
|
||
TYPE: 'type',
|
||
ACTION: 'action',
|
||
ENCODING: 'encoding',
|
||
PROMPT: 'prompt',
|
||
NAME: 'name',
|
||
COLOR: 'color',
|
||
FACE: 'face',
|
||
SIZE: 'size'
|
||
};
|
||
|
||
exports.DOCUMENT_MODE = {
|
||
NO_QUIRKS: 'no-quirks',
|
||
QUIRKS: 'quirks',
|
||
LIMITED_QUIRKS: 'limited-quirks'
|
||
};
|
||
|
||
const $ = (exports.TAG_NAMES = {
|
||
A: 'a',
|
||
ADDRESS: 'address',
|
||
ANNOTATION_XML: 'annotation-xml',
|
||
APPLET: 'applet',
|
||
AREA: 'area',
|
||
ARTICLE: 'article',
|
||
ASIDE: 'aside',
|
||
|
||
B: 'b',
|
||
BASE: 'base',
|
||
BASEFONT: 'basefont',
|
||
BGSOUND: 'bgsound',
|
||
BIG: 'big',
|
||
BLOCKQUOTE: 'blockquote',
|
||
BODY: 'body',
|
||
BR: 'br',
|
||
BUTTON: 'button',
|
||
|
||
CAPTION: 'caption',
|
||
CENTER: 'center',
|
||
CODE: 'code',
|
||
COL: 'col',
|
||
COLGROUP: 'colgroup',
|
||
|
||
DD: 'dd',
|
||
DESC: 'desc',
|
||
DETAILS: 'details',
|
||
DIALOG: 'dialog',
|
||
DIR: 'dir',
|
||
DIV: 'div',
|
||
DL: 'dl',
|
||
DT: 'dt',
|
||
|
||
EM: 'em',
|
||
EMBED: 'embed',
|
||
|
||
FIELDSET: 'fieldset',
|
||
FIGCAPTION: 'figcaption',
|
||
FIGURE: 'figure',
|
||
FONT: 'font',
|
||
FOOTER: 'footer',
|
||
FOREIGN_OBJECT: 'foreignObject',
|
||
FORM: 'form',
|
||
FRAME: 'frame',
|
||
FRAMESET: 'frameset',
|
||
|
||
H1: 'h1',
|
||
H2: 'h2',
|
||
H3: 'h3',
|
||
H4: 'h4',
|
||
H5: 'h5',
|
||
H6: 'h6',
|
||
HEAD: 'head',
|
||
HEADER: 'header',
|
||
HGROUP: 'hgroup',
|
||
HR: 'hr',
|
||
HTML: 'html',
|
||
|
||
I: 'i',
|
||
IMG: 'img',
|
||
IMAGE: 'image',
|
||
INPUT: 'input',
|
||
IFRAME: 'iframe',
|
||
|
||
KEYGEN: 'keygen',
|
||
|
||
LABEL: 'label',
|
||
LI: 'li',
|
||
LINK: 'link',
|
||
LISTING: 'listing',
|
||
|
||
MAIN: 'main',
|
||
MALIGNMARK: 'malignmark',
|
||
MARQUEE: 'marquee',
|
||
MATH: 'math',
|
||
MENU: 'menu',
|
||
META: 'meta',
|
||
MGLYPH: 'mglyph',
|
||
MI: 'mi',
|
||
MO: 'mo',
|
||
MN: 'mn',
|
||
MS: 'ms',
|
||
MTEXT: 'mtext',
|
||
|
||
NAV: 'nav',
|
||
NOBR: 'nobr',
|
||
NOFRAMES: 'noframes',
|
||
NOEMBED: 'noembed',
|
||
NOSCRIPT: 'noscript',
|
||
|
||
OBJECT: 'object',
|
||
OL: 'ol',
|
||
OPTGROUP: 'optgroup',
|
||
OPTION: 'option',
|
||
|
||
P: 'p',
|
||
PARAM: 'param',
|
||
PLAINTEXT: 'plaintext',
|
||
PRE: 'pre',
|
||
|
||
RB: 'rb',
|
||
RP: 'rp',
|
||
RT: 'rt',
|
||
RTC: 'rtc',
|
||
RUBY: 'ruby',
|
||
|
||
S: 's',
|
||
SCRIPT: 'script',
|
||
SECTION: 'section',
|
||
SELECT: 'select',
|
||
SOURCE: 'source',
|
||
SMALL: 'small',
|
||
SPAN: 'span',
|
||
STRIKE: 'strike',
|
||
STRONG: 'strong',
|
||
STYLE: 'style',
|
||
SUB: 'sub',
|
||
SUMMARY: 'summary',
|
||
SUP: 'sup',
|
||
|
||
TABLE: 'table',
|
||
TBODY: 'tbody',
|
||
TEMPLATE: 'template',
|
||
TEXTAREA: 'textarea',
|
||
TFOOT: 'tfoot',
|
||
TD: 'td',
|
||
TH: 'th',
|
||
THEAD: 'thead',
|
||
TITLE: 'title',
|
||
TR: 'tr',
|
||
TRACK: 'track',
|
||
TT: 'tt',
|
||
|
||
U: 'u',
|
||
UL: 'ul',
|
||
|
||
SVG: 'svg',
|
||
|
||
VAR: 'var',
|
||
|
||
WBR: 'wbr',
|
||
|
||
XMP: 'xmp'
|
||
});
|
||
|
||
exports.SPECIAL_ELEMENTS = {
|
||
[NS.HTML]: {
|
||
[$.ADDRESS]: true,
|
||
[$.APPLET]: true,
|
||
[$.AREA]: true,
|
||
[$.ARTICLE]: true,
|
||
[$.ASIDE]: true,
|
||
[$.BASE]: true,
|
||
[$.BASEFONT]: true,
|
||
[$.BGSOUND]: true,
|
||
[$.BLOCKQUOTE]: true,
|
||
[$.BODY]: true,
|
||
[$.BR]: true,
|
||
[$.BUTTON]: true,
|
||
[$.CAPTION]: true,
|
||
[$.CENTER]: true,
|
||
[$.COL]: true,
|
||
[$.COLGROUP]: true,
|
||
[$.DD]: true,
|
||
[$.DETAILS]: true,
|
||
[$.DIR]: true,
|
||
[$.DIV]: true,
|
||
[$.DL]: true,
|
||
[$.DT]: true,
|
||
[$.EMBED]: true,
|
||
[$.FIELDSET]: true,
|
||
[$.FIGCAPTION]: true,
|
||
[$.FIGURE]: true,
|
||
[$.FOOTER]: true,
|
||
[$.FORM]: true,
|
||
[$.FRAME]: true,
|
||
[$.FRAMESET]: true,
|
||
[$.H1]: true,
|
||
[$.H2]: true,
|
||
[$.H3]: true,
|
||
[$.H4]: true,
|
||
[$.H5]: true,
|
||
[$.H6]: true,
|
||
[$.HEAD]: true,
|
||
[$.HEADER]: true,
|
||
[$.HGROUP]: true,
|
||
[$.HR]: true,
|
||
[$.HTML]: true,
|
||
[$.IFRAME]: true,
|
||
[$.IMG]: true,
|
||
[$.INPUT]: true,
|
||
[$.LI]: true,
|
||
[$.LINK]: true,
|
||
[$.LISTING]: true,
|
||
[$.MAIN]: true,
|
||
[$.MARQUEE]: true,
|
||
[$.MENU]: true,
|
||
[$.META]: true,
|
||
[$.NAV]: true,
|
||
[$.NOEMBED]: true,
|
||
[$.NOFRAMES]: true,
|
||
[$.NOSCRIPT]: true,
|
||
[$.OBJECT]: true,
|
||
[$.OL]: true,
|
||
[$.P]: true,
|
||
[$.PARAM]: true,
|
||
[$.PLAINTEXT]: true,
|
||
[$.PRE]: true,
|
||
[$.SCRIPT]: true,
|
||
[$.SECTION]: true,
|
||
[$.SELECT]: true,
|
||
[$.SOURCE]: true,
|
||
[$.STYLE]: true,
|
||
[$.SUMMARY]: true,
|
||
[$.TABLE]: true,
|
||
[$.TBODY]: true,
|
||
[$.TD]: true,
|
||
[$.TEMPLATE]: true,
|
||
[$.TEXTAREA]: true,
|
||
[$.TFOOT]: true,
|
||
[$.TH]: true,
|
||
[$.THEAD]: true,
|
||
[$.TITLE]: true,
|
||
[$.TR]: true,
|
||
[$.TRACK]: true,
|
||
[$.UL]: true,
|
||
[$.WBR]: true,
|
||
[$.XMP]: true
|
||
},
|
||
[NS.MATHML]: {
|
||
[$.MI]: true,
|
||
[$.MO]: true,
|
||
[$.MN]: true,
|
||
[$.MS]: true,
|
||
[$.MTEXT]: true,
|
||
[$.ANNOTATION_XML]: true
|
||
},
|
||
[NS.SVG]: {
|
||
[$.TITLE]: true,
|
||
[$.FOREIGN_OBJECT]: true,
|
||
[$.DESC]: true
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 144 */
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
//Const
|
||
const NOAH_ARK_CAPACITY = 3;
|
||
|
||
//List of formatting elements
|
||
class FormattingElementList {
|
||
constructor(treeAdapter) {
|
||
this.length = 0;
|
||
this.entries = [];
|
||
this.treeAdapter = treeAdapter;
|
||
this.bookmark = null;
|
||
}
|
||
|
||
//Noah Ark's condition
|
||
//OPTIMIZATION: at first we try to find possible candidates for exclusion using
|
||
//lightweight heuristics without thorough attributes check.
|
||
_getNoahArkConditionCandidates(newElement) {
|
||
const candidates = [];
|
||
|
||
if (this.length >= NOAH_ARK_CAPACITY) {
|
||
const neAttrsLength = this.treeAdapter.getAttrList(newElement).length;
|
||
const neTagName = this.treeAdapter.getTagName(newElement);
|
||
const neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement);
|
||
|
||
for (let i = this.length - 1; i >= 0; i--) {
|
||
const entry = this.entries[i];
|
||
|
||
if (entry.type === FormattingElementList.MARKER_ENTRY) {
|
||
break;
|
||
}
|
||
|
||
const element = entry.element;
|
||
const elementAttrs = this.treeAdapter.getAttrList(element);
|
||
|
||
const isCandidate =
|
||
this.treeAdapter.getTagName(element) === neTagName &&
|
||
this.treeAdapter.getNamespaceURI(element) === neNamespaceURI &&
|
||
elementAttrs.length === neAttrsLength;
|
||
|
||
if (isCandidate) {
|
||
candidates.push({ idx: i, attrs: elementAttrs });
|
||
}
|
||
}
|
||
}
|
||
|
||
return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates;
|
||
}
|
||
|
||
_ensureNoahArkCondition(newElement) {
|
||
const candidates = this._getNoahArkConditionCandidates(newElement);
|
||
let cLength = candidates.length;
|
||
|
||
if (cLength) {
|
||
const neAttrs = this.treeAdapter.getAttrList(newElement);
|
||
const neAttrsLength = neAttrs.length;
|
||
const neAttrsMap = Object.create(null);
|
||
|
||
//NOTE: build attrs map for the new element so we can perform fast lookups
|
||
for (let i = 0; i < neAttrsLength; i++) {
|
||
const neAttr = neAttrs[i];
|
||
|
||
neAttrsMap[neAttr.name] = neAttr.value;
|
||
}
|
||
|
||
for (let i = 0; i < neAttrsLength; i++) {
|
||
for (let j = 0; j < cLength; j++) {
|
||
const cAttr = candidates[j].attrs[i];
|
||
|
||
if (neAttrsMap[cAttr.name] !== cAttr.value) {
|
||
candidates.splice(j, 1);
|
||
cLength--;
|
||
}
|
||
|
||
if (candidates.length < NOAH_ARK_CAPACITY) {
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
//NOTE: remove bottommost candidates until Noah's Ark condition will not be met
|
||
for (let i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) {
|
||
this.entries.splice(candidates[i].idx, 1);
|
||
this.length--;
|
||
}
|
||
}
|
||
}
|
||
|
||
//Mutations
|
||
insertMarker() {
|
||
this.entries.push({ type: FormattingElementList.MARKER_ENTRY });
|
||
this.length++;
|
||
}
|
||
|
||
pushElement(element, token) {
|
||
this._ensureNoahArkCondition(element);
|
||
|
||
this.entries.push({
|
||
type: FormattingElementList.ELEMENT_ENTRY,
|
||
element: element,
|
||
token: token
|
||
});
|
||
|
||
this.length++;
|
||
}
|
||
|
||
insertElementAfterBookmark(element, token) {
|
||
let bookmarkIdx = this.length - 1;
|
||
|
||
for (; bookmarkIdx >= 0; bookmarkIdx--) {
|
||
if (this.entries[bookmarkIdx] === this.bookmark) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
this.entries.splice(bookmarkIdx + 1, 0, {
|
||
type: FormattingElementList.ELEMENT_ENTRY,
|
||
element: element,
|
||
token: token
|
||
});
|
||
|
||
this.length++;
|
||
}
|
||
|
||
removeEntry(entry) {
|
||
for (let i = this.length - 1; i >= 0; i--) {
|
||
if (this.entries[i] === entry) {
|
||
this.entries.splice(i, 1);
|
||
this.length--;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
clearToLastMarker() {
|
||
while (this.length) {
|
||
const entry = this.entries.pop();
|
||
|
||
this.length--;
|
||
|
||
if (entry.type === FormattingElementList.MARKER_ENTRY) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
//Search
|
||
getElementEntryInScopeWithTagName(tagName) {
|
||
for (let i = this.length - 1; i >= 0; i--) {
|
||
const entry = this.entries[i];
|
||
|
||
if (entry.type === FormattingElementList.MARKER_ENTRY) {
|
||
return null;
|
||
}
|
||
|
||
if (this.treeAdapter.getTagName(entry.element) === tagName) {
|
||
return entry;
|
||
}
|
||
}
|
||
|
||
return null;
|
||
}
|
||
|
||
getElementEntry(element) {
|
||
for (let i = this.length - 1; i >= 0; i--) {
|
||
const entry = this.entries[i];
|
||
|
||
if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) {
|
||
return entry;
|
||
}
|
||
}
|
||
|
||
return null;
|
||
}
|
||
}
|
||
|
||
//Entry types
|
||
FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY';
|
||
FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY';
|
||
|
||
module.exports = FormattingElementList;
|
||
|
||
|
||
/***/ }),
|
||
/* 145 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const Mixin = __webpack_require__(146);
|
||
const Tokenizer = __webpack_require__(137);
|
||
const LocationInfoTokenizerMixin = __webpack_require__(147);
|
||
const LocationInfoOpenElementStackMixin = __webpack_require__(149);
|
||
const HTML = __webpack_require__(143);
|
||
|
||
//Aliases
|
||
const $ = HTML.TAG_NAMES;
|
||
|
||
class LocationInfoParserMixin extends Mixin {
|
||
constructor(parser) {
|
||
super(parser);
|
||
|
||
this.parser = parser;
|
||
this.treeAdapter = this.parser.treeAdapter;
|
||
this.posTracker = null;
|
||
this.lastStartTagToken = null;
|
||
this.lastFosterParentingLocation = null;
|
||
this.currentToken = null;
|
||
}
|
||
|
||
_setStartLocation(element) {
|
||
let loc = null;
|
||
|
||
if (this.lastStartTagToken) {
|
||
loc = Object.assign({}, this.lastStartTagToken.location);
|
||
loc.startTag = this.lastStartTagToken.location;
|
||
}
|
||
|
||
this.treeAdapter.setNodeSourceCodeLocation(element, loc);
|
||
}
|
||
|
||
_setEndLocation(element, closingToken) {
|
||
const loc = this.treeAdapter.getNodeSourceCodeLocation(element);
|
||
|
||
if (loc) {
|
||
if (closingToken.location) {
|
||
const ctLoc = closingToken.location;
|
||
const tn = this.treeAdapter.getTagName(element);
|
||
|
||
// NOTE: For cases like <p> <p> </p> - First 'p' closes without a closing
|
||
// tag and for cases like <td> <p> </td> - 'p' closes without a closing tag.
|
||
const isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && tn === closingToken.tagName;
|
||
const endLoc = {};
|
||
if (isClosingEndTag) {
|
||
endLoc.endTag = Object.assign({}, ctLoc);
|
||
endLoc.endLine = ctLoc.endLine;
|
||
endLoc.endCol = ctLoc.endCol;
|
||
endLoc.endOffset = ctLoc.endOffset;
|
||
} else {
|
||
endLoc.endLine = ctLoc.startLine;
|
||
endLoc.endCol = ctLoc.startCol;
|
||
endLoc.endOffset = ctLoc.startOffset;
|
||
}
|
||
|
||
this.treeAdapter.updateNodeSourceCodeLocation(element, endLoc);
|
||
}
|
||
}
|
||
}
|
||
|
||
_getOverriddenMethods(mxn, orig) {
|
||
return {
|
||
_bootstrap(document, fragmentContext) {
|
||
orig._bootstrap.call(this, document, fragmentContext);
|
||
|
||
mxn.lastStartTagToken = null;
|
||
mxn.lastFosterParentingLocation = null;
|
||
mxn.currentToken = null;
|
||
|
||
const tokenizerMixin = Mixin.install(this.tokenizer, LocationInfoTokenizerMixin);
|
||
|
||
mxn.posTracker = tokenizerMixin.posTracker;
|
||
|
||
Mixin.install(this.openElements, LocationInfoOpenElementStackMixin, {
|
||
onItemPop: function(element) {
|
||
mxn._setEndLocation(element, mxn.currentToken);
|
||
}
|
||
});
|
||
},
|
||
|
||
_runParsingLoop(scriptHandler) {
|
||
orig._runParsingLoop.call(this, scriptHandler);
|
||
|
||
// NOTE: generate location info for elements
|
||
// that remains on open element stack
|
||
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
||
mxn._setEndLocation(this.openElements.items[i], mxn.currentToken);
|
||
}
|
||
},
|
||
|
||
//Token processing
|
||
_processTokenInForeignContent(token) {
|
||
mxn.currentToken = token;
|
||
orig._processTokenInForeignContent.call(this, token);
|
||
},
|
||
|
||
_processToken(token) {
|
||
mxn.currentToken = token;
|
||
orig._processToken.call(this, token);
|
||
|
||
//NOTE: <body> and <html> are never popped from the stack, so we need to updated
|
||
//their end location explicitly.
|
||
const requireExplicitUpdate =
|
||
token.type === Tokenizer.END_TAG_TOKEN &&
|
||
(token.tagName === $.HTML || (token.tagName === $.BODY && this.openElements.hasInScope($.BODY)));
|
||
|
||
if (requireExplicitUpdate) {
|
||
for (let i = this.openElements.stackTop; i >= 0; i--) {
|
||
const element = this.openElements.items[i];
|
||
|
||
if (this.treeAdapter.getTagName(element) === token.tagName) {
|
||
mxn._setEndLocation(element, token);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
//Doctype
|
||
_setDocumentType(token) {
|
||
orig._setDocumentType.call(this, token);
|
||
|
||
const documentChildren = this.treeAdapter.getChildNodes(this.document);
|
||
const cnLength = documentChildren.length;
|
||
|
||
for (let i = 0; i < cnLength; i++) {
|
||
const node = documentChildren[i];
|
||
|
||
if (this.treeAdapter.isDocumentTypeNode(node)) {
|
||
this.treeAdapter.setNodeSourceCodeLocation(node, token.location);
|
||
break;
|
||
}
|
||
}
|
||
},
|
||
|
||
//Elements
|
||
_attachElementToTree(element) {
|
||
//NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods.
|
||
//So we will use token location stored in this methods for the element.
|
||
mxn._setStartLocation(element);
|
||
mxn.lastStartTagToken = null;
|
||
orig._attachElementToTree.call(this, element);
|
||
},
|
||
|
||
_appendElement(token, namespaceURI) {
|
||
mxn.lastStartTagToken = token;
|
||
orig._appendElement.call(this, token, namespaceURI);
|
||
},
|
||
|
||
_insertElement(token, namespaceURI) {
|
||
mxn.lastStartTagToken = token;
|
||
orig._insertElement.call(this, token, namespaceURI);
|
||
},
|
||
|
||
_insertTemplate(token) {
|
||
mxn.lastStartTagToken = token;
|
||
orig._insertTemplate.call(this, token);
|
||
|
||
const tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current);
|
||
|
||
this.treeAdapter.setNodeSourceCodeLocation(tmplContent, null);
|
||
},
|
||
|
||
_insertFakeRootElement() {
|
||
orig._insertFakeRootElement.call(this);
|
||
this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current, null);
|
||
},
|
||
|
||
//Comments
|
||
_appendCommentNode(token, parent) {
|
||
orig._appendCommentNode.call(this, token, parent);
|
||
|
||
const children = this.treeAdapter.getChildNodes(parent);
|
||
const commentNode = children[children.length - 1];
|
||
|
||
this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);
|
||
},
|
||
|
||
//Text
|
||
_findFosterParentingLocation() {
|
||
//NOTE: store last foster parenting location, so we will be able to find inserted text
|
||
//in case of foster parenting
|
||
mxn.lastFosterParentingLocation = orig._findFosterParentingLocation.call(this);
|
||
|
||
return mxn.lastFosterParentingLocation;
|
||
},
|
||
|
||
_insertCharacters(token) {
|
||
orig._insertCharacters.call(this, token);
|
||
|
||
const hasFosterParent = this._shouldFosterParentOnInsertion();
|
||
|
||
const parent =
|
||
(hasFosterParent && mxn.lastFosterParentingLocation.parent) ||
|
||
this.openElements.currentTmplContent ||
|
||
this.openElements.current;
|
||
|
||
const siblings = this.treeAdapter.getChildNodes(parent);
|
||
|
||
const textNodeIdx =
|
||
hasFosterParent && mxn.lastFosterParentingLocation.beforeElement
|
||
? siblings.indexOf(mxn.lastFosterParentingLocation.beforeElement) - 1
|
||
: siblings.length - 1;
|
||
|
||
const textNode = siblings[textNodeIdx];
|
||
|
||
//NOTE: if we have location assigned by another token, then just update end position
|
||
const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode);
|
||
|
||
if (tnLoc) {
|
||
const { endLine, endCol, endOffset } = token.location;
|
||
this.treeAdapter.updateNodeSourceCodeLocation(textNode, { endLine, endCol, endOffset });
|
||
} else {
|
||
this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);
|
||
}
|
||
}
|
||
};
|
||
}
|
||
}
|
||
|
||
module.exports = LocationInfoParserMixin;
|
||
|
||
|
||
/***/ }),
|
||
/* 146 */
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
class Mixin {
|
||
constructor(host) {
|
||
const originalMethods = {};
|
||
const overriddenMethods = this._getOverriddenMethods(this, originalMethods);
|
||
|
||
for (const key of Object.keys(overriddenMethods)) {
|
||
if (typeof overriddenMethods[key] === 'function') {
|
||
originalMethods[key] = host[key];
|
||
host[key] = overriddenMethods[key];
|
||
}
|
||
}
|
||
}
|
||
|
||
_getOverriddenMethods() {
|
||
throw new Error('Not implemented');
|
||
}
|
||
}
|
||
|
||
Mixin.install = function(host, Ctor, opts) {
|
||
if (!host.__mixins) {
|
||
host.__mixins = [];
|
||
}
|
||
|
||
for (let i = 0; i < host.__mixins.length; i++) {
|
||
if (host.__mixins[i].constructor === Ctor) {
|
||
return host.__mixins[i];
|
||
}
|
||
}
|
||
|
||
const mixin = new Ctor(host, opts);
|
||
|
||
host.__mixins.push(mixin);
|
||
|
||
return mixin;
|
||
};
|
||
|
||
module.exports = Mixin;
|
||
|
||
|
||
/***/ }),
|
||
/* 147 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const Mixin = __webpack_require__(146);
|
||
const Tokenizer = __webpack_require__(137);
|
||
const PositionTrackingPreprocessorMixin = __webpack_require__(148);
|
||
|
||
class LocationInfoTokenizerMixin extends Mixin {
|
||
constructor(tokenizer) {
|
||
super(tokenizer);
|
||
|
||
this.tokenizer = tokenizer;
|
||
this.posTracker = Mixin.install(tokenizer.preprocessor, PositionTrackingPreprocessorMixin);
|
||
this.currentAttrLocation = null;
|
||
this.ctLoc = null;
|
||
}
|
||
|
||
_getCurrentLocation() {
|
||
return {
|
||
startLine: this.posTracker.line,
|
||
startCol: this.posTracker.col,
|
||
startOffset: this.posTracker.offset,
|
||
endLine: -1,
|
||
endCol: -1,
|
||
endOffset: -1
|
||
};
|
||
}
|
||
|
||
_attachCurrentAttrLocationInfo() {
|
||
this.currentAttrLocation.endLine = this.posTracker.line;
|
||
this.currentAttrLocation.endCol = this.posTracker.col;
|
||
this.currentAttrLocation.endOffset = this.posTracker.offset;
|
||
|
||
const currentToken = this.tokenizer.currentToken;
|
||
const currentAttr = this.tokenizer.currentAttr;
|
||
|
||
if (!currentToken.location.attrs) {
|
||
currentToken.location.attrs = Object.create(null);
|
||
}
|
||
|
||
currentToken.location.attrs[currentAttr.name] = this.currentAttrLocation;
|
||
}
|
||
|
||
_getOverriddenMethods(mxn, orig) {
|
||
const methods = {
|
||
_createStartTagToken() {
|
||
orig._createStartTagToken.call(this);
|
||
this.currentToken.location = mxn.ctLoc;
|
||
},
|
||
|
||
_createEndTagToken() {
|
||
orig._createEndTagToken.call(this);
|
||
this.currentToken.location = mxn.ctLoc;
|
||
},
|
||
|
||
_createCommentToken() {
|
||
orig._createCommentToken.call(this);
|
||
this.currentToken.location = mxn.ctLoc;
|
||
},
|
||
|
||
_createDoctypeToken(initialName) {
|
||
orig._createDoctypeToken.call(this, initialName);
|
||
this.currentToken.location = mxn.ctLoc;
|
||
},
|
||
|
||
_createCharacterToken(type, ch) {
|
||
orig._createCharacterToken.call(this, type, ch);
|
||
this.currentCharacterToken.location = mxn.ctLoc;
|
||
},
|
||
|
||
_createEOFToken() {
|
||
orig._createEOFToken.call(this);
|
||
this.currentToken.location = mxn._getCurrentLocation();
|
||
},
|
||
|
||
_createAttr(attrNameFirstCh) {
|
||
orig._createAttr.call(this, attrNameFirstCh);
|
||
mxn.currentAttrLocation = mxn._getCurrentLocation();
|
||
},
|
||
|
||
_leaveAttrName(toState) {
|
||
orig._leaveAttrName.call(this, toState);
|
||
mxn._attachCurrentAttrLocationInfo();
|
||
},
|
||
|
||
_leaveAttrValue(toState) {
|
||
orig._leaveAttrValue.call(this, toState);
|
||
mxn._attachCurrentAttrLocationInfo();
|
||
},
|
||
|
||
_emitCurrentToken() {
|
||
const ctLoc = this.currentToken.location;
|
||
|
||
//NOTE: if we have pending character token make it's end location equal to the
|
||
//current token's start location.
|
||
if (this.currentCharacterToken) {
|
||
this.currentCharacterToken.location.endLine = ctLoc.startLine;
|
||
this.currentCharacterToken.location.endCol = ctLoc.startCol;
|
||
this.currentCharacterToken.location.endOffset = ctLoc.startOffset;
|
||
}
|
||
|
||
if (this.currentToken.type === Tokenizer.EOF_TOKEN) {
|
||
ctLoc.endLine = ctLoc.startLine;
|
||
ctLoc.endCol = ctLoc.startCol;
|
||
ctLoc.endOffset = ctLoc.startOffset;
|
||
} else {
|
||
ctLoc.endLine = mxn.posTracker.line;
|
||
ctLoc.endCol = mxn.posTracker.col + 1;
|
||
ctLoc.endOffset = mxn.posTracker.offset + 1;
|
||
}
|
||
|
||
orig._emitCurrentToken.call(this);
|
||
},
|
||
|
||
_emitCurrentCharacterToken() {
|
||
const ctLoc = this.currentCharacterToken && this.currentCharacterToken.location;
|
||
|
||
//NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(),
|
||
//then set it's location at the current preprocessor position.
|
||
//We don't need to increment preprocessor position, since character token
|
||
//emission is always forced by the start of the next character token here.
|
||
//So, we already have advanced position.
|
||
if (ctLoc && ctLoc.endOffset === -1) {
|
||
ctLoc.endLine = mxn.posTracker.line;
|
||
ctLoc.endCol = mxn.posTracker.col;
|
||
ctLoc.endOffset = mxn.posTracker.offset;
|
||
}
|
||
|
||
orig._emitCurrentCharacterToken.call(this);
|
||
}
|
||
};
|
||
|
||
//NOTE: patch initial states for each mode to obtain token start position
|
||
Object.keys(Tokenizer.MODE).forEach(modeName => {
|
||
const state = Tokenizer.MODE[modeName];
|
||
|
||
methods[state] = function(cp) {
|
||
mxn.ctLoc = mxn._getCurrentLocation();
|
||
orig[state].call(this, cp);
|
||
};
|
||
});
|
||
|
||
return methods;
|
||
}
|
||
}
|
||
|
||
module.exports = LocationInfoTokenizerMixin;
|
||
|
||
|
||
/***/ }),
|
||
/* 148 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const Mixin = __webpack_require__(146);
|
||
|
||
class PositionTrackingPreprocessorMixin extends Mixin {
|
||
constructor(preprocessor) {
|
||
super(preprocessor);
|
||
|
||
this.preprocessor = preprocessor;
|
||
this.isEol = false;
|
||
this.lineStartPos = 0;
|
||
this.droppedBufferSize = 0;
|
||
|
||
this.offset = 0;
|
||
this.col = 0;
|
||
this.line = 1;
|
||
}
|
||
|
||
_getOverriddenMethods(mxn, orig) {
|
||
return {
|
||
advance() {
|
||
const pos = this.pos + 1;
|
||
const ch = this.html[pos];
|
||
|
||
//NOTE: LF should be in the last column of the line
|
||
if (mxn.isEol) {
|
||
mxn.isEol = false;
|
||
mxn.line++;
|
||
mxn.lineStartPos = pos;
|
||
}
|
||
|
||
if (ch === '\n' || (ch === '\r' && this.html[pos + 1] !== '\n')) {
|
||
mxn.isEol = true;
|
||
}
|
||
|
||
mxn.col = pos - mxn.lineStartPos + 1;
|
||
mxn.offset = mxn.droppedBufferSize + pos;
|
||
|
||
return orig.advance.call(this);
|
||
},
|
||
|
||
retreat() {
|
||
orig.retreat.call(this);
|
||
|
||
mxn.isEol = false;
|
||
mxn.col = this.pos - mxn.lineStartPos + 1;
|
||
},
|
||
|
||
dropParsedChunk() {
|
||
const prevPos = this.pos;
|
||
|
||
orig.dropParsedChunk.call(this);
|
||
|
||
const reduction = prevPos - this.pos;
|
||
|
||
mxn.lineStartPos -= reduction;
|
||
mxn.droppedBufferSize += reduction;
|
||
mxn.offset = mxn.droppedBufferSize + this.pos;
|
||
}
|
||
};
|
||
}
|
||
}
|
||
|
||
module.exports = PositionTrackingPreprocessorMixin;
|
||
|
||
|
||
/***/ }),
|
||
/* 149 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const Mixin = __webpack_require__(146);
|
||
|
||
class LocationInfoOpenElementStackMixin extends Mixin {
|
||
constructor(stack, opts) {
|
||
super(stack);
|
||
|
||
this.onItemPop = opts.onItemPop;
|
||
}
|
||
|
||
_getOverriddenMethods(mxn, orig) {
|
||
return {
|
||
pop() {
|
||
mxn.onItemPop(this.current);
|
||
orig.pop.call(this);
|
||
},
|
||
|
||
popAllUpToHtmlElement() {
|
||
for (let i = this.stackTop; i > 0; i--) {
|
||
mxn.onItemPop(this.items[i]);
|
||
}
|
||
|
||
orig.popAllUpToHtmlElement.call(this);
|
||
},
|
||
|
||
remove(element) {
|
||
mxn.onItemPop(this.current);
|
||
orig.remove.call(this, element);
|
||
}
|
||
};
|
||
}
|
||
}
|
||
|
||
module.exports = LocationInfoOpenElementStackMixin;
|
||
|
||
|
||
/***/ }),
|
||
/* 150 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const ErrorReportingMixinBase = __webpack_require__(151);
|
||
const ErrorReportingTokenizerMixin = __webpack_require__(152);
|
||
const LocationInfoTokenizerMixin = __webpack_require__(147);
|
||
const Mixin = __webpack_require__(146);
|
||
|
||
class ErrorReportingParserMixin extends ErrorReportingMixinBase {
|
||
constructor(parser, opts) {
|
||
super(parser, opts);
|
||
|
||
this.opts = opts;
|
||
this.ctLoc = null;
|
||
this.locBeforeToken = false;
|
||
}
|
||
|
||
_setErrorLocation(err) {
|
||
if (this.ctLoc) {
|
||
err.startLine = this.ctLoc.startLine;
|
||
err.startCol = this.ctLoc.startCol;
|
||
err.startOffset = this.ctLoc.startOffset;
|
||
|
||
err.endLine = this.locBeforeToken ? this.ctLoc.startLine : this.ctLoc.endLine;
|
||
err.endCol = this.locBeforeToken ? this.ctLoc.startCol : this.ctLoc.endCol;
|
||
err.endOffset = this.locBeforeToken ? this.ctLoc.startOffset : this.ctLoc.endOffset;
|
||
}
|
||
}
|
||
|
||
_getOverriddenMethods(mxn, orig) {
|
||
return {
|
||
_bootstrap(document, fragmentContext) {
|
||
orig._bootstrap.call(this, document, fragmentContext);
|
||
|
||
Mixin.install(this.tokenizer, ErrorReportingTokenizerMixin, mxn.opts);
|
||
Mixin.install(this.tokenizer, LocationInfoTokenizerMixin);
|
||
},
|
||
|
||
_processInputToken(token) {
|
||
mxn.ctLoc = token.location;
|
||
|
||
orig._processInputToken.call(this, token);
|
||
},
|
||
|
||
_err(code, options) {
|
||
mxn.locBeforeToken = options && options.beforeToken;
|
||
mxn._reportError(code);
|
||
}
|
||
};
|
||
}
|
||
}
|
||
|
||
module.exports = ErrorReportingParserMixin;
|
||
|
||
|
||
/***/ }),
|
||
/* 151 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const Mixin = __webpack_require__(146);
|
||
|
||
class ErrorReportingMixinBase extends Mixin {
|
||
constructor(host, opts) {
|
||
super(host);
|
||
|
||
this.posTracker = null;
|
||
this.onParseError = opts.onParseError;
|
||
}
|
||
|
||
_setErrorLocation(err) {
|
||
err.startLine = err.endLine = this.posTracker.line;
|
||
err.startCol = err.endCol = this.posTracker.col;
|
||
err.startOffset = err.endOffset = this.posTracker.offset;
|
||
}
|
||
|
||
_reportError(code) {
|
||
const err = {
|
||
code: code,
|
||
startLine: -1,
|
||
startCol: -1,
|
||
startOffset: -1,
|
||
endLine: -1,
|
||
endCol: -1,
|
||
endOffset: -1
|
||
};
|
||
|
||
this._setErrorLocation(err);
|
||
this.onParseError(err);
|
||
}
|
||
|
||
_getOverriddenMethods(mxn) {
|
||
return {
|
||
_err(code) {
|
||
mxn._reportError(code);
|
||
}
|
||
};
|
||
}
|
||
}
|
||
|
||
module.exports = ErrorReportingMixinBase;
|
||
|
||
|
||
/***/ }),
|
||
/* 152 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const ErrorReportingMixinBase = __webpack_require__(151);
|
||
const ErrorReportingPreprocessorMixin = __webpack_require__(153);
|
||
const Mixin = __webpack_require__(146);
|
||
|
||
class ErrorReportingTokenizerMixin extends ErrorReportingMixinBase {
|
||
constructor(tokenizer, opts) {
|
||
super(tokenizer, opts);
|
||
|
||
const preprocessorMixin = Mixin.install(tokenizer.preprocessor, ErrorReportingPreprocessorMixin, opts);
|
||
|
||
this.posTracker = preprocessorMixin.posTracker;
|
||
}
|
||
}
|
||
|
||
module.exports = ErrorReportingTokenizerMixin;
|
||
|
||
|
||
/***/ }),
|
||
/* 153 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const ErrorReportingMixinBase = __webpack_require__(151);
|
||
const PositionTrackingPreprocessorMixin = __webpack_require__(148);
|
||
const Mixin = __webpack_require__(146);
|
||
|
||
class ErrorReportingPreprocessorMixin extends ErrorReportingMixinBase {
|
||
constructor(preprocessor, opts) {
|
||
super(preprocessor, opts);
|
||
|
||
this.posTracker = Mixin.install(preprocessor, PositionTrackingPreprocessorMixin);
|
||
this.lastErrOffset = -1;
|
||
}
|
||
|
||
_reportError(code) {
|
||
//NOTE: avoid reporting error twice on advance/retreat
|
||
if (this.lastErrOffset !== this.posTracker.offset) {
|
||
this.lastErrOffset = this.posTracker.offset;
|
||
super._reportError(code);
|
||
}
|
||
}
|
||
}
|
||
|
||
module.exports = ErrorReportingPreprocessorMixin;
|
||
|
||
|
||
/***/ }),
|
||
/* 154 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const { DOCUMENT_MODE } = __webpack_require__(143);
|
||
|
||
//Node construction
|
||
exports.createDocument = function() {
|
||
return {
|
||
nodeName: '#document',
|
||
mode: DOCUMENT_MODE.NO_QUIRKS,
|
||
childNodes: []
|
||
};
|
||
};
|
||
|
||
exports.createDocumentFragment = function() {
|
||
return {
|
||
nodeName: '#document-fragment',
|
||
childNodes: []
|
||
};
|
||
};
|
||
|
||
exports.createElement = function(tagName, namespaceURI, attrs) {
|
||
return {
|
||
nodeName: tagName,
|
||
tagName: tagName,
|
||
attrs: attrs,
|
||
namespaceURI: namespaceURI,
|
||
childNodes: [],
|
||
parentNode: null
|
||
};
|
||
};
|
||
|
||
exports.createCommentNode = function(data) {
|
||
return {
|
||
nodeName: '#comment',
|
||
data: data,
|
||
parentNode: null
|
||
};
|
||
};
|
||
|
||
const createTextNode = function(value) {
|
||
return {
|
||
nodeName: '#text',
|
||
value: value,
|
||
parentNode: null
|
||
};
|
||
};
|
||
|
||
//Tree mutation
|
||
const appendChild = (exports.appendChild = function(parentNode, newNode) {
|
||
parentNode.childNodes.push(newNode);
|
||
newNode.parentNode = parentNode;
|
||
});
|
||
|
||
const insertBefore = (exports.insertBefore = function(parentNode, newNode, referenceNode) {
|
||
const insertionIdx = parentNode.childNodes.indexOf(referenceNode);
|
||
|
||
parentNode.childNodes.splice(insertionIdx, 0, newNode);
|
||
newNode.parentNode = parentNode;
|
||
});
|
||
|
||
exports.setTemplateContent = function(templateElement, contentElement) {
|
||
templateElement.content = contentElement;
|
||
};
|
||
|
||
exports.getTemplateContent = function(templateElement) {
|
||
return templateElement.content;
|
||
};
|
||
|
||
exports.setDocumentType = function(document, name, publicId, systemId) {
|
||
let doctypeNode = null;
|
||
|
||
for (let i = 0; i < document.childNodes.length; i++) {
|
||
if (document.childNodes[i].nodeName === '#documentType') {
|
||
doctypeNode = document.childNodes[i];
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (doctypeNode) {
|
||
doctypeNode.name = name;
|
||
doctypeNode.publicId = publicId;
|
||
doctypeNode.systemId = systemId;
|
||
} else {
|
||
appendChild(document, {
|
||
nodeName: '#documentType',
|
||
name: name,
|
||
publicId: publicId,
|
||
systemId: systemId
|
||
});
|
||
}
|
||
};
|
||
|
||
exports.setDocumentMode = function(document, mode) {
|
||
document.mode = mode;
|
||
};
|
||
|
||
exports.getDocumentMode = function(document) {
|
||
return document.mode;
|
||
};
|
||
|
||
exports.detachNode = function(node) {
|
||
if (node.parentNode) {
|
||
const idx = node.parentNode.childNodes.indexOf(node);
|
||
|
||
node.parentNode.childNodes.splice(idx, 1);
|
||
node.parentNode = null;
|
||
}
|
||
};
|
||
|
||
exports.insertText = function(parentNode, text) {
|
||
if (parentNode.childNodes.length) {
|
||
const prevNode = parentNode.childNodes[parentNode.childNodes.length - 1];
|
||
|
||
if (prevNode.nodeName === '#text') {
|
||
prevNode.value += text;
|
||
return;
|
||
}
|
||
}
|
||
|
||
appendChild(parentNode, createTextNode(text));
|
||
};
|
||
|
||
exports.insertTextBefore = function(parentNode, text, referenceNode) {
|
||
const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
|
||
|
||
if (prevNode && prevNode.nodeName === '#text') {
|
||
prevNode.value += text;
|
||
} else {
|
||
insertBefore(parentNode, createTextNode(text), referenceNode);
|
||
}
|
||
};
|
||
|
||
exports.adoptAttributes = function(recipient, attrs) {
|
||
const recipientAttrsMap = [];
|
||
|
||
for (let i = 0; i < recipient.attrs.length; i++) {
|
||
recipientAttrsMap.push(recipient.attrs[i].name);
|
||
}
|
||
|
||
for (let j = 0; j < attrs.length; j++) {
|
||
if (recipientAttrsMap.indexOf(attrs[j].name) === -1) {
|
||
recipient.attrs.push(attrs[j]);
|
||
}
|
||
}
|
||
};
|
||
|
||
//Tree traversing
|
||
exports.getFirstChild = function(node) {
|
||
return node.childNodes[0];
|
||
};
|
||
|
||
exports.getChildNodes = function(node) {
|
||
return node.childNodes;
|
||
};
|
||
|
||
exports.getParentNode = function(node) {
|
||
return node.parentNode;
|
||
};
|
||
|
||
exports.getAttrList = function(element) {
|
||
return element.attrs;
|
||
};
|
||
|
||
//Node data
|
||
exports.getTagName = function(element) {
|
||
return element.tagName;
|
||
};
|
||
|
||
exports.getNamespaceURI = function(element) {
|
||
return element.namespaceURI;
|
||
};
|
||
|
||
exports.getTextNodeContent = function(textNode) {
|
||
return textNode.value;
|
||
};
|
||
|
||
exports.getCommentNodeContent = function(commentNode) {
|
||
return commentNode.data;
|
||
};
|
||
|
||
exports.getDocumentTypeNodeName = function(doctypeNode) {
|
||
return doctypeNode.name;
|
||
};
|
||
|
||
exports.getDocumentTypeNodePublicId = function(doctypeNode) {
|
||
return doctypeNode.publicId;
|
||
};
|
||
|
||
exports.getDocumentTypeNodeSystemId = function(doctypeNode) {
|
||
return doctypeNode.systemId;
|
||
};
|
||
|
||
//Node types
|
||
exports.isTextNode = function(node) {
|
||
return node.nodeName === '#text';
|
||
};
|
||
|
||
exports.isCommentNode = function(node) {
|
||
return node.nodeName === '#comment';
|
||
};
|
||
|
||
exports.isDocumentTypeNode = function(node) {
|
||
return node.nodeName === '#documentType';
|
||
};
|
||
|
||
exports.isElementNode = function(node) {
|
||
return !!node.tagName;
|
||
};
|
||
|
||
// Source code location
|
||
exports.setNodeSourceCodeLocation = function(node, location) {
|
||
node.sourceCodeLocation = location;
|
||
};
|
||
|
||
exports.getNodeSourceCodeLocation = function(node) {
|
||
return node.sourceCodeLocation;
|
||
};
|
||
|
||
exports.updateNodeSourceCodeLocation = function(node, endLocation) {
|
||
node.sourceCodeLocation = Object.assign(node.sourceCodeLocation, endLocation);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 155 */
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
module.exports = function mergeOptions(defaults, options) {
|
||
options = options || Object.create(null);
|
||
|
||
return [defaults, options].reduce((merged, optObj) => {
|
||
Object.keys(optObj).forEach(key => {
|
||
merged[key] = optObj[key];
|
||
});
|
||
|
||
return merged;
|
||
}, Object.create(null));
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 156 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const { DOCUMENT_MODE } = __webpack_require__(143);
|
||
|
||
//Const
|
||
const VALID_DOCTYPE_NAME = 'html';
|
||
const VALID_SYSTEM_ID = 'about:legacy-compat';
|
||
const QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd';
|
||
|
||
const QUIRKS_MODE_PUBLIC_ID_PREFIXES = [
|
||
'+//silmaril//dtd html pro v0r11 19970101//',
|
||
'-//as//dtd html 3.0 aswedit + extensions//',
|
||
'-//advasoft ltd//dtd html 3.0 aswedit + extensions//',
|
||
'-//ietf//dtd html 2.0 level 1//',
|
||
'-//ietf//dtd html 2.0 level 2//',
|
||
'-//ietf//dtd html 2.0 strict level 1//',
|
||
'-//ietf//dtd html 2.0 strict level 2//',
|
||
'-//ietf//dtd html 2.0 strict//',
|
||
'-//ietf//dtd html 2.0//',
|
||
'-//ietf//dtd html 2.1e//',
|
||
'-//ietf//dtd html 3.0//',
|
||
'-//ietf//dtd html 3.2 final//',
|
||
'-//ietf//dtd html 3.2//',
|
||
'-//ietf//dtd html 3//',
|
||
'-//ietf//dtd html level 0//',
|
||
'-//ietf//dtd html level 1//',
|
||
'-//ietf//dtd html level 2//',
|
||
'-//ietf//dtd html level 3//',
|
||
'-//ietf//dtd html strict level 0//',
|
||
'-//ietf//dtd html strict level 1//',
|
||
'-//ietf//dtd html strict level 2//',
|
||
'-//ietf//dtd html strict level 3//',
|
||
'-//ietf//dtd html strict//',
|
||
'-//ietf//dtd html//',
|
||
'-//metrius//dtd metrius presentational//',
|
||
'-//microsoft//dtd internet explorer 2.0 html strict//',
|
||
'-//microsoft//dtd internet explorer 2.0 html//',
|
||
'-//microsoft//dtd internet explorer 2.0 tables//',
|
||
'-//microsoft//dtd internet explorer 3.0 html strict//',
|
||
'-//microsoft//dtd internet explorer 3.0 html//',
|
||
'-//microsoft//dtd internet explorer 3.0 tables//',
|
||
'-//netscape comm. corp.//dtd html//',
|
||
'-//netscape comm. corp.//dtd strict html//',
|
||
"-//o'reilly and associates//dtd html 2.0//",
|
||
"-//o'reilly and associates//dtd html extended 1.0//",
|
||
"-//o'reilly and associates//dtd html extended relaxed 1.0//",
|
||
'-//sq//dtd html 2.0 hotmetal + extensions//',
|
||
'-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//',
|
||
'-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//',
|
||
'-//spyglass//dtd html 2.0 extended//',
|
||
'-//sun microsystems corp.//dtd hotjava html//',
|
||
'-//sun microsystems corp.//dtd hotjava strict html//',
|
||
'-//w3c//dtd html 3 1995-03-24//',
|
||
'-//w3c//dtd html 3.2 draft//',
|
||
'-//w3c//dtd html 3.2 final//',
|
||
'-//w3c//dtd html 3.2//',
|
||
'-//w3c//dtd html 3.2s draft//',
|
||
'-//w3c//dtd html 4.0 frameset//',
|
||
'-//w3c//dtd html 4.0 transitional//',
|
||
'-//w3c//dtd html experimental 19960712//',
|
||
'-//w3c//dtd html experimental 970421//',
|
||
'-//w3c//dtd w3 html//',
|
||
'-//w3o//dtd w3 html 3.0//',
|
||
'-//webtechs//dtd mozilla html 2.0//',
|
||
'-//webtechs//dtd mozilla html//'
|
||
];
|
||
|
||
const QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = QUIRKS_MODE_PUBLIC_ID_PREFIXES.concat([
|
||
'-//w3c//dtd html 4.01 frameset//',
|
||
'-//w3c//dtd html 4.01 transitional//'
|
||
]);
|
||
|
||
const QUIRKS_MODE_PUBLIC_IDS = ['-//w3o//dtd w3 html strict 3.0//en//', '-/w3c/dtd html 4.0 transitional/en', 'html'];
|
||
const LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ['-//w3c//dtd xhtml 1.0 frameset//', '-//w3c//dtd xhtml 1.0 transitional//'];
|
||
|
||
const LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = LIMITED_QUIRKS_PUBLIC_ID_PREFIXES.concat([
|
||
'-//w3c//dtd html 4.01 frameset//',
|
||
'-//w3c//dtd html 4.01 transitional//'
|
||
]);
|
||
|
||
//Utils
|
||
function enquoteDoctypeId(id) {
|
||
const quote = id.indexOf('"') !== -1 ? "'" : '"';
|
||
|
||
return quote + id + quote;
|
||
}
|
||
|
||
function hasPrefix(publicId, prefixes) {
|
||
for (let i = 0; i < prefixes.length; i++) {
|
||
if (publicId.indexOf(prefixes[i]) === 0) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
//API
|
||
exports.isConforming = function(token) {
|
||
return (
|
||
token.name === VALID_DOCTYPE_NAME &&
|
||
token.publicId === null &&
|
||
(token.systemId === null || token.systemId === VALID_SYSTEM_ID)
|
||
);
|
||
};
|
||
|
||
exports.getDocumentMode = function(token) {
|
||
if (token.name !== VALID_DOCTYPE_NAME) {
|
||
return DOCUMENT_MODE.QUIRKS;
|
||
}
|
||
|
||
const systemId = token.systemId;
|
||
|
||
if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) {
|
||
return DOCUMENT_MODE.QUIRKS;
|
||
}
|
||
|
||
let publicId = token.publicId;
|
||
|
||
if (publicId !== null) {
|
||
publicId = publicId.toLowerCase();
|
||
|
||
if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) {
|
||
return DOCUMENT_MODE.QUIRKS;
|
||
}
|
||
|
||
let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES;
|
||
|
||
if (hasPrefix(publicId, prefixes)) {
|
||
return DOCUMENT_MODE.QUIRKS;
|
||
}
|
||
|
||
prefixes =
|
||
systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES;
|
||
|
||
if (hasPrefix(publicId, prefixes)) {
|
||
return DOCUMENT_MODE.LIMITED_QUIRKS;
|
||
}
|
||
}
|
||
|
||
return DOCUMENT_MODE.NO_QUIRKS;
|
||
};
|
||
|
||
exports.serializeContent = function(name, publicId, systemId) {
|
||
let str = '!DOCTYPE ';
|
||
|
||
if (name) {
|
||
str += name;
|
||
}
|
||
|
||
if (publicId) {
|
||
str += ' PUBLIC ' + enquoteDoctypeId(publicId);
|
||
} else if (systemId) {
|
||
str += ' SYSTEM';
|
||
}
|
||
|
||
if (systemId !== null) {
|
||
str += ' ' + enquoteDoctypeId(systemId);
|
||
}
|
||
|
||
return str;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 157 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const Tokenizer = __webpack_require__(137);
|
||
const HTML = __webpack_require__(143);
|
||
|
||
//Aliases
|
||
const $ = HTML.TAG_NAMES;
|
||
const NS = HTML.NAMESPACES;
|
||
const ATTRS = HTML.ATTRS;
|
||
|
||
//MIME types
|
||
const MIME_TYPES = {
|
||
TEXT_HTML: 'text/html',
|
||
APPLICATION_XML: 'application/xhtml+xml'
|
||
};
|
||
|
||
//Attributes
|
||
const DEFINITION_URL_ATTR = 'definitionurl';
|
||
const ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL';
|
||
const SVG_ATTRS_ADJUSTMENT_MAP = {
|
||
attributename: 'attributeName',
|
||
attributetype: 'attributeType',
|
||
basefrequency: 'baseFrequency',
|
||
baseprofile: 'baseProfile',
|
||
calcmode: 'calcMode',
|
||
clippathunits: 'clipPathUnits',
|
||
diffuseconstant: 'diffuseConstant',
|
||
edgemode: 'edgeMode',
|
||
filterunits: 'filterUnits',
|
||
glyphref: 'glyphRef',
|
||
gradienttransform: 'gradientTransform',
|
||
gradientunits: 'gradientUnits',
|
||
kernelmatrix: 'kernelMatrix',
|
||
kernelunitlength: 'kernelUnitLength',
|
||
keypoints: 'keyPoints',
|
||
keysplines: 'keySplines',
|
||
keytimes: 'keyTimes',
|
||
lengthadjust: 'lengthAdjust',
|
||
limitingconeangle: 'limitingConeAngle',
|
||
markerheight: 'markerHeight',
|
||
markerunits: 'markerUnits',
|
||
markerwidth: 'markerWidth',
|
||
maskcontentunits: 'maskContentUnits',
|
||
maskunits: 'maskUnits',
|
||
numoctaves: 'numOctaves',
|
||
pathlength: 'pathLength',
|
||
patterncontentunits: 'patternContentUnits',
|
||
patterntransform: 'patternTransform',
|
||
patternunits: 'patternUnits',
|
||
pointsatx: 'pointsAtX',
|
||
pointsaty: 'pointsAtY',
|
||
pointsatz: 'pointsAtZ',
|
||
preservealpha: 'preserveAlpha',
|
||
preserveaspectratio: 'preserveAspectRatio',
|
||
primitiveunits: 'primitiveUnits',
|
||
refx: 'refX',
|
||
refy: 'refY',
|
||
repeatcount: 'repeatCount',
|
||
repeatdur: 'repeatDur',
|
||
requiredextensions: 'requiredExtensions',
|
||
requiredfeatures: 'requiredFeatures',
|
||
specularconstant: 'specularConstant',
|
||
specularexponent: 'specularExponent',
|
||
spreadmethod: 'spreadMethod',
|
||
startoffset: 'startOffset',
|
||
stddeviation: 'stdDeviation',
|
||
stitchtiles: 'stitchTiles',
|
||
surfacescale: 'surfaceScale',
|
||
systemlanguage: 'systemLanguage',
|
||
tablevalues: 'tableValues',
|
||
targetx: 'targetX',
|
||
targety: 'targetY',
|
||
textlength: 'textLength',
|
||
viewbox: 'viewBox',
|
||
viewtarget: 'viewTarget',
|
||
xchannelselector: 'xChannelSelector',
|
||
ychannelselector: 'yChannelSelector',
|
||
zoomandpan: 'zoomAndPan'
|
||
};
|
||
|
||
const XML_ATTRS_ADJUSTMENT_MAP = {
|
||
'xlink:actuate': { prefix: 'xlink', name: 'actuate', namespace: NS.XLINK },
|
||
'xlink:arcrole': { prefix: 'xlink', name: 'arcrole', namespace: NS.XLINK },
|
||
'xlink:href': { prefix: 'xlink', name: 'href', namespace: NS.XLINK },
|
||
'xlink:role': { prefix: 'xlink', name: 'role', namespace: NS.XLINK },
|
||
'xlink:show': { prefix: 'xlink', name: 'show', namespace: NS.XLINK },
|
||
'xlink:title': { prefix: 'xlink', name: 'title', namespace: NS.XLINK },
|
||
'xlink:type': { prefix: 'xlink', name: 'type', namespace: NS.XLINK },
|
||
'xml:base': { prefix: 'xml', name: 'base', namespace: NS.XML },
|
||
'xml:lang': { prefix: 'xml', name: 'lang', namespace: NS.XML },
|
||
'xml:space': { prefix: 'xml', name: 'space', namespace: NS.XML },
|
||
xmlns: { prefix: '', name: 'xmlns', namespace: NS.XMLNS },
|
||
'xmlns:xlink': { prefix: 'xmlns', name: 'xlink', namespace: NS.XMLNS }
|
||
};
|
||
|
||
//SVG tag names adjustment map
|
||
const SVG_TAG_NAMES_ADJUSTMENT_MAP = (exports.SVG_TAG_NAMES_ADJUSTMENT_MAP = {
|
||
altglyph: 'altGlyph',
|
||
altglyphdef: 'altGlyphDef',
|
||
altglyphitem: 'altGlyphItem',
|
||
animatecolor: 'animateColor',
|
||
animatemotion: 'animateMotion',
|
||
animatetransform: 'animateTransform',
|
||
clippath: 'clipPath',
|
||
feblend: 'feBlend',
|
||
fecolormatrix: 'feColorMatrix',
|
||
fecomponenttransfer: 'feComponentTransfer',
|
||
fecomposite: 'feComposite',
|
||
feconvolvematrix: 'feConvolveMatrix',
|
||
fediffuselighting: 'feDiffuseLighting',
|
||
fedisplacementmap: 'feDisplacementMap',
|
||
fedistantlight: 'feDistantLight',
|
||
feflood: 'feFlood',
|
||
fefunca: 'feFuncA',
|
||
fefuncb: 'feFuncB',
|
||
fefuncg: 'feFuncG',
|
||
fefuncr: 'feFuncR',
|
||
fegaussianblur: 'feGaussianBlur',
|
||
feimage: 'feImage',
|
||
femerge: 'feMerge',
|
||
femergenode: 'feMergeNode',
|
||
femorphology: 'feMorphology',
|
||
feoffset: 'feOffset',
|
||
fepointlight: 'fePointLight',
|
||
fespecularlighting: 'feSpecularLighting',
|
||
fespotlight: 'feSpotLight',
|
||
fetile: 'feTile',
|
||
feturbulence: 'feTurbulence',
|
||
foreignobject: 'foreignObject',
|
||
glyphref: 'glyphRef',
|
||
lineargradient: 'linearGradient',
|
||
radialgradient: 'radialGradient',
|
||
textpath: 'textPath'
|
||
});
|
||
|
||
//Tags that causes exit from foreign content
|
||
const EXITS_FOREIGN_CONTENT = {
|
||
[$.B]: true,
|
||
[$.BIG]: true,
|
||
[$.BLOCKQUOTE]: true,
|
||
[$.BODY]: true,
|
||
[$.BR]: true,
|
||
[$.CENTER]: true,
|
||
[$.CODE]: true,
|
||
[$.DD]: true,
|
||
[$.DIV]: true,
|
||
[$.DL]: true,
|
||
[$.DT]: true,
|
||
[$.EM]: true,
|
||
[$.EMBED]: true,
|
||
[$.H1]: true,
|
||
[$.H2]: true,
|
||
[$.H3]: true,
|
||
[$.H4]: true,
|
||
[$.H5]: true,
|
||
[$.H6]: true,
|
||
[$.HEAD]: true,
|
||
[$.HR]: true,
|
||
[$.I]: true,
|
||
[$.IMG]: true,
|
||
[$.LI]: true,
|
||
[$.LISTING]: true,
|
||
[$.MENU]: true,
|
||
[$.META]: true,
|
||
[$.NOBR]: true,
|
||
[$.OL]: true,
|
||
[$.P]: true,
|
||
[$.PRE]: true,
|
||
[$.RUBY]: true,
|
||
[$.S]: true,
|
||
[$.SMALL]: true,
|
||
[$.SPAN]: true,
|
||
[$.STRONG]: true,
|
||
[$.STRIKE]: true,
|
||
[$.SUB]: true,
|
||
[$.SUP]: true,
|
||
[$.TABLE]: true,
|
||
[$.TT]: true,
|
||
[$.U]: true,
|
||
[$.UL]: true,
|
||
[$.VAR]: true
|
||
};
|
||
|
||
//Check exit from foreign content
|
||
exports.causesExit = function(startTagToken) {
|
||
const tn = startTagToken.tagName;
|
||
const isFontWithAttrs =
|
||
tn === $.FONT &&
|
||
(Tokenizer.getTokenAttr(startTagToken, ATTRS.COLOR) !== null ||
|
||
Tokenizer.getTokenAttr(startTagToken, ATTRS.SIZE) !== null ||
|
||
Tokenizer.getTokenAttr(startTagToken, ATTRS.FACE) !== null);
|
||
|
||
return isFontWithAttrs ? true : EXITS_FOREIGN_CONTENT[tn];
|
||
};
|
||
|
||
//Token adjustments
|
||
exports.adjustTokenMathMLAttrs = function(token) {
|
||
for (let i = 0; i < token.attrs.length; i++) {
|
||
if (token.attrs[i].name === DEFINITION_URL_ATTR) {
|
||
token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR;
|
||
break;
|
||
}
|
||
}
|
||
};
|
||
|
||
exports.adjustTokenSVGAttrs = function(token) {
|
||
for (let i = 0; i < token.attrs.length; i++) {
|
||
const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name];
|
||
|
||
if (adjustedAttrName) {
|
||
token.attrs[i].name = adjustedAttrName;
|
||
}
|
||
}
|
||
};
|
||
|
||
exports.adjustTokenXMLAttrs = function(token) {
|
||
for (let i = 0; i < token.attrs.length; i++) {
|
||
const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name];
|
||
|
||
if (adjustedAttrEntry) {
|
||
token.attrs[i].prefix = adjustedAttrEntry.prefix;
|
||
token.attrs[i].name = adjustedAttrEntry.name;
|
||
token.attrs[i].namespace = adjustedAttrEntry.namespace;
|
||
}
|
||
}
|
||
};
|
||
|
||
exports.adjustTokenSVGTagName = function(token) {
|
||
const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP[token.tagName];
|
||
|
||
if (adjustedTagName) {
|
||
token.tagName = adjustedTagName;
|
||
}
|
||
};
|
||
|
||
//Integration points
|
||
function isMathMLTextIntegrationPoint(tn, ns) {
|
||
return ns === NS.MATHML && (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS || tn === $.MTEXT);
|
||
}
|
||
|
||
function isHtmlIntegrationPoint(tn, ns, attrs) {
|
||
if (ns === NS.MATHML && tn === $.ANNOTATION_XML) {
|
||
for (let i = 0; i < attrs.length; i++) {
|
||
if (attrs[i].name === ATTRS.ENCODING) {
|
||
const value = attrs[i].value.toLowerCase();
|
||
|
||
return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML;
|
||
}
|
||
}
|
||
}
|
||
|
||
return ns === NS.SVG && (tn === $.FOREIGN_OBJECT || tn === $.DESC || tn === $.TITLE);
|
||
}
|
||
|
||
exports.isIntegrationPoint = function(tn, ns, attrs, foreignNS) {
|
||
if ((!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs)) {
|
||
return true;
|
||
}
|
||
|
||
if ((!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns)) {
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 158 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
const defaultTreeAdapter = __webpack_require__(154);
|
||
const mergeOptions = __webpack_require__(155);
|
||
const doctype = __webpack_require__(156);
|
||
const HTML = __webpack_require__(143);
|
||
|
||
//Aliases
|
||
const $ = HTML.TAG_NAMES;
|
||
const NS = HTML.NAMESPACES;
|
||
|
||
//Default serializer options
|
||
const DEFAULT_OPTIONS = {
|
||
treeAdapter: defaultTreeAdapter
|
||
};
|
||
|
||
//Escaping regexes
|
||
const AMP_REGEX = /&/g;
|
||
const NBSP_REGEX = /\u00a0/g;
|
||
const DOUBLE_QUOTE_REGEX = /"/g;
|
||
const LT_REGEX = /</g;
|
||
const GT_REGEX = />/g;
|
||
|
||
//Serializer
|
||
class Serializer {
|
||
constructor(node, options) {
|
||
this.options = mergeOptions(DEFAULT_OPTIONS, options);
|
||
this.treeAdapter = this.options.treeAdapter;
|
||
|
||
this.html = '';
|
||
this.startNode = node;
|
||
}
|
||
|
||
//API
|
||
serialize() {
|
||
this._serializeChildNodes(this.startNode);
|
||
|
||
return this.html;
|
||
}
|
||
|
||
//Internals
|
||
_serializeChildNodes(parentNode) {
|
||
const childNodes = this.treeAdapter.getChildNodes(parentNode);
|
||
|
||
if (childNodes) {
|
||
for (let i = 0, cnLength = childNodes.length; i < cnLength; i++) {
|
||
const currentNode = childNodes[i];
|
||
|
||
if (this.treeAdapter.isElementNode(currentNode)) {
|
||
this._serializeElement(currentNode);
|
||
} else if (this.treeAdapter.isTextNode(currentNode)) {
|
||
this._serializeTextNode(currentNode);
|
||
} else if (this.treeAdapter.isCommentNode(currentNode)) {
|
||
this._serializeCommentNode(currentNode);
|
||
} else if (this.treeAdapter.isDocumentTypeNode(currentNode)) {
|
||
this._serializeDocumentTypeNode(currentNode);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
_serializeElement(node) {
|
||
const tn = this.treeAdapter.getTagName(node);
|
||
const ns = this.treeAdapter.getNamespaceURI(node);
|
||
|
||
this.html += '<' + tn;
|
||
this._serializeAttributes(node);
|
||
this.html += '>';
|
||
|
||
if (
|
||
tn !== $.AREA &&
|
||
tn !== $.BASE &&
|
||
tn !== $.BASEFONT &&
|
||
tn !== $.BGSOUND &&
|
||
tn !== $.BR &&
|
||
tn !== $.COL &&
|
||
tn !== $.EMBED &&
|
||
tn !== $.FRAME &&
|
||
tn !== $.HR &&
|
||
tn !== $.IMG &&
|
||
tn !== $.INPUT &&
|
||
tn !== $.KEYGEN &&
|
||
tn !== $.LINK &&
|
||
tn !== $.META &&
|
||
tn !== $.PARAM &&
|
||
tn !== $.SOURCE &&
|
||
tn !== $.TRACK &&
|
||
tn !== $.WBR
|
||
) {
|
||
const childNodesHolder =
|
||
tn === $.TEMPLATE && ns === NS.HTML ? this.treeAdapter.getTemplateContent(node) : node;
|
||
|
||
this._serializeChildNodes(childNodesHolder);
|
||
this.html += '</' + tn + '>';
|
||
}
|
||
}
|
||
|
||
_serializeAttributes(node) {
|
||
const attrs = this.treeAdapter.getAttrList(node);
|
||
|
||
for (let i = 0, attrsLength = attrs.length; i < attrsLength; i++) {
|
||
const attr = attrs[i];
|
||
const value = Serializer.escapeString(attr.value, true);
|
||
|
||
this.html += ' ';
|
||
|
||
if (!attr.namespace) {
|
||
this.html += attr.name;
|
||
} else if (attr.namespace === NS.XML) {
|
||
this.html += 'xml:' + attr.name;
|
||
} else if (attr.namespace === NS.XMLNS) {
|
||
if (attr.name !== 'xmlns') {
|
||
this.html += 'xmlns:';
|
||
}
|
||
|
||
this.html += attr.name;
|
||
} else if (attr.namespace === NS.XLINK) {
|
||
this.html += 'xlink:' + attr.name;
|
||
} else {
|
||
this.html += attr.prefix + ':' + attr.name;
|
||
}
|
||
|
||
this.html += '="' + value + '"';
|
||
}
|
||
}
|
||
|
||
_serializeTextNode(node) {
|
||
const content = this.treeAdapter.getTextNodeContent(node);
|
||
const parent = this.treeAdapter.getParentNode(node);
|
||
let parentTn = void 0;
|
||
|
||
if (parent && this.treeAdapter.isElementNode(parent)) {
|
||
parentTn = this.treeAdapter.getTagName(parent);
|
||
}
|
||
|
||
if (
|
||
parentTn === $.STYLE ||
|
||
parentTn === $.SCRIPT ||
|
||
parentTn === $.XMP ||
|
||
parentTn === $.IFRAME ||
|
||
parentTn === $.NOEMBED ||
|
||
parentTn === $.NOFRAMES ||
|
||
parentTn === $.PLAINTEXT ||
|
||
parentTn === $.NOSCRIPT
|
||
) {
|
||
this.html += content;
|
||
} else {
|
||
this.html += Serializer.escapeString(content, false);
|
||
}
|
||
}
|
||
|
||
_serializeCommentNode(node) {
|
||
this.html += '<!--' + this.treeAdapter.getCommentNodeContent(node) + '-->';
|
||
}
|
||
|
||
_serializeDocumentTypeNode(node) {
|
||
const name = this.treeAdapter.getDocumentTypeNodeName(node);
|
||
|
||
this.html += '<' + doctype.serializeContent(name, null, null) + '>';
|
||
}
|
||
}
|
||
|
||
// NOTE: used in tests and by rewriting stream
|
||
Serializer.escapeString = function(str, attrMode) {
|
||
str = str.replace(AMP_REGEX, '&').replace(NBSP_REGEX, ' ');
|
||
|
||
if (attrMode) {
|
||
str = str.replace(DOUBLE_QUOTE_REGEX, '"');
|
||
} else {
|
||
str = str.replace(LT_REGEX, '<').replace(GT_REGEX, '>');
|
||
}
|
||
|
||
return str;
|
||
};
|
||
|
||
module.exports = Serializer;
|
||
|
||
|
||
/***/ }),
|
||
/* 159 */
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
// -------------------------------------------------------------
|
||
// WARNING: this file is used by both the client and the server.
|
||
// Do not use any browser or node-specific API!
|
||
// -------------------------------------------------------------
|
||
const { parse } = __webpack_require__(160);
|
||
const { generate } = __webpack_require__(180);
|
||
|
||
class JSRewriter {
|
||
constructor(ctx) {
|
||
this.parseOptions = {
|
||
allowReturnOutsideFunction: true,
|
||
allowImportExportEverywhere: true,
|
||
ecmaVersion: 2021,
|
||
};
|
||
this.generationOptions = {
|
||
format: {
|
||
quotes: 'double',
|
||
escapeless: true,
|
||
compact: true,
|
||
},
|
||
};
|
||
this.rewrite = ['location', 'parent', 'top'];
|
||
this.map = [
|
||
{
|
||
type: 'MemberExpression',
|
||
handler: (node, parent) => {
|
||
let rewrite = false;
|
||
if (parent.type == 'UnaryExpression' && parent.operator == 'delete') return;
|
||
if (parent.type == 'NewExpression' && parent.callee == node) return;
|
||
if (parent.type === 'CallExpression' && parent.callee === node) return;
|
||
if (node.preventRewrite) return;
|
||
switch(node.property.type) {
|
||
case 'Identifier':
|
||
//if (node.computed) rewrite = true;
|
||
if (!node.computed && this.rewrite.includes(node.property.name)) {
|
||
node.property = this.createLiteral(node.property.name);
|
||
rewrite = true;
|
||
};
|
||
break;
|
||
case 'Literal':
|
||
if (this.rewrite.includes(node.property.name)) rewrite = true;
|
||
break;
|
||
case 'TemplateLiteral':
|
||
rewrite = true;
|
||
break;
|
||
default:
|
||
if (node.computed) rewrite = true;
|
||
};
|
||
if (rewrite) {
|
||
let identifier = '$corrosionGet$m';
|
||
let nodeToRewrite = node;
|
||
const args = [
|
||
node.object,
|
||
node.property,
|
||
];
|
||
if (node.computed) args[1].preventRewrite = true;
|
||
if (parent.type == 'AssignmentExpression' && parent.left == node) {
|
||
identifier = '$corrosionSet$m';
|
||
nodeToRewrite = parent;
|
||
args.push(parent.right, this.createLiteral(parent.operator));
|
||
};
|
||
if (parent.type == 'CallExpression' && parent.callee == node) {
|
||
identifier = '$corrosionCall$m';
|
||
nodeToRewrite = parent;
|
||
args.push(this.createArrayExpression(...parent.arguments))
|
||
};
|
||
if (parent.type == 'UpdateExpression') {
|
||
identifier = '$corrosionSet$m';
|
||
nodeToRewrite = parent;
|
||
args.push(this.createLiteral(null), this.createLiteral(parent.operator));
|
||
};
|
||
Object.assign(nodeToRewrite, this.createCallExpression({ type: 'Identifier', name: identifier, }, args));
|
||
};
|
||
},
|
||
},
|
||
{
|
||
type: 'Identifier',
|
||
handler: (node, parent) => {
|
||
if (parent.type == 'MemberExpression' && parent.property == node) return; // window.location;
|
||
if (parent.type == 'LabeledStatement') return; // { location: null, };
|
||
if (parent.type == 'VariableDeclarator' && parent.id == node) return;
|
||
if (parent.type == 'Property' && parent.key == node) return;
|
||
if (parent.type == 'MethodDefinition') return;
|
||
if (parent.type == 'ClassDeclaration') return;
|
||
if (parent.type == 'RestElement') return;
|
||
if (parent.type == 'ExportSpecifier') return;
|
||
if (parent.type == 'ImportSpecifier') return;
|
||
if ((parent.type == 'FunctionDeclaration' || parent.type == 'FunctionExpression' || parent.type == 'ArrowFunctionExpression') && parent.params.includes(node)) return;
|
||
if ((parent.type == 'FunctionDeclaration' || parent.type == 'FunctionExpression') && parent.id == node) return;
|
||
if (parent.type == 'AssignmentPattern' && parent.left == node) return;
|
||
if (!this.rewrite.includes(node.name)) return;
|
||
if (node.preventRewrite) return;
|
||
let identifier = '$corrosionGet$';
|
||
let nodeToRewrite = node;
|
||
const args = [
|
||
this.createIdentifier(node.name, true),
|
||
];
|
||
|
||
if (parent.type == 'AssignmentExpression' && parent.left == node) {
|
||
identifier = '$corrosionSet$';
|
||
nodeToRewrite = parent;
|
||
args.push(parent.right);
|
||
args.push(this.createLiteral(parent.operator));
|
||
};
|
||
|
||
Object.assign(nodeToRewrite, this.createCallExpression({ type: 'Identifier', name: identifier }, args));
|
||
},
|
||
},
|
||
{
|
||
type: 'ImportDeclaration',
|
||
handler: (node, parent, url) => {
|
||
if (node.source.type != 'Literal' || !url) return;
|
||
node.source = this.createLiteral(ctx.url.wrap(node.source.value, { base: url, }));
|
||
},
|
||
},
|
||
{
|
||
type: 'ImportExpression',
|
||
handler: (node, parent) => {
|
||
node.source = this.createCallExpression(this.createMemberExpression(this.createMemberExpression(this.createIdentifier('$corrosion'), this.createIdentifier('url')), this.createIdentifier('wrap')), [
|
||
node.source,
|
||
this.createMemberExpression(this.createIdentifier('$corrosion'), this.createIdentifier('meta')),
|
||
]);
|
||
},
|
||
},
|
||
];
|
||
this.ctx = ctx;
|
||
};
|
||
process(source, url) {
|
||
try {
|
||
const ast = parse(source, this.parseOptions);
|
||
this.iterate(ast, (node, parent) => {
|
||
const fn = this.map.find(entry => entry.type == (node || {}).type);
|
||
if (fn) fn.handler(node, parent, url);
|
||
});
|
||
return (url ? this.createHead(url) : '') + generate(ast, this.generationOptions);
|
||
} catch(e) {
|
||
return source;
|
||
};
|
||
};
|
||
createHead(url) {
|
||
return `
|
||
if (!self.$corrosion && self.importScripts) {
|
||
importScripts(location.origin + '${this.ctx.prefix}index.js');
|
||
self.$corrosion = new Corrosion({ url: '${url}', codec: '${this.ctx.config.codec || 'plain'}', serviceWorker: true, window: self, prefix: '${this.ctx.prefix || '/service/'}', ws: ${this.ctx.config.ws || true}, cookies: ${this.ctx.config.cookies || false}, title: '${this.ctx.config.title}', }); $corrosion.init();
|
||
};\n`;
|
||
};
|
||
iterate(ast, handler) {
|
||
if (typeof ast != 'object' || !handler) return;
|
||
walk(ast, null, handler);
|
||
function walk(node, parent, handler) {
|
||
if (typeof node != 'object' || !handler) return;
|
||
handler(node, parent, handler);
|
||
for (const child in node) {
|
||
if (Array.isArray(node[child])) {
|
||
node[child].forEach(entry => walk(entry, node, handler));
|
||
} else {
|
||
walk(node[child], node, handler);
|
||
};
|
||
};
|
||
};
|
||
};
|
||
createCallExpression(callee, args) {
|
||
return { type: 'CallExpression', callee, arguments: args, optional: false, };
|
||
};
|
||
createArrayExpression(...elements) {
|
||
return {
|
||
type: 'ArrayExpression',
|
||
elements,
|
||
};
|
||
};
|
||
createMemberExpression(object, property) {
|
||
return {
|
||
type: 'MemberExpression',
|
||
object,
|
||
property,
|
||
};
|
||
};
|
||
createLiteral(value) {
|
||
return {
|
||
type: 'Literal',
|
||
value,
|
||
}
|
||
};
|
||
createIdentifier(name, preventRewrite) {
|
||
return { type: 'Identifier', name, preventRewrite: preventRewrite || false, };
|
||
};
|
||
};
|
||
|
||
module.exports = JSRewriter;
|
||
|
||
|
||
/***/ }),
|
||
/* 160 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.nonASCIIwhitespace = exports.lineBreakG = exports.lineBreak = exports.isNewLine = exports.Token = exports.isIdentifierStart = exports.isIdentifierChar = exports.tokContexts = exports.TokContext = exports.keywordTypes = exports.tokTypes = exports.TokenType = exports.Node = exports.getLineInfo = exports.SourceLocation = exports.Position = exports.defaultOptions = exports.Parser = exports.version = undefined;
|
||
exports.parse = parse;
|
||
exports.parseExpressionAt = parseExpressionAt;
|
||
exports.tokenizer = tokenizer;
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
__webpack_require__(169);
|
||
|
||
__webpack_require__(170);
|
||
|
||
__webpack_require__(171);
|
||
|
||
__webpack_require__(172);
|
||
|
||
__webpack_require__(173);
|
||
|
||
__webpack_require__(174);
|
||
|
||
var _options = __webpack_require__(165);
|
||
|
||
var _locutil = __webpack_require__(167);
|
||
|
||
var _node = __webpack_require__(175);
|
||
|
||
var _tokentype = __webpack_require__(163);
|
||
|
||
var _tokencontext = __webpack_require__(176);
|
||
|
||
var _identifier = __webpack_require__(162);
|
||
|
||
var _tokenize = __webpack_require__(177);
|
||
|
||
var _whitespace = __webpack_require__(164);
|
||
|
||
var _util = __webpack_require__(166);
|
||
|
||
var utils = _interopRequireWildcard(_util);
|
||
|
||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||
|
||
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
||
//
|
||
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
|
||
// various contributors and released under an MIT license.
|
||
//
|
||
// Git repositories for Acorn are available at
|
||
//
|
||
// http://marijnhaverbeke.nl/git/acorn
|
||
// https://github.com/acornjs/acorn.git
|
||
//
|
||
// Please use the [github bug tracker][ghbt] to report issues.
|
||
//
|
||
// [ghbt]: https://github.com/acornjs/acorn/issues
|
||
//
|
||
// [walk]: util/walk.js
|
||
|
||
const version = exports.version = "8.1.0";
|
||
exports.Parser = _state.Parser;
|
||
exports.defaultOptions = _options.defaultOptions;
|
||
exports.Position = _locutil.Position;
|
||
exports.SourceLocation = _locutil.SourceLocation;
|
||
exports.getLineInfo = _locutil.getLineInfo;
|
||
exports.Node = _node.Node;
|
||
exports.TokenType = _tokentype.TokenType;
|
||
exports.tokTypes = _tokentype.types;
|
||
exports.keywordTypes = _tokentype.keywords;
|
||
exports.TokContext = _tokencontext.TokContext;
|
||
exports.tokContexts = _tokencontext.types;
|
||
exports.isIdentifierChar = _identifier.isIdentifierChar;
|
||
exports.isIdentifierStart = _identifier.isIdentifierStart;
|
||
exports.Token = _tokenize.Token;
|
||
exports.isNewLine = _whitespace.isNewLine;
|
||
exports.lineBreak = _whitespace.lineBreak;
|
||
exports.lineBreakG = _whitespace.lineBreakG;
|
||
exports.nonASCIIwhitespace = _whitespace.nonASCIIwhitespace;
|
||
|
||
|
||
_state.Parser.acorn = {
|
||
Parser: _state.Parser,
|
||
version,
|
||
defaultOptions: _options.defaultOptions,
|
||
Position: _locutil.Position,
|
||
SourceLocation: _locutil.SourceLocation,
|
||
getLineInfo: _locutil.getLineInfo,
|
||
Node: _node.Node,
|
||
TokenType: _tokentype.TokenType,
|
||
tokTypes: _tokentype.types,
|
||
keywordTypes: _tokentype.keywords,
|
||
TokContext: _tokencontext.TokContext,
|
||
tokContexts: _tokencontext.types,
|
||
isIdentifierChar: _identifier.isIdentifierChar,
|
||
isIdentifierStart: _identifier.isIdentifierStart,
|
||
Token: _tokenize.Token,
|
||
isNewLine: _whitespace.isNewLine,
|
||
lineBreak: _whitespace.lineBreak,
|
||
lineBreakG: _whitespace.lineBreakG,
|
||
nonASCIIwhitespace: _whitespace.nonASCIIwhitespace
|
||
|
||
// The main exported interface (under `self.acorn` when in the
|
||
// browser) is a `parse` function that takes a code string and
|
||
// returns an abstract syntax tree as specified by [Mozilla parser
|
||
// API][api].
|
||
//
|
||
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
|
||
|
||
};function parse(input, options) {
|
||
return _state.Parser.parse(input, options);
|
||
}
|
||
|
||
// This function tries to parse a single expression at a given
|
||
// offset in a string. Useful for parsing mixed-language formats
|
||
// that embed JavaScript expressions.
|
||
|
||
function parseExpressionAt(input, pos, options) {
|
||
return _state.Parser.parseExpressionAt(input, pos, options);
|
||
}
|
||
|
||
// Acorn is organized as a tokenizer and a recursive-descent parser.
|
||
// The `tokenizer` export provides an interface to the tokenizer.
|
||
|
||
function tokenizer(input, options) {
|
||
return _state.Parser.tokenizer(input, options);
|
||
}
|
||
|
||
// =============================================================================
|
||
// =============================================================================
|
||
// ===================== TestCafe performance patch ============================
|
||
// =====================||||||||||||||||||||||||||||============================
|
||
// =====================vvvvvvvvvvvvvvvvvvvvvvvvvvvv============================
|
||
|
||
const storedWordsRegexp = utils.wordsRegexp;
|
||
const wordsRegexpCache = {};
|
||
|
||
utils.wordsRegexp = function (words) {
|
||
if (!wordsRegexpCache[words]) wordsRegexpCache[words] = storedWordsRegexp(words);
|
||
|
||
return wordsRegexpCache[words];
|
||
};
|
||
|
||
// =====================^^^^^^^^^^^^^^^^^^^^^^^^^^^^============================
|
||
// =====================||||||||||||||||||||||||||||============================
|
||
// ===================== TestCafe performance patch ============================
|
||
// =============================================================================
|
||
// =============================================================================
|
||
|
||
/***/ }),
|
||
/* 161 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.Parser = undefined;
|
||
|
||
var _identifier = __webpack_require__(162);
|
||
|
||
var _tokentype = __webpack_require__(163);
|
||
|
||
var _whitespace = __webpack_require__(164);
|
||
|
||
var _options = __webpack_require__(165);
|
||
|
||
var _util = __webpack_require__(166);
|
||
|
||
var _scopeflags = __webpack_require__(168);
|
||
|
||
class Parser {
|
||
constructor(options, input, startPos) {
|
||
this.options = options = (0, _options.getOptions)(options);
|
||
this.sourceFile = options.sourceFile;
|
||
this.keywords = (0, _util.wordsRegexp)(_identifier.keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
||
let reserved = "";
|
||
if (options.allowReserved !== true) {
|
||
reserved = _identifier.reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
|
||
if (options.sourceType === "module") reserved += " await";
|
||
}
|
||
this.reservedWords = (0, _util.wordsRegexp)(reserved);
|
||
let reservedStrict = (reserved ? reserved + " " : "") + _identifier.reservedWords.strict;
|
||
this.reservedWordsStrict = (0, _util.wordsRegexp)(reservedStrict);
|
||
this.reservedWordsStrictBind = (0, _util.wordsRegexp)(reservedStrict + " " + _identifier.reservedWords.strictBind);
|
||
this.input = String(input);
|
||
|
||
// Used to signal to callers of `readWord1` whether the word
|
||
// contained any escape sequences. This is needed because words with
|
||
// escape sequences must not be interpreted as keywords.
|
||
this.containsEsc = false;
|
||
|
||
// Set up token state
|
||
|
||
// The current position of the tokenizer in the input.
|
||
if (startPos) {
|
||
this.pos = startPos;
|
||
this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
|
||
this.curLine = this.input.slice(0, this.lineStart).split(_whitespace.lineBreak).length;
|
||
} else {
|
||
this.pos = this.lineStart = 0;
|
||
this.curLine = 1;
|
||
}
|
||
|
||
// Properties of the current token:
|
||
// Its type
|
||
this.type = _tokentype.types.eof;
|
||
// For tokens that include more information than their type, the value
|
||
this.value = null;
|
||
// Its start and end offset
|
||
this.start = this.end = this.pos;
|
||
// And, if locations are used, the {line, column} object
|
||
// corresponding to those offsets
|
||
this.startLoc = this.endLoc = this.curPosition();
|
||
|
||
// Position information for the previous token
|
||
this.lastTokEndLoc = this.lastTokStartLoc = null;
|
||
this.lastTokStart = this.lastTokEnd = this.pos;
|
||
|
||
// The context stack is used to superficially track syntactic
|
||
// context to predict whether a regular expression is allowed in a
|
||
// given position.
|
||
this.context = this.initialContext();
|
||
this.exprAllowed = true;
|
||
|
||
// Figure out if it's a module code.
|
||
this.inModule = options.sourceType === "module";
|
||
this.strict = this.inModule || this.strictDirective(this.pos);
|
||
|
||
// Used to signify the start of a potential arrow function
|
||
this.potentialArrowAt = -1;
|
||
|
||
// Positions to delayed-check that yield/await does not exist in default parameters.
|
||
this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
|
||
// Labels in scope.
|
||
this.labels = [];
|
||
// Thus-far undefined exports.
|
||
this.undefinedExports = Object.create(null);
|
||
|
||
// If enabled, skip leading hashbang line.
|
||
if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") this.skipLineComment(2);
|
||
|
||
// Scope tracking for duplicate variable names (see scope.js)
|
||
this.scopeStack = [];
|
||
this.enterScope(_scopeflags.SCOPE_TOP);
|
||
|
||
// For RegExp validation
|
||
this.regexpState = null;
|
||
}
|
||
|
||
parse() {
|
||
let node = this.options.program || this.startNode();
|
||
this.nextToken();
|
||
return this.parseTopLevel(node);
|
||
}
|
||
|
||
get inFunction() {
|
||
return (this.currentVarScope().flags & _scopeflags.SCOPE_FUNCTION) > 0;
|
||
}
|
||
get inGenerator() {
|
||
return (this.currentVarScope().flags & _scopeflags.SCOPE_GENERATOR) > 0;
|
||
}
|
||
get inAsync() {
|
||
return (this.currentVarScope().flags & _scopeflags.SCOPE_ASYNC) > 0;
|
||
}
|
||
get allowSuper() {
|
||
return (this.currentThisScope().flags & _scopeflags.SCOPE_SUPER) > 0;
|
||
}
|
||
get allowDirectSuper() {
|
||
return (this.currentThisScope().flags & _scopeflags.SCOPE_DIRECT_SUPER) > 0;
|
||
}
|
||
get treatFunctionsAsVar() {
|
||
return this.treatFunctionsAsVarInScope(this.currentScope());
|
||
}
|
||
get inNonArrowFunction() {
|
||
return (this.currentThisScope().flags & _scopeflags.SCOPE_FUNCTION) > 0;
|
||
}
|
||
|
||
static extend(...plugins) {
|
||
let cls = this;
|
||
for (let i = 0; i < plugins.length; i++) cls = plugins[i](cls);
|
||
return cls;
|
||
}
|
||
|
||
static parse(input, options) {
|
||
return new this(options, input).parse();
|
||
}
|
||
|
||
static parseExpressionAt(input, pos, options) {
|
||
let parser = new this(options, input, pos);
|
||
parser.nextToken();
|
||
return parser.parseExpression();
|
||
}
|
||
|
||
static tokenizer(input, options) {
|
||
return new this(options, input);
|
||
}
|
||
}
|
||
exports.Parser = Parser;
|
||
|
||
/***/ }),
|
||
/* 162 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.isIdentifierStart = isIdentifierStart;
|
||
exports.isIdentifierChar = isIdentifierChar;
|
||
// Reserved word lists for various dialects of the language
|
||
|
||
const reservedWords = exports.reservedWords = {
|
||
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
|
||
5: "class enum extends super const export import",
|
||
6: "enum",
|
||
strict: "implements interface let package private protected public static yield",
|
||
strictBind: "eval arguments"
|
||
|
||
// And the keywords
|
||
|
||
};const ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
|
||
|
||
const keywords = exports.keywords = {
|
||
5: ecma5AndLessKeywords,
|
||
"5module": ecma5AndLessKeywords + " export import",
|
||
6: ecma5AndLessKeywords + " const class extends export import super"
|
||
};
|
||
|
||
const keywordRelationalOperator = exports.keywordRelationalOperator = /^in(stanceof)?$/;
|
||
|
||
// ## Character categories
|
||
|
||
// Big ugly regular expressions that match characters in the
|
||
// whitespace, identifier, and identifier-start categories. These
|
||
// are only applied when a character is found to actually have a
|
||
// code point above 128.
|
||
// Generated by `bin/generate-identifier-regex.js`.
|
||
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
||
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
||
|
||
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
||
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
||
|
||
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
||
|
||
// These are a run-length and offset encoded representation of the
|
||
// >0xffff code points that are a valid part of identifiers. The
|
||
// offset starts at 0x10000, and each pair of numbers represents an
|
||
// offset to the next range, and then a size of the range. They were
|
||
// generated by bin/generate-identifier-regex.js
|
||
|
||
// eslint-disable-next-line comma-spacing
|
||
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
|
||
|
||
// eslint-disable-next-line comma-spacing
|
||
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
||
|
||
// This has a complexity linear to the value of the code. The
|
||
// assumption is that looking up astral identifier characters is
|
||
// rare.
|
||
function isInAstralSet(code, set) {
|
||
let pos = 0x10000;
|
||
for (let i = 0; i < set.length; i += 2) {
|
||
pos += set[i];
|
||
if (pos > code) return false;
|
||
pos += set[i + 1];
|
||
if (pos >= code) return true;
|
||
}
|
||
}
|
||
|
||
// Test whether a given character code starts an identifier.
|
||
|
||
function isIdentifierStart(code, astral) {
|
||
if (code < 65) return code === 36;
|
||
if (code < 91) return true;
|
||
if (code < 97) return code === 95;
|
||
if (code < 123) return true;
|
||
if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
||
if (astral === false) return false;
|
||
return isInAstralSet(code, astralIdentifierStartCodes);
|
||
}
|
||
|
||
// Test whether a given character is part of an identifier.
|
||
|
||
function isIdentifierChar(code, astral) {
|
||
if (code < 48) return code === 36;
|
||
if (code < 58) return true;
|
||
if (code < 65) return false;
|
||
if (code < 91) return true;
|
||
if (code < 97) return code === 95;
|
||
if (code < 123) return true;
|
||
if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
|
||
if (astral === false) return false;
|
||
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
||
}
|
||
|
||
/***/ }),
|
||
/* 163 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
// ## Token types
|
||
|
||
// The assignment of fine-grained, information-carrying type objects
|
||
// allows the tokenizer to store the information it has about a
|
||
// token in a way that is very cheap for the parser to look up.
|
||
|
||
// All token type variables start with an underscore, to make them
|
||
// easy to recognize.
|
||
|
||
// The `beforeExpr` property is used to disambiguate between regular
|
||
// expressions and divisions. It is set on all token types that can
|
||
// be followed by an expression (thus, a slash after them would be a
|
||
// regular expression).
|
||
//
|
||
// The `startsExpr` property is used to check if the token ends a
|
||
// `yield` expression. It is set on all token types that either can
|
||
// directly start an expression (like a quotation mark) or can
|
||
// continue an expression (like the body of a string).
|
||
//
|
||
// `isLoop` marks a keyword as starting a loop, which is important
|
||
// to know when parsing a label, in order to allow or disallow
|
||
// continue jumps to that label.
|
||
|
||
class TokenType {
|
||
constructor(label, conf = {}) {
|
||
this.label = label;
|
||
this.keyword = conf.keyword;
|
||
this.beforeExpr = !!conf.beforeExpr;
|
||
this.startsExpr = !!conf.startsExpr;
|
||
this.isLoop = !!conf.isLoop;
|
||
this.isAssign = !!conf.isAssign;
|
||
this.prefix = !!conf.prefix;
|
||
this.postfix = !!conf.postfix;
|
||
this.binop = conf.binop || null;
|
||
this.updateContext = null;
|
||
}
|
||
}
|
||
|
||
exports.TokenType = TokenType;
|
||
function binop(name, prec) {
|
||
return new TokenType(name, { beforeExpr: true, binop: prec });
|
||
}
|
||
const beforeExpr = { beforeExpr: true },
|
||
startsExpr = { startsExpr: true
|
||
|
||
// Map keyword names to token types.
|
||
|
||
};const keywords = exports.keywords = {};
|
||
|
||
// Succinct definitions of keyword token types
|
||
function kw(name, options = {}) {
|
||
options.keyword = name;
|
||
return keywords[name] = new TokenType(name, options);
|
||
}
|
||
|
||
const types = exports.types = {
|
||
num: new TokenType("num", startsExpr),
|
||
regexp: new TokenType("regexp", startsExpr),
|
||
string: new TokenType("string", startsExpr),
|
||
name: new TokenType("name", startsExpr),
|
||
eof: new TokenType("eof"),
|
||
|
||
// Punctuation token types.
|
||
bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }),
|
||
bracketR: new TokenType("]"),
|
||
braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }),
|
||
braceR: new TokenType("}"),
|
||
parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }),
|
||
parenR: new TokenType(")"),
|
||
comma: new TokenType(",", beforeExpr),
|
||
semi: new TokenType(";", beforeExpr),
|
||
colon: new TokenType(":", beforeExpr),
|
||
dot: new TokenType("."),
|
||
question: new TokenType("?", beforeExpr),
|
||
questionDot: new TokenType("?."),
|
||
arrow: new TokenType("=>", beforeExpr),
|
||
template: new TokenType("template"),
|
||
invalidTemplate: new TokenType("invalidTemplate"),
|
||
ellipsis: new TokenType("...", beforeExpr),
|
||
backQuote: new TokenType("`", startsExpr),
|
||
dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }),
|
||
|
||
// Operators. These carry several kinds of properties to help the
|
||
// parser use them properly (the presence of these properties is
|
||
// what categorizes them as operators).
|
||
//
|
||
// `binop`, when present, specifies that this operator is a binary
|
||
// operator, and will refer to its precedence.
|
||
//
|
||
// `prefix` and `postfix` mark the operator as a prefix or postfix
|
||
// unary operator.
|
||
//
|
||
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
|
||
// binary operators with a very low precedence, that should result
|
||
// in AssignmentExpression nodes.
|
||
|
||
eq: new TokenType("=", { beforeExpr: true, isAssign: true }),
|
||
assign: new TokenType("_=", { beforeExpr: true, isAssign: true }),
|
||
incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }),
|
||
prefix: new TokenType("!/~", { beforeExpr: true, prefix: true, startsExpr: true }),
|
||
logicalOR: binop("||", 1),
|
||
logicalAND: binop("&&", 2),
|
||
bitwiseOR: binop("|", 3),
|
||
bitwiseXOR: binop("^", 4),
|
||
bitwiseAND: binop("&", 5),
|
||
equality: binop("==/!=/===/!==", 6),
|
||
relational: binop("</>/<=/>=", 7),
|
||
bitShift: binop("<</>>/>>>", 8),
|
||
plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }),
|
||
modulo: binop("%", 10),
|
||
star: binop("*", 10),
|
||
slash: binop("/", 10),
|
||
starstar: new TokenType("**", { beforeExpr: true }),
|
||
coalesce: binop("??", 1),
|
||
|
||
// Keyword token types.
|
||
_break: kw("break"),
|
||
_case: kw("case", beforeExpr),
|
||
_catch: kw("catch"),
|
||
_continue: kw("continue"),
|
||
_debugger: kw("debugger"),
|
||
_default: kw("default", beforeExpr),
|
||
_do: kw("do", { isLoop: true, beforeExpr: true }),
|
||
_else: kw("else", beforeExpr),
|
||
_finally: kw("finally"),
|
||
_for: kw("for", { isLoop: true }),
|
||
_function: kw("function", startsExpr),
|
||
_if: kw("if"),
|
||
_return: kw("return", beforeExpr),
|
||
_switch: kw("switch"),
|
||
_throw: kw("throw", beforeExpr),
|
||
_try: kw("try"),
|
||
_var: kw("var"),
|
||
_const: kw("const"),
|
||
_while: kw("while", { isLoop: true }),
|
||
_with: kw("with"),
|
||
_new: kw("new", { beforeExpr: true, startsExpr: true }),
|
||
_this: kw("this", startsExpr),
|
||
_super: kw("super", startsExpr),
|
||
_class: kw("class", startsExpr),
|
||
_extends: kw("extends", beforeExpr),
|
||
_export: kw("export"),
|
||
_import: kw("import", startsExpr),
|
||
_null: kw("null", startsExpr),
|
||
_true: kw("true", startsExpr),
|
||
_false: kw("false", startsExpr),
|
||
_in: kw("in", { beforeExpr: true, binop: 7 }),
|
||
_instanceof: kw("instanceof", { beforeExpr: true, binop: 7 }),
|
||
_typeof: kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true }),
|
||
_void: kw("void", { beforeExpr: true, prefix: true, startsExpr: true }),
|
||
_delete: kw("delete", { beforeExpr: true, prefix: true, startsExpr: true })
|
||
};
|
||
|
||
/***/ }),
|
||
/* 164 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.isNewLine = isNewLine;
|
||
// Matches a whole line break (where CRLF is considered a single
|
||
// line break). Used to count lines.
|
||
|
||
const lineBreak = exports.lineBreak = /\r\n?|\n|\u2028|\u2029/;
|
||
const lineBreakG = exports.lineBreakG = new RegExp(lineBreak.source, "g");
|
||
|
||
function isNewLine(code, ecma2019String) {
|
||
return code === 10 || code === 13 || !ecma2019String && (code === 0x2028 || code === 0x2029);
|
||
}
|
||
|
||
const nonASCIIwhitespace = exports.nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
|
||
|
||
const skipWhiteSpace = exports.skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
||
|
||
/***/ }),
|
||
/* 165 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.defaultOptions = undefined;
|
||
exports.getOptions = getOptions;
|
||
|
||
var _util = __webpack_require__(166);
|
||
|
||
var _locutil = __webpack_require__(167);
|
||
|
||
// A second argument must be given to configure the parser process.
|
||
// These options are recognized (only `ecmaVersion` is required):
|
||
|
||
const defaultOptions = exports.defaultOptions = {
|
||
// `ecmaVersion` indicates the ECMAScript version to parse. Must be
|
||
// either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
|
||
// (2019), 11 (2020), 12 (2021), or `"latest"` (the latest version
|
||
// the library supports). This influences support for strict mode,
|
||
// the set of reserved words, and support for new syntax features.
|
||
ecmaVersion: null,
|
||
// `sourceType` indicates the mode the code should be parsed in.
|
||
// Can be either `"script"` or `"module"`. This influences global
|
||
// strict mode and parsing of `import` and `export` declarations.
|
||
sourceType: "script",
|
||
// `onInsertedSemicolon` can be a callback that will be called
|
||
// when a semicolon is automatically inserted. It will be passed
|
||
// the position of the comma as an offset, and if `locations` is
|
||
// enabled, it is given the location as a `{line, column}` object
|
||
// as second argument.
|
||
onInsertedSemicolon: null,
|
||
// `onTrailingComma` is similar to `onInsertedSemicolon`, but for
|
||
// trailing commas.
|
||
onTrailingComma: null,
|
||
// By default, reserved words are only enforced if ecmaVersion >= 5.
|
||
// Set `allowReserved` to a boolean value to explicitly turn this on
|
||
// an off. When this option has the value "never", reserved words
|
||
// and keywords can also not be used as property names.
|
||
allowReserved: null,
|
||
// When enabled, a return at the top level is not considered an
|
||
// error.
|
||
allowReturnOutsideFunction: false,
|
||
// When enabled, import/export statements are not constrained to
|
||
// appearing at the top of the program, and an import.meta expression
|
||
// in a script isn't considered an error.
|
||
allowImportExportEverywhere: false,
|
||
// When enabled, await identifiers are allowed to appear at the top-level scope,
|
||
// but they are still not allowed in non-async functions.
|
||
allowAwaitOutsideFunction: false,
|
||
// When enabled, hashbang directive in the beginning of file
|
||
// is allowed and treated as a line comment.
|
||
allowHashBang: false,
|
||
// When `locations` is on, `loc` properties holding objects with
|
||
// `start` and `end` properties in `{line, column}` form (with
|
||
// line being 1-based and column 0-based) will be attached to the
|
||
// nodes.
|
||
locations: false,
|
||
// A function can be passed as `onToken` option, which will
|
||
// cause Acorn to call that function with object in the same
|
||
// format as tokens returned from `tokenizer().getToken()`. Note
|
||
// that you are not allowed to call the parser from the
|
||
// callback—that will corrupt its internal state.
|
||
onToken: null,
|
||
// A function can be passed as `onComment` option, which will
|
||
// cause Acorn to call that function with `(block, text, start,
|
||
// end)` parameters whenever a comment is skipped. `block` is a
|
||
// boolean indicating whether this is a block (`/* */`) comment,
|
||
// `text` is the content of the comment, and `start` and `end` are
|
||
// character offsets that denote the start and end of the comment.
|
||
// When the `locations` option is on, two more parameters are
|
||
// passed, the full `{line, column}` locations of the start and
|
||
// end of the comments. Note that you are not allowed to call the
|
||
// parser from the callback—that will corrupt its internal state.
|
||
onComment: null,
|
||
// Nodes have their start and end characters offsets recorded in
|
||
// `start` and `end` properties (directly on the node, rather than
|
||
// the `loc` object, which holds line/column data. To also add a
|
||
// [semi-standardized][range] `range` property holding a `[start,
|
||
// end]` array with the same numbers, set the `ranges` option to
|
||
// `true`.
|
||
//
|
||
// [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
|
||
ranges: false,
|
||
// It is possible to parse multiple files into a single AST by
|
||
// passing the tree produced by parsing the first file as
|
||
// `program` option in subsequent parses. This will add the
|
||
// toplevel forms of the parsed file to the `Program` (top) node
|
||
// of an existing parse tree.
|
||
program: null,
|
||
// When `locations` is on, you can pass this to record the source
|
||
// file in every node's `loc` object.
|
||
sourceFile: null,
|
||
// This value, if given, is stored in every node, whether
|
||
// `locations` is on or off.
|
||
directSourceFile: null,
|
||
// When enabled, parenthesized expressions are represented by
|
||
// (non-standard) ParenthesizedExpression nodes
|
||
preserveParens: false
|
||
|
||
// Interpret and default an options object
|
||
|
||
};let warnedAboutEcmaVersion = false;
|
||
|
||
function getOptions(opts) {
|
||
let options = {};
|
||
|
||
for (let opt in defaultOptions) options[opt] = opts && (0, _util.has)(opts, opt) ? opts[opt] : defaultOptions[opt];
|
||
|
||
if (options.ecmaVersion === "latest") {
|
||
options.ecmaVersion = 1e8;
|
||
} else if (options.ecmaVersion == null) {
|
||
if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) {
|
||
warnedAboutEcmaVersion = true;
|
||
console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.");
|
||
}
|
||
options.ecmaVersion = 11;
|
||
} else if (options.ecmaVersion >= 2015) {
|
||
options.ecmaVersion -= 2009;
|
||
}
|
||
|
||
if (options.allowReserved == null) options.allowReserved = options.ecmaVersion < 5;
|
||
|
||
if ((0, _util.isArray)(options.onToken)) {
|
||
let tokens = options.onToken;
|
||
options.onToken = token => tokens.push(token);
|
||
}
|
||
if ((0, _util.isArray)(options.onComment)) options.onComment = pushComment(options, options.onComment);
|
||
|
||
return options;
|
||
}
|
||
|
||
function pushComment(options, array) {
|
||
return function (block, text, start, end, startLoc, endLoc) {
|
||
let comment = {
|
||
type: block ? "Block" : "Line",
|
||
value: text,
|
||
start: start,
|
||
end: end
|
||
};
|
||
if (options.locations) comment.loc = new _locutil.SourceLocation(this, startLoc, endLoc);
|
||
if (options.ranges) comment.range = [start, end];
|
||
array.push(comment);
|
||
};
|
||
}
|
||
|
||
/***/ }),
|
||
/* 166 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.has = has;
|
||
exports.wordsRegexp = wordsRegexp;
|
||
var _Object$prototype = Object.prototype;
|
||
const hasOwnProperty = _Object$prototype.hasOwnProperty,
|
||
toString = _Object$prototype.toString;
|
||
|
||
// Checks if an object has a property.
|
||
|
||
function has(obj, propName) {
|
||
return hasOwnProperty.call(obj, propName);
|
||
}
|
||
|
||
const isArray = exports.isArray = Array.isArray || (obj => toString.call(obj) === "[object Array]");
|
||
|
||
function wordsRegexp(words) {
|
||
return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$");
|
||
}
|
||
|
||
/***/ }),
|
||
/* 167 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.SourceLocation = exports.Position = undefined;
|
||
exports.getLineInfo = getLineInfo;
|
||
|
||
var _whitespace = __webpack_require__(164);
|
||
|
||
// These are used when `options.locations` is on, for the
|
||
// `startLoc` and `endLoc` properties.
|
||
|
||
class Position {
|
||
constructor(line, col) {
|
||
this.line = line;
|
||
this.column = col;
|
||
}
|
||
|
||
offset(n) {
|
||
return new Position(this.line, this.column + n);
|
||
}
|
||
}
|
||
|
||
exports.Position = Position;
|
||
class SourceLocation {
|
||
constructor(p, start, end) {
|
||
this.start = start;
|
||
this.end = end;
|
||
if (p.sourceFile !== null) this.source = p.sourceFile;
|
||
}
|
||
}
|
||
|
||
exports.SourceLocation = SourceLocation; // The `getLineInfo` function is mostly useful when the
|
||
// `locations` option is off (for performance reasons) and you
|
||
// want to find the line/column position for a given character
|
||
// offset. `input` should be the code string that the offset refers
|
||
// into.
|
||
|
||
function getLineInfo(input, offset) {
|
||
for (let line = 1, cur = 0;;) {
|
||
_whitespace.lineBreakG.lastIndex = cur;
|
||
let match = _whitespace.lineBreakG.exec(input);
|
||
if (match && match.index < offset) {
|
||
++line;
|
||
cur = match.index + match[0].length;
|
||
} else {
|
||
return new Position(line, offset - cur);
|
||
}
|
||
}
|
||
}
|
||
|
||
/***/ }),
|
||
/* 168 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.functionFlags = functionFlags;
|
||
// Each scope gets a bitset that may contain these flags
|
||
const SCOPE_TOP = exports.SCOPE_TOP = 1,
|
||
SCOPE_FUNCTION = exports.SCOPE_FUNCTION = 2,
|
||
SCOPE_VAR = exports.SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION,
|
||
SCOPE_ASYNC = exports.SCOPE_ASYNC = 4,
|
||
SCOPE_GENERATOR = exports.SCOPE_GENERATOR = 8,
|
||
SCOPE_ARROW = exports.SCOPE_ARROW = 16,
|
||
SCOPE_SIMPLE_CATCH = exports.SCOPE_SIMPLE_CATCH = 32,
|
||
SCOPE_SUPER = exports.SCOPE_SUPER = 64,
|
||
SCOPE_DIRECT_SUPER = exports.SCOPE_DIRECT_SUPER = 128;
|
||
|
||
function functionFlags(async, generator) {
|
||
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
|
||
}
|
||
|
||
// Used in checkLVal* and declareName to determine the type of a binding
|
||
const BIND_NONE = exports.BIND_NONE = 0,
|
||
// Not a binding
|
||
BIND_VAR = exports.BIND_VAR = 1,
|
||
// Var-style binding
|
||
BIND_LEXICAL = exports.BIND_LEXICAL = 2,
|
||
// Let- or const-style binding
|
||
BIND_FUNCTION = exports.BIND_FUNCTION = 3,
|
||
// Function declaration
|
||
BIND_SIMPLE_CATCH = exports.BIND_SIMPLE_CATCH = 4,
|
||
// Simple (identifier pattern) catch binding
|
||
BIND_OUTSIDE = exports.BIND_OUTSIDE = 5; // Special case for function names as bound inside the function
|
||
|
||
/***/ }),
|
||
/* 169 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.DestructuringErrors = DestructuringErrors;
|
||
|
||
var _tokentype = __webpack_require__(163);
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
var _whitespace = __webpack_require__(164);
|
||
|
||
const pp = _state.Parser.prototype;
|
||
|
||
// ## Parser utilities
|
||
|
||
const literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
||
pp.strictDirective = function (start) {
|
||
for (;;) {
|
||
// Try to find string literal.
|
||
_whitespace.skipWhiteSpace.lastIndex = start;
|
||
start += _whitespace.skipWhiteSpace.exec(this.input)[0].length;
|
||
let match = literal.exec(this.input.slice(start));
|
||
if (!match) return false;
|
||
if ((match[1] || match[2]) === "use strict") return false;
|
||
start += match[0].length;
|
||
|
||
// Skip semicolon, if any.
|
||
_whitespace.skipWhiteSpace.lastIndex = start;
|
||
start += _whitespace.skipWhiteSpace.exec(this.input)[0].length;
|
||
if (this.input[start] === ";") start++;
|
||
}
|
||
};
|
||
|
||
// Predicate that tests whether the next token is of the given
|
||
// type, and if yes, consumes it as a side effect.
|
||
|
||
pp.eat = function (type) {
|
||
if (this.type === type) {
|
||
this.next();
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
};
|
||
|
||
// Tests whether parsed token is a contextual keyword.
|
||
|
||
pp.isContextual = function (name) {
|
||
return this.type === _tokentype.types.name && this.value === name && !this.containsEsc;
|
||
};
|
||
|
||
// Consumes contextual keyword if possible.
|
||
|
||
pp.eatContextual = function (name) {
|
||
if (!this.isContextual(name)) return false;
|
||
this.next();
|
||
return true;
|
||
};
|
||
|
||
// Asserts that following token is given contextual keyword.
|
||
|
||
pp.expectContextual = function (name) {
|
||
if (!this.eatContextual(name)) this.unexpected();
|
||
};
|
||
|
||
// Test whether a semicolon can be inserted at the current position.
|
||
|
||
pp.canInsertSemicolon = function () {
|
||
return this.type === _tokentype.types.eof || this.type === _tokentype.types.braceR || _whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
|
||
};
|
||
|
||
pp.insertSemicolon = function () {
|
||
if (this.canInsertSemicolon()) {
|
||
if (this.options.onInsertedSemicolon) this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc);
|
||
return true;
|
||
}
|
||
};
|
||
|
||
// Consume a semicolon, or, failing that, see if we are allowed to
|
||
// pretend that there is a semicolon at this position.
|
||
|
||
pp.semicolon = function () {
|
||
if (!this.eat(_tokentype.types.semi) && !this.insertSemicolon()) this.unexpected();
|
||
};
|
||
|
||
pp.afterTrailingComma = function (tokType, notNext) {
|
||
if (this.type === tokType) {
|
||
if (this.options.onTrailingComma) this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc);
|
||
if (!notNext) this.next();
|
||
return true;
|
||
}
|
||
};
|
||
|
||
// Expect a token of a given type. If found, consume it, otherwise,
|
||
// raise an unexpected token error.
|
||
|
||
pp.expect = function (type) {
|
||
this.eat(type) || this.unexpected();
|
||
};
|
||
|
||
// Raise an unexpected token error.
|
||
|
||
pp.unexpected = function (pos) {
|
||
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
||
};
|
||
|
||
function DestructuringErrors() {
|
||
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
||
}
|
||
|
||
pp.checkPatternErrors = function (refDestructuringErrors, isAssign) {
|
||
if (!refDestructuringErrors) return;
|
||
if (refDestructuringErrors.trailingComma > -1) this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element");
|
||
let parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
|
||
if (parens > -1) this.raiseRecoverable(parens, "Parenthesized pattern");
|
||
};
|
||
|
||
pp.checkExpressionErrors = function (refDestructuringErrors, andThrow) {
|
||
if (!refDestructuringErrors) return false;
|
||
let shorthandAssign = refDestructuringErrors.shorthandAssign,
|
||
doubleProto = refDestructuringErrors.doubleProto;
|
||
|
||
if (!andThrow) return shorthandAssign >= 0 || doubleProto >= 0;
|
||
if (shorthandAssign >= 0) this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns");
|
||
if (doubleProto >= 0) this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property");
|
||
};
|
||
|
||
pp.checkYieldAwaitInDefaultParams = function () {
|
||
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) this.raise(this.yieldPos, "Yield expression cannot be a default value");
|
||
if (this.awaitPos) this.raise(this.awaitPos, "Await expression cannot be a default value");
|
||
};
|
||
|
||
pp.isSimpleAssignTarget = function (expr) {
|
||
if (expr.type === "ParenthesizedExpression") return this.isSimpleAssignTarget(expr.expression);
|
||
return expr.type === "Identifier" || expr.type === "MemberExpression";
|
||
};
|
||
|
||
/***/ }),
|
||
/* 170 */
|
||
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _tokentype = __webpack_require__(163);
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
var _whitespace = __webpack_require__(164);
|
||
|
||
var _identifier = __webpack_require__(162);
|
||
|
||
var _util = __webpack_require__(166);
|
||
|
||
var _parseutil = __webpack_require__(169);
|
||
|
||
var _scopeflags = __webpack_require__(168);
|
||
|
||
const pp = _state.Parser.prototype;
|
||
|
||
// ### Statement parsing
|
||
|
||
// Parse a program. Initializes the parser, reads any number of
|
||
// statements, and wraps them in a Program node. Optionally takes a
|
||
// `program` argument. If present, the statements will be appended
|
||
// to its body instead of creating a new node.
|
||
|
||
pp.parseTopLevel = function (node) {
|
||
let exports = Object.create(null);
|
||
if (!node.body) node.body = [];
|
||
while (this.type !== _tokentype.types.eof) {
|
||
let stmt = this.parseStatement(null, true, exports);
|
||
node.body.push(stmt);
|
||
}
|
||
if (this.inModule) {
|
||
for (var _iterator = Object.keys(this.undefinedExports), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||
var _ref;
|
||
|
||
if (_isArray) {
|
||
if (_i >= _iterator.length) break;
|
||
_ref = _iterator[_i++];
|
||
} else {
|
||
_i = _iterator.next();
|
||
if (_i.done) break;
|
||
_ref = _i.value;
|
||
}
|
||
|
||
let name = _ref;
|
||
|
||
this.raiseRecoverable(this.undefinedExports[name].start, `Export '${name}' is not defined`);
|
||
}
|
||
}this.adaptDirectivePrologue(node.body);
|
||
this.next();
|
||
node.sourceType = this.options.sourceType;
|
||
return this.finishNode(node, "Program");
|
||
};
|
||
|
||
const loopLabel = { kind: "loop" },
|
||
switchLabel = { kind: "switch" };
|
||
|
||
pp.isLet = function (context) {
|
||
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return false;
|
||
_whitespace.skipWhiteSpace.lastIndex = this.pos;
|
||
let skip = _whitespace.skipWhiteSpace.exec(this.input);
|
||
let next = this.pos + skip[0].length,
|
||
nextCh = this.input.charCodeAt(next);
|
||
// For ambiguous cases, determine if a LexicalDeclaration (or only a
|
||
// Statement) is allowed here. If context is not empty then only a Statement
|
||
// is allowed. However, `let [` is an explicit negative lookahead for
|
||
// ExpressionStatement, so special-case it first.
|
||
if (nextCh === 91) return true; // '['
|
||
if (context) return false;
|
||
|
||
if (nextCh === 123) return true; // '{'
|
||
if ((0, _identifier.isIdentifierStart)(nextCh, true)) {
|
||
let pos = next + 1;
|
||
while ((0, _identifier.isIdentifierChar)(this.input.charCodeAt(pos), true)) ++pos;
|
||
let ident = this.input.slice(next, pos);
|
||
if (!_identifier.keywordRelationalOperator.test(ident)) return true;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// check 'async [no LineTerminator here] function'
|
||
// - 'async /*foo*/ function' is OK.
|
||
// - 'async /*\n*/ function' is invalid.
|
||
pp.isAsyncFunction = function () {
|
||
if (this.options.ecmaVersion < 8 || !this.isContextual("async")) return false;
|
||
|
||
_whitespace.skipWhiteSpace.lastIndex = this.pos;
|
||
let skip = _whitespace.skipWhiteSpace.exec(this.input);
|
||
let next = this.pos + skip[0].length;
|
||
return !_whitespace.lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(0, _identifier.isIdentifierChar)(this.input.charAt(next + 8)));
|
||
};
|
||
|
||
// Parse a single statement.
|
||
//
|
||
// If expecting a statement and finding a slash operator, parse a
|
||
// regular expression literal. This is to handle cases like
|
||
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
||
// does not help.
|
||
|
||
pp.parseStatement = function (context, topLevel, exports) {
|
||
let starttype = this.type,
|
||
node = this.startNode(),
|
||
kind;
|
||
|
||
if (this.isLet(context)) {
|
||
starttype = _tokentype.types._var;
|
||
kind = "let";
|
||
}
|
||
|
||
// Most types of statements are recognized by the keyword they
|
||
// start with. Many are trivial to parse, some require a bit of
|
||
// complexity.
|
||
|
||
switch (starttype) {
|
||
case _tokentype.types._break:case _tokentype.types._continue:
|
||
return this.parseBreakContinueStatement(node, starttype.keyword);
|
||
case _tokentype.types._debugger:
|
||
return this.parseDebuggerStatement(node);
|
||
case _tokentype.types._do:
|
||
return this.parseDoStatement(node);
|
||
case _tokentype.types._for:
|
||
return this.parseForStatement(node);
|
||
case _tokentype.types._function:
|
||
// Function as sole body of either an if statement or a labeled statement
|
||
// works, but not when it is part of a labeled statement that is the sole
|
||
// body of an if statement.
|
||
if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) this.unexpected();
|
||
return this.parseFunctionStatement(node, false, !context);
|
||
case _tokentype.types._class:
|
||
if (context) this.unexpected();
|
||
return this.parseClass(node, true);
|
||
case _tokentype.types._if:
|
||
return this.parseIfStatement(node);
|
||
case _tokentype.types._return:
|
||
return this.parseReturnStatement(node);
|
||
case _tokentype.types._switch:
|
||
return this.parseSwitchStatement(node);
|
||
case _tokentype.types._throw:
|
||
return this.parseThrowStatement(node);
|
||
case _tokentype.types._try:
|
||
return this.parseTryStatement(node);
|
||
case _tokentype.types._const:case _tokentype.types._var:
|
||
kind = kind || this.value;
|
||
if (context && kind !== "var") this.unexpected();
|
||
return this.parseVarStatement(node, kind);
|
||
case _tokentype.types._while:
|
||
return this.parseWhileStatement(node);
|
||
case _tokentype.types._with:
|
||
return this.parseWithStatement(node);
|
||
case _tokentype.types.braceL:
|
||
return this.parseBlock(true, node);
|
||
case _tokentype.types.semi:
|
||
return this.parseEmptyStatement(node);
|
||
case _tokentype.types._export:
|
||
case _tokentype.types._import:
|
||
if (this.options.ecmaVersion > 10 && starttype === _tokentype.types._import) {
|
||
_whitespace.skipWhiteSpace.lastIndex = this.pos;
|
||
let skip = _whitespace.skipWhiteSpace.exec(this.input);
|
||
let next = this.pos + skip[0].length,
|
||
nextCh = this.input.charCodeAt(next);
|
||
if (nextCh === 40 || nextCh === 46) // '(' or '.'
|
||
return this.parseExpressionStatement(node, this.parseExpression());
|
||
}
|
||
|
||
if (!this.options.allowImportExportEverywhere) {
|
||
if (!topLevel) this.raise(this.start, "'import' and 'export' may only appear at the top level");
|
||
if (!this.inModule) this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
|
||
}
|
||
return starttype === _tokentype.types._import ? this.parseImport(node) : this.parseExport(node, exports);
|
||
|
||
// If the statement does not start with a statement keyword or a
|
||
// brace, it's an ExpressionStatement or LabeledStatement. We
|
||
// simply start parsing an expression, and afterwards, if the
|
||
// next token is a colon and the expression was a simple
|
||
// Identifier node, we switch to interpreting it as a label.
|
||
default:
|
||
if (this.isAsyncFunction()) {
|
||
if (context) this.unexpected();
|
||
this.next();
|
||
return this.parseFunctionStatement(node, true, !context);
|
||
}
|
||
|
||
let maybeName = this.value,
|
||
expr = this.parseExpression();
|
||
if (starttype === _tokentype.types.name && expr.type === "Identifier" && this.eat(_tokentype.types.colon)) return this.parseLabeledStatement(node, maybeName, expr, context);else return this.parseExpressionStatement(node, expr);
|
||
}
|
||
};
|
||
|
||
pp.parseBreakContinueStatement = function (node, keyword) {
|
||
let isBreak = keyword === "break";
|
||
this.next();
|
||
if (this.eat(_tokentype.types.semi) || this.insertSemicolon()) node.label = null;else if (this.type !== _tokentype.types.name) this.unexpected();else {
|
||
node.label = this.parseIdent();
|
||
this.semicolon();
|
||
}
|
||
|
||
// Verify that there is an actual destination to break or
|
||
// continue to.
|
||
let i = 0;
|
||
for (; i < this.labels.length; ++i) {
|
||
let lab = this.labels[i];
|
||
if (node.label == null || lab.name === node.label.name) {
|
||
if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
|
||
if (node.label && isBreak) break;
|
||
}
|
||
}
|
||
if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword);
|
||
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
|
||
};
|
||
|
||
pp.parseDebuggerStatement = function (node) {
|
||
this.next();
|
||
this.semicolon();
|
||
return this.finishNode(node, "DebuggerStatement");
|
||
};
|
||
|
||
pp.parseDoStatement = function (node) {
|
||
this.next();
|
||
this.labels.push(loopLabel);
|
||
node.body = this.parseStatement("do");
|
||
this.labels.pop();
|
||
this.expect(_tokentype.types._while);
|
||
node.test = this.parseParenExpression();
|
||
if (this.options.ecmaVersion >= 6) this.eat(_tokentype.types.semi);else this.semicolon();
|
||
return this.finishNode(node, "DoWhileStatement");
|
||
};
|
||
|
||
// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
|
||
// loop is non-trivial. Basically, we have to parse the init `var`
|
||
// statement or expression, disallowing the `in` operator (see
|
||
// the second parameter to `parseExpression`), and then check
|
||
// whether the next token is `in` or `of`. When there is no init
|
||
// part (semicolon immediately after the opening parenthesis), it
|
||
// is a regular `for` loop.
|
||
|
||
pp.parseForStatement = function (node) {
|
||
this.next();
|
||
let awaitAt = this.options.ecmaVersion >= 9 && (this.inAsync || !this.inFunction && this.options.allowAwaitOutsideFunction) && this.eatContextual("await") ? this.lastTokStart : -1;
|
||
this.labels.push(loopLabel);
|
||
this.enterScope(0);
|
||
this.expect(_tokentype.types.parenL);
|
||
if (this.type === _tokentype.types.semi) {
|
||
if (awaitAt > -1) this.unexpected(awaitAt);
|
||
return this.parseFor(node, null);
|
||
}
|
||
let isLet = this.isLet();
|
||
if (this.type === _tokentype.types._var || this.type === _tokentype.types._const || isLet) {
|
||
let init = this.startNode(),
|
||
kind = isLet ? "let" : this.value;
|
||
this.next();
|
||
this.parseVar(init, true, kind);
|
||
this.finishNode(init, "VariableDeclaration");
|
||
if ((this.type === _tokentype.types._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init.declarations.length === 1) {
|
||
if (this.options.ecmaVersion >= 9) {
|
||
if (this.type === _tokentype.types._in) {
|
||
if (awaitAt > -1) this.unexpected(awaitAt);
|
||
} else node.await = awaitAt > -1;
|
||
}
|
||
return this.parseForIn(node, init);
|
||
}
|
||
if (awaitAt > -1) this.unexpected(awaitAt);
|
||
return this.parseFor(node, init);
|
||
}
|
||
let refDestructuringErrors = new _parseutil.DestructuringErrors();
|
||
let init = this.parseExpression(true, refDestructuringErrors);
|
||
if (this.type === _tokentype.types._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) {
|
||
if (this.options.ecmaVersion >= 9) {
|
||
if (this.type === _tokentype.types._in) {
|
||
if (awaitAt > -1) this.unexpected(awaitAt);
|
||
} else node.await = awaitAt > -1;
|
||
}
|
||
this.toAssignable(init, false, refDestructuringErrors);
|
||
this.checkLValPattern(init);
|
||
return this.parseForIn(node, init);
|
||
} else {
|
||
this.checkExpressionErrors(refDestructuringErrors, true);
|
||
}
|
||
if (awaitAt > -1) this.unexpected(awaitAt);
|
||
return this.parseFor(node, init);
|
||
};
|
||
|
||
pp.parseFunctionStatement = function (node, isAsync, declarationPosition) {
|
||
this.next();
|
||
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
|
||
};
|
||
|
||
pp.parseIfStatement = function (node) {
|
||
this.next();
|
||
node.test = this.parseParenExpression();
|
||
// allow function declarations in branches, but only in non-strict mode
|
||
node.consequent = this.parseStatement("if");
|
||
node.alternate = this.eat(_tokentype.types._else) ? this.parseStatement("if") : null;
|
||
return this.finishNode(node, "IfStatement");
|
||
};
|
||
|
||
pp.parseReturnStatement = function (node) {
|
||
if (!this.inFunction && !this.options.allowReturnOutsideFunction) this.raise(this.start, "'return' outside of function");
|
||
this.next();
|
||
|
||
// In `return` (and `break`/`continue`), the keywords with
|
||
// optional arguments, we eagerly look for a semicolon or the
|
||
// possibility to insert one.
|
||
|
||
if (this.eat(_tokentype.types.semi) || this.insertSemicolon()) node.argument = null;else {
|
||
node.argument = this.parseExpression();this.semicolon();
|
||
}
|
||
return this.finishNode(node, "ReturnStatement");
|
||
};
|
||
|
||
pp.parseSwitchStatement = function (node) {
|
||
this.next();
|
||
node.discriminant = this.parseParenExpression();
|
||
node.cases = [];
|
||
this.expect(_tokentype.types.braceL);
|
||
this.labels.push(switchLabel);
|
||
this.enterScope(0);
|
||
|
||
// Statements under must be grouped (by label) in SwitchCase
|
||
// nodes. `cur` is used to keep the node that we are currently
|
||
// adding statements to.
|
||
|
||
let cur;
|
||
for (let sawDefault = false; this.type !== _tokentype.types.braceR;) {
|
||
if (this.type === _tokentype.types._case || this.type === _tokentype.types._default) {
|
||
let isCase = this.type === _tokentype.types._case;
|
||
if (cur) this.finishNode(cur, "SwitchCase");
|
||
node.cases.push(cur = this.startNode());
|
||
cur.consequent = [];
|
||
this.next();
|
||
if (isCase) {
|
||
cur.test = this.parseExpression();
|
||
} else {
|
||
if (sawDefault) this.raiseRecoverable(this.lastTokStart, "Multiple default clauses");
|
||
sawDefault = true;
|
||
cur.test = null;
|
||
}
|
||
this.expect(_tokentype.types.colon);
|
||
} else {
|
||
if (!cur) this.unexpected();
|
||
cur.consequent.push(this.parseStatement(null));
|
||
}
|
||
}
|
||
this.exitScope();
|
||
if (cur) this.finishNode(cur, "SwitchCase");
|
||
this.next(); // Closing brace
|
||
this.labels.pop();
|
||
return this.finishNode(node, "SwitchStatement");
|
||
};
|
||
|
||
pp.parseThrowStatement = function (node) {
|
||
this.next();
|
||
if (_whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) this.raise(this.lastTokEnd, "Illegal newline after throw");
|
||
node.argument = this.parseExpression();
|
||
this.semicolon();
|
||
return this.finishNode(node, "ThrowStatement");
|
||
};
|
||
|
||
// Reused empty array added for node fields that are always empty.
|
||
|
||
const empty = [];
|
||
|
||
pp.parseTryStatement = function (node) {
|
||
this.next();
|
||
node.block = this.parseBlock();
|
||
node.handler = null;
|
||
if (this.type === _tokentype.types._catch) {
|
||
let clause = this.startNode();
|
||
this.next();
|
||
if (this.eat(_tokentype.types.parenL)) {
|
||
clause.param = this.parseBindingAtom();
|
||
let simple = clause.param.type === "Identifier";
|
||
this.enterScope(simple ? _scopeflags.SCOPE_SIMPLE_CATCH : 0);
|
||
this.checkLValPattern(clause.param, simple ? _scopeflags.BIND_SIMPLE_CATCH : _scopeflags.BIND_LEXICAL);
|
||
this.expect(_tokentype.types.parenR);
|
||
} else {
|
||
if (this.options.ecmaVersion < 10) this.unexpected();
|
||
clause.param = null;
|
||
this.enterScope(0);
|
||
}
|
||
clause.body = this.parseBlock(false);
|
||
this.exitScope();
|
||
node.handler = this.finishNode(clause, "CatchClause");
|
||
}
|
||
node.finalizer = this.eat(_tokentype.types._finally) ? this.parseBlock() : null;
|
||
if (!node.handler && !node.finalizer) this.raise(node.start, "Missing catch or finally clause");
|
||
return this.finishNode(node, "TryStatement");
|
||
};
|
||
|
||
pp.parseVarStatement = function (node, kind) {
|
||
this.next();
|
||
this.parseVar(node, false, kind);
|
||
this.semicolon();
|
||
return this.finishNode(node, "VariableDeclaration");
|
||
};
|
||
|
||
pp.parseWhileStatement = function (node) {
|
||
this.next();
|
||
node.test = this.parseParenExpression();
|
||
this.labels.push(loopLabel);
|
||
node.body = this.parseStatement("while");
|
||
this.labels.pop();
|
||
return this.finishNode(node, "WhileStatement");
|
||
};
|
||
|
||
pp.parseWithStatement = function (node) {
|
||
if (this.strict) this.raise(this.start, "'with' in strict mode");
|
||
this.next();
|
||
node.object = this.parseParenExpression();
|
||
node.body = this.parseStatement("with");
|
||
return this.finishNode(node, "WithStatement");
|
||
};
|
||
|
||
pp.parseEmptyStatement = function (node) {
|
||
this.next();
|
||
return this.finishNode(node, "EmptyStatement");
|
||
};
|
||
|
||
pp.parseLabeledStatement = function (node, maybeName, expr, context) {
|
||
for (var _iterator2 = this.labels, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
||
var _ref2;
|
||
|
||
if (_isArray2) {
|
||
if (_i2 >= _iterator2.length) break;
|
||
_ref2 = _iterator2[_i2++];
|
||
} else {
|
||
_i2 = _iterator2.next();
|
||
if (_i2.done) break;
|
||
_ref2 = _i2.value;
|
||
}
|
||
|
||
let label = _ref2;
|
||
|
||
if (label.name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
||
}let kind = this.type.isLoop ? "loop" : this.type === _tokentype.types._switch ? "switch" : null;
|
||
for (let i = this.labels.length - 1; i >= 0; i--) {
|
||
let label = this.labels[i];
|
||
if (label.statementStart === node.start) {
|
||
// Update information about previous labels on this node
|
||
label.statementStart = this.start;
|
||
label.kind = kind;
|
||
} else break;
|
||
}
|
||
this.labels.push({ name: maybeName, kind, statementStart: this.start });
|
||
node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
|
||
this.labels.pop();
|
||
node.label = expr;
|
||
return this.finishNode(node, "LabeledStatement");
|
||
};
|
||
|
||
pp.parseExpressionStatement = function (node, expr) {
|
||
node.expression = expr;
|
||
this.semicolon();
|
||
return this.finishNode(node, "ExpressionStatement");
|
||
};
|
||
|
||
// Parse a semicolon-enclosed block of statements, handling `"use
|
||
// strict"` declarations when `allowStrict` is true (used for
|
||
// function bodies).
|
||
|
||
pp.parseBlock = function (createNewLexicalScope = true, node = this.startNode(), exitStrict) {
|
||
node.body = [];
|
||
this.expect(_tokentype.types.braceL);
|
||
if (createNewLexicalScope) this.enterScope(0);
|
||
while (this.type !== _tokentype.types.braceR) {
|
||
let stmt = this.parseStatement(null);
|
||
node.body.push(stmt);
|
||
}
|
||
if (exitStrict) this.strict = false;
|
||
this.next();
|
||
if (createNewLexicalScope) this.exitScope();
|
||
return this.finishNode(node, "BlockStatement");
|
||
};
|
||
|
||
// Parse a regular `for` loop. The disambiguation code in
|
||
// `parseStatement` will already have parsed the init statement or
|
||
// expression.
|
||
|
||
pp.parseFor = function (node, init) {
|
||
node.init = init;
|
||
this.expect(_tokentype.types.semi);
|
||
node.test = this.type === _tokentype.types.semi ? null : this.parseExpression();
|
||
this.expect(_tokentype.types.semi);
|
||
node.update = this.type === _tokentype.types.parenR ? null : this.parseExpression();
|
||
this.expect(_tokentype.types.parenR);
|
||
node.body = this.parseStatement("for");
|
||
this.exitScope();
|
||
this.labels.pop();
|
||
return this.finishNode(node, "ForStatement");
|
||
};
|
||
|
||
// Parse a `for`/`in` and `for`/`of` loop, which are almost
|
||
// same from parser's perspective.
|
||
|
||
pp.parseForIn = function (node, init) {
|
||
const isForIn = this.type === _tokentype.types._in;
|
||
this.next();
|
||
|
||
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
|
||
this.raise(init.start, `${isForIn ? "for-in" : "for-of"} loop variable declaration may not have an initializer`);
|
||
}
|
||
node.left = init;
|
||
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
||
this.expect(_tokentype.types.parenR);
|
||
node.body = this.parseStatement("for");
|
||
this.exitScope();
|
||
this.labels.pop();
|
||
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
|
||
};
|
||
|
||
// Parse a list of variable declarations.
|
||
|
||
pp.parseVar = function (node, isFor, kind) {
|
||
node.declarations = [];
|
||
node.kind = kind;
|
||
for (;;) {
|
||
let decl = this.startNode();
|
||
this.parseVarId(decl, kind);
|
||
if (this.eat(_tokentype.types.eq)) {
|
||
decl.init = this.parseMaybeAssign(isFor);
|
||
} else if (kind === "const" && !(this.type === _tokentype.types._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
||
this.unexpected();
|
||
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === _tokentype.types._in || this.isContextual("of")))) {
|
||
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
||
} else {
|
||
decl.init = null;
|
||
}
|
||
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
||
if (!this.eat(_tokentype.types.comma)) break;
|
||
}
|
||
return node;
|
||
};
|
||
|
||
pp.parseVarId = function (decl, kind) {
|
||
decl.id = this.parseBindingAtom();
|
||
this.checkLValPattern(decl.id, kind === "var" ? _scopeflags.BIND_VAR : _scopeflags.BIND_LEXICAL, false);
|
||
};
|
||
|
||
const FUNC_STATEMENT = 1,
|
||
FUNC_HANGING_STATEMENT = 2,
|
||
FUNC_NULLABLE_ID = 4;
|
||
|
||
// Parse a function declaration or literal (depending on the
|
||
// `statement & FUNC_STATEMENT`).
|
||
|
||
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
|
||
pp.parseFunction = function (node, statement, allowExpressionBody, isAsync) {
|
||
this.initFunction(node);
|
||
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
||
if (this.type === _tokentype.types.star && statement & FUNC_HANGING_STATEMENT) this.unexpected();
|
||
node.generator = this.eat(_tokentype.types.star);
|
||
}
|
||
if (this.options.ecmaVersion >= 8) node.async = !!isAsync;
|
||
|
||
if (statement & FUNC_STATEMENT) {
|
||
node.id = statement & FUNC_NULLABLE_ID && this.type !== _tokentype.types.name ? null : this.parseIdent();
|
||
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
|
||
// If it is a regular function declaration in sloppy mode, then it is
|
||
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
|
||
// mode depends on properties of the current scope (see
|
||
// treatFunctionsAsVar).
|
||
this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? _scopeflags.BIND_VAR : _scopeflags.BIND_LEXICAL : _scopeflags.BIND_FUNCTION);
|
||
}
|
||
|
||
let oldYieldPos = this.yieldPos,
|
||
oldAwaitPos = this.awaitPos,
|
||
oldAwaitIdentPos = this.awaitIdentPos;
|
||
this.yieldPos = 0;
|
||
this.awaitPos = 0;
|
||
this.awaitIdentPos = 0;
|
||
this.enterScope((0, _scopeflags.functionFlags)(node.async, node.generator));
|
||
|
||
if (!(statement & FUNC_STATEMENT)) node.id = this.type === _tokentype.types.name ? this.parseIdent() : null;
|
||
|
||
this.parseFunctionParams(node);
|
||
this.parseFunctionBody(node, allowExpressionBody, false);
|
||
|
||
this.yieldPos = oldYieldPos;
|
||
this.awaitPos = oldAwaitPos;
|
||
this.awaitIdentPos = oldAwaitIdentPos;
|
||
return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression");
|
||
};
|
||
|
||
pp.parseFunctionParams = function (node) {
|
||
this.expect(_tokentype.types.parenL);
|
||
node.params = this.parseBindingList(_tokentype.types.parenR, false, this.options.ecmaVersion >= 8);
|
||
this.checkYieldAwaitInDefaultParams();
|
||
};
|
||
|
||
// Parse a class declaration or literal (depending on the
|
||
// `isStatement` parameter).
|
||
|
||
pp.parseClass = function (node, isStatement) {
|
||
this.next();
|
||
|
||
// ecma-262 14.6 Class Definitions
|
||
// A class definition is always strict mode code.
|
||
const oldStrict = this.strict;
|
||
this.strict = true;
|
||
|
||
this.parseClassId(node, isStatement);
|
||
this.parseClassSuper(node);
|
||
let classBody = this.startNode();
|
||
let hadConstructor = false;
|
||
classBody.body = [];
|
||
this.expect(_tokentype.types.braceL);
|
||
while (this.type !== _tokentype.types.braceR) {
|
||
const element = this.parseClassElement(node.superClass !== null);
|
||
if (element) {
|
||
classBody.body.push(element);
|
||
if (element.type === "MethodDefinition" && element.kind === "constructor") {
|
||
if (hadConstructor) this.raise(element.start, "Duplicate constructor in the same class");
|
||
hadConstructor = true;
|
||
}
|
||
}
|
||
}
|
||
this.strict = oldStrict;
|
||
this.next();
|
||
node.body = this.finishNode(classBody, "ClassBody");
|
||
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
|
||
};
|
||
|
||
pp.parseClassElement = function (constructorAllowsSuper) {
|
||
if (this.eat(_tokentype.types.semi)) return null;
|
||
|
||
let method = this.startNode();
|
||
const tryContextual = (k, noLineBreak = false) => {
|
||
const start = this.start,
|
||
startLoc = this.startLoc;
|
||
if (!this.eatContextual(k)) return false;
|
||
if (this.type !== _tokentype.types.parenL && (!noLineBreak || !this.canInsertSemicolon())) return true;
|
||
if (method.key) this.unexpected();
|
||
method.computed = false;
|
||
method.key = this.startNodeAt(start, startLoc);
|
||
method.key.name = k;
|
||
this.finishNode(method.key, "Identifier");
|
||
return false;
|
||
};
|
||
|
||
method.kind = "method";
|
||
method.static = tryContextual("static");
|
||
let isGenerator = this.eat(_tokentype.types.star);
|
||
let isAsync = false;
|
||
if (!isGenerator) {
|
||
if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) {
|
||
isAsync = true;
|
||
isGenerator = this.options.ecmaVersion >= 9 && this.eat(_tokentype.types.star);
|
||
} else if (tryContextual("get")) {
|
||
method.kind = "get";
|
||
} else if (tryContextual("set")) {
|
||
method.kind = "set";
|
||
}
|
||
}
|
||
if (!method.key) this.parsePropertyName(method);
|
||
let key = method.key;
|
||
|
||
let allowsDirectSuper = false;
|
||
if (!method.computed && !method.static && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) {
|
||
if (method.kind !== "method") this.raise(key.start, "Constructor can't have get/set modifier");
|
||
if (isGenerator) this.raise(key.start, "Constructor can't be a generator");
|
||
if (isAsync) this.raise(key.start, "Constructor can't be an async method");
|
||
method.kind = "constructor";
|
||
allowsDirectSuper = constructorAllowsSuper;
|
||
} else if (method.static && key.type === "Identifier" && key.name === "prototype") {
|
||
this.raise(key.start, "Classes may not have a static property named prototype");
|
||
}
|
||
this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper);
|
||
if (method.kind === "get" && method.value.params.length !== 0) this.raiseRecoverable(method.value.start, "getter should have no params");
|
||
if (method.kind === "set" && method.value.params.length !== 1) this.raiseRecoverable(method.value.start, "setter should have exactly one param");
|
||
if (method.kind === "set" && method.value.params[0].type === "RestElement") this.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params");
|
||
return method;
|
||
};
|
||
|
||
pp.parseClassMethod = function (method, isGenerator, isAsync, allowsDirectSuper) {
|
||
method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
|
||
return this.finishNode(method, "MethodDefinition");
|
||
};
|
||
|
||
pp.parseClassId = function (node, isStatement) {
|
||
if (this.type === _tokentype.types.name) {
|
||
node.id = this.parseIdent();
|
||
if (isStatement) this.checkLValSimple(node.id, _scopeflags.BIND_LEXICAL, false);
|
||
} else {
|
||
if (isStatement === true) this.unexpected();
|
||
node.id = null;
|
||
}
|
||
};
|
||
|
||
pp.parseClassSuper = function (node) {
|
||
node.superClass = this.eat(_tokentype.types._extends) ? this.parseExprSubscripts() : null;
|
||
};
|
||
|
||
// Parses module export declaration.
|
||
|
||
pp.parseExport = function (node, exports) {
|
||
this.next();
|
||
// export * from '...'
|
||
if (this.eat(_tokentype.types.star)) {
|
||
if (this.options.ecmaVersion >= 11) {
|
||
if (this.eatContextual("as")) {
|
||
node.exported = this.parseIdent(true);
|
||
this.checkExport(exports, node.exported.name, this.lastTokStart);
|
||
} else {
|
||
node.exported = null;
|
||
}
|
||
}
|
||
this.expectContextual("from");
|
||
if (this.type !== _tokentype.types.string) this.unexpected();
|
||
node.source = this.parseExprAtom();
|
||
this.semicolon();
|
||
return this.finishNode(node, "ExportAllDeclaration");
|
||
}
|
||
if (this.eat(_tokentype.types._default)) {
|
||
// export default ...
|
||
this.checkExport(exports, "default", this.lastTokStart);
|
||
let isAsync;
|
||
if (this.type === _tokentype.types._function || (isAsync = this.isAsyncFunction())) {
|
||
let fNode = this.startNode();
|
||
this.next();
|
||
if (isAsync) this.next();
|
||
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
||
} else if (this.type === _tokentype.types._class) {
|
||
let cNode = this.startNode();
|
||
node.declaration = this.parseClass(cNode, "nullableID");
|
||
} else {
|
||
node.declaration = this.parseMaybeAssign();
|
||
this.semicolon();
|
||
}
|
||
return this.finishNode(node, "ExportDefaultDeclaration");
|
||
}
|
||
// export var|const|let|function|class ...
|
||
if (this.shouldParseExportStatement()) {
|
||
node.declaration = this.parseStatement(null);
|
||
if (node.declaration.type === "VariableDeclaration") this.checkVariableExport(exports, node.declaration.declarations);else this.checkExport(exports, node.declaration.id.name, node.declaration.id.start);
|
||
node.specifiers = [];
|
||
node.source = null;
|
||
} else {
|
||
// export { x, y as z } [from '...']
|
||
node.declaration = null;
|
||
node.specifiers = this.parseExportSpecifiers(exports);
|
||
if (this.eatContextual("from")) {
|
||
if (this.type !== _tokentype.types.string) this.unexpected();
|
||
node.source = this.parseExprAtom();
|
||
} else {
|
||
for (var _iterator3 = node.specifiers, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
|
||
var _ref3;
|
||
|
||
if (_isArray3) {
|
||
if (_i3 >= _iterator3.length) break;
|
||
_ref3 = _iterator3[_i3++];
|
||
} else {
|
||
_i3 = _iterator3.next();
|
||
if (_i3.done) break;
|
||
_ref3 = _i3.value;
|
||
}
|
||
|
||
let spec = _ref3;
|
||
|
||
// check for keywords used as local names
|
||
this.checkUnreserved(spec.local);
|
||
// check if export is defined
|
||
this.checkLocalExport(spec.local);
|
||
}
|
||
|
||
node.source = null;
|
||
}
|
||
this.semicolon();
|
||
}
|
||
return this.finishNode(node, "ExportNamedDeclaration");
|
||
};
|
||
|
||
pp.checkExport = function (exports, name, pos) {
|
||
if (!exports) return;
|
||
if ((0, _util.has)(exports, name)) this.raiseRecoverable(pos, "Duplicate export '" + name + "'");
|
||
exports[name] = true;
|
||
};
|
||
|
||
pp.checkPatternExport = function (exports, pat) {
|
||
let type = pat.type;
|
||
if (type === "Identifier") this.checkExport(exports, pat.name, pat.start);else if (type === "ObjectPattern") {
|
||
for (var _iterator4 = pat.properties, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
|
||
var _ref4;
|
||
|
||
if (_isArray4) {
|
||
if (_i4 >= _iterator4.length) break;
|
||
_ref4 = _iterator4[_i4++];
|
||
} else {
|
||
_i4 = _iterator4.next();
|
||
if (_i4.done) break;
|
||
_ref4 = _i4.value;
|
||
}
|
||
|
||
let prop = _ref4;
|
||
|
||
this.checkPatternExport(exports, prop);
|
||
}
|
||
} else if (type === "ArrayPattern") {
|
||
for (var _iterator5 = pat.elements, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
|
||
var _ref5;
|
||
|
||
if (_isArray5) {
|
||
if (_i5 >= _iterator5.length) break;
|
||
_ref5 = _iterator5[_i5++];
|
||
} else {
|
||
_i5 = _iterator5.next();
|
||
if (_i5.done) break;
|
||
_ref5 = _i5.value;
|
||
}
|
||
|
||
let elt = _ref5;
|
||
|
||
if (elt) this.checkPatternExport(exports, elt);
|
||
}
|
||
} else if (type === "Property") this.checkPatternExport(exports, pat.value);else if (type === "AssignmentPattern") this.checkPatternExport(exports, pat.left);else if (type === "RestElement") this.checkPatternExport(exports, pat.argument);else if (type === "ParenthesizedExpression") this.checkPatternExport(exports, pat.expression);
|
||
};
|
||
|
||
pp.checkVariableExport = function (exports, decls) {
|
||
if (!exports) return;
|
||
for (var _iterator6 = decls, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
|
||
var _ref6;
|
||
|
||
if (_isArray6) {
|
||
if (_i6 >= _iterator6.length) break;
|
||
_ref6 = _iterator6[_i6++];
|
||
} else {
|
||
_i6 = _iterator6.next();
|
||
if (_i6.done) break;
|
||
_ref6 = _i6.value;
|
||
}
|
||
|
||
let decl = _ref6;
|
||
|
||
this.checkPatternExport(exports, decl.id);
|
||
}
|
||
};
|
||
|
||
pp.shouldParseExportStatement = function () {
|
||
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
|
||
};
|
||
|
||
// Parses a comma-separated list of module exports.
|
||
|
||
pp.parseExportSpecifiers = function (exports) {
|
||
let nodes = [],
|
||
first = true;
|
||
// export { x, y as z } [from '...']
|
||
this.expect(_tokentype.types.braceL);
|
||
while (!this.eat(_tokentype.types.braceR)) {
|
||
if (!first) {
|
||
this.expect(_tokentype.types.comma);
|
||
if (this.afterTrailingComma(_tokentype.types.braceR)) break;
|
||
} else first = false;
|
||
|
||
let node = this.startNode();
|
||
node.local = this.parseIdent(true);
|
||
node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local;
|
||
this.checkExport(exports, node.exported.name, node.exported.start);
|
||
nodes.push(this.finishNode(node, "ExportSpecifier"));
|
||
}
|
||
return nodes;
|
||
};
|
||
|
||
// Parses import declaration.
|
||
|
||
pp.parseImport = function (node) {
|
||
this.next();
|
||
// import '...'
|
||
if (this.type === _tokentype.types.string) {
|
||
node.specifiers = empty;
|
||
node.source = this.parseExprAtom();
|
||
} else {
|
||
node.specifiers = this.parseImportSpecifiers();
|
||
this.expectContextual("from");
|
||
node.source = this.type === _tokentype.types.string ? this.parseExprAtom() : this.unexpected();
|
||
}
|
||
this.semicolon();
|
||
return this.finishNode(node, "ImportDeclaration");
|
||
};
|
||
|
||
// Parses a comma-separated list of module imports.
|
||
|
||
pp.parseImportSpecifiers = function () {
|
||
let nodes = [],
|
||
first = true;
|
||
if (this.type === _tokentype.types.name) {
|
||
// import defaultObj, { x, y as z } from '...'
|
||
let node = this.startNode();
|
||
node.local = this.parseIdent();
|
||
this.checkLValSimple(node.local, _scopeflags.BIND_LEXICAL);
|
||
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
||
if (!this.eat(_tokentype.types.comma)) return nodes;
|
||
}
|
||
if (this.type === _tokentype.types.star) {
|
||
let node = this.startNode();
|
||
this.next();
|
||
this.expectContextual("as");
|
||
node.local = this.parseIdent();
|
||
this.checkLValSimple(node.local, _scopeflags.BIND_LEXICAL);
|
||
nodes.push(this.finishNode(node, "ImportNamespaceSpecifier"));
|
||
return nodes;
|
||
}
|
||
this.expect(_tokentype.types.braceL);
|
||
while (!this.eat(_tokentype.types.braceR)) {
|
||
if (!first) {
|
||
this.expect(_tokentype.types.comma);
|
||
if (this.afterTrailingComma(_tokentype.types.braceR)) break;
|
||
} else first = false;
|
||
|
||
let node = this.startNode();
|
||
node.imported = this.parseIdent(true);
|
||
if (this.eatContextual("as")) {
|
||
node.local = this.parseIdent();
|
||
} else {
|
||
this.checkUnreserved(node.imported);
|
||
node.local = node.imported;
|
||
}
|
||
this.checkLValSimple(node.local, _scopeflags.BIND_LEXICAL);
|
||
nodes.push(this.finishNode(node, "ImportSpecifier"));
|
||
}
|
||
return nodes;
|
||
};
|
||
|
||
// Set `ExpressionStatement#directive` property for directive prologues.
|
||
pp.adaptDirectivePrologue = function (statements) {
|
||
for (let i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
||
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
||
}
|
||
};
|
||
pp.isDirectiveCandidate = function (statement) {
|
||
return statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && (
|
||
// Reject parenthesized strings.
|
||
this.input[statement.start] === "\"" || this.input[statement.start] === "'");
|
||
};
|
||
|
||
/***/ }),
|
||
/* 171 */
|
||
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _tokentype = __webpack_require__(163);
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
var _util = __webpack_require__(166);
|
||
|
||
var _scopeflags = __webpack_require__(168);
|
||
|
||
const pp = _state.Parser.prototype;
|
||
|
||
// Convert existing expression atom to assignable pattern
|
||
// if possible.
|
||
|
||
pp.toAssignable = function (node, isBinding, refDestructuringErrors) {
|
||
if (this.options.ecmaVersion >= 6 && node) {
|
||
switch (node.type) {
|
||
case "Identifier":
|
||
if (this.inAsync && node.name === "await") this.raise(node.start, "Cannot use 'await' as identifier inside an async function");
|
||
break;
|
||
|
||
case "ObjectPattern":
|
||
case "ArrayPattern":
|
||
case "AssignmentPattern":
|
||
case "RestElement":
|
||
break;
|
||
|
||
case "ObjectExpression":
|
||
node.type = "ObjectPattern";
|
||
if (refDestructuringErrors) this.checkPatternErrors(refDestructuringErrors, true);
|
||
for (var _iterator = node.properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||
var _ref;
|
||
|
||
if (_isArray) {
|
||
if (_i >= _iterator.length) break;
|
||
_ref = _iterator[_i++];
|
||
} else {
|
||
_i = _iterator.next();
|
||
if (_i.done) break;
|
||
_ref = _i.value;
|
||
}
|
||
|
||
let prop = _ref;
|
||
|
||
this.toAssignable(prop, isBinding);
|
||
// Early error:
|
||
// AssignmentRestProperty[Yield, Await] :
|
||
// `...` DestructuringAssignmentTarget[Yield, Await]
|
||
//
|
||
// It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
|
||
if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) {
|
||
this.raise(prop.argument.start, "Unexpected token");
|
||
}
|
||
}
|
||
break;
|
||
|
||
case "Property":
|
||
// AssignmentProperty has type === "Property"
|
||
if (node.kind !== "init") this.raise(node.key.start, "Object pattern can't contain getter or setter");
|
||
this.toAssignable(node.value, isBinding);
|
||
break;
|
||
|
||
case "ArrayExpression":
|
||
node.type = "ArrayPattern";
|
||
if (refDestructuringErrors) this.checkPatternErrors(refDestructuringErrors, true);
|
||
this.toAssignableList(node.elements, isBinding);
|
||
break;
|
||
|
||
case "SpreadElement":
|
||
node.type = "RestElement";
|
||
this.toAssignable(node.argument, isBinding);
|
||
if (node.argument.type === "AssignmentPattern") this.raise(node.argument.start, "Rest elements cannot have a default value");
|
||
break;
|
||
|
||
case "AssignmentExpression":
|
||
if (node.operator !== "=") this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
|
||
node.type = "AssignmentPattern";
|
||
delete node.operator;
|
||
this.toAssignable(node.left, isBinding);
|
||
break;
|
||
|
||
case "ParenthesizedExpression":
|
||
this.toAssignable(node.expression, isBinding, refDestructuringErrors);
|
||
break;
|
||
|
||
case "ChainExpression":
|
||
this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
|
||
break;
|
||
|
||
case "MemberExpression":
|
||
if (!isBinding) break;
|
||
|
||
default:
|
||
this.raise(node.start, "Assigning to rvalue");
|
||
}
|
||
} else if (refDestructuringErrors) this.checkPatternErrors(refDestructuringErrors, true);
|
||
return node;
|
||
};
|
||
|
||
// Convert list of expression atoms to binding list.
|
||
|
||
pp.toAssignableList = function (exprList, isBinding) {
|
||
let end = exprList.length;
|
||
for (let i = 0; i < end; i++) {
|
||
let elt = exprList[i];
|
||
if (elt) this.toAssignable(elt, isBinding);
|
||
}
|
||
if (end) {
|
||
let last = exprList[end - 1];
|
||
if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") this.unexpected(last.argument.start);
|
||
}
|
||
return exprList;
|
||
};
|
||
|
||
// Parses spread element.
|
||
|
||
pp.parseSpread = function (refDestructuringErrors) {
|
||
let node = this.startNode();
|
||
this.next();
|
||
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
||
return this.finishNode(node, "SpreadElement");
|
||
};
|
||
|
||
pp.parseRestBinding = function () {
|
||
let node = this.startNode();
|
||
this.next();
|
||
|
||
// RestElement inside of a function parameter must be an identifier
|
||
if (this.options.ecmaVersion === 6 && this.type !== _tokentype.types.name) this.unexpected();
|
||
|
||
node.argument = this.parseBindingAtom();
|
||
|
||
return this.finishNode(node, "RestElement");
|
||
};
|
||
|
||
// Parses lvalue (assignable) atom.
|
||
|
||
pp.parseBindingAtom = function () {
|
||
if (this.options.ecmaVersion >= 6) {
|
||
switch (this.type) {
|
||
case _tokentype.types.bracketL:
|
||
let node = this.startNode();
|
||
this.next();
|
||
node.elements = this.parseBindingList(_tokentype.types.bracketR, true, true);
|
||
return this.finishNode(node, "ArrayPattern");
|
||
|
||
case _tokentype.types.braceL:
|
||
return this.parseObj(true);
|
||
}
|
||
}
|
||
return this.parseIdent();
|
||
};
|
||
|
||
pp.parseBindingList = function (close, allowEmpty, allowTrailingComma) {
|
||
let elts = [],
|
||
first = true;
|
||
while (!this.eat(close)) {
|
||
if (first) first = false;else this.expect(_tokentype.types.comma);
|
||
if (allowEmpty && this.type === _tokentype.types.comma) {
|
||
elts.push(null);
|
||
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
||
break;
|
||
} else if (this.type === _tokentype.types.ellipsis) {
|
||
let rest = this.parseRestBinding();
|
||
this.parseBindingListItem(rest);
|
||
elts.push(rest);
|
||
if (this.type === _tokentype.types.comma) this.raise(this.start, "Comma is not permitted after the rest element");
|
||
this.expect(close);
|
||
break;
|
||
} else {
|
||
let elem = this.parseMaybeDefault(this.start, this.startLoc);
|
||
this.parseBindingListItem(elem);
|
||
elts.push(elem);
|
||
}
|
||
}
|
||
return elts;
|
||
};
|
||
|
||
pp.parseBindingListItem = function (param) {
|
||
return param;
|
||
};
|
||
|
||
// Parses assignment pattern around given atom if possible.
|
||
|
||
pp.parseMaybeDefault = function (startPos, startLoc, left) {
|
||
left = left || this.parseBindingAtom();
|
||
if (this.options.ecmaVersion < 6 || !this.eat(_tokentype.types.eq)) return left;
|
||
let node = this.startNodeAt(startPos, startLoc);
|
||
node.left = left;
|
||
node.right = this.parseMaybeAssign();
|
||
return this.finishNode(node, "AssignmentPattern");
|
||
};
|
||
|
||
// The following three functions all verify that a node is an lvalue —
|
||
// something that can be bound, or assigned to. In order to do so, they perform
|
||
// a variety of checks:
|
||
//
|
||
// - Check that none of the bound/assigned-to identifiers are reserved words.
|
||
// - Record name declarations for bindings in the appropriate scope.
|
||
// - Check duplicate argument names, if checkClashes is set.
|
||
//
|
||
// If a complex binding pattern is encountered (e.g., object and array
|
||
// destructuring), the entire pattern is recursively checked.
|
||
//
|
||
// There are three versions of checkLVal*() appropriate for different
|
||
// circumstances:
|
||
//
|
||
// - checkLValSimple() shall be used if the syntactic construct supports
|
||
// nothing other than identifiers and member expressions. Parenthesized
|
||
// expressions are also correctly handled. This is generally appropriate for
|
||
// constructs for which the spec says
|
||
//
|
||
// > It is a Syntax Error if AssignmentTargetType of [the production] is not
|
||
// > simple.
|
||
//
|
||
// It is also appropriate for checking if an identifier is valid and not
|
||
// defined elsewhere, like import declarations or function/class identifiers.
|
||
//
|
||
// Examples where this is used include:
|
||
// a += …;
|
||
// import a from '…';
|
||
// where a is the node to be checked.
|
||
//
|
||
// - checkLValPattern() shall be used if the syntactic construct supports
|
||
// anything checkLValSimple() supports, as well as object and array
|
||
// destructuring patterns. This is generally appropriate for constructs for
|
||
// which the spec says
|
||
//
|
||
// > It is a Syntax Error if [the production] is neither an ObjectLiteral nor
|
||
// > an ArrayLiteral and AssignmentTargetType of [the production] is not
|
||
// > simple.
|
||
//
|
||
// Examples where this is used include:
|
||
// (a = …);
|
||
// const a = …;
|
||
// try { … } catch (a) { … }
|
||
// where a is the node to be checked.
|
||
//
|
||
// - checkLValInnerPattern() shall be used if the syntactic construct supports
|
||
// anything checkLValPattern() supports, as well as default assignment
|
||
// patterns, rest elements, and other constructs that may appear within an
|
||
// object or array destructuring pattern.
|
||
//
|
||
// As a special case, function parameters also use checkLValInnerPattern(),
|
||
// as they also support defaults and rest constructs.
|
||
//
|
||
// These functions deliberately support both assignment and binding constructs,
|
||
// as the logic for both is exceedingly similar. If the node is the target of
|
||
// an assignment, then bindingType should be set to BIND_NONE. Otherwise, it
|
||
// should be set to the appropriate BIND_* constant, like BIND_VAR or
|
||
// BIND_LEXICAL.
|
||
//
|
||
// If the function is called with a non-BIND_NONE bindingType, then
|
||
// additionally a checkClashes object may be specified to allow checking for
|
||
// duplicate argument names. checkClashes is ignored if the provided construct
|
||
// is an assignment (i.e., bindingType is BIND_NONE).
|
||
|
||
pp.checkLValSimple = function (expr, bindingType = _scopeflags.BIND_NONE, checkClashes) {
|
||
const isBind = bindingType !== _scopeflags.BIND_NONE;
|
||
|
||
switch (expr.type) {
|
||
case "Identifier":
|
||
if (this.strict && this.reservedWordsStrictBind.test(expr.name)) this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
|
||
if (isBind) {
|
||
if (bindingType === _scopeflags.BIND_LEXICAL && expr.name === "let") this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name");
|
||
if (checkClashes) {
|
||
if ((0, _util.has)(checkClashes, expr.name)) this.raiseRecoverable(expr.start, "Argument name clash");
|
||
checkClashes[expr.name] = true;
|
||
}
|
||
if (bindingType !== _scopeflags.BIND_OUTSIDE) this.declareName(expr.name, bindingType, expr.start);
|
||
}
|
||
break;
|
||
|
||
case "ChainExpression":
|
||
this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
|
||
break;
|
||
|
||
case "MemberExpression":
|
||
if (isBind) this.raiseRecoverable(expr.start, "Binding member expression");
|
||
break;
|
||
|
||
case "ParenthesizedExpression":
|
||
if (isBind) this.raiseRecoverable(expr.start, "Binding parenthesized expression");
|
||
return this.checkLValSimple(expr.expression, bindingType, checkClashes);
|
||
|
||
default:
|
||
this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue");
|
||
}
|
||
};
|
||
|
||
pp.checkLValPattern = function (expr, bindingType = _scopeflags.BIND_NONE, checkClashes) {
|
||
switch (expr.type) {
|
||
case "ObjectPattern":
|
||
for (var _iterator2 = expr.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
||
var _ref2;
|
||
|
||
if (_isArray2) {
|
||
if (_i2 >= _iterator2.length) break;
|
||
_ref2 = _iterator2[_i2++];
|
||
} else {
|
||
_i2 = _iterator2.next();
|
||
if (_i2.done) break;
|
||
_ref2 = _i2.value;
|
||
}
|
||
|
||
let prop = _ref2;
|
||
|
||
this.checkLValInnerPattern(prop, bindingType, checkClashes);
|
||
}
|
||
break;
|
||
|
||
case "ArrayPattern":
|
||
for (var _iterator3 = expr.elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
|
||
var _ref3;
|
||
|
||
if (_isArray3) {
|
||
if (_i3 >= _iterator3.length) break;
|
||
_ref3 = _iterator3[_i3++];
|
||
} else {
|
||
_i3 = _iterator3.next();
|
||
if (_i3.done) break;
|
||
_ref3 = _i3.value;
|
||
}
|
||
|
||
let elem = _ref3;
|
||
|
||
if (elem) this.checkLValInnerPattern(elem, bindingType, checkClashes);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
this.checkLValSimple(expr, bindingType, checkClashes);
|
||
}
|
||
};
|
||
|
||
pp.checkLValInnerPattern = function (expr, bindingType = _scopeflags.BIND_NONE, checkClashes) {
|
||
switch (expr.type) {
|
||
case "Property":
|
||
// AssignmentProperty has type === "Property"
|
||
this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
|
||
break;
|
||
|
||
case "AssignmentPattern":
|
||
this.checkLValPattern(expr.left, bindingType, checkClashes);
|
||
break;
|
||
|
||
case "RestElement":
|
||
this.checkLValPattern(expr.argument, bindingType, checkClashes);
|
||
break;
|
||
|
||
default:
|
||
this.checkLValPattern(expr, bindingType, checkClashes);
|
||
}
|
||
};
|
||
|
||
/***/ }),
|
||
/* 172 */
|
||
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _tokentype = __webpack_require__(163);
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
var _parseutil = __webpack_require__(169);
|
||
|
||
var _whitespace = __webpack_require__(164);
|
||
|
||
var _scopeflags = __webpack_require__(168);
|
||
|
||
const pp = _state.Parser.prototype;
|
||
|
||
// Check if property name clashes with already added.
|
||
// Object/class getters and setters are not allowed to clash —
|
||
// either with each other or with an init property — and in
|
||
// strict mode, init properties are also not allowed to be repeated.
|
||
|
||
// A recursive descent parser operates by defining functions for all
|
||
// syntactic elements, and recursively calling those, each function
|
||
// advancing the input stream and returning an AST node. Precedence
|
||
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
|
||
// instead of `(!x)[1]` is handled by the fact that the parser
|
||
// function that parses unary prefix operators is called first, and
|
||
// in turn calls the function that parses `[]` subscripts — that
|
||
// way, it'll receive the node for `x[1]` already parsed, and wraps
|
||
// *that* in the unary operator node.
|
||
//
|
||
// Acorn uses an [operator precedence parser][opp] to handle binary
|
||
// operator precedence, because it is much more compact than using
|
||
// the technique outlined above, which uses different, nesting
|
||
// functions to specify precedence, for all of the ten binary
|
||
// precedence levels that JavaScript defines.
|
||
//
|
||
// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
|
||
|
||
pp.checkPropClash = function (prop, propHash, refDestructuringErrors) {
|
||
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") return;
|
||
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) return;
|
||
let key = prop.key,
|
||
name;
|
||
switch (key.type) {
|
||
case "Identifier":
|
||
name = key.name;break;
|
||
case "Literal":
|
||
name = String(key.value);break;
|
||
default:
|
||
return;
|
||
}
|
||
let kind = prop.kind;
|
||
|
||
if (this.options.ecmaVersion >= 6) {
|
||
if (name === "__proto__" && kind === "init") {
|
||
if (propHash.proto) {
|
||
if (refDestructuringErrors) {
|
||
if (refDestructuringErrors.doubleProto < 0) refDestructuringErrors.doubleProto = key.start;
|
||
// Backwards-compat kludge. Can be removed in version 6.0
|
||
} else this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
||
}
|
||
propHash.proto = true;
|
||
}
|
||
return;
|
||
}
|
||
name = "$" + name;
|
||
let other = propHash[name];
|
||
if (other) {
|
||
let redefinition;
|
||
if (kind === "init") {
|
||
redefinition = this.strict && other.init || other.get || other.set;
|
||
} else {
|
||
redefinition = other.init || other[kind];
|
||
}
|
||
if (redefinition) this.raiseRecoverable(key.start, "Redefinition of property");
|
||
} else {
|
||
other = propHash[name] = {
|
||
init: false,
|
||
get: false,
|
||
set: false
|
||
};
|
||
}
|
||
other[kind] = true;
|
||
};
|
||
|
||
// ### Expression parsing
|
||
|
||
// These nest, from the most general expression type at the top to
|
||
// 'atomic', nondivisible expression types at the bottom. Most of
|
||
// the functions will simply let the function(s) below them parse,
|
||
// and, *if* the syntactic construct they handle is present, wrap
|
||
// the AST node that the inner parser gave them in another node.
|
||
|
||
// Parse a full expression. The optional arguments are used to
|
||
// forbid the `in` operator (in for loops initalization expressions)
|
||
// and provide reference for storing '=' operator inside shorthand
|
||
// property assignment in contexts where both object expression
|
||
// and object pattern might appear (so it's possible to raise
|
||
// delayed syntax error at correct position).
|
||
|
||
pp.parseExpression = function (noIn, refDestructuringErrors) {
|
||
let startPos = this.start,
|
||
startLoc = this.startLoc;
|
||
let expr = this.parseMaybeAssign(noIn, refDestructuringErrors);
|
||
if (this.type === _tokentype.types.comma) {
|
||
let node = this.startNodeAt(startPos, startLoc);
|
||
node.expressions = [expr];
|
||
while (this.eat(_tokentype.types.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors));
|
||
return this.finishNode(node, "SequenceExpression");
|
||
}
|
||
return expr;
|
||
};
|
||
|
||
// Parse an assignment expression. This includes applications of
|
||
// operators like `+=`.
|
||
|
||
pp.parseMaybeAssign = function (noIn, refDestructuringErrors, afterLeftParse) {
|
||
if (this.isContextual("yield")) {
|
||
if (this.inGenerator) return this.parseYield(noIn);
|
||
// The tokenizer will assume an expression is allowed after
|
||
// `yield`, but this isn't that kind of yield
|
||
else this.exprAllowed = false;
|
||
}
|
||
|
||
let ownDestructuringErrors = false,
|
||
oldParenAssign = -1,
|
||
oldTrailingComma = -1;
|
||
if (refDestructuringErrors) {
|
||
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
|
||
oldTrailingComma = refDestructuringErrors.trailingComma;
|
||
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
|
||
} else {
|
||
refDestructuringErrors = new _parseutil.DestructuringErrors();
|
||
ownDestructuringErrors = true;
|
||
}
|
||
|
||
let startPos = this.start,
|
||
startLoc = this.startLoc;
|
||
if (this.type === _tokentype.types.parenL || this.type === _tokentype.types.name) this.potentialArrowAt = this.start;
|
||
let left = this.parseMaybeConditional(noIn, refDestructuringErrors);
|
||
if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc);
|
||
if (this.type.isAssign) {
|
||
let node = this.startNodeAt(startPos, startLoc);
|
||
node.operator = this.value;
|
||
if (this.type === _tokentype.types.eq) left = this.toAssignable(left, false, refDestructuringErrors);
|
||
if (!ownDestructuringErrors) {
|
||
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
|
||
}
|
||
if (refDestructuringErrors.shorthandAssign >= left.start) refDestructuringErrors.shorthandAssign = -1; // reset because shorthand default was used correctly
|
||
if (this.type === _tokentype.types.eq) this.checkLValPattern(left);else this.checkLValSimple(left);
|
||
node.left = left;
|
||
this.next();
|
||
node.right = this.parseMaybeAssign(noIn);
|
||
return this.finishNode(node, "AssignmentExpression");
|
||
} else {
|
||
if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true);
|
||
}
|
||
if (oldParenAssign > -1) refDestructuringErrors.parenthesizedAssign = oldParenAssign;
|
||
if (oldTrailingComma > -1) refDestructuringErrors.trailingComma = oldTrailingComma;
|
||
return left;
|
||
};
|
||
|
||
// Parse a ternary conditional (`?:`) operator.
|
||
|
||
pp.parseMaybeConditional = function (noIn, refDestructuringErrors) {
|
||
let startPos = this.start,
|
||
startLoc = this.startLoc;
|
||
let expr = this.parseExprOps(noIn, refDestructuringErrors);
|
||
if (this.checkExpressionErrors(refDestructuringErrors)) return expr;
|
||
if (this.eat(_tokentype.types.question)) {
|
||
let node = this.startNodeAt(startPos, startLoc);
|
||
node.test = expr;
|
||
node.consequent = this.parseMaybeAssign();
|
||
this.expect(_tokentype.types.colon);
|
||
node.alternate = this.parseMaybeAssign(noIn);
|
||
return this.finishNode(node, "ConditionalExpression");
|
||
}
|
||
return expr;
|
||
};
|
||
|
||
// Start the precedence parser.
|
||
|
||
pp.parseExprOps = function (noIn, refDestructuringErrors) {
|
||
let startPos = this.start,
|
||
startLoc = this.startLoc;
|
||
let expr = this.parseMaybeUnary(refDestructuringErrors, false);
|
||
if (this.checkExpressionErrors(refDestructuringErrors)) return expr;
|
||
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn);
|
||
};
|
||
|
||
// Parse binary operators with the operator precedence parsing
|
||
// algorithm. `left` is the left-hand side of the operator.
|
||
// `minPrec` provides context that allows the function to stop and
|
||
// defer further parser to one of its callers when it encounters an
|
||
// operator that has a lower precedence than the set it is parsing.
|
||
|
||
pp.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) {
|
||
let prec = this.type.binop;
|
||
if (prec != null && (!noIn || this.type !== _tokentype.types._in)) {
|
||
if (prec > minPrec) {
|
||
let logical = this.type === _tokentype.types.logicalOR || this.type === _tokentype.types.logicalAND;
|
||
let coalesce = this.type === _tokentype.types.coalesce;
|
||
if (coalesce) {
|
||
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
|
||
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
|
||
prec = _tokentype.types.logicalAND.binop;
|
||
}
|
||
let op = this.value;
|
||
this.next();
|
||
let startPos = this.start,
|
||
startLoc = this.startLoc;
|
||
let right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn);
|
||
let node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
||
if (logical && this.type === _tokentype.types.coalesce || coalesce && (this.type === _tokentype.types.logicalOR || this.type === _tokentype.types.logicalAND)) {
|
||
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
||
}
|
||
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
|
||
}
|
||
}
|
||
return left;
|
||
};
|
||
|
||
pp.buildBinary = function (startPos, startLoc, left, right, op, logical) {
|
||
let node = this.startNodeAt(startPos, startLoc);
|
||
node.left = left;
|
||
node.operator = op;
|
||
node.right = right;
|
||
return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression");
|
||
};
|
||
|
||
// Parse unary operators, both prefix and postfix.
|
||
|
||
pp.parseMaybeUnary = function (refDestructuringErrors, sawUnary) {
|
||
let startPos = this.start,
|
||
startLoc = this.startLoc,
|
||
expr;
|
||
if (this.isContextual("await") && (this.inAsync || !this.inFunction && this.options.allowAwaitOutsideFunction)) {
|
||
expr = this.parseAwait();
|
||
sawUnary = true;
|
||
} else if (this.type.prefix) {
|
||
let node = this.startNode(),
|
||
update = this.type === _tokentype.types.incDec;
|
||
node.operator = this.value;
|
||
node.prefix = true;
|
||
this.next();
|
||
node.argument = this.parseMaybeUnary(null, true);
|
||
this.checkExpressionErrors(refDestructuringErrors, true);
|
||
if (update) this.checkLValSimple(node.argument);else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") this.raiseRecoverable(node.start, "Deleting local variable in strict mode");else sawUnary = true;
|
||
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
||
} else {
|
||
expr = this.parseExprSubscripts(refDestructuringErrors);
|
||
if (this.checkExpressionErrors(refDestructuringErrors)) return expr;
|
||
while (this.type.postfix && !this.canInsertSemicolon()) {
|
||
let node = this.startNodeAt(startPos, startLoc);
|
||
node.operator = this.value;
|
||
node.prefix = false;
|
||
node.argument = expr;
|
||
this.checkLValSimple(expr);
|
||
this.next();
|
||
expr = this.finishNode(node, "UpdateExpression");
|
||
}
|
||
}
|
||
|
||
if (!sawUnary && this.eat(_tokentype.types.starstar)) return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false);else return expr;
|
||
};
|
||
|
||
// Parse call, dot, and `[]`-subscript expressions.
|
||
|
||
pp.parseExprSubscripts = function (refDestructuringErrors) {
|
||
let startPos = this.start,
|
||
startLoc = this.startLoc;
|
||
let expr = this.parseExprAtom(refDestructuringErrors);
|
||
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") return expr;
|
||
let result = this.parseSubscripts(expr, startPos, startLoc);
|
||
if (refDestructuringErrors && result.type === "MemberExpression") {
|
||
if (refDestructuringErrors.parenthesizedAssign >= result.start) refDestructuringErrors.parenthesizedAssign = -1;
|
||
if (refDestructuringErrors.parenthesizedBind >= result.start) refDestructuringErrors.parenthesizedBind = -1;
|
||
if (refDestructuringErrors.trailingComma >= result.start) refDestructuringErrors.trailingComma = -1;
|
||
}
|
||
return result;
|
||
};
|
||
|
||
pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {
|
||
let maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.potentialArrowAt === base.start;
|
||
let optionalChained = false;
|
||
|
||
while (true) {
|
||
let element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained);
|
||
|
||
if (element.optional) optionalChained = true;
|
||
if (element === base || element.type === "ArrowFunctionExpression") {
|
||
if (optionalChained) {
|
||
const chainNode = this.startNodeAt(startPos, startLoc);
|
||
chainNode.expression = element;
|
||
element = this.finishNode(chainNode, "ChainExpression");
|
||
}
|
||
return element;
|
||
}
|
||
|
||
base = element;
|
||
}
|
||
};
|
||
|
||
pp.parseSubscript = function (base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained) {
|
||
let optionalSupported = this.options.ecmaVersion >= 11;
|
||
let optional = optionalSupported && this.eat(_tokentype.types.questionDot);
|
||
if (noCalls && optional) this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
|
||
|
||
let computed = this.eat(_tokentype.types.bracketL);
|
||
if (computed || optional && this.type !== _tokentype.types.parenL && this.type !== _tokentype.types.backQuote || this.eat(_tokentype.types.dot)) {
|
||
let node = this.startNodeAt(startPos, startLoc);
|
||
node.object = base;
|
||
node.property = computed ? this.parseExpression() : this.parseIdent(this.options.allowReserved !== "never");
|
||
node.computed = !!computed;
|
||
if (computed) this.expect(_tokentype.types.bracketR);
|
||
if (optionalSupported) {
|
||
node.optional = optional;
|
||
}
|
||
base = this.finishNode(node, "MemberExpression");
|
||
} else if (!noCalls && this.eat(_tokentype.types.parenL)) {
|
||
let refDestructuringErrors = new _parseutil.DestructuringErrors(),
|
||
oldYieldPos = this.yieldPos,
|
||
oldAwaitPos = this.awaitPos,
|
||
oldAwaitIdentPos = this.awaitIdentPos;
|
||
this.yieldPos = 0;
|
||
this.awaitPos = 0;
|
||
this.awaitIdentPos = 0;
|
||
let exprList = this.parseExprList(_tokentype.types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
||
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(_tokentype.types.arrow)) {
|
||
this.checkPatternErrors(refDestructuringErrors, false);
|
||
this.checkYieldAwaitInDefaultParams();
|
||
if (this.awaitIdentPos > 0) this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function");
|
||
this.yieldPos = oldYieldPos;
|
||
this.awaitPos = oldAwaitPos;
|
||
this.awaitIdentPos = oldAwaitIdentPos;
|
||
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true);
|
||
}
|
||
this.checkExpressionErrors(refDestructuringErrors, true);
|
||
this.yieldPos = oldYieldPos || this.yieldPos;
|
||
this.awaitPos = oldAwaitPos || this.awaitPos;
|
||
this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
|
||
let node = this.startNodeAt(startPos, startLoc);
|
||
node.callee = base;
|
||
node.arguments = exprList;
|
||
if (optionalSupported) {
|
||
node.optional = optional;
|
||
}
|
||
base = this.finishNode(node, "CallExpression");
|
||
} else if (this.type === _tokentype.types.backQuote) {
|
||
if (optional || optionalChained) {
|
||
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
||
}
|
||
let node = this.startNodeAt(startPos, startLoc);
|
||
node.tag = base;
|
||
node.quasi = this.parseTemplate({ isTagged: true });
|
||
base = this.finishNode(node, "TaggedTemplateExpression");
|
||
}
|
||
return base;
|
||
};
|
||
|
||
// Parse an atomic expression — either a single token that is an
|
||
// expression, an expression started by a keyword like `function` or
|
||
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
||
// or `{}`.
|
||
|
||
pp.parseExprAtom = function (refDestructuringErrors) {
|
||
// If a division operator appears in an expression position, the
|
||
// tokenizer got confused, and we force it to read a regexp instead.
|
||
if (this.type === _tokentype.types.slash) this.readRegexp();
|
||
|
||
let node,
|
||
canBeArrow = this.potentialArrowAt === this.start;
|
||
switch (this.type) {
|
||
case _tokentype.types._super:
|
||
if (!this.allowSuper) this.raise(this.start, "'super' keyword outside a method");
|
||
node = this.startNode();
|
||
this.next();
|
||
if (this.type === _tokentype.types.parenL && !this.allowDirectSuper) this.raise(node.start, "super() call outside constructor of a subclass");
|
||
// The `super` keyword can appear at below:
|
||
// SuperProperty:
|
||
// super [ Expression ]
|
||
// super . IdentifierName
|
||
// SuperCall:
|
||
// super ( Arguments )
|
||
if (this.type !== _tokentype.types.dot && this.type !== _tokentype.types.bracketL && this.type !== _tokentype.types.parenL) this.unexpected();
|
||
return this.finishNode(node, "Super");
|
||
|
||
case _tokentype.types._this:
|
||
node = this.startNode();
|
||
this.next();
|
||
return this.finishNode(node, "ThisExpression");
|
||
|
||
case _tokentype.types.name:
|
||
let startPos = this.start,
|
||
startLoc = this.startLoc,
|
||
containsEsc = this.containsEsc;
|
||
let id = this.parseIdent(false);
|
||
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(_tokentype.types._function)) return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true);
|
||
if (canBeArrow && !this.canInsertSemicolon()) {
|
||
if (this.eat(_tokentype.types.arrow)) return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false);
|
||
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === _tokentype.types.name && !containsEsc) {
|
||
id = this.parseIdent(false);
|
||
if (this.canInsertSemicolon() || !this.eat(_tokentype.types.arrow)) this.unexpected();
|
||
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true);
|
||
}
|
||
}
|
||
return id;
|
||
|
||
case _tokentype.types.regexp:
|
||
let value = this.value;
|
||
node = this.parseLiteral(value.value);
|
||
node.regex = { pattern: value.pattern, flags: value.flags };
|
||
return node;
|
||
|
||
case _tokentype.types.num:case _tokentype.types.string:
|
||
return this.parseLiteral(this.value);
|
||
|
||
case _tokentype.types._null:case _tokentype.types._true:case _tokentype.types._false:
|
||
node = this.startNode();
|
||
node.value = this.type === _tokentype.types._null ? null : this.type === _tokentype.types._true;
|
||
node.raw = this.type.keyword;
|
||
this.next();
|
||
return this.finishNode(node, "Literal");
|
||
|
||
case _tokentype.types.parenL:
|
||
let start = this.start,
|
||
expr = this.parseParenAndDistinguishExpression(canBeArrow);
|
||
if (refDestructuringErrors) {
|
||
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) refDestructuringErrors.parenthesizedAssign = start;
|
||
if (refDestructuringErrors.parenthesizedBind < 0) refDestructuringErrors.parenthesizedBind = start;
|
||
}
|
||
return expr;
|
||
|
||
case _tokentype.types.bracketL:
|
||
node = this.startNode();
|
||
this.next();
|
||
node.elements = this.parseExprList(_tokentype.types.bracketR, true, true, refDestructuringErrors);
|
||
return this.finishNode(node, "ArrayExpression");
|
||
|
||
case _tokentype.types.braceL:
|
||
return this.parseObj(false, refDestructuringErrors);
|
||
|
||
case _tokentype.types._function:
|
||
node = this.startNode();
|
||
this.next();
|
||
return this.parseFunction(node, 0);
|
||
|
||
case _tokentype.types._class:
|
||
return this.parseClass(this.startNode(), false);
|
||
|
||
case _tokentype.types._new:
|
||
return this.parseNew();
|
||
|
||
case _tokentype.types.backQuote:
|
||
return this.parseTemplate();
|
||
|
||
case _tokentype.types._import:
|
||
if (this.options.ecmaVersion >= 11) {
|
||
return this.parseExprImport();
|
||
} else {
|
||
return this.unexpected();
|
||
}
|
||
|
||
default:
|
||
this.unexpected();
|
||
}
|
||
};
|
||
|
||
pp.parseExprImport = function () {
|
||
const node = this.startNode();
|
||
|
||
// Consume `import` as an identifier for `import.meta`.
|
||
// Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.
|
||
if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword import");
|
||
const meta = this.parseIdent(true);
|
||
|
||
switch (this.type) {
|
||
case _tokentype.types.parenL:
|
||
return this.parseDynamicImport(node);
|
||
case _tokentype.types.dot:
|
||
node.meta = meta;
|
||
return this.parseImportMeta(node);
|
||
default:
|
||
this.unexpected();
|
||
}
|
||
};
|
||
|
||
pp.parseDynamicImport = function (node) {
|
||
this.next(); // skip `(`
|
||
|
||
// Parse node.source.
|
||
node.source = this.parseMaybeAssign();
|
||
|
||
// Verify ending.
|
||
if (!this.eat(_tokentype.types.parenR)) {
|
||
const errorPos = this.start;
|
||
if (this.eat(_tokentype.types.comma) && this.eat(_tokentype.types.parenR)) {
|
||
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
||
} else {
|
||
this.unexpected(errorPos);
|
||
}
|
||
}
|
||
|
||
return this.finishNode(node, "ImportExpression");
|
||
};
|
||
|
||
pp.parseImportMeta = function (node) {
|
||
this.next(); // skip `.`
|
||
|
||
const containsEsc = this.containsEsc;
|
||
node.property = this.parseIdent(true);
|
||
|
||
if (node.property.name !== "meta") this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'");
|
||
if (containsEsc) this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters");
|
||
if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module");
|
||
|
||
return this.finishNode(node, "MetaProperty");
|
||
};
|
||
|
||
pp.parseLiteral = function (value) {
|
||
let node = this.startNode();
|
||
node.value = value;
|
||
node.raw = this.input.slice(this.start, this.end);
|
||
if (node.raw.charCodeAt(node.raw.length - 1) === 110) node.bigint = node.raw.slice(0, -1).replace(/_/g, "");
|
||
this.next();
|
||
return this.finishNode(node, "Literal");
|
||
};
|
||
|
||
pp.parseParenExpression = function () {
|
||
this.expect(_tokentype.types.parenL);
|
||
let val = this.parseExpression();
|
||
this.expect(_tokentype.types.parenR);
|
||
return val;
|
||
};
|
||
|
||
pp.parseParenAndDistinguishExpression = function (canBeArrow) {
|
||
let startPos = this.start,
|
||
startLoc = this.startLoc,
|
||
val,
|
||
allowTrailingComma = this.options.ecmaVersion >= 8;
|
||
if (this.options.ecmaVersion >= 6) {
|
||
this.next();
|
||
|
||
let innerStartPos = this.start,
|
||
innerStartLoc = this.startLoc;
|
||
let exprList = [],
|
||
first = true,
|
||
lastIsComma = false;
|
||
let refDestructuringErrors = new _parseutil.DestructuringErrors(),
|
||
oldYieldPos = this.yieldPos,
|
||
oldAwaitPos = this.awaitPos,
|
||
spreadStart;
|
||
this.yieldPos = 0;
|
||
this.awaitPos = 0;
|
||
// Do not save awaitIdentPos to allow checking awaits nested in parameters
|
||
while (this.type !== _tokentype.types.parenR) {
|
||
first ? first = false : this.expect(_tokentype.types.comma);
|
||
if (allowTrailingComma && this.afterTrailingComma(_tokentype.types.parenR, true)) {
|
||
lastIsComma = true;
|
||
break;
|
||
} else if (this.type === _tokentype.types.ellipsis) {
|
||
spreadStart = this.start;
|
||
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
||
if (this.type === _tokentype.types.comma) this.raise(this.start, "Comma is not permitted after the rest element");
|
||
break;
|
||
} else {
|
||
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
||
}
|
||
}
|
||
let innerEndPos = this.start,
|
||
innerEndLoc = this.startLoc;
|
||
this.expect(_tokentype.types.parenR);
|
||
|
||
if (canBeArrow && !this.canInsertSemicolon() && this.eat(_tokentype.types.arrow)) {
|
||
this.checkPatternErrors(refDestructuringErrors, false);
|
||
this.checkYieldAwaitInDefaultParams();
|
||
this.yieldPos = oldYieldPos;
|
||
this.awaitPos = oldAwaitPos;
|
||
return this.parseParenArrowList(startPos, startLoc, exprList);
|
||
}
|
||
|
||
if (!exprList.length || lastIsComma) this.unexpected(this.lastTokStart);
|
||
if (spreadStart) this.unexpected(spreadStart);
|
||
this.checkExpressionErrors(refDestructuringErrors, true);
|
||
this.yieldPos = oldYieldPos || this.yieldPos;
|
||
this.awaitPos = oldAwaitPos || this.awaitPos;
|
||
|
||
if (exprList.length > 1) {
|
||
val = this.startNodeAt(innerStartPos, innerStartLoc);
|
||
val.expressions = exprList;
|
||
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
|
||
} else {
|
||
val = exprList[0];
|
||
}
|
||
} else {
|
||
val = this.parseParenExpression();
|
||
}
|
||
|
||
if (this.options.preserveParens) {
|
||
let par = this.startNodeAt(startPos, startLoc);
|
||
par.expression = val;
|
||
return this.finishNode(par, "ParenthesizedExpression");
|
||
} else {
|
||
return val;
|
||
}
|
||
};
|
||
|
||
pp.parseParenItem = function (item) {
|
||
return item;
|
||
};
|
||
|
||
pp.parseParenArrowList = function (startPos, startLoc, exprList) {
|
||
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList);
|
||
};
|
||
|
||
// New's precedence is slightly tricky. It must allow its argument to
|
||
// be a `[]` or dot subscript expression, but not a call — at least,
|
||
// not without wrapping it in parentheses. Thus, it uses the noCalls
|
||
// argument to parseSubscripts to prevent it from consuming the
|
||
// argument list.
|
||
|
||
const empty = [];
|
||
|
||
pp.parseNew = function () {
|
||
if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
||
let node = this.startNode();
|
||
let meta = this.parseIdent(true);
|
||
if (this.options.ecmaVersion >= 6 && this.eat(_tokentype.types.dot)) {
|
||
node.meta = meta;
|
||
let containsEsc = this.containsEsc;
|
||
node.property = this.parseIdent(true);
|
||
if (node.property.name !== "target") this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'");
|
||
if (containsEsc) this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters");
|
||
if (!this.inNonArrowFunction) this.raiseRecoverable(node.start, "'new.target' can only be used in functions");
|
||
return this.finishNode(node, "MetaProperty");
|
||
}
|
||
let startPos = this.start,
|
||
startLoc = this.startLoc,
|
||
isImport = this.type === _tokentype.types._import;
|
||
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
|
||
if (isImport && node.callee.type === "ImportExpression") {
|
||
this.raise(startPos, "Cannot use new with import()");
|
||
}
|
||
if (this.eat(_tokentype.types.parenL)) node.arguments = this.parseExprList(_tokentype.types.parenR, this.options.ecmaVersion >= 8, false);else node.arguments = empty;
|
||
return this.finishNode(node, "NewExpression");
|
||
};
|
||
|
||
// Parse template expression.
|
||
|
||
pp.parseTemplateElement = function ({ isTagged }) {
|
||
let elem = this.startNode();
|
||
if (this.type === _tokentype.types.invalidTemplate) {
|
||
if (!isTagged) {
|
||
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
||
}
|
||
elem.value = {
|
||
raw: this.value,
|
||
cooked: null
|
||
};
|
||
} else {
|
||
elem.value = {
|
||
raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
|
||
cooked: this.value
|
||
};
|
||
}
|
||
this.next();
|
||
elem.tail = this.type === _tokentype.types.backQuote;
|
||
return this.finishNode(elem, "TemplateElement");
|
||
};
|
||
|
||
pp.parseTemplate = function ({ isTagged = false } = {}) {
|
||
let node = this.startNode();
|
||
this.next();
|
||
node.expressions = [];
|
||
let curElt = this.parseTemplateElement({ isTagged });
|
||
node.quasis = [curElt];
|
||
while (!curElt.tail) {
|
||
if (this.type === _tokentype.types.eof) this.raise(this.pos, "Unterminated template literal");
|
||
this.expect(_tokentype.types.dollarBraceL);
|
||
node.expressions.push(this.parseExpression());
|
||
this.expect(_tokentype.types.braceR);
|
||
node.quasis.push(curElt = this.parseTemplateElement({ isTagged }));
|
||
}
|
||
this.next();
|
||
return this.finishNode(node, "TemplateLiteral");
|
||
};
|
||
|
||
pp.isAsyncProp = function (prop) {
|
||
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (this.type === _tokentype.types.name || this.type === _tokentype.types.num || this.type === _tokentype.types.string || this.type === _tokentype.types.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === _tokentype.types.star) && !_whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
|
||
};
|
||
|
||
// Parse an object literal or binding pattern.
|
||
|
||
pp.parseObj = function (isPattern, refDestructuringErrors) {
|
||
let node = this.startNode(),
|
||
first = true,
|
||
propHash = {};
|
||
node.properties = [];
|
||
this.next();
|
||
while (!this.eat(_tokentype.types.braceR)) {
|
||
if (!first) {
|
||
this.expect(_tokentype.types.comma);
|
||
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(_tokentype.types.braceR)) break;
|
||
} else first = false;
|
||
|
||
const prop = this.parseProperty(isPattern, refDestructuringErrors);
|
||
if (!isPattern) this.checkPropClash(prop, propHash, refDestructuringErrors);
|
||
node.properties.push(prop);
|
||
}
|
||
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
|
||
};
|
||
|
||
pp.parseProperty = function (isPattern, refDestructuringErrors) {
|
||
let prop = this.startNode(),
|
||
isGenerator,
|
||
isAsync,
|
||
startPos,
|
||
startLoc;
|
||
if (this.options.ecmaVersion >= 9 && this.eat(_tokentype.types.ellipsis)) {
|
||
if (isPattern) {
|
||
prop.argument = this.parseIdent(false);
|
||
if (this.type === _tokentype.types.comma) {
|
||
this.raise(this.start, "Comma is not permitted after the rest element");
|
||
}
|
||
return this.finishNode(prop, "RestElement");
|
||
}
|
||
// To disallow parenthesized identifier via `this.toAssignable()`.
|
||
if (this.type === _tokentype.types.parenL && refDestructuringErrors) {
|
||
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
||
refDestructuringErrors.parenthesizedAssign = this.start;
|
||
}
|
||
if (refDestructuringErrors.parenthesizedBind < 0) {
|
||
refDestructuringErrors.parenthesizedBind = this.start;
|
||
}
|
||
}
|
||
// Parse argument.
|
||
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
||
// To disallow trailing comma via `this.toAssignable()`.
|
||
if (this.type === _tokentype.types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
||
refDestructuringErrors.trailingComma = this.start;
|
||
}
|
||
// Finish
|
||
return this.finishNode(prop, "SpreadElement");
|
||
}
|
||
if (this.options.ecmaVersion >= 6) {
|
||
prop.method = false;
|
||
prop.shorthand = false;
|
||
if (isPattern || refDestructuringErrors) {
|
||
startPos = this.start;
|
||
startLoc = this.startLoc;
|
||
}
|
||
if (!isPattern) isGenerator = this.eat(_tokentype.types.star);
|
||
}
|
||
let containsEsc = this.containsEsc;
|
||
this.parsePropertyName(prop);
|
||
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
||
isAsync = true;
|
||
isGenerator = this.options.ecmaVersion >= 9 && this.eat(_tokentype.types.star);
|
||
this.parsePropertyName(prop, refDestructuringErrors);
|
||
} else {
|
||
isAsync = false;
|
||
}
|
||
this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
|
||
return this.finishNode(prop, "Property");
|
||
};
|
||
|
||
pp.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
||
if ((isGenerator || isAsync) && this.type === _tokentype.types.colon) this.unexpected();
|
||
|
||
if (this.eat(_tokentype.types.colon)) {
|
||
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
|
||
prop.kind = "init";
|
||
} else if (this.options.ecmaVersion >= 6 && this.type === _tokentype.types.parenL) {
|
||
if (isPattern) this.unexpected();
|
||
prop.kind = "init";
|
||
prop.method = true;
|
||
prop.value = this.parseMethod(isGenerator, isAsync);
|
||
} else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && this.type !== _tokentype.types.comma && this.type !== _tokentype.types.braceR && this.type !== _tokentype.types.eq) {
|
||
if (isGenerator || isAsync) this.unexpected();
|
||
prop.kind = prop.key.name;
|
||
this.parsePropertyName(prop);
|
||
prop.value = this.parseMethod(false);
|
||
let paramCount = prop.kind === "get" ? 0 : 1;
|
||
if (prop.value.params.length !== paramCount) {
|
||
let start = prop.value.start;
|
||
if (prop.kind === "get") this.raiseRecoverable(start, "getter should have no params");else this.raiseRecoverable(start, "setter should have exactly one param");
|
||
} else {
|
||
if (prop.kind === "set" && prop.value.params[0].type === "RestElement") this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params");
|
||
}
|
||
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
|
||
if (isGenerator || isAsync) this.unexpected();
|
||
this.checkUnreserved(prop.key);
|
||
if (prop.key.name === "await" && !this.awaitIdentPos) this.awaitIdentPos = startPos;
|
||
prop.kind = "init";
|
||
if (isPattern) {
|
||
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
||
} else if (this.type === _tokentype.types.eq && refDestructuringErrors) {
|
||
if (refDestructuringErrors.shorthandAssign < 0) refDestructuringErrors.shorthandAssign = this.start;
|
||
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
||
} else {
|
||
prop.value = this.copyNode(prop.key);
|
||
}
|
||
prop.shorthand = true;
|
||
} else this.unexpected();
|
||
};
|
||
|
||
pp.parsePropertyName = function (prop) {
|
||
if (this.options.ecmaVersion >= 6) {
|
||
if (this.eat(_tokentype.types.bracketL)) {
|
||
prop.computed = true;
|
||
prop.key = this.parseMaybeAssign();
|
||
this.expect(_tokentype.types.bracketR);
|
||
return prop.key;
|
||
} else {
|
||
prop.computed = false;
|
||
}
|
||
}
|
||
return prop.key = this.type === _tokentype.types.num || this.type === _tokentype.types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
||
};
|
||
|
||
// Initialize empty function node.
|
||
|
||
pp.initFunction = function (node) {
|
||
node.id = null;
|
||
if (this.options.ecmaVersion >= 6) node.generator = node.expression = false;
|
||
if (this.options.ecmaVersion >= 8) node.async = false;
|
||
};
|
||
|
||
// Parse object or class method.
|
||
|
||
pp.parseMethod = function (isGenerator, isAsync, allowDirectSuper) {
|
||
let node = this.startNode(),
|
||
oldYieldPos = this.yieldPos,
|
||
oldAwaitPos = this.awaitPos,
|
||
oldAwaitIdentPos = this.awaitIdentPos;
|
||
|
||
this.initFunction(node);
|
||
if (this.options.ecmaVersion >= 6) node.generator = isGenerator;
|
||
if (this.options.ecmaVersion >= 8) node.async = !!isAsync;
|
||
|
||
this.yieldPos = 0;
|
||
this.awaitPos = 0;
|
||
this.awaitIdentPos = 0;
|
||
this.enterScope((0, _scopeflags.functionFlags)(isAsync, node.generator) | _scopeflags.SCOPE_SUPER | (allowDirectSuper ? _scopeflags.SCOPE_DIRECT_SUPER : 0));
|
||
|
||
this.expect(_tokentype.types.parenL);
|
||
node.params = this.parseBindingList(_tokentype.types.parenR, false, this.options.ecmaVersion >= 8);
|
||
this.checkYieldAwaitInDefaultParams();
|
||
this.parseFunctionBody(node, false, true);
|
||
|
||
this.yieldPos = oldYieldPos;
|
||
this.awaitPos = oldAwaitPos;
|
||
this.awaitIdentPos = oldAwaitIdentPos;
|
||
return this.finishNode(node, "FunctionExpression");
|
||
};
|
||
|
||
// Parse arrow function expression with given parameters.
|
||
|
||
pp.parseArrowExpression = function (node, params, isAsync) {
|
||
let oldYieldPos = this.yieldPos,
|
||
oldAwaitPos = this.awaitPos,
|
||
oldAwaitIdentPos = this.awaitIdentPos;
|
||
|
||
this.enterScope((0, _scopeflags.functionFlags)(isAsync, false) | _scopeflags.SCOPE_ARROW);
|
||
this.initFunction(node);
|
||
if (this.options.ecmaVersion >= 8) node.async = !!isAsync;
|
||
|
||
this.yieldPos = 0;
|
||
this.awaitPos = 0;
|
||
this.awaitIdentPos = 0;
|
||
|
||
node.params = this.toAssignableList(params, true);
|
||
this.parseFunctionBody(node, true, false);
|
||
|
||
this.yieldPos = oldYieldPos;
|
||
this.awaitPos = oldAwaitPos;
|
||
this.awaitIdentPos = oldAwaitIdentPos;
|
||
return this.finishNode(node, "ArrowFunctionExpression");
|
||
};
|
||
|
||
// Parse function body and check parameters.
|
||
|
||
pp.parseFunctionBody = function (node, isArrowFunction, isMethod) {
|
||
let isExpression = isArrowFunction && this.type !== _tokentype.types.braceL;
|
||
let oldStrict = this.strict,
|
||
useStrict = false;
|
||
|
||
if (isExpression) {
|
||
node.body = this.parseMaybeAssign();
|
||
node.expression = true;
|
||
this.checkParams(node, false);
|
||
} else {
|
||
let nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
|
||
if (!oldStrict || nonSimple) {
|
||
useStrict = this.strictDirective(this.end);
|
||
// If this is a strict mode function, verify that argument names
|
||
// are not repeated, and it does not try to bind the words `eval`
|
||
// or `arguments`.
|
||
if (useStrict && nonSimple) this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list");
|
||
}
|
||
// Start a new scope with regard to labels and the `inFunction`
|
||
// flag (restore them to their old value afterwards).
|
||
let oldLabels = this.labels;
|
||
this.labels = [];
|
||
if (useStrict) this.strict = true;
|
||
|
||
// Add the params to varDeclaredNames to ensure that an error is thrown
|
||
// if a let/const declaration in the function clashes with one of the params.
|
||
this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
|
||
// Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
|
||
if (this.strict && node.id) this.checkLValSimple(node.id, _scopeflags.BIND_OUTSIDE);
|
||
node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
|
||
node.expression = false;
|
||
this.adaptDirectivePrologue(node.body.body);
|
||
this.labels = oldLabels;
|
||
}
|
||
this.exitScope();
|
||
};
|
||
|
||
pp.isSimpleParamList = function (params) {
|
||
for (var _iterator = params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||
var _ref;
|
||
|
||
if (_isArray) {
|
||
if (_i >= _iterator.length) break;
|
||
_ref = _iterator[_i++];
|
||
} else {
|
||
_i = _iterator.next();
|
||
if (_i.done) break;
|
||
_ref = _i.value;
|
||
}
|
||
|
||
let param = _ref;
|
||
|
||
if (param.type !== "Identifier") return false;
|
||
}return true;
|
||
};
|
||
|
||
// Checks function params for various disallowed patterns such as using "eval"
|
||
// or "arguments" and duplicate parameters.
|
||
|
||
pp.checkParams = function (node, allowDuplicates) {
|
||
let nameHash = Object.create(null);
|
||
for (var _iterator2 = node.params, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
||
var _ref2;
|
||
|
||
if (_isArray2) {
|
||
if (_i2 >= _iterator2.length) break;
|
||
_ref2 = _iterator2[_i2++];
|
||
} else {
|
||
_i2 = _iterator2.next();
|
||
if (_i2.done) break;
|
||
_ref2 = _i2.value;
|
||
}
|
||
|
||
let param = _ref2;
|
||
|
||
this.checkLValInnerPattern(param, _scopeflags.BIND_VAR, allowDuplicates ? null : nameHash);
|
||
}
|
||
};
|
||
|
||
// Parses a comma-separated list of expressions, and returns them as
|
||
// an array. `close` is the token type that ends the list, and
|
||
// `allowEmpty` can be turned on to allow subsequent commas with
|
||
// nothing in between them to be parsed as `null` (which is needed
|
||
// for array literals).
|
||
|
||
pp.parseExprList = function (close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
||
let elts = [],
|
||
first = true;
|
||
while (!this.eat(close)) {
|
||
if (!first) {
|
||
this.expect(_tokentype.types.comma);
|
||
if (allowTrailingComma && this.afterTrailingComma(close)) break;
|
||
} else first = false;
|
||
|
||
let elt;
|
||
if (allowEmpty && this.type === _tokentype.types.comma) elt = null;else if (this.type === _tokentype.types.ellipsis) {
|
||
elt = this.parseSpread(refDestructuringErrors);
|
||
if (refDestructuringErrors && this.type === _tokentype.types.comma && refDestructuringErrors.trailingComma < 0) refDestructuringErrors.trailingComma = this.start;
|
||
} else {
|
||
elt = this.parseMaybeAssign(false, refDestructuringErrors);
|
||
}
|
||
elts.push(elt);
|
||
}
|
||
return elts;
|
||
};
|
||
|
||
pp.checkUnreserved = function ({ start, end, name }) {
|
||
if (this.inGenerator && name === "yield") this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator");
|
||
if (this.inAsync && name === "await") this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function");
|
||
if (this.keywords.test(name)) this.raise(start, `Unexpected keyword '${name}'`);
|
||
if (this.options.ecmaVersion < 6 && this.input.slice(start, end).indexOf("\\") !== -1) return;
|
||
const re = this.strict ? this.reservedWordsStrict : this.reservedWords;
|
||
if (re.test(name)) {
|
||
if (!this.inAsync && name === "await") this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function");
|
||
this.raiseRecoverable(start, `The keyword '${name}' is reserved`);
|
||
}
|
||
};
|
||
|
||
// Parse the next token as an identifier. If `liberal` is true (used
|
||
// when parsing properties), it will also convert keywords into
|
||
// identifiers.
|
||
|
||
pp.parseIdent = function (liberal, isBinding) {
|
||
let node = this.startNode();
|
||
if (this.type === _tokentype.types.name) {
|
||
node.name = this.value;
|
||
} else if (this.type.keyword) {
|
||
node.name = this.type.keyword;
|
||
|
||
// To fix https://github.com/acornjs/acorn/issues/575
|
||
// `class` and `function` keywords push new context into this.context.
|
||
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
|
||
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
|
||
if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
|
||
this.context.pop();
|
||
}
|
||
} else {
|
||
this.unexpected();
|
||
}
|
||
this.next(!!liberal);
|
||
this.finishNode(node, "Identifier");
|
||
if (!liberal) {
|
||
this.checkUnreserved(node);
|
||
if (node.name === "await" && !this.awaitIdentPos) this.awaitIdentPos = node.start;
|
||
}
|
||
return node;
|
||
};
|
||
|
||
// Parses yield expression inside generator.
|
||
|
||
pp.parseYield = function (noIn) {
|
||
if (!this.yieldPos) this.yieldPos = this.start;
|
||
|
||
let node = this.startNode();
|
||
this.next();
|
||
if (this.type === _tokentype.types.semi || this.canInsertSemicolon() || this.type !== _tokentype.types.star && !this.type.startsExpr) {
|
||
node.delegate = false;
|
||
node.argument = null;
|
||
} else {
|
||
node.delegate = this.eat(_tokentype.types.star);
|
||
node.argument = this.parseMaybeAssign(noIn);
|
||
}
|
||
return this.finishNode(node, "YieldExpression");
|
||
};
|
||
|
||
pp.parseAwait = function () {
|
||
if (!this.awaitPos) this.awaitPos = this.start;
|
||
|
||
let node = this.startNode();
|
||
this.next();
|
||
node.argument = this.parseMaybeUnary(null, true);
|
||
return this.finishNode(node, "AwaitExpression");
|
||
};
|
||
|
||
/***/ }),
|
||
/* 173 */
|
||
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
var _locutil = __webpack_require__(167);
|
||
|
||
const pp = _state.Parser.prototype;
|
||
|
||
// This function is used to raise exceptions on parse errors. It
|
||
// takes an offset integer (into the current `input`) to indicate
|
||
// the location of the error, attaches the position to the end
|
||
// of the error message, and then raises a `SyntaxError` with that
|
||
// message.
|
||
|
||
pp.raise = function (pos, message) {
|
||
let loc = (0, _locutil.getLineInfo)(this.input, pos);
|
||
message += " (" + loc.line + ":" + loc.column + ")";
|
||
let err = new SyntaxError(message);
|
||
err.pos = pos;err.loc = loc;err.raisedAt = this.pos;
|
||
throw err;
|
||
};
|
||
|
||
pp.raiseRecoverable = pp.raise;
|
||
|
||
pp.curPosition = function () {
|
||
if (this.options.locations) {
|
||
return new _locutil.Position(this.curLine, this.pos - this.lineStart);
|
||
}
|
||
};
|
||
|
||
/***/ }),
|
||
/* 174 */
|
||
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
var _scopeflags = __webpack_require__(168);
|
||
|
||
const pp = _state.Parser.prototype;
|
||
|
||
class Scope {
|
||
constructor(flags) {
|
||
this.flags = flags;
|
||
// A list of var-declared names in the current lexical scope
|
||
this.var = [];
|
||
// A list of lexically-declared names in the current lexical scope
|
||
this.lexical = [];
|
||
// A list of lexically-declared FunctionDeclaration names in the current lexical scope
|
||
this.functions = [];
|
||
}
|
||
}
|
||
|
||
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
||
|
||
pp.enterScope = function (flags) {
|
||
this.scopeStack.push(new Scope(flags));
|
||
};
|
||
|
||
pp.exitScope = function () {
|
||
this.scopeStack.pop();
|
||
};
|
||
|
||
// The spec says:
|
||
// > At the top level of a function, or script, function declarations are
|
||
// > treated like var declarations rather than like lexical declarations.
|
||
pp.treatFunctionsAsVarInScope = function (scope) {
|
||
return scope.flags & _scopeflags.SCOPE_FUNCTION || !this.inModule && scope.flags & _scopeflags.SCOPE_TOP;
|
||
};
|
||
|
||
pp.declareName = function (name, bindingType, pos) {
|
||
let redeclared = false;
|
||
if (bindingType === _scopeflags.BIND_LEXICAL) {
|
||
const scope = this.currentScope();
|
||
redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
|
||
scope.lexical.push(name);
|
||
if (this.inModule && scope.flags & _scopeflags.SCOPE_TOP) delete this.undefinedExports[name];
|
||
} else if (bindingType === _scopeflags.BIND_SIMPLE_CATCH) {
|
||
const scope = this.currentScope();
|
||
scope.lexical.push(name);
|
||
} else if (bindingType === _scopeflags.BIND_FUNCTION) {
|
||
const scope = this.currentScope();
|
||
if (this.treatFunctionsAsVar) redeclared = scope.lexical.indexOf(name) > -1;else redeclared = scope.lexical.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
|
||
scope.functions.push(name);
|
||
} else {
|
||
for (let i = this.scopeStack.length - 1; i >= 0; --i) {
|
||
const scope = this.scopeStack[i];
|
||
if (scope.lexical.indexOf(name) > -1 && !(scope.flags & _scopeflags.SCOPE_SIMPLE_CATCH && scope.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.indexOf(name) > -1) {
|
||
redeclared = true;
|
||
break;
|
||
}
|
||
scope.var.push(name);
|
||
if (this.inModule && scope.flags & _scopeflags.SCOPE_TOP) delete this.undefinedExports[name];
|
||
if (scope.flags & _scopeflags.SCOPE_VAR) break;
|
||
}
|
||
}
|
||
if (redeclared) this.raiseRecoverable(pos, `Identifier '${name}' has already been declared`);
|
||
};
|
||
|
||
pp.checkLocalExport = function (id) {
|
||
// scope.functions must be empty as Module code is always strict.
|
||
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1) {
|
||
this.undefinedExports[id.name] = id;
|
||
}
|
||
};
|
||
|
||
pp.currentScope = function () {
|
||
return this.scopeStack[this.scopeStack.length - 1];
|
||
};
|
||
|
||
pp.currentVarScope = function () {
|
||
for (let i = this.scopeStack.length - 1;; i--) {
|
||
let scope = this.scopeStack[i];
|
||
if (scope.flags & _scopeflags.SCOPE_VAR) return scope;
|
||
}
|
||
};
|
||
|
||
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
|
||
pp.currentThisScope = function () {
|
||
for (let i = this.scopeStack.length - 1;; i--) {
|
||
let scope = this.scopeStack[i];
|
||
if (scope.flags & _scopeflags.SCOPE_VAR && !(scope.flags & _scopeflags.SCOPE_ARROW)) return scope;
|
||
}
|
||
};
|
||
|
||
/***/ }),
|
||
/* 175 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.Node = undefined;
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
var _locutil = __webpack_require__(167);
|
||
|
||
class Node {
|
||
constructor(parser, pos, loc) {
|
||
this.type = "";
|
||
this.start = pos;
|
||
this.end = 0;
|
||
if (parser.options.locations) this.loc = new _locutil.SourceLocation(parser, loc);
|
||
if (parser.options.directSourceFile) this.sourceFile = parser.options.directSourceFile;
|
||
if (parser.options.ranges) this.range = [pos, 0];
|
||
}
|
||
}
|
||
|
||
exports.Node = Node; // Start an AST node, attaching a start offset.
|
||
|
||
const pp = _state.Parser.prototype;
|
||
|
||
pp.startNode = function () {
|
||
return new Node(this, this.start, this.startLoc);
|
||
};
|
||
|
||
pp.startNodeAt = function (pos, loc) {
|
||
return new Node(this, pos, loc);
|
||
};
|
||
|
||
// Finish an AST node, adding `type` and `end` properties.
|
||
|
||
function finishNodeAt(node, type, pos, loc) {
|
||
node.type = type;
|
||
node.end = pos;
|
||
if (this.options.locations) node.loc.end = loc;
|
||
if (this.options.ranges) node.range[1] = pos;
|
||
return node;
|
||
}
|
||
|
||
pp.finishNode = function (node, type) {
|
||
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc);
|
||
};
|
||
|
||
// Finish node at given position
|
||
|
||
pp.finishNodeAt = function (node, type, pos, loc) {
|
||
return finishNodeAt.call(this, node, type, pos, loc);
|
||
};
|
||
|
||
pp.copyNode = function (node) {
|
||
let newNode = new Node(this, node.start, this.startLoc);
|
||
for (let prop in node) newNode[prop] = node[prop];
|
||
return newNode;
|
||
};
|
||
|
||
/***/ }),
|
||
/* 176 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.types = exports.TokContext = undefined;
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
var _tokentype = __webpack_require__(163);
|
||
|
||
var _whitespace = __webpack_require__(164);
|
||
|
||
class TokContext {
|
||
constructor(token, isExpr, preserveSpace, override, generator) {
|
||
this.token = token;
|
||
this.isExpr = !!isExpr;
|
||
this.preserveSpace = !!preserveSpace;
|
||
this.override = override;
|
||
this.generator = !!generator;
|
||
}
|
||
}
|
||
|
||
exports.TokContext = TokContext; // The algorithm used to determine whether a regexp can appear at a
|
||
// given point in the program is loosely based on sweet.js' approach.
|
||
// See https://github.com/mozilla/sweet.js/wiki/design
|
||
|
||
const types = exports.types = {
|
||
b_stat: new TokContext("{", false),
|
||
b_expr: new TokContext("{", true),
|
||
b_tmpl: new TokContext("${", false),
|
||
p_stat: new TokContext("(", false),
|
||
p_expr: new TokContext("(", true),
|
||
q_tmpl: new TokContext("`", true, true, p => p.tryReadTemplateToken()),
|
||
f_stat: new TokContext("function", false),
|
||
f_expr: new TokContext("function", true),
|
||
f_expr_gen: new TokContext("function", true, false, null, true),
|
||
f_gen: new TokContext("function", false, false, null, true)
|
||
};
|
||
|
||
const pp = _state.Parser.prototype;
|
||
|
||
pp.initialContext = function () {
|
||
return [types.b_stat];
|
||
};
|
||
|
||
pp.braceIsBlock = function (prevType) {
|
||
let parent = this.curContext();
|
||
if (parent === types.f_expr || parent === types.f_stat) return true;
|
||
if (prevType === _tokentype.types.colon && (parent === types.b_stat || parent === types.b_expr)) return !parent.isExpr;
|
||
|
||
// The check for `tt.name && exprAllowed` detects whether we are
|
||
// after a `yield` or `of` construct. See the `updateContext` for
|
||
// `tt.name`.
|
||
if (prevType === _tokentype.types._return || prevType === _tokentype.types.name && this.exprAllowed) return _whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
|
||
if (prevType === _tokentype.types._else || prevType === _tokentype.types.semi || prevType === _tokentype.types.eof || prevType === _tokentype.types.parenR || prevType === _tokentype.types.arrow) return true;
|
||
if (prevType === _tokentype.types.braceL) return parent === types.b_stat;
|
||
if (prevType === _tokentype.types._var || prevType === _tokentype.types._const || prevType === _tokentype.types.name) return false;
|
||
return !this.exprAllowed;
|
||
};
|
||
|
||
pp.inGeneratorContext = function () {
|
||
for (let i = this.context.length - 1; i >= 1; i--) {
|
||
let context = this.context[i];
|
||
if (context.token === "function") return context.generator;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
pp.updateContext = function (prevType) {
|
||
let update,
|
||
type = this.type;
|
||
if (type.keyword && prevType === _tokentype.types.dot) this.exprAllowed = false;else if (update = type.updateContext) update.call(this, prevType);else this.exprAllowed = type.beforeExpr;
|
||
};
|
||
|
||
// Token-specific context update code
|
||
|
||
_tokentype.types.parenR.updateContext = _tokentype.types.braceR.updateContext = function () {
|
||
if (this.context.length === 1) {
|
||
this.exprAllowed = true;
|
||
return;
|
||
}
|
||
let out = this.context.pop();
|
||
if (out === types.b_stat && this.curContext().token === "function") {
|
||
out = this.context.pop();
|
||
}
|
||
this.exprAllowed = !out.isExpr;
|
||
};
|
||
|
||
_tokentype.types.braceL.updateContext = function (prevType) {
|
||
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
|
||
this.exprAllowed = true;
|
||
};
|
||
|
||
_tokentype.types.dollarBraceL.updateContext = function () {
|
||
this.context.push(types.b_tmpl);
|
||
this.exprAllowed = true;
|
||
};
|
||
|
||
_tokentype.types.parenL.updateContext = function (prevType) {
|
||
let statementParens = prevType === _tokentype.types._if || prevType === _tokentype.types._for || prevType === _tokentype.types._with || prevType === _tokentype.types._while;
|
||
this.context.push(statementParens ? types.p_stat : types.p_expr);
|
||
this.exprAllowed = true;
|
||
};
|
||
|
||
_tokentype.types.incDec.updateContext = function () {
|
||
// tokExprAllowed stays unchanged
|
||
};
|
||
|
||
_tokentype.types._function.updateContext = _tokentype.types._class.updateContext = function (prevType) {
|
||
if (prevType.beforeExpr && prevType !== _tokentype.types._else && !(prevType === _tokentype.types.semi && this.curContext() !== types.p_stat) && !(prevType === _tokentype.types._return && _whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === _tokentype.types.colon || prevType === _tokentype.types.braceL) && this.curContext() === types.b_stat)) this.context.push(types.f_expr);else this.context.push(types.f_stat);
|
||
this.exprAllowed = false;
|
||
};
|
||
|
||
_tokentype.types.backQuote.updateContext = function () {
|
||
if (this.curContext() === types.q_tmpl) this.context.pop();else this.context.push(types.q_tmpl);
|
||
this.exprAllowed = false;
|
||
};
|
||
|
||
_tokentype.types.star.updateContext = function (prevType) {
|
||
if (prevType === _tokentype.types._function) {
|
||
let index = this.context.length - 1;
|
||
if (this.context[index] === types.f_expr) this.context[index] = types.f_expr_gen;else this.context[index] = types.f_gen;
|
||
}
|
||
this.exprAllowed = true;
|
||
};
|
||
|
||
_tokentype.types.name.updateContext = function (prevType) {
|
||
let allowed = false;
|
||
if (this.options.ecmaVersion >= 6 && prevType !== _tokentype.types.dot) {
|
||
if (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) allowed = true;
|
||
}
|
||
this.exprAllowed = allowed;
|
||
};
|
||
|
||
/***/ }),
|
||
/* 177 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.Token = undefined;
|
||
|
||
var _identifier = __webpack_require__(162);
|
||
|
||
var _tokentype = __webpack_require__(163);
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
var _locutil = __webpack_require__(167);
|
||
|
||
var _regexp = __webpack_require__(178);
|
||
|
||
var _whitespace = __webpack_require__(164);
|
||
|
||
// Object type used to represent tokens. Note that normally, tokens
|
||
// simply exist as properties on the parser object. This is only
|
||
// used for the onToken callback and the external tokenizer.
|
||
|
||
class Token {
|
||
constructor(p) {
|
||
this.type = p.type;
|
||
this.value = p.value;
|
||
this.start = p.start;
|
||
this.end = p.end;
|
||
if (p.options.locations) this.loc = new _locutil.SourceLocation(p, p.startLoc, p.endLoc);
|
||
if (p.options.ranges) this.range = [p.start, p.end];
|
||
}
|
||
}
|
||
|
||
exports.Token = Token; // ## Tokenizer
|
||
|
||
const pp = _state.Parser.prototype;
|
||
|
||
// Move to the next token
|
||
|
||
pp.next = function (ignoreEscapeSequenceInKeyword) {
|
||
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword);
|
||
if (this.options.onToken) this.options.onToken(new Token(this));
|
||
|
||
this.lastTokEnd = this.end;
|
||
this.lastTokStart = this.start;
|
||
this.lastTokEndLoc = this.endLoc;
|
||
this.lastTokStartLoc = this.startLoc;
|
||
this.nextToken();
|
||
};
|
||
|
||
pp.getToken = function () {
|
||
this.next();
|
||
return new Token(this);
|
||
};
|
||
|
||
// If we're in an ES6 environment, make parsers iterable
|
||
if (typeof Symbol !== "undefined") pp[Symbol.iterator] = function () {
|
||
return {
|
||
next: () => {
|
||
let token = this.getToken();
|
||
return {
|
||
done: token.type === _tokentype.types.eof,
|
||
value: token
|
||
};
|
||
}
|
||
};
|
||
};
|
||
|
||
// Toggle strict mode. Re-reads the next number or string to please
|
||
// pedantic tests (`"use strict"; 010;` should fail).
|
||
|
||
pp.curContext = function () {
|
||
return this.context[this.context.length - 1];
|
||
};
|
||
|
||
// Read a single token, updating the parser object's token-related
|
||
// properties.
|
||
|
||
pp.nextToken = function () {
|
||
let curContext = this.curContext();
|
||
if (!curContext || !curContext.preserveSpace) this.skipSpace();
|
||
|
||
this.start = this.pos;
|
||
if (this.options.locations) this.startLoc = this.curPosition();
|
||
if (this.pos >= this.input.length) return this.finishToken(_tokentype.types.eof);
|
||
|
||
if (curContext.override) return curContext.override(this);else this.readToken(this.fullCharCodeAtPos());
|
||
};
|
||
|
||
pp.readToken = function (code) {
|
||
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
||
// identifiers, so '\' also dispatches to that.
|
||
if ((0, _identifier.isIdentifierStart)(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */) return this.readWord();
|
||
|
||
return this.getTokenFromCode(code);
|
||
};
|
||
|
||
pp.fullCharCodeAtPos = function () {
|
||
let code = this.input.charCodeAt(this.pos);
|
||
if (code <= 0xd7ff || code >= 0xe000) return code;
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
return (code << 10) + next - 0x35fdc00;
|
||
};
|
||
|
||
pp.skipBlockComment = function () {
|
||
let startLoc = this.options.onComment && this.curPosition();
|
||
let start = this.pos,
|
||
end = this.input.indexOf("*/", this.pos += 2);
|
||
if (end === -1) this.raise(this.pos - 2, "Unterminated comment");
|
||
this.pos = end + 2;
|
||
if (this.options.locations) {
|
||
_whitespace.lineBreakG.lastIndex = start;
|
||
let match;
|
||
while ((match = _whitespace.lineBreakG.exec(this.input)) && match.index < this.pos) {
|
||
++this.curLine;
|
||
this.lineStart = match.index + match[0].length;
|
||
}
|
||
}
|
||
if (this.options.onComment) this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos, startLoc, this.curPosition());
|
||
};
|
||
|
||
pp.skipLineComment = function (startSkip) {
|
||
let start = this.pos;
|
||
let startLoc = this.options.onComment && this.curPosition();
|
||
let ch = this.input.charCodeAt(this.pos += startSkip);
|
||
while (this.pos < this.input.length && !(0, _whitespace.isNewLine)(ch)) {
|
||
ch = this.input.charCodeAt(++this.pos);
|
||
}
|
||
if (this.options.onComment) this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, startLoc, this.curPosition());
|
||
};
|
||
|
||
// Called at the start of the parse and after every token. Skips
|
||
// whitespace and comments, and.
|
||
|
||
pp.skipSpace = function () {
|
||
loop: while (this.pos < this.input.length) {
|
||
let ch = this.input.charCodeAt(this.pos);
|
||
switch (ch) {
|
||
case 32:case 160:
|
||
// ' '
|
||
++this.pos;
|
||
break;
|
||
case 13:
|
||
if (this.input.charCodeAt(this.pos + 1) === 10) {
|
||
++this.pos;
|
||
}
|
||
case 10:case 8232:case 8233:
|
||
++this.pos;
|
||
if (this.options.locations) {
|
||
++this.curLine;
|
||
this.lineStart = this.pos;
|
||
}
|
||
break;
|
||
case 47:
|
||
// '/'
|
||
switch (this.input.charCodeAt(this.pos + 1)) {
|
||
case 42:
|
||
// '*'
|
||
this.skipBlockComment();
|
||
break;
|
||
case 47:
|
||
this.skipLineComment(2);
|
||
break;
|
||
default:
|
||
break loop;
|
||
}
|
||
break;
|
||
default:
|
||
if (ch > 8 && ch < 14 || ch >= 5760 && _whitespace.nonASCIIwhitespace.test(String.fromCharCode(ch))) {
|
||
++this.pos;
|
||
} else {
|
||
break loop;
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
// Called at the end of every token. Sets `end`, `val`, and
|
||
// maintains `context` and `exprAllowed`, and skips the space after
|
||
// the token, so that the next one's `start` will point at the
|
||
// right position.
|
||
|
||
pp.finishToken = function (type, val) {
|
||
this.end = this.pos;
|
||
if (this.options.locations) this.endLoc = this.curPosition();
|
||
let prevType = this.type;
|
||
this.type = type;
|
||
this.value = val;
|
||
|
||
this.updateContext(prevType);
|
||
};
|
||
|
||
// ### Token reading
|
||
|
||
// This is the function that is called to fetch the next token. It
|
||
// is somewhat obscure, because it works in character codes rather
|
||
// than characters, and because operator parsing has been inlined
|
||
// into it.
|
||
//
|
||
// All in the name of speed.
|
||
//
|
||
pp.readToken_dot = function () {
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
if (next >= 48 && next <= 57) return this.readNumber(true);
|
||
let next2 = this.input.charCodeAt(this.pos + 2);
|
||
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) {
|
||
// 46 = dot '.'
|
||
this.pos += 3;
|
||
return this.finishToken(_tokentype.types.ellipsis);
|
||
} else {
|
||
++this.pos;
|
||
return this.finishToken(_tokentype.types.dot);
|
||
}
|
||
};
|
||
|
||
pp.readToken_slash = function () {
|
||
// '/'
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
if (this.exprAllowed) {
|
||
++this.pos;return this.readRegexp();
|
||
}
|
||
if (next === 61) return this.finishOp(_tokentype.types.assign, 2);
|
||
return this.finishOp(_tokentype.types.slash, 1);
|
||
};
|
||
|
||
pp.readToken_mult_modulo_exp = function (code) {
|
||
// '%*'
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
let size = 1;
|
||
let tokentype = code === 42 ? _tokentype.types.star : _tokentype.types.modulo;
|
||
|
||
// exponentiation operator ** and **=
|
||
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
|
||
++size;
|
||
tokentype = _tokentype.types.starstar;
|
||
next = this.input.charCodeAt(this.pos + 2);
|
||
}
|
||
|
||
if (next === 61) return this.finishOp(_tokentype.types.assign, size + 1);
|
||
return this.finishOp(tokentype, size);
|
||
};
|
||
|
||
pp.readToken_pipe_amp = function (code) {
|
||
// '|&'
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
if (next === code) {
|
||
if (this.options.ecmaVersion >= 12) {
|
||
let next2 = this.input.charCodeAt(this.pos + 2);
|
||
if (next2 === 61) return this.finishOp(_tokentype.types.assign, 3);
|
||
}
|
||
return this.finishOp(code === 124 ? _tokentype.types.logicalOR : _tokentype.types.logicalAND, 2);
|
||
}
|
||
if (next === 61) return this.finishOp(_tokentype.types.assign, 2);
|
||
return this.finishOp(code === 124 ? _tokentype.types.bitwiseOR : _tokentype.types.bitwiseAND, 1);
|
||
};
|
||
|
||
pp.readToken_caret = function () {
|
||
// '^'
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
if (next === 61) return this.finishOp(_tokentype.types.assign, 2);
|
||
return this.finishOp(_tokentype.types.bitwiseXOR, 1);
|
||
};
|
||
|
||
pp.readToken_plus_min = function (code) {
|
||
// '+-'
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
if (next === code) {
|
||
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || _whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
|
||
// A `-->` line comment
|
||
this.skipLineComment(3);
|
||
this.skipSpace();
|
||
return this.nextToken();
|
||
}
|
||
return this.finishOp(_tokentype.types.incDec, 2);
|
||
}
|
||
if (next === 61) return this.finishOp(_tokentype.types.assign, 2);
|
||
return this.finishOp(_tokentype.types.plusMin, 1);
|
||
};
|
||
|
||
pp.readToken_lt_gt = function (code) {
|
||
// '<>'
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
let size = 1;
|
||
if (next === code) {
|
||
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
|
||
if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(_tokentype.types.assign, size + 1);
|
||
return this.finishOp(_tokentype.types.bitShift, size);
|
||
}
|
||
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) {
|
||
// `<!--`, an XML-style comment that should be interpreted as a line comment
|
||
this.skipLineComment(4);
|
||
this.skipSpace();
|
||
return this.nextToken();
|
||
}
|
||
if (next === 61) size = 2;
|
||
return this.finishOp(_tokentype.types.relational, size);
|
||
};
|
||
|
||
pp.readToken_eq_excl = function (code) {
|
||
// '=!'
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
if (next === 61) return this.finishOp(_tokentype.types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2);
|
||
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) {
|
||
// '=>'
|
||
this.pos += 2;
|
||
return this.finishToken(_tokentype.types.arrow);
|
||
}
|
||
return this.finishOp(code === 61 ? _tokentype.types.eq : _tokentype.types.prefix, 1);
|
||
};
|
||
|
||
pp.readToken_question = function () {
|
||
// '?'
|
||
const ecmaVersion = this.options.ecmaVersion;
|
||
if (ecmaVersion >= 11) {
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
if (next === 46) {
|
||
let next2 = this.input.charCodeAt(this.pos + 2);
|
||
if (next2 < 48 || next2 > 57) return this.finishOp(_tokentype.types.questionDot, 2);
|
||
}
|
||
if (next === 63) {
|
||
if (ecmaVersion >= 12) {
|
||
let next2 = this.input.charCodeAt(this.pos + 2);
|
||
if (next2 === 61) return this.finishOp(_tokentype.types.assign, 3);
|
||
}
|
||
return this.finishOp(_tokentype.types.coalesce, 2);
|
||
}
|
||
}
|
||
return this.finishOp(_tokentype.types.question, 1);
|
||
};
|
||
|
||
pp.getTokenFromCode = function (code) {
|
||
switch (code) {
|
||
// The interpretation of a dot depends on whether it is followed
|
||
// by a digit or another two dots.
|
||
case 46:
|
||
// '.'
|
||
return this.readToken_dot();
|
||
|
||
// Punctuation tokens.
|
||
case 40:
|
||
++this.pos;return this.finishToken(_tokentype.types.parenL);
|
||
case 41:
|
||
++this.pos;return this.finishToken(_tokentype.types.parenR);
|
||
case 59:
|
||
++this.pos;return this.finishToken(_tokentype.types.semi);
|
||
case 44:
|
||
++this.pos;return this.finishToken(_tokentype.types.comma);
|
||
case 91:
|
||
++this.pos;return this.finishToken(_tokentype.types.bracketL);
|
||
case 93:
|
||
++this.pos;return this.finishToken(_tokentype.types.bracketR);
|
||
case 123:
|
||
++this.pos;return this.finishToken(_tokentype.types.braceL);
|
||
case 125:
|
||
++this.pos;return this.finishToken(_tokentype.types.braceR);
|
||
case 58:
|
||
++this.pos;return this.finishToken(_tokentype.types.colon);
|
||
|
||
case 96:
|
||
// '`'
|
||
if (this.options.ecmaVersion < 6) break;
|
||
++this.pos;
|
||
return this.finishToken(_tokentype.types.backQuote);
|
||
|
||
case 48:
|
||
// '0'
|
||
let next = this.input.charCodeAt(this.pos + 1);
|
||
if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number
|
||
if (this.options.ecmaVersion >= 6) {
|
||
if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number
|
||
if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number
|
||
}
|
||
|
||
// Anything else beginning with a digit is an integer, octal
|
||
// number, or float.
|
||
case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:
|
||
// 1-9
|
||
return this.readNumber(false);
|
||
|
||
// Quotes produce strings.
|
||
case 34:case 39:
|
||
// '"', "'"
|
||
return this.readString(code);
|
||
|
||
// Operators are parsed inline in tiny state machines. '=' (61) is
|
||
// often referred to. `finishOp` simply skips the amount of
|
||
// characters it is given as second argument, and returns a token
|
||
// of the type given by its first argument.
|
||
|
||
case 47:
|
||
// '/'
|
||
return this.readToken_slash();
|
||
|
||
case 37:case 42:
|
||
// '%*'
|
||
return this.readToken_mult_modulo_exp(code);
|
||
|
||
case 124:case 38:
|
||
// '|&'
|
||
return this.readToken_pipe_amp(code);
|
||
|
||
case 94:
|
||
// '^'
|
||
return this.readToken_caret();
|
||
|
||
case 43:case 45:
|
||
// '+-'
|
||
return this.readToken_plus_min(code);
|
||
|
||
case 60:case 62:
|
||
// '<>'
|
||
return this.readToken_lt_gt(code);
|
||
|
||
case 61:case 33:
|
||
// '=!'
|
||
return this.readToken_eq_excl(code);
|
||
|
||
case 63:
|
||
// '?'
|
||
return this.readToken_question();
|
||
|
||
case 126:
|
||
// '~'
|
||
return this.finishOp(_tokentype.types.prefix, 1);
|
||
}
|
||
|
||
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
||
};
|
||
|
||
pp.finishOp = function (type, size) {
|
||
let str = this.input.slice(this.pos, this.pos + size);
|
||
this.pos += size;
|
||
return this.finishToken(type, str);
|
||
};
|
||
|
||
pp.readRegexp = function () {
|
||
let escaped,
|
||
inClass,
|
||
start = this.pos;
|
||
for (;;) {
|
||
if (this.pos >= this.input.length) this.raise(start, "Unterminated regular expression");
|
||
let ch = this.input.charAt(this.pos);
|
||
if (_whitespace.lineBreak.test(ch)) this.raise(start, "Unterminated regular expression");
|
||
if (!escaped) {
|
||
if (ch === "[") inClass = true;else if (ch === "]" && inClass) inClass = false;else if (ch === "/" && !inClass) break;
|
||
escaped = ch === "\\";
|
||
} else escaped = false;
|
||
++this.pos;
|
||
}
|
||
let pattern = this.input.slice(start, this.pos);
|
||
++this.pos;
|
||
let flagsStart = this.pos;
|
||
let flags = this.readWord1();
|
||
if (this.containsEsc) this.unexpected(flagsStart);
|
||
|
||
// Validate pattern
|
||
const state = this.regexpState || (this.regexpState = new _regexp.RegExpValidationState(this));
|
||
state.reset(start, pattern, flags);
|
||
this.validateRegExpFlags(state);
|
||
this.validateRegExpPattern(state);
|
||
|
||
// Create Literal#value property value.
|
||
let value = null;
|
||
try {
|
||
value = new RegExp(pattern, flags);
|
||
} catch (e) {
|
||
// ESTree requires null if it failed to instantiate RegExp object.
|
||
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
|
||
}
|
||
|
||
return this.finishToken(_tokentype.types.regexp, { pattern, flags, value });
|
||
};
|
||
|
||
// Read an integer in the given radix. Return null if zero digits
|
||
// were read, the integer value otherwise. When `len` is given, this
|
||
// will return `null` unless the integer has exactly `len` digits.
|
||
|
||
pp.readInt = function (radix, len, maybeLegacyOctalNumericLiteral) {
|
||
// `len` is used for character escape sequences. In that case, disallow separators.
|
||
const allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
|
||
|
||
// `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)
|
||
// and isn't fraction part nor exponent part. In that case, if the first digit
|
||
// is zero then disallow separators.
|
||
const isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
|
||
|
||
let start = this.pos,
|
||
total = 0,
|
||
lastCode = 0;
|
||
for (let i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
|
||
let code = this.input.charCodeAt(this.pos),
|
||
val;
|
||
|
||
if (allowSeparators && code === 95) {
|
||
if (isLegacyOctalNumericLiteral) this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals");
|
||
if (lastCode === 95) this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore");
|
||
if (i === 0) this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits");
|
||
lastCode = code;
|
||
continue;
|
||
}
|
||
|
||
if (code >= 97) val = code - 97 + 10; // a
|
||
else if (code >= 65) val = code - 65 + 10; // A
|
||
else if (code >= 48 && code <= 57) val = code - 48; // 0-9
|
||
else val = Infinity;
|
||
if (val >= radix) break;
|
||
lastCode = code;
|
||
total = total * radix + val;
|
||
}
|
||
|
||
if (allowSeparators && lastCode === 95) this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits");
|
||
if (this.pos === start || len != null && this.pos - start !== len) return null;
|
||
|
||
return total;
|
||
};
|
||
|
||
function stringToNumber(str, isLegacyOctalNumericLiteral) {
|
||
if (isLegacyOctalNumericLiteral) {
|
||
return parseInt(str, 8);
|
||
}
|
||
|
||
// `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
|
||
return parseFloat(str.replace(/_/g, ""));
|
||
}
|
||
|
||
function stringToBigInt(str) {
|
||
if (typeof BigInt !== "function") {
|
||
return null;
|
||
}
|
||
|
||
// `BigInt(value)` throws syntax error if the string contains numeric separators.
|
||
return BigInt(str.replace(/_/g, ""));
|
||
}
|
||
|
||
pp.readRadixNumber = function (radix) {
|
||
let start = this.pos;
|
||
this.pos += 2; // 0x
|
||
let val = this.readInt(radix);
|
||
if (val == null) this.raise(this.start + 2, "Expected number in radix " + radix);
|
||
if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
|
||
val = stringToBigInt(this.input.slice(start, this.pos));
|
||
++this.pos;
|
||
} else if ((0, _identifier.isIdentifierStart)(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");
|
||
return this.finishToken(_tokentype.types.num, val);
|
||
};
|
||
|
||
// Read an integer, octal integer, or floating-point number.
|
||
|
||
pp.readNumber = function (startsWithDot) {
|
||
let start = this.pos;
|
||
if (!startsWithDot && this.readInt(10, undefined, true) === null) this.raise(start, "Invalid number");
|
||
let octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
||
if (octal && this.strict) this.raise(start, "Invalid number");
|
||
let next = this.input.charCodeAt(this.pos);
|
||
if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
|
||
let val = stringToBigInt(this.input.slice(start, this.pos));
|
||
++this.pos;
|
||
if ((0, _identifier.isIdentifierStart)(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");
|
||
return this.finishToken(_tokentype.types.num, val);
|
||
}
|
||
if (octal && /[89]/.test(this.input.slice(start, this.pos))) octal = false;
|
||
if (next === 46 && !octal) {
|
||
// '.'
|
||
++this.pos;
|
||
this.readInt(10);
|
||
next = this.input.charCodeAt(this.pos);
|
||
}
|
||
if ((next === 69 || next === 101) && !octal) {
|
||
// 'eE'
|
||
next = this.input.charCodeAt(++this.pos);
|
||
if (next === 43 || next === 45) ++this.pos; // '+-'
|
||
if (this.readInt(10) === null) this.raise(start, "Invalid number");
|
||
}
|
||
if ((0, _identifier.isIdentifierStart)(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");
|
||
|
||
let val = stringToNumber(this.input.slice(start, this.pos), octal);
|
||
return this.finishToken(_tokentype.types.num, val);
|
||
};
|
||
|
||
// Read a string value, interpreting backslash-escapes.
|
||
|
||
pp.readCodePoint = function () {
|
||
let ch = this.input.charCodeAt(this.pos),
|
||
code;
|
||
|
||
if (ch === 123) {
|
||
// '{'
|
||
if (this.options.ecmaVersion < 6) this.unexpected();
|
||
let codePos = ++this.pos;
|
||
code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
|
||
++this.pos;
|
||
if (code > 0x10FFFF) this.invalidStringToken(codePos, "Code point out of bounds");
|
||
} else {
|
||
code = this.readHexChar(4);
|
||
}
|
||
return code;
|
||
};
|
||
|
||
function codePointToString(code) {
|
||
// UTF-16 Decoding
|
||
if (code <= 0xFFFF) return String.fromCharCode(code);
|
||
code -= 0x10000;
|
||
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00);
|
||
}
|
||
|
||
pp.readString = function (quote) {
|
||
let out = "",
|
||
chunkStart = ++this.pos;
|
||
for (;;) {
|
||
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated string constant");
|
||
let ch = this.input.charCodeAt(this.pos);
|
||
if (ch === quote) break;
|
||
if (ch === 92) {
|
||
// '\'
|
||
out += this.input.slice(chunkStart, this.pos);
|
||
out += this.readEscapedChar(false);
|
||
chunkStart = this.pos;
|
||
} else {
|
||
if ((0, _whitespace.isNewLine)(ch, this.options.ecmaVersion >= 10)) this.raise(this.start, "Unterminated string constant");
|
||
++this.pos;
|
||
}
|
||
}
|
||
out += this.input.slice(chunkStart, this.pos++);
|
||
return this.finishToken(_tokentype.types.string, out);
|
||
};
|
||
|
||
// Reads template string tokens.
|
||
|
||
const INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
||
|
||
pp.tryReadTemplateToken = function () {
|
||
this.inTemplateElement = true;
|
||
try {
|
||
this.readTmplToken();
|
||
} catch (err) {
|
||
if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {
|
||
this.readInvalidTemplateToken();
|
||
} else {
|
||
throw err;
|
||
}
|
||
}
|
||
|
||
this.inTemplateElement = false;
|
||
};
|
||
|
||
pp.invalidStringToken = function (position, message) {
|
||
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
|
||
throw INVALID_TEMPLATE_ESCAPE_ERROR;
|
||
} else {
|
||
this.raise(position, message);
|
||
}
|
||
};
|
||
|
||
pp.readTmplToken = function () {
|
||
let out = "",
|
||
chunkStart = this.pos;
|
||
for (;;) {
|
||
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated template");
|
||
let ch = this.input.charCodeAt(this.pos);
|
||
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) {
|
||
// '`', '${'
|
||
if (this.pos === this.start && (this.type === _tokentype.types.template || this.type === _tokentype.types.invalidTemplate)) {
|
||
if (ch === 36) {
|
||
this.pos += 2;
|
||
return this.finishToken(_tokentype.types.dollarBraceL);
|
||
} else {
|
||
++this.pos;
|
||
return this.finishToken(_tokentype.types.backQuote);
|
||
}
|
||
}
|
||
out += this.input.slice(chunkStart, this.pos);
|
||
return this.finishToken(_tokentype.types.template, out);
|
||
}
|
||
if (ch === 92) {
|
||
// '\'
|
||
out += this.input.slice(chunkStart, this.pos);
|
||
out += this.readEscapedChar(true);
|
||
chunkStart = this.pos;
|
||
} else if ((0, _whitespace.isNewLine)(ch)) {
|
||
out += this.input.slice(chunkStart, this.pos);
|
||
++this.pos;
|
||
switch (ch) {
|
||
case 13:
|
||
if (this.input.charCodeAt(this.pos) === 10) ++this.pos;
|
||
case 10:
|
||
out += "\n";
|
||
break;
|
||
default:
|
||
out += String.fromCharCode(ch);
|
||
break;
|
||
}
|
||
if (this.options.locations) {
|
||
++this.curLine;
|
||
this.lineStart = this.pos;
|
||
}
|
||
chunkStart = this.pos;
|
||
} else {
|
||
++this.pos;
|
||
}
|
||
}
|
||
};
|
||
|
||
// Reads a template token to search for the end, without validating any escape sequences
|
||
pp.readInvalidTemplateToken = function () {
|
||
for (; this.pos < this.input.length; this.pos++) {
|
||
switch (this.input[this.pos]) {
|
||
case "\\":
|
||
++this.pos;
|
||
break;
|
||
|
||
case "$":
|
||
if (this.input[this.pos + 1] !== "{") {
|
||
break;
|
||
}
|
||
// falls through
|
||
|
||
case "`":
|
||
return this.finishToken(_tokentype.types.invalidTemplate, this.input.slice(this.start, this.pos));
|
||
|
||
// no default
|
||
}
|
||
}
|
||
this.raise(this.start, "Unterminated template");
|
||
};
|
||
|
||
// Used to read escaped characters
|
||
|
||
pp.readEscapedChar = function (inTemplate) {
|
||
let ch = this.input.charCodeAt(++this.pos);
|
||
++this.pos;
|
||
switch (ch) {
|
||
case 110:
|
||
return "\n"; // 'n' -> '\n'
|
||
case 114:
|
||
return "\r"; // 'r' -> '\r'
|
||
case 120:
|
||
return String.fromCharCode(this.readHexChar(2)); // 'x'
|
||
case 117:
|
||
return codePointToString(this.readCodePoint()); // 'u'
|
||
case 116:
|
||
return "\t"; // 't' -> '\t'
|
||
case 98:
|
||
return "\b"; // 'b' -> '\b'
|
||
case 118:
|
||
return "\u000b"; // 'v' -> '\u000b'
|
||
case 102:
|
||
return "\f"; // 'f' -> '\f'
|
||
case 13:
|
||
if (this.input.charCodeAt(this.pos) === 10) ++this.pos; // '\r\n'
|
||
case 10:
|
||
// ' \n'
|
||
if (this.options.locations) {
|
||
this.lineStart = this.pos;++this.curLine;
|
||
}
|
||
return "";
|
||
case 56:
|
||
case 57:
|
||
if (this.strict) {
|
||
this.invalidStringToken(this.pos - 1, "Invalid escape sequence");
|
||
}
|
||
if (inTemplate) {
|
||
const codePos = this.pos - 1;
|
||
|
||
this.invalidStringToken(codePos, "Invalid escape sequence in template string");
|
||
|
||
return null;
|
||
}
|
||
default:
|
||
if (ch >= 48 && ch <= 55) {
|
||
let octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];
|
||
let octal = parseInt(octalStr, 8);
|
||
if (octal > 255) {
|
||
octalStr = octalStr.slice(0, -1);
|
||
octal = parseInt(octalStr, 8);
|
||
}
|
||
this.pos += octalStr.length - 1;
|
||
ch = this.input.charCodeAt(this.pos);
|
||
if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {
|
||
this.invalidStringToken(this.pos - 1 - octalStr.length, inTemplate ? "Octal literal in template string" : "Octal literal in strict mode");
|
||
}
|
||
return String.fromCharCode(octal);
|
||
}
|
||
if ((0, _whitespace.isNewLine)(ch)) {
|
||
// Unicode new line characters after \ get removed from output in both
|
||
// template literals and strings
|
||
return "";
|
||
}
|
||
return String.fromCharCode(ch);
|
||
}
|
||
};
|
||
|
||
// Used to read character escape sequences ('\x', '\u', '\U').
|
||
|
||
pp.readHexChar = function (len) {
|
||
let codePos = this.pos;
|
||
let n = this.readInt(16, len);
|
||
if (n === null) this.invalidStringToken(codePos, "Bad character escape sequence");
|
||
return n;
|
||
};
|
||
|
||
// Read an identifier, and return it as a string. Sets `this.containsEsc`
|
||
// to whether the word contained a '\u' escape.
|
||
//
|
||
// Incrementally adds only escaped chars, adding other chunks as-is
|
||
// as a micro-optimization.
|
||
|
||
pp.readWord1 = function () {
|
||
this.containsEsc = false;
|
||
let word = "",
|
||
first = true,
|
||
chunkStart = this.pos;
|
||
let astral = this.options.ecmaVersion >= 6;
|
||
while (this.pos < this.input.length) {
|
||
let ch = this.fullCharCodeAtPos();
|
||
if ((0, _identifier.isIdentifierChar)(ch, astral)) {
|
||
this.pos += ch <= 0xffff ? 1 : 2;
|
||
} else if (ch === 92) {
|
||
// "\"
|
||
this.containsEsc = true;
|
||
word += this.input.slice(chunkStart, this.pos);
|
||
let escStart = this.pos;
|
||
if (this.input.charCodeAt(++this.pos) !== 117) // "u"
|
||
this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX");
|
||
++this.pos;
|
||
let esc = this.readCodePoint();
|
||
if (!(first ? _identifier.isIdentifierStart : _identifier.isIdentifierChar)(esc, astral)) this.invalidStringToken(escStart, "Invalid Unicode escape");
|
||
word += this.input.substr(this.pos - 6, 6);
|
||
chunkStart = this.pos;
|
||
} else {
|
||
break;
|
||
}
|
||
first = false;
|
||
}
|
||
return word + this.input.slice(chunkStart, this.pos);
|
||
};
|
||
|
||
// Read an identifier or keyword token. Will check for reserved
|
||
// words when necessary.
|
||
|
||
pp.readWord = function () {
|
||
let word = this.readWord1();
|
||
let type = _tokentype.types.name;
|
||
if (this.keywords.test(word)) {
|
||
type = _tokentype.keywords[word];
|
||
}
|
||
return this.finishToken(type, word);
|
||
};
|
||
|
||
/***/ }),
|
||
/* 178 */
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
exports.RegExpValidationState = undefined;
|
||
|
||
var _identifier = __webpack_require__(162);
|
||
|
||
var _state = __webpack_require__(161);
|
||
|
||
var _unicodePropertyData = __webpack_require__(179);
|
||
|
||
var _unicodePropertyData2 = _interopRequireDefault(_unicodePropertyData);
|
||
|
||
var _util = __webpack_require__(166);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
const pp = _state.Parser.prototype;
|
||
|
||
class RegExpValidationState {
|
||
constructor(parser) {
|
||
this.parser = parser;
|
||
this.validFlags = `gim${parser.options.ecmaVersion >= 6 ? "uy" : ""}${parser.options.ecmaVersion >= 9 ? "s" : ""}`;
|
||
this.unicodeProperties = _unicodePropertyData2.default[parser.options.ecmaVersion >= 12 ? 12 : parser.options.ecmaVersion];
|
||
this.source = "";
|
||
this.flags = "";
|
||
this.start = 0;
|
||
this.switchU = false;
|
||
this.switchN = false;
|
||
this.pos = 0;
|
||
this.lastIntValue = 0;
|
||
this.lastStringValue = "";
|
||
this.lastAssertionIsQuantifiable = false;
|
||
this.numCapturingParens = 0;
|
||
this.maxBackReference = 0;
|
||
this.groupNames = [];
|
||
this.backReferenceNames = [];
|
||
}
|
||
|
||
reset(start, pattern, flags) {
|
||
const unicode = flags.indexOf("u") !== -1;
|
||
this.start = start | 0;
|
||
this.source = pattern + "";
|
||
this.flags = flags;
|
||
this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
|
||
this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
|
||
}
|
||
|
||
raise(message) {
|
||
this.parser.raiseRecoverable(this.start, `Invalid regular expression: /${this.source}/: ${message}`);
|
||
}
|
||
|
||
// If u flag is given, this returns the code point at the index (it combines a surrogate pair).
|
||
// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
|
||
at(i, forceU = false) {
|
||
const s = this.source;
|
||
const l = s.length;
|
||
if (i >= l) {
|
||
return -1;
|
||
}
|
||
const c = s.charCodeAt(i);
|
||
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
|
||
return c;
|
||
}
|
||
const next = s.charCodeAt(i + 1);
|
||
return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c;
|
||
}
|
||
|
||
nextIndex(i, forceU = false) {
|
||
const s = this.source;
|
||
const l = s.length;
|
||
if (i >= l) {
|
||
return l;
|
||
}
|
||
let c = s.charCodeAt(i),
|
||
next;
|
||
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
|
||
return i + 1;
|
||
}
|
||
return i + 2;
|
||
}
|
||
|
||
current(forceU = false) {
|
||
return this.at(this.pos, forceU);
|
||
}
|
||
|
||
lookahead(forceU = false) {
|
||
return this.at(this.nextIndex(this.pos, forceU), forceU);
|
||
}
|
||
|
||
advance(forceU = false) {
|
||
this.pos = this.nextIndex(this.pos, forceU);
|
||
}
|
||
|
||
eat(ch, forceU = false) {
|
||
if (this.current(forceU) === ch) {
|
||
this.advance(forceU);
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
|
||
exports.RegExpValidationState = RegExpValidationState;
|
||
function codePointToString(ch) {
|
||
if (ch <= 0xFFFF) return String.fromCharCode(ch);
|
||
ch -= 0x10000;
|
||
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00);
|
||
}
|
||
|
||
/**
|
||
* Validate the flags part of a given RegExpLiteral.
|
||
*
|
||
* @param {RegExpValidationState} state The state to validate RegExp.
|
||
* @returns {void}
|
||
*/
|
||
pp.validateRegExpFlags = function (state) {
|
||
const validFlags = state.validFlags;
|
||
const flags = state.flags;
|
||
|
||
for (let i = 0; i < flags.length; i++) {
|
||
const flag = flags.charAt(i);
|
||
if (validFlags.indexOf(flag) === -1) {
|
||
this.raise(state.start, "Invalid regular expression flag");
|
||
}
|
||
if (flags.indexOf(flag, i + 1) > -1) {
|
||
this.raise(state.start, "Duplicate regular expression flag");
|
||
}
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Validate the pattern part of a given RegExpLiteral.
|
||
*
|
||
* @param {RegExpValidationState} state The state to validate RegExp.
|
||
* @returns {void}
|
||
*/
|
||
pp.validateRegExpPattern = function (state) {
|
||
this.regexp_pattern(state);
|
||
|
||
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
|
||
// parsing contains a |GroupName|, reparse with the goal symbol
|
||
// |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*
|
||
// exception if _P_ did not conform to the grammar, if any elements of _P_
|
||
// were not matched by the parse, or if any Early Error conditions exist.
|
||
if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {
|
||
state.switchN = true;
|
||
this.regexp_pattern(state);
|
||
}
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
|
||
pp.regexp_pattern = function (state) {
|
||
state.pos = 0;
|
||
state.lastIntValue = 0;
|
||
state.lastStringValue = "";
|
||
state.lastAssertionIsQuantifiable = false;
|
||
state.numCapturingParens = 0;
|
||
state.maxBackReference = 0;
|
||
state.groupNames.length = 0;
|
||
state.backReferenceNames.length = 0;
|
||
|
||
this.regexp_disjunction(state);
|
||
|
||
if (state.pos !== state.source.length) {
|
||
// Make the same messages as V8.
|
||
if (state.eat(0x29 /* ) */)) {
|
||
state.raise("Unmatched ')'");
|
||
}
|
||
if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {
|
||
state.raise("Lone quantifier brackets");
|
||
}
|
||
}
|
||
if (state.maxBackReference > state.numCapturingParens) {
|
||
state.raise("Invalid escape");
|
||
}
|
||
for (var _iterator = state.backReferenceNames, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||
var _ref;
|
||
|
||
if (_isArray) {
|
||
if (_i >= _iterator.length) break;
|
||
_ref = _iterator[_i++];
|
||
} else {
|
||
_i = _iterator.next();
|
||
if (_i.done) break;
|
||
_ref = _i.value;
|
||
}
|
||
|
||
const name = _ref;
|
||
|
||
if (state.groupNames.indexOf(name) === -1) {
|
||
state.raise("Invalid named capture referenced");
|
||
}
|
||
}
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
||
pp.regexp_disjunction = function (state) {
|
||
this.regexp_alternative(state);
|
||
while (state.eat(0x7C /* | */)) {
|
||
this.regexp_alternative(state);
|
||
}
|
||
|
||
// Make the same message as V8.
|
||
if (this.regexp_eatQuantifier(state, true)) {
|
||
state.raise("Nothing to repeat");
|
||
}
|
||
if (state.eat(0x7B /* { */)) {
|
||
state.raise("Lone quantifier brackets");
|
||
}
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
||
pp.regexp_alternative = function (state) {
|
||
while (state.pos < state.source.length && this.regexp_eatTerm(state));
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
||
pp.regexp_eatTerm = function (state) {
|
||
if (this.regexp_eatAssertion(state)) {
|
||
// Handle `QuantifiableAssertion Quantifier` alternative.
|
||
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
|
||
// is a QuantifiableAssertion.
|
||
if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {
|
||
// Make the same message as V8.
|
||
if (state.switchU) {
|
||
state.raise("Invalid quantifier");
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {
|
||
this.regexp_eatQuantifier(state);
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
|
||
pp.regexp_eatAssertion = function (state) {
|
||
const start = state.pos;
|
||
state.lastAssertionIsQuantifiable = false;
|
||
|
||
// ^, $
|
||
if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {
|
||
return true;
|
||
}
|
||
|
||
// \b \B
|
||
if (state.eat(0x5C /* \ */)) {
|
||
if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {
|
||
return true;
|
||
}
|
||
state.pos = start;
|
||
}
|
||
|
||
// Lookahead / Lookbehind
|
||
if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {
|
||
let lookbehind = false;
|
||
if (this.options.ecmaVersion >= 9) {
|
||
lookbehind = state.eat(0x3C /* < */);
|
||
}
|
||
if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {
|
||
this.regexp_disjunction(state);
|
||
if (!state.eat(0x29 /* ) */)) {
|
||
state.raise("Unterminated group");
|
||
}
|
||
state.lastAssertionIsQuantifiable = !lookbehind;
|
||
return true;
|
||
}
|
||
}
|
||
|
||
state.pos = start;
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
|
||
pp.regexp_eatQuantifier = function (state, noError = false) {
|
||
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
||
state.eat(0x3F /* ? */);
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
|
||
pp.regexp_eatQuantifierPrefix = function (state, noError) {
|
||
return state.eat(0x2A /* * */) || state.eat(0x2B /* + */) || state.eat(0x3F /* ? */) || this.regexp_eatBracedQuantifier(state, noError);
|
||
};
|
||
pp.regexp_eatBracedQuantifier = function (state, noError) {
|
||
const start = state.pos;
|
||
if (state.eat(0x7B /* { */)) {
|
||
let min = 0,
|
||
max = -1;
|
||
if (this.regexp_eatDecimalDigits(state)) {
|
||
min = state.lastIntValue;
|
||
if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {
|
||
max = state.lastIntValue;
|
||
}
|
||
if (state.eat(0x7D /* } */)) {
|
||
// SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term
|
||
if (max !== -1 && max < min && !noError) {
|
||
state.raise("numbers out of order in {} quantifier");
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
if (state.switchU && !noError) {
|
||
state.raise("Incomplete quantifier");
|
||
}
|
||
state.pos = start;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
|
||
pp.regexp_eatAtom = function (state) {
|
||
return this.regexp_eatPatternCharacters(state) || state.eat(0x2E /* . */) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state);
|
||
};
|
||
pp.regexp_eatReverseSolidusAtomEscape = function (state) {
|
||
const start = state.pos;
|
||
if (state.eat(0x5C /* \ */)) {
|
||
if (this.regexp_eatAtomEscape(state)) {
|
||
return true;
|
||
}
|
||
state.pos = start;
|
||
}
|
||
return false;
|
||
};
|
||
pp.regexp_eatUncapturingGroup = function (state) {
|
||
const start = state.pos;
|
||
if (state.eat(0x28 /* ( */)) {
|
||
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
|
||
this.regexp_disjunction(state);
|
||
if (state.eat(0x29 /* ) */)) {
|
||
return true;
|
||
}
|
||
state.raise("Unterminated group");
|
||
}
|
||
state.pos = start;
|
||
}
|
||
return false;
|
||
};
|
||
pp.regexp_eatCapturingGroup = function (state) {
|
||
if (state.eat(0x28 /* ( */)) {
|
||
if (this.options.ecmaVersion >= 9) {
|
||
this.regexp_groupSpecifier(state);
|
||
} else if (state.current() === 0x3F /* ? */) {
|
||
state.raise("Invalid group");
|
||
}
|
||
this.regexp_disjunction(state);
|
||
if (state.eat(0x29 /* ) */)) {
|
||
state.numCapturingParens += 1;
|
||
return true;
|
||
}
|
||
state.raise("Unterminated group");
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
|
||
pp.regexp_eatExtendedAtom = function (state) {
|
||
return state.eat(0x2E /* . */) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state);
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
|
||
pp.regexp_eatInvalidBracedQuantifier = function (state) {
|
||
if (this.regexp_eatBracedQuantifier(state, true)) {
|
||
state.raise("Nothing to repeat");
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
|
||
pp.regexp_eatSyntaxCharacter = function (state) {
|
||
const ch = state.current();
|
||
if (isSyntaxCharacter(ch)) {
|
||
state.lastIntValue = ch;
|
||
state.advance();
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
function isSyntaxCharacter(ch) {
|
||
return ch === 0x24 /* $ */ || ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ || ch === 0x2E /* . */ || ch === 0x3F /* ? */ || ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ || ch >= 0x7B /* { */ && ch <= 0x7D /* } */
|
||
;
|
||
}
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
|
||
// But eat eager.
|
||
pp.regexp_eatPatternCharacters = function (state) {
|
||
const start = state.pos;
|
||
let ch = 0;
|
||
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
|
||
state.advance();
|
||
}
|
||
return state.pos !== start;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
|
||
pp.regexp_eatExtendedPatternCharacter = function (state) {
|
||
const ch = state.current();
|
||
if (ch !== -1 && ch !== 0x24 /* $ */ && !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) && ch !== 0x2E /* . */ && ch !== 0x3F /* ? */ && ch !== 0x5B /* [ */ && ch !== 0x5E /* ^ */ && ch !== 0x7C /* | */
|
||
) {
|
||
state.advance();
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// GroupSpecifier ::
|
||
// [empty]
|
||
// `?` GroupName
|
||
pp.regexp_groupSpecifier = function (state) {
|
||
if (state.eat(0x3F /* ? */)) {
|
||
if (this.regexp_eatGroupName(state)) {
|
||
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
|
||
state.raise("Duplicate capture group name");
|
||
}
|
||
state.groupNames.push(state.lastStringValue);
|
||
return;
|
||
}
|
||
state.raise("Invalid group");
|
||
}
|
||
};
|
||
|
||
// GroupName ::
|
||
// `<` RegExpIdentifierName `>`
|
||
// Note: this updates `state.lastStringValue` property with the eaten name.
|
||
pp.regexp_eatGroupName = function (state) {
|
||
state.lastStringValue = "";
|
||
if (state.eat(0x3C /* < */)) {
|
||
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
|
||
return true;
|
||
}
|
||
state.raise("Invalid capture group name");
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// RegExpIdentifierName ::
|
||
// RegExpIdentifierStart
|
||
// RegExpIdentifierName RegExpIdentifierPart
|
||
// Note: this updates `state.lastStringValue` property with the eaten name.
|
||
pp.regexp_eatRegExpIdentifierName = function (state) {
|
||
state.lastStringValue = "";
|
||
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
||
state.lastStringValue += codePointToString(state.lastIntValue);
|
||
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
||
state.lastStringValue += codePointToString(state.lastIntValue);
|
||
}
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// RegExpIdentifierStart ::
|
||
// UnicodeIDStart
|
||
// `$`
|
||
// `_`
|
||
// `\` RegExpUnicodeEscapeSequence[+U]
|
||
pp.regexp_eatRegExpIdentifierStart = function (state) {
|
||
const start = state.pos;
|
||
const forceU = this.options.ecmaVersion >= 11;
|
||
let ch = state.current(forceU);
|
||
state.advance(forceU);
|
||
|
||
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
|
||
ch = state.lastIntValue;
|
||
}
|
||
if (isRegExpIdentifierStart(ch)) {
|
||
state.lastIntValue = ch;
|
||
return true;
|
||
}
|
||
|
||
state.pos = start;
|
||
return false;
|
||
};
|
||
function isRegExpIdentifierStart(ch) {
|
||
return (0, _identifier.isIdentifierStart)(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F; /* _ */
|
||
}
|
||
|
||
// RegExpIdentifierPart ::
|
||
// UnicodeIDContinue
|
||
// `$`
|
||
// `_`
|
||
// `\` RegExpUnicodeEscapeSequence[+U]
|
||
// <ZWNJ>
|
||
// <ZWJ>
|
||
pp.regexp_eatRegExpIdentifierPart = function (state) {
|
||
const start = state.pos;
|
||
const forceU = this.options.ecmaVersion >= 11;
|
||
let ch = state.current(forceU);
|
||
state.advance(forceU);
|
||
|
||
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
|
||
ch = state.lastIntValue;
|
||
}
|
||
if (isRegExpIdentifierPart(ch)) {
|
||
state.lastIntValue = ch;
|
||
return true;
|
||
}
|
||
|
||
state.pos = start;
|
||
return false;
|
||
};
|
||
function isRegExpIdentifierPart(ch) {
|
||
return (0, _identifier.isIdentifierChar)(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D; /* <ZWJ> */
|
||
}
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
|
||
pp.regexp_eatAtomEscape = function (state) {
|
||
if (this.regexp_eatBackReference(state) || this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state) || state.switchN && this.regexp_eatKGroupName(state)) {
|
||
return true;
|
||
}
|
||
if (state.switchU) {
|
||
// Make the same message as V8.
|
||
if (state.current() === 0x63 /* c */) {
|
||
state.raise("Invalid unicode escape");
|
||
}
|
||
state.raise("Invalid escape");
|
||
}
|
||
return false;
|
||
};
|
||
pp.regexp_eatBackReference = function (state) {
|
||
const start = state.pos;
|
||
if (this.regexp_eatDecimalEscape(state)) {
|
||
const n = state.lastIntValue;
|
||
if (state.switchU) {
|
||
// For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape
|
||
if (n > state.maxBackReference) {
|
||
state.maxBackReference = n;
|
||
}
|
||
return true;
|
||
}
|
||
if (n <= state.numCapturingParens) {
|
||
return true;
|
||
}
|
||
state.pos = start;
|
||
}
|
||
return false;
|
||
};
|
||
pp.regexp_eatKGroupName = function (state) {
|
||
if (state.eat(0x6B /* k */)) {
|
||
if (this.regexp_eatGroupName(state)) {
|
||
state.backReferenceNames.push(state.lastStringValue);
|
||
return true;
|
||
}
|
||
state.raise("Invalid named reference");
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
|
||
pp.regexp_eatCharacterEscape = function (state) {
|
||
return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state);
|
||
};
|
||
pp.regexp_eatCControlLetter = function (state) {
|
||
const start = state.pos;
|
||
if (state.eat(0x63 /* c */)) {
|
||
if (this.regexp_eatControlLetter(state)) {
|
||
return true;
|
||
}
|
||
state.pos = start;
|
||
}
|
||
return false;
|
||
};
|
||
pp.regexp_eatZero = function (state) {
|
||
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
|
||
state.lastIntValue = 0;
|
||
state.advance();
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
|
||
pp.regexp_eatControlEscape = function (state) {
|
||
const ch = state.current();
|
||
if (ch === 0x74 /* t */) {
|
||
state.lastIntValue = 0x09; /* \t */
|
||
state.advance();
|
||
return true;
|
||
}
|
||
if (ch === 0x6E /* n */) {
|
||
state.lastIntValue = 0x0A; /* \n */
|
||
state.advance();
|
||
return true;
|
||
}
|
||
if (ch === 0x76 /* v */) {
|
||
state.lastIntValue = 0x0B; /* \v */
|
||
state.advance();
|
||
return true;
|
||
}
|
||
if (ch === 0x66 /* f */) {
|
||
state.lastIntValue = 0x0C; /* \f */
|
||
state.advance();
|
||
return true;
|
||
}
|
||
if (ch === 0x72 /* r */) {
|
||
state.lastIntValue = 0x0D; /* \r */
|
||
state.advance();
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
|
||
pp.regexp_eatControlLetter = function (state) {
|
||
const ch = state.current();
|
||
if (isControlLetter(ch)) {
|
||
state.lastIntValue = ch % 0x20;
|
||
state.advance();
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
function isControlLetter(ch) {
|
||
return ch >= 0x41 /* A */ && ch <= 0x5A /* Z */ || ch >= 0x61 /* a */ && ch <= 0x7A /* z */;
|
||
}
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
||
pp.regexp_eatRegExpUnicodeEscapeSequence = function (state, forceU = false) {
|
||
const start = state.pos;
|
||
const switchU = forceU || state.switchU;
|
||
|
||
if (state.eat(0x75 /* u */)) {
|
||
if (this.regexp_eatFixedHexDigits(state, 4)) {
|
||
const lead = state.lastIntValue;
|
||
if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
|
||
const leadSurrogateEnd = state.pos;
|
||
if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
|
||
const trail = state.lastIntValue;
|
||
if (trail >= 0xDC00 && trail <= 0xDFFF) {
|
||
state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
|
||
return true;
|
||
}
|
||
}
|
||
state.pos = leadSurrogateEnd;
|
||
state.lastIntValue = lead;
|
||
}
|
||
return true;
|
||
}
|
||
if (switchU && state.eat(0x7B /* { */) && this.regexp_eatHexDigits(state) && state.eat(0x7D /* } */) && isValidUnicode(state.lastIntValue)) {
|
||
return true;
|
||
}
|
||
if (switchU) {
|
||
state.raise("Invalid unicode escape");
|
||
}
|
||
state.pos = start;
|
||
}
|
||
|
||
return false;
|
||
};
|
||
function isValidUnicode(ch) {
|
||
return ch >= 0 && ch <= 0x10FFFF;
|
||
}
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
|
||
pp.regexp_eatIdentityEscape = function (state) {
|
||
if (state.switchU) {
|
||
if (this.regexp_eatSyntaxCharacter(state)) {
|
||
return true;
|
||
}
|
||
if (state.eat(0x2F /* / */)) {
|
||
state.lastIntValue = 0x2F; /* / */
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
const ch = state.current();
|
||
if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {
|
||
state.lastIntValue = ch;
|
||
state.advance();
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
|
||
pp.regexp_eatDecimalEscape = function (state) {
|
||
state.lastIntValue = 0;
|
||
let ch = state.current();
|
||
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
|
||
do {
|
||
state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
|
||
state.advance();
|
||
} while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */);
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
||
pp.regexp_eatCharacterClassEscape = function (state) {
|
||
const ch = state.current();
|
||
|
||
if (isCharacterClassEscape(ch)) {
|
||
state.lastIntValue = -1;
|
||
state.advance();
|
||
return true;
|
||
}
|
||
|
||
if (state.switchU && this.options.ecmaVersion >= 9 && (ch === 0x50 /* P */ || ch === 0x70 /* p */)) {
|
||
state.lastIntValue = -1;
|
||
state.advance();
|
||
if (state.eat(0x7B /* { */) && this.regexp_eatUnicodePropertyValueExpression(state) && state.eat(0x7D /* } */)) {
|
||
return true;
|
||
}
|
||
state.raise("Invalid property name");
|
||
}
|
||
|
||
return false;
|
||
};
|
||
function isCharacterClassEscape(ch) {
|
||
return ch === 0x64 /* d */ || ch === 0x44 /* D */ || ch === 0x73 /* s */ || ch === 0x53 /* S */ || ch === 0x77 /* w */ || ch === 0x57 /* W */
|
||
;
|
||
}
|
||
|
||
// UnicodePropertyValueExpression ::
|
||
// UnicodePropertyName `=` UnicodePropertyValue
|
||
// LoneUnicodePropertyNameOrValue
|
||
pp.regexp_eatUnicodePropertyValueExpression = function (state) {
|
||
const start = state.pos;
|
||
|
||
// UnicodePropertyName `=` UnicodePropertyValue
|
||
if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {
|
||
const name = state.lastStringValue;
|
||
if (this.regexp_eatUnicodePropertyValue(state)) {
|
||
const value = state.lastStringValue;
|
||
this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
|
||
return true;
|
||
}
|
||
}
|
||
state.pos = start;
|
||
|
||
// LoneUnicodePropertyNameOrValue
|
||
if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
|
||
const nameOrValue = state.lastStringValue;
|
||
this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
pp.regexp_validateUnicodePropertyNameAndValue = function (state, name, value) {
|
||
if (!(0, _util.has)(state.unicodeProperties.nonBinary, name)) state.raise("Invalid property name");
|
||
if (!state.unicodeProperties.nonBinary[name].test(value)) state.raise("Invalid property value");
|
||
};
|
||
pp.regexp_validateUnicodePropertyNameOrValue = function (state, nameOrValue) {
|
||
if (!state.unicodeProperties.binary.test(nameOrValue)) state.raise("Invalid property name");
|
||
};
|
||
|
||
// UnicodePropertyName ::
|
||
// UnicodePropertyNameCharacters
|
||
pp.regexp_eatUnicodePropertyName = function (state) {
|
||
let ch = 0;
|
||
state.lastStringValue = "";
|
||
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
||
state.lastStringValue += codePointToString(ch);
|
||
state.advance();
|
||
}
|
||
return state.lastStringValue !== "";
|
||
};
|
||
function isUnicodePropertyNameCharacter(ch) {
|
||
return isControlLetter(ch) || ch === 0x5F; /* _ */
|
||
}
|
||
|
||
// UnicodePropertyValue ::
|
||
// UnicodePropertyValueCharacters
|
||
pp.regexp_eatUnicodePropertyValue = function (state) {
|
||
let ch = 0;
|
||
state.lastStringValue = "";
|
||
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
||
state.lastStringValue += codePointToString(ch);
|
||
state.advance();
|
||
}
|
||
return state.lastStringValue !== "";
|
||
};
|
||
function isUnicodePropertyValueCharacter(ch) {
|
||
return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch);
|
||
}
|
||
|
||
// LoneUnicodePropertyNameOrValue ::
|
||
// UnicodePropertyValueCharacters
|
||
pp.regexp_eatLoneUnicodePropertyNameOrValue = function (state) {
|
||
return this.regexp_eatUnicodePropertyValue(state);
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
||
pp.regexp_eatCharacterClass = function (state) {
|
||
if (state.eat(0x5B /* [ */)) {
|
||
state.eat(0x5E /* ^ */);
|
||
this.regexp_classRanges(state);
|
||
if (state.eat(0x5D /* ] */)) {
|
||
return true;
|
||
}
|
||
// Unreachable since it threw "unterminated regular expression" error before.
|
||
state.raise("Unterminated character class");
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
||
pp.regexp_classRanges = function (state) {
|
||
while (this.regexp_eatClassAtom(state)) {
|
||
const left = state.lastIntValue;
|
||
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
||
const right = state.lastIntValue;
|
||
if (state.switchU && (left === -1 || right === -1)) {
|
||
state.raise("Invalid character class");
|
||
}
|
||
if (left !== -1 && right !== -1 && left > right) {
|
||
state.raise("Range out of order in character class");
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
|
||
pp.regexp_eatClassAtom = function (state) {
|
||
const start = state.pos;
|
||
|
||
if (state.eat(0x5C /* \ */)) {
|
||
if (this.regexp_eatClassEscape(state)) {
|
||
return true;
|
||
}
|
||
if (state.switchU) {
|
||
// Make the same message as V8.
|
||
const ch = state.current();
|
||
if (ch === 0x63 /* c */ || isOctalDigit(ch)) {
|
||
state.raise("Invalid class escape");
|
||
}
|
||
state.raise("Invalid escape");
|
||
}
|
||
state.pos = start;
|
||
}
|
||
|
||
const ch = state.current();
|
||
if (ch !== 0x5D /* ] */) {
|
||
state.lastIntValue = ch;
|
||
state.advance();
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
|
||
pp.regexp_eatClassEscape = function (state) {
|
||
const start = state.pos;
|
||
|
||
if (state.eat(0x62 /* b */)) {
|
||
state.lastIntValue = 0x08; /* <BS> */
|
||
return true;
|
||
}
|
||
|
||
if (state.switchU && state.eat(0x2D /* - */)) {
|
||
state.lastIntValue = 0x2D; /* - */
|
||
return true;
|
||
}
|
||
|
||
if (!state.switchU && state.eat(0x63 /* c */)) {
|
||
if (this.regexp_eatClassControlLetter(state)) {
|
||
return true;
|
||
}
|
||
state.pos = start;
|
||
}
|
||
|
||
return this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state);
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
||
pp.regexp_eatClassControlLetter = function (state) {
|
||
const ch = state.current();
|
||
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
|
||
state.lastIntValue = ch % 0x20;
|
||
state.advance();
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
||
pp.regexp_eatHexEscapeSequence = function (state) {
|
||
const start = state.pos;
|
||
if (state.eat(0x78 /* x */)) {
|
||
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
||
return true;
|
||
}
|
||
if (state.switchU) {
|
||
state.raise("Invalid escape");
|
||
}
|
||
state.pos = start;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
|
||
pp.regexp_eatDecimalDigits = function (state) {
|
||
const start = state.pos;
|
||
let ch = 0;
|
||
state.lastIntValue = 0;
|
||
while (isDecimalDigit(ch = state.current())) {
|
||
state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
|
||
state.advance();
|
||
}
|
||
return state.pos !== start;
|
||
};
|
||
function isDecimalDigit(ch) {
|
||
return ch >= 0x30 /* 0 */ && ch <= 0x39; /* 9 */
|
||
}
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
|
||
pp.regexp_eatHexDigits = function (state) {
|
||
const start = state.pos;
|
||
let ch = 0;
|
||
state.lastIntValue = 0;
|
||
while (isHexDigit(ch = state.current())) {
|
||
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
|
||
state.advance();
|
||
}
|
||
return state.pos !== start;
|
||
};
|
||
function isHexDigit(ch) {
|
||
return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */ || ch >= 0x41 /* A */ && ch <= 0x46 /* F */ || ch >= 0x61 /* a */ && ch <= 0x66 /* f */;
|
||
}
|
||
function hexToInt(ch) {
|
||
if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {
|
||
return 10 + (ch - 0x41 /* A */);
|
||
}
|
||
if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {
|
||
return 10 + (ch - 0x61 /* a */);
|
||
}
|
||
return ch - 0x30; /* 0 */
|
||
}
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
|
||
// Allows only 0-377(octal) i.e. 0-255(decimal).
|
||
pp.regexp_eatLegacyOctalEscapeSequence = function (state) {
|
||
if (this.regexp_eatOctalDigit(state)) {
|
||
const n1 = state.lastIntValue;
|
||
if (this.regexp_eatOctalDigit(state)) {
|
||
const n2 = state.lastIntValue;
|
||
if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {
|
||
state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;
|
||
} else {
|
||
state.lastIntValue = n1 * 8 + n2;
|
||
}
|
||
} else {
|
||
state.lastIntValue = n1;
|
||
}
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
|
||
pp.regexp_eatOctalDigit = function (state) {
|
||
const ch = state.current();
|
||
if (isOctalDigit(ch)) {
|
||
state.lastIntValue = ch - 0x30; /* 0 */
|
||
state.advance();
|
||
return true;
|
||
}
|
||
state.lastIntValue = 0;
|
||
return false;
|
||
};
|
||
function isOctalDigit(ch) {
|
||
return ch >= 0x30 /* 0 */ && ch <= 0x37; /* 7 */
|
||
}
|
||
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
|
||
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
|
||
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
||
pp.regexp_eatFixedHexDigits = function (state, length) {
|
||
const start = state.pos;
|
||
state.lastIntValue = 0;
|
||
for (let i = 0; i < length; ++i) {
|
||
const ch = state.current();
|
||
if (!isHexDigit(ch)) {
|
||
state.pos = start;
|
||
return false;
|
||
}
|
||
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
|
||
state.advance();
|
||
}
|
||
return true;
|
||
};
|
||
|
||
/***/ }),
|
||
/* 179 */
|
||
/***/ ((module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _util = __webpack_require__(166);
|
||
|
||
// This file contains Unicode properties extracted from the ECMAScript
|
||
// specification. The lists are extracted like so:
|
||
// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)
|
||
|
||
// #table-binary-unicode-properties
|
||
const ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
|
||
const ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
|
||
const ecma11BinaryProperties = ecma10BinaryProperties;
|
||
const ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
|
||
const unicodeBinaryProperties = {
|
||
9: ecma9BinaryProperties,
|
||
10: ecma10BinaryProperties,
|
||
11: ecma11BinaryProperties,
|
||
12: ecma12BinaryProperties
|
||
|
||
// #table-unicode-general-category-values
|
||
};const unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
|
||
|
||
// #table-unicode-script-values
|
||
const ecma9ScriptValues = "Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
|
||
const ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd";
|
||
const ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
|
||
const ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
|
||
const unicodeScriptValues = {
|
||
9: ecma9ScriptValues,
|
||
10: ecma10ScriptValues,
|
||
11: ecma11ScriptValues,
|
||
12: ecma12ScriptValues
|
||
};
|
||
|
||
const data = {};
|
||
function buildUnicodeData(ecmaVersion) {
|
||
let d = data[ecmaVersion] = {
|
||
binary: (0, _util.wordsRegexp)(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
|
||
nonBinary: {
|
||
General_Category: (0, _util.wordsRegexp)(unicodeGeneralCategoryValues),
|
||
Script: (0, _util.wordsRegexp)(unicodeScriptValues[ecmaVersion])
|
||
}
|
||
};
|
||
d.nonBinary.Script_Extensions = d.nonBinary.Script;
|
||
|
||
d.nonBinary.gc = d.nonBinary.General_Category;
|
||
d.nonBinary.sc = d.nonBinary.Script;
|
||
d.nonBinary.scx = d.nonBinary.Script_Extensions;
|
||
}
|
||
buildUnicodeData(9);
|
||
buildUnicodeData(10);
|
||
buildUnicodeData(11);
|
||
buildUnicodeData(12);
|
||
|
||
exports.default = data;
|
||
module.exports = exports['default'];
|
||
|
||
/***/ }),
|
||
/* 180 */
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
// -------------------------------------------------------------
|
||
// WARNING: this file is used by both the client and the server.
|
||
// Do not use any browser or node-specific API!
|
||
// -------------------------------------------------------------
|
||
|
||
/*
|
||
Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
|
||
Copyright (C) 2012-2014 Yusuke Suzuki <utatane.tea@gmail.com>
|
||
Copyright (C) 2012-2013 Michael Ficarra <escodegen.copyright@michael.ficarra.me>
|
||
Copyright (C) 2012-2013 Mathias Bynens <mathias@qiwi.be>
|
||
Copyright (C) 2013 Irakli Gozalishvili <rfobic@gmail.com>
|
||
Copyright (C) 2012 Robert Gust-Bardon <donate@robert.gust-bardon.org>
|
||
Copyright (C) 2012 John Freeman <jfreeman08@gmail.com>
|
||
Copyright (C) 2011-2012 Ariya Hidayat <ariya.hidayat@gmail.com>
|
||
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
|
||
Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
|
||
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
|
||
|
||
Redistribution and use in source and binary forms, with or without
|
||
modification, are permitted provided that the following conditions are met:
|
||
|
||
* Redistributions of source code must retain the above copyright
|
||
notice, this list of conditions and the following disclaimer.
|
||
* Redistributions in binary form must reproduce the above copyright
|
||
notice, this list of conditions and the following disclaimer in the
|
||
documentation and/or other materials provided with the distribution.
|
||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
*/
|
||
|
||
|
||
|
||
var isArray,
|
||
json,
|
||
renumber,
|
||
hexadecimal,
|
||
quotes,
|
||
escapeless,
|
||
parentheses,
|
||
semicolons,
|
||
safeConcatenation,
|
||
directive,
|
||
extra,
|
||
parse;
|
||
|
||
var Syntax = {
|
||
AssignmentExpression: 'AssignmentExpression',
|
||
AssignmentPattern: 'AssignmentPattern',
|
||
ArrayExpression: 'ArrayExpression',
|
||
ArrayPattern: 'ArrayPattern',
|
||
ArrowFunctionExpression: 'ArrowFunctionExpression',
|
||
AwaitExpression: 'AwaitExpression',
|
||
BlockStatement: 'BlockStatement',
|
||
BinaryExpression: 'BinaryExpression',
|
||
BreakStatement: 'BreakStatement',
|
||
CallExpression: 'CallExpression',
|
||
CatchClause: 'CatchClause',
|
||
ClassBody: 'ClassBody',
|
||
ClassDeclaration: 'ClassDeclaration',
|
||
ClassExpression: 'ClassExpression',
|
||
ComprehensionBlock: 'ComprehensionBlock',
|
||
ComprehensionExpression: 'ComprehensionExpression',
|
||
ConditionalExpression: 'ConditionalExpression',
|
||
ContinueStatement: 'ContinueStatement',
|
||
DirectiveStatement: 'DirectiveStatement',
|
||
DoWhileStatement: 'DoWhileStatement',
|
||
DebuggerStatement: 'DebuggerStatement',
|
||
EmptyStatement: 'EmptyStatement',
|
||
ExportAllDeclaration: 'ExportAllDeclaration',
|
||
ExportBatchSpecifier: 'ExportBatchSpecifier',
|
||
ExportDeclaration: 'ExportDeclaration',
|
||
ExportNamedDeclaration: 'ExportNamedDeclaration',
|
||
ExportSpecifier: 'ExportSpecifier',
|
||
ExpressionStatement: 'ExpressionStatement',
|
||
ForStatement: 'ForStatement',
|
||
ForInStatement: 'ForInStatement',
|
||
ForOfStatement: 'ForOfStatement',
|
||
FunctionDeclaration: 'FunctionDeclaration',
|
||
FunctionExpression: 'FunctionExpression',
|
||
GeneratorExpression: 'GeneratorExpression',
|
||
Identifier: 'Identifier',
|
||
IfStatement: 'IfStatement',
|
||
ImportExpression: 'ImportExpression',
|
||
ImportSpecifier: 'ImportSpecifier',
|
||
ImportDeclaration: 'ImportDeclaration',
|
||
ChainExpression: 'ChainExpression',
|
||
Literal: 'Literal',
|
||
LabeledStatement: 'LabeledStatement',
|
||
LogicalExpression: 'LogicalExpression',
|
||
MemberExpression: 'MemberExpression',
|
||
MetaProperty: 'MetaProperty',
|
||
MethodDefinition: 'MethodDefinition',
|
||
ModuleDeclaration: 'ModuleDeclaration',
|
||
NewExpression: 'NewExpression',
|
||
ObjectExpression: 'ObjectExpression',
|
||
ObjectPattern: 'ObjectPattern',
|
||
Program: 'Program',
|
||
Property: 'Property',
|
||
RestElement: 'RestElement',
|
||
ReturnStatement: 'ReturnStatement',
|
||
SequenceExpression: 'SequenceExpression',
|
||
SpreadElement: 'SpreadElement',
|
||
Super: 'Super',
|
||
SwitchStatement: 'SwitchStatement',
|
||
SwitchCase: 'SwitchCase',
|
||
TaggedTemplateExpression: 'TaggedTemplateExpression',
|
||
TemplateElement: 'TemplateElement',
|
||
TemplateLiteral: 'TemplateLiteral',
|
||
ThisExpression: 'ThisExpression',
|
||
ThrowStatement: 'ThrowStatement',
|
||
TryStatement: 'TryStatement',
|
||
UnaryExpression: 'UnaryExpression',
|
||
UpdateExpression: 'UpdateExpression',
|
||
VariableDeclaration: 'VariableDeclaration',
|
||
VariableDeclarator: 'VariableDeclarator',
|
||
WhileStatement: 'WhileStatement',
|
||
WithStatement: 'WithStatement',
|
||
YieldExpression: 'YieldExpression'
|
||
};
|
||
|
||
exports.Syntax = Syntax;
|
||
|
||
var Precedence = {
|
||
Sequence: 0,
|
||
Yield: 1,
|
||
Assignment: 1,
|
||
Conditional: 2,
|
||
ArrowFunction: 2,
|
||
Coalesce: 3,
|
||
LogicalOR: 3,
|
||
LogicalAND: 4,
|
||
BitwiseOR: 5,
|
||
BitwiseXOR: 6,
|
||
BitwiseAND: 7,
|
||
Equality: 8,
|
||
Relational: 9,
|
||
BitwiseSHIFT: 10,
|
||
Additive: 11,
|
||
Multiplicative: 12,
|
||
Unary: 13,
|
||
Exponentiation: 14,
|
||
Postfix: 14,
|
||
Await: 14,
|
||
Call: 15,
|
||
New: 16,
|
||
TaggedTemplate: 17,
|
||
OptionalChaining: 17,
|
||
Member: 18,
|
||
Primary: 19
|
||
};
|
||
|
||
var BinaryPrecedence = {
|
||
'||': Precedence.LogicalOR,
|
||
'&&': Precedence.LogicalAND,
|
||
'|': Precedence.BitwiseOR,
|
||
'^': Precedence.BitwiseXOR,
|
||
'&': Precedence.BitwiseAND,
|
||
'==': Precedence.Equality,
|
||
'!=': Precedence.Equality,
|
||
'===': Precedence.Equality,
|
||
'!==': Precedence.Equality,
|
||
'is': Precedence.Equality,
|
||
'isnt': Precedence.Equality,
|
||
'<': Precedence.Relational,
|
||
'>': Precedence.Relational,
|
||
'<=': Precedence.Relational,
|
||
'>=': Precedence.Relational,
|
||
'in': Precedence.Relational,
|
||
'instanceof': Precedence.Relational,
|
||
'<<': Precedence.BitwiseSHIFT,
|
||
'>>': Precedence.BitwiseSHIFT,
|
||
'>>>': Precedence.BitwiseSHIFT,
|
||
'+': Precedence.Additive,
|
||
'-': Precedence.Additive,
|
||
'*': Precedence.Multiplicative,
|
||
'%': Precedence.Multiplicative,
|
||
'/': Precedence.Multiplicative,
|
||
'??': Precedence.Coalesce,
|
||
'**': Precedence.Exponentiation
|
||
};
|
||
|
||
function getDefaultOptions () {
|
||
// default options
|
||
return {
|
||
indent: null,
|
||
base: null,
|
||
parse: null,
|
||
format: {
|
||
indent: {
|
||
style: ' ',
|
||
base: 0
|
||
},
|
||
newline: '\n',
|
||
space: ' ',
|
||
json: false,
|
||
renumber: false,
|
||
hexadecimal: false,
|
||
quotes: 'single',
|
||
escapeless: false,
|
||
compact: false,
|
||
parentheses: true,
|
||
semicolons: true,
|
||
safeConcatenation: false
|
||
},
|
||
directive: false,
|
||
raw: true,
|
||
verbatim: null
|
||
};
|
||
}
|
||
|
||
//-------------------------------------------------===------------------------------------------------------
|
||
// Lexical utils
|
||
//-------------------------------------------------===------------------------------------------------------
|
||
|
||
//Const
|
||
var NON_ASCII_WHITESPACES = [
|
||
0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005,
|
||
0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000,
|
||
0xFEFF
|
||
];
|
||
|
||
//Regular expressions
|
||
var NON_ASCII_IDENTIFIER_CHARACTERS_REGEXP = new RegExp(
|
||
'[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376' +
|
||
'\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-' +
|
||
'\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA' +
|
||
'\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-' +
|
||
'\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0\u08A2-\u08AC\u08E4-\u08FE\u0900-' +
|
||
'\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-' +
|
||
'\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-' +
|
||
'\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38' +
|
||
'\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83' +
|
||
'\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9' +
|
||
'\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-' +
|
||
'\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-' +
|
||
'\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E' +
|
||
'\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-' +
|
||
'\u0BEF\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-' +
|
||
'\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\u0C83\u0C85-\u0C8C\u0C8E-' +
|
||
'\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE' +
|
||
'\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44' +
|
||
'\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-' +
|
||
'\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A' +
|
||
'\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-' +
|
||
'\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9' +
|
||
'\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84' +
|
||
'\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-' +
|
||
'\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5' +
|
||
'\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-' +
|
||
'\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-' +
|
||
'\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD' +
|
||
'\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191C\u1920-\u192B' +
|
||
'\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E' +
|
||
'\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-' +
|
||
'\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-' +
|
||
'\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-' +
|
||
'\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F' +
|
||
'\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115' +
|
||
'\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188' +
|
||
'\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-' +
|
||
'\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-' +
|
||
'\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A' +
|
||
'\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5' +
|
||
'\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA697' +
|
||
'\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873' +
|
||
'\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-' +
|
||
'\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-' +
|
||
'\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABEA\uABEC' +
|
||
'\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-' +
|
||
'\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D' +
|
||
'\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74' +
|
||
'\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-' +
|
||
'\uFFD7\uFFDA-\uFFDC]'
|
||
);
|
||
|
||
|
||
//Methods
|
||
function isIdentifierCh (cp) {
|
||
if (cp < 0x80) {
|
||
return cp >= 97 && cp <= 122 || // a..z
|
||
cp >= 65 && cp <= 90 || // A..Z
|
||
cp >= 48 && cp <= 57 || // 0..9
|
||
cp === 36 || cp === 95 || // $ (dollar) and _ (underscore)
|
||
cp === 92; // \ (backslash)
|
||
}
|
||
|
||
var ch = String.fromCharCode(cp);
|
||
|
||
return NON_ASCII_IDENTIFIER_CHARACTERS_REGEXP.test(ch);
|
||
}
|
||
|
||
function isLineTerminator (cp) {
|
||
return cp === 0x0A || cp === 0x0D || cp === 0x2028 || cp === 0x2029;
|
||
}
|
||
|
||
function isWhitespace (cp) {
|
||
return cp === 0x20 || cp === 0x09 || isLineTerminator(cp) || cp === 0x0B || cp === 0x0C || cp === 0xA0 ||
|
||
(cp >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(cp) >= 0);
|
||
}
|
||
|
||
function isDecimalDigit (cp) {
|
||
return cp >= 48 && cp <= 57;
|
||
}
|
||
|
||
function stringRepeat (str, num) {
|
||
var result = '';
|
||
|
||
for (num |= 0; num > 0; num >>>= 1, str += str) {
|
||
if (num & 1) {
|
||
result += str;
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
isArray = Array.isArray;
|
||
if (!isArray) {
|
||
isArray = function isArray (array) {
|
||
return Object.prototype.toString.call(array) === '[object Array]';
|
||
};
|
||
}
|
||
|
||
|
||
function updateDeeply (target, override) {
|
||
var key, val;
|
||
|
||
function isHashObject (target) {
|
||
return typeof target === 'object' && target instanceof Object && !(target instanceof RegExp);
|
||
}
|
||
|
||
for (key in override) {
|
||
if (override.hasOwnProperty(key)) {
|
||
val = override[key];
|
||
if (isHashObject(val)) {
|
||
if (isHashObject(target[key])) {
|
||
updateDeeply(target[key], val);
|
||
}
|
||
else {
|
||
target[key] = updateDeeply({}, val);
|
||
}
|
||
}
|
||
else {
|
||
target[key] = val;
|
||
}
|
||
}
|
||
}
|
||
return target;
|
||
}
|
||
|
||
function generateNumber (value) {
|
||
var result, point, temp, exponent, pos;
|
||
|
||
if (value === 1 / 0) {
|
||
return json ? 'null' : renumber ? '1e400' : '1e+400';
|
||
}
|
||
|
||
result = '' + value;
|
||
if (!renumber || result.length < 3) {
|
||
return result;
|
||
}
|
||
|
||
point = result.indexOf('.');
|
||
//NOTE: 0x30 == '0'
|
||
if (!json && result.charCodeAt(0) === 0x30 && point === 1) {
|
||
point = 0;
|
||
result = result.slice(1);
|
||
}
|
||
temp = result;
|
||
result = result.replace('e+', 'e');
|
||
exponent = 0;
|
||
if ((pos = temp.indexOf('e')) > 0) {
|
||
exponent = +temp.slice(pos + 1);
|
||
temp = temp.slice(0, pos);
|
||
}
|
||
if (point >= 0) {
|
||
exponent -= temp.length - point - 1;
|
||
temp = +(temp.slice(0, point) + temp.slice(point + 1)) + '';
|
||
}
|
||
pos = 0;
|
||
|
||
//NOTE: 0x30 == '0'
|
||
while (temp.charCodeAt(temp.length + pos - 1) === 0x30) {
|
||
--pos;
|
||
}
|
||
if (pos !== 0) {
|
||
exponent -= pos;
|
||
temp = temp.slice(0, pos);
|
||
}
|
||
if (exponent !== 0) {
|
||
temp += 'e' + exponent;
|
||
}
|
||
if ((temp.length < result.length ||
|
||
(hexadecimal && value > 1e12 && Math.floor(value) === value &&
|
||
(temp = '0x' + value.toString(16)).length
|
||
< result.length)) &&
|
||
+temp === value) {
|
||
result = temp;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
// Generate valid RegExp expression.
|
||
// This function is based on https://github.com/Constellation/iv Engine
|
||
|
||
function escapeRegExpCharacter (ch, previousIsBackslash) {
|
||
// not handling '\' and handling \u2028 or \u2029 to unicode escape sequence
|
||
if ((ch & ~1) === 0x2028) {
|
||
return (previousIsBackslash ? 'u' : '\\u') + ((ch === 0x2028) ? '2028' : '2029');
|
||
}
|
||
else if (ch === 10 || ch === 13) { // \n, \r
|
||
return (previousIsBackslash ? '' : '\\') + ((ch === 10) ? 'n' : 'r');
|
||
}
|
||
return String.fromCharCode(ch);
|
||
}
|
||
|
||
function generateRegExp (reg) {
|
||
var match, result, flags, i, iz, ch, characterInBrack, previousIsBackslash;
|
||
|
||
result = reg.toString();
|
||
|
||
if (reg.source) {
|
||
// extract flag from toString result
|
||
match = result.match(/\/([^/]*)$/);
|
||
if (!match) {
|
||
return result;
|
||
}
|
||
|
||
flags = match[1];
|
||
result = '';
|
||
|
||
characterInBrack = false;
|
||
previousIsBackslash = false;
|
||
for (i = 0, iz = reg.source.length; i < iz; ++i) {
|
||
ch = reg.source.charCodeAt(i);
|
||
|
||
if (!previousIsBackslash) {
|
||
if (characterInBrack) {
|
||
if (ch === 93) { // ]
|
||
characterInBrack = false;
|
||
}
|
||
}
|
||
else {
|
||
if (ch === 47) { // /
|
||
result += '\\';
|
||
}
|
||
else if (ch === 91) { // [
|
||
characterInBrack = true;
|
||
}
|
||
}
|
||
result += escapeRegExpCharacter(ch, previousIsBackslash);
|
||
previousIsBackslash = ch === 92; // \
|
||
}
|
||
else {
|
||
// if new RegExp("\\\n') is provided, create /\n/
|
||
result += escapeRegExpCharacter(ch, previousIsBackslash);
|
||
// prevent like /\\[/]/
|
||
previousIsBackslash = false;
|
||
}
|
||
}
|
||
|
||
return '/' + result + '/' + flags;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function escapeAllowedCharacter (code, next) {
|
||
var hex, result = '\\';
|
||
|
||
switch (code) {
|
||
case 0x08: // \b
|
||
result += 'b';
|
||
break;
|
||
case 0x0C: // \f
|
||
result += 'f';
|
||
break;
|
||
case 0x09: // \t
|
||
result += 't';
|
||
break;
|
||
default:
|
||
hex = code.toString(16).toUpperCase();
|
||
if (json || code > 0xFF) {
|
||
result += 'u' + '0000'.slice(hex.length) + hex;
|
||
}
|
||
|
||
else if (code === 0x0000 && !isDecimalDigit(next)) {
|
||
result += '0';
|
||
}
|
||
|
||
else if (code === 0x000B) { // \v
|
||
result += 'x0B';
|
||
}
|
||
|
||
else {
|
||
result += 'x' + '00'.slice(hex.length) + hex;
|
||
}
|
||
break;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function escapeDisallowedCharacter (code) {
|
||
var result = '\\';
|
||
switch (code) {
|
||
case 0x5C // \
|
||
:
|
||
result += '\\';
|
||
break;
|
||
case 0x0A // \n
|
||
:
|
||
result += 'n';
|
||
break;
|
||
case 0x0D // \r
|
||
:
|
||
result += 'r';
|
||
break;
|
||
case 0x2028:
|
||
result += 'u2028';
|
||
break;
|
||
case 0x2029:
|
||
result += 'u2029';
|
||
break;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function escapeDirective (str) {
|
||
var i, iz, code, quote;
|
||
|
||
quote = quotes === 'double' ? '"' : '\'';
|
||
for (i = 0, iz = str.length; i < iz; ++i) {
|
||
code = str.charCodeAt(i);
|
||
if (code === 0x27) { // '
|
||
quote = '"';
|
||
break;
|
||
}
|
||
else if (code === 0x22) { // "
|
||
quote = '\'';
|
||
break;
|
||
}
|
||
else if (code === 0x5C) { // \
|
||
++i;
|
||
}
|
||
}
|
||
|
||
return quote + str + quote;
|
||
}
|
||
|
||
function escapeString (str) {
|
||
var result = '', i, len, code, singleQuotes = 0, doubleQuotes = 0, single, quote;
|
||
//TODO http://jsperf.com/character-counting/8
|
||
for (i = 0, len = str.length; i < len; ++i) {
|
||
code = str.charCodeAt(i);
|
||
if (code === 0x27) { // '
|
||
++singleQuotes;
|
||
}
|
||
else if (code === 0x22) { // "
|
||
++doubleQuotes;
|
||
}
|
||
else if (code === 0x2F && json) { // /
|
||
result += '\\';
|
||
}
|
||
else if (isLineTerminator(code) || code === 0x5C) { // \
|
||
result += escapeDisallowedCharacter(code);
|
||
continue;
|
||
}
|
||
else if ((json && code < 0x20) || // SP
|
||
!(json || escapeless || (code >= 0x20 && code <= 0x7E))) { // SP, ~
|
||
result += escapeAllowedCharacter(code, str.charCodeAt(i + 1));
|
||
continue;
|
||
}
|
||
result += String.fromCharCode(code);
|
||
}
|
||
|
||
single = !(quotes === 'double' || (quotes === 'auto' && doubleQuotes < singleQuotes));
|
||
quote = single ? '\'' : '"';
|
||
|
||
if (!(single ? singleQuotes : doubleQuotes)) {
|
||
return quote + result + quote;
|
||
}
|
||
|
||
str = result;
|
||
result = quote;
|
||
|
||
for (i = 0, len = str.length; i < len; ++i) {
|
||
code = str.charCodeAt(i);
|
||
if ((code === 0x27 && single) || (code === 0x22 && !single)) { // ', "
|
||
result += '\\';
|
||
}
|
||
result += String.fromCharCode(code);
|
||
}
|
||
|
||
return result + quote;
|
||
}
|
||
|
||
|
||
function join (l, r) {
|
||
if (!l.length)
|
||
return r;
|
||
|
||
if (!r.length)
|
||
return l;
|
||
|
||
var lCp = l.charCodeAt(l.length - 1),
|
||
rCp = r.charCodeAt(0);
|
||
|
||
if (isIdentifierCh(lCp) && isIdentifierCh(rCp) ||
|
||
lCp === rCp && (lCp === 0x2B || lCp === 0x2D) || // + +, - -
|
||
lCp === 0x2F && rCp === 0x69) { // /re/ instanceof foo
|
||
return l + _.space + r;
|
||
}
|
||
|
||
else if (isWhitespace(lCp) || isWhitespace(rCp))
|
||
return l + r;
|
||
|
||
return l + _.optSpace + r;
|
||
}
|
||
|
||
function shiftIndent () {
|
||
var prevIndent = _.indent;
|
||
|
||
_.indent += _.indentUnit;
|
||
return prevIndent;
|
||
}
|
||
|
||
function adoptionPrefix ($stmt) {
|
||
if ($stmt.type === Syntax.BlockStatement)
|
||
return _.optSpace;
|
||
|
||
if ($stmt.type === Syntax.EmptyStatement)
|
||
return '';
|
||
|
||
return _.newline + _.indent + _.indentUnit;
|
||
}
|
||
|
||
function adoptionSuffix ($stmt) {
|
||
if ($stmt.type === Syntax.BlockStatement)
|
||
return _.optSpace;
|
||
|
||
return _.newline + _.indent;
|
||
}
|
||
|
||
//Subentities generators
|
||
function generateVerbatim ($expr, settings) {
|
||
var verbatim = $expr[extra.verbatim],
|
||
strVerbatim = typeof verbatim === 'string',
|
||
precedence = !strVerbatim &&
|
||
verbatim.precedence !== void 0 ? verbatim.precedence : Precedence.Sequence,
|
||
parenthesize = precedence < settings.precedence,
|
||
content = strVerbatim ? verbatim : verbatim.content,
|
||
chunks = content.split(/\r\n|\n/),
|
||
chunkCount = chunks.length;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
_.js += chunks[0];
|
||
|
||
for (var i = 1; i < chunkCount; i++)
|
||
_.js += _.newline + _.indent + chunks[i];
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
}
|
||
|
||
function generateFunctionParams ($node) {
|
||
var $params = $node.params,
|
||
paramCount = $params.length,
|
||
lastParamIdx = paramCount - 1,
|
||
arrowFuncWithoutParentheses = $node.type === Syntax.ArrowFunctionExpression && paramCount === 1 &&
|
||
$params[0].type === Syntax.Identifier;
|
||
|
||
//NOTE: arg => { } case
|
||
if (arrowFuncWithoutParentheses)
|
||
_.js += $params[0].name;
|
||
|
||
else {
|
||
_.js += '(';
|
||
|
||
for (var i = 0; i < paramCount; ++i) {
|
||
var $param = $params[i];
|
||
|
||
if ($params[i].type === Syntax.Identifier)
|
||
_.js += $param.name;
|
||
|
||
else
|
||
ExprGen[$param.type]($param, Preset.e4);
|
||
|
||
if (i !== lastParamIdx)
|
||
_.js += ',' + _.optSpace;
|
||
}
|
||
|
||
_.js += ')';
|
||
}
|
||
}
|
||
|
||
function generateFunctionBody ($node) {
|
||
var $body = $node.body;
|
||
|
||
generateFunctionParams($node);
|
||
|
||
if ($node.type === Syntax.ArrowFunctionExpression)
|
||
_.js += _.optSpace + '=>';
|
||
|
||
if ($node.expression) {
|
||
_.js += _.optSpace;
|
||
|
||
var exprJs = exprToJs($body, Preset.e4);
|
||
|
||
if (exprJs.charAt(0) === '{')
|
||
exprJs = '(' + exprJs + ')';
|
||
|
||
_.js += exprJs;
|
||
}
|
||
|
||
else {
|
||
_.js += adoptionPrefix($body);
|
||
StmtGen[$body.type]($body, Preset.s8);
|
||
}
|
||
}
|
||
|
||
|
||
//-------------------------------------------------===------------------------------------------------------
|
||
// Syntactic entities generation presets
|
||
//-------------------------------------------------===------------------------------------------------------
|
||
|
||
var Preset = {
|
||
e1: function (allowIn) {
|
||
return {
|
||
precedence: Precedence.Assignment,
|
||
allowIn: allowIn,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
};
|
||
},
|
||
|
||
e2: function (allowIn) {
|
||
return {
|
||
precedence: Precedence.LogicalOR,
|
||
allowIn: allowIn,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
};
|
||
},
|
||
|
||
e3: {
|
||
precedence: Precedence.Call,
|
||
allowIn: true,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: false
|
||
},
|
||
|
||
e4: {
|
||
precedence: Precedence.Assignment,
|
||
allowIn: true,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
},
|
||
|
||
e5: {
|
||
precedence: Precedence.Sequence,
|
||
allowIn: true,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
},
|
||
|
||
e6: function (allowUnparenthesizedNew) {
|
||
return {
|
||
precedence: Precedence.New,
|
||
allowIn: true,
|
||
allowCall: false,
|
||
allowUnparenthesizedNew: allowUnparenthesizedNew
|
||
};
|
||
},
|
||
|
||
e7: {
|
||
precedence: Precedence.Unary,
|
||
allowIn: true,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
},
|
||
|
||
e8: {
|
||
precedence: Precedence.Postfix,
|
||
allowIn: true,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
},
|
||
|
||
e9: {
|
||
precedence: void 0,
|
||
allowIn: true,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
},
|
||
|
||
e10: {
|
||
precedence: Precedence.Call,
|
||
allowIn: true,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
},
|
||
|
||
e11: function (allowCall) {
|
||
return {
|
||
precedence: Precedence.Call,
|
||
allowIn: true,
|
||
allowCall: allowCall,
|
||
allowUnparenthesizedNew: false
|
||
};
|
||
},
|
||
|
||
e12: {
|
||
precedence: Precedence.Primary,
|
||
allowIn: false,
|
||
allowCall: false,
|
||
allowUnparenthesizedNew: true
|
||
},
|
||
|
||
e13: {
|
||
precedence: Precedence.Primary,
|
||
allowIn: true,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
},
|
||
|
||
|
||
e14: {
|
||
precedence: Precedence.Sequence,
|
||
allowIn: false,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
},
|
||
|
||
|
||
e15: function (allowCall) {
|
||
return {
|
||
precedence: Precedence.Sequence,
|
||
allowIn: true,
|
||
allowCall: allowCall,
|
||
allowUnparenthesizedNew: true
|
||
};
|
||
},
|
||
|
||
e16: function (precedence, allowIn) {
|
||
return {
|
||
precedence: precedence,
|
||
allowIn: allowIn,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
};
|
||
},
|
||
|
||
e17: function (allowIn) {
|
||
return {
|
||
precedence: Precedence.Call,
|
||
allowIn: allowIn,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
}
|
||
},
|
||
|
||
e18: function (allowIn) {
|
||
return {
|
||
precedence: Precedence.Assignment,
|
||
allowIn: allowIn,
|
||
allowCall: true,
|
||
allowUnparenthesizedNew: true
|
||
}
|
||
},
|
||
|
||
e19: {
|
||
precedence: Precedence.Sequence,
|
||
allowIn: true,
|
||
allowCall: true,
|
||
semicolonOptional: false
|
||
},
|
||
|
||
e20: {
|
||
precedence: Precedence.Await,
|
||
allowCall: true
|
||
},
|
||
|
||
s1: function (functionBody, semicolonOptional) {
|
||
return {
|
||
allowIn: true,
|
||
functionBody: false,
|
||
directiveContext: functionBody,
|
||
semicolonOptional: semicolonOptional
|
||
};
|
||
},
|
||
|
||
s2: {
|
||
allowIn: true,
|
||
functionBody: false,
|
||
directiveContext: false,
|
||
semicolonOptional: true
|
||
},
|
||
|
||
s3: function (allowIn) {
|
||
return {
|
||
allowIn: allowIn,
|
||
functionBody: false,
|
||
directiveContext: false,
|
||
semicolonOptional: false
|
||
};
|
||
},
|
||
|
||
s4: function (semicolonOptional) {
|
||
return {
|
||
allowIn: true,
|
||
functionBody: false,
|
||
directiveContext: false,
|
||
semicolonOptional: semicolonOptional
|
||
};
|
||
},
|
||
|
||
s5: function (semicolonOptional) {
|
||
return {
|
||
allowIn: true,
|
||
functionBody: false,
|
||
directiveContext: true,
|
||
semicolonOptional: semicolonOptional,
|
||
};
|
||
},
|
||
|
||
s6: {
|
||
allowIn: false,
|
||
functionBody: false,
|
||
directiveContext: false,
|
||
semicolonOptional: false
|
||
},
|
||
|
||
s7: {
|
||
allowIn: true,
|
||
functionBody: false,
|
||
directiveContext: false,
|
||
semicolonOptional: false
|
||
},
|
||
|
||
s8: {
|
||
allowIn: true,
|
||
functionBody: true,
|
||
directiveContext: false,
|
||
semicolonOptional: false
|
||
}
|
||
};
|
||
|
||
|
||
//-------------------------------------------------===-------------------------------------------------------
|
||
// Expressions
|
||
//-------------------------------------------------===-------------------------------------------------------
|
||
|
||
//Regular expressions
|
||
var FLOATING_OR_OCTAL_REGEXP = /[.eExX]|^0[0-9]+/,
|
||
LAST_DECIMAL_DIGIT_REGEXP = /[0-9]$/;
|
||
|
||
|
||
//Common expression generators
|
||
function generateLogicalOrBinaryExpression ($expr, settings) {
|
||
var op = $expr.operator,
|
||
precedence = BinaryPrecedence[$expr.operator],
|
||
parenthesize = precedence < settings.precedence,
|
||
allowIn = settings.allowIn || parenthesize,
|
||
operandGenSettings = Preset.e16(precedence, allowIn),
|
||
exprJs = exprToJs($expr.left, operandGenSettings);
|
||
|
||
parenthesize |= op === 'in' && !allowIn;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
// 0x2F = '/'
|
||
if (exprJs.charCodeAt(exprJs.length - 1) === 0x2F && isIdentifierCh(op.charCodeAt(0)))
|
||
exprJs = exprJs + _.space + op;
|
||
|
||
else
|
||
exprJs = join(exprJs, op);
|
||
|
||
operandGenSettings.precedence++;
|
||
|
||
var rightJs = exprToJs($expr.right, operandGenSettings);
|
||
|
||
//NOTE: If '/' concats with '/' or `<` concats with `!--`, it is interpreted as comment start
|
||
if (op === '/' && rightJs.charAt(0) === '/' || op.slice(-1) === '<' && rightJs.slice(0, 3) === '!--')
|
||
exprJs += _.space + rightJs;
|
||
|
||
else
|
||
exprJs = join(exprJs, rightJs);
|
||
|
||
_.js += exprJs;
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
}
|
||
|
||
function generateArrayPatternOrExpression ($expr) {
|
||
var $elems = $expr.elements,
|
||
elemCount = $elems.length;
|
||
|
||
if (elemCount) {
|
||
var lastElemIdx = elemCount - 1,
|
||
multiline = elemCount > 1,
|
||
prevIndent = shiftIndent(),
|
||
itemPrefix = _.newline + _.indent;
|
||
|
||
_.js += '[';
|
||
|
||
for (var i = 0; i < elemCount; i++) {
|
||
var $elem = $elems[i];
|
||
|
||
if (multiline)
|
||
_.js += itemPrefix;
|
||
|
||
if ($elem)
|
||
ExprGen[$elem.type]($elem, Preset.e4);
|
||
|
||
if (i !== lastElemIdx || !$elem)
|
||
_.js += ',';
|
||
}
|
||
|
||
_.indent = prevIndent;
|
||
|
||
if (multiline)
|
||
_.js += _.newline + _.indent;
|
||
|
||
_.js += ']';
|
||
}
|
||
|
||
else
|
||
_.js += '[]';
|
||
}
|
||
|
||
function generateGeneratorOrComprehensionExpression ($expr) {
|
||
//NOTE: GeneratorExpression should be parenthesized with (...), ComprehensionExpression with [...]
|
||
var $blocks = $expr.blocks,
|
||
$filter = $expr.filter,
|
||
isGenerator = $expr.type === Syntax.GeneratorExpression,
|
||
exprJs = isGenerator ? '(' : '[',
|
||
bodyJs = exprToJs($expr.body, Preset.e4);
|
||
|
||
if ($blocks) {
|
||
var prevIndent = shiftIndent(),
|
||
blockCount = $blocks.length;
|
||
|
||
for (var i = 0; i < blockCount; ++i) {
|
||
var blockJs = exprToJs($blocks[i], Preset.e5);
|
||
|
||
exprJs = i > 0 ? join(exprJs, blockJs) : (exprJs + blockJs);
|
||
}
|
||
|
||
_.indent = prevIndent;
|
||
}
|
||
|
||
if ($filter) {
|
||
var filterJs = exprToJs($filter, Preset.e5);
|
||
|
||
exprJs = join(exprJs, 'if' + _.optSpace);
|
||
exprJs = join(exprJs, '(' + filterJs + ')');
|
||
}
|
||
|
||
exprJs = join(exprJs, bodyJs);
|
||
exprJs += isGenerator ? ')' : ']';
|
||
|
||
_.js += exprJs;
|
||
}
|
||
|
||
|
||
//Expression raw generator dictionary
|
||
var ExprRawGen = {
|
||
SequenceExpression: function generateSequenceExpression ($expr, settings) {
|
||
var $children = $expr.expressions,
|
||
childrenCount = $children.length,
|
||
lastChildIdx = childrenCount - 1,
|
||
parenthesize = Precedence.Sequence < settings.precedence,
|
||
exprGenSettings = Preset.e1(settings.allowIn || parenthesize);
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
for (var i = 0; i < childrenCount; i++) {
|
||
var $child = $children[i];
|
||
|
||
ExprGen[$child.type]($child, exprGenSettings);
|
||
|
||
if (i !== lastChildIdx)
|
||
_.js += ',' + _.optSpace;
|
||
}
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
AssignmentExpression: function generateAssignmentExpression ($expr, settings) {
|
||
var $left = $expr.left,
|
||
$right = $expr.right,
|
||
parenthesize = Precedence.Assignment < settings.precedence,
|
||
allowIn = settings.allowIn || parenthesize;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
ExprGen[$left.type]($left, Preset.e17(allowIn));
|
||
_.js += _.optSpace + $expr.operator + _.optSpace;
|
||
ExprGen[$right.type]($right, Preset.e18(allowIn));
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
AssignmentPattern: function generateAssignmentPattern ($node) {
|
||
var $fakeAssign = {
|
||
left: $node.left,
|
||
right: $node.right,
|
||
operator: '='
|
||
};
|
||
|
||
ExprGen.AssignmentExpression($fakeAssign, Preset.e4);
|
||
},
|
||
|
||
ArrowFunctionExpression: function generateArrowFunctionExpression ($expr, settings) {
|
||
var parenthesize = Precedence.ArrowFunction < settings.precedence;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
if ($expr.async)
|
||
_.js += 'async ';
|
||
|
||
generateFunctionBody($expr);
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
AwaitExpression: function generateAwaitExpression ($expr, settings) {
|
||
var parenthesize = Precedence.Await < settings.precedence;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
_.js += $expr.all ? 'await* ' : 'await ';
|
||
|
||
ExprGen[$expr.argument.type]($expr.argument, Preset.e20);
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
ConditionalExpression: function generateConditionalExpression ($expr, settings) {
|
||
var $test = $expr.test,
|
||
$conseq = $expr.consequent,
|
||
$alt = $expr.alternate,
|
||
parenthesize = Precedence.Conditional < settings.precedence,
|
||
allowIn = settings.allowIn || parenthesize,
|
||
testGenSettings = Preset.e2(allowIn),
|
||
branchGenSettings = Preset.e1(allowIn);
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
ExprGen[$test.type]($test, testGenSettings);
|
||
_.js += _.optSpace + '?' + _.optSpace;
|
||
ExprGen[$conseq.type]($conseq, branchGenSettings);
|
||
_.js += _.optSpace + ':' + _.optSpace;
|
||
ExprGen[$alt.type]($alt, branchGenSettings);
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
LogicalExpression: generateLogicalOrBinaryExpression,
|
||
|
||
BinaryExpression: generateLogicalOrBinaryExpression,
|
||
|
||
CallExpression: function generateCallExpression ($expr, settings) {
|
||
var $callee = $expr.callee,
|
||
$args = $expr['arguments'],
|
||
argCount = $args.length,
|
||
lastArgIdx = argCount - 1,
|
||
parenthesize = !settings.allowCall || Precedence.Call < settings.precedence;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
ExprGen[$callee.type]($callee, Preset.e3);
|
||
|
||
if ($expr.optional)
|
||
_.js += '?.';
|
||
|
||
_.js += '(';
|
||
|
||
for (var i = 0; i < argCount; ++i) {
|
||
var $arg = $args[i];
|
||
|
||
ExprGen[$arg.type]($arg, Preset.e4);
|
||
|
||
if (i !== lastArgIdx)
|
||
_.js += ',' + _.optSpace;
|
||
}
|
||
|
||
_.js += ')';
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
NewExpression: function generateNewExpression ($expr, settings) {
|
||
var $args = $expr['arguments'],
|
||
parenthesize = Precedence.New < settings.precedence,
|
||
argCount = $args.length,
|
||
lastArgIdx = argCount - 1,
|
||
withCall = !settings.allowUnparenthesizedNew || parentheses || argCount > 0,
|
||
calleeJs = exprToJs($expr.callee, Preset.e6(!withCall));
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
_.js += join('new', calleeJs);
|
||
|
||
if (withCall) {
|
||
_.js += '(';
|
||
|
||
for (var i = 0; i < argCount; ++i) {
|
||
var $arg = $args[i];
|
||
|
||
ExprGen[$arg.type]($arg, Preset.e4);
|
||
|
||
if (i !== lastArgIdx)
|
||
_.js += ',' + _.optSpace;
|
||
}
|
||
|
||
_.js += ')';
|
||
}
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
MemberExpression: function generateMemberExpression ($expr, settings) {
|
||
var $obj = $expr.object,
|
||
$prop = $expr.property,
|
||
parenthesize = Precedence.Member < settings.precedence,
|
||
isNumObj = !$expr.computed && $obj.type === Syntax.Literal && typeof $obj.value === 'number';
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
if (isNumObj) {
|
||
|
||
//NOTE: When the following conditions are all true:
|
||
// 1. No floating point
|
||
// 2. Don't have exponents
|
||
// 3. The last character is a decimal digit
|
||
// 4. Not hexadecimal OR octal number literal
|
||
// then we should add a floating point.
|
||
|
||
var numJs = exprToJs($obj, Preset.e11(settings.allowCall)),
|
||
withPoint = LAST_DECIMAL_DIGIT_REGEXP.test(numJs) && !FLOATING_OR_OCTAL_REGEXP.test(numJs);
|
||
|
||
_.js += withPoint ? (numJs + '.') : numJs;
|
||
}
|
||
|
||
else
|
||
ExprGen[$obj.type]($obj, Preset.e11(settings.allowCall));
|
||
|
||
if ($expr.computed) {
|
||
if ($expr.optional)
|
||
_.js += '?.';
|
||
|
||
_.js += '[';
|
||
ExprGen[$prop.type]($prop, Preset.e15(settings.allowCall));
|
||
_.js += ']';
|
||
}
|
||
|
||
else
|
||
_.js += ($expr.optional ? '?.' : '.') + $prop.name;
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
UnaryExpression: function generateUnaryExpression ($expr, settings) {
|
||
var parenthesize = Precedence.Unary < settings.precedence,
|
||
op = $expr.operator,
|
||
argJs = exprToJs($expr.argument, Preset.e7);
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
//NOTE: delete, void, typeof
|
||
// get `typeof []`, not `typeof[]`
|
||
if (_.optSpace === '' || op.length > 2)
|
||
_.js += join(op, argJs);
|
||
|
||
else {
|
||
_.js += op;
|
||
|
||
//NOTE: Prevent inserting spaces between operator and argument if it is unnecessary
|
||
// like, `!cond`
|
||
var leftCp = op.charCodeAt(op.length - 1),
|
||
rightCp = argJs.charCodeAt(0);
|
||
|
||
// 0x2B = '+', 0x2D = '-'
|
||
if (leftCp === rightCp && (leftCp === 0x2B || leftCp === 0x2D) ||
|
||
isIdentifierCh(leftCp) && isIdentifierCh(rightCp)) {
|
||
_.js += _.space;
|
||
}
|
||
|
||
_.js += argJs;
|
||
}
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
YieldExpression: function generateYieldExpression ($expr, settings) {
|
||
var $arg = $expr.argument,
|
||
js = $expr.delegate ? 'yield*' : 'yield',
|
||
parenthesize = Precedence.Yield < settings.precedence;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
if ($arg) {
|
||
var argJs = exprToJs($arg, Preset.e4);
|
||
|
||
js = join(js, argJs);
|
||
}
|
||
|
||
_.js += js;
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
UpdateExpression: function generateUpdateExpression ($expr, settings) {
|
||
var $arg = $expr.argument,
|
||
$op = $expr.operator,
|
||
prefix = $expr.prefix,
|
||
precedence = prefix ? Precedence.Unary : Precedence.Postfix,
|
||
parenthesize = precedence < settings.precedence;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
if (prefix) {
|
||
_.js += $op;
|
||
ExprGen[$arg.type]($arg, Preset.e8);
|
||
|
||
}
|
||
|
||
else {
|
||
ExprGen[$arg.type]($arg, Preset.e8);
|
||
_.js += $op;
|
||
}
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
FunctionExpression: function generateFunctionExpression ($expr) {
|
||
var isGenerator = !!$expr.generator;
|
||
|
||
if ($expr.async)
|
||
_.js += 'async ';
|
||
|
||
_.js += isGenerator ? 'function*' : 'function';
|
||
|
||
if ($expr.id) {
|
||
_.js += isGenerator ? _.optSpace : _.space;
|
||
_.js += $expr.id.name;
|
||
}
|
||
else
|
||
_.js += _.optSpace;
|
||
|
||
generateFunctionBody($expr);
|
||
},
|
||
|
||
ExportBatchSpecifier: function generateExportBatchSpecifier () {
|
||
_.js += '*';
|
||
},
|
||
|
||
ArrayPattern: generateArrayPatternOrExpression,
|
||
|
||
ArrayExpression: generateArrayPatternOrExpression,
|
||
|
||
ClassExpression: function generateClassExpression ($expr) {
|
||
var $id = $expr.id,
|
||
$super = $expr.superClass,
|
||
$body = $expr.body,
|
||
exprJs = 'class';
|
||
|
||
if ($id) {
|
||
var idJs = exprToJs($id, Preset.e9);
|
||
|
||
exprJs = join(exprJs, idJs);
|
||
}
|
||
|
||
if ($super) {
|
||
var superJs = exprToJs($super, Preset.e4);
|
||
|
||
superJs = join('extends', superJs);
|
||
exprJs = join(exprJs, superJs);
|
||
}
|
||
|
||
_.js += exprJs + _.optSpace;
|
||
StmtGen[$body.type]($body, Preset.s2);
|
||
},
|
||
|
||
MetaProperty: function generateMetaProperty ($expr, settings) {
|
||
var $meta = $expr.meta,
|
||
$property = $expr.property,
|
||
parenthesize = Precedence.Member < settings.precedence;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
_.js += (typeof $meta === "string" ? $meta : $meta.name) +
|
||
'.' + (typeof $property === "string" ? $property : $property.name);
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
MethodDefinition: function generateMethodDefinition ($expr) {
|
||
var exprJs = $expr['static'] ? 'static' + _.optSpace : '',
|
||
keyJs = exprToJs($expr.key, Preset.e5);
|
||
|
||
if ($expr.computed)
|
||
keyJs = '[' + keyJs + ']';
|
||
|
||
if ($expr.kind === 'get' || $expr.kind === 'set') {
|
||
keyJs = join($expr.kind, keyJs);
|
||
_.js += join(exprJs, keyJs);
|
||
}
|
||
|
||
else {
|
||
if ($expr.value.generator)
|
||
_.js += exprJs + '*' + keyJs;
|
||
else if ($expr.value.async)
|
||
_.js += exprJs + 'async ' + keyJs;
|
||
else
|
||
_.js += join(exprJs, keyJs);
|
||
}
|
||
|
||
generateFunctionBody($expr.value);
|
||
},
|
||
|
||
Property: function generateProperty ($expr) {
|
||
var $val = $expr.value,
|
||
$kind = $expr.kind,
|
||
keyJs = exprToJs($expr.key, Preset.e4);
|
||
|
||
if ($expr.computed)
|
||
keyJs = '[' + keyJs + ']';
|
||
|
||
if ($kind === 'get' || $kind === 'set') {
|
||
_.js += $kind + _.space + keyJs;
|
||
generateFunctionBody($val);
|
||
}
|
||
|
||
else {
|
||
if ($expr.shorthand)
|
||
_.js += keyJs;
|
||
|
||
else if ($expr.method) {
|
||
if ($val.generator)
|
||
keyJs = '*' + keyJs;
|
||
else if ($val.async)
|
||
keyJs = 'async ' + keyJs;
|
||
|
||
_.js += keyJs;
|
||
generateFunctionBody($val)
|
||
}
|
||
|
||
else {
|
||
_.js += keyJs + ':' + _.optSpace;
|
||
ExprGen[$val.type]($val, Preset.e4);
|
||
}
|
||
}
|
||
},
|
||
|
||
ObjectExpression: function generateObjectExpression ($expr) {
|
||
var $props = $expr.properties,
|
||
propCount = $props.length;
|
||
|
||
if (propCount) {
|
||
var lastPropIdx = propCount - 1,
|
||
prevIndent = shiftIndent();
|
||
|
||
_.js += '{';
|
||
|
||
for (var i = 0; i < propCount; i++) {
|
||
var $prop = $props[i],
|
||
propType = $prop.type || Syntax.Property;
|
||
|
||
_.js += _.newline + _.indent;
|
||
ExprGen[propType]($prop, Preset.e5);
|
||
|
||
if (i !== lastPropIdx)
|
||
_.js += ',';
|
||
}
|
||
|
||
_.indent = prevIndent;
|
||
_.js += _.newline + _.indent + '}';
|
||
}
|
||
|
||
else
|
||
_.js += '{}';
|
||
},
|
||
|
||
ObjectPattern: function generateObjectPattern ($expr) {
|
||
var $props = $expr.properties,
|
||
propCount = $props.length;
|
||
|
||
if (propCount) {
|
||
var lastPropIdx = propCount - 1,
|
||
multiline = false;
|
||
|
||
if (propCount === 1 && $props[0].value)
|
||
multiline = $props[0].value.type !== Syntax.Identifier;
|
||
|
||
else {
|
||
for (var i = 0; i < propCount; i++) {
|
||
if (!$props[i].shorthand) {
|
||
multiline = true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
_.js += multiline ? ('{' + _.newline) : '{';
|
||
|
||
var prevIndent = shiftIndent(),
|
||
propSuffix = ',' + (multiline ? _.newline : _.optSpace);
|
||
|
||
for (var i = 0; i < propCount; i++) {
|
||
var $prop = $props[i];
|
||
|
||
if (multiline)
|
||
_.js += _.indent;
|
||
|
||
ExprGen[$prop.type]($prop, Preset.e5);
|
||
|
||
if (i !== lastPropIdx)
|
||
_.js += propSuffix;
|
||
}
|
||
|
||
_.indent = prevIndent;
|
||
_.js += multiline ? (_.newline + _.indent + '}') : '}';
|
||
}
|
||
else
|
||
_.js += '{}';
|
||
},
|
||
|
||
ThisExpression: function generateThisExpression () {
|
||
_.js += 'this';
|
||
},
|
||
|
||
Identifier: function generateIdentifier ($expr, precedence, flag) {
|
||
_.js += $expr.name;
|
||
},
|
||
|
||
ImportExpression: function generateImportExpression ($expr, settings) {
|
||
var parenthesize = Precedence.Call < settings.precedence;
|
||
var $source = $expr.source;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
_.js += 'import(';
|
||
|
||
ExprGen[$source.type]($source, Preset.e4);
|
||
|
||
_.js += ')';
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
ImportSpecifier: function generateImportSpecifier ($expr) {
|
||
_.js += $expr.imported.name;
|
||
|
||
if ($expr.local)
|
||
_.js += _.space + 'as' + _.space + $expr.local.name;
|
||
},
|
||
|
||
ExportSpecifier: function generateImportOrExportSpecifier ($expr) {
|
||
_.js += $expr.local.name;
|
||
|
||
if ($expr.exported)
|
||
_.js += _.space + 'as' + _.space + $expr.exported.name;
|
||
},
|
||
|
||
ChainExpression: function generateChainExpression ($expr, settings) {
|
||
var parenthesize = Precedence.OptionalChaining < settings.precedence;
|
||
var $expression = $expr.expression;
|
||
|
||
settings = settings || {};
|
||
|
||
var newSettings = {
|
||
precedence: Precedence.OptionalChaining,
|
||
allowIn: settings.allowIn ,
|
||
allowCall: settings.allowCall,
|
||
|
||
allowUnparenthesizedNew: settings.allowUnparenthesizedNew
|
||
}
|
||
|
||
if (parenthesize) {
|
||
newSettings.allowCall = true;
|
||
_.js += '(';
|
||
}
|
||
|
||
ExprGen[$expression.type]($expression, newSettings);
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
Literal: function generateLiteral ($expr) {
|
||
if (extra.raw && $expr.raw !== void 0)
|
||
_.js += $expr.raw;
|
||
|
||
else if ($expr.value === null)
|
||
_.js += 'null';
|
||
|
||
else {
|
||
var valueType = typeof $expr.value;
|
||
|
||
if (valueType === 'string')
|
||
_.js += escapeString($expr.value);
|
||
|
||
else if (valueType === 'number')
|
||
_.js += generateNumber($expr.value);
|
||
|
||
else if (valueType === 'boolean')
|
||
_.js += $expr.value ? 'true' : 'false';
|
||
|
||
else
|
||
_.js += generateRegExp($expr.value);
|
||
}
|
||
},
|
||
|
||
GeneratorExpression: generateGeneratorOrComprehensionExpression,
|
||
|
||
ComprehensionExpression: generateGeneratorOrComprehensionExpression,
|
||
|
||
ComprehensionBlock: function generateComprehensionBlock ($expr) {
|
||
var $left = $expr.left,
|
||
leftJs = void 0,
|
||
rightJs = exprToJs($expr.right, Preset.e5);
|
||
|
||
if ($left.type === Syntax.VariableDeclaration)
|
||
leftJs = $left.kind + _.space + stmtToJs($left.declarations[0], Preset.s6);
|
||
|
||
else
|
||
leftJs = exprToJs($left, Preset.e10);
|
||
|
||
leftJs = join(leftJs, $expr.of ? 'of' : 'in');
|
||
|
||
_.js += 'for' + _.optSpace + '(' + join(leftJs, rightJs) + ')';
|
||
},
|
||
|
||
RestElement: function generateRestElement ($node) {
|
||
_.js += '...' + $node.argument.name;
|
||
},
|
||
|
||
SpreadElement: function generateSpreadElement ($expr) {
|
||
var $arg = $expr.argument;
|
||
|
||
_.js += '...';
|
||
ExprGen[$arg.type]($arg, Preset.e4);
|
||
},
|
||
|
||
TaggedTemplateExpression: function generateTaggedTemplateExpression ($expr, settings) {
|
||
var $tag = $expr.tag,
|
||
$quasi = $expr.quasi,
|
||
parenthesize = Precedence.TaggedTemplate < settings.precedence;
|
||
|
||
if (parenthesize)
|
||
_.js += '(';
|
||
|
||
ExprGen[$tag.type]($tag, Preset.e11(settings.allowCall));
|
||
ExprGen[$quasi.type]($quasi, Preset.e12);
|
||
|
||
if (parenthesize)
|
||
_.js += ')';
|
||
},
|
||
|
||
TemplateElement: function generateTemplateElement ($expr) {
|
||
//NOTE: Don't use "cooked". Since tagged template can use raw template
|
||
// representation. So if we do so, it breaks the script semantics.
|
||
_.js += $expr.value.raw;
|
||
},
|
||
|
||
TemplateLiteral: function generateTemplateLiteral ($expr) {
|
||
var $quasis = $expr.quasis,
|
||
$childExprs = $expr.expressions,
|
||
quasiCount = $quasis.length,
|
||
lastQuasiIdx = quasiCount - 1;
|
||
|
||
_.js += '`';
|
||
|
||
for (var i = 0; i < quasiCount; ++i) {
|
||
var $quasi = $quasis[i];
|
||
|
||
ExprGen[$quasi.type]($quasi, Preset.e13);
|
||
|
||
if (i !== lastQuasiIdx) {
|
||
var $childExpr = $childExprs[i];
|
||
|
||
_.js += '${' + _.optSpace;
|
||
ExprGen[$childExpr.type]($childExpr, Preset.e5);
|
||
_.js += _.optSpace + '}';
|
||
}
|
||
}
|
||
|
||
_.js += '`';
|
||
},
|
||
|
||
Super: function generateSuper () {
|
||
_.js += 'super';
|
||
}
|
||
};
|
||
|
||
|
||
//-------------------------------------------------===------------------------------------------------------
|
||
// Statements
|
||
//-------------------------------------------------===------------------------------------------------------
|
||
|
||
|
||
//Regular expressions
|
||
var EXPR_STMT_UNALLOWED_EXPR_REGEXP = /^{|^class(?:\s|{)|^(async )?function(?:\s|\*|\()/;
|
||
|
||
|
||
//Common statement generators
|
||
function generateTryStatementHandlers (stmtJs, $finalizer, handlers) {
|
||
var handlerCount = handlers.length,
|
||
lastHandlerIdx = handlerCount - 1;
|
||
|
||
for (var i = 0; i < handlerCount; ++i) {
|
||
var handlerJs = stmtToJs(handlers[i], Preset.s7);
|
||
|
||
stmtJs = join(stmtJs, handlerJs);
|
||
|
||
if ($finalizer || i !== lastHandlerIdx)
|
||
stmtJs += adoptionSuffix(handlers[i].body);
|
||
}
|
||
|
||
return stmtJs;
|
||
}
|
||
|
||
function generateForStatementIterator ($op, $stmt, settings) {
|
||
var $body = $stmt.body,
|
||
$left = $stmt.left,
|
||
bodySemicolonOptional = !semicolons && settings.semicolonOptional,
|
||
prevIndent1 = shiftIndent(),
|
||
awaitStr = $stmt.await ? ' await' : '',
|
||
stmtJs = 'for' + awaitStr + _.optSpace + '(';
|
||
|
||
if ($left.type === Syntax.VariableDeclaration) {
|
||
var prevIndent2 = shiftIndent();
|
||
|
||
stmtJs += $left.kind + _.space + stmtToJs($left.declarations[0], Preset.s6);
|
||
_.indent = prevIndent2;
|
||
}
|
||
|
||
else
|
||
stmtJs += exprToJs($left, Preset.e10);
|
||
|
||
stmtJs = join(stmtJs, $op);
|
||
|
||
var rightJs = exprToJs($stmt.right, Preset.e4);
|
||
|
||
stmtJs = join(stmtJs, rightJs) + ')';
|
||
|
||
_.indent = prevIndent1;
|
||
|
||
_.js += stmtJs + adoptionPrefix($body);
|
||
StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional));
|
||
}
|
||
|
||
|
||
//Statement generator dictionary
|
||
var StmtRawGen = {
|
||
BlockStatement: function generateBlockStatement ($stmt, settings) {
|
||
var $body = $stmt.body,
|
||
len = $body.length,
|
||
lastIdx = len - 1,
|
||
prevIndent = shiftIndent();
|
||
|
||
_.js += '{' + _.newline;
|
||
|
||
for (var i = 0; i < len; i++) {
|
||
var $item = $body[i];
|
||
|
||
_.js += _.indent;
|
||
StmtGen[$item.type]($item, Preset.s1(settings.functionBody, i === lastIdx));
|
||
_.js += _.newline;
|
||
}
|
||
|
||
_.indent = prevIndent;
|
||
_.js += _.indent + '}';
|
||
},
|
||
|
||
BreakStatement: function generateBreakStatement ($stmt, settings) {
|
||
if ($stmt.label)
|
||
_.js += 'break ' + $stmt.label.name;
|
||
|
||
else
|
||
_.js += 'break';
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
},
|
||
|
||
ContinueStatement: function generateContinueStatement ($stmt, settings) {
|
||
if ($stmt.label)
|
||
_.js += 'continue ' + $stmt.label.name;
|
||
|
||
else
|
||
_.js += 'continue';
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
},
|
||
|
||
ClassBody: function generateClassBody ($stmt) {
|
||
var $body = $stmt.body,
|
||
itemCount = $body.length,
|
||
lastItemIdx = itemCount - 1,
|
||
prevIndent = shiftIndent();
|
||
|
||
_.js += '{' + _.newline;
|
||
|
||
for (var i = 0; i < itemCount; i++) {
|
||
var $item = $body[i],
|
||
itemType = $item.type || Syntax.Property;
|
||
|
||
_.js += _.indent;
|
||
ExprGen[itemType]($item, Preset.e5);
|
||
|
||
if (i !== lastItemIdx)
|
||
_.js += _.newline;
|
||
}
|
||
|
||
_.indent = prevIndent;
|
||
_.js += _.newline + _.indent + '}';
|
||
},
|
||
|
||
ClassDeclaration: function generateClassDeclaration ($stmt) {
|
||
var $body = $stmt.body,
|
||
$super = $stmt.superClass,
|
||
js = 'class ' + $stmt.id.name;
|
||
|
||
if ($super) {
|
||
var superJs = exprToJs($super, Preset.e4);
|
||
|
||
js += _.space + join('extends', superJs);
|
||
}
|
||
|
||
_.js += js + _.optSpace;
|
||
StmtGen[$body.type]($body, Preset.s2);
|
||
},
|
||
|
||
DirectiveStatement: function generateDirectiveStatement ($stmt, settings) {
|
||
if (extra.raw && $stmt.raw)
|
||
_.js += $stmt.raw;
|
||
|
||
else
|
||
_.js += escapeDirective($stmt.directive);
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
},
|
||
|
||
DoWhileStatement: function generateDoWhileStatement ($stmt, settings) {
|
||
var $body = $stmt.body,
|
||
$test = $stmt.test,
|
||
bodyJs = adoptionPrefix($body) +
|
||
stmtToJs($body, Preset.s7) +
|
||
adoptionSuffix($body);
|
||
|
||
//NOTE: Because `do 42 while (cond)` is Syntax Error. We need semicolon.
|
||
var stmtJs = join('do', bodyJs);
|
||
|
||
_.js += join(stmtJs, 'while' + _.optSpace + '(');
|
||
ExprGen[$test.type]($test, Preset.e5);
|
||
_.js += ')';
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
},
|
||
|
||
CatchClause: function generateCatchClause ($stmt) {
|
||
var $param = $stmt.param,
|
||
$guard = $stmt.guard,
|
||
$body = $stmt.body,
|
||
prevIndent = shiftIndent();
|
||
|
||
_.js += 'catch' + _.optSpace;
|
||
|
||
if ($param) {
|
||
_.js += '(';
|
||
ExprGen[$param.type]($param, Preset.e5);
|
||
}
|
||
|
||
if ($guard) {
|
||
_.js += ' if ';
|
||
ExprGen[$guard.type]($guard, Preset.e5);
|
||
}
|
||
|
||
_.indent = prevIndent;
|
||
if ($param) {
|
||
_.js += ')';
|
||
}
|
||
|
||
_.js += adoptionPrefix($body);
|
||
StmtGen[$body.type]($body, Preset.s7);
|
||
},
|
||
|
||
DebuggerStatement: function generateDebuggerStatement ($stmt, settings) {
|
||
_.js += 'debugger';
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
},
|
||
|
||
EmptyStatement: function generateEmptyStatement () {
|
||
_.js += ';';
|
||
},
|
||
|
||
ExportAllDeclaration: function ($stmt, settings) {
|
||
StmtRawGen.ExportDeclaration($stmt, settings, true);
|
||
},
|
||
|
||
ExportDeclaration: function generateExportDeclaration ($stmt, settings, exportAll) {
|
||
var $specs = $stmt.specifiers,
|
||
$decl = $stmt.declaration,
|
||
withSemicolon = semicolons || !settings.semicolonOptional;
|
||
|
||
// export default AssignmentExpression[In] ;
|
||
if ($stmt['default']) {
|
||
var declJs = exprToJs($decl, Preset.e4);
|
||
|
||
_.js += join('export default', declJs);
|
||
|
||
if (withSemicolon)
|
||
_.js += ';';
|
||
}
|
||
|
||
// export * FromClause ;
|
||
// export ExportClause[NoReference] FromClause ;
|
||
// export ExportClause ;
|
||
else if ($specs || exportAll) {
|
||
var stmtJs = 'export';
|
||
|
||
if (exportAll)
|
||
stmtJs += _.optSpace + '*';
|
||
|
||
else if ($specs.length === 0)
|
||
stmtJs += _.optSpace + '{' + _.optSpace + '}';
|
||
|
||
else if ($specs[0].type === Syntax.ExportBatchSpecifier) {
|
||
var specJs = exprToJs($specs[0], Preset.e5);
|
||
|
||
stmtJs = join(stmtJs, specJs);
|
||
}
|
||
|
||
else {
|
||
var prevIndent = shiftIndent(),
|
||
specCount = $specs.length,
|
||
lastSpecIdx = specCount - 1;
|
||
|
||
stmtJs += _.optSpace + '{';
|
||
|
||
for (var i = 0; i < specCount; ++i) {
|
||
stmtJs += _.newline + _.indent;
|
||
stmtJs += exprToJs($specs[i], Preset.e5);
|
||
|
||
if (i !== lastSpecIdx)
|
||
stmtJs += ',';
|
||
}
|
||
|
||
_.indent = prevIndent;
|
||
stmtJs += _.newline + _.indent + '}';
|
||
}
|
||
|
||
if ($stmt.source) {
|
||
_.js += join(stmtJs, 'from' + _.optSpace);
|
||
ExprGen.Literal($stmt.source);
|
||
}
|
||
|
||
else
|
||
_.js += stmtJs;
|
||
|
||
if (withSemicolon)
|
||
_.js += ';';
|
||
}
|
||
|
||
// export VariableStatement
|
||
// export Declaration[Default]
|
||
else if ($decl) {
|
||
var declJs = stmtToJs($decl, Preset.s4(!withSemicolon));
|
||
|
||
_.js += join('export', declJs);
|
||
}
|
||
},
|
||
|
||
ExportNamedDeclaration: function ($stmt, settings) {
|
||
StmtRawGen.ExportDeclaration($stmt, settings);
|
||
},
|
||
|
||
ExpressionStatement: function generateExpressionStatement ($stmt, settings) {
|
||
var exprJs = exprToJs($stmt.expression, Preset.e5),
|
||
parenthesize = EXPR_STMT_UNALLOWED_EXPR_REGEXP.test(exprJs) ||
|
||
(directive &&
|
||
settings.directiveContext &&
|
||
$stmt.expression.type === Syntax.Literal &&
|
||
typeof $stmt.expression.value === 'string');
|
||
|
||
//NOTE: '{', 'function', 'class' are not allowed in expression statement.
|
||
// Therefore, they should be parenthesized.
|
||
if (parenthesize)
|
||
_.js += '(' + exprJs + ')';
|
||
|
||
else
|
||
_.js += exprJs;
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
},
|
||
|
||
ImportDeclaration: function generateImportDeclaration ($stmt, settings) {
|
||
var $specs = $stmt.specifiers,
|
||
stmtJs = 'import',
|
||
specCount = $specs.length;
|
||
|
||
//NOTE: If no ImportClause is present,
|
||
// this should be `import ModuleSpecifier` so skip `from`
|
||
// ModuleSpecifier is StringLiteral.
|
||
if (specCount) {
|
||
var hasBinding = !!$specs[0]['default'],
|
||
firstNamedIdx = hasBinding ? 1 : 0,
|
||
lastSpecIdx = specCount - 1;
|
||
|
||
// ImportedBinding
|
||
if (hasBinding)
|
||
stmtJs = join(stmtJs, $specs[0].id.name);
|
||
|
||
// NamedImports
|
||
if (firstNamedIdx < specCount) {
|
||
if (hasBinding)
|
||
stmtJs += ',';
|
||
|
||
stmtJs += _.optSpace + '{';
|
||
|
||
// import { ... } from "...";
|
||
if (firstNamedIdx === lastSpecIdx)
|
||
stmtJs += _.optSpace + exprToJs($specs[firstNamedIdx], Preset.e5) + _.optSpace;
|
||
|
||
else {
|
||
var prevIndent = shiftIndent();
|
||
|
||
// import {
|
||
// ...,
|
||
// ...,
|
||
// } from "...";
|
||
for (var i = firstNamedIdx; i < specCount; i++) {
|
||
stmtJs += _.newline + _.indent + exprToJs($specs[i], Preset.e5);
|
||
|
||
if (i !== lastSpecIdx)
|
||
stmtJs += ',';
|
||
}
|
||
|
||
_.indent = prevIndent;
|
||
stmtJs += _.newline + _.indent;
|
||
}
|
||
|
||
stmtJs += '}' + _.optSpace;
|
||
}
|
||
|
||
stmtJs = join(stmtJs, 'from')
|
||
}
|
||
|
||
_.js += stmtJs + _.optSpace;
|
||
ExprGen.Literal($stmt.source);
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
},
|
||
|
||
VariableDeclarator: function generateVariableDeclarator ($stmt, settings) {
|
||
var $id = $stmt.id,
|
||
$init = $stmt.init,
|
||
genSettings = Preset.e1(settings.allowIn);
|
||
|
||
if ($init) {
|
||
ExprGen[$id.type]($id, genSettings);
|
||
_.js += _.optSpace + '=' + _.optSpace;
|
||
ExprGen[$init.type]($init, genSettings);
|
||
}
|
||
|
||
else {
|
||
if ($id.type === Syntax.Identifier)
|
||
_.js += $id.name;
|
||
|
||
else
|
||
ExprGen[$id.type]($id, genSettings);
|
||
}
|
||
},
|
||
|
||
VariableDeclaration: function generateVariableDeclaration ($stmt, settings) {
|
||
var $decls = $stmt.declarations,
|
||
len = $decls.length,
|
||
prevIndent = len > 1 ? shiftIndent() : _.indent,
|
||
declGenSettings = Preset.s3(settings.allowIn);
|
||
|
||
_.js += $stmt.kind;
|
||
|
||
for (var i = 0; i < len; i++) {
|
||
var $decl = $decls[i];
|
||
|
||
_.js += i === 0 ? _.space : (',' + _.optSpace);
|
||
StmtGen[$decl.type]($decl, declGenSettings);
|
||
}
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
|
||
_.indent = prevIndent;
|
||
},
|
||
|
||
ThrowStatement: function generateThrowStatement ($stmt, settings) {
|
||
var argJs = exprToJs($stmt.argument, Preset.e5);
|
||
|
||
_.js += join('throw', argJs);
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
},
|
||
|
||
TryStatement: function generateTryStatement ($stmt) {
|
||
var $block = $stmt.block,
|
||
$finalizer = $stmt.finalizer,
|
||
stmtJs = 'try' +
|
||
adoptionPrefix($block) +
|
||
stmtToJs($block, Preset.s7) +
|
||
adoptionSuffix($block);
|
||
|
||
var $handlers = $stmt.handlers || $stmt.guardedHandlers;
|
||
|
||
if ($handlers)
|
||
stmtJs = generateTryStatementHandlers(stmtJs, $finalizer, $handlers);
|
||
|
||
if ($stmt.handler) {
|
||
$handlers = isArray($stmt.handler) ? $stmt.handler : [$stmt.handler];
|
||
stmtJs = generateTryStatementHandlers(stmtJs, $finalizer, $handlers);
|
||
}
|
||
|
||
if ($finalizer) {
|
||
stmtJs = join(stmtJs, 'finally' + adoptionPrefix($finalizer));
|
||
stmtJs += stmtToJs($finalizer, Preset.s7);
|
||
}
|
||
|
||
_.js += stmtJs;
|
||
},
|
||
|
||
SwitchStatement: function generateSwitchStatement ($stmt) {
|
||
var $cases = $stmt.cases,
|
||
$discr = $stmt.discriminant,
|
||
prevIndent = shiftIndent();
|
||
|
||
_.js += 'switch' + _.optSpace + '(';
|
||
ExprGen[$discr.type]($discr, Preset.e5);
|
||
_.js += ')' + _.optSpace + '{' + _.newline;
|
||
_.indent = prevIndent;
|
||
|
||
if ($cases) {
|
||
var caseCount = $cases.length,
|
||
lastCaseIdx = caseCount - 1;
|
||
|
||
for (var i = 0; i < caseCount; i++) {
|
||
var $case = $cases[i];
|
||
|
||
_.js += _.indent;
|
||
StmtGen[$case.type]($case, Preset.s4(i === lastCaseIdx));
|
||
_.js += _.newline;
|
||
}
|
||
}
|
||
|
||
_.js += _.indent + '}';
|
||
},
|
||
|
||
SwitchCase: function generateSwitchCase ($stmt, settings) {
|
||
var $conseqs = $stmt.consequent,
|
||
$firstConseq = $conseqs[0],
|
||
$test = $stmt.test,
|
||
i = 0,
|
||
conseqSemicolonOptional = !semicolons && settings.semicolonOptional,
|
||
conseqCount = $conseqs.length,
|
||
lastConseqIdx = conseqCount - 1,
|
||
prevIndent = shiftIndent();
|
||
|
||
if ($test) {
|
||
var testJs = exprToJs($test, Preset.e5);
|
||
|
||
_.js += join('case', testJs) + ':';
|
||
}
|
||
|
||
else
|
||
_.js += 'default:';
|
||
|
||
|
||
if (conseqCount && $firstConseq.type === Syntax.BlockStatement) {
|
||
i++;
|
||
_.js += adoptionPrefix($firstConseq);
|
||
StmtGen[$firstConseq.type]($firstConseq, Preset.s7);
|
||
}
|
||
|
||
for (; i < conseqCount; i++) {
|
||
var $conseq = $conseqs[i],
|
||
semicolonOptional = i === lastConseqIdx && conseqSemicolonOptional;
|
||
|
||
_.js += _.newline + _.indent;
|
||
StmtGen[$conseq.type]($conseq, Preset.s4(semicolonOptional));
|
||
}
|
||
|
||
_.indent = prevIndent;
|
||
},
|
||
|
||
IfStatement: function generateIfStatement ($stmt, settings) {
|
||
var $conseq = $stmt.consequent,
|
||
$test = $stmt.test,
|
||
prevIndent = shiftIndent(),
|
||
semicolonOptional = !semicolons && settings.semicolonOptional;
|
||
|
||
_.js += 'if' + _.optSpace + '(';
|
||
ExprGen[$test.type]($test, Preset.e5);
|
||
_.js += ')';
|
||
_.indent = prevIndent;
|
||
_.js += adoptionPrefix($conseq);
|
||
|
||
if ($stmt.alternate) {
|
||
var conseq = stmtToJs($conseq, Preset.s7) + adoptionSuffix($conseq),
|
||
alt = stmtToJs($stmt.alternate, Preset.s4(semicolonOptional));
|
||
|
||
if ($stmt.alternate.type === Syntax.IfStatement)
|
||
alt = 'else ' + alt;
|
||
|
||
else
|
||
alt = join('else', adoptionPrefix($stmt.alternate) + alt);
|
||
|
||
_.js += join(conseq, alt);
|
||
}
|
||
|
||
else
|
||
StmtGen[$conseq.type]($conseq, Preset.s4(semicolonOptional));
|
||
},
|
||
|
||
ForStatement: function generateForStatement ($stmt, settings) {
|
||
var $init = $stmt.init,
|
||
$test = $stmt.test,
|
||
$body = $stmt.body,
|
||
$update = $stmt.update,
|
||
bodySemicolonOptional = !semicolons && settings.semicolonOptional,
|
||
prevIndent = shiftIndent();
|
||
|
||
_.js += 'for' + _.optSpace + '(';
|
||
|
||
if ($init) {
|
||
if ($init.type === Syntax.VariableDeclaration)
|
||
StmtGen[$init.type]($init, Preset.s6);
|
||
|
||
else {
|
||
ExprGen[$init.type]($init, Preset.e14);
|
||
_.js += ';';
|
||
}
|
||
}
|
||
|
||
else
|
||
_.js += ';';
|
||
|
||
if ($test) {
|
||
_.js += _.optSpace;
|
||
ExprGen[$test.type]($test, Preset.e5);
|
||
}
|
||
|
||
_.js += ';';
|
||
|
||
if ($update) {
|
||
_.js += _.optSpace;
|
||
ExprGen[$update.type]($update, Preset.e5);
|
||
}
|
||
|
||
_.js += ')';
|
||
_.indent = prevIndent;
|
||
_.js += adoptionPrefix($body);
|
||
StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional));
|
||
},
|
||
|
||
ForInStatement: function generateForInStatement ($stmt, settings) {
|
||
generateForStatementIterator('in', $stmt, settings);
|
||
},
|
||
|
||
ForOfStatement: function generateForOfStatement ($stmt, settings) {
|
||
generateForStatementIterator('of', $stmt, settings);
|
||
},
|
||
|
||
LabeledStatement: function generateLabeledStatement ($stmt, settings) {
|
||
var $body = $stmt.body,
|
||
bodySemicolonOptional = !semicolons && settings.semicolonOptional,
|
||
prevIndent = _.indent;
|
||
|
||
_.js += $stmt.label.name + ':' + adoptionPrefix($body);
|
||
|
||
if ($body.type !== Syntax.BlockStatement)
|
||
prevIndent = shiftIndent();
|
||
|
||
StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional));
|
||
_.indent = prevIndent;
|
||
},
|
||
|
||
ModuleDeclaration: function generateModuleDeclaration ($stmt, settings) {
|
||
_.js += 'module' + _.space + $stmt.id.name + _.space + 'from' + _.optSpace;
|
||
|
||
ExprGen.Literal($stmt.source);
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
},
|
||
|
||
Program: function generateProgram ($stmt) {
|
||
var $body = $stmt.body,
|
||
len = $body.length,
|
||
lastIdx = len - 1;
|
||
|
||
if (safeConcatenation && len > 0)
|
||
_.js += '\n';
|
||
|
||
for (var i = 0; i < len; i++) {
|
||
var $item = $body[i];
|
||
|
||
_.js += _.indent;
|
||
StmtGen[$item.type]($item, Preset.s5(!safeConcatenation && i === lastIdx));
|
||
|
||
if (i !== lastIdx)
|
||
_.js += _.newline;
|
||
}
|
||
},
|
||
|
||
FunctionDeclaration: function generateFunctionDeclaration ($stmt) {
|
||
var isGenerator = !!$stmt.generator;
|
||
|
||
if ($stmt.async)
|
||
_.js += 'async ';
|
||
|
||
_.js += isGenerator ? ('function*' + _.optSpace) : ('function' + _.space );
|
||
_.js += $stmt.id.name;
|
||
generateFunctionBody($stmt);
|
||
},
|
||
|
||
ReturnStatement: function generateReturnStatement ($stmt, settings) {
|
||
var $arg = $stmt.argument;
|
||
|
||
if ($arg) {
|
||
var argJs = exprToJs($arg, Preset.e5);
|
||
|
||
_.js += join('return', argJs);
|
||
}
|
||
|
||
else
|
||
_.js += 'return';
|
||
|
||
if (semicolons || !settings.semicolonOptional)
|
||
_.js += ';';
|
||
},
|
||
|
||
WhileStatement: function generateWhileStatement ($stmt, settings) {
|
||
var $body = $stmt.body,
|
||
$test = $stmt.test,
|
||
bodySemicolonOptional = !semicolons && settings.semicolonOptional,
|
||
prevIndent = shiftIndent();
|
||
|
||
_.js += 'while' + _.optSpace + '(';
|
||
ExprGen[$test.type]($test, Preset.e5);
|
||
_.js += ')';
|
||
_.indent = prevIndent;
|
||
|
||
_.js += adoptionPrefix($body);
|
||
StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional));
|
||
},
|
||
|
||
WithStatement: function generateWithStatement ($stmt, settings) {
|
||
var $body = $stmt.body,
|
||
$obj = $stmt.object,
|
||
bodySemicolonOptional = !semicolons && settings.semicolonOptional,
|
||
prevIndent = shiftIndent();
|
||
|
||
_.js += 'with' + _.optSpace + '(';
|
||
ExprGen[$obj.type]($obj, Preset.e5);
|
||
_.js += ')';
|
||
_.indent = prevIndent;
|
||
_.js += adoptionPrefix($body);
|
||
StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional));
|
||
}
|
||
};
|
||
|
||
function generateStatement ($stmt, option) {
|
||
StmtGen[$stmt.type]($stmt, option);
|
||
}
|
||
|
||
//CodeGen
|
||
//-----------------------------------------------------------------------------------
|
||
function exprToJs ($expr, settings) {
|
||
var savedJs = _.js;
|
||
_.js = '';
|
||
|
||
// ExprGen[$expr.type]($expr, settings);
|
||
// Modified for Corrosion
|
||
if (typeof ExprGen[$expr.type] == 'function') ExprGen[$expr.type]($expr, settings);
|
||
|
||
var src = _.js;
|
||
_.js = savedJs;
|
||
|
||
return src;
|
||
}
|
||
|
||
function stmtToJs ($stmt, settings) {
|
||
var savedJs = _.js;
|
||
_.js = '';
|
||
|
||
StmtGen[$stmt.type]($stmt, settings);
|
||
|
||
var src = _.js;
|
||
_.js = savedJs;
|
||
|
||
return src;
|
||
}
|
||
|
||
function run ($node) {
|
||
_.js = '';
|
||
|
||
if (StmtGen[$node.type])
|
||
StmtGen[$node.type]($node, Preset.s7);
|
||
|
||
else
|
||
ExprGen[$node.type]($node, Preset.e19);
|
||
|
||
return _.js;
|
||
}
|
||
|
||
function wrapExprGen (gen) {
|
||
return function ($expr, settings) {
|
||
if (extra.verbatim && $expr.hasOwnProperty(extra.verbatim))
|
||
generateVerbatim($expr, settings);
|
||
|
||
else
|
||
gen($expr, settings);
|
||
}
|
||
}
|
||
|
||
function createExprGenWithExtras () {
|
||
var gens = {};
|
||
|
||
for (var key in ExprRawGen) {
|
||
if (ExprRawGen.hasOwnProperty(key))
|
||
gens[key] = wrapExprGen(ExprRawGen[key]);
|
||
}
|
||
|
||
return gens;
|
||
}
|
||
|
||
|
||
//Strings
|
||
var _ = {
|
||
js: '',
|
||
newline: '\n',
|
||
optSpace: ' ',
|
||
space: ' ',
|
||
indentUnit: ' ',
|
||
indent: ''
|
||
};
|
||
|
||
|
||
//Generators
|
||
var ExprGen = void 0,
|
||
StmtGen = StmtRawGen;
|
||
|
||
|
||
exports.generate = function ($node, options) {
|
||
var defaultOptions = getDefaultOptions(), result, pair;
|
||
|
||
if (options != null) {
|
||
//NOTE: Obsolete options
|
||
//
|
||
// `options.indent`
|
||
// `options.base`
|
||
//
|
||
// Instead of them, we can use `option.format.indent`.
|
||
if (typeof options.indent === 'string') {
|
||
defaultOptions.format.indent.style = options.indent;
|
||
}
|
||
if (typeof options.base === 'number') {
|
||
defaultOptions.format.indent.base = options.base;
|
||
}
|
||
options = updateDeeply(defaultOptions, options);
|
||
_.indentUnit = options.format.indent.style;
|
||
if (typeof options.base === 'string') {
|
||
_.indent = options.base;
|
||
}
|
||
else {
|
||
_.indent = stringRepeat(_.indentUnit, options.format.indent.base);
|
||
}
|
||
}
|
||
else {
|
||
options = defaultOptions;
|
||
_.indentUnit = options.format.indent.style;
|
||
_.indent = stringRepeat(_.indentUnit, options.format.indent.base);
|
||
}
|
||
json = options.format.json;
|
||
renumber = options.format.renumber;
|
||
hexadecimal = json ? false : options.format.hexadecimal;
|
||
quotes = json ? 'double' : options.format.quotes;
|
||
escapeless = options.format.escapeless;
|
||
|
||
_.newline = options.format.newline;
|
||
_.optSpace = options.format.space;
|
||
|
||
if (options.format.compact)
|
||
_.newline = _.optSpace = _.indentUnit = _.indent = '';
|
||
|
||
_.space = _.optSpace ? _.optSpace : ' ';
|
||
parentheses = options.format.parentheses;
|
||
semicolons = options.format.semicolons;
|
||
safeConcatenation = options.format.safeConcatenation;
|
||
directive = options.directive;
|
||
parse = json ? null : options.parse;
|
||
extra = options;
|
||
|
||
if (extra.verbatim)
|
||
ExprGen = createExprGenWithExtras();
|
||
|
||
else
|
||
ExprGen = ExprRawGen;
|
||
|
||
return run($node);
|
||
};
|
||
|
||
/***/ })
|
||
/******/ ]);
|
||
/************************************************************************/
|
||
/******/ // The module cache
|
||
/******/ var __webpack_module_cache__ = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/ // Check if module is in cache
|
||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||
/******/ if (cachedModule !== undefined) {
|
||
/******/ return cachedModule.exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||
/******/ // no module.id needed
|
||
/******/ // no module.loaded needed
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/************************************************************************/
|
||
var __webpack_exports__ = {};
|
||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
||
(() => {
|
||
const createDocumentRewriter = __webpack_require__(1);
|
||
const createHistoryRewriter = __webpack_require__(2);
|
||
const createHttpRewriter = __webpack_require__(3);
|
||
const createLocation = __webpack_require__(4);
|
||
const createWorkerRewriter = __webpack_require__(5);
|
||
const defaultConfig = {
|
||
prefix: '/service/',
|
||
codec: 'plain',
|
||
ws: true,
|
||
cookie: true,
|
||
title: 'Service',
|
||
serviceWorker: false,
|
||
url: null,
|
||
window: false,
|
||
};
|
||
|
||
class Corrosion extends __webpack_require__(6) {
|
||
constructor(config = defaultConfig) {
|
||
super(Object.assign(defaultConfig, config));
|
||
const corrosion = this;
|
||
if (!this.config.window) throw 'Corrosion Error: No window was given.';
|
||
this.serviceWorker = this.config.serviceWorker || false;
|
||
this.window = this.config.window;
|
||
this.document = this.serviceWorker ? this.window.document : {};
|
||
this._url = new URL((this.config.url || this.url.unwrap(this.window.location.href, { origin: this.window.location.origin, })));
|
||
this.originalXhr = this.window.XMLHttpRequest;
|
||
this.meta = {
|
||
origin: this.window.location.origin,
|
||
get base() {
|
||
if (corrosion.serviceWorker) return corrosion._url;
|
||
return corrosion.window.document.baseURI != corrosion.location.href ? new URL(corrosion.window.document.baseURI) : corrosion._url;
|
||
},
|
||
url: this._url,
|
||
};
|
||
this.location = createLocation(this, this._url);
|
||
this.rewriteHttp = createHttpRewriter(this);
|
||
this.rewriteDocument = createDocumentRewriter(this);
|
||
this.rewriteHistory = createHistoryRewriter(this);
|
||
this.rewriteWorker = createWorkerRewriter(this);
|
||
if (!this.serviceWorker && this.window.document.currentScript) this.window.document.currentScript.remove();
|
||
};
|
||
get parent() {
|
||
if (this.serviceWorker) return false;
|
||
try {
|
||
return this.window.parent.$corrosion ? this.window.parent : this.window;
|
||
} catch(e) {
|
||
return this.window;
|
||
};
|
||
};
|
||
get top() {
|
||
if (this.serviceWorker) return false;
|
||
try {
|
||
return this.window.top.$corrosion ? this.window.top : this.parent;
|
||
} catch(e) {
|
||
return this.parent;
|
||
};
|
||
};
|
||
init() {
|
||
this.rewriteHttp();
|
||
this.rewriteDocument();
|
||
this.rewriteHistory();
|
||
this.rewriteWorker();
|
||
this.window.Location = createLocation.Location;
|
||
this.window.$corrosionGet$ = this.get$.bind(this);
|
||
this.window.$corrosionSet$ = this.set$.bind(this);
|
||
this.window.$corrosionGet$m = this.get$m.bind(this);
|
||
this.window.$corrosionSet$m = this.set$m.bind(this);
|
||
this.window.$corrosionCall$m = this.call$m.bind(this);
|
||
};
|
||
get$m(obj, key) {
|
||
if (!this.serviceWorker && this.window != this.window.parent && obj == this.window.parent) {
|
||
return this.parent.$corrosion.get$m(this.parent, key);
|
||
};
|
||
if (!this.serviceWorker && this.window != this.window.top && obj == this.window.top) {
|
||
return this.top.$corrosion.get$m(this.top, key);
|
||
};
|
||
if (obj == this.window && key == 'location' || !this.serviceWorker && obj == this.window.document && key == 'location') return this.location;
|
||
if (!this.serviceWorker && obj == this.window && key == 'parent' && this.window != this.window.parent) return this.parent;
|
||
if (!this.serviceWorker && obj == this.window && key == 'top' && this.window != this.window.top) return this.top;
|
||
return obj[key];
|
||
};
|
||
set$m(obj, key, val, operator) {
|
||
if (!this.serviceWorker && this.window != this.window.parent && obj == this.window.parent) {
|
||
return this.parent.$corrosion.set$m(this.parent, key, val, operator);
|
||
};
|
||
if (!this.serviceWorker && this.window != this.window.top && obj == this.window.top) {
|
||
return this.top.$corrosion.set$m(this.top, key, val, operator);
|
||
};
|
||
if (obj == this.window && key == 'location' || !this.serviceWorker && obj == this.window.document && key == 'location') obj = this;
|
||
switch(operator) {
|
||
case '+=':
|
||
return obj[key] += val;
|
||
case '-=':
|
||
return obj[key] -= val;
|
||
case '*=':
|
||
return obj[key] *= val;
|
||
case '/=':
|
||
return obj[key] /= val;
|
||
case '%=':
|
||
return obj[key] %= val;
|
||
case '**=':
|
||
return obj[key] **= val;
|
||
case '<<=':
|
||
return obj[key] <<= val;
|
||
case '>>=':
|
||
return obj[key] >>= val;
|
||
case '>>>=':
|
||
return obj[key] >>>= val;
|
||
case '&=':
|
||
return obj[key] &= val;
|
||
case '^=':
|
||
return obj[key] ^= val;
|
||
case '|=':
|
||
return obj[key] |= val;
|
||
case '&&=':
|
||
return obj[key] &&= val;
|
||
case '||=':
|
||
return obj[key] ||= val;
|
||
case '??=':
|
||
return obj[key] ??= val;
|
||
case '++':
|
||
return obj[key]++;
|
||
case '--':
|
||
return obj[key]--;
|
||
case '=':
|
||
default:
|
||
return obj[key] = val;
|
||
};
|
||
};
|
||
call$m(obj, key, args) {
|
||
if (!this.serviceWorker && this.window != this.window.parent && obj == this.window.parent) {
|
||
return this.parent.$corrosion.call$m(this.parent, key, args);
|
||
};
|
||
if (!this.serviceWorker && this.window != this.window.top && obj == this.window.top) {
|
||
return this.top.$corrosion.call$m(this.top, key, args);
|
||
};
|
||
return obj[key](...args);
|
||
};
|
||
get$(obj) {
|
||
if (obj == this.window.location) return this.location;
|
||
if (!this.serviceWorker && obj == this.window.parent) return this.parent;
|
||
if (!this.serviceWorker && obj == this.window.top) return this.top;
|
||
return obj;
|
||
};
|
||
set$(obj, val, operator) {
|
||
if (obj == this.window.location) return this.set$(this.location, val, operator);
|
||
if (!this.serviceWorker && this.window != this.window.parent && obj == this.window.parent) return this.parent.set$(this.parent, val, operator);
|
||
if (!this.serviceWorker && this.window != this.window.top && obj == this.window.top) return this.top.set$(this.top, val, operator);
|
||
switch(operator) {
|
||
case '+=':
|
||
return obj += val;
|
||
case '-=':
|
||
return obj -= val;
|
||
case '*=':
|
||
return obj *= val;
|
||
case '/=':
|
||
return obj /= val;
|
||
case '%=':
|
||
return obj %= val;
|
||
case '**=':
|
||
return obj **= val;
|
||
case '<<=':
|
||
return obj <<= val;
|
||
case '>>=':
|
||
return obj >>= val;
|
||
case '>>>=':
|
||
return obj >>>= val;
|
||
case '&=':
|
||
return obj &= val;
|
||
case '^=':
|
||
return obj ^= val;
|
||
case '|=':
|
||
return obj |= val;
|
||
case '&&=':
|
||
return obj &&= val;
|
||
case '||=':
|
||
return obj ||= val;
|
||
case '??=':
|
||
return obj ??= val;
|
||
case '++':
|
||
return obj++;
|
||
case '--':
|
||
return obj--;
|
||
case '=':
|
||
default:
|
||
return obj = val;
|
||
};
|
||
};
|
||
updateLocation() {
|
||
this._url = new URL(this.url.unwrap(this.window.location.href, this.meta));
|
||
this.location = createLocation(this, this._url);
|
||
};
|
||
};
|
||
|
||
globalThis.Corrosion = Corrosion;
|
||
})();
|
||
|
||
/******/ })()
|
||
; |