diff --git a/.eslintrc.js b/.eslintrc.js index ae50027..57ae1e1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,113 +1,60 @@ -module.exports = { - // "parser": '@typescript-eslint/parser', // 启用会导致vue文件eslint错误 - extends: [ - 'plugin:vue/vue3-recommended', - // 'eslint:alins', - ], - 'plugins': [ - '@typescript-eslint', - ], - 'env': { - 'browser': true, - 'es6': true, - 'node': true, - 'commonjs': true - }, - // 接入vue失败 暂且eslint 忽略vue文件 - 'extends': [ - // "standard", - 'plugin:vue/essential' - ], - 'parserOptions': { - // "parser": "babel-eslint", - 'parser': '@typescript-eslint/parser', - 'ecmaVersion': 2018, - 'ecmaFeatures': { - 'arrowFunctions': true, - 'classes': true, - 'modules': true, - 'defaultParams': true, - 'experimentalObjectRestSpread': true - }, - 'sourceType': 'module', - 'parserOptions': { - 'allowImportExportEverywhere': true - }, - project: 'tsconfig.json', - tsconfigRootDir: './', - extraFileExtensions: [ '.vue' ], - }, - 'globals': { - 'window': true, - 'define': true, - 'console': true, - 'require': true, - 'module': true, - __DEBUG__: true, - __DEV__: true, - __VERSION__: true, - }, - 'rules': { - // 'no-var': "error", - // 优先使用 interface 而不是 type - '@typescript-eslint/consistent-type-definitions': [ - 'error', - 'interface' - ], - '@typescript-eslint/no-unused-vars': 'error', // 使用 ts 未使用变量的规则 比如枚举类型在es中会报错 - 'no-extend-native': 0, - 'no-new': 0, - 'no-var': 2, - 'prefer-const': 2, - 'no-useless-escape': 0, - 'no-useless-constructor': 0, - 'no-trailing-spaces': [ 'error', {'skipBlankLines': true} ], - 'indent': [ 'error', 4, { - 'SwitchCase': 1 - } ], - 'space-infix-ops': [ 'error', {'int32Hint': false} ], - 'space-before-function-paren': [ 'error', { - 'anonymous': 'always', - 'named': 'always', - 'asyncArrow': 'always' - } ], - 'semi': [ 'error', 'always' ], - 'comma-dangle': 0, - 'no-console': 0, - 'no-debugger': 0, - 'id-length': 0, - 'eol-last': 0, - 'object-curly-spacing': [ 'error', 'never' ], - 'arrow-spacing': 'error', - 'no-multiple-empty-lines': 'error', - 'no-unused-vars': 'error', - 'spaced-comment': 'error', - 'quotes': [ 'error', 'single', {'allowTemplateLiterals': true} ], - 'no-unreachable': 'error', - 'keyword-spacing': 'error', - 'space-before-blocks': 'error', - 'semi-spacing': 'error', - 'comma-spacing': 'error', - 'key-spacing': 'error', - 'no-undef': 'error', - 'prefer-const': [ 'error', { - 'destructuring': 'any', - 'ignoreReadBeforeAssign': false - } ], - 'vue/script-indent': [ 'warn', 4, { - 'baseIndent': 1, - 'switchCase': 1 - } ], - 'vue/html-indent': [ 'error', 4 ], - 'vue/html-quotes': [ 'error', 'single', {'avoidEscape': true} ], - 'no-restricted-syntax': 'off', - }, - 'overrides': [ - { - 'files': [ '*.vue' ], - 'rules': { - 'indent': 'off' - } - } - ] -}; \ No newline at end of file +// /* +// * @Author: tackchen +// * @Date: 2022-09-04 08:02:56 +// * @Description: Coding something +// */ +// module.exports = { +// parser: '@typescript-eslint/parser', +// plugins: [ +// 'eslint-plugin-react', +// '@typescript-eslint', +// ], +// 'env': { +// 'node': true, +// }, +// rules: { +// 'no-var': 'error', +// 'no-extend-native': 0, +// 'no-new': 0, +// 'no-useless-escape': 0, +// 'no-useless-constructor': 0, +// 'no-trailing-spaces': [ 'error', { 'skipBlankLines': true } ], +// 'indent': [ 'error', 4, { +// 'SwitchCase': 1 +// } ], +// 'space-infix-ops': [ 'error', { 'int32Hint': false } ], +// 'space-before-function-paren': [ 'error', { +// 'anonymous': 'always', +// 'named': 'always', +// 'asyncArrow': 'always' +// } ], +// 'semi': [ 'error', 'always' ], +// 'comma-dangle': 0, +// 'no-console': 0, +// 'no-debugger': 0, +// 'id-length': 0, +// 'eol-last': 0, +// 'object-curly-spacing': [ 'error', 'always' ], +// 'array-bracket-spacing': [ 'error', 'always' ], +// 'arrow-spacing': 'error', +// 'no-multiple-empty-lines': 'error', +// // 'no-unused-vars': 'error', +// 'spaced-comment': 'error', +// 'quotes': [ 'error', 'single', { 'allowTemplateLiterals': true } ], +// 'no-unreachable': 'error', +// 'keyword-spacing': 'error', +// 'space-before-blocks': 'error', +// 'semi-spacing': 'error', +// 'comma-spacing': 'error', +// 'key-spacing': 'error', +// 'prefer-const': [ 'error', { +// 'destructuring': 'any', +// 'ignoreReadBeforeAssign': false +// } ], +// 'space-infix-ops': 2, +// 'no-irregular-whitespace': 2, // 不规则的空白不允许 +// 'no-trailing-spaces': 2, // 一行结束后面有空格就发出警告 +// '@typescript-eslint/ban-ts-comment': 'off', +// '@typescript-eslint/no-unused-vars': 'error', +// } +// }; diff --git a/packages/client-core/src/branch/branch-block.ts b/packages/client-core/src/branch/branch-block.ts new file mode 100644 index 0000000..efc6334 --- /dev/null +++ b/packages/client-core/src/branch/branch-block.ts @@ -0,0 +1,234 @@ + +/* + * @Author: chenzhongsheng + * @Date: 2023-09-04 22:12:56 + * @Description: Coding something + */ +import { Renderer } from '../element/renderer'; +import { IReturnCall } from '../type'; +import { getParent, insertBefore } from '../utils'; +import { BranchCache } from './cache'; + +const BranchTree = (() => { + let initialized = false; + let stack: BranchBlock[] = []; + + let currentBranch: BranchBlock|null = null; + + return { + next (branch: BranchBlock) { + branch.parent = currentBranch; + currentBranch?.children.push(branch); // debug use + stack.push(branch); + currentBranch = branch; + }, + back () { + stack.pop(); + if (stack.length === 0) { // 当所有branch弹出 initializing 完成 + initialized = true; + currentBranch = null; + } else { + currentBranch = stack[stack.length - 1]; + } + }, + + visit (branch: BranchBlock) { + if (!initialized || currentBranch === branch) return; + // ! 访问某个分支之后 将该分支作为stack起点 作为还未加载节点的父分支 + stack = [ branch ]; + currentBranch = branch; + }, + current () { + return currentBranch; + } + }; +})(); + +// let id = 0; +export class BranchBlock { + start = Renderer.createEmptyMountNode(); + end = Renderer.createEmptyMountNode(); + // id = id++; + cache: BranchCache; + + parent: BranchBlock|null = null; + + children: BranchBlock[] = []; // debug use + + branchCalls: IReturnCall[] = []; + + activeIndex: number = -1; + + refreshList: any[] = []; + + private initilized = false; + + constructor () { + this.cache = new BranchCache(); + // this.start.__branch = this; // todo 删除到这个地方的时候需要缓存一下 + BranchTree.next(this); + // if (!window.Root) window.Root = this; + } + + private wrapAnchor (el: any) { + const d = Renderer.createDocumentFragment(); + // @ts-ignore + d.appendChild(this.start); + if (el) d.appendChild(el); + // @ts-ignore + d.appendChild(this.end); + return d; + } + + add (call: IReturnCall) { + this.branchCalls.push(call); + } + + getCache (call: IReturnCall) { + BranchTree.visit(this); + return this.cache.get(call); + } + + private initAnchor (dom: any) { + + if (Renderer.isFragment(dom)) { + // @ts-ignore + dom.appendChild(this.end); + // @ts-ignore + dom.insertBefore(this.start, dom.childNodes[0]); + return dom; + } else { + return this.wrapAnchor(dom); + } + } + + replace (i: number) { + if (i === this.activeIndex) return; + const call = this.branchCalls[i]; + this.activeIndex = i; + const result = this.getCache(call); + + if (!this.initilized) { + this.initilized = true; + return this.initAnchor(result); + } else { + this.refresh(result); + return result; + } + } + + refresh (result: any) { + if (this.clear()) { + if (Renderer.isElement(result)) { + // @ts-ignore + this.end.parentElement?.insertBefore(result, this.end); + } + this.parent?.refreshCache(this); + this.triggerRefresh(); + } else { + // ! 对于不在dom树的元素 需要加入待刷新队列 后续刷新 + this.parent?.addRefreshCall(this.refresh.bind(this, result)); + } + } + + addRefreshCall (fn: any) { + if (!this.start.parentElement) { + this.parent?.addRefreshCall(fn); + } else { + this.refreshList.push(fn); + } + } + + triggerRefresh () { + if (this.refreshList.length) { + const arr = this.refreshList; + this.refreshList = []; // ! 需要先清空后调用 + arr.forEach(fn => {fn();}); + } else { + this.parent?.triggerRefresh(); + } + } + + quit () { + BranchTree.back(); + } + + returned (call: number|IReturnCall) { + if (typeof call === 'number') { + call = this.branchCalls[call]; + } + // ! 编译时注入的returned + return call.returned !== false; + } + + refreshCache (child: BranchBlock) { + this.cache.refreshCache(child.start, child.end); + this.parent?.refreshCache(this); + } + + private clear () { + const { start, end } = this; + if (!end.parentElement) return false; + while (start.nextSibling && start.nextSibling !== end) { + start.nextSibling.remove(); + } + return true; + } + + // ! 解决 for 与 if 组合使用时的问题 + + +} + +export function createDomCacheManager () { + const branch = BranchTree.current(); + + return { + insertBefore (node: any, child:any, defParent: any) { + // 如果没有父元素则 append到初始的frag上 + const parent = getParent(child, defParent); + if (!branch) { + parent.insertBefore(node, child); + return; + } + + const cache = branch.cache; + if (child.parentElement === parent) { + insertBefore(cache.curCache, node, child); + parent.insertBefore(node, child); + } else { + cache.addTask((parent) => { + // @ts-ignore + insertBefore(cache.curCache, node, child); + try { + parent.insertBefore(node, child); + } catch (e) { + debugger; + } + }); + } + }, + removeElement (node: any) { + if (!branch) { + Renderer.removeElement(node); + return; + } + const cache = branch.cache; + if (node.parentElement) { + Renderer.removeElement(node); + const index = cache.curCache.indexOf(node); + cache.curCache.splice(index, 1); + } else { + cache.addTask(() => { + Renderer.removeElement(node); + const index = cache.curCache.indexOf(node); + cache.curCache.splice(index, 1); + }); + } + }, + + addTask (fn: any) { + branch?.cache.addTask(fn); + }, + }; +} \ No newline at end of file diff --git a/packages/client-core/src/branch/cache.ts b/packages/client-core/src/branch/cache.ts new file mode 100644 index 0000000..346cbe9 --- /dev/null +++ b/packages/client-core/src/branch/cache.ts @@ -0,0 +1,104 @@ +/* + * @Author: chenzhongsheng + * @Date: 2023-09-04 22:14:25 + * @Description: Coding something + */ + +import { IElement, ITextNode, ITrueElement, Renderer } from '../element/renderer'; +import { IReturnCall } from '../type'; + +function transformElementToCache (element: any): (IElement|ITextNode)[]|null { + if (!element) return null; + if (Renderer.isFragment(element)) { + // @ts-ignore + return Array.from(element.childNodes); + } else if (Array.isArray(element)) { + return element; + } + // @ts-ignore + return [ element ]; +} + +function transformCacheToElement (cache: (IElement|ITextNode)[]|null): ITrueElement|null { + if (!cache) return null; + // if (cache.length === 1) return cache[0]; + const d = Renderer.createDocumentFragment(); + for (const item of cache) { + // @ts-ignore + d.appendChild(item); + } + return d; +} + +export class BranchCache { + cacheMap = new WeakMap(); + + // 当前的缓存数组 + curCache: any[] = []; + + tasks: any[] = []; + + get (call: IReturnCall) { + const el = this.cacheMap.get(call); + if (typeof el === 'undefined') { + let result = call(); + if (typeof result === 'string') { + result = Renderer.createTextNode(result); + } + this.curCache = transformElementToCache(result) || []; + this.cacheMap.set(call, this.curCache); + return result; + } else { + this.curCache = el || []; + const doc = transformCacheToElement(el); + if (this.tasks.length) { + this.tasks.forEach(task => {task(doc);}); + this.tasks = []; + } + return doc; + + } + } + + refreshCache (start: IElement, end: IElement) { + if (!this.curCache) throw new Error('CurCache is null'); + // this.cu + const parent = start.parentElement; + if (!parent) return; + const children = parent.childNodes; + const n = children.length; + + let started = false; + + const nodes: any[] = []; + + for (let i = 0; i < n; i++) { + const node = children[i]; + if (started) { + if (node === end) break; + nodes.push(node); + } + if (node === start) { + started = true; + } + } + + let index1 = -1, index2 = -1; + + const cn = this.curCache.length; + + for (let i = 0; i < cn; i++) { + const node = this.curCache[i]; + if (node === start) index1 = i; + else if (node === end) { + index2 = i; + break; + } + } + this.curCache.splice(index1 + 1, index2 - index1 - 1, ...nodes); + } + + addTask (task: (parent: any) => void) { + this.tasks.push(task); + } +} \ No newline at end of file diff --git a/packages/client-core/src/branch/if.ts b/packages/client-core/src/branch/if.ts new file mode 100644 index 0000000..06969b0 --- /dev/null +++ b/packages/client-core/src/branch/if.ts @@ -0,0 +1,116 @@ +/* + * @Author: chenzhongsheng + * @Date: 2023-07-02 21:55:39 + * @Description: Coding something + */ +import { IWatchRefTarget, watch } from 'alins-reactive'; +import { + IReturnCall +} from '../type'; +import { IGeneralElement, Renderer } from '../element/renderer'; +import { empty } from 'alins-utils'; +import { BranchBlock } from './branch-block'; + +export type IIfTarget = IWatchRefTarget; +export interface IIfReturn { + elif(data: IIfTarget, call: IReturnCall): IIfReturn; + else(call: IReturnCall): IIfReturn; + end(call?: IReturnCall): IGeneralElement|void; +} + +// const _ifCMMap = [] as any[]; +// window._mm = _ifCMMap; +// const _anchorMap = [] as any[]; +// window._am = _anchorMap; + +class IfBlock implements IIfReturn { + private branch: BranchBlock; + + private activeIndex = -1; + + constructor (ref: IIfTarget, call: IReturnCall) { + this.branch = new BranchBlock(); + this.acceptIf(ref, call, true); + } + + private switchNode (i: number) { + if (this.activeIndex === i) return true; + this.activeIndex = i; + this.branch.replace(i); + // console.warn('switch node', i); + // ! 编译时注入的returned + return this.branch.returned(i); + } + + private onDataChange (bs: boolean[]) { + // console.warn('if onDataChange', bs); + const n = bs.length; + for (let i = 0; i < n; i++) { + if (bs[i]) { + let returned = this.switchNode(i); + // ! 没有返回值并且不是最后一个 执行end逻辑 + if (!returned && i !== n - 1) { + returned = this.switchNode(n - 1); + } + return returned; + } + } + } + + private index = 0; + // private returnEle: ITrueElement|(typeof empty) = empty; + private returnEle: any = empty; + private matched = false; + private refs: IIfTarget[] = []; + + private acceptIf (ref: IIfTarget, call: IReturnCall, isEnd = false) { + const currentIndex = this.index; + const id = this.index ++; + this.refs[id] = ref; + this.branch.add(call); + + if (this.returnEle !== empty) return; + + if (!this.matched || isEnd) { + const value = typeof ref === 'function' ? ref() : ref.v; + if (value) { + this.matched = true; + if (!isEnd) this.activeIndex = currentIndex; + const dom = this.branch.replace(id); + if (this.returnEle === empty && this.branch.returned(call)) { + this.returnEle = dom; + } + } + } + } + + elif (ref: IIfTarget, call: IReturnCall) { + this.acceptIf(ref, call); + return this; + } + else (call: IReturnCall) { + // else 永远为true + this.acceptIf(() => true, call); + return this; + } + // ! if判断会引起finally执行与否 + end (call = () => {}) { + this.acceptIf(() => true, call, false); + // console.warn('if end', refs); + watch(() => ( + this.refs.map(item => typeof item === 'function' ? item() : item.v) + ), this.onDataChange.bind(this), false); + this.branch.quit(); + if (this.returnEle !== empty) { + // ! 首次不需要branch + return this.returnEle; + } + // 创建一个空节点用来作为锚点 + return Renderer.createDocumentFragment(); + } +} + + +export function _if (ref: IIfTarget, call: IReturnCall): IfBlock { + return new IfBlock(ref, call); +} diff --git a/packages/client-core/src/branch/switch.ts b/packages/client-core/src/branch/switch.ts new file mode 100644 index 0000000..5499632 --- /dev/null +++ b/packages/client-core/src/branch/switch.ts @@ -0,0 +1,96 @@ +/* + * @Author: chenzhongsheng + * @Date: 2023-07-03 09:09:46 + * @Description: Coding something + */ + +import { IWatchRefTarget, watch } from 'alins-reactive'; +import { ISimpleValue } from 'alins-utils'; +import { IGeneralElement, Renderer } from '../element/renderer'; +import { IReturnCall } from '../type'; +import { BranchBlock } from './branch-block'; + +// export const _break = Symbol('b'); +// export const _default = Symbol('d'); + +export type ISwitchTarget = IWatchRefTarget; + +export type ISwitchCase = [any, (()=>any)|null, boolean]; +// value, call, break, + +export type ISwitchCaseList = ISwitchCase[]; + + +// ! 编译时 return; return null; => return <> + +class SwitchBlock { + private branch: BranchBlock; + + private endCall: IReturnCall; + + private target: ISwitchTarget; + private caseList: ISwitchCaseList; + + constructor (target: ISwitchTarget, caseList: ISwitchCaseList) { + this.branch = new BranchBlock(); + this.target = target; + this.caseList = caseList; + } + + private run (value: any) { + // console.log('switch debug:run', value); + let matched: boolean = false; + let el: any = null; + const n = this.caseList.length; + for (let i = 0; i < n; i++) { + const item = this.caseList[i]; + const caseValue = item[0]; + // 没有value表示为default + if ( + (Array.isArray(caseValue) && caseValue.includes(value)) || + caseValue === value || + caseValue === null + ) { // 命中或走default + // console.log('matched'); + matched = true; + el = this.branch.replace(i); + break; + } + } + if (!matched) { + el = this.branch.replace(n); + } + return el; + } + + end (call: IReturnCall = () => void 0): IGeneralElement|void { + this.endCall = call; + + // ! 首次run初始化分支 + const initSwitchBranches = () => { + for (const item of this.caseList) { + const call = item[1]; + if (call) { + this.branch.add(call); + } + } + this.branch.add(this.endCall); + this.branch.quit(); + }; + + // console.warn('switch end'); + const init = watch(this.target, (value) => { + // console.warn('switch debug: change', value); + this.run(value); + }); + initSwitchBranches(); + const el = this.run(init.v); + if (Renderer.isElement(el)) return el; + // @ts-ignore + return Renderer.createDocumentFragment(); + } +} + +export function _switch (target: ISwitchTarget, caseList: ISwitchCaseList) { + return new SwitchBlock(target, caseList); +} diff --git a/packages/client-core/src/context.ts b/packages/client-core/src/context.ts index e7624f0..cd813f9 100644 --- a/packages/client-core/src/context.ts +++ b/packages/client-core/src/context.ts @@ -4,67 +4,44 @@ * @Description: Coding something */ -import {IIfTarget, _if} from './if'; -import {assignCompData, assignData, computed, isProxy, mockRef, reactive, watch} from 'alins-reactive'; -import {ISwitchCaseList, ISwitchTarget, _switch} from './switch'; +import { _if } from './branch/if'; +import { assignCompData, assignData, computed, isProxy, mockRef, reactive, watch } from 'alins-reactive'; +import { _switch } from './branch/switch'; import './for'; -import {ICtxUtil, IReturnCall} from './type'; -// import {createAnchor, createBranchLink, createCallCache} from './ctx-util'; -import {createAnchor} from './scope/anchor'; -import {createCallCache} from './scope/cache'; -import {createBranchLink} from './scope/branch'; -import {JSX} from './element/element'; -import {mockMap} from './for'; +import { JSX } from './element/element'; +import { mockMap } from './for'; -export function createContext () { - const cache = createCallCache(); - const anchor = createAnchor(cache); +export const _$ce = JSX.createElement; - const branch = createBranchLink(cache, anchor); - - const ctxUtil: ICtxUtil = { - anchor, - cache, - branch, - }; +// ! 处理 async 代码没有返回值 +// markNotReturned +export function _$mnr (fn: any) { + fn.returned = false; + return fn; +} - const ctx = { - util: ctxUtil, - if: (cond: IIfTarget, call: IReturnCall) => { - return _if(cond, call, ctxUtil); - }, - switch: (cond: ISwitchTarget, list: ISwitchCaseList) => _switch(cond, list, ctxUtil), - }; - return ctx; +export function _$r (v: any, shallow?: boolean) { + if (typeof shallow !== 'boolean') { + shallow = typeof v.v === 'object' && isProxy(v.v); + } + return reactive({ v }, shallow); } +export const _$c = computed; +export const _$w = watch; -export const ContextTool = { - ce: JSX.createElement, - // ! 处理 async 代码没有返回值 - // markNotReturned - mnr (fn: any) { - fn.returned = false; - return fn; - }, - r (data: any) { - return reactive(data, isProxy(data.v)); - }, - c: computed, - w: watch, - cc (get: any, set: any) { // 简写,减少编译代码量 - return computed({get, set}); - }, - e: assignData, - es: assignCompData, - // markUpdateExpression: true - mu (fn:any) { - fn._update = true; - return fn; - }, - mf: mockRef, - mm: mockMap, -}; +export function _$cc (get: any, set: any) { // 简写,减少编译代码量 + return computed({ get, set }); +} -Object.assign(createContext, ContextTool); +export const _$e = assignData; +export const _$es = assignCompData; -export type IComponentContext = ReturnType; \ No newline at end of file +// markUpdateExpression: true +export function _$mu (fn:any) { + fn._update = true; + return fn; +} +export const _$mf = mockRef; +export const _$mm = mockMap; +export const _$if = _if; +export const _$sw = _switch; \ No newline at end of file diff --git a/packages/client-core/src/element/attributes.ts b/packages/client-core/src/element/attributes.ts index e02a30e..6b79a0b 100644 --- a/packages/client-core/src/element/attributes.ts +++ b/packages/client-core/src/element/attributes.ts @@ -3,10 +3,10 @@ * @Date: 2023-07-21 22:37:05 * @Description: Coding something */ -import {isProxy} from 'alins-reactive'; -import {reactiveBindingEnable} from './dom-util'; -import {IBaseAttributes} from './jsx'; - +import { isProxy } from 'alins-reactive'; +import { reactiveBindingEnable } from './dom-util'; +import { IBaseAttributes } from './jsx'; + export function parseAttributes ( dom: HTMLElement, value: IBaseAttributes | string | (()=>string) diff --git a/packages/client-core/src/element/element.ts b/packages/client-core/src/element/element.ts index 30410ef..16af7c9 100644 --- a/packages/client-core/src/element/element.ts +++ b/packages/client-core/src/element/element.ts @@ -3,21 +3,21 @@ * @Date: 2023-06-25 22:31:56 * @Description: Coding something */ -import {addEvent, isEventAttr, IEventNames} from './event'; -import {IElement, IFragment, ITrueElement, Renderer} from './renderer'; +import { addEvent, isEventAttr, IEventNames } from './event'; +import { IElement, IFragment, ITrueElement, Renderer } from './renderer'; import { IBindingReactionEnable, reactiveBindingEnable, IChildren, reactiveBindingValue, } from './dom-util'; -import {AlinsType, IJson, type} from 'alins-utils'; -import {IBindingReaction, IBindingRef, isProxy} from 'alins-reactive'; -import {IAttributes} from './jsx'; -import {parseStyle, parseStyleSuffix} from './style'; -import {parseModel} from './model'; -import {getParent} from '../utils'; -import {parseAttributes} from './attributes'; -import {parseClassName, parseClassSuffix} from './class'; -import {initMountedObserver, initRemovedObserver} from './lifecycle'; +import { AlinsType, IJson, type } from 'alins-utils'; +import { IBindingReaction, IBindingRef, isProxy } from 'alins-reactive'; +import { IAttributes } from './jsx'; +import { parseStyle, parseStyleSuffix } from './style'; +import { parseModel } from './model'; +import { getParent } from '../utils'; +import { parseAttributes } from './attributes'; +import { parseClassName, parseClassSuffix } from './class'; +import { initMountedObserver, initRemovedObserver } from './lifecycle'; export type IAttributeNames = keyof IAttributes; @@ -88,6 +88,8 @@ export function transformOptionsToElement (opt: IJSXDomOptions): ITrueElement { // @ts-ignore const $appended = opt.attributes.$appended; + let $mount: any = opt.attributes.$mount; + opt.attributes.$created?.(el); for (const k in opt.attributes) { @@ -96,19 +98,12 @@ export function transformOptionsToElement (opt: IJSXDomOptions): ITrueElement { addEvent(el as IElement, k, v); continue; } - switch (k) { case '$created': break; case '$appended': (el as IElement).__$appended = $appended; break; case '$removed': (el as IElement).__$removed = v; break; case '$mounted': (el as IElement).__$mounted = v; break; - case '$mount': { - let dom = v; - if (typeof dom === 'string') dom = document.querySelector(dom); - if (!dom) throw new Error('$mount is not a Element'); - dom.appendChild(el); - if ($appended) $appended(el); // todo 此处有可能还没有append到document中 - }; break; + case '$mount': break; case '$html': reactiveBindingEnable(v, (v) => { // @ts-ignore el.innerHTML = v || ''; @@ -129,6 +124,7 @@ export function transformOptionsToElement (opt: IJSXDomOptions): ITrueElement { ) { break; } else { + // console.warn('reactiveBindingEnable', k, v); reactiveBindingEnable(v, (v) => { if (typeof v === 'object') { v = (!!v.enable) ? v.value : null; @@ -140,11 +136,33 @@ export function transformOptionsToElement (opt: IJSXDomOptions): ITrueElement { }; break; }; } + if ($mount) { + + if (typeof $mount === 'string') $mount = document.querySelector($mount); + if (!$mount) throw new Error('$mount is not a Element'); + // dom.appendChild(el); + appendChild($mount, el); + if ($appended) $appended(el); // todo 此处有可能还没有append到document中 + + } + } } return el; } +function appendChild (parent: any, item: any) { + // @ts-ignore + if (item.__$mounted) { + initMountedObserver(parent); + } + // @ts-ignore + if (item.__$removed) initRemovedObserver(item); + parent.appendChild(item as any); + // @ts-ignore + item.__$appended?.(item); +} + export function appendChildren (parent: IElement|IFragment, children: (IChildren|IJSXDomOptions)[]) { for (const item of children) { @@ -156,13 +174,7 @@ export function appendChildren (parent: IElement|IFragment, children: (IChildren } if (Renderer.isElement(item)) { - // @ts-ignore - if (item.__$mounted) initMountedObserver(parent); - // @ts-ignore - if (item.__$removed) initRemovedObserver(item); - parent.appendChild(item as any); - // @ts-ignore - item.__$appended?.(item); + appendChild(parent, item); continue; } @@ -171,7 +183,7 @@ export function appendChildren (parent: IElement|IFragment, children: (IChildren // @ts-ignore 是 domOptions options = item; } else { - options = {text: item, isText: true}; + options = { text: item, isText: true }; } const dom = transformOptionsToElement(options); @@ -202,7 +214,7 @@ export const JSX = { for (const k in attributes) { const v = attributes[k]; if (!isProxy(v)) { - attributes[k] = {v, [type]: AlinsType.Ref}; // ! 模拟ref + attributes[k] = { v, [type]: AlinsType.Ref }; // ! 模拟ref } // if(typeof v === 'function') } @@ -211,13 +223,15 @@ export const JSX = { // if (dom.toString() === '[object Promise]') { const result = transformAsyncDom(dom) as any; if ($mount) { + // todo bugfix if (typeof $mount === 'string') $mount = document.querySelector($mount); - $mount.appendChild(result); + appendChild($mount, result); + // $mount.appendChild(result); } return result; } // @ts-ignore - const result: IJSXDomOptions = {tag, attributes, children, jsx: true}; + const result: IJSXDomOptions = { tag, attributes, children, jsx: true }; // console.log('createElement', result); return transformOptionsToElement(result); } diff --git a/packages/client-core/src/element/renderer.ts b/packages/client-core/src/element/renderer.ts index e97a43d..ee7bf6c 100644 --- a/packages/client-core/src/element/renderer.ts +++ b/packages/client-core/src/element/renderer.ts @@ -4,7 +4,7 @@ * @Description: Coding something */ -import {AlinsType, type} from 'alins-utils'; +import { AlinsType, type } from 'alins-utils'; export type IFragment = DocumentFragment; @@ -30,6 +30,7 @@ export interface IElement { insertBefore(node: T, child: IElement | null): T; remove(): void; children: (IElement|ITextNode)[]; + childNodes: (IElement|ITextNode)[]; get parentElement(): IElement; get parentNode(): IElement; get nextSibling(): IElement; diff --git a/packages/client-core/src/for.ts b/packages/client-core/src/for.ts index 0693218..d556354 100644 --- a/packages/client-core/src/for.ts +++ b/packages/client-core/src/for.ts @@ -7,12 +7,12 @@ import { createProxy, isProxy, watchArray, IOprationAction, OprateType, registArrayMap, - createCleaner, ICleaner, mockRef + createCleaner, ICleaner, mockRef, useCurCleaner } from 'alins-reactive'; -import {IProxyData, util} from 'alins-utils'; -import {IFragment, IGeneralElement, ITrueElement, Renderer} from './element/renderer'; -import {createDomCacheManager} from './scope/cache'; -import {getParent} from './utils'; +import { IProxyData, util } from 'alins-utils'; +import { createDomCacheManager } from './branch/branch-block'; +import { IFragment, IGeneralElement, ITrueElement, Renderer } from './element/renderer'; +import { getParent } from './utils'; /* @@ -48,8 +48,9 @@ export function map ( const ScopeEnd = Renderer.createEmptyMountNode(); const EndMap: ITrueElement[] = []; const Cleaners: ICleaner[] = []; + // window._Cleaners = Cleaners; - const cacheManager = createDomCacheManager(); + const cacheManager = createDomCacheManager(); // todo let head: ITrueElement; @@ -65,11 +66,11 @@ export function map ( // window.EndMap = EndMap; const createScope = (item: any, i: number): IProxyData => { - item = createProxy({v: item}, {shallow: true}); - const scope = {[k]: item}; + item = createProxy({ v: item }, { shallow: true }); + const scope = { [k]: item }; if (ik) { // 表示有第二个参数 - scope[ik] = createProxy({v: i}, {shallow: true}); + scope[ik] = createProxy({ v: i }, { shallow: true }); } return scope; }; @@ -84,9 +85,11 @@ export function map ( // console.log('cc', item, i); const scope = createScope(item, i); - cleaners.push(createCleaner()); + const cleaner = createCleaner(); - let child = call(scope[k], scope[ik] || i); + cleaners.push(cleaner); + + let child = useCurCleaner(cleaner, () => call(scope[k], scope[ik] || i)); // @ts-ignore let end: ITrueElement = child; @@ -114,10 +117,10 @@ export function map ( } // if(i===0)debugger; // console.log(head, i); - + scopes.push(scope); ends.push(end); - + return child; }; for (let i = 0; i < n; i++) { @@ -126,7 +129,7 @@ export function map ( container.appendChild(child as any); } container.appendChild(ScopeEnd as any); - watchArray(list, ({index, count, data, type}: IOprationAction) => { + watchArray(list, ({ index, count, data, type }: IOprationAction) => { switch (type) { case OprateType.Push: { // console.warn('OprateType.Push', index, count, data, type); @@ -137,8 +140,8 @@ export function map ( // @ts-ignore doc.appendChild(child); } - // 如果没有父元素则 append到初始的frag上 // todo check 这里的逻辑 cacheManager.insertBefore(doc, ScopeEnd, container); + // getParent(ScopeEnd, container).insertBefore(doc, ScopeEnd); };break; case OprateType.Replace: { // console.warn('OprateType.Replace', index, count, data, type); @@ -167,11 +170,12 @@ export function map ( const endPos = startPos + count; // @ts-ignore const endDom = EndMap[endPos]?.nextSibling || ScopeEnd; - + const startDom = ((startPos < 0) ? (head || ScopeEnd) : EndMap[startPos]) as Node; while (startDom.nextSibling && startDom !== endDom && startDom.nextSibling !== endDom) { const dom = startDom.nextSibling; cacheManager.removeElement(dom); + // Renderer.removeElement(dom); } if (startPos < 0) { // @ts-ignore @@ -180,6 +184,7 @@ export function map ( head = startDom.nextSibling; // @ts-ignore cacheManager.removeElement(startDom); + // Renderer.removeElement(startDom); } else { head = ScopeEnd; } @@ -187,10 +192,11 @@ export function map ( EndMap.splice(index, count); ScopeItems.splice(index, count); Cleaners.splice(index, count).forEach(cleaner => { + // console.log('clean lns'); cleaner.clean(); }); }; - + // items.forEach(item => item[util].release()); // console.warn('【watch array remove】', index, count, data); @@ -198,6 +204,7 @@ export function map ( removeFunc(); } else { cacheManager.addTask(removeFunc); + // removeFunc(); } };break; @@ -226,6 +233,7 @@ export function map ( insertFunc(); } else { cacheManager.addTask(insertFunc); + // insertFunc(); } // console.warn('【watch array insert】', index, count, data); };break; @@ -246,4 +254,4 @@ export function mockMap ( ik?: string, ) { return map.call(list, call, jsx, k, ik); -} \ No newline at end of file +} diff --git a/packages/client-core/src/if.ts b/packages/client-core/src/if.ts deleted file mode 100644 index 9463268..0000000 --- a/packages/client-core/src/if.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* - * @Author: chenzhongsheng - * @Date: 2023-07-02 21:55:39 - * @Description: Coding something - */ -import {IWatchRefTarget, watch, getCurCleaner, useCurCleaner} from 'alins-reactive'; -import { - IReturnCall, ICtxUtil -} from './type'; -import {IGeneralElement, ITrueElement, Renderer} from './element/renderer'; -import {empty} from 'alins-utils'; -import {IBranchTarget} from './scope/branch'; -import {createAnchor} from './scope/anchor'; - -export type IIfTarget = IWatchRefTarget; -export interface IIfReturn { - elif(data: IIfTarget, call: IReturnCall): IIfReturn; - else(call: IReturnCall): IIfReturn; - end(call?: IReturnCall): IGeneralElement|void; -} - -export function _if (ref: IIfTarget, call: IReturnCall, util: ICtxUtil): IIfReturn { - // console.log('branch debug:enter if', call.toString()); - const cleaner = getCurCleaner(); - const anchor = createAnchor(util.cache); - // ! 最后一个branch是end - const branchs: IBranchTarget[] = []; - let activeIndex = -1; - // console.log(branchs); - - // 返回当前接节点是否有返回值 - const switchNode = (i: number) => { - if (activeIndex === i) return true; - activeIndex = i; - const branch = branchs[i]; - useCurCleaner(cleaner, () => { - anchor.replaceBranch(branch); - }); - // setCurCleaner(cleaner); - // console.warn('switch node', i); - // ! 编译时注入的returned - return branch.call.returned !== false; - }; - const onDataChange = (bs: boolean[]) => { - // console.warn('if onDataChange', bs); - const n = bs.length; - for (let i = 0; i < n; i++) { - if (bs[i]) { - let returned = switchNode(i); - // ! 没有返回值并且不是最后一个 执行end逻辑 - if (!returned && i !== n - 1) { - returned = switchNode(n - 1); - } - return returned; - } - } - }; - let index = 0; - let returnEle: ITrueElement|(typeof empty) = empty; - let matched = false; - const refs: IIfTarget[] = []; - const acceptIf = (ref: IIfTarget, call: IReturnCall, init = false, isEnd = false) => { - const currentIndex = index; - const id = index ++; - // console.warn('accept if', id); - branchs[id] = util.branch.next(call, anchor, init); - refs[id] = ref; - - if (returnEle !== empty) return; - - if (!matched || isEnd) { - const value = typeof ref === 'function' ? ref() : ref.v; - if (value) { - matched = true; - branchs[id].inited = true; // todo 待定 - if (!isEnd) activeIndex = currentIndex; - const dom = util.cache.call(branchs[id], anchor); - if (returnEle === empty && call.returned !== false) { // ! 编译时注入的returned - returnEle = dom; - } - } - } - }; - acceptIf(ref, call, true); - const result: IIfReturn = { - elif (ref, call) { - acceptIf(ref, call); - return result; - }, - else (call) { - // else 永远为true - acceptIf(() => true, call); - return result; - }, - // ! if判断会引起finally执行与否 - end (call = () => {}) { - acceptIf(() => true, call, false, true); - // console.warn('if end', refs); - watch(() => ( - refs.map(item => typeof item === 'function' ? item() : item.v) - ), onDataChange, false); - util.branch.back(); - if (returnEle !== empty) { - // ! 首次不需要branch - return anchor.replaceContent(returnEle); - } - // 创建一个空节点用来作为锚点 - return Renderer.createDocumentFragment(); - } - }; - return result; -} - -// function aa () { -// const data = await aa(); - -// a.a = data; - -// return xxx; - -// return c.async(async () => { -// const data = await aa(); -// a.a = data; -// return xxx; -// }); -// } - -// function aa () { -// if (a === 1) { -// const data = await aa(); -// a.a = data; -// } - -// return xxx; - -// return c.if(a===1, ()=>{ -// const el = c.async(async () => { -// const data = await aa(); -// a.a = data; -// return xxx; -// }); -// if(el) return el; -// }).else(()={ -// return xxx; -// }) -// } \ No newline at end of file diff --git a/packages/client-core/src/index.ts b/packages/client-core/src/index.ts index c370f9d..5ae5236 100644 --- a/packages/client-core/src/index.ts +++ b/packages/client-core/src/index.ts @@ -4,22 +4,18 @@ * @Description: Coding something */ -import {createContext} from './context'; +export * from './context'; -export const _$$ = createContext; +export type { IAttributes } from './element/jsx.d'; -export {ContextTool, createContext} from './context'; - -export type {IAttributes} from './element/jsx.d'; - -export {_if} from './if'; -export {_switch} from './switch'; -export {map} from './for'; +export { _if } from './branch/if'; +export { _switch } from './branch/switch'; +export { map } from './for'; export * from './element/renderer'; export * from 'alins-reactive'; -export const version = __VERSION__; +export const version = '__VERSION__'; -export {reactiveBindingEnable} from './element/dom-util'; +export { reactiveBindingEnable } from './element/dom-util'; diff --git a/packages/client-core/src/scope/anchor.ts b/packages/client-core/src/scope/anchor.ts deleted file mode 100644 index 1229b49..0000000 --- a/packages/client-core/src/scope/anchor.ts +++ /dev/null @@ -1,163 +0,0 @@ -/* - * @Author: chenzhongsheng - * @Date: 2023-07-06 21:13:18 - * @Description: Coding something - */ - -import {IFragment, IGeneralElement, ITrueElement, Renderer, getFirstElement} from '../element/renderer'; -import {IElement} from '../element/renderer'; -import {getParent} from '../utils'; -import {IBranchTarget} from './branch'; -import {ICallCache} from './cache'; -/* -dom 元素挂载的锚点 -firstElement => anchor 之前为组件的所有dom -*/ - -// let id = 0; -export function createAnchor (cache: ICallCache) { - let end: IElement|null = null; - let start: IElement|null = null; - - let frag: IFragment; - - const initFirstMount = (element?: IGeneralElement): IFragment => { - // @ts-ignore - end = Renderer.createEmptyMountNode(); - start = getFirstElement(element) || end; - // console.warn('initFirstMount', start); - - if (Renderer.isFragment(element)) { - // @ts-ignore - element.appendChild(end); - return element as IFragment; - } - const d = Renderer.createDocumentFragment(); - // @ts-ignore - if (element) d.appendChild(element); - // @ts-ignore - d.appendChild(end); - return d; - }; - - // setInterval(() => { - // console.log(start); - // }, 3000); - - const clearDom = () => { - const cursor = start; - if (cursor !== end) { - // @ts-ignore - while (cursor.nextSibling && cursor.nextSibling !== end) { - try { - // @ts-ignore - cursor.nextSibling.remove(); - } catch (e) { - console.error(e); - break; - } - } - // @ts-ignore - cursor.remove(); - } - start = end; - }; - - return { - getNodes () { - const arr: any[] = []; - let node = start; - while (node && node !== end) { - arr.push(node); - node = node.nextSibling; - } - return arr; - }, - start () {return start;}, - setStart (element: ITrueElement|null|undefined) { - if (element) { - start = getFirstElement(element) || end; - } - }, - // ! async 时dom被替换了 此时需要检测一下如果是start 则需要替换start - replaceStart (old: any, newDom: any) { - const oldStart = getFirstElement(old); - if (oldStart === start) { - start = getFirstElement(newDom); - } - }, - replaceBranch (branch: IBranchTarget) { - const current = branch.current(); // ! 缓存一下当前branch, call之后会被覆盖 - if (current === branch) return true; - // const activeBranch = branch.getBottomChild(); - const dom = cache.call(branch); - // console.log('branch debug:dom', dom); - if (!branch.inited) { - branch.inited = true; - this.replaceContent(dom, branch); - } else { - if (dom) { - if (branch.isVisible(current)) { - this.replaceContent(dom, branch); - } - } else { - // 目前branch为空则清除dom - // console.log('branch debug:clearDom'); - clearDom(); - branch.updateActiveCache(); - } - } - return dom; - // console.log(dom, branch, current); - // if (branch.parent === current?.parent) { - // debugger; - // branch.parent?.anchor.setStart(dom); - // } - }, - // 往当前组件替换dom元素 - replaceContent (element?: IGeneralElement, branch?: IBranchTarget) { - if (!end || !start) { - frag = initFirstMount(element); - return frag; - } - // console.log(element.textContent, element.outerHTML, end.parentElement); - const container = getParent(end, frag); - - if (container === element) return element; - // if (!start.parentElement) { - // start = end; // ! start 不在页面上了 则 指向end - // } else { - clearDom(); - // } - if (!element) { - branch?.updateActiveCache(); - return element; - } - // @ts-ignore - const newEle = getFirstElement(element); - const newStart = newEle || end; - let parent = branch?.parent; - while (parent && parent.anchor.start() === start) { - parent.anchor.setStart(newStart); - // @ts-ignore - if (parent.call) cache.modifyCache(parent, newEle); - parent = parent.parent; - } - start = newStart; - // console.log('branch debug:container insert', container, start, end); - try { - container.insertBefore(element, end); - branch?.updateActiveCache(); - } catch (e) { - console.error(e, container, element, end); - } - // console.log('xxxxxxx', this.start(), start, start?.parentElement); - return element; - }, - clearCache () { - - } - }; -} - -export type ICtxAnchor = ReturnType; \ No newline at end of file diff --git a/packages/client-core/src/scope/branch.ts b/packages/client-core/src/scope/branch.ts deleted file mode 100644 index b2cd6b2..0000000 --- a/packages/client-core/src/scope/branch.ts +++ /dev/null @@ -1,157 +0,0 @@ -/* - * @Author: chenzhongsheng - * @Date: 2023-07-07 10:35:16 - * @Description: Coding something - */ -import {IReturnCall} from '../type'; -import {ICtxAnchor} from './anchor'; -import {ICallCache} from './cache'; - -export interface IBranchTarget { - id: number; - call: IReturnCall; - parent: IBranchTarget|null; // null 表示root - visit(): void; - current(): IBranchTarget|null; - isVisible(branch?: IBranchTarget|null): boolean; - clearCache(): void; - anchor: ICtxAnchor; - inited?: boolean; - activeChild: IBranchTarget|null; - getBottomChild(): IBranchTarget; - updateCache(): void; - updateActiveCache(): void; -} - -export function createBranchLink (cache: ICallCache, anchor: ICtxAnchor) { - // console.log('createBranchLink'); - let stack: IBranchTarget[] = []; - let id = 0; - const Root = {anchor, parent: null}; - - let currentBranch: IBranchTarget|null = null; - - // @ts-ignore - // window.getCurBranch = () => currentBranch; - - // const branchPool: WeakMap = new WeakMap(); - - // ! 表示active branch到Root branch的路径, 用作判断某branch是否可见 - let branchMap: WeakMap|null = null; - - // branchLink 是否初始化完毕 - let initialized = false; - - const createTarget = (call: IReturnCall, anchor: ICtxAnchor, forward = false): IBranchTarget => { - // const item = branchPool.get(call);stack - // if (item) return item; - const last = stack.length === 0 ? Root : stack[stack.length - 1]; - const parent = (forward ? last : last?.parent) as IBranchTarget|null; - const branch: IBranchTarget = { - id: id++, - call, - parent, - activeChild: null, - anchor, - current () { - return currentBranch; - }, - isVisible (branch?: IBranchTarget|null) { - // console.warn('isVisible', this); - // 做一件事情:如果需要更新dom,则直接更新,否则清除祖先缓存 - if (!branchMap) { - branchMap = new WeakMap(); - let node: IBranchTarget|null = branch || currentBranch; // todo fix 这里的上一个分支逻辑有问题 - const path:any = []; - while (node) { - path.push(node.id); - branchMap.set(node, 1); - node = node.parent; - } - // console.log('branch debug:branchpath', path.toString()); - } - /* - branchMap 为一条当前可见路径到顶层的路径 - 然后通过判断 this branch 的父节点是否位于这条路径上来判断 this branch是否可见 - */ - const isCurrentVisible = !!branchMap.get(this); - if (isCurrentVisible) { - // console.warn('isVisible result true'); - return true; - } - let parent = this.parent; - // ! parent 表示当前为组件根branch,为可见(可操作) - if (!parent || !!branchMap.get(parent)) return true; - while (parent) { - const isVisible = !!branchMap.get(parent); - if (isVisible) { - // console.warn('isVisible result false1'); - break; - } - parent = parent.parent; - } - // console.warn('isVisible result false2'); - return false; - }, - visit () { - // ! 访问某个分支之后 将该分支作为stack起点 作为还未加载节点的父分支 - // console.warn('visit branch', this); - if (currentBranch === this) return; - if (initialized) { - stack = [this]; - } - currentBranch = this; - if (this.parent) this.parent.activeChild = this; - branchMap = null; - }, - // updateCache (from?: IBranchTarget) { - updateCache () { - const nodes = anchor.getNodes(); - // console.log('branch debug: updateCache', this.id, nodes); - cache.setCache(this.call, nodes); - this.parent?.updateCache?.(); - // if (this !== from) { - // this.parent?.updateCache?.(); - // } - }, - updateActiveCache () { - // ! 找到当前分支的最底部之前的活跃分支,一直往上进行cache更新 - this.getBottomChild().parent?.updateCache?.(); - // this.getBottomChild().parent?.updateCache?.(this); - }, - clearCache () { - // console.warn('branch debug:clearCache', this.id, this.call); - // cache.clearCache(this.call); - // this.parent?.clearCache?.(); - }, - getBottomChild () { - let node = this; - while (node.activeChild) node = node.activeChild; - return node; - } - }; - // branchPool.set(call, branch); - return branch; - }; - - - return { - // forward 表示是否要向下一层 - next (call: IReturnCall, anchor: ICtxAnchor, forward = false) { - const target = createTarget(call, anchor, forward); - forward ? stack.push(target) : (stack[stack.length - 1] = target); - // console.warn(`branch debug:next:${target.id}:${forward}`, target.call.toString()); - return target; - }, - back () { - // console.warn(`branch:back`); - - const value = stack.pop(); - if (stack.length === 0) { // 当所有branch弹出 initializing 完成 - initialized = true; - } - return value; - }, - }; -} -export type IBranchLink = ReturnType \ No newline at end of file diff --git a/packages/client-core/src/scope/cache.ts b/packages/client-core/src/scope/cache.ts deleted file mode 100644 index 698d6d5..0000000 --- a/packages/client-core/src/scope/cache.ts +++ /dev/null @@ -1,211 +0,0 @@ -/* - * @Author: chenzhongsheng - * @Date: 2023-07-04 09:42:17 - * @Description: Coding something - */ - -import {transformAsyncDom} from '../element/element'; -import {ITrueElement, IElement, ITextNode, Renderer, getFirstElement} from '../element/renderer'; -import type {IAsyncReturnCall, IReturnCall} from '../type'; -import {getParent, insertBefore} from '../utils'; -import type {IBranchTarget} from './branch'; - -// const DEFAULT_CACHE_KEY = createEmptyJson(); - -function transformElementToCache (element: ITrueElement|null|(IElement|ITextNode)[]): (IElement|ITextNode)[]|null { - if (!element) return null; - if (Renderer.isFragment(element)) { - // @ts-ignore - return Array.from(element.childNodes); - } else if (Array.isArray(element)) { - return element; - } - // @ts-ignore - return [element]; -} - -function transformCacheToElement (cache: (IElement|ITextNode)[]|null): ITrueElement|null { - if (!cache) return null; - if (cache.length === 1) return cache[0]; - const d = Renderer.createDocumentFragment(); - for (const item of cache) { - // @ts-ignore - d.appendChild(item); - } - return d; -} - - -export function createCallCache () { - // ! call => dom 的cache - const cacheMap = new WeakMap(); - // window.cacheMap = cacheMap; - - let taskList: ((el: any, fn: any)=>void)[] = []; - - const managerMap = new WeakMap; - - // 当前执行到的函数 - let curCall: IReturnCall|IAsyncReturnCall|null = null; - - const execCacheCall = (fn: any, cache: ICallCache) => { - curCache = cache; - curCall = fn; - const origin = fn(); - curCache = null; - curCall = null; - return origin; - }; - - return { - cacheMap, - addCacheTask (fn: any) { - taskList.push(fn); - }, - initManager (manager: ICacheManager) { - if (!curCall) return; - managerMap.set(curCall, manager); - }, - // ! 调用某个函数,缓存其结果 - // @ts-ignore - call (branch: IBranchTarget, anchor?: any) { - branch.visit(); - const fn = branch.call; - const item = cacheMap.get(fn); - // ! 需要更新自己与父branch的cache - // console.log('branch debug:item', branch.id, item); - if (typeof item !== 'undefined') { - const cacheElement = transformCacheToElement(item); - - if (taskList.length > 0) { - debugger; - taskList.forEach(task => { - task(cacheElement, fn); - }); - taskList = []; - } - return cacheElement; - } - const origin = execCacheCall(fn, this); - let element: any; - if (fn.returned === false) { - // @ts-ignore - element = transformAsyncDom(origin, false); - } else { - let first: any = null; - // @ts-ignore - element = transformAsyncDom(origin, true, (trueDom: any) => { - // ! 被异步dom返回替换时需要替换cache和anchor - this.modifyCache(branch, trueDom); - anchor?.replaceStart(first, trueDom); - first = null; - }); - first = getFirstElement(element); - } - if (typeof element === 'string') { - element = Renderer.createTextNode(element); - } - // currentCall = null; - // 有可能存在void的情况 - if (Renderer.isElement(element) || typeof element === 'undefined') { - this.modifyCache(branch, element); - return element; - } - // todo 对于 return; 的处理 - throw new Error('动态条件分支中不允许返回非元素类型'); - }, - modifyCache (branch: IBranchTarget, el: ITrueElement) { - const key = branch.call; - if (!key) return; - // if (el) { - const doms = transformElementToCache(el); - // console.log('branch debug: cacheMap set', branch.id, doms) - cacheMap.set(key, doms); - const manager = managerMap.get(key); - if (manager && !manager.cacheArray) { - debugger; - // @ts-ignore - manager.cacheArray = doms; - managerMap.delete(key); - } - }, - setCache (call: any, doms: any[]) { - cacheMap.set(call, doms); - }, - _get (fn: any) { - return cacheMap.get(fn); - }, - }; -} -export type ICallCache = ReturnType - -let curCache: ICallCache|null = null; - -export function getCurCache () { - return curCache; -} - -/* - ! cachemanager 为管理条件分支中不包含 父元素的 for循环中的缓存 - 如 - - - 如果没有这个结构 就会导致 缓存异常 -*/ -export function createDomCacheManager () { - const cache = curCache; - - const manager = { - insertBefore (node: any, child:any, defParent: any) { - // 如果没有父元素则 append到初始的frag上 - const parent = getParent(child, defParent); - if (!cache) { - parent.insertBefore(node, child); - return; - } - - if (child.parentElement === parent) { - insertBefore(this.cacheArray, node, child); - parent.insertBefore(node, child); - } else { - cache?.addCacheTask((parent) => { - insertBefore(this.cacheArray, node, child); - try { - parent.insertBefore(node, child); - } catch (e) { - debugger; - } - }); - } - }, - removeElement (node: any) { - - if (!cache) { - Renderer.removeElement(node); - return; - } - - if (node.parentElement) { - Renderer.removeElement(node); - const index = this.cacheArray.indexOf(node); - this.cacheArray.splice(index, 1); - } else { - cache?.addCacheTask(() => { - Renderer.removeElement(node); - const index = this.cacheArray.indexOf(node); - this.cacheArray.splice(index, 1); - }); - } - }, - - addTask (fn: any) { - cache?.addCacheTask(fn); - }, - // @ts-ignore - cacheArray: null as any[], - }; - if (cache) cache.initManager(manager); - return manager; -} - -type ICacheManager = ReturnType; \ No newline at end of file diff --git a/packages/client-core/src/switch.ts b/packages/client-core/src/switch.ts deleted file mode 100644 index 792a53f..0000000 --- a/packages/client-core/src/switch.ts +++ /dev/null @@ -1,119 +0,0 @@ -/* - * @Author: chenzhongsheng - * @Date: 2023-07-03 09:09:46 - * @Description: Coding something - */ - -import {IWatchRefTarget, watch} from 'alins-reactive'; -import {ISimpleValue} from 'alins-utils'; -import {IBranchTarget} from './scope/branch'; -import {IGeneralElement, ITrueElement, Renderer} from './element/renderer'; -import {ICtxUtil, IReturnCall} from './type'; -import {createAnchor} from './scope/anchor'; - -// export const _break = Symbol('b'); -// export const _default = Symbol('d'); - -export type ISwitchTarget = IWatchRefTarget; - -export type ISwitchCase = [any, (()=>any)|null, boolean]; -// value, call, break, - -export type ISwitchCaseList = ISwitchCase[]; - -enum SwitchResult { - Init = 0, - Break, - Return, - Continue, -} - -// ! 编译时 return; return null; => return <> - -export function _switch (target: ISwitchTarget, caseList: ISwitchCaseList, util: ICtxUtil) { - const anchor = createAnchor(util.cache); - let endCall: IReturnCall; - - let initilizing = true; - - const branchMap = new WeakMap(); - - let result: SwitchResult = SwitchResult.Init; - - const execSingle = ([, call, brk]: ISwitchCase) => { - // console.log('switch debug:execSingle', call, brk); - if (call) { - const branch = branchMap.get(call); - if (!branch) throw new Error('empty branch'); - const dom = initilizing ? util.cache.call(branch, anchor) : anchor.replaceBranch(branch); - if (dom) { - result = SwitchResult.Return; - branch.inited = true; // todo 待定 - return dom; - } - } - result = brk ? SwitchResult.Break : SwitchResult.Continue; - return !!brk; - }; - - const run = (value: any) => { - // console.log('switch debug:run', value); - let macthed: boolean = false; - result = SwitchResult.Init; - let el: boolean|ITrueElement|null|undefined = null; - for (const item of caseList) { - if (macthed) { - if (el = execSingle(item)) break; - } else { - const caseValue = item[0]; - // 没有value表示为default - if ( - (Array.isArray(caseValue) && caseValue.includes(value)) || - caseValue === value || - caseValue === null - ) { // 命中或走default - macthed = true; - if (el = execSingle(item)) break; - } - } - } - // @ts-ignore - if (result !== SwitchResult.Return) { // 不是return; - const branch = branchMap.get(endCall) as IBranchTarget; - branch.inited = true; // todo 待定 - el = initilizing ? util.cache.call(branch, anchor) : anchor.replaceBranch(branch); - } - return el; - }; - - // ! 首次run初始化分支 - const initSwitchBranches = () => { - let first = true; - for (const item of caseList) { - const call = item[1]; - if (call) { - branchMap.set(call, util.branch.next(call, anchor, first)); - if (first) first = false; - } - } - branchMap.set(endCall, util.branch.next(endCall, anchor, first)); - util.branch.back(); - }; - - return { - end (call: IReturnCall = () => void 0): IGeneralElement|void { - endCall = call; - // console.warn('switch end'); - const init = watch(target, (value) => { - // console.warn('switch debug: change', value); - run(value); - }); - initSwitchBranches(); - const el = run(init.v); - initilizing = false; - if (Renderer.isElement(el)) return anchor.replaceContent(el as ITrueElement); - // @ts-ignore - return Renderer.createDocumentFragment(); - } - }; -} \ No newline at end of file diff --git a/packages/client-core/src/type.d.ts b/packages/client-core/src/type.d.ts index 52da410..1970731 100644 --- a/packages/client-core/src/type.d.ts +++ b/packages/client-core/src/type.d.ts @@ -4,11 +4,7 @@ * @Description: Coding something */ - -import {IBranchLink} from './scope/branch'; -import {ICtxAnchor} from './scope/anchor'; -import {ICallCache} from './scope/cache'; -import {ITrueElement} from './element/renderer'; +import { ITrueElement } from './element/renderer'; // eslint-disable-next-line no-undef export interface IReturnCall { @@ -18,8 +14,3 @@ export interface IReturnCall { } export type IAsyncReturnCall = () => Promise; -export interface ICtxUtil { - cache: ICallCache; - anchor: ICtxAnchor; - branch: IBranchLink; -} diff --git a/packages/client-core/src/utils.ts b/packages/client-core/src/utils.ts index 76a7d03..4b192b3 100644 --- a/packages/client-core/src/utils.ts +++ b/packages/client-core/src/utils.ts @@ -1,4 +1,4 @@ -import {Renderer} from './element/renderer'; +import { Renderer } from './element/renderer'; /* * @Author: chenzhongsheng @@ -23,7 +23,7 @@ export function insertBefore (array: any[], node: any, child: any) { if (Renderer.isFragment(node)) { node = Array.from(node.childNodes); } else { - node = [node]; + node = [ node ]; } if (index === 0) { // @ts-ignore diff --git a/packages/client-reactive/src/array-proxy.ts b/packages/client-reactive/src/array-proxy.ts index 5d9c954..c778c7d 100644 --- a/packages/client-reactive/src/array-proxy.ts +++ b/packages/client-reactive/src/array-proxy.ts @@ -4,8 +4,8 @@ * @Description: Coding something */ -import {empty, IProxyData, trig, util} from 'alins-utils'; -import {createProxy} from './proxy'; +import { empty, IProxyData, trig, util } from 'alins-utils'; +import { createProxy, isProxy } from './proxy'; export enum OprateType { Replace = 0, // Replace index a => b @@ -24,11 +24,10 @@ export interface IOprationAction { } function proxyItem (data: IProxyData, args: any[], index: number) { - + if (data[util].shallow) return args; return args.map((item, i) => { - if (item && typeof item === 'object') { - // debugger; + if (item && typeof item === 'object' && !isProxy(item)) { return createProxy(item, { commonLns: data[util].commonLns, path: data[util].path, @@ -43,7 +42,7 @@ function proxyItem (data: IProxyData, args: any[], index: number) { function triggerOprationEvent (arr: any[], type: OprateType, index:number, data: any[], count: number, fromAssign?:boolean) { // const ut = arr[util]; // @ts-ignore - arr[trig]?.forEach((fn: any) => {fn({type, data, index, count, fromAssign});}); + arr[trig]?.forEach((fn: any) => {fn({ type, data, index, count, fromAssign });}); } function wrapArrayCall (target: IProxyData, fn:()=>any) { @@ -56,7 +55,7 @@ function wrapArrayCall (target: IProxyData, fn:()=>any) { const ArrayMap = { splice (this: {target: IProxyData, origin: any}, start: number, count?: number, ...args: any[]) { - const {target, origin} = this; + const { target, origin } = this; // console.log('splice', start, count); if (start >= target.length) { start = target.length; @@ -72,56 +71,47 @@ const ArrayMap = { const data = proxyItem(target, args.slice(replaceNum), n); triggerOprationEvent(target, OprateType.Insert, n, data, data.length); // console.log('Insert', n, args.slice(replaceNum)); - // result = origin.call(proxy, n, 0, ...data); } else { const size = count - newCount; // 需要删除的数量 triggerOprationEvent(target, OprateType.Remove, n, target.slice(n, n + size), size); // console.log('Remove', n, count - newCount); - // result = origin.call(proxy, n, size); } for (let i = start; i < n; i++) { const data = args[i - start]; // [new,old] - triggerOprationEvent(target, OprateType.Replace, i, [data, target[i]], 1); - // // console.log('Replace', i, this[i], args[i - start]); - // if (data && typeof data === 'object') { - // target[i][util].replace(args[i - start]); - // } else { - // proxy[i] = data; - // } + triggerOprationEvent(target, OprateType.Replace, i, [ data, target[i] ], 1); } const items = target[util].scopeItems; // @ts-ignore const data = items?.slice(start, start + args.length).map(i => i[items.key].v); - // const data = args; // @ts-ignore return wrapArrayCall(target, () => origin.call(target[util].proxy, start, count, ...data)); }, push (this: {target: IProxyData, origin: any}, ...args: any[]) { // console.log('Push', args); - const {target, origin} = this; + const { target, origin } = this; args = proxyItem(target, args, target.length); triggerOprationEvent(target, OprateType.Push, target.length, args, args.length); return origin.call(target[util].proxy, ...args); }, pop (this: {target: IProxyData, origin: any}) { - const {target, origin} = this; + const { target, origin } = this; if (target.length > 0) { - triggerOprationEvent(target, OprateType.Remove, target.length - 1, [target[target.length - 1]], 1); + triggerOprationEvent(target, OprateType.Remove, target.length - 1, [ target[target.length - 1] ], 1); } // console.log('Remove', this.length - 1, 1); return origin.call(target[util].proxy); }, unshift (this: {target: IProxyData, origin: any}, ...args: any[]) { // console.log('Insert', ); - const {target, origin} = this; + const { target, origin } = this; args = proxyItem(target, args, 0); triggerOprationEvent(target, OprateType.Insert, 0, args, args.length); return wrapArrayCall(target, () => origin.call(target[util].proxy, ...args)); }, shift (this: {target: IProxyData, origin: any}) { // console.log('Remove', 0, 1); - const {target, origin} = this; + const { target, origin } = this; if (target.length > 0) { triggerOprationEvent(target, OprateType.Remove, 0, target[0], 1); } @@ -129,44 +119,19 @@ const ArrayMap = { }, replace (target: any, index: number, ov: any, v: any) { // console.warn('replace=======', index, ov, v); - triggerOprationEvent(target, OprateType.Replace, index, [v, ov], 1); + triggerOprationEvent(target, OprateType.Replace, index, [ v, ov ], 1); target[index] = v; }, - // sort (this: {target: IProxyData, origin: any}, compareFn?: ((a: any, b: any) => number) | undefined) { - // const {target, origin} = this; - // const originData = [...target]; - // const result = origin.call(target, compareFn); - // const n = result.length; - // for (let i = 0; i < n; i++) { - // if (originData[i] !== result[i]) { - // // Sort 作为另外一种类型 移动dom元素 修改索引 既可以 - // triggerOprationEvent(target, OprateType.Replace, i, [result[i], originData[i]], 1); - // // console.log('Replace', i, origin[i], result[i]); - // } - // } - // return result; - // }, - // fill (this: {target: IProxyData, origin: any}, data: any, start?: number, end?: number) { - // const {target, origin} = this; - // const result = origin.call(target[util].proxy, data, start, end); - // const n = end ?? result.length; - // const endItem = result[n - 1]; - // for (let i = start ?? 0; i < n; i++) { - // debugger; - // replaceLNS(result[i], endItem); - // } - // return result; - // }, }; const mapFunc: any = { // todo // https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce // indexOf (this: any[]) { - + // }, // lastIndexOf () { - + // }, // includes () { @@ -193,7 +158,7 @@ export function arrayFuncProxy (target: any, property: string, receiver: any) { // @ts-ignore if (ArrayMap[property] && target[trig] && !target[property].hack) { // @ts-ignore - target[property] = ArrayMap[property].bind({target, origin: target[property]}); + target[property] = ArrayMap[property].bind({ target, origin: target[property] }); target[property].hack = true; return target[property]; } @@ -222,7 +187,7 @@ export function replaceWholeArray (origin: any[], v: any[]) { for (let i = 0; i < min; i++) { - triggerOprationEvent(origin, OprateType.Replace, i, [v[i], origin[i]], 1); + triggerOprationEvent(origin, OprateType.Replace, i, [ v[i], origin[i] ], 1); origin[util].data[i] = v[i]; } @@ -231,19 +196,16 @@ export function replaceWholeArray (origin: any[], v: any[]) { if (on > vn) { // @ts-ignore triggerOprationEvent(origin, OprateType.Remove, min, null, on - vn); - // // for (let i = min; i < origin.length; i++) { - // // const item = origin[i]; - // // item.___clear_cache?.(); - // // } + // window.ccc.forEach(f => f()); // window.ccc = null; - origin[util].proxy.splice(min); + origin.splice(min); } else { const data = v.slice(min); // triggerOprationEvent(origin, OprateType.Push, min, data, vn - on); - origin[util].proxy.push(...data); + origin.push(...data); } - + return true; } @@ -256,7 +218,7 @@ export function replaceWholeArray (origin: any[], v: any[]) { // console.warn('type======', ['replace', 'remove', 'insert', 'push'][type], `index=${index}; count=${count}`, 'data=', data.map(i => JSON.stringify(i))); // }); // watch(list, (...args) => console.warn('watch======', args, JSON.stringify(args[0]), JSON.stringify(args[1]))); - + // list.splice(1, 2, {a: 0}); // } // window.testSpliceRemove = testSpliceRemove; @@ -275,7 +237,7 @@ export function replaceWholeArray (origin: any[], v: any[]) { // // result.push() // console.warn('watch======', args, JSON.stringify(args[0]), JSON.stringify(args[1])); // }); - + // list.splice(1, 1, {a: 0}, {a: 1}); // } // window.testSpliceInsert = testSpliceInsert; \ No newline at end of file diff --git a/packages/client-reactive/src/binding.ts b/packages/client-reactive/src/binding.ts index fd4bccf..86c02c4 100644 --- a/packages/client-reactive/src/binding.ts +++ b/packages/client-reactive/src/binding.ts @@ -4,9 +4,9 @@ * @Description: Coding something */ -import {isRef} from './proxy'; -import {AlinsType, IRefData, ISimpleValue, type} from 'alins-utils'; -import {watch} from './watch'; +import { isRef } from './proxy'; +import { AlinsType, IRefData, ISimpleValue, type } from 'alins-utils'; +import { watch } from './watch'; export const binding = Symbol('b'); diff --git a/packages/client-reactive/src/cleaner.ts b/packages/client-reactive/src/cleaner.ts index d4e827d..21aa163 100644 --- a/packages/client-reactive/src/cleaner.ts +++ b/packages/client-reactive/src/cleaner.ts @@ -6,7 +6,7 @@ export interface ICleaner { clean(): void; - collect(currentFn: any, clean: any): void; + collect(clean: any): void; } let curCleaner: ICleaner|null = null; @@ -19,39 +19,36 @@ export function getCurCleaner () { return curCleaner; } -export function useCurCleaner (cleaner: ICleaner|null, callback: ()=>void) { +export function useCurCleaner (cleaner: ICleaner|null, callback: ()=>T) { setCurCleaner(cleaner); - callback(); + // console.warn('useCurCleaner'); + const result = callback(); setCurCleaner(null); + return result; } // 收集dom元素依赖的watch,在元素remove时主动释放掉所有watch export function createCleaner () { - - let cleanMap: Mapvoid> = new Map(); + + let cleanMap: any[] = []; const cleaner: ICleaner = { + // map () {return cleanMap;}, clean () { cleanMap.forEach(clean => { clean(); }); - // ! 使用for of 部分打包工具会转译成 普通for语句 导致元素没有被遍历到,没有释放内存 - // const keys = cleanMap.keys(); - // for (const key of keys) { - // // @ts-ignore - // cleanMap.get(key)(); - // } - cleanMap.clear(); // @ts-ignore cleanMap = null; + // @ts-ignore + set = null; }, - collect (key: any, clean: any) { + collect (clean: any) { if (!cleanMap) { console.warn('cleanMap is null'); return; } - if (cleanMap.has(key)) return; - cleanMap.set(key, clean); + cleanMap.push(clean); } }; diff --git a/packages/client-reactive/src/computed.ts b/packages/client-reactive/src/computed.ts index 0f80242..4d845e6 100644 --- a/packages/client-reactive/src/computed.ts +++ b/packages/client-reactive/src/computed.ts @@ -4,9 +4,9 @@ * @Description: Coding something */ -import {util, IRefData, IOnChange} from 'alins-utils'; -import {observe, createProxy, wrapReactive} from './proxy'; -import {isDepReactive} from './proxy'; +import { util, IRefData, IOnChange } from 'alins-utils'; +import { observe, createProxy, wrapReactive } from './proxy'; +import { isDepReactive } from './proxy'; export interface IComputedObject { get(): T; @@ -29,23 +29,12 @@ export function computed (target:(()=>T)|IComputedObject): IRefData|{v: }); if (isDepReactive()) { - proxy = createProxy(wrapReactive(v, true), {set, get}); + proxy = createProxy(wrapReactive(v, true), { set, get }); return proxy; } - // // @ts-ignore - // fn = null; // ! 此处是为了兼容编译时将未知类型的import常量进行表达式计算时进行的统一computed处理的开销 // 也可以优化 computed静态类型的开销 如 computed(()=>1+1) - return {v}; - - // // eslint-disable-next-line prefer-const - // proxy = observe(() => { - // return createProxy(wrapReactive(get(), true), {set, get}); - // }, () => { - // // ! 每次都需要重新get以下 因为可能代码逻辑分支有变化导致出现了没有收集到的依赖 - // proxy[util].forceWrite(wrapReactive(get(), true)); - // }); - // // console.log(proxy); - // return proxy; + return { v }; + } diff --git a/packages/client-reactive/src/proxy.ts b/packages/client-reactive/src/proxy.ts index 35d1d79..e38dd5a 100644 --- a/packages/client-reactive/src/proxy.ts +++ b/packages/client-reactive/src/proxy.ts @@ -9,10 +9,10 @@ import { IJson, IOnChange, IProxyData, IProxyListener, IProxyListenerMap, type, util } from 'alins-utils'; -import {arrayFuncProxy, replaceWholeArray} from './array-proxy'; -import {replaceArrayItem} from './array-proxy'; -import {empty, pureproxy} from 'alins-utils'; -import {getCurCleaner} from './cleaner'; +import { arrayFuncProxy, replaceWholeArray } from './array-proxy'; +import { replaceArrayItem } from './array-proxy'; +import { empty, pureproxy } from 'alins-utils'; +import { getCurCleaner } from './cleaner'; let currentFn: any = null; let depReactive = false; // 当前表达式是否依赖响应数据 @@ -41,13 +41,13 @@ export function isProxy (data: any): boolean { } export function mockRef (data: any) { - return {v: data, [type]: AlinsType.Ref}; + return { v: data, [type]: AlinsType.Ref }; } export function wrapReactive (data: any, force = false) { if (force || !data || typeof data !== 'object') { // @ts-ignore - return {v: data, [type]: AlinsType.Ref}; + return { v: data, [type]: AlinsType.Ref }; } return data; } @@ -57,7 +57,7 @@ export function createUtils ( key: string, path: string[], ): void { - const current = key ? [...path, key] : [...path]; + const current = key ? [ ...path, key ] : [ ...path ]; const isArray = Array.isArray(data); const triggerChange = (property: string, nv: any, old: any, remove?: boolean, isNew?: boolean) => { const each = (fn: any) => { @@ -70,23 +70,6 @@ export function createUtils ( item[property]?.forEach(each); }); }; - // const clearCache = () => { - // // @ts-ignore - // data[util].commonLns = null; - // const lns = data[util].lns; - - // for (const k in lns) { - // lns[k].clear(); - // // @ts-ignore - // lns[k] = null; - // } - // // @ts-ignore - // data[util].lns = null; - // // @ts-ignore - // data[util].extraLns = null; - // // @ts-ignore - // data[util] = null; - // }; const forceUpdate = () => { for (const k in data) { // @ts-ignore @@ -102,9 +85,10 @@ export function createUtils ( }; const subscribe = (ln: IProxyListener, deep: boolean = true) => { // console.trace('subscribe', Object.keys(lns)); - data[util].commonLns?.add(ln) || (data[util].commonLns = new Set([ln])); + const ut = data[util]; + addLns(ut, 'commonLns', ln); for (const k in data) { - data[util].lns[k]?.add(ln) || (data[util].lns[k] = new Set([ln])); + addLns(ut.lns, k, ln); // @ts-ignore if (deep && isProxy(data[k])) data[k][util].subscribe(ln, deep); } @@ -120,7 +104,6 @@ export function createUtils ( subscribe, isArray, forceUpdate, - // clearCache, }); } @@ -130,6 +113,19 @@ function isArrayOrJson (o: any) { return false; } +function deepReactive (data: any, path: string[]) { + for (const k in data) { + const v = data[k]; + if (v && typeof v === 'object') { + try { + data[k] = createProxy(v, { path, key: k }); + } catch (e) { + console.warn(e); + } + } + } +} + export function createProxy (data: T, { commonLns, lns = {}, // lns=>listeners @@ -148,49 +144,19 @@ export function createProxy (data: T, { commonLns?: Set } = {}): IProxyData { - if (!isArrayOrJson(data)) { - return data as any; - } + if (!isArrayOrJson(data) || isProxy(data)) return data as any; + + if (!shallow) deepReactive(data, path); // @ts-ignore if (!data[type]) data[type] = AlinsType.Proxy; - if (!shallow) { - for (const k in data) { - const v = data[k]; - if (v && typeof v === 'object') { - try { - data[k] = createProxy(v, {path, key: k}); - } catch (e) { - // debugger; - console.warn(e); - } - } - } - } - // @ts-ignore - data[util] = { - commonLns, - lns, - shallow, - data, - }; + data[util] = { commonLns, lns, shallow, data }; // @ts-ignore createUtils(data, key, path); - // @ts-ignore - let {triggerChange, isArray} = data[util]; - - let __clearCache = () => { - data[util].clearCache(); - triggerChange = null; - isArray = null; - // @ts-ignore - __clearCache = null; - // @ts-ignore - data[util] = null; - }; + const { triggerChange, isArray } = data[util]; let prevLength = isArray ? data.length : null; @@ -198,12 +164,9 @@ export function createProxy (data: T, { const proxy = new Proxy(data, { // ! 闭包 get (target: IJson, property, receiver) { - if (property === '___clear_cache') { - return __clearCache; - } + // if (property === 'label') console.warn('proxy get', property); const isFunc = typeof target[property] === 'function'; if (isArray && isFunc) { - // console.log('Proxy function', property, target[property]); // debugger; return arrayFuncProxy(target, property as string, receiver); } @@ -211,24 +174,8 @@ export function createProxy (data: T, { // ! 收集依赖 if (currentFn) { if (!depReactive) depReactive = true; - if (!lns[property]) lns[property] = new Set(); - let listener = currentFn; - if (!lns[property].has(listener)) { - // 移除被删除的dom的引用释放内存 - const clean = () => { - // console.log('clear', target, property); - // debugger; - lns[property].delete(listener); - listener = null; - }; - // console.log('collect', target[util], property); - // debugger; - getCurCleaner()?.collect(target[util], clean); - listener.__clear = clean; - // if (__DEBUG__) console.log('收集依赖', property); - lns[property].add(listener); - // if (__DEBUG__) console.log('收集依赖222', lns[property]); - } + // console.warn('COLLECT------ ', property, '=', target[property]); + addLns(lns, property, currentFn); // ! 当在依赖搜集时 返回缓存的值 return Reflect.get(target, property, receiver); } @@ -242,7 +189,7 @@ export function createProxy (data: T, { // ! 闭包 set (target: IJson, property, v, receiver) { // console.log('Set property', property, v); - const orginSet = () => { + const originSet = () => { const value = Reflect.set(target, property, v, receiver); if (isArray && property !== 'length' && lns.length?.size) { // 直接对数组赋值 arr[100] = 1; 会增加长度但是不会触发 length的proxy @@ -260,10 +207,9 @@ export function createProxy (data: T, { } return value; }; - + if (typeof property !== 'symbol' && typeof target[property] !== 'function') { // console.log('debug:Proxy.set', target, property, v); - // if (v.a === 2) debugger; let origin: any = null; if (isArray && property === 'length') { origin = prevLength; @@ -271,11 +217,9 @@ export function createProxy (data: T, { } else { origin = target[property]; } - // debugger; if (v === origin && !target[util]?._map) return true; if (set === null) { console.warn('Computed 不可设置'); return true;} if (property === 'v' && set) { set(v, origin, `${path.join('.')}.${property as string}`, property); return true; } - // if (v.a === 0) debugger; if (v && typeof v === 'object' && !shallow) { // ! 非shallow时 赋值需要createProxy并且将listener透传下去 if (!isProxy(v)) { if (origin) origin[util].removed = true; @@ -289,33 +233,20 @@ export function createProxy (data: T, { } else { if (!v[pureproxy]) v = v[util].proxy; // ! 如果是伪proxy 则获取真proxy if (isProxy(origin) && data[util].replaceLns !== false) { - // todo 多个对象引用同一个数据时处理 ! - // const list = target.filter(item => item[util] === v[util]); - // 需要修改lns - // console.warn('debug: replace lns', JSON.stringify(v), JSON.stringify(origin)); replaceLNS(v, origin); } } } let value: any = empty; - - - if (isArray && /^\d+$/.test(property)) { - value = replaceArrayItem(target, property, v); - } - - if (Array.isArray(v) && Array.isArray(origin)) { - value = replaceWholeArray(origin, v); - } - - if (value === empty) value = orginSet(); + if (isArray && /^\d+$/.test(property)) value = replaceArrayItem(target, property, v); + if (Array.isArray(v) && Array.isArray(origin)) value = replaceWholeArray(origin, v); + if (value === empty) value = originSet(); // ! 执行依赖 - // if (origin === undefined && property === '5') debugger; triggerChange(property as string, v, origin, false, typeof origin === 'undefined'); return value; } - return orginSet(); + return originSet(); }, // ! 闭包 deleteProperty (target: IJson, property) { @@ -337,7 +268,7 @@ export function replaceLNS (nv: IProxyData, origin: IProxyData) { // ! 引入extraLns 来处理 赋值问题 if (!out.extraLns || !out.extraLns.has(ut.lns)) { if (!ut.extraLns) { - ut.extraLns = new Set([out.lns]); + ut.extraLns = new Set([ out.lns ]); } else { ut.extraLns.add(out.lns); } @@ -354,4 +285,22 @@ export function replaceLNS (nv: IProxyData, origin: IProxyData) { replaceLNS(nv[k], origin[k]); } } +} + +export function addLns (lns, property, listener) { + let set = lns[property]; + if (!set) set = lns[property] = new Set(); + if (!set.has(listener)) { + // 移除被删除的dom的引用释放内存 + const cleaner = getCurCleaner(); + if (cleaner) { + if (property === 'v') { + cleaner.collect(() => { + set.delete(listener); + listener = null; + }); + } + } + set.add(listener); + } } \ No newline at end of file diff --git a/packages/client-reactive/src/react.ts b/packages/client-reactive/src/react.ts index 993dd9b..f4c2bdf 100644 --- a/packages/client-reactive/src/react.ts +++ b/packages/client-reactive/src/react.ts @@ -9,9 +9,8 @@ import { IProxyData, isStringTemplateArray, } from 'alins-utils'; -import {createProxy, isProxy, wrapReactive} from './proxy'; -import {createBinding, IBindingReaction, IReactBindingResult} from './binding'; - +import { createProxy, isProxy, wrapReactive } from './proxy'; +import { createBinding, IBindingReaction, IReactBindingResult } from './binding'; // ! 重载顺序不能更改 // 生成响应数据绑定 @@ -36,5 +35,5 @@ export function reactive (data: T, shallow = false): IProxyData if (isProxy(data.v)) return data as any; - return createProxy(wrapReactive(data) as T, {shallow}); + return createProxy(wrapReactive(data) as T, { shallow }); } \ No newline at end of file diff --git a/packages/client-reactive/src/store.ts b/packages/client-reactive/src/store.ts index 256cec4..7d4ef00 100644 --- a/packages/client-reactive/src/store.ts +++ b/packages/client-reactive/src/store.ts @@ -3,8 +3,8 @@ * @Date: 2023-08-31 09:38:52 * @Description: Coding something */ -import {react} from './react'; -import {watch} from './watch'; +import { react } from './react'; +import { watch } from './watch'; type IAction> = Record, ...args: any[])=>any> diff --git a/packages/client-reactive/src/watch.ts b/packages/client-reactive/src/watch.ts index 719a272..dcc17f4 100644 --- a/packages/client-reactive/src/watch.ts +++ b/packages/client-reactive/src/watch.ts @@ -3,10 +3,10 @@ * @Date: 2023-06-26 15:31:14 * @Description: Coding something */ -import {IProxyListener, IProxyData, util, IRefData, trig, empty} from 'alins-utils'; -import {isProxy, observe} from './proxy'; +import { IProxyListener, IProxyData, util, IRefData, trig, empty } from 'alins-utils'; +import { isProxy, observe } from './proxy'; // import {computed} from './computed'; -import {IOprationAction} from './array-proxy'; +import { IOprationAction } from './array-proxy'; export type IWatchRefTarget = (()=>T)|IRefData|{v:T}; export type IWatchTarget = IWatchRefTarget|(IProxyData); @@ -39,6 +39,7 @@ export function watch ( cb: IProxyListener, deep = true, ): IProxyData|IRefData|{v:T} { + // console.warn('watch', target); if (typeof target === 'function') { let before: any = empty; before = observe(target, (v, nv, path, p, remove) => { @@ -54,17 +55,7 @@ export function watch ( } }); - return {v: before}; - - // target = computed(target); - // // 防止多次重复触发watch - // const origin = cb; - // cb = (v, nv, path, p, remove) => { - // console.log(v, nv, path, p, remove); - // if (!isValueEqual(v, nv)) { - // origin(v, nv, path, p, remove); - // } - // }; + return { v: before }; } else if (!isProxy(target)) { // ! 兼容computed(()=>1+1)情况 return target; @@ -79,12 +70,12 @@ export function watch ( export function watchArray ( target: IProxyData, - listener: ({index, count, data, type}: IOprationAction)=>void + listener: ({ index, count, data, type }: IOprationAction)=>void ) { // @ts-ignore if (!target[trig]) { // @ts-ignore - target[trig] = [listener]; + target[trig] = [ listener ]; } else { // @ts-ignore target[trig].push(listener); diff --git a/packages/client-standalone/src/index.ts b/packages/client-standalone/src/index.ts index e2058be..b62774d 100644 --- a/packages/client-standalone/src/index.ts +++ b/packages/client-standalone/src/index.ts @@ -6,11 +6,11 @@ import { IRefData, IGeneralElement, _if, _switch, - ContextTool, createContext, IAttributes, Renderer, reactiveBindingEnable, - map + map, + _$ce } from 'alins'; type IValueCond = (()=>T)|IRefData; @@ -26,8 +26,8 @@ type IDomGenerator = ()=>IGeneralElement|IGeneralElement[]; // }); -export {react, watch, computed} from 'alins'; -import {react, watch, computed} from 'alins'; +export { react, watch, computed } from 'alins'; +import { react, watch, computed } from 'alins'; // alins.Dom('div', { @@ -40,7 +40,7 @@ export function Dom (name: string, attributes: IAttributes = {}, children: any[] attributes = {}; } // @ts-ignore - return ContextTool.ce(name, attributes, children); + return _$ce(name, attributes, children); } // alins.component(fn, {}, []) export function Component ( @@ -53,7 +53,7 @@ export function Component ( attributes = {}; } // @ts-ignore - return ContextTool.ce(fn, attributes, children); + return _$ce(fn, attributes, children); } @@ -74,7 +74,7 @@ export function Component ( export function If (condition: IBoolCond, generator: IDomGenerator, ...items: any[][]) { // @ts-ignore - let result = _if(condition, generator, createContext()); + let result = _if(condition, generator); for (const item of items) { if (item.length === 2) result = result.elif(item[0], item[1]); else if (item.length === 1) result = result.else(item[0]); @@ -82,10 +82,10 @@ export function If (condition: IBoolCond, generator: IDomGenerator, ...items: an return result.end(); } export function ElseIf (condition: IBoolCond, generator: IDomGenerator) { - return [condition, generator]; + return [ condition, generator ]; } export function Else (generator: IDomGenerator) { - return [generator]; + return [ generator ]; } // alins.switch(()=>a, @@ -96,17 +96,17 @@ export function Else (generator: IDomGenerator) { // ) export function Switch (condition: IValueCond, generator: IDomGenerator) { // @ts-ignore - return _switch(condition, generator, createContext()).end(); + return _switch(condition, generator).end(); } type ICaseItem = [any, IDomGenerator, boolean|undefined]; export function Case (value: any, generator: IDomGenerator, brk?: boolean): ICaseItem { - return [value, generator, brk]; + return [ value, generator, brk ]; } export function Default (generator: IDomGenerator, brk?: boolean): ICaseItem { - return [null, generator, brk]; + return [ null, generator, brk ]; } @@ -118,7 +118,7 @@ export function Async ( generator: (data: T)=>IGeneralElement|IGeneralElement[] ) { // @ts-ignore - return ContextTool.ce(async () => { + return _$ce(async () => { const data = await promise; return generator(data); }); diff --git a/packages/client-utils/src/index.ts b/packages/client-utils/src/index.ts index b5c485c..fdc7e06 100644 --- a/packages/client-utils/src/index.ts +++ b/packages/client-utils/src/index.ts @@ -5,7 +5,7 @@ */ export * from './utils'; export * from './types/symbol'; -export {version} from '../package.json'; +export { version } from '../package.json'; export * from './types/common.d'; export * from './types/react.d'; diff --git a/packages/client-utils/src/types/react.d.ts b/packages/client-utils/src/types/react.d.ts index a0aac00..58fdb4f 100644 --- a/packages/client-utils/src/types/react.d.ts +++ b/packages/client-utils/src/types/react.d.ts @@ -4,9 +4,9 @@ * @Description: Coding something */ -import {IJson} from './common'; -import {AlinsType} from './enum'; -import {type, util} from './symbol'; +import { IJson } from './common'; +import { AlinsType } from './enum'; +import { type, util } from './symbol'; export type ISimpleValue = string|number|boolean; @@ -31,7 +31,7 @@ export interface IProxyUtils { data: any; } -interface IProxyBase { +export interface IProxyBase { // @ts-ignore [util]: IProxyUtils; // @ts-ignore diff --git a/packages/compiler-core/src/component/component.ts b/packages/compiler-core/src/component/component.ts index 2877f3b..5ed922e 100644 --- a/packages/compiler-core/src/component/component.ts +++ b/packages/compiler-core/src/component/component.ts @@ -3,10 +3,11 @@ * @Date: 2023-07-31 20:37:15 * @Description: Coding something */ -import type {NodePath} from '@babel/traverse'; -import type {Identifier, JSXAttribute, JSXElement, JSXOpeningElement, Node} from '@babel/types'; -import {isOriginJSXElement} from '../is'; -import {getT, Names, parseAttributes} from '../parse-utils'; +import type { NodePath } from '@babel/traverse'; +import type { Identifier, JSXAttribute, JSXElement, JSXOpeningElement, Node } from '@babel/types'; +import { AlinsVar, ImportManager } from '../controller/import-manager'; +import { isOriginJSXElement } from '../is'; +import { createCtxCall, getT, parseAttributes } from '../parse-utils'; const CompNames = { For: 'For', @@ -21,9 +22,13 @@ const CompNames = { // Frag: 'Frag', }; -function wrapChildren (children: any[], args: any[]|null = []) { +function wrapChildren ( + children: any[], + args: any[]|null = [], + isBreak = true, +) { const t = getT(); - let content = children.length === 1 ? children[0] : t.jsxFragment( + let content = (children.length === 1 && isBreak) ? children[0] : t.jsxFragment( t.jsxOpeningFragment(), t.jsxClosingFragment(), children @@ -92,13 +97,23 @@ function parseFor (path: NodePath) { if (!arrId) throw new Error('for:data is required'); const t = getT(); + + const children = path.node.children; + // ! Case中添加其他分支元素时可能已经被转化了 需要用 expContainer 包裹一下 + children.forEach((item, i) => { + // @ts-ignore + if (item.type === 'CallExpression') { + children[i] = t.jsxExpressionContainer(item); + } + }); + const newNode = t.callExpression( t.memberExpression( arrId, t.identifier('map'), ), [ - wrapChildren(path.node.children, [ + wrapChildren(children, [ t.identifier(itemName), t.identifier(indexName), ]) @@ -117,7 +132,7 @@ function parseIf (path: NodePath) { object: any, id: Identifier, args: any[], ) => { anchor = t.callExpression( - t.memberExpression(object, id), + id ? t.memberExpression(object, id) : object, args ); if (args.length > 0)args[args.length - 1]._call = anchor; @@ -132,7 +147,7 @@ function parseIf (path: NodePath) { const handleNext = (path: NodePath) => { let end = false; - let object: any, id: Identifier, args: any[]; + let object: any, id: Identifier|null, args: any[]; const node = path.node; @@ -142,8 +157,8 @@ function parseIf (path: NodePath) { switch (name) { case CompNames.If: { parseComponentAttr(node); - object = t.identifier(Names.Ctx); - id = t.identifier('if'); + object = ImportManager.use(AlinsVar.If); + id = null; args = [ t.arrowFunctionExpression([], getExp(node.openingElement)), wrapChildren(node.children), @@ -206,6 +221,9 @@ function parseSwitch (path: NodePath) { const array: any = []; const t = getT(); + let childrenList: any[][] = []; + let isLastBreak = true; + for (const item of node.children) { if (isEmptyText(item)) continue; if (!isOriginJSXElement(item.type)) { @@ -220,15 +238,29 @@ function parseSwitch (path: NodePath) { // @ts-ignore const name = el.name.name; if (name === CompNames.Case || name === CompNames.Default) { + // @ts-ignore + const brk = el.attributes.find(item => item.name.name === 'break'); + const isBreak = brk?.value?.expression.value !== false; + // @ts-ignore + const children = item.children || []; + const exp = getExp(el); const elements: any[] = [ !exp ? t.nullLiteral() : exp, - // @ts-ignore - wrapChildren(item.children || []), + wrapChildren(children, [], isBreak), + t.booleanLiteral(isBreak), ]; - // @ts-ignore - const brk = el.attributes.find(item => item.name.name === 'break'); - elements.push(t.booleanLiteral(brk?.value?.expression.value !== false)); + if (!isLastBreak) { + childrenList.forEach(item => { + item.push(...children); + }); + } + if (!isBreak) { + childrenList.push(children); + } else { + childrenList = []; + } + isLastBreak = isBreak; array.push(t.arrayExpression(elements)); if (name === CompNames.Default) break; } else { @@ -236,14 +268,10 @@ function parseSwitch (path: NodePath) { } } - - const switchNode = t.callExpression( - t.memberExpression(t.identifier(Names.Ctx), t.identifier('switch')), - [ - t.arrowFunctionExpression([], getExp(node.openingElement)), - t.arrayExpression(array) - ] - ); + const switchNode = createCtxCall(AlinsVar.Switch, [ + t.arrowFunctionExpression([], getExp(node.openingElement)), + t.arrayExpression(array) + ]); path.replaceWith(t.callExpression( t.memberExpression(switchNode, t.identifier('end')), @@ -271,10 +299,7 @@ function parseAsync (path: NodePath) { t.returnStatement(wrapChildren(node.children, null)) ]); - path.replaceWith(t.callExpression( - t.memberExpression(t.identifier(Names.CtxFn), t.identifier('ce')), - [ t.arrowFunctionExpression([], body, true) ] - )); + path.replaceWith(createCtxCall(AlinsVar.Create, [ t.arrowFunctionExpression([], body, true) ])); } function parseShow (path: NodePath) { diff --git a/packages/compiler-core/src/context.ts b/packages/compiler-core/src/context.ts index a5f4ec8..916adfd 100644 --- a/packages/compiler-core/src/context.ts +++ b/packages/compiler-core/src/context.ts @@ -3,13 +3,13 @@ * @Date: 2023-06-30 16:07:45 * @Description: Coding something */ -import type {NodePath} from '@babel/traverse'; -import type {CallExpression, Expression, FunctionDeclaration, Identifier, JSXExpressionContainer, Node, Program, VariableDeclaration, VariableDeclarator} from '@babel/types'; -import {MapScope} from './controller/map'; -import {isComponentFunc, isFuncExpression, isJsxCallee} from './is'; -import {getObjectPropValue, ImportScope, initCurModule} from './parse-utils'; -import {Scope} from './scope'; -import {INodeTypeMap} from './types'; +import type { NodePath } from '@babel/traverse'; +import type { CallExpression, Expression, FunctionDeclaration, Identifier, JSXExpressionContainer, Node, Program, VariableDeclaration, VariableDeclarator } from '@babel/types'; +import { MapScope } from './controller/map'; +import { isComponentFunc, isJsxCallee } from './is'; +import { getObjectPropValue, initCurModule } from './parse-utils'; +import { Scope } from './scope'; +import { INodeTypeMap } from './types'; export let currentModule: Module = null as any; @@ -39,17 +39,12 @@ export class Module { curScope: Scope = null as any; curDeclarationType: VariableDeclaration['kind'] = 'var'; id = 0; - ctx: NodePath; // ! 当前的 alins ctx 用不到的话需要移除出去 constructor (path: NodePath) { this.id = moduleId++; this.enterScope(path); } exitModule () { - // @ts-ignore - if (this.ctx && !this.ctx.node._used) { - ImportScope.unuse(); - this.ctx.remove(); - } + } enterScope (path: NodePath, isFunc = false) { @@ -61,14 +56,11 @@ export class Module { newScope.parent = this.curScope; newScope.deep = this.curScope ? (this.curScope.deep + 1) : 0; this.curScope = newScope; - // console.log('AlinsCtx enterScope', newScope.id, newScope.deep, path.toString()); - // debugger; } exitScope () { // iii --; // console.log('SCOPE_DEBUG: exitScope', this.curScope?.inJsxTrans, path?.toString(), iii); if (this.curScope.inJsxTrans) return; - // ! 没有使用到的 ctx 则删除 const scope = this.curScope; // debugger; scope.exit(); @@ -130,7 +122,7 @@ export class Module { } enterIdentifier (path: NodePath) { - const {node, parent} = path; + const { node, parent } = path; // @ts-ignore if (node._deco) return; // 装饰器jsx直接表达式需要跳过 ! value:number={a} const ptype = parent.type; @@ -217,7 +209,7 @@ export class Module { jsxFlagStackDeep = 0; checkJsxComponent (path: NodePath) { - + if (isComponentFunc(path.node)) { // 首字母大写的函数 // @ts-ignore diff --git a/packages/compiler-core/src/controller/control-scope.ts b/packages/compiler-core/src/controller/control-scope.ts index 40ce6b0..4790787 100644 --- a/packages/compiler-core/src/controller/control-scope.ts +++ b/packages/compiler-core/src/controller/control-scope.ts @@ -3,10 +3,10 @@ * @Date: 2023-07-17 07:55:32 * @Description: Coding something */ -import type {Statement} from '@babel/types'; -import type {NodePath} from '@babel/traverse'; -import type {Scope} from '../scope'; - +import type { Statement } from '@babel/types'; +import type { NodePath } from '@babel/traverse'; +import type { Scope } from '../scope'; + export abstract class ControlScope { replaceEnd: (node: Statement[])=>void; parent: ControlScope|null = null; ; @@ -64,29 +64,7 @@ export abstract class ControlScope { // @ts-ignore this.newNode = null; } - - // this.path.replaceWith(this.newNode); - // if (!this.top) { - // const t = getT(); - // const returnStatement = t.returnStatement(t.identifier(Names.TempResult)); - // const returnNode = () => this.returned ? returnStatement : t.ifStatement( - // t.identifier(Names.TempResult), - // returnStatement, - // null - // ); - // if (this.replaceEnd) { - // // ! if end 时候需要对返回值重新评估 当有return的时候 不需要if判断 - // const origin = this.replaceEnd.bind(this); - // this.replaceEnd = (node: any) => { - // origin(node); // ! 必须在前面先初始化 returned - // this.path.insertAfter(returnNode()); - // }; - // // this.path.insertAfter(returnNode()); - // } else { - // this.path.insertAfter(returnNode()); - // } - // } return this.parent; } } \ No newline at end of file diff --git a/packages/compiler-core/src/controller/if-scope.ts b/packages/compiler-core/src/controller/if-scope.ts index 6bce202..5c921d7 100644 --- a/packages/compiler-core/src/controller/if-scope.ts +++ b/packages/compiler-core/src/controller/if-scope.ts @@ -1,7 +1,8 @@ -import type {Identifier, IfStatement, Statement} from '@babel/types'; -import {getT, markMNR, Names, traverseIfStatement} from '../parse-utils'; -import {ControlScope} from './control-scope'; -import {createScopeStack} from './scope-stack'; +import type { Identifier, IfStatement, Statement } from '@babel/types'; +import { getT, markMNR, traverseIfStatement } from '../parse-utils'; +import { ControlScope } from './control-scope'; +import { AlinsVar, ImportManager } from './import-manager'; +import { createScopeStack } from './scope-stack'; /* * @Author: chenzhongsheng @@ -26,10 +27,10 @@ export class IfScope extends ControlScope { const end = map.end; const setAnchor = ( - object: any, id: Identifier, args: any[], + object: any, id: Identifier|null, args: any[], ) => { const bodyFn = args[args.length - 1]; - if (id.name !== 'end') { + if (!id || id.name !== 'end') { args[args.length - 1] = markMNR(bodyFn, () => { this.markScopeReturnJsx(); }); @@ -40,13 +41,13 @@ export class IfScope extends ControlScope { } // @ts-ignore anchor = t.callExpression( - t.memberExpression(object, id), + id ? t.memberExpression(object, id) : object, args ); bodyFn._call = anchor; }; - setAnchor(t.identifier(Names.Ctx), map.if.id, [ map.if.test, map.if.fn ]); + setAnchor(ImportManager.use(AlinsVar.If), null, [ map.if.test, map.if.fn ]); for (const item of map.elif) { setAnchor(anchor, item.id, [ item.test, item.fn ]); @@ -74,11 +75,7 @@ export class IfScope extends ControlScope { if (!this.top) { // @ts-ignore anchor = t.returnStatement(anchor); - // anchor = createVarDeclaration('var', - // [ createVarDeclarator(Names.TempResult, anchor) ] - // ); } - // this.returned = map.returned; this.newNode = anchor; } diff --git a/packages/compiler-core/src/controller/import-manager.ts b/packages/compiler-core/src/controller/import-manager.ts new file mode 100644 index 0000000..adc7bc6 --- /dev/null +++ b/packages/compiler-core/src/controller/import-manager.ts @@ -0,0 +1,86 @@ +/* + * @Author: chenzhongsheng + * @Date: 2023-09-06 11:35:21 + * @Description: Coding something + */ + +import { getT } from '../parse-utils'; + +export const AlinsStr = { + Prefix: '_$', + Value: 'v', + Temp: '_$R', +}; + +export enum AlinsVar { + Create = 'ce', + MNR = 'mnr', + React = 'r', + Computed = 'c', + Watch = 'w', + ComputedShort = 'cc', // computed 简写 + Extend = 'e', + ExtendComp = 'es', + MarkUpdate = 'mu', + MockRef = 'mf', + MockMap = 'mm', + If = 'if', + Switch = 'sw', +} + +// react | computed | watch | ComputedFull | + +export const ImportManager = (() => { + let used = false; + + const useNames = new Set([]); + + let addUse: (name: AlinsVar)=>void = () => {}; + + let clear: any; + + return { + exitModule () { + if (useNames.size === 0) { + clear(); + } + useNames.clear(); + addUse = () => {}; + }, + use (name: AlinsVar) { + if (!used) used = true; + + const s = `${AlinsStr.Prefix}${name}`; + if (!useNames.has(name)) { + // @ts-ignore + addUse(s); + useNames.add(name); + } + + return getT().identifier(s); + }, + init (useImport: boolean, clearDecl) { + const t = getT(); + clear = clearDecl; + if (useImport) { + const declaration = t.importDeclaration([], t.stringLiteral('alins')); + addUse = (name: AlinsVar) => { + declaration.specifiers.push( + t.importSpecifier(t.identifier(name), t.identifier(name)) + ); + }; + return declaration; + } + const objectPattern = t.objectPattern([]); + const declaration = t.variableDeclaration('var', [ + t.variableDeclarator(objectPattern, t.memberExpression(t.identifier('window'), t.identifier('Alins'))) + ]); + addUse = (name: AlinsVar) => { + objectPattern.properties.push( + t.objectProperty(t.identifier(name), t.identifier(name), false, true) + ); + }; + return declaration; + } + }; +})(); \ No newline at end of file diff --git a/packages/compiler-core/src/controller/jsx-scope.ts b/packages/compiler-core/src/controller/jsx-scope.ts index 9459d1c..ef91c0b 100644 --- a/packages/compiler-core/src/controller/jsx-scope.ts +++ b/packages/compiler-core/src/controller/jsx-scope.ts @@ -3,12 +3,13 @@ * @Date: 2023-07-14 23:19:18 * @Description: Coding something */ -import type {NodePath} from '@babel/traverse'; -import {createMemberExp, getT, Names, parseFirstMemberObject, parseJsxAttrShort, createWrapAttr, replaceJsxDomCreator, skipNode, createUnfInit} from '../parse-utils'; -import type {JSXAttribute, JSXElement, JSXExpressionContainer, JSXFragment} from '@babel/types'; -import type {Module} from '../context'; -import {isFuncExpression, isJSXComponent} from '../is'; -import {isEventAttr} from '../is'; +import type { NodePath } from '@babel/traverse'; +import { createMemberExp, getT, parseFirstMemberObject, parseJsxAttrShort, createWrapAttr, replaceJsxDomCreator, skipNode, createUnfInit, createCtxCall } from '../parse-utils'; +import type { JSXAttribute, JSXElement, JSXExpressionContainer, JSXFragment } from '@babel/types'; +import type { Module } from '../context'; +import { isFuncExpression, isJSXComponent } from '../is'; +import { isEventAttr } from '../is'; +import { AlinsVar } from './import-manager'; // ! 此处是因为 jsx 被转译之后无法根据原始path replace /* @@ -19,7 +20,7 @@ b = 2; // ! 导致此处变更不能修改之前的结构 JsxScope 是先从最里层遍历的 */ -const ExcludeDecoMap = {class: 1, style: 1}; +const ExcludeDecoMap = { class: 1, style: 1 }; const ModelTag = { input: 1, select: 1, textarea: 1, @@ -113,7 +114,7 @@ export class JsxScope { variable.path.parent.kind = 'let'; } v.expression = t.arrowFunctionExpression( - [t.identifier('_$ref')], + [ t.identifier('_$ref') ], skipNode(t.assignmentExpression('=', exp, t.identifier('_$ref'))) ); } @@ -153,7 +154,7 @@ export class JsxScope { let deco = ''; let isEvent = false; - + // ! 处理事件包裹 const checkEventAttr = () => { if (!isFuncExpression(expression) && isEventAttr(name)) { @@ -213,13 +214,10 @@ export class JsxScope { } else if (expression.type === 'MemberExpression') { const object = parseFirstMemberObject(expression); this.module.markVarChange(object.name); - const computedExp = t.callExpression( - createMemberExp(Names.CtxFn, Names.ComputedFullFn), - [ - t.arrowFunctionExpression([], expression), - t.arrowFunctionExpression([t.identifier('v')], t.assignmentExpression('=', expression, t.identifier('v'))), - ] - ); + const computedExp = createCtxCall(AlinsVar.ComputedShort, [ + t.arrowFunctionExpression([], expression), + t.arrowFunctionExpression([ t.identifier('v') ], t.assignmentExpression('=', expression, t.identifier('v'))), + ]); if (newExpression === expression) { newExpression = computedExp; } else { diff --git a/packages/compiler-core/src/controller/map.ts b/packages/compiler-core/src/controller/map.ts index be54644..9b5cb0e 100644 --- a/packages/compiler-core/src/controller/map.ts +++ b/packages/compiler-core/src/controller/map.ts @@ -5,11 +5,12 @@ */ // map 方法中有返回值为jsx时 对map进行转译 -import type {CallExpression} from '@babel/types'; -import type {Module} from '../context'; -import {isOriginJSXElement} from '../is'; -import {createCtxCall, getT, parseFirstMemberObject} from '../parse-utils'; -import {ControlScope} from './control-scope'; +import type { CallExpression } from '@babel/types'; +import type { Module } from '../context'; +import { isOriginJSXElement } from '../is'; +import { createCtxCall, getT, parseFirstMemberObject } from '../parse-utils'; +import { ControlScope } from './control-scope'; +import { AlinsVar } from './import-manager'; export class MapScope extends ControlScope { @@ -62,7 +63,7 @@ export class MapScope extends ControlScope { // t.stringLiteral(this.indexKeyName), // ); this.path.replaceWith( - createCtxCall('mm', [ + createCtxCall(AlinsVar.MockMap, [ // @ts-ignore node.callee.object, ...this.path.node.arguments, diff --git a/packages/compiler-core/src/controller/switch-scope.ts b/packages/compiler-core/src/controller/switch-scope.ts index 5f970d2..ca8f9c5 100644 --- a/packages/compiler-core/src/controller/switch-scope.ts +++ b/packages/compiler-core/src/controller/switch-scope.ts @@ -3,11 +3,11 @@ * @Date: 2023-07-14 17:39:29 * @Description: Coding something */ -import type {Statement, SwitchStatement} from '@babel/types'; -import {getT, traverseSwitchStatement} from '../parse-utils'; +import type { Statement, SwitchStatement } from '@babel/types'; +import { getT, traverseSwitchStatement } from '../parse-utils'; -import {ControlScope} from './control-scope'; -import {createScopeStack} from './scope-stack'; +import { ControlScope } from './control-scope'; +import { createScopeStack } from './scope-stack'; export class SwitchScope extends ControlScope { @@ -15,7 +15,7 @@ export class SwitchScope extends ControlScope { _init () { SwitchScope.ScopeStack.newNode(this); - const {endFunc, node, isReturnJsx} = traverseSwitchStatement(this.path.node); + const { endFunc, node, isReturnJsx } = traverseSwitchStatement(this.path.node); if (isReturnJsx) { this.markScopeReturnJsx(); } diff --git a/packages/compiler-core/src/index.ts b/packages/compiler-core/src/index.ts index 5f0361b..d80666a 100644 --- a/packages/compiler-core/src/index.ts +++ b/packages/compiler-core/src/index.ts @@ -15,7 +15,7 @@ export function randomTsxFileName () { export type IAlinsParser = (code: string, options?: IParserOptions) => string; -export {createNodeVisitor, createBabelPluginAlins} from './transform'; +export { createNodeVisitor, createBabelPluginAlins } from './transform'; // import type {Node} from '@babel/traverse'; diff --git a/packages/compiler-core/src/is.ts b/packages/compiler-core/src/is.ts index 02525ad..a7a7542 100644 --- a/packages/compiler-core/src/is.ts +++ b/packages/compiler-core/src/is.ts @@ -3,8 +3,8 @@ * @Date: 2023-07-11 16:43:11 * @Description: Coding something */ -import type {NodePath} from '@babel/traverse'; -import type {BlockStatement, CallExpression, FunctionDeclaration, JSXElement, Node, VariableDeclarator} from '@babel/types'; +import type { NodePath } from '@babel/traverse'; +import type { BlockStatement, CallExpression, FunctionDeclaration, JSXElement, Node, VariableDeclarator } from '@babel/types'; // export function isFuncParameter (path: NodePath) { @@ -13,7 +13,7 @@ import type {BlockStatement, CallExpression, FunctionDeclaration, JSXElement, No export function isJSXElement (node: Node) { return node.type === 'CallExpression' && isJsxCallee(node); } - + export function isJsxCallee (node: CallExpression) { const callee = node.callee; if (!callee) return false; @@ -245,4 +245,18 @@ export function isEventEmptyDeco (name: string, deco: string, value: any) { export function isArrayMapCall (node: CallExpression) { // @ts-ignore return node.callee?.property?.name === 'map'; +} + +export function isBlockBreak (elements: any[]) { + for (let i = elements.length - 1; i >= 0; i--) { + const node = elements[i]; + if (node.type === 'BreakStatement') { + return true; + } else if (node.type === 'BlockStatement') { + if (isBlockBreak(node.body)) { + return true; + } + } + } + return false; } \ No newline at end of file diff --git a/packages/compiler-core/src/parse-utils.ts b/packages/compiler-core/src/parse-utils.ts index 8c3483f..d1ee341 100644 --- a/packages/compiler-core/src/parse-utils.ts +++ b/packages/compiler-core/src/parse-utils.ts @@ -3,7 +3,7 @@ * @Date: 2023-06-29 15:18:14 * @Description: Coding something */ -import type {NodePath} from '@babel/traverse'; +import type { NodePath } from '@babel/traverse'; import type { BlockStatement, CallExpression, @@ -19,61 +19,10 @@ import type { JSXAttribute, ObjectProperty } from '@babel/types'; -import type {IBabelType} from './types'; -import {BlockReturnType, isBlockReturned, isEventEmptyDeco} from './is'; -import type {Module} from './context'; - -export const ImportScope = (() => { - let fn: any = null; - let count = 0; - return { - regist (_fn: any) { - fn = _fn; - }, - use () { - count ++; - }, - unuse () { - count --; - }, - trigger () { - if (count > 0)fn?.(); - fn = null; - count = 0; - }, - }; -})(); - -let currentCtx: any = null; - -export const Names = { - _Ctx: '_$', - AliasPrefix: '_$', - _CtxFn: '_$$', - get CtxFn () { - ImportScope.use(); - return this._CtxFn; - }, - ReactFn: 'r', - ComputedFn: 'c', - ComputedFullFn: 'cc', - WatchFn: 'w', - CreateElementFn: 'ce', - Value: 'v', - TempResult: '_$R', - ExtendFn: 'e', - ExtendCompFn: 'es', - get Ctx () { - // 部分使用ctx时候并不是在当前作用域 - // 比如因为有赋值导致的react和computed - const ctx = currentCtx; - // console.log('AlinsCtx use', ctx); - // if (!ctx) debugger; - if (!ctx._used) ctx._used = true; - return this._Ctx; - }, -}; - +import type { IBabelType } from './types'; +import { BlockReturnType, isBlockBreak, isBlockReturned, isEventEmptyDeco } from './is'; +import type { Module } from './context'; +import { AlinsStr, AlinsVar, ImportManager } from './controller/import-manager'; export let t: IBabelType; @@ -131,26 +80,6 @@ export function createVarDeclarator (id: string, init: any) { init, ); } -let id = 0; -export function createAlinsCtx () { - // console.log('AlinsCtx 111', top); - currentCtx = t.variableDeclaration( - 'const', - [ - t.variableDeclarator( - t.identifier(Names._Ctx), - t.callExpression( - t.identifier(Names.CtxFn), - [] - ), - ) - ] - ); - currentCtx._isCtx = true; - currentCtx.id = id++; - currentCtx._skip = false; - return currentCtx; -} export function createMemberExp (id: string, prop: string) { return t.memberExpression( @@ -159,23 +88,19 @@ export function createMemberExp (id: string, prop: string) { ); } -export function createElementMember () { - return createMemberExp(Names.CtxFn, Names.CreateElementFn); -} - export function replaceJsxDomCreator (path: NodePath) { - return createCtxCall(Names.CreateElementFn, path.node.arguments); + return createCtxCall(AlinsVar.Create, path.node.arguments); } // ! 暂时先全部用v包裹 后续优化 export function createReadValue (idName: string) { - const node = createMemberExp(idName, Names.Value); + const node = createMemberExp(idName, AlinsStr.Value); // @ts-ignore node._skip = true; return node; } -export function createFullComputed (get: any, set: any) { +function createFullComputed (get: any, set: any) { return t.objectExpression([ t.objectProperty(t.identifier('get'), get), t.objectProperty(t.identifier('set'), set), @@ -184,7 +109,7 @@ export function createFullComputed (get: any, set: any) { export function createComputed (node: VariableDeclarator) { const get = t.arrowFunctionExpression([], node.init as any); - let target: any; ; + let target: any; // @ts-ignore if (node._computedSet) { // @ts-ignore @@ -199,12 +124,12 @@ export function createComputed (node: VariableDeclarator) { } function createComputeCall (fn?: any) { - return createCtxCall(Names.ComputedFn, [fn]); + return createCtxCall(AlinsVar.Computed, [ fn ]); } -export function createCtxCall (name: string, args: any[]) { +export function createCtxCall (name: AlinsVar, args: any[]) { return t.callExpression( - createMemberExp(Names.CtxFn, name), + ImportManager.use(name), args ); } @@ -224,7 +149,7 @@ export function createJsxCompute (node: Expression|JSXExpressionContainer, isCom ); if (exp.type === 'UpdateExpression') { - call = createCtxCall('mu', [call]); + call = createCtxCall(AlinsVar.MarkUpdate, [ call ]); } // 标注当前是否在JSX组件中,组件中需要被转成 _$$.c() @@ -251,20 +176,13 @@ export function createReact (node: VariableDeclarator) { // ); // debugger; // console.log('wrap react-------', node.id.name); - const args: any[] = [ - t.objectExpression( - [ t.objectProperty( - t.identifier(Names.Value), - node.init as any - ) ] - ) - ]; + const args: any[] = [ node.init ]; if (node._isShallow) { args.push(t.booleanLiteral(true)); } return skipNode(t.variableDeclarator( node.id, - createCtxCall(Names.ReactFn, args), + createCtxCall(AlinsVar.React, args), )); } @@ -342,9 +260,9 @@ export function createUnfInit () { export function createExportAliasInit (alias: string, name: string) { // _$.w(()=> x.v, (v)=>x=v, false).v; - const v = Names.Value; + const v = AlinsStr.Value; return t.memberExpression( - createCtxCall(Names.WatchFn, [ + createCtxCall(AlinsVar.Watch, [ t.arrowFunctionExpression([], createMemberExp(alias, v)), t.arrowFunctionExpression([], t.assignmentExpression('=', t.identifier(name), t.identifier(v))), t.booleanLiteral(false), @@ -353,17 +271,6 @@ export function createExportAliasInit (alias: string, name: string) { ); } -// export function replaceIfStatement () { -// return t.callExpression( -// createMemberExp(Names.Ctx, 'if'), -// [ -// t.arrowFunctionExpression([], createMemberExp(alias, v)), -// t.arrowFunctionExpression([], t.assignmentExpression('=', t.identifier(name), t.identifier(v))), -// t.booleanLiteral(false), -// ] -// ); -// } - function transformToBlock (body: any) { // 对于没有{}的语句 进行block包裹 if (body.type !== 'BlockStatement') { @@ -373,7 +280,7 @@ function transformToBlock (body: any) { return body; } -export function traverseIfStatement (node: IfStatement, map: any = {elif: []}, i = 0) { +export function traverseIfStatement (node: IfStatement, map: any = { elif: [] }, i = 0) { // @ts-ignore node._traversed = true; @@ -435,35 +342,57 @@ export function createSetAsyncArrowFunc (body: BlockStatement) { export function traverseSwitchStatement (node: SwitchStatement) { const discr = t.arrowFunctionExpression([], node.discriminant); let isReturnJsx = false; + + + let childrenList: any[][] = []; + let isLastBreak = true; + const cases = t.arrayExpression(node.cases.map(item => { - const {test, consequent: cons} = item; - let body: any = []; + const { test, consequent: cons } = item; + const bodyArr: any = []; for (const single of cons) { if (single.type === 'BlockStatement') { - body.push(...single.body); + bodyArr.push(...single.body); } else if (single.type === 'EmptyStatement') { continue; } else { - body.push(single); + bodyArr.push(single); } } - body = transformToBlock(body); + const body = transformToBlock(bodyArr); + const returnType = isBlockReturned(body); + if (!isReturnJsx) { - isReturnJsx = (isBlockReturned(body) === BlockReturnType.Jsx); + isReturnJsx = (returnType === BlockReturnType.Jsx); + } + + const isBreak = !!returnType || isBlockBreak(bodyArr); + if (!isLastBreak) { + childrenList.forEach(item => {item.push(...bodyArr);}); + } + if (!isBreak) { + childrenList.push(bodyArr); + } else { + childrenList = []; } - let array = t.arrayExpression([ + isLastBreak = isBreak; + + const array = t.arrayExpression([ // ! !test 为 default !test ? t.nullLiteral() : test, body.length === 0 ? t.nullLiteral() : t.arrowFunctionExpression([], body), ]); - // @ts-ignore - item._setBrk = () => { + if (isBreak) { array.elements.push(t.booleanLiteral(true)); - // @ts-ignore - item._setBrk = null; - // @ts-ignore - array = null; - }; + } + // // @ts-ignore + // item._setBrk = () => { + + // // @ts-ignore + // item._setBrk = null; + // // @ts-ignore + // array = null; + // }; return array; })); @@ -472,10 +401,10 @@ export function traverseSwitchStatement (node: SwitchStatement) { endFunc, isReturnJsx, node: t.callExpression( - t.memberExpression(t.callExpression( - createMemberExp(Names.Ctx, 'switch'), - [ discr, cases ] - ), t.identifier('end')), + t.memberExpression( + createCtxCall(AlinsVar.Switch, [ discr, cases ]), + t.identifier('end') + ), [ endFunc ] ) }; @@ -508,26 +437,13 @@ export function markMNR (fn: any, returnJsxCall?: ()=>void) { if (!returnType) { fn._mnrMarked = true; // ! 标注是否有返回值 - return createCtxCall('mnr', [fn]); + return createCtxCall(AlinsVar.MNR, [ fn ]); } else if (returnType === BlockReturnType.Jsx) { returnJsxCall?.(); } return fn; } -export function createImportAlins (useImport = true) { - return useImport ? - t.importDeclaration([ - t.importSpecifier(t.identifier('_$$'), t.identifier('_$$')) - ], t.stringLiteral('alins')) : - t.variableDeclaration('const', [ - t.variableDeclarator(t.identifier('_$$'), t.memberExpression( - t.memberExpression(t.identifier('window'), t.identifier('Alins')), - t.identifier('_$$'), - )) - ]); -} - export function parseComputedSet (path: NodePath) { // ! computed set 解析 const next = path.getNextSibling(); @@ -556,13 +472,13 @@ export function parseComputedSet (path: NodePath) { } export function extendCallee (isComp: boolean) { - return createMemberExp(Names.CtxFn, isComp ? Names.ExtendCompFn : Names.ExtendFn); + return ImportManager.use(isComp ? AlinsVar.ExtendComp : AlinsVar.Extend); } export function createExtendCalleeWrap (arg: any, isComp: boolean) { return t.callExpression( extendCallee(isComp), - [arg] + [ arg ] ); } @@ -588,7 +504,7 @@ export function parseAttributes (attrs: JSXAttribute[], handleReactive?: boolean export function parseJsxAttrShort (path: NodePath) { const nodeValue = path.node.value; if (nodeValue) return false; - + const newAttr = createNewJSXAttribute(path.node); if (newAttr) { path.replaceWith(newAttr); @@ -645,7 +561,7 @@ export function createWrapAttr (name: string, value: any, wrap = false, handleRe export function getObjectPropValue (node: ObjectProperty, mock = false) { const value = node.value; if (value.type === 'AssignmentPattern') { - if (mock) value.right = createCtxCall('mf', [value.right]); + if (mock) value.right = createCtxCall(AlinsVar.MockRef, [ value.right ]); return value.left; } return value; diff --git a/packages/compiler-core/src/scope.ts b/packages/compiler-core/src/scope.ts index d87e3fe..d7f87fc 100644 --- a/packages/compiler-core/src/scope.ts +++ b/packages/compiler-core/src/scope.ts @@ -4,7 +4,7 @@ * @Description: Coding something */ -import type {NodePath} from '@babel/traverse'; +import type { NodePath } from '@babel/traverse'; import type { Expression, FunctionDeclaration, @@ -15,18 +15,19 @@ import type { VariableDeclaration, VariableDeclarator, } from '@babel/types'; -import {IfScope} from './controller/if-scope'; -import {isArrayMapCall, isFuncExpression, isNeedComputed, isObjectAssignDeclarator} from './is'; -import {JsxScope} from './controller/jsx-scope'; +import { IfScope } from './controller/if-scope'; +import { isArrayMapCall, isFuncExpression, isNeedComputed, isObjectAssignDeclarator } from './is'; +import { JsxScope } from './controller/jsx-scope'; import { isStaticNode, createReact, createComputed, createJsxCompute, createReadValue, - Names, createVarDeclarator, createVarDeclaration, createExportAliasInit, getT, + createVarDeclarator, createVarDeclaration, createExportAliasInit, getT, skipNode } from './parse-utils'; -import {SwitchScope} from './controller/switch-scope'; -import {Module} from './context'; -import {INodeTypeMap} from './types'; -import {FuncReactiveScope} from './controller/func-reactive'; +import { SwitchScope } from './controller/switch-scope'; +import { Module } from './context'; +import { INodeTypeMap } from './types'; +import { FuncReactiveScope } from './controller/func-reactive'; +import { AlinsStr } from './controller/import-manager'; const NodeNeedHandleVarMap: INodeTypeMap = { 'JSXElement': 1, @@ -332,7 +333,7 @@ export class Scope { const node = variable.path.node; // @ts-ignore if (node._export) { - variable.alias = `${Names.AliasPrefix}${variable.name}`; + variable.alias = `${AlinsStr.Prefix}${variable.name}`; // @ts-ignore node._parentPath.insertBefore( createVarDeclaration(variable.type, [ createVarDeclarator(variable.alias, newNode.init) ]) @@ -498,7 +499,7 @@ export class Scope { const t = getT(); sp.replaceWith(skipNode(t.memberExpression( sp.node, - t.identifier(Names.Value) + t.identifier(AlinsStr.Value) ))); } } else { diff --git a/packages/compiler-core/src/transform.ts b/packages/compiler-core/src/transform.ts index 61adb46..0358a26 100644 --- a/packages/compiler-core/src/transform.ts +++ b/packages/compiler-core/src/transform.ts @@ -1,15 +1,16 @@ -import type {NodePath, TraverseOptions} from '@babel/traverse'; -import type {Program} from '@babel/types'; -import type {IBabelType} from './types'; -import {parseCommentMulti, parseVarDeclCommentReactive} from './comment'; -import {parseInnerComponent} from './component/component'; -import {currentModule as ctx, enterContext, exitContext} from './context'; +import type { NodePath, TraverseOptions } from '@babel/traverse'; +import type { Program } from '@babel/types'; +import type { IBabelType } from './types'; +import { parseCommentMulti, parseVarDeclCommentReactive } from './comment'; +import { parseInnerComponent } from './component/component'; +import { currentModule as ctx, enterContext, exitContext } from './context'; import { - createAlinsCtx, createEmptyString, createExtendCalleeWrap, createImportAlins, createUnfInit, - extendCallee, getObjectPropValue, getT, ImportScope, initTypes, ModArrayFunc, parseComputedSet, parseFirstMemberObject, + createEmptyString, createExtendCalleeWrap, createUnfInit, + extendCallee, getObjectPropValue, getT, initTypes, ModArrayFunc, parseComputedSet, parseFirstMemberObject, } from './parse-utils'; -import {isJsxExtendCall, isJsxExtendDef, isOriginJSXElement} from './is'; +import { isJsxExtendCall, isJsxExtendDef, isOriginJSXElement } from './is'; +import { ImportManager } from './controller/import-manager'; export function createNodeVisitor (t: IBabelType, useImport = true) { initTypes(t); @@ -20,25 +21,16 @@ export function createNodeVisitor (t: IBabelType, useImport = true) { const body = path.node.body; for (let i = 0; i < body.length; i++) { if (body[i]?.type !== 'ImportDeclaration') { - body.splice(i, 0, createAlinsCtx()); - if (!useImport) { - ImportScope.regist(() => { - body.splice(i, 0, createImportAlins(useImport)); - }); - } + body.splice(i, 0, ImportManager.init(useImport, () => { + body.splice(i, 1); + })); break; } } - - if (useImport) { - ImportScope.regist(() => { - body.unshift(createImportAlins()); - }); - } }, exit () { exitContext(); - ImportScope.trigger(); + ImportManager.exitModule(); } }, ImportDeclaration: (path) => { @@ -116,13 +108,9 @@ export function createNodeVisitor (t: IBabelType, useImport = true) { path.skip(); return; } - + parseVarDeclCommentReactive(path.node); - if (path.node._isCtx) { // ! 是否是生成的alins ctx - path.node._isCtx = false; - ctx.ctx = path; - } if (!ctx.enter(path)) return; // ! computed set 解析 @@ -166,6 +154,7 @@ export function createNodeVisitor (t: IBabelType, useImport = true) { if (!ctx.enter(path)) return; // todo init = null 时 设置为 void 0; // if (path.node.id.name === 'c') debugger; + if (path.node.id.type === 'ObjectPattern') return; ctx.collectVar(path); }, exit () { @@ -387,16 +376,16 @@ export function createNodeVisitor (t: IBabelType, useImport = true) { BreakStatement (path) { // console.log(ctx.curScope); if (ctx.curScope.inIf || ctx.curScope.inSwitch) { - if (ctx.curScope.inSwitch) { - if (path.parent.type === 'SwitchCase') { - // @ts-ignore - path.parent._setBrk?.(); - } else { - const parent = path.findParent(node => node.type === 'SwitchCase'); - // @ts-ignore - parent?.node._setBrk?.(); - } - } + // if (ctx.curScope.inSwitch) { + // if (path.parent.type === 'SwitchCase') { + // // @ts-ignore + // path.parent._setBrk?.(); + // } else { + // const parent = path.findParent(node => node.type === 'SwitchCase'); + // // @ts-ignore + // parent?.node._setBrk?.(); + // } + // } path.replaceWith(getT().returnStatement()); } } diff --git a/packages/compiler-core/src/types.d.ts b/packages/compiler-core/src/types.d.ts index b8ad408..72f5f1f 100644 --- a/packages/compiler-core/src/types.d.ts +++ b/packages/compiler-core/src/types.d.ts @@ -18,7 +18,6 @@ declare module '@babel/types' { interface CommonNode { _isReplace?: boolean; // 是否是完全赋值 const a=b; _isForUpdate?: boolean; // 是否是for循环的初始化_isCtx - _isCtx?: boolean; // ! 是否是生成的alins ctx _shouldRemoved?: boolean; // 是否需要标记在exit时删除node _importReactive?: '' | '*' | string[]; // import 语句标记是否是reactive _isComReact?: boolean; // 是否标记为reactive diff --git a/packages/compiler-web/src/babel.min.d.ts b/packages/compiler-web/src/babel.min.d.ts new file mode 100644 index 0000000..67f2449 --- /dev/null +++ b/packages/compiler-web/src/babel.min.d.ts @@ -0,0 +1,13 @@ +/* + * @Author: chenzhongsheng + * @Date: 2023-09-06 16:20:04 + * @Description: Coding something + */ +// ! 模改babel-standalone 目的是为了去掉babel内部自动执行 text/babel 的逻辑 + +declare const Babel: { + transform(code: string, options: any): {code: string}; + registerPlugin(name: string, plugin: any): void; +}; + +export default Babel; \ No newline at end of file diff --git a/packages/compiler-web/src/babel.min.js b/packages/compiler-web/src/babel.min.js new file mode 100644 index 0000000..e7e44db --- /dev/null +++ b/packages/compiler-web/src/babel.min.js @@ -0,0 +1,121276 @@ +export default (function(){ + 'use strict'; + var exports = {}; + var _babel = /*#__PURE__*/Object.freeze({ + __proto__: null, + get version () { return version$1; }, + get types () { return t$8; }, + get loadOptionsSync () { return loadOptionsSync; }, + get DEFAULT_EXTENSIONS () { return DEFAULT_EXTENSIONS; }, + get File () { return File; }, + get buildExternalHelpers () { return babelBuildExternalHelpers; }, + get resolvePlugin () { return resolvePlugin; }, + get resolvePreset () { return resolvePreset; }, + get getEnv () { return getEnv; }, + get tokTypes () { return tokTypes; }, + get traverse () { return traverse; }, + get template () { return template$2; }, + get createConfigItem () { return createConfigItem; }, + get createConfigItemSync () { return createConfigItemSync; }, + get createConfigItemAsync () { return createConfigItemAsync; }, + get loadPartialConfig () { return loadPartialConfig; }, + get loadPartialConfigSync () { return loadPartialConfigSync; }, + get loadPartialConfigAsync () { return loadPartialConfigAsync; }, + get loadOptions () { return loadOptions; }, + get loadOptionsAsync () { return loadOptionsAsync; }, + get transform () { return transform$3; }, + get transformSync () { return transformSync; }, + get transformAsync () { return transformAsync; }, + get transformFile () { return transformFile; }, + get transformFileSync () { return transformFileSync; }, + get transformFileAsync () { return transformFileAsync; }, + get transformFromAst () { return transformFromAst$1; }, + get transformFromAstSync () { return transformFromAstSync; }, + get transformFromAstAsync () { return transformFromAstAsync; }, + get parse () { return parse$1; }, + get parseSync () { return parseSync; }, + get parseAsync () { return parseAsync; } + }); + + function _iterableToArrayLimit(arr, i) { + var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; + if (null != _i) { + var _s, + _e, + _x, + _r, + _arr = [], + _n = !0, + _d = !1; + try { + if (_x = (_i = _i.call(arr)).next, 0 === i) { + if (Object(_i) !== _i) return; + _n = !1; + } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); + } catch (err) { + _d = !0, _e = err; + } finally { + try { + if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; + } finally { + if (_d) throw _e; + } + } + return _arr; + } + } + function _regeneratorRuntime() { + _regeneratorRuntime = function () { + return exports; + }; + var exports = {}, + Op = Object.prototype, + hasOwn = Op.hasOwnProperty, + defineProperty = Object.defineProperty || function (obj, key, desc) { + obj[key] = desc.value; + }, + $Symbol = "function" == typeof Symbol ? Symbol : {}, + iteratorSymbol = $Symbol.iterator || "@@iterator", + asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", + toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + function define(obj, key, value) { + return Object.defineProperty(obj, key, { + value: value, + enumerable: !0, + configurable: !0, + writable: !0 + }), obj[key]; + } + try { + define({}, ""); + } catch (err) { + define = function (obj, key, value) { + return obj[key] = value; + }; + } + function wrap(innerFn, outerFn, self, tryLocsList) { + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, + generator = Object.create(protoGenerator.prototype), + context = new Context(tryLocsList || []); + return defineProperty(generator, "_invoke", { + value: makeInvokeMethod(innerFn, self, context) + }), generator; + } + function tryCatch(fn, obj, arg) { + try { + return { + type: "normal", + arg: fn.call(obj, arg) + }; + } catch (err) { + return { + type: "throw", + arg: err + }; + } + } + exports.wrap = wrap; + var ContinueSentinel = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var IteratorPrototype = {}; + define(IteratorPrototype, iteratorSymbol, function () { + return this; + }); + var getProto = Object.getPrototypeOf, + NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); + var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function (method) { + define(prototype, method, function (arg) { + return this._invoke(method, arg); + }); + }); + } + function AsyncIterator(generator, PromiseImpl) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if ("throw" !== record.type) { + var result = record.arg, + value = result.value; + return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { + invoke("next", value, resolve, reject); + }, function (err) { + invoke("throw", err, resolve, reject); + }) : PromiseImpl.resolve(value).then(function (unwrapped) { + result.value = unwrapped, resolve(result); + }, function (error) { + return invoke("throw", error, resolve, reject); + }); + } + reject(record.arg); + } + var previousPromise; + defineProperty(this, "_invoke", { + value: function (method, arg) { + function callInvokeWithMethodAndArg() { + return new PromiseImpl(function (resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(innerFn, self, context) { + var state = "suspendedStart"; + return function (method, arg) { + if ("executing" === state) throw new Error("Generator is already running"); + if ("completed" === state) { + if ("throw" === method) throw arg; + return doneResult(); + } + for (context.method = method, context.arg = arg;;) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { + if ("suspendedStart" === state) throw state = "completed", context.arg; + context.dispatchException(context.arg); + } else "return" === context.method && context.abrupt("return", context.arg); + state = "executing"; + var record = tryCatch(innerFn, self, context); + if ("normal" === record.type) { + if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; + return { + value: record.arg, + done: context.done + }; + } + "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); + } + }; + } + function maybeInvokeDelegate(delegate, context) { + var methodName = context.method, + method = delegate.iterator[methodName]; + if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; + var record = tryCatch(method, delegate.iterator, context.arg); + if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; + var info = record.arg; + return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); + } + function pushTryEntry(locs) { + var entry = { + tryLoc: locs[0] + }; + 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); + } + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal", delete record.arg, entry.completion = record; + } + function Context(tryLocsList) { + this.tryEntries = [{ + tryLoc: "root" + }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); + } + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) return iteratorMethod.call(iterable); + if ("function" == typeof iterable.next) return iterable; + if (!isNaN(iterable.length)) { + var i = -1, + next = function next() { + for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; + return next.value = undefined, next.done = !0, next; + }; + return next.next = next; + } + } + return { + next: doneResult + }; + } + function doneResult() { + return { + value: undefined, + done: !0 + }; + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), defineProperty(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { + var ctor = "function" == typeof genFun && genFun.constructor; + return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); + }, exports.mark = function (genFun) { + return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; + }, exports.awrap = function (arg) { + return { + __await: arg + }; + }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { + return this; + }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { + void 0 === PromiseImpl && (PromiseImpl = Promise); + var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); + return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { + return result.done ? result.value : iter.next(); + }); + }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { + return this; + }), define(Gp, "toString", function () { + return "[object Generator]"; + }), exports.keys = function (val) { + var object = Object(val), + keys = []; + for (var key in object) keys.push(key); + return keys.reverse(), function next() { + for (; keys.length;) { + var key = keys.pop(); + if (key in object) return next.value = key, next.done = !1, next; + } + return next.done = !0, next; + }; + }, exports.values = values, Context.prototype = { + constructor: Context, + reset: function (skipTempReset) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); + }, + stop: function () { + this.done = !0; + var rootRecord = this.tryEntries[0].completion; + if ("throw" === rootRecord.type) throw rootRecord.arg; + return this.rval; + }, + dispatchException: function (exception) { + if (this.done) throw exception; + var context = this; + function handle(loc, caught) { + return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; + } + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i], + record = entry.completion; + if ("root" === entry.tryLoc) return handle("end"); + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"), + hasFinally = hasOwn.call(entry, "finallyLoc"); + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); + if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); + } else if (hasCatch) { + if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); + } else { + if (!hasFinally) throw new Error("try statement without catch or finally"); + if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); + } + } + } + }, + abrupt: function (type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); + var record = finallyEntry ? finallyEntry.completion : {}; + return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); + }, + complete: function (record, afterLoc) { + if ("throw" === record.type) throw record.arg; + return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; + }, + finish: function (finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; + } + }, + catch: function (tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if ("throw" === record.type) { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + throw new Error("illegal catch attempt"); + }, + delegateYield: function (iterable, resultName, nextLoc) { + return this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }, "next" === this.method && (this.arg = undefined), ContinueSentinel; + } + }, exports; + } + function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + if (info.done) { + resolve(value); + } else { + Promise.resolve(value).then(_next, _throw); + } + } + function _asyncToGenerator(fn) { + return function () { + var self = this, + args = arguments; + return new Promise(function (resolve, reject) { + var gen = fn.apply(self, args); + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + _next(undefined); + }); + }; + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); + } + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct.bind(); + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + return _construct.apply(null, arguments); + } + function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; + } + function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + _cache.set(Class, Wrapper); + } + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + return _wrapNativeSuper(Class); + } + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; + } + function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for (i = 0; i < sourceSymbolKeys.length; i++) { + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; + } + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return self; + } + function _taggedTemplateLiteralLoose(strings, raw) { + if (!raw) { + raw = strings.slice(0); + } + strings.raw = raw; + return strings; + } + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _createForOfIteratorHelperLoose(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (it) return (it = it.call(o)).next.bind(it); + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _toPrimitive(input, hint) { + if (typeof input !== "object" || input === null) return input; + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (typeof res !== "object") return res; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (hint === "string" ? String : Number)(input); + } + function _toPropertyKey(arg) { + var key = _toPrimitive(arg, "string"); + return typeof key === "symbol" ? key : String(key); + } + + var ReferencedIdentifier$1 = ["Identifier", "JSXIdentifier"]; + var ReferencedMemberExpression = ["MemberExpression"]; + var BindingIdentifier = ["Identifier"]; + var Statement = ["Statement"]; + var Expression = ["Expression"]; + var Scope$2 = ["Scopable", "Pattern"]; + var Referenced = null; + var BlockScoped = null; + var Var = ["VariableDeclaration"]; + var User = null; + var Generated = null; + var Pure = null; + var Flow = ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"]; + var RestProperty$1 = ["RestElement"]; + var SpreadProperty$1 = ["RestElement"]; + var ExistentialTypeParam = ["ExistsTypeAnnotation"]; + var NumericLiteralTypeAnnotation = ["NumberLiteralTypeAnnotation"]; + var ForAwaitStatement = ["ForOfStatement"]; + + var virtualTypes = /*#__PURE__*/Object.freeze({ + __proto__: null, + ReferencedIdentifier: ReferencedIdentifier$1, + ReferencedMemberExpression: ReferencedMemberExpression, + BindingIdentifier: BindingIdentifier, + Statement: Statement, + Expression: Expression, + Scope: Scope$2, + Referenced: Referenced, + BlockScoped: BlockScoped, + Var: Var, + User: User, + Generated: Generated, + Pure: Pure, + Flow: Flow, + RestProperty: RestProperty$1, + SpreadProperty: SpreadProperty$1, + ExistentialTypeParam: ExistentialTypeParam, + NumericLiteralTypeAnnotation: NumericLiteralTypeAnnotation, + ForAwaitStatement: ForAwaitStatement + }); + + function shallowEqual$2(actual, expected) { + var keys = Object.keys(expected); + for (var _i = 0, _keys = keys; _i < _keys.length; _i++) { + var key = _keys[_i]; + if (actual[key] !== expected[key]) { + return false; + } + } + return true; + } + + var warnings = new Set(); + function deprecationWarning$1(oldName, newName, prefix) { + if (prefix === void 0) { + prefix = ""; + } + if (warnings.has(oldName)) return; + warnings.add(oldName); + var _captureShortStackTra = captureShortStackTrace(1, 2), + internal = _captureShortStackTra.internal, + trace = _captureShortStackTra.trace; + if (internal) { + return; + } + console.warn(prefix + "`" + oldName + "` has been deprecated, please migrate to `" + newName + "`\n" + trace); + } + function captureShortStackTrace(skip, length) { + var stackTraceLimit = Error.stackTraceLimit, + prepareStackTrace = Error.prepareStackTrace; + var stackTrace; + Error.stackTraceLimit = 1 + skip + length; + Error.prepareStackTrace = function (err, stack) { + stackTrace = stack; + }; + new Error().stack; + Error.stackTraceLimit = stackTraceLimit; + Error.prepareStackTrace = prepareStackTrace; + if (!stackTrace) return { + internal: false, + trace: "" + }; + var shortStackTrace = stackTrace.slice(1 + skip, 1 + skip + length); + return { + internal: /[\\/]@babel[\\/]/.test(shortStackTrace[1].getFileName()), + trace: shortStackTrace.map(function (frame) { + return " at " + frame; + }).join("\n") + }; + } + + function isArrayExpression$2(node, opts) { + if (!node) return false; + if (node.type !== "ArrayExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isAssignmentExpression$4(node, opts) { + if (!node) return false; + if (node.type !== "AssignmentExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isBinaryExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "BinaryExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isInterpreterDirective(node, opts) { + if (!node) return false; + if (node.type !== "InterpreterDirective") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDirective(node, opts) { + if (!node) return false; + if (node.type !== "Directive") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDirectiveLiteral(node, opts) { + if (!node) return false; + if (node.type !== "DirectiveLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isBlockStatement$2(node, opts) { + if (!node) return false; + if (node.type !== "BlockStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isBreakStatement(node, opts) { + if (!node) return false; + if (node.type !== "BreakStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isCallExpression$8(node, opts) { + if (!node) return false; + if (node.type !== "CallExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isCatchClause(node, opts) { + if (!node) return false; + if (node.type !== "CatchClause") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isConditionalExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "ConditionalExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isContinueStatement(node, opts) { + if (!node) return false; + if (node.type !== "ContinueStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDebuggerStatement(node, opts) { + if (!node) return false; + if (node.type !== "DebuggerStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDoWhileStatement(node, opts) { + if (!node) return false; + if (node.type !== "DoWhileStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEmptyStatement(node, opts) { + if (!node) return false; + if (node.type !== "EmptyStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isExpressionStatement$3(node, opts) { + if (!node) return false; + if (node.type !== "ExpressionStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isFile(node, opts) { + if (!node) return false; + if (node.type !== "File") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isForInStatement$1(node, opts) { + if (!node) return false; + if (node.type !== "ForInStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isForStatement$3(node, opts) { + if (!node) return false; + if (node.type !== "ForStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isFunctionDeclaration$2(node, opts) { + if (!node) return false; + if (node.type !== "FunctionDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isFunctionExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "FunctionExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isIdentifier$j(node, opts) { + if (!node) return false; + if (node.type !== "Identifier") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isIfStatement$2(node, opts) { + if (!node) return false; + if (node.type !== "IfStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isLabeledStatement(node, opts) { + if (!node) return false; + if (node.type !== "LabeledStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isStringLiteral$6(node, opts) { + if (!node) return false; + if (node.type !== "StringLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isNumericLiteral(node, opts) { + if (!node) return false; + if (node.type !== "NumericLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isNullLiteral$2(node, opts) { + if (!node) return false; + if (node.type !== "NullLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isBooleanLiteral(node, opts) { + if (!node) return false; + if (node.type !== "BooleanLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isRegExpLiteral$2(node, opts) { + if (!node) return false; + if (node.type !== "RegExpLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isLogicalExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "LogicalExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isMemberExpression$8(node, opts) { + if (!node) return false; + if (node.type !== "MemberExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isNewExpression$4(node, opts) { + if (!node) return false; + if (node.type !== "NewExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isProgram$1(node, opts) { + if (!node) return false; + if (node.type !== "Program") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isObjectExpression$3(node, opts) { + if (!node) return false; + if (node.type !== "ObjectExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isObjectMethod$1(node, opts) { + if (!node) return false; + if (node.type !== "ObjectMethod") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isObjectProperty$5(node, opts) { + if (!node) return false; + if (node.type !== "ObjectProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isRestElement$3(node, opts) { + if (!node) return false; + if (node.type !== "RestElement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isReturnStatement$1(node, opts) { + if (!node) return false; + if (node.type !== "ReturnStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isSequenceExpression$2(node, opts) { + if (!node) return false; + if (node.type !== "SequenceExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isParenthesizedExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "ParenthesizedExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isSwitchCase(node, opts) { + if (!node) return false; + if (node.type !== "SwitchCase") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isSwitchStatement$1(node, opts) { + if (!node) return false; + if (node.type !== "SwitchStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isThisExpression$2(node, opts) { + if (!node) return false; + if (node.type !== "ThisExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isThrowStatement$1(node, opts) { + if (!node) return false; + if (node.type !== "ThrowStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTryStatement(node, opts) { + if (!node) return false; + if (node.type !== "TryStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isUnaryExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "UnaryExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isUpdateExpression$2(node, opts) { + if (!node) return false; + if (node.type !== "UpdateExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isVariableDeclaration$3(node, opts) { + if (!node) return false; + if (node.type !== "VariableDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isVariableDeclarator$2(node, opts) { + if (!node) return false; + if (node.type !== "VariableDeclarator") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isWhileStatement$1(node, opts) { + if (!node) return false; + if (node.type !== "WhileStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isWithStatement(node, opts) { + if (!node) return false; + if (node.type !== "WithStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isAssignmentPattern$5(node, opts) { + if (!node) return false; + if (node.type !== "AssignmentPattern") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isArrayPattern$1(node, opts) { + if (!node) return false; + if (node.type !== "ArrayPattern") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isArrowFunctionExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "ArrowFunctionExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isClassBody$2(node, opts) { + if (!node) return false; + if (node.type !== "ClassBody") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isClassExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "ClassExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isClassDeclaration$2(node, opts) { + if (!node) return false; + if (node.type !== "ClassDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isExportAllDeclaration$1(node, opts) { + if (!node) return false; + if (node.type !== "ExportAllDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isExportDefaultDeclaration$3(node, opts) { + if (!node) return false; + if (node.type !== "ExportDefaultDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isExportNamedDeclaration$3(node, opts) { + if (!node) return false; + if (node.type !== "ExportNamedDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isExportSpecifier(node, opts) { + if (!node) return false; + if (node.type !== "ExportSpecifier") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isForOfStatement$2(node, opts) { + if (!node) return false; + if (node.type !== "ForOfStatement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isImportDeclaration$2(node, opts) { + if (!node) return false; + if (node.type !== "ImportDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isImportDefaultSpecifier$1(node, opts) { + if (!node) return false; + if (node.type !== "ImportDefaultSpecifier") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isImportNamespaceSpecifier$1(node, opts) { + if (!node) return false; + if (node.type !== "ImportNamespaceSpecifier") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isImportSpecifier$1(node, opts) { + if (!node) return false; + if (node.type !== "ImportSpecifier") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isMetaProperty$1(node, opts) { + if (!node) return false; + if (node.type !== "MetaProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isClassMethod(node, opts) { + if (!node) return false; + if (node.type !== "ClassMethod") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isObjectPattern$2(node, opts) { + if (!node) return false; + if (node.type !== "ObjectPattern") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isSpreadElement$1(node, opts) { + if (!node) return false; + if (node.type !== "SpreadElement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isSuper$3(node, opts) { + if (!node) return false; + if (node.type !== "Super") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTaggedTemplateExpression$2(node, opts) { + if (!node) return false; + if (node.type !== "TaggedTemplateExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTemplateElement(node, opts) { + if (!node) return false; + if (node.type !== "TemplateElement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTemplateLiteral$2(node, opts) { + if (!node) return false; + if (node.type !== "TemplateLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isYieldExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "YieldExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isAwaitExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "AwaitExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isImport(node, opts) { + if (!node) return false; + if (node.type !== "Import") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isBigIntLiteral(node, opts) { + if (!node) return false; + if (node.type !== "BigIntLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isExportNamespaceSpecifier$1(node, opts) { + if (!node) return false; + if (node.type !== "ExportNamespaceSpecifier") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isOptionalMemberExpression$3(node, opts) { + if (!node) return false; + if (node.type !== "OptionalMemberExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isOptionalCallExpression$3(node, opts) { + if (!node) return false; + if (node.type !== "OptionalCallExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isClassProperty(node, opts) { + if (!node) return false; + if (node.type !== "ClassProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isClassAccessorProperty(node, opts) { + if (!node) return false; + if (node.type !== "ClassAccessorProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isClassPrivateProperty(node, opts) { + if (!node) return false; + if (node.type !== "ClassPrivateProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isClassPrivateMethod(node, opts) { + if (!node) return false; + if (node.type !== "ClassPrivateMethod") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isPrivateName$3(node, opts) { + if (!node) return false; + if (node.type !== "PrivateName") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isStaticBlock(node, opts) { + if (!node) return false; + if (node.type !== "StaticBlock") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isAnyTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "AnyTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isArrayTypeAnnotation$2(node, opts) { + if (!node) return false; + if (node.type !== "ArrayTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isBooleanTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "BooleanTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isBooleanLiteralTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "BooleanLiteralTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isNullLiteralTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "NullLiteralTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isClassImplements(node, opts) { + if (!node) return false; + if (node.type !== "ClassImplements") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclareClass(node, opts) { + if (!node) return false; + if (node.type !== "DeclareClass") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclareFunction(node, opts) { + if (!node) return false; + if (node.type !== "DeclareFunction") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclareInterface(node, opts) { + if (!node) return false; + if (node.type !== "DeclareInterface") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclareModule(node, opts) { + if (!node) return false; + if (node.type !== "DeclareModule") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclareModuleExports(node, opts) { + if (!node) return false; + if (node.type !== "DeclareModuleExports") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclareTypeAlias(node, opts) { + if (!node) return false; + if (node.type !== "DeclareTypeAlias") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclareOpaqueType(node, opts) { + if (!node) return false; + if (node.type !== "DeclareOpaqueType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclareVariable(node, opts) { + if (!node) return false; + if (node.type !== "DeclareVariable") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclareExportDeclaration$1(node, opts) { + if (!node) return false; + if (node.type !== "DeclareExportDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclareExportAllDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "DeclareExportAllDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDeclaredPredicate(node, opts) { + if (!node) return false; + if (node.type !== "DeclaredPredicate") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isExistsTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "ExistsTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isFunctionTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "FunctionTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isFunctionTypeParam(node, opts) { + if (!node) return false; + if (node.type !== "FunctionTypeParam") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isGenericTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "GenericTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isInferredPredicate(node, opts) { + if (!node) return false; + if (node.type !== "InferredPredicate") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isInterfaceExtends(node, opts) { + if (!node) return false; + if (node.type !== "InterfaceExtends") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isInterfaceDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "InterfaceDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isInterfaceTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "InterfaceTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isIntersectionTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "IntersectionTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isMixedTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "MixedTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEmptyTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "EmptyTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isNullableTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "NullableTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isNumberLiteralTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "NumberLiteralTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isNumberTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "NumberTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isObjectTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isObjectTypeInternalSlot(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeInternalSlot") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isObjectTypeCallProperty(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeCallProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isObjectTypeIndexer(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeIndexer") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isObjectTypeProperty(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isObjectTypeSpreadProperty(node, opts) { + if (!node) return false; + if (node.type !== "ObjectTypeSpreadProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isOpaqueType(node, opts) { + if (!node) return false; + if (node.type !== "OpaqueType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isQualifiedTypeIdentifier(node, opts) { + if (!node) return false; + if (node.type !== "QualifiedTypeIdentifier") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isStringLiteralTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "StringLiteralTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isStringTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "StringTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isSymbolTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "SymbolTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isThisTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "ThisTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTupleTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "TupleTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTypeofTypeAnnotation(node, opts) { + if (!node) return false; + if (node.type !== "TypeofTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTypeAlias(node, opts) { + if (!node) return false; + if (node.type !== "TypeAlias") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTypeAnnotation$2(node, opts) { + if (!node) return false; + if (node.type !== "TypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTypeCastExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "TypeCastExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTypeParameter(node, opts) { + if (!node) return false; + if (node.type !== "TypeParameter") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTypeParameterDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TypeParameterDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTypeParameterInstantiation(node, opts) { + if (!node) return false; + if (node.type !== "TypeParameterInstantiation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isUnionTypeAnnotation$2(node, opts) { + if (!node) return false; + if (node.type !== "UnionTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isVariance(node, opts) { + if (!node) return false; + if (node.type !== "Variance") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isVoidTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "VoidTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEnumDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "EnumDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEnumBooleanBody(node, opts) { + if (!node) return false; + if (node.type !== "EnumBooleanBody") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEnumNumberBody(node, opts) { + if (!node) return false; + if (node.type !== "EnumNumberBody") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEnumStringBody(node, opts) { + if (!node) return false; + if (node.type !== "EnumStringBody") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEnumSymbolBody(node, opts) { + if (!node) return false; + if (node.type !== "EnumSymbolBody") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEnumBooleanMember(node, opts) { + if (!node) return false; + if (node.type !== "EnumBooleanMember") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEnumNumberMember(node, opts) { + if (!node) return false; + if (node.type !== "EnumNumberMember") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEnumStringMember(node, opts) { + if (!node) return false; + if (node.type !== "EnumStringMember") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isEnumDefaultedMember(node, opts) { + if (!node) return false; + if (node.type !== "EnumDefaultedMember") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isIndexedAccessType$1(node, opts) { + if (!node) return false; + if (node.type !== "IndexedAccessType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isOptionalIndexedAccessType(node, opts) { + if (!node) return false; + if (node.type !== "OptionalIndexedAccessType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXAttribute(node, opts) { + if (!node) return false; + if (node.type !== "JSXAttribute") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXClosingElement(node, opts) { + if (!node) return false; + if (node.type !== "JSXClosingElement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXElement(node, opts) { + if (!node) return false; + if (node.type !== "JSXElement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXEmptyExpression(node, opts) { + if (!node) return false; + if (node.type !== "JSXEmptyExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXExpressionContainer$1(node, opts) { + if (!node) return false; + if (node.type !== "JSXExpressionContainer") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXSpreadChild(node, opts) { + if (!node) return false; + if (node.type !== "JSXSpreadChild") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXIdentifier$3(node, opts) { + if (!node) return false; + if (node.type !== "JSXIdentifier") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXMemberExpression$2(node, opts) { + if (!node) return false; + if (node.type !== "JSXMemberExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXNamespacedName$1(node, opts) { + if (!node) return false; + if (node.type !== "JSXNamespacedName") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXOpeningElement(node, opts) { + if (!node) return false; + if (node.type !== "JSXOpeningElement") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXSpreadAttribute$1(node, opts) { + if (!node) return false; + if (node.type !== "JSXSpreadAttribute") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXText(node, opts) { + if (!node) return false; + if (node.type !== "JSXText") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXFragment(node, opts) { + if (!node) return false; + if (node.type !== "JSXFragment") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXOpeningFragment(node, opts) { + if (!node) return false; + if (node.type !== "JSXOpeningFragment") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isJSXClosingFragment(node, opts) { + if (!node) return false; + if (node.type !== "JSXClosingFragment") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isNoop(node, opts) { + if (!node) return false; + if (node.type !== "Noop") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isPlaceholder$1(node, opts) { + if (!node) return false; + if (node.type !== "Placeholder") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isV8IntrinsicIdentifier(node, opts) { + if (!node) return false; + if (node.type !== "V8IntrinsicIdentifier") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isArgumentPlaceholder(node, opts) { + if (!node) return false; + if (node.type !== "ArgumentPlaceholder") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isBindExpression(node, opts) { + if (!node) return false; + if (node.type !== "BindExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isImportAttribute(node, opts) { + if (!node) return false; + if (node.type !== "ImportAttribute") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDecorator(node, opts) { + if (!node) return false; + if (node.type !== "Decorator") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDoExpression(node, opts) { + if (!node) return false; + if (node.type !== "DoExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isExportDefaultSpecifier$1(node, opts) { + if (!node) return false; + if (node.type !== "ExportDefaultSpecifier") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isRecordExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "RecordExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTupleExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "TupleExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isDecimalLiteral(node, opts) { + if (!node) return false; + if (node.type !== "DecimalLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isModuleExpression(node, opts) { + if (!node) return false; + if (node.type !== "ModuleExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTopicReference$1(node, opts) { + if (!node) return false; + if (node.type !== "TopicReference") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isPipelineTopicExpression(node, opts) { + if (!node) return false; + if (node.type !== "PipelineTopicExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isPipelineBareFunction(node, opts) { + if (!node) return false; + if (node.type !== "PipelineBareFunction") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isPipelinePrimaryTopicReference(node, opts) { + if (!node) return false; + if (node.type !== "PipelinePrimaryTopicReference") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSParameterProperty(node, opts) { + if (!node) return false; + if (node.type !== "TSParameterProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSDeclareFunction(node, opts) { + if (!node) return false; + if (node.type !== "TSDeclareFunction") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSDeclareMethod(node, opts) { + if (!node) return false; + if (node.type !== "TSDeclareMethod") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSQualifiedName(node, opts) { + if (!node) return false; + if (node.type !== "TSQualifiedName") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSCallSignatureDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSCallSignatureDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSConstructSignatureDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSConstructSignatureDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSPropertySignature(node, opts) { + if (!node) return false; + if (node.type !== "TSPropertySignature") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSMethodSignature(node, opts) { + if (!node) return false; + if (node.type !== "TSMethodSignature") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSIndexSignature(node, opts) { + if (!node) return false; + if (node.type !== "TSIndexSignature") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSAnyKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSAnyKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSBooleanKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSBooleanKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSBigIntKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSBigIntKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSIntrinsicKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSIntrinsicKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSNeverKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSNeverKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSNullKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSNullKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSNumberKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSNumberKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSObjectKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSObjectKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSStringKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSStringKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSSymbolKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSSymbolKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSUndefinedKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSUndefinedKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSUnknownKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSUnknownKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSVoidKeyword(node, opts) { + if (!node) return false; + if (node.type !== "TSVoidKeyword") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSThisType(node, opts) { + if (!node) return false; + if (node.type !== "TSThisType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSFunctionType(node, opts) { + if (!node) return false; + if (node.type !== "TSFunctionType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSConstructorType(node, opts) { + if (!node) return false; + if (node.type !== "TSConstructorType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeReference$1(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeReference") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypePredicate(node, opts) { + if (!node) return false; + if (node.type !== "TSTypePredicate") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeQuery(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeQuery") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeLiteral(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSArrayType$2(node, opts) { + if (!node) return false; + if (node.type !== "TSArrayType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTupleType(node, opts) { + if (!node) return false; + if (node.type !== "TSTupleType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSOptionalType$1(node, opts) { + if (!node) return false; + if (node.type !== "TSOptionalType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSRestType$1(node, opts) { + if (!node) return false; + if (node.type !== "TSRestType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSNamedTupleMember(node, opts) { + if (!node) return false; + if (node.type !== "TSNamedTupleMember") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSUnionType$1(node, opts) { + if (!node) return false; + if (node.type !== "TSUnionType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSIntersectionType$1(node, opts) { + if (!node) return false; + if (node.type !== "TSIntersectionType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSConditionalType(node, opts) { + if (!node) return false; + if (node.type !== "TSConditionalType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSInferType(node, opts) { + if (!node) return false; + if (node.type !== "TSInferType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSParenthesizedType(node, opts) { + if (!node) return false; + if (node.type !== "TSParenthesizedType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeOperator(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeOperator") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSIndexedAccessType(node, opts) { + if (!node) return false; + if (node.type !== "TSIndexedAccessType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSMappedType(node, opts) { + if (!node) return false; + if (node.type !== "TSMappedType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSLiteralType(node, opts) { + if (!node) return false; + if (node.type !== "TSLiteralType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSExpressionWithTypeArguments(node, opts) { + if (!node) return false; + if (node.type !== "TSExpressionWithTypeArguments") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSInterfaceDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSInterfaceDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSInterfaceBody$1(node, opts) { + if (!node) return false; + if (node.type !== "TSInterfaceBody") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeAliasDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeAliasDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSInstantiationExpression$1(node, opts) { + if (!node) return false; + if (node.type !== "TSInstantiationExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSAsExpression$2(node, opts) { + if (!node) return false; + if (node.type !== "TSAsExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSSatisfiesExpression$2(node, opts) { + if (!node) return false; + if (node.type !== "TSSatisfiesExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeAssertion$2(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeAssertion") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSEnumDeclaration$1(node, opts) { + if (!node) return false; + if (node.type !== "TSEnumDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSEnumMember(node, opts) { + if (!node) return false; + if (node.type !== "TSEnumMember") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSModuleDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSModuleDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSModuleBlock(node, opts) { + if (!node) return false; + if (node.type !== "TSModuleBlock") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSImportType(node, opts) { + if (!node) return false; + if (node.type !== "TSImportType") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSImportEqualsDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSImportEqualsDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSExternalModuleReference(node, opts) { + if (!node) return false; + if (node.type !== "TSExternalModuleReference") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSNonNullExpression$2(node, opts) { + if (!node) return false; + if (node.type !== "TSNonNullExpression") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSExportAssignment(node, opts) { + if (!node) return false; + if (node.type !== "TSExportAssignment") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSNamespaceExportDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSNamespaceExportDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeAnnotation$1(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeAnnotation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeParameterInstantiation(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeParameterInstantiation") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeParameterDeclaration(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeParameterDeclaration") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeParameter(node, opts) { + if (!node) return false; + if (node.type !== "TSTypeParameter") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isStandardized(node, opts) { + if (!node) return false; + switch (node.type) { + case "ArrayExpression": + case "AssignmentExpression": + case "BinaryExpression": + case "InterpreterDirective": + case "Directive": + case "DirectiveLiteral": + case "BlockStatement": + case "BreakStatement": + case "CallExpression": + case "CatchClause": + case "ConditionalExpression": + case "ContinueStatement": + case "DebuggerStatement": + case "DoWhileStatement": + case "EmptyStatement": + case "ExpressionStatement": + case "File": + case "ForInStatement": + case "ForStatement": + case "FunctionDeclaration": + case "FunctionExpression": + case "Identifier": + case "IfStatement": + case "LabeledStatement": + case "StringLiteral": + case "NumericLiteral": + case "NullLiteral": + case "BooleanLiteral": + case "RegExpLiteral": + case "LogicalExpression": + case "MemberExpression": + case "NewExpression": + case "Program": + case "ObjectExpression": + case "ObjectMethod": + case "ObjectProperty": + case "RestElement": + case "ReturnStatement": + case "SequenceExpression": + case "ParenthesizedExpression": + case "SwitchCase": + case "SwitchStatement": + case "ThisExpression": + case "ThrowStatement": + case "TryStatement": + case "UnaryExpression": + case "UpdateExpression": + case "VariableDeclaration": + case "VariableDeclarator": + case "WhileStatement": + case "WithStatement": + case "AssignmentPattern": + case "ArrayPattern": + case "ArrowFunctionExpression": + case "ClassBody": + case "ClassExpression": + case "ClassDeclaration": + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + case "ExportSpecifier": + case "ForOfStatement": + case "ImportDeclaration": + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "ImportSpecifier": + case "MetaProperty": + case "ClassMethod": + case "ObjectPattern": + case "SpreadElement": + case "Super": + case "TaggedTemplateExpression": + case "TemplateElement": + case "TemplateLiteral": + case "YieldExpression": + case "AwaitExpression": + case "Import": + case "BigIntLiteral": + case "ExportNamespaceSpecifier": + case "OptionalMemberExpression": + case "OptionalCallExpression": + case "ClassProperty": + case "ClassAccessorProperty": + case "ClassPrivateProperty": + case "ClassPrivateMethod": + case "PrivateName": + case "StaticBlock": + break; + case "Placeholder": + switch (node.expectedNode) { + case "Identifier": + case "StringLiteral": + case "BlockStatement": + case "ClassBody": + break; + default: + return false; + } + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isExpression$4(node, opts) { + if (!node) return false; + switch (node.type) { + case "ArrayExpression": + case "AssignmentExpression": + case "BinaryExpression": + case "CallExpression": + case "ConditionalExpression": + case "FunctionExpression": + case "Identifier": + case "StringLiteral": + case "NumericLiteral": + case "NullLiteral": + case "BooleanLiteral": + case "RegExpLiteral": + case "LogicalExpression": + case "MemberExpression": + case "NewExpression": + case "ObjectExpression": + case "SequenceExpression": + case "ParenthesizedExpression": + case "ThisExpression": + case "UnaryExpression": + case "UpdateExpression": + case "ArrowFunctionExpression": + case "ClassExpression": + case "MetaProperty": + case "Super": + case "TaggedTemplateExpression": + case "TemplateLiteral": + case "YieldExpression": + case "AwaitExpression": + case "Import": + case "BigIntLiteral": + case "OptionalMemberExpression": + case "OptionalCallExpression": + case "TypeCastExpression": + case "JSXElement": + case "JSXFragment": + case "BindExpression": + case "DoExpression": + case "RecordExpression": + case "TupleExpression": + case "DecimalLiteral": + case "ModuleExpression": + case "TopicReference": + case "PipelineTopicExpression": + case "PipelineBareFunction": + case "PipelinePrimaryTopicReference": + case "TSInstantiationExpression": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSNonNullExpression": + break; + case "Placeholder": + switch (node.expectedNode) { + case "Expression": + case "Identifier": + case "StringLiteral": + break; + default: + return false; + } + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isBinary$3(node, opts) { + if (!node) return false; + switch (node.type) { + case "BinaryExpression": + case "LogicalExpression": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isScopable(node, opts) { + if (!node) return false; + switch (node.type) { + case "BlockStatement": + case "CatchClause": + case "DoWhileStatement": + case "ForInStatement": + case "ForStatement": + case "FunctionDeclaration": + case "FunctionExpression": + case "Program": + case "ObjectMethod": + case "SwitchStatement": + case "WhileStatement": + case "ArrowFunctionExpression": + case "ClassExpression": + case "ClassDeclaration": + case "ForOfStatement": + case "ClassMethod": + case "ClassPrivateMethod": + case "StaticBlock": + case "TSModuleBlock": + break; + case "Placeholder": + if (node.expectedNode === "BlockStatement") break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isBlockParent(node, opts) { + if (!node) return false; + switch (node.type) { + case "BlockStatement": + case "CatchClause": + case "DoWhileStatement": + case "ForInStatement": + case "ForStatement": + case "FunctionDeclaration": + case "FunctionExpression": + case "Program": + case "ObjectMethod": + case "SwitchStatement": + case "WhileStatement": + case "ArrowFunctionExpression": + case "ForOfStatement": + case "ClassMethod": + case "ClassPrivateMethod": + case "StaticBlock": + case "TSModuleBlock": + break; + case "Placeholder": + if (node.expectedNode === "BlockStatement") break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isBlock(node, opts) { + if (!node) return false; + switch (node.type) { + case "BlockStatement": + case "Program": + case "TSModuleBlock": + break; + case "Placeholder": + if (node.expectedNode === "BlockStatement") break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isStatement$8(node, opts) { + if (!node) return false; + switch (node.type) { + case "BlockStatement": + case "BreakStatement": + case "ContinueStatement": + case "DebuggerStatement": + case "DoWhileStatement": + case "EmptyStatement": + case "ExpressionStatement": + case "ForInStatement": + case "ForStatement": + case "FunctionDeclaration": + case "IfStatement": + case "LabeledStatement": + case "ReturnStatement": + case "SwitchStatement": + case "ThrowStatement": + case "TryStatement": + case "VariableDeclaration": + case "WhileStatement": + case "WithStatement": + case "ClassDeclaration": + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + case "ForOfStatement": + case "ImportDeclaration": + case "DeclareClass": + case "DeclareFunction": + case "DeclareInterface": + case "DeclareModule": + case "DeclareModuleExports": + case "DeclareTypeAlias": + case "DeclareOpaqueType": + case "DeclareVariable": + case "DeclareExportDeclaration": + case "DeclareExportAllDeclaration": + case "InterfaceDeclaration": + case "OpaqueType": + case "TypeAlias": + case "EnumDeclaration": + case "TSDeclareFunction": + case "TSInterfaceDeclaration": + case "TSTypeAliasDeclaration": + case "TSEnumDeclaration": + case "TSModuleDeclaration": + case "TSImportEqualsDeclaration": + case "TSExportAssignment": + case "TSNamespaceExportDeclaration": + break; + case "Placeholder": + switch (node.expectedNode) { + case "Statement": + case "Declaration": + case "BlockStatement": + break; + default: + return false; + } + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isTerminatorless(node, opts) { + if (!node) return false; + switch (node.type) { + case "BreakStatement": + case "ContinueStatement": + case "ReturnStatement": + case "ThrowStatement": + case "YieldExpression": + case "AwaitExpression": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isCompletionStatement(node, opts) { + if (!node) return false; + switch (node.type) { + case "BreakStatement": + case "ContinueStatement": + case "ReturnStatement": + case "ThrowStatement": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isConditional$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "ConditionalExpression": + case "IfStatement": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isLoop$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "DoWhileStatement": + case "ForInStatement": + case "ForStatement": + case "WhileStatement": + case "ForOfStatement": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isWhile(node, opts) { + if (!node) return false; + switch (node.type) { + case "DoWhileStatement": + case "WhileStatement": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isExpressionWrapper(node, opts) { + if (!node) return false; + switch (node.type) { + case "ExpressionStatement": + case "ParenthesizedExpression": + case "TypeCastExpression": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isFor$2(node, opts) { + if (!node) return false; + switch (node.type) { + case "ForInStatement": + case "ForStatement": + case "ForOfStatement": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isForXStatement$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "ForInStatement": + case "ForOfStatement": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isFunction$5(node, opts) { + if (!node) return false; + switch (node.type) { + case "FunctionDeclaration": + case "FunctionExpression": + case "ObjectMethod": + case "ArrowFunctionExpression": + case "ClassMethod": + case "ClassPrivateMethod": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isFunctionParent(node, opts) { + if (!node) return false; + switch (node.type) { + case "FunctionDeclaration": + case "FunctionExpression": + case "ObjectMethod": + case "ArrowFunctionExpression": + case "ClassMethod": + case "ClassPrivateMethod": + case "StaticBlock": + case "TSModuleBlock": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isPureish$2(node, opts) { + if (!node) return false; + switch (node.type) { + case "FunctionDeclaration": + case "FunctionExpression": + case "StringLiteral": + case "NumericLiteral": + case "NullLiteral": + case "BooleanLiteral": + case "RegExpLiteral": + case "ArrowFunctionExpression": + case "BigIntLiteral": + case "DecimalLiteral": + break; + case "Placeholder": + if (node.expectedNode === "StringLiteral") break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isDeclaration$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "FunctionDeclaration": + case "VariableDeclaration": + case "ClassDeclaration": + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + case "ImportDeclaration": + case "DeclareClass": + case "DeclareFunction": + case "DeclareInterface": + case "DeclareModule": + case "DeclareModuleExports": + case "DeclareTypeAlias": + case "DeclareOpaqueType": + case "DeclareVariable": + case "DeclareExportDeclaration": + case "DeclareExportAllDeclaration": + case "InterfaceDeclaration": + case "OpaqueType": + case "TypeAlias": + case "EnumDeclaration": + case "TSDeclareFunction": + case "TSInterfaceDeclaration": + case "TSTypeAliasDeclaration": + case "TSEnumDeclaration": + case "TSModuleDeclaration": + break; + case "Placeholder": + if (node.expectedNode === "Declaration") break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isPatternLike(node, opts) { + if (!node) return false; + switch (node.type) { + case "Identifier": + case "RestElement": + case "AssignmentPattern": + case "ArrayPattern": + case "ObjectPattern": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSNonNullExpression": + break; + case "Placeholder": + switch (node.expectedNode) { + case "Pattern": + case "Identifier": + break; + default: + return false; + } + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isLVal(node, opts) { + if (!node) return false; + switch (node.type) { + case "Identifier": + case "MemberExpression": + case "RestElement": + case "AssignmentPattern": + case "ArrayPattern": + case "ObjectPattern": + case "TSParameterProperty": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSNonNullExpression": + break; + case "Placeholder": + switch (node.expectedNode) { + case "Pattern": + case "Identifier": + break; + default: + return false; + } + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isTSEntityName(node, opts) { + if (!node) return false; + switch (node.type) { + case "Identifier": + case "TSQualifiedName": + break; + case "Placeholder": + if (node.expectedNode === "Identifier") break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isLiteral$6(node, opts) { + if (!node) return false; + switch (node.type) { + case "StringLiteral": + case "NumericLiteral": + case "NullLiteral": + case "BooleanLiteral": + case "RegExpLiteral": + case "TemplateLiteral": + case "BigIntLiteral": + case "DecimalLiteral": + break; + case "Placeholder": + if (node.expectedNode === "StringLiteral") break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isUserWhitespacable(node, opts) { + if (!node) return false; + switch (node.type) { + case "ObjectMethod": + case "ObjectProperty": + case "ObjectTypeInternalSlot": + case "ObjectTypeCallProperty": + case "ObjectTypeIndexer": + case "ObjectTypeProperty": + case "ObjectTypeSpreadProperty": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isMethod$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "ObjectMethod": + case "ClassMethod": + case "ClassPrivateMethod": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isObjectMember(node, opts) { + if (!node) return false; + switch (node.type) { + case "ObjectMethod": + case "ObjectProperty": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isProperty$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "ObjectProperty": + case "ClassProperty": + case "ClassAccessorProperty": + case "ClassPrivateProperty": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isUnaryLike$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "UnaryExpression": + case "SpreadElement": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isPattern(node, opts) { + if (!node) return false; + switch (node.type) { + case "AssignmentPattern": + case "ArrayPattern": + case "ObjectPattern": + break; + case "Placeholder": + if (node.expectedNode === "Pattern") break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isClass$2(node, opts) { + if (!node) return false; + switch (node.type) { + case "ClassExpression": + case "ClassDeclaration": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isImportOrExportDeclaration(node, opts) { + if (!node) return false; + switch (node.type) { + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + case "ImportDeclaration": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isExportDeclaration$3(node, opts) { + if (!node) return false; + switch (node.type) { + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isModuleSpecifier$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "ExportSpecifier": + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "ImportSpecifier": + case "ExportNamespaceSpecifier": + case "ExportDefaultSpecifier": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isAccessor(node, opts) { + if (!node) return false; + switch (node.type) { + case "ClassAccessorProperty": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isPrivate(node, opts) { + if (!node) return false; + switch (node.type) { + case "ClassPrivateProperty": + case "ClassPrivateMethod": + case "PrivateName": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isFlow$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "AnyTypeAnnotation": + case "ArrayTypeAnnotation": + case "BooleanTypeAnnotation": + case "BooleanLiteralTypeAnnotation": + case "NullLiteralTypeAnnotation": + case "ClassImplements": + case "DeclareClass": + case "DeclareFunction": + case "DeclareInterface": + case "DeclareModule": + case "DeclareModuleExports": + case "DeclareTypeAlias": + case "DeclareOpaqueType": + case "DeclareVariable": + case "DeclareExportDeclaration": + case "DeclareExportAllDeclaration": + case "DeclaredPredicate": + case "ExistsTypeAnnotation": + case "FunctionTypeAnnotation": + case "FunctionTypeParam": + case "GenericTypeAnnotation": + case "InferredPredicate": + case "InterfaceExtends": + case "InterfaceDeclaration": + case "InterfaceTypeAnnotation": + case "IntersectionTypeAnnotation": + case "MixedTypeAnnotation": + case "EmptyTypeAnnotation": + case "NullableTypeAnnotation": + case "NumberLiteralTypeAnnotation": + case "NumberTypeAnnotation": + case "ObjectTypeAnnotation": + case "ObjectTypeInternalSlot": + case "ObjectTypeCallProperty": + case "ObjectTypeIndexer": + case "ObjectTypeProperty": + case "ObjectTypeSpreadProperty": + case "OpaqueType": + case "QualifiedTypeIdentifier": + case "StringLiteralTypeAnnotation": + case "StringTypeAnnotation": + case "SymbolTypeAnnotation": + case "ThisTypeAnnotation": + case "TupleTypeAnnotation": + case "TypeofTypeAnnotation": + case "TypeAlias": + case "TypeAnnotation": + case "TypeCastExpression": + case "TypeParameter": + case "TypeParameterDeclaration": + case "TypeParameterInstantiation": + case "UnionTypeAnnotation": + case "Variance": + case "VoidTypeAnnotation": + case "EnumDeclaration": + case "EnumBooleanBody": + case "EnumNumberBody": + case "EnumStringBody": + case "EnumSymbolBody": + case "EnumBooleanMember": + case "EnumNumberMember": + case "EnumStringMember": + case "EnumDefaultedMember": + case "IndexedAccessType": + case "OptionalIndexedAccessType": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isFlowType$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "AnyTypeAnnotation": + case "ArrayTypeAnnotation": + case "BooleanTypeAnnotation": + case "BooleanLiteralTypeAnnotation": + case "NullLiteralTypeAnnotation": + case "ExistsTypeAnnotation": + case "FunctionTypeAnnotation": + case "GenericTypeAnnotation": + case "InterfaceTypeAnnotation": + case "IntersectionTypeAnnotation": + case "MixedTypeAnnotation": + case "EmptyTypeAnnotation": + case "NullableTypeAnnotation": + case "NumberLiteralTypeAnnotation": + case "NumberTypeAnnotation": + case "ObjectTypeAnnotation": + case "StringLiteralTypeAnnotation": + case "StringTypeAnnotation": + case "SymbolTypeAnnotation": + case "ThisTypeAnnotation": + case "TupleTypeAnnotation": + case "TypeofTypeAnnotation": + case "UnionTypeAnnotation": + case "VoidTypeAnnotation": + case "IndexedAccessType": + case "OptionalIndexedAccessType": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isFlowBaseAnnotation$1(node, opts) { + if (!node) return false; + switch (node.type) { + case "AnyTypeAnnotation": + case "BooleanTypeAnnotation": + case "NullLiteralTypeAnnotation": + case "MixedTypeAnnotation": + case "EmptyTypeAnnotation": + case "NumberTypeAnnotation": + case "StringTypeAnnotation": + case "SymbolTypeAnnotation": + case "ThisTypeAnnotation": + case "VoidTypeAnnotation": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isFlowDeclaration(node, opts) { + if (!node) return false; + switch (node.type) { + case "DeclareClass": + case "DeclareFunction": + case "DeclareInterface": + case "DeclareModule": + case "DeclareModuleExports": + case "DeclareTypeAlias": + case "DeclareOpaqueType": + case "DeclareVariable": + case "DeclareExportDeclaration": + case "DeclareExportAllDeclaration": + case "InterfaceDeclaration": + case "OpaqueType": + case "TypeAlias": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isFlowPredicate(node, opts) { + if (!node) return false; + switch (node.type) { + case "DeclaredPredicate": + case "InferredPredicate": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isEnumBody(node, opts) { + if (!node) return false; + switch (node.type) { + case "EnumBooleanBody": + case "EnumNumberBody": + case "EnumStringBody": + case "EnumSymbolBody": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isEnumMember(node, opts) { + if (!node) return false; + switch (node.type) { + case "EnumBooleanMember": + case "EnumNumberMember": + case "EnumStringMember": + case "EnumDefaultedMember": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isJSX(node, opts) { + if (!node) return false; + switch (node.type) { + case "JSXAttribute": + case "JSXClosingElement": + case "JSXElement": + case "JSXEmptyExpression": + case "JSXExpressionContainer": + case "JSXSpreadChild": + case "JSXIdentifier": + case "JSXMemberExpression": + case "JSXNamespacedName": + case "JSXOpeningElement": + case "JSXSpreadAttribute": + case "JSXText": + case "JSXFragment": + case "JSXOpeningFragment": + case "JSXClosingFragment": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isMiscellaneous(node, opts) { + if (!node) return false; + switch (node.type) { + case "Noop": + case "Placeholder": + case "V8IntrinsicIdentifier": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isTypeScript(node, opts) { + if (!node) return false; + switch (node.type) { + case "TSParameterProperty": + case "TSDeclareFunction": + case "TSDeclareMethod": + case "TSQualifiedName": + case "TSCallSignatureDeclaration": + case "TSConstructSignatureDeclaration": + case "TSPropertySignature": + case "TSMethodSignature": + case "TSIndexSignature": + case "TSAnyKeyword": + case "TSBooleanKeyword": + case "TSBigIntKeyword": + case "TSIntrinsicKeyword": + case "TSNeverKeyword": + case "TSNullKeyword": + case "TSNumberKeyword": + case "TSObjectKeyword": + case "TSStringKeyword": + case "TSSymbolKeyword": + case "TSUndefinedKeyword": + case "TSUnknownKeyword": + case "TSVoidKeyword": + case "TSThisType": + case "TSFunctionType": + case "TSConstructorType": + case "TSTypeReference": + case "TSTypePredicate": + case "TSTypeQuery": + case "TSTypeLiteral": + case "TSArrayType": + case "TSTupleType": + case "TSOptionalType": + case "TSRestType": + case "TSNamedTupleMember": + case "TSUnionType": + case "TSIntersectionType": + case "TSConditionalType": + case "TSInferType": + case "TSParenthesizedType": + case "TSTypeOperator": + case "TSIndexedAccessType": + case "TSMappedType": + case "TSLiteralType": + case "TSExpressionWithTypeArguments": + case "TSInterfaceDeclaration": + case "TSInterfaceBody": + case "TSTypeAliasDeclaration": + case "TSInstantiationExpression": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSEnumDeclaration": + case "TSEnumMember": + case "TSModuleDeclaration": + case "TSModuleBlock": + case "TSImportType": + case "TSImportEqualsDeclaration": + case "TSExternalModuleReference": + case "TSNonNullExpression": + case "TSExportAssignment": + case "TSNamespaceExportDeclaration": + case "TSTypeAnnotation": + case "TSTypeParameterInstantiation": + case "TSTypeParameterDeclaration": + case "TSTypeParameter": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isTSTypeElement(node, opts) { + if (!node) return false; + switch (node.type) { + case "TSCallSignatureDeclaration": + case "TSConstructSignatureDeclaration": + case "TSPropertySignature": + case "TSMethodSignature": + case "TSIndexSignature": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isTSType(node, opts) { + if (!node) return false; + switch (node.type) { + case "TSAnyKeyword": + case "TSBooleanKeyword": + case "TSBigIntKeyword": + case "TSIntrinsicKeyword": + case "TSNeverKeyword": + case "TSNullKeyword": + case "TSNumberKeyword": + case "TSObjectKeyword": + case "TSStringKeyword": + case "TSSymbolKeyword": + case "TSUndefinedKeyword": + case "TSUnknownKeyword": + case "TSVoidKeyword": + case "TSThisType": + case "TSFunctionType": + case "TSConstructorType": + case "TSTypeReference": + case "TSTypePredicate": + case "TSTypeQuery": + case "TSTypeLiteral": + case "TSArrayType": + case "TSTupleType": + case "TSOptionalType": + case "TSRestType": + case "TSUnionType": + case "TSIntersectionType": + case "TSConditionalType": + case "TSInferType": + case "TSParenthesizedType": + case "TSTypeOperator": + case "TSIndexedAccessType": + case "TSMappedType": + case "TSLiteralType": + case "TSExpressionWithTypeArguments": + case "TSImportType": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isTSBaseType(node, opts) { + if (!node) return false; + switch (node.type) { + case "TSAnyKeyword": + case "TSBooleanKeyword": + case "TSBigIntKeyword": + case "TSIntrinsicKeyword": + case "TSNeverKeyword": + case "TSNullKeyword": + case "TSNumberKeyword": + case "TSObjectKeyword": + case "TSStringKeyword": + case "TSSymbolKeyword": + case "TSUndefinedKeyword": + case "TSUnknownKeyword": + case "TSVoidKeyword": + case "TSThisType": + case "TSLiteralType": + break; + default: + return false; + } + return opts == null || shallowEqual$2(node, opts); + } + function isNumberLiteral(node, opts) { + deprecationWarning$1("isNumberLiteral", "isNumericLiteral"); + if (!node) return false; + if (node.type !== "NumberLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isRegexLiteral(node, opts) { + deprecationWarning$1("isRegexLiteral", "isRegExpLiteral"); + if (!node) return false; + if (node.type !== "RegexLiteral") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isRestProperty$1(node, opts) { + deprecationWarning$1("isRestProperty", "isRestElement"); + if (!node) return false; + if (node.type !== "RestProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isSpreadProperty$1(node, opts) { + deprecationWarning$1("isSpreadProperty", "isSpreadElement"); + if (!node) return false; + if (node.type !== "SpreadProperty") return false; + return opts == null || shallowEqual$2(node, opts); + } + function isModuleDeclaration(node, opts) { + deprecationWarning$1("isModuleDeclaration", "isImportOrExportDeclaration"); + return isImportOrExportDeclaration(node, opts); + } + + function matchesPattern$2(member, match, allowPartial) { + if (!isMemberExpression$8(member)) return false; + var parts = Array.isArray(match) ? match : match.split("."); + var nodes = []; + var node; + for (node = member; isMemberExpression$8(node); node = node.object) { + nodes.push(node.property); + } + nodes.push(node); + if (nodes.length < parts.length) return false; + if (!allowPartial && nodes.length > parts.length) return false; + for (var i = 0, j = nodes.length - 1; i < parts.length; i++, j--) { + var _node = nodes[j]; + var value = void 0; + if (isIdentifier$j(_node)) { + value = _node.name; + } else if (isStringLiteral$6(_node)) { + value = _node.value; + } else if (isThisExpression$2(_node)) { + value = "this"; + } else { + return false; + } + if (parts[i] !== value) return false; + } + return true; + } + + function buildMatchMemberExpression$1(match, allowPartial) { + var parts = match.split("."); + return function (member) { + return matchesPattern$2(member, parts, allowPartial); + }; + } + + var isReactComponent = buildMatchMemberExpression$1("React.Component"); + + function isCompatTag$1(tagName) { + return !!tagName && /^[a-z]/.test(tagName); + } + + var global$1 = (typeof global !== "undefined" ? global : + typeof self !== "undefined" ? self : + typeof window !== "undefined" ? window : {}); + + // shim for using process in browser + // based off https://github.com/defunctzombie/node-process/blob/master/browser.js + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + var cachedSetTimeout = defaultSetTimout; + var cachedClearTimeout = defaultClearTimeout; + if (typeof global$1.setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } + if (typeof global$1.clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } + + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + function nextTick(fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + } + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + var title = 'browser'; + var platform = 'browser'; + var browser$4 = true; + var env$1 = {}; + var argv = []; + var version$2 = ''; // empty string to avoid regexp issues + var versions$2 = {}; + var release = {}; + var config$1 = {}; + + function noop$2() {} + + var on = noop$2; + var addListener = noop$2; + var once$1 = noop$2; + var off = noop$2; + var removeListener = noop$2; + var removeAllListeners = noop$2; + var emit$1 = noop$2; + + function binding(name) { + throw new Error('process.binding is not supported'); + } + + function cwd () { return '/' } + function chdir (dir) { + throw new Error('process.chdir is not supported'); + }function umask() { return 0; } + + // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js + var performance = global$1.performance || {}; + var performanceNow = + performance.now || + performance.mozNow || + performance.msNow || + performance.oNow || + performance.webkitNow || + function(){ return (new Date()).getTime() }; + + // generate timestamp or delta + // see http://nodejs.org/api/process.html#process_process_hrtime + function hrtime(previousTimestamp){ + var clocktime = performanceNow.call(performance)*1e-3; + var seconds = Math.floor(clocktime); + var nanoseconds = Math.floor((clocktime%1)*1e9); + if (previousTimestamp) { + seconds = seconds - previousTimestamp[0]; + nanoseconds = nanoseconds - previousTimestamp[1]; + if (nanoseconds<0) { + seconds--; + nanoseconds += 1e9; + } + } + return [seconds,nanoseconds] + } + + var startTime = new Date(); + function uptime() { + var currentTime = new Date(); + var dif = currentTime - startTime; + return dif / 1000; + } + + var browser$1$1 = { + nextTick: nextTick, + title: title, + browser: browser$4, + env: env$1, + argv: argv, + version: version$2, + versions: versions$2, + on: on, + addListener: addListener, + once: once$1, + off: off, + removeListener: removeListener, + removeAllListeners: removeAllListeners, + emit: emit$1, + binding: binding, + cwd: cwd, + chdir: chdir, + umask: umask, + hrtime: hrtime, + platform: platform, + release: release, + config: config$1, + uptime: uptime + }; + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function getAugmentedNamespace(n) { + if (n.__esModule) return n; + var f = n.default; + if (typeof f == "function") { + var a = function a () { + if (this instanceof a) { + var args = [null]; + args.push.apply(args, arguments); + var Ctor = Function.bind.apply(f, args); + return new Ctor(); + } + return f.apply(this, arguments); + }; + a.prototype = f.prototype; + } else a = {}; + Object.defineProperty(a, '__esModule', {value: true}); + Object.keys(n).forEach(function (k) { + var d = Object.getOwnPropertyDescriptor(n, k); + Object.defineProperty(a, k, d.get ? d : { + enumerable: true, + get: function () { + return n[k]; + } + }); + }); + return a; + } + + var toFastPropertiesBABEL_8_BREAKINGFalse; + var hasRequiredToFastPropertiesBABEL_8_BREAKINGFalse; + function requireToFastPropertiesBABEL_8_BREAKINGFalse() { + if (hasRequiredToFastPropertiesBABEL_8_BREAKINGFalse) return toFastPropertiesBABEL_8_BREAKINGFalse; + hasRequiredToFastPropertiesBABEL_8_BREAKINGFalse = 1; + var fastProto = null; + function FastObject(o) { + if (fastProto !== null && typeof fastProto.property) { + var result = fastProto; + fastProto = FastObject.prototype = null; + return result; + } + fastProto = FastObject.prototype = o == null ? Object.create(null) : o; + return new FastObject(); + } + FastObject(); + toFastPropertiesBABEL_8_BREAKINGFalse = function toFastproperties(o) { + return FastObject(o); + }; + return toFastPropertiesBABEL_8_BREAKINGFalse; + } + + function bool$e(value) { + if (value == null) return false; + return value && value !== "false" && value !== "0"; + } + var toFastProperties = bool$e(browser$1$1.env["BABEL_8_BREAKING"]) ? requireToFastPropertiesBABEL_8_BREAKINGFalse() : requireToFastPropertiesBABEL_8_BREAKINGFalse(); + + function isType$2(nodeType, targetType) { + if (nodeType === targetType) return true; + if (nodeType == null) return false; + if (ALIAS_KEYS[targetType]) return false; + var aliases = FLIPPED_ALIAS_KEYS$3[targetType]; + if (aliases) { + if (aliases[0] === nodeType) return true; + for (var _iterator = _createForOfIteratorHelperLoose(aliases), _step; !(_step = _iterator()).done;) { + var alias = _step.value; + if (nodeType === alias) return true; + } + } + return false; + } + + function isPlaceholderType(placeholderType, targetType) { + if (placeholderType === targetType) return true; + var aliases = PLACEHOLDERS_ALIAS[placeholderType]; + if (aliases) { + for (var _iterator = _createForOfIteratorHelperLoose(aliases), _step; !(_step = _iterator()).done;) { + var alias = _step.value; + if (targetType === alias) return true; + } + } + return false; + } + + function is$1(type, node, opts) { + if (!node) return false; + var matches = isType$2(node.type, type); + if (!matches) { + if (!opts && node.type === "Placeholder" && type in FLIPPED_ALIAS_KEYS$3) { + return isPlaceholderType(node.expectedNode, type); + } + return false; + } + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual$2(node, opts); + } + } + + var 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\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\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\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\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-\u1711\u171F-\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-\u1B4C\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-\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-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\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"; + var 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\u0898-\u089F\u08CA-\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\u0C3C\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\u0CF3\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-\u0ECE\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-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\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-\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"; + var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); + var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); + nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; + var 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, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 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, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 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, 20, 1, 64, 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, 38, 6, 186, 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, 19, 72, 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, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 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, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 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, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 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, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191]; + var 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, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 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, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 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, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; + function isInAstralSet(code, set) { + var pos = 0x10000; + for (var i = 0, length = set.length; i < length; i += 2) { + pos += set[i]; + if (pos > code) return false; + pos += set[i + 1]; + if (pos >= code) return true; + } + return false; + } + function isIdentifierStart(code) { + if (code < 65) return code === 36; + if (code <= 90) return true; + if (code < 97) return code === 95; + if (code <= 122) return true; + if (code <= 0xffff) { + return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); + } + return isInAstralSet(code, astralIdentifierStartCodes); + } + function isIdentifierChar(code) { + if (code < 48) return code === 36; + if (code < 58) return true; + if (code < 65) return false; + if (code <= 90) return true; + if (code < 97) return code === 95; + if (code <= 122) return true; + if (code <= 0xffff) { + return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); + } + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); + } + function isIdentifierName(name) { + var isFirst = true; + for (var i = 0; i < name.length; i++) { + var cp = name.charCodeAt(i); + if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) { + var trail = name.charCodeAt(++i); + if ((trail & 0xfc00) === 0xdc00) { + cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff); + } + } + if (isFirst) { + isFirst = false; + if (!isIdentifierStart(cp)) { + return false; + } + } else if (!isIdentifierChar(cp)) { + return false; + } + } + return !isFirst; + } + + var reservedWords = { + keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"], + strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"], + strictBind: ["eval", "arguments"] + }; + var keywords$1 = new Set(reservedWords.keyword); + var reservedWordsStrictSet = new Set(reservedWords.strict); + var reservedWordsStrictBindSet = new Set(reservedWords.strictBind); + function isReservedWord(word, inModule) { + return inModule && word === "await" || word === "enum"; + } + function isStrictReservedWord(word, inModule) { + return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word); + } + function isStrictBindOnlyReservedWord(word) { + return reservedWordsStrictBindSet.has(word); + } + function isStrictBindReservedWord(word, inModule) { + return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word); + } + function isKeyword(word) { + return keywords$1.has(word); + } + + function isValidIdentifier$1(name, reserved) { + if (reserved === void 0) { + reserved = true; + } + if (typeof name !== "string") return false; + if (reserved) { + if (isKeyword(name) || isStrictReservedWord(name, true)) { + return false; + } + } + return isIdentifierName(name); + } + + var _isDigit = function isDigit(code) { + return code >= 48 && code <= 57; + }; + var forbiddenNumericSeparatorSiblings = { + decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]), + hex: new Set([46, 88, 95, 120]) + }; + var isAllowedNumericSeparatorSibling = { + bin: function bin(ch) { + return ch === 48 || ch === 49; + }, + oct: function oct(ch) { + return ch >= 48 && ch <= 55; + }, + dec: function dec(ch) { + return ch >= 48 && ch <= 57; + }, + hex: function hex(ch) { + return ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102; + } + }; + function readStringContents(type, input, pos, lineStart, curLine, errors) { + var initialPos = pos; + var initialLineStart = lineStart; + var initialCurLine = curLine; + var out = ""; + var firstInvalidLoc = null; + var chunkStart = pos; + var length = input.length; + for (;;) { + if (pos >= length) { + errors.unterminated(initialPos, initialLineStart, initialCurLine); + out += input.slice(chunkStart, pos); + break; + } + var ch = input.charCodeAt(pos); + if (isStringEnd(type, ch, input, pos)) { + out += input.slice(chunkStart, pos); + break; + } + if (ch === 92) { + out += input.slice(chunkStart, pos); + var res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors); + if (res.ch === null && !firstInvalidLoc) { + firstInvalidLoc = { + pos: pos, + lineStart: lineStart, + curLine: curLine + }; + } else { + out += res.ch; + } + pos = res.pos; + lineStart = res.lineStart; + curLine = res.curLine; + chunkStart = pos; + } else if (ch === 8232 || ch === 8233) { + ++pos; + ++curLine; + lineStart = pos; + } else if (ch === 10 || ch === 13) { + if (type === "template") { + out += input.slice(chunkStart, pos) + "\n"; + ++pos; + if (ch === 13 && input.charCodeAt(pos) === 10) { + ++pos; + } + ++curLine; + chunkStart = lineStart = pos; + } else { + errors.unterminated(initialPos, initialLineStart, initialCurLine); + } + } else { + ++pos; + } + } + return { + pos: pos, + str: out, + firstInvalidLoc: firstInvalidLoc, + lineStart: lineStart, + curLine: curLine, + containsInvalid: !!firstInvalidLoc + }; + } + function isStringEnd(type, ch, input, pos) { + if (type === "template") { + return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123; + } + return ch === (type === "double" ? 34 : 39); + } + function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) { + var throwOnInvalid = !inTemplate; + pos++; + var res = function res(ch) { + return { + pos: pos, + ch: ch, + lineStart: lineStart, + curLine: curLine + }; + }; + var ch = input.charCodeAt(pos++); + switch (ch) { + case 110: + return res("\n"); + case 114: + return res("\r"); + case 120: + { + var code; + var _readHexChar = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors); + code = _readHexChar.code; + pos = _readHexChar.pos; + return res(code === null ? null : String.fromCharCode(code)); + } + case 117: + { + var _code; + var _readCodePoint = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors); + _code = _readCodePoint.code; + pos = _readCodePoint.pos; + return res(_code === null ? null : String.fromCodePoint(_code)); + } + case 116: + return res("\t"); + case 98: + return res("\b"); + case 118: + return res("\x0B"); + case 102: + return res("\f"); + case 13: + if (input.charCodeAt(pos) === 10) { + ++pos; + } + case 10: + lineStart = pos; + ++curLine; + case 8232: + case 8233: + return res(""); + case 56: + case 57: + if (inTemplate) { + return res(null); + } else { + errors.strictNumericEscape(pos - 1, lineStart, curLine); + } + default: + if (ch >= 48 && ch <= 55) { + var startPos = pos - 1; + var match = input.slice(startPos, pos + 2).match(/^[0-7]+/); + var octalStr = match[0]; + var octal = parseInt(octalStr, 8); + if (octal > 255) { + octalStr = octalStr.slice(0, -1); + octal = parseInt(octalStr, 8); + } + pos += octalStr.length - 1; + var next = input.charCodeAt(pos); + if (octalStr !== "0" || next === 56 || next === 57) { + if (inTemplate) { + return res(null); + } else { + errors.strictNumericEscape(startPos, lineStart, curLine); + } + } + return res(String.fromCharCode(octal)); + } + return res(String.fromCharCode(ch)); + } + } + function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) { + var initialPos = pos; + var n; + var _readInt = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid); + n = _readInt.n; + pos = _readInt.pos; + if (n === null) { + if (throwOnInvalid) { + errors.invalidEscapeSequence(initialPos, lineStart, curLine); + } else { + pos = initialPos - 1; + } + } + return { + code: n, + pos: pos + }; + } + function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) { + var start = pos; + var forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct; + var isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin; + var invalid = false; + var total = 0; + for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) { + var code = input.charCodeAt(pos); + var val = void 0; + if (code === 95 && allowNumSeparator !== "bail") { + var prev = input.charCodeAt(pos - 1); + var next = input.charCodeAt(pos + 1); + if (!allowNumSeparator) { + if (bailOnError) return { + n: null, + pos: pos + }; + errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine); + } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) { + if (bailOnError) return { + n: null, + pos: pos + }; + errors.unexpectedNumericSeparator(pos, lineStart, curLine); + } + ++pos; + continue; + } + if (code >= 97) { + val = code - 97 + 10; + } else if (code >= 65) { + val = code - 65 + 10; + } else if (_isDigit(code)) { + val = code - 48; + } else { + val = Infinity; + } + if (val >= radix) { + if (val <= 9 && bailOnError) { + return { + n: null, + pos: pos + }; + } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) { + val = 0; + } else if (forceLen) { + val = 0; + invalid = true; + } else { + break; + } + } + ++pos; + total = total * radix + val; + } + if (pos === start || len != null && pos - start !== len || invalid) { + return { + n: null, + pos: pos + }; + } + return { + n: total, + pos: pos + }; + } + function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) { + var ch = input.charCodeAt(pos); + var code; + if (ch === 123) { + ++pos; + var _readHexChar2 = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors); + code = _readHexChar2.code; + pos = _readHexChar2.pos; + ++pos; + if (code !== null && code > 0x10ffff) { + if (throwOnInvalid) { + errors.invalidCodePoint(pos, lineStart, curLine); + } else { + return { + code: null, + pos: pos + }; + } + } + } else { + var _readHexChar3 = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors); + code = _readHexChar3.code; + pos = _readHexChar3.pos; + } + return { + code: code, + pos: pos + }; + } + + var STATEMENT_OR_BLOCK_KEYS$1 = ["consequent", "body", "alternate"]; + var FLATTENABLE_KEYS = ["body", "expressions"]; + var FOR_INIT_KEYS = ["left", "init"]; + var COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; + var LOGICAL_OPERATORS$3 = ["||", "&&", "??"]; + var UPDATE_OPERATORS = ["++", "--"]; + var BOOLEAN_NUMBER_BINARY_OPERATORS$1 = [">", "<", ">=", "<="]; + var EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; + var COMPARISON_BINARY_OPERATORS = [].concat(EQUALITY_BINARY_OPERATORS, ["in", "instanceof"]); + var BOOLEAN_BINARY_OPERATORS$1 = [].concat(_toConsumableArray(COMPARISON_BINARY_OPERATORS), BOOLEAN_NUMBER_BINARY_OPERATORS$1); + var NUMBER_BINARY_OPERATORS$1 = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; + var BINARY_OPERATORS = ["+"].concat(NUMBER_BINARY_OPERATORS$1, _toConsumableArray(BOOLEAN_BINARY_OPERATORS$1), ["|>"]); + var ASSIGNMENT_OPERATORS = ["=", "+="].concat(_toConsumableArray(NUMBER_BINARY_OPERATORS$1.map(function (op) { + return op + "="; + })), _toConsumableArray(LOGICAL_OPERATORS$3.map(function (op) { + return op + "="; + }))); + var BOOLEAN_UNARY_OPERATORS$1 = ["delete", "!"]; + var NUMBER_UNARY_OPERATORS$1 = ["+", "-", "~"]; + var STRING_UNARY_OPERATORS$1 = ["typeof"]; + var UNARY_OPERATORS = ["void", "throw"].concat(BOOLEAN_UNARY_OPERATORS$1, NUMBER_UNARY_OPERATORS$1, STRING_UNARY_OPERATORS$1); + var INHERIT_KEYS = { + optional: ["typeAnnotation", "typeParameters", "returnType"], + force: ["start", "loc", "end"] + }; + var BLOCK_SCOPED_SYMBOL = Symbol["for"]("var used to be block scoped"); + var NOT_LOCAL_BINDING$2 = Symbol["for"]("should not be considered a local binding"); + + var VISITOR_KEYS$5 = {}; + var ALIAS_KEYS = {}; + var FLIPPED_ALIAS_KEYS$3 = {}; + var NODE_FIELDS = {}; + var BUILDER_KEYS = {}; + var DEPRECATED_KEYS$1 = {}; + var NODE_PARENT_VALIDATIONS = {}; + function getType$2(val) { + if (Array.isArray(val)) { + return "array"; + } else if (val === null) { + return "null"; + } else { + return typeof val; + } + } + function validate$6(validate) { + return { + validate: validate + }; + } + function typeIs(typeName) { + return typeof typeName === "string" ? assertNodeType(typeName) : assertNodeType.apply(void 0, _toConsumableArray(typeName)); + } + function validateType(typeName) { + return validate$6(typeIs(typeName)); + } + function validateOptional(validate) { + return { + validate: validate, + optional: true + }; + } + function validateOptionalType(typeName) { + return { + validate: typeIs(typeName), + optional: true + }; + } + function arrayOf(elementType) { + return chain$1(assertValueType("array"), assertEach(elementType)); + } + function arrayOfType(typeName) { + return arrayOf(typeIs(typeName)); + } + function validateArrayOfType(typeName) { + return validate$6(arrayOfType(typeName)); + } + function assertEach(callback) { + function validator(node, key, val) { + if (!Array.isArray(val)) return; + for (var i = 0; i < val.length; i++) { + var subkey = key + "[" + i + "]"; + var v = val[i]; + callback(node, subkey, v); + if (browser$1$1.env.BABEL_TYPES_8_BREAKING) validateChild(node, subkey, v); + } + } + validator.each = callback; + return validator; + } + function assertOneOf() { + for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { + values[_key] = arguments[_key]; + } + function validate(node, key, val) { + if (values.indexOf(val) < 0) { + throw new TypeError("Property " + key + " expected value to be one of " + JSON.stringify(values) + " but got " + JSON.stringify(val)); + } + } + validate.oneOf = values; + return validate; + } + function assertNodeType() { + for (var _len2 = arguments.length, types = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + types[_key2] = arguments[_key2]; + } + function validate(node, key, val) { + for (var _iterator = _createForOfIteratorHelperLoose(types), _step; !(_step = _iterator()).done;) { + var type = _step.value; + if (is$1(type, val)) { + validateChild(node, key, val); + return; + } + } + throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + JSON.stringify(types) + " but instead got " + JSON.stringify(val == null ? void 0 : val.type)); + } + validate.oneOfNodeTypes = types; + return validate; + } + function assertNodeOrValueType() { + for (var _len3 = arguments.length, types = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + types[_key3] = arguments[_key3]; + } + function validate(node, key, val) { + for (var _iterator2 = _createForOfIteratorHelperLoose(types), _step2; !(_step2 = _iterator2()).done;) { + var type = _step2.value; + if (getType$2(val) === type || is$1(type, val)) { + validateChild(node, key, val); + return; + } + } + throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + JSON.stringify(types) + " but instead got " + JSON.stringify(val == null ? void 0 : val.type)); + } + validate.oneOfNodeOrValueTypes = types; + return validate; + } + function assertValueType(type) { + function validate(node, key, val) { + var valid = getType$2(val) === type; + if (!valid) { + throw new TypeError("Property " + key + " expected type of " + type + " but got " + getType$2(val)); + } + } + validate.type = type; + return validate; + } + function assertShape(shape) { + function validate(node, key, val) { + var errors = []; + for (var _i = 0, _Object$keys = Object.keys(shape); _i < _Object$keys.length; _i++) { + var property = _Object$keys[_i]; + try { + validateField(node, property, val[property], shape[property]); + } catch (error) { + if (error instanceof TypeError) { + errors.push(error.message); + continue; + } + throw error; + } + } + if (errors.length) { + throw new TypeError("Property " + key + " of " + node.type + " expected to have the following:\n" + errors.join("\n")); + } + } + validate.shapeOf = shape; + return validate; + } + function assertOptionalChainStart() { + function validate(node) { + var _current2; + var current = node; + while (node) { + var _current = current, + type = _current.type; + if (type === "OptionalCallExpression") { + if (current.optional) return; + current = current.callee; + continue; + } + if (type === "OptionalMemberExpression") { + if (current.optional) return; + current = current.object; + continue; + } + break; + } + throw new TypeError("Non-optional " + node.type + " must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from " + ((_current2 = current) == null ? void 0 : _current2.type)); + } + return validate; + } + function chain$1() { + for (var _len4 = arguments.length, fns = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + fns[_key4] = arguments[_key4]; + } + function validate() { + for (var _iterator3 = _createForOfIteratorHelperLoose(fns), _step3; !(_step3 = _iterator3()).done;) { + var fn = _step3.value; + fn.apply(void 0, arguments); + } + } + validate.chainOf = fns; + if (fns.length >= 2 && "type" in fns[0] && fns[0].type === "array" && !("each" in fns[1])) { + throw new Error("An assertValueType(\"array\") validator can only be followed by an assertEach(...) validator."); + } + return validate; + } + var validTypeOpts = ["aliases", "builder", "deprecatedAlias", "fields", "inherits", "visitor", "validate"]; + var validFieldKeys = ["default", "optional", "deprecated", "validate"]; + var store = {}; + function defineAliasedType() { + for (var _len5 = arguments.length, aliases = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + aliases[_key5] = arguments[_key5]; + } + return function (type, opts) { + var _defined2; + if (opts === void 0) { + opts = {}; + } + var defined = opts.aliases; + if (!defined) { + var _store$opts$inherits$, _defined; + if (opts.inherits) defined = (_store$opts$inherits$ = store[opts.inherits].aliases) == null ? void 0 : _store$opts$inherits$.slice(); + (_defined = defined) != null ? _defined : defined = []; + opts.aliases = defined; + } + var additional = aliases.filter(function (a) { + return !defined.includes(a); + }); + (_defined2 = defined).unshift.apply(_defined2, _toConsumableArray(additional)); + defineType$5(type, opts); + }; + } + function defineType$5(type, opts) { + if (opts === void 0) { + opts = {}; + } + var inherits = opts.inherits && store[opts.inherits] || {}; + var fields = opts.fields; + if (!fields) { + fields = {}; + if (inherits.fields) { + var keys = Object.getOwnPropertyNames(inherits.fields); + for (var _iterator4 = _createForOfIteratorHelperLoose(keys), _step4; !(_step4 = _iterator4()).done;) { + var _key6 = _step4.value; + var field = inherits.fields[_key6]; + var def = field["default"]; + if (Array.isArray(def) ? def.length > 0 : def && typeof def === "object") { + throw new Error("field defaults can only be primitives or empty arrays currently"); + } + fields[_key6] = { + "default": Array.isArray(def) ? [] : def, + optional: field.optional, + deprecated: field.deprecated, + validate: field.validate + }; + } + } + } + var visitor = opts.visitor || inherits.visitor || []; + var aliases = opts.aliases || inherits.aliases || []; + var builder = opts.builder || inherits.builder || opts.visitor || []; + for (var _i2 = 0, _Object$keys2 = Object.keys(opts); _i2 < _Object$keys2.length; _i2++) { + var k = _Object$keys2[_i2]; + if (validTypeOpts.indexOf(k) === -1) { + throw new Error("Unknown type option \"" + k + "\" on " + type); + } + } + if (opts.deprecatedAlias) { + DEPRECATED_KEYS$1[opts.deprecatedAlias] = type; + } + for (var _iterator5 = _createForOfIteratorHelperLoose(visitor.concat(builder)), _step5; !(_step5 = _iterator5()).done;) { + var _key8 = _step5.value; + fields[_key8] = fields[_key8] || {}; + } + for (var _i3 = 0, _Object$keys3 = Object.keys(fields); _i3 < _Object$keys3.length; _i3++) { + var _key7 = _Object$keys3[_i3]; + var _field = fields[_key7]; + if (_field["default"] !== undefined && builder.indexOf(_key7) === -1) { + _field.optional = true; + } + if (_field["default"] === undefined) { + _field["default"] = null; + } else if (!_field.validate && _field["default"] != null) { + _field.validate = assertValueType(getType$2(_field["default"])); + } + for (var _i4 = 0, _Object$keys4 = Object.keys(_field); _i4 < _Object$keys4.length; _i4++) { + var _k = _Object$keys4[_i4]; + if (validFieldKeys.indexOf(_k) === -1) { + throw new Error("Unknown field key \"" + _k + "\" on " + type + "." + _key7); + } + } + } + VISITOR_KEYS$5[type] = opts.visitor = visitor; + BUILDER_KEYS[type] = opts.builder = builder; + NODE_FIELDS[type] = opts.fields = fields; + ALIAS_KEYS[type] = opts.aliases = aliases; + aliases.forEach(function (alias) { + FLIPPED_ALIAS_KEYS$3[alias] = FLIPPED_ALIAS_KEYS$3[alias] || []; + FLIPPED_ALIAS_KEYS$3[alias].push(type); + }); + if (opts.validate) { + NODE_PARENT_VALIDATIONS[type] = opts.validate; + } + store[type] = opts; + } + + var defineType$4 = defineAliasedType("Standardized"); + defineType$4("ArrayExpression", { + fields: { + elements: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeOrValueType("null", "Expression", "SpreadElement"))), + "default": !browser$1$1.env.BABEL_TYPES_8_BREAKING ? [] : undefined + } + }, + visitor: ["elements"], + aliases: ["Expression"] + }); + defineType$4("AssignmentExpression", { + fields: { + operator: { + validate: function () { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) { + return assertValueType("string"); + } + var identifier = assertOneOf.apply(void 0, _toConsumableArray(ASSIGNMENT_OPERATORS)); + var pattern = assertOneOf("="); + return function (node, key, val) { + var validator = is$1("Pattern", node.left) ? pattern : identifier; + validator(node, key, val); + }; + }() + }, + left: { + validate: !browser$1$1.env.BABEL_TYPES_8_BREAKING ? assertNodeType("LVal") : assertNodeType("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") + }, + right: { + validate: assertNodeType("Expression") + } + }, + builder: ["operator", "left", "right"], + visitor: ["left", "right"], + aliases: ["Expression"] + }); + defineType$4("BinaryExpression", { + builder: ["operator", "left", "right"], + fields: { + operator: { + validate: assertOneOf.apply(void 0, _toConsumableArray(BINARY_OPERATORS)) + }, + left: { + validate: function () { + var expression = assertNodeType("Expression"); + var inOp = assertNodeType("Expression", "PrivateName"); + var validator = Object.assign(function (node, key, val) { + var validator = node.operator === "in" ? inOp : expression; + validator(node, key, val); + }, { + oneOfNodeTypes: ["Expression", "PrivateName"] + }); + return validator; + }() + }, + right: { + validate: assertNodeType("Expression") + } + }, + visitor: ["left", "right"], + aliases: ["Binary", "Expression"] + }); + defineType$4("InterpreterDirective", { + builder: ["value"], + fields: { + value: { + validate: assertValueType("string") + } + } + }); + defineType$4("Directive", { + visitor: ["value"], + fields: { + value: { + validate: assertNodeType("DirectiveLiteral") + } + } + }); + defineType$4("DirectiveLiteral", { + builder: ["value"], + fields: { + value: { + validate: assertValueType("string") + } + } + }); + defineType$4("BlockStatement", { + builder: ["body", "directives"], + visitor: ["directives", "body"], + fields: { + directives: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Directive"))), + "default": [] + }, + body: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Statement"))) + } + }, + aliases: ["Scopable", "BlockParent", "Block", "Statement"] + }); + defineType$4("BreakStatement", { + visitor: ["label"], + fields: { + label: { + validate: assertNodeType("Identifier"), + optional: true + } + }, + aliases: ["Statement", "Terminatorless", "CompletionStatement"] + }); + defineType$4("CallExpression", { + visitor: ["callee", "arguments", "typeParameters", "typeArguments"], + builder: ["callee", "arguments"], + aliases: ["Expression"], + fields: Object.assign({ + callee: { + validate: assertNodeType("Expression", "Super", "V8IntrinsicIdentifier") + }, + arguments: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Expression", "SpreadElement", "JSXNamespacedName", "ArgumentPlaceholder"))) + } + }, !browser$1$1.env.BABEL_TYPES_8_BREAKING ? { + optional: { + validate: assertOneOf(true, false), + optional: true + } + } : {}, { + typeArguments: { + validate: assertNodeType("TypeParameterInstantiation"), + optional: true + }, + typeParameters: { + validate: assertNodeType("TSTypeParameterInstantiation"), + optional: true + } + }) + }); + defineType$4("CatchClause", { + visitor: ["param", "body"], + fields: { + param: { + validate: assertNodeType("Identifier", "ArrayPattern", "ObjectPattern"), + optional: true + }, + body: { + validate: assertNodeType("BlockStatement") + } + }, + aliases: ["Scopable", "BlockParent"] + }); + defineType$4("ConditionalExpression", { + visitor: ["test", "consequent", "alternate"], + fields: { + test: { + validate: assertNodeType("Expression") + }, + consequent: { + validate: assertNodeType("Expression") + }, + alternate: { + validate: assertNodeType("Expression") + } + }, + aliases: ["Expression", "Conditional"] + }); + defineType$4("ContinueStatement", { + visitor: ["label"], + fields: { + label: { + validate: assertNodeType("Identifier"), + optional: true + } + }, + aliases: ["Statement", "Terminatorless", "CompletionStatement"] + }); + defineType$4("DebuggerStatement", { + aliases: ["Statement"] + }); + defineType$4("DoWhileStatement", { + visitor: ["test", "body"], + fields: { + test: { + validate: assertNodeType("Expression") + }, + body: { + validate: assertNodeType("Statement") + } + }, + aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"] + }); + defineType$4("EmptyStatement", { + aliases: ["Statement"] + }); + defineType$4("ExpressionStatement", { + visitor: ["expression"], + fields: { + expression: { + validate: assertNodeType("Expression") + } + }, + aliases: ["Statement", "ExpressionWrapper"] + }); + defineType$4("File", { + builder: ["program", "comments", "tokens"], + visitor: ["program"], + fields: { + program: { + validate: assertNodeType("Program") + }, + comments: { + validate: !browser$1$1.env.BABEL_TYPES_8_BREAKING ? Object.assign(function () {}, { + each: { + oneOfNodeTypes: ["CommentBlock", "CommentLine"] + } + }) : assertEach(assertNodeType("CommentBlock", "CommentLine")), + optional: true + }, + tokens: { + validate: assertEach(Object.assign(function () {}, { + type: "any" + })), + optional: true + } + } + }); + defineType$4("ForInStatement", { + visitor: ["left", "right", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], + fields: { + left: { + validate: !browser$1$1.env.BABEL_TYPES_8_BREAKING ? assertNodeType("VariableDeclaration", "LVal") : assertNodeType("VariableDeclaration", "Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") + }, + right: { + validate: assertNodeType("Expression") + }, + body: { + validate: assertNodeType("Statement") + } + } + }); + defineType$4("ForStatement", { + visitor: ["init", "test", "update", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"], + fields: { + init: { + validate: assertNodeType("VariableDeclaration", "Expression"), + optional: true + }, + test: { + validate: assertNodeType("Expression"), + optional: true + }, + update: { + validate: assertNodeType("Expression"), + optional: true + }, + body: { + validate: assertNodeType("Statement") + } + } + }); + var functionCommon = function functionCommon() { + return { + params: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Identifier", "Pattern", "RestElement"))) + }, + generator: { + "default": false + }, + async: { + "default": false + } + }; + }; + var functionTypeAnnotationCommon = function functionTypeAnnotationCommon() { + return { + returnType: { + validate: assertNodeType("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, + typeParameters: { + validate: assertNodeType("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), + optional: true + } + }; + }; + var functionDeclarationCommon = function functionDeclarationCommon() { + return Object.assign({}, functionCommon(), { + declare: { + validate: assertValueType("boolean"), + optional: true + }, + id: { + validate: assertNodeType("Identifier"), + optional: true + } + }); + }; + defineType$4("FunctionDeclaration", { + builder: ["id", "params", "body", "generator", "async"], + visitor: ["id", "params", "body", "returnType", "typeParameters"], + fields: Object.assign({}, functionDeclarationCommon(), functionTypeAnnotationCommon(), { + body: { + validate: assertNodeType("BlockStatement") + }, + predicate: { + validate: assertNodeType("DeclaredPredicate", "InferredPredicate"), + optional: true + } + }), + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"], + validate: function () { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return function () {}; + var identifier = assertNodeType("Identifier"); + return function (parent, key, node) { + if (!is$1("ExportDefaultDeclaration", parent)) { + identifier(node, "id", node.id); + } + }; + }() + }); + defineType$4("FunctionExpression", { + inherits: "FunctionDeclaration", + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], + fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), { + id: { + validate: assertNodeType("Identifier"), + optional: true + }, + body: { + validate: assertNodeType("BlockStatement") + }, + predicate: { + validate: assertNodeType("DeclaredPredicate", "InferredPredicate"), + optional: true + } + }) + }); + var patternLikeCommon = function patternLikeCommon() { + return { + typeAnnotation: { + validate: assertNodeType("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, + optional: { + validate: assertValueType("boolean"), + optional: true + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + } + }; + }; + defineType$4("Identifier", { + builder: ["name"], + visitor: ["typeAnnotation", "decorators"], + aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"], + fields: Object.assign({}, patternLikeCommon(), { + name: { + validate: chain$1(assertValueType("string"), Object.assign(function (node, key, val) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + if (!isValidIdentifier$1(val, false)) { + throw new TypeError("\"" + val + "\" is not a valid identifier name"); + } + }, { + type: "string" + })) + } + }), + validate: function validate(parent, key, node) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + var match = /\.(\w+)$/.exec(key); + if (!match) return; + var _match = _slicedToArray(match, 2), + parentKey = _match[1]; + var nonComp = { + computed: false + }; + if (parentKey === "property") { + if (is$1("MemberExpression", parent, nonComp)) return; + if (is$1("OptionalMemberExpression", parent, nonComp)) return; + } else if (parentKey === "key") { + if (is$1("Property", parent, nonComp)) return; + if (is$1("Method", parent, nonComp)) return; + } else if (parentKey === "exported") { + if (is$1("ExportSpecifier", parent)) return; + } else if (parentKey === "imported") { + if (is$1("ImportSpecifier", parent, { + imported: node + })) return; + } else if (parentKey === "meta") { + if (is$1("MetaProperty", parent, { + meta: node + })) return; + } + if ((isKeyword(node.name) || isReservedWord(node.name, false)) && node.name !== "this") { + throw new TypeError("\"" + node.name + "\" is not a valid identifier"); + } + } + }); + defineType$4("IfStatement", { + visitor: ["test", "consequent", "alternate"], + aliases: ["Statement", "Conditional"], + fields: { + test: { + validate: assertNodeType("Expression") + }, + consequent: { + validate: assertNodeType("Statement") + }, + alternate: { + optional: true, + validate: assertNodeType("Statement") + } + } + }); + defineType$4("LabeledStatement", { + visitor: ["label", "body"], + aliases: ["Statement"], + fields: { + label: { + validate: assertNodeType("Identifier") + }, + body: { + validate: assertNodeType("Statement") + } + } + }); + defineType$4("StringLiteral", { + builder: ["value"], + fields: { + value: { + validate: assertValueType("string") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] + }); + defineType$4("NumericLiteral", { + builder: ["value"], + deprecatedAlias: "NumberLiteral", + fields: { + value: { + validate: chain$1(assertValueType("number"), Object.assign(function (node, key, val) { + }, { + type: "number" + })) + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] + }); + defineType$4("NullLiteral", { + aliases: ["Expression", "Pureish", "Literal", "Immutable"] + }); + defineType$4("BooleanLiteral", { + builder: ["value"], + fields: { + value: { + validate: assertValueType("boolean") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] + }); + defineType$4("RegExpLiteral", { + builder: ["pattern", "flags"], + deprecatedAlias: "RegexLiteral", + aliases: ["Expression", "Pureish", "Literal"], + fields: { + pattern: { + validate: assertValueType("string") + }, + flags: { + validate: chain$1(assertValueType("string"), Object.assign(function (node, key, val) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + var invalid = /[^gimsuy]/.exec(val); + if (invalid) { + throw new TypeError("\"" + invalid[0] + "\" is not a valid RegExp flag"); + } + }, { + type: "string" + })), + "default": "" + } + } + }); + defineType$4("LogicalExpression", { + builder: ["operator", "left", "right"], + visitor: ["left", "right"], + aliases: ["Binary", "Expression"], + fields: { + operator: { + validate: assertOneOf.apply(void 0, _toConsumableArray(LOGICAL_OPERATORS$3)) + }, + left: { + validate: assertNodeType("Expression") + }, + right: { + validate: assertNodeType("Expression") + } + } + }); + defineType$4("MemberExpression", { + builder: ["object", "property", "computed"].concat(_toConsumableArray(!browser$1$1.env.BABEL_TYPES_8_BREAKING ? ["optional"] : [])), + visitor: ["object", "property"], + aliases: ["Expression", "LVal"], + fields: Object.assign({ + object: { + validate: assertNodeType("Expression", "Super") + }, + property: { + validate: function () { + var normal = assertNodeType("Identifier", "PrivateName"); + var computed = assertNodeType("Expression"); + var validator = function validator(node, key, val) { + var validator = node.computed ? computed : normal; + validator(node, key, val); + }; + validator.oneOfNodeTypes = ["Expression", "Identifier", "PrivateName"]; + return validator; + }() + }, + computed: { + "default": false + } + }, !browser$1$1.env.BABEL_TYPES_8_BREAKING ? { + optional: { + validate: assertOneOf(true, false), + optional: true + } + } : {}) + }); + defineType$4("NewExpression", { + inherits: "CallExpression" + }); + defineType$4("Program", { + visitor: ["directives", "body"], + builder: ["body", "directives", "sourceType", "interpreter"], + fields: { + sourceFile: { + validate: assertValueType("string") + }, + sourceType: { + validate: assertOneOf("script", "module"), + "default": "script" + }, + interpreter: { + validate: assertNodeType("InterpreterDirective"), + "default": null, + optional: true + }, + directives: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Directive"))), + "default": [] + }, + body: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Statement"))) + } + }, + aliases: ["Scopable", "BlockParent", "Block"] + }); + defineType$4("ObjectExpression", { + visitor: ["properties"], + aliases: ["Expression"], + fields: { + properties: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("ObjectMethod", "ObjectProperty", "SpreadElement"))) + } + } + }); + defineType$4("ObjectMethod", { + builder: ["kind", "key", "params", "body", "computed", "generator", "async"], + fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), { + kind: Object.assign({ + validate: assertOneOf("method", "get", "set") + }, !browser$1$1.env.BABEL_TYPES_8_BREAKING ? { + "default": "method" + } : {}), + computed: { + "default": false + }, + key: { + validate: function () { + var normal = assertNodeType("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral"); + var computed = assertNodeType("Expression"); + var validator = function validator(node, key, val) { + var validator = node.computed ? computed : normal; + validator(node, key, val); + }; + validator.oneOfNodeTypes = ["Expression", "Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral"]; + return validator; + }() + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + }, + body: { + validate: assertNodeType("BlockStatement") + } + }), + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"] + }); + defineType$4("ObjectProperty", { + builder: ["key", "value", "computed", "shorthand"].concat(_toConsumableArray(!browser$1$1.env.BABEL_TYPES_8_BREAKING ? ["decorators"] : [])), + fields: { + computed: { + "default": false + }, + key: { + validate: function () { + var normal = assertNodeType("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "DecimalLiteral", "PrivateName"); + var computed = assertNodeType("Expression"); + var validator = Object.assign(function (node, key, val) { + var validator = node.computed ? computed : normal; + validator(node, key, val); + }, { + oneOfNodeTypes: ["Expression", "Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "DecimalLiteral", "PrivateName"] + }); + return validator; + }() + }, + value: { + validate: assertNodeType("Expression", "PatternLike") + }, + shorthand: { + validate: chain$1(assertValueType("boolean"), Object.assign(function (node, key, val) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + if (val && node.computed) { + throw new TypeError("Property shorthand of ObjectProperty cannot be true if computed is true"); + } + }, { + type: "boolean" + }), function (node, key, val) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + if (val && !is$1("Identifier", node.key)) { + throw new TypeError("Property shorthand of ObjectProperty cannot be true if key is not an Identifier"); + } + }), + "default": false + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + } + }, + visitor: ["key", "value", "decorators"], + aliases: ["UserWhitespacable", "Property", "ObjectMember"], + validate: function () { + var pattern = assertNodeType("Identifier", "Pattern", "TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion"); + var expression = assertNodeType("Expression"); + return function (parent, key, node) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + var validator = is$1("ObjectPattern", parent) ? pattern : expression; + validator(node, "value", node.value); + }; + }() + }); + defineType$4("RestElement", { + visitor: ["argument", "typeAnnotation"], + builder: ["argument"], + aliases: ["LVal", "PatternLike"], + deprecatedAlias: "RestProperty", + fields: Object.assign({}, patternLikeCommon(), { + argument: { + validate: !browser$1$1.env.BABEL_TYPES_8_BREAKING ? assertNodeType("LVal") : assertNodeType("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") + } + }), + validate: function validate(parent, key) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + var match = /(\w+)\[(\d+)\]/.exec(key); + if (!match) throw new Error("Internal Babel error: malformed key."); + var _ref = match, + _ref2 = _slicedToArray(_ref, 3), + listKey = _ref2[1], + index = _ref2[2]; + if (parent[listKey].length > +index + 1) { + throw new TypeError("RestElement must be last element of " + listKey); + } + } + }); + defineType$4("ReturnStatement", { + visitor: ["argument"], + aliases: ["Statement", "Terminatorless", "CompletionStatement"], + fields: { + argument: { + validate: assertNodeType("Expression"), + optional: true + } + } + }); + defineType$4("SequenceExpression", { + visitor: ["expressions"], + fields: { + expressions: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Expression"))) + } + }, + aliases: ["Expression"] + }); + defineType$4("ParenthesizedExpression", { + visitor: ["expression"], + aliases: ["Expression", "ExpressionWrapper"], + fields: { + expression: { + validate: assertNodeType("Expression") + } + } + }); + defineType$4("SwitchCase", { + visitor: ["test", "consequent"], + fields: { + test: { + validate: assertNodeType("Expression"), + optional: true + }, + consequent: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Statement"))) + } + } + }); + defineType$4("SwitchStatement", { + visitor: ["discriminant", "cases"], + aliases: ["Statement", "BlockParent", "Scopable"], + fields: { + discriminant: { + validate: assertNodeType("Expression") + }, + cases: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("SwitchCase"))) + } + } + }); + defineType$4("ThisExpression", { + aliases: ["Expression"] + }); + defineType$4("ThrowStatement", { + visitor: ["argument"], + aliases: ["Statement", "Terminatorless", "CompletionStatement"], + fields: { + argument: { + validate: assertNodeType("Expression") + } + } + }); + defineType$4("TryStatement", { + visitor: ["block", "handler", "finalizer"], + aliases: ["Statement"], + fields: { + block: { + validate: chain$1(assertNodeType("BlockStatement"), Object.assign(function (node) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + if (!node.handler && !node.finalizer) { + throw new TypeError("TryStatement expects either a handler or finalizer, or both"); + } + }, { + oneOfNodeTypes: ["BlockStatement"] + })) + }, + handler: { + optional: true, + validate: assertNodeType("CatchClause") + }, + finalizer: { + optional: true, + validate: assertNodeType("BlockStatement") + } + } + }); + defineType$4("UnaryExpression", { + builder: ["operator", "argument", "prefix"], + fields: { + prefix: { + "default": true + }, + argument: { + validate: assertNodeType("Expression") + }, + operator: { + validate: assertOneOf.apply(void 0, _toConsumableArray(UNARY_OPERATORS)) + } + }, + visitor: ["argument"], + aliases: ["UnaryLike", "Expression"] + }); + defineType$4("UpdateExpression", { + builder: ["operator", "argument", "prefix"], + fields: { + prefix: { + "default": false + }, + argument: { + validate: !browser$1$1.env.BABEL_TYPES_8_BREAKING ? assertNodeType("Expression") : assertNodeType("Identifier", "MemberExpression") + }, + operator: { + validate: assertOneOf.apply(void 0, _toConsumableArray(UPDATE_OPERATORS)) + } + }, + visitor: ["argument"], + aliases: ["Expression"] + }); + defineType$4("VariableDeclaration", { + builder: ["kind", "declarations"], + visitor: ["declarations"], + aliases: ["Statement", "Declaration"], + fields: { + declare: { + validate: assertValueType("boolean"), + optional: true + }, + kind: { + validate: assertOneOf("var", "let", "const", "using", "await using") + }, + declarations: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("VariableDeclarator"))) + } + }, + validate: function validate(parent, key, node) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + if (!is$1("ForXStatement", parent, { + left: node + })) return; + if (node.declarations.length !== 1) { + throw new TypeError("Exactly one VariableDeclarator is required in the VariableDeclaration of a " + parent.type); + } + } + }); + defineType$4("VariableDeclarator", { + visitor: ["id", "init"], + fields: { + id: { + validate: function () { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) { + return assertNodeType("LVal"); + } + var normal = assertNodeType("Identifier", "ArrayPattern", "ObjectPattern"); + var without = assertNodeType("Identifier"); + return function (node, key, val) { + var validator = node.init ? normal : without; + validator(node, key, val); + }; + }() + }, + definite: { + optional: true, + validate: assertValueType("boolean") + }, + init: { + optional: true, + validate: assertNodeType("Expression") + } + } + }); + defineType$4("WhileStatement", { + visitor: ["test", "body"], + aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"], + fields: { + test: { + validate: assertNodeType("Expression") + }, + body: { + validate: assertNodeType("Statement") + } + } + }); + defineType$4("WithStatement", { + visitor: ["object", "body"], + aliases: ["Statement"], + fields: { + object: { + validate: assertNodeType("Expression") + }, + body: { + validate: assertNodeType("Statement") + } + } + }); + defineType$4("AssignmentPattern", { + visitor: ["left", "right", "decorators"], + builder: ["left", "right"], + aliases: ["Pattern", "PatternLike", "LVal"], + fields: Object.assign({}, patternLikeCommon(), { + left: { + validate: assertNodeType("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") + }, + right: { + validate: assertNodeType("Expression") + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + } + }) + }); + defineType$4("ArrayPattern", { + visitor: ["elements", "typeAnnotation"], + builder: ["elements"], + aliases: ["Pattern", "PatternLike", "LVal"], + fields: Object.assign({}, patternLikeCommon(), { + elements: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeOrValueType("null", "PatternLike", "LVal"))) + } + }) + }); + defineType$4("ArrowFunctionExpression", { + builder: ["params", "body", "async"], + visitor: ["params", "body", "returnType", "typeParameters"], + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], + fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), { + expression: { + validate: assertValueType("boolean") + }, + body: { + validate: assertNodeType("BlockStatement", "Expression") + }, + predicate: { + validate: assertNodeType("DeclaredPredicate", "InferredPredicate"), + optional: true + } + }) + }); + defineType$4("ClassBody", { + visitor: ["body"], + fields: { + body: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassPrivateProperty", "ClassAccessorProperty", "TSDeclareMethod", "TSIndexSignature", "StaticBlock"))) + } + } + }); + defineType$4("ClassExpression", { + builder: ["id", "superClass", "body", "decorators"], + visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"], + aliases: ["Scopable", "Class", "Expression"], + fields: { + id: { + validate: assertNodeType("Identifier"), + optional: true + }, + typeParameters: { + validate: assertNodeType("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), + optional: true + }, + body: { + validate: assertNodeType("ClassBody") + }, + superClass: { + optional: true, + validate: assertNodeType("Expression") + }, + superTypeParameters: { + validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + optional: true + }, + "implements": { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("TSExpressionWithTypeArguments", "ClassImplements"))), + optional: true + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + }, + mixins: { + validate: assertNodeType("InterfaceExtends"), + optional: true + } + } + }); + defineType$4("ClassDeclaration", { + inherits: "ClassExpression", + aliases: ["Scopable", "Class", "Statement", "Declaration"], + fields: { + id: { + validate: assertNodeType("Identifier") + }, + typeParameters: { + validate: assertNodeType("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), + optional: true + }, + body: { + validate: assertNodeType("ClassBody") + }, + superClass: { + optional: true, + validate: assertNodeType("Expression") + }, + superTypeParameters: { + validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + optional: true + }, + "implements": { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("TSExpressionWithTypeArguments", "ClassImplements"))), + optional: true + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + }, + mixins: { + validate: assertNodeType("InterfaceExtends"), + optional: true + }, + declare: { + validate: assertValueType("boolean"), + optional: true + }, + "abstract": { + validate: assertValueType("boolean"), + optional: true + } + }, + validate: function () { + var identifier = assertNodeType("Identifier"); + return function (parent, key, node) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + if (!is$1("ExportDefaultDeclaration", parent)) { + identifier(node, "id", node.id); + } + }; + }() + }); + defineType$4("ExportAllDeclaration", { + builder: ["source"], + visitor: ["source", "attributes", "assertions"], + aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"], + fields: { + source: { + validate: assertNodeType("StringLiteral") + }, + exportKind: validateOptional(assertOneOf("type", "value")), + attributes: { + optional: true, + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("ImportAttribute"))) + }, + assertions: { + optional: true, + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("ImportAttribute"))) + } + } + }); + defineType$4("ExportDefaultDeclaration", { + visitor: ["declaration"], + aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"], + fields: { + declaration: { + validate: assertNodeType("TSDeclareFunction", "FunctionDeclaration", "ClassDeclaration", "Expression") + }, + exportKind: validateOptional(assertOneOf("value")) + } + }); + defineType$4("ExportNamedDeclaration", { + builder: ["declaration", "specifiers", "source"], + visitor: ["declaration", "specifiers", "source", "attributes", "assertions"], + aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"], + fields: { + declaration: { + optional: true, + validate: chain$1(assertNodeType("Declaration"), Object.assign(function (node, key, val) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + if (val && node.specifiers.length) { + throw new TypeError("Only declaration or specifiers is allowed on ExportNamedDeclaration"); + } + }, { + oneOfNodeTypes: ["Declaration"] + }), function (node, key, val) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + if (val && node.source) { + throw new TypeError("Cannot export a declaration from a source"); + } + }) + }, + attributes: { + optional: true, + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("ImportAttribute"))) + }, + assertions: { + optional: true, + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("ImportAttribute"))) + }, + specifiers: { + "default": [], + validate: chain$1(assertValueType("array"), assertEach(function () { + var sourced = assertNodeType("ExportSpecifier", "ExportDefaultSpecifier", "ExportNamespaceSpecifier"); + var sourceless = assertNodeType("ExportSpecifier"); + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return sourced; + return function (node, key, val) { + var validator = node.source ? sourced : sourceless; + validator(node, key, val); + }; + }())) + }, + source: { + validate: assertNodeType("StringLiteral"), + optional: true + }, + exportKind: validateOptional(assertOneOf("type", "value")) + } + }); + defineType$4("ExportSpecifier", { + visitor: ["local", "exported"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: assertNodeType("Identifier") + }, + exported: { + validate: assertNodeType("Identifier", "StringLiteral") + }, + exportKind: { + validate: assertOneOf("type", "value"), + optional: true + } + } + }); + defineType$4("ForOfStatement", { + visitor: ["left", "right", "body"], + builder: ["left", "right", "body", "await"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], + fields: { + left: { + validate: function () { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) { + return assertNodeType("VariableDeclaration", "LVal"); + } + var declaration = assertNodeType("VariableDeclaration"); + var lval = assertNodeType("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression"); + return function (node, key, val) { + if (is$1("VariableDeclaration", val)) { + declaration(node, key, val); + } else { + lval(node, key, val); + } + }; + }() + }, + right: { + validate: assertNodeType("Expression") + }, + body: { + validate: assertNodeType("Statement") + }, + "await": { + "default": false + } + } + }); + defineType$4("ImportDeclaration", { + builder: ["specifiers", "source"], + visitor: ["specifiers", "source", "attributes", "assertions"], + aliases: ["Statement", "Declaration", "ImportOrExportDeclaration"], + fields: { + attributes: { + optional: true, + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("ImportAttribute"))) + }, + assertions: { + optional: true, + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("ImportAttribute"))) + }, + module: { + optional: true, + validate: assertValueType("boolean") + }, + specifiers: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier"))) + }, + source: { + validate: assertNodeType("StringLiteral") + }, + importKind: { + validate: assertOneOf("type", "typeof", "value"), + optional: true + } + } + }); + defineType$4("ImportDefaultSpecifier", { + visitor: ["local"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: assertNodeType("Identifier") + } + } + }); + defineType$4("ImportNamespaceSpecifier", { + visitor: ["local"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: assertNodeType("Identifier") + } + } + }); + defineType$4("ImportSpecifier", { + visitor: ["local", "imported"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: assertNodeType("Identifier") + }, + imported: { + validate: assertNodeType("Identifier", "StringLiteral") + }, + importKind: { + validate: assertOneOf("type", "typeof", "value"), + optional: true + } + } + }); + defineType$4("MetaProperty", { + visitor: ["meta", "property"], + aliases: ["Expression"], + fields: { + meta: { + validate: chain$1(assertNodeType("Identifier"), Object.assign(function (node, key, val) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + var property; + switch (val.name) { + case "function": + property = "sent"; + break; + case "new": + property = "target"; + break; + case "import": + property = "meta"; + break; + } + if (!is$1("Identifier", node.property, { + name: property + })) { + throw new TypeError("Unrecognised MetaProperty"); + } + }, { + oneOfNodeTypes: ["Identifier"] + })) + }, + property: { + validate: assertNodeType("Identifier") + } + } + }); + var classMethodOrPropertyCommon = function classMethodOrPropertyCommon() { + return { + "abstract": { + validate: assertValueType("boolean"), + optional: true + }, + accessibility: { + validate: assertOneOf("public", "private", "protected"), + optional: true + }, + "static": { + "default": false + }, + override: { + "default": false + }, + computed: { + "default": false + }, + optional: { + validate: assertValueType("boolean"), + optional: true + }, + key: { + validate: chain$1(function () { + var normal = assertNodeType("Identifier", "StringLiteral", "NumericLiteral"); + var computed = assertNodeType("Expression"); + return function (node, key, val) { + var validator = node.computed ? computed : normal; + validator(node, key, val); + }; + }(), assertNodeType("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "Expression")) + } + }; + }; + var classMethodOrDeclareMethodCommon = function classMethodOrDeclareMethodCommon() { + return Object.assign({}, functionCommon(), classMethodOrPropertyCommon(), { + params: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Identifier", "Pattern", "RestElement", "TSParameterProperty"))) + }, + kind: { + validate: assertOneOf("get", "set", "method", "constructor"), + "default": "method" + }, + access: { + validate: chain$1(assertValueType("string"), assertOneOf("public", "private", "protected")), + optional: true + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + } + }); + }; + defineType$4("ClassMethod", { + aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"], + builder: ["kind", "key", "params", "body", "computed", "static", "generator", "async"], + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + fields: Object.assign({}, classMethodOrDeclareMethodCommon(), functionTypeAnnotationCommon(), { + body: { + validate: assertNodeType("BlockStatement") + } + }) + }); + defineType$4("ObjectPattern", { + visitor: ["properties", "typeAnnotation", "decorators"], + builder: ["properties"], + aliases: ["Pattern", "PatternLike", "LVal"], + fields: Object.assign({}, patternLikeCommon(), { + properties: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("RestElement", "ObjectProperty"))) + } + }) + }); + defineType$4("SpreadElement", { + visitor: ["argument"], + aliases: ["UnaryLike"], + deprecatedAlias: "SpreadProperty", + fields: { + argument: { + validate: assertNodeType("Expression") + } + } + }); + defineType$4("Super", { + aliases: ["Expression"] + }); + defineType$4("TaggedTemplateExpression", { + visitor: ["tag", "quasi", "typeParameters"], + builder: ["tag", "quasi"], + aliases: ["Expression"], + fields: { + tag: { + validate: assertNodeType("Expression") + }, + quasi: { + validate: assertNodeType("TemplateLiteral") + }, + typeParameters: { + validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + optional: true + } + } + }); + defineType$4("TemplateElement", { + builder: ["value", "tail"], + fields: { + value: { + validate: chain$1(assertShape({ + raw: { + validate: assertValueType("string") + }, + cooked: { + validate: assertValueType("string"), + optional: true + } + }), function templateElementCookedValidator(node) { + var raw = node.value.raw; + var unterminatedCalled = false; + var error = function error() { + throw new Error("Internal @babel/types error."); + }; + var _readStringContents = readStringContents("template", raw, 0, 0, 0, { + unterminated: function unterminated() { + unterminatedCalled = true; + }, + strictNumericEscape: error, + invalidEscapeSequence: error, + numericSeparatorInEscapeSequence: error, + unexpectedNumericSeparator: error, + invalidDigit: error, + invalidCodePoint: error + }), + str = _readStringContents.str, + firstInvalidLoc = _readStringContents.firstInvalidLoc; + if (!unterminatedCalled) throw new Error("Invalid raw"); + node.value.cooked = firstInvalidLoc ? null : str; + }) + }, + tail: { + "default": false + } + } + }); + defineType$4("TemplateLiteral", { + visitor: ["quasis", "expressions"], + aliases: ["Expression", "Literal"], + fields: { + quasis: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("TemplateElement"))) + }, + expressions: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Expression", "TSType")), function (node, key, val) { + if (node.quasis.length !== val.length + 1) { + throw new TypeError("Number of " + node.type + " quasis should be exactly one more than the number of expressions.\nExpected " + (val.length + 1) + " quasis but got " + node.quasis.length); + } + }) + } + } + }); + defineType$4("YieldExpression", { + builder: ["argument", "delegate"], + visitor: ["argument"], + aliases: ["Expression", "Terminatorless"], + fields: { + delegate: { + validate: chain$1(assertValueType("boolean"), Object.assign(function (node, key, val) { + if (!browser$1$1.env.BABEL_TYPES_8_BREAKING) return; + if (val && !node.argument) { + throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument"); + } + }, { + type: "boolean" + })), + "default": false + }, + argument: { + optional: true, + validate: assertNodeType("Expression") + } + } + }); + defineType$4("AwaitExpression", { + builder: ["argument"], + visitor: ["argument"], + aliases: ["Expression", "Terminatorless"], + fields: { + argument: { + validate: assertNodeType("Expression") + } + } + }); + defineType$4("Import", { + aliases: ["Expression"] + }); + defineType$4("BigIntLiteral", { + builder: ["value"], + fields: { + value: { + validate: assertValueType("string") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] + }); + defineType$4("ExportNamespaceSpecifier", { + visitor: ["exported"], + aliases: ["ModuleSpecifier"], + fields: { + exported: { + validate: assertNodeType("Identifier") + } + } + }); + defineType$4("OptionalMemberExpression", { + builder: ["object", "property", "computed", "optional"], + visitor: ["object", "property"], + aliases: ["Expression"], + fields: { + object: { + validate: assertNodeType("Expression") + }, + property: { + validate: function () { + var normal = assertNodeType("Identifier"); + var computed = assertNodeType("Expression"); + var validator = Object.assign(function (node, key, val) { + var validator = node.computed ? computed : normal; + validator(node, key, val); + }, { + oneOfNodeTypes: ["Expression", "Identifier"] + }); + return validator; + }() + }, + computed: { + "default": false + }, + optional: { + validate: !browser$1$1.env.BABEL_TYPES_8_BREAKING ? assertValueType("boolean") : chain$1(assertValueType("boolean"), assertOptionalChainStart()) + } + } + }); + defineType$4("OptionalCallExpression", { + visitor: ["callee", "arguments", "typeParameters", "typeArguments"], + builder: ["callee", "arguments", "optional"], + aliases: ["Expression"], + fields: { + callee: { + validate: assertNodeType("Expression") + }, + arguments: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Expression", "SpreadElement", "JSXNamespacedName", "ArgumentPlaceholder"))) + }, + optional: { + validate: !browser$1$1.env.BABEL_TYPES_8_BREAKING ? assertValueType("boolean") : chain$1(assertValueType("boolean"), assertOptionalChainStart()) + }, + typeArguments: { + validate: assertNodeType("TypeParameterInstantiation"), + optional: true + }, + typeParameters: { + validate: assertNodeType("TSTypeParameterInstantiation"), + optional: true + } + } + }); + defineType$4("ClassProperty", { + visitor: ["key", "value", "typeAnnotation", "decorators"], + builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"], + aliases: ["Property"], + fields: Object.assign({}, classMethodOrPropertyCommon(), { + value: { + validate: assertNodeType("Expression"), + optional: true + }, + definite: { + validate: assertValueType("boolean"), + optional: true + }, + typeAnnotation: { + validate: assertNodeType("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + }, + readonly: { + validate: assertValueType("boolean"), + optional: true + }, + declare: { + validate: assertValueType("boolean"), + optional: true + }, + variance: { + validate: assertNodeType("Variance"), + optional: true + } + }) + }); + defineType$4("ClassAccessorProperty", { + visitor: ["key", "value", "typeAnnotation", "decorators"], + builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"], + aliases: ["Property", "Accessor"], + fields: Object.assign({}, classMethodOrPropertyCommon(), { + key: { + validate: chain$1(function () { + var normal = assertNodeType("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "PrivateName"); + var computed = assertNodeType("Expression"); + return function (node, key, val) { + var validator = node.computed ? computed : normal; + validator(node, key, val); + }; + }(), assertNodeType("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "Expression", "PrivateName")) + }, + value: { + validate: assertNodeType("Expression"), + optional: true + }, + definite: { + validate: assertValueType("boolean"), + optional: true + }, + typeAnnotation: { + validate: assertNodeType("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + }, + readonly: { + validate: assertValueType("boolean"), + optional: true + }, + declare: { + validate: assertValueType("boolean"), + optional: true + }, + variance: { + validate: assertNodeType("Variance"), + optional: true + } + }) + }); + defineType$4("ClassPrivateProperty", { + visitor: ["key", "value", "decorators", "typeAnnotation"], + builder: ["key", "value", "decorators", "static"], + aliases: ["Property", "Private"], + fields: { + key: { + validate: assertNodeType("PrivateName") + }, + value: { + validate: assertNodeType("Expression"), + optional: true + }, + typeAnnotation: { + validate: assertNodeType("TypeAnnotation", "TSTypeAnnotation", "Noop"), + optional: true + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + }, + "static": { + validate: assertValueType("boolean"), + "default": false + }, + readonly: { + validate: assertValueType("boolean"), + optional: true + }, + definite: { + validate: assertValueType("boolean"), + optional: true + }, + variance: { + validate: assertNodeType("Variance"), + optional: true + } + } + }); + defineType$4("ClassPrivateMethod", { + builder: ["kind", "key", "params", "body", "static"], + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method", "Private"], + fields: Object.assign({}, classMethodOrDeclareMethodCommon(), functionTypeAnnotationCommon(), { + kind: { + validate: assertOneOf("get", "set", "method"), + "default": "method" + }, + key: { + validate: assertNodeType("PrivateName") + }, + body: { + validate: assertNodeType("BlockStatement") + } + }) + }); + defineType$4("PrivateName", { + visitor: ["id"], + aliases: ["Private"], + fields: { + id: { + validate: assertNodeType("Identifier") + } + } + }); + defineType$4("StaticBlock", { + visitor: ["body"], + fields: { + body: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Statement"))) + } + }, + aliases: ["Scopable", "BlockParent", "FunctionParent"] + }); + + var defineType$3 = defineAliasedType("Flow"); + var defineInterfaceishType = function defineInterfaceishType(name) { + var isDeclareClass = name === "DeclareClass"; + defineType$3(name, { + builder: ["id", "typeParameters", "extends", "body"], + visitor: ["id", "typeParameters", "extends"].concat(_toConsumableArray(isDeclareClass ? ["mixins", "implements"] : []), ["body"]), + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: Object.assign({ + id: validateType("Identifier"), + typeParameters: validateOptionalType("TypeParameterDeclaration"), + "extends": validateOptional(arrayOfType("InterfaceExtends")) + }, isDeclareClass ? { + mixins: validateOptional(arrayOfType("InterfaceExtends")), + "implements": validateOptional(arrayOfType("ClassImplements")) + } : {}, { + body: validateType("ObjectTypeAnnotation") + }) + }); + }; + defineType$3("AnyTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] + }); + defineType$3("ArrayTypeAnnotation", { + visitor: ["elementType"], + aliases: ["FlowType"], + fields: { + elementType: validateType("FlowType") + } + }); + defineType$3("BooleanTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] + }); + defineType$3("BooleanLiteralTypeAnnotation", { + builder: ["value"], + aliases: ["FlowType"], + fields: { + value: validate$6(assertValueType("boolean")) + } + }); + defineType$3("NullLiteralTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] + }); + defineType$3("ClassImplements", { + visitor: ["id", "typeParameters"], + fields: { + id: validateType("Identifier"), + typeParameters: validateOptionalType("TypeParameterInstantiation") + } + }); + defineInterfaceishType("DeclareClass"); + defineType$3("DeclareFunction", { + visitor: ["id"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: validateType("Identifier"), + predicate: validateOptionalType("DeclaredPredicate") + } + }); + defineInterfaceishType("DeclareInterface"); + defineType$3("DeclareModule", { + builder: ["id", "body", "kind"], + visitor: ["id", "body"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: validateType(["Identifier", "StringLiteral"]), + body: validateType("BlockStatement"), + kind: validateOptional(assertOneOf("CommonJS", "ES")) + } + }); + defineType$3("DeclareModuleExports", { + visitor: ["typeAnnotation"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + typeAnnotation: validateType("TypeAnnotation") + } + }); + defineType$3("DeclareTypeAlias", { + visitor: ["id", "typeParameters", "right"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: validateType("Identifier"), + typeParameters: validateOptionalType("TypeParameterDeclaration"), + right: validateType("FlowType") + } + }); + defineType$3("DeclareOpaqueType", { + visitor: ["id", "typeParameters", "supertype"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: validateType("Identifier"), + typeParameters: validateOptionalType("TypeParameterDeclaration"), + supertype: validateOptionalType("FlowType"), + impltype: validateOptionalType("FlowType") + } + }); + defineType$3("DeclareVariable", { + visitor: ["id"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: validateType("Identifier") + } + }); + defineType$3("DeclareExportDeclaration", { + visitor: ["declaration", "specifiers", "source"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + declaration: validateOptionalType("Flow"), + specifiers: validateOptional(arrayOfType(["ExportSpecifier", "ExportNamespaceSpecifier"])), + source: validateOptionalType("StringLiteral"), + "default": validateOptional(assertValueType("boolean")) + } + }); + defineType$3("DeclareExportAllDeclaration", { + visitor: ["source"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + source: validateType("StringLiteral"), + exportKind: validateOptional(assertOneOf("type", "value")) + } + }); + defineType$3("DeclaredPredicate", { + visitor: ["value"], + aliases: ["FlowPredicate"], + fields: { + value: validateType("Flow") + } + }); + defineType$3("ExistsTypeAnnotation", { + aliases: ["FlowType"] + }); + defineType$3("FunctionTypeAnnotation", { + visitor: ["typeParameters", "params", "rest", "returnType"], + aliases: ["FlowType"], + fields: { + typeParameters: validateOptionalType("TypeParameterDeclaration"), + params: validate$6(arrayOfType("FunctionTypeParam")), + rest: validateOptionalType("FunctionTypeParam"), + "this": validateOptionalType("FunctionTypeParam"), + returnType: validateType("FlowType") + } + }); + defineType$3("FunctionTypeParam", { + visitor: ["name", "typeAnnotation"], + fields: { + name: validateOptionalType("Identifier"), + typeAnnotation: validateType("FlowType"), + optional: validateOptional(assertValueType("boolean")) + } + }); + defineType$3("GenericTypeAnnotation", { + visitor: ["id", "typeParameters"], + aliases: ["FlowType"], + fields: { + id: validateType(["Identifier", "QualifiedTypeIdentifier"]), + typeParameters: validateOptionalType("TypeParameterInstantiation") + } + }); + defineType$3("InferredPredicate", { + aliases: ["FlowPredicate"] + }); + defineType$3("InterfaceExtends", { + visitor: ["id", "typeParameters"], + fields: { + id: validateType(["Identifier", "QualifiedTypeIdentifier"]), + typeParameters: validateOptionalType("TypeParameterInstantiation") + } + }); + defineInterfaceishType("InterfaceDeclaration"); + defineType$3("InterfaceTypeAnnotation", { + visitor: ["extends", "body"], + aliases: ["FlowType"], + fields: { + "extends": validateOptional(arrayOfType("InterfaceExtends")), + body: validateType("ObjectTypeAnnotation") + } + }); + defineType$3("IntersectionTypeAnnotation", { + visitor: ["types"], + aliases: ["FlowType"], + fields: { + types: validate$6(arrayOfType("FlowType")) + } + }); + defineType$3("MixedTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] + }); + defineType$3("EmptyTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] + }); + defineType$3("NullableTypeAnnotation", { + visitor: ["typeAnnotation"], + aliases: ["FlowType"], + fields: { + typeAnnotation: validateType("FlowType") + } + }); + defineType$3("NumberLiteralTypeAnnotation", { + builder: ["value"], + aliases: ["FlowType"], + fields: { + value: validate$6(assertValueType("number")) + } + }); + defineType$3("NumberTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] + }); + defineType$3("ObjectTypeAnnotation", { + visitor: ["properties", "indexers", "callProperties", "internalSlots"], + aliases: ["FlowType"], + builder: ["properties", "indexers", "callProperties", "internalSlots", "exact"], + fields: { + properties: validate$6(arrayOfType(["ObjectTypeProperty", "ObjectTypeSpreadProperty"])), + indexers: { + validate: arrayOfType("ObjectTypeIndexer"), + optional: true, + "default": [] + }, + callProperties: { + validate: arrayOfType("ObjectTypeCallProperty"), + optional: true, + "default": [] + }, + internalSlots: { + validate: arrayOfType("ObjectTypeInternalSlot"), + optional: true, + "default": [] + }, + exact: { + validate: assertValueType("boolean"), + "default": false + }, + inexact: validateOptional(assertValueType("boolean")) + } + }); + defineType$3("ObjectTypeInternalSlot", { + visitor: ["id", "value", "optional", "static", "method"], + aliases: ["UserWhitespacable"], + fields: { + id: validateType("Identifier"), + value: validateType("FlowType"), + optional: validate$6(assertValueType("boolean")), + "static": validate$6(assertValueType("boolean")), + method: validate$6(assertValueType("boolean")) + } + }); + defineType$3("ObjectTypeCallProperty", { + visitor: ["value"], + aliases: ["UserWhitespacable"], + fields: { + value: validateType("FlowType"), + "static": validate$6(assertValueType("boolean")) + } + }); + defineType$3("ObjectTypeIndexer", { + visitor: ["id", "key", "value", "variance"], + aliases: ["UserWhitespacable"], + fields: { + id: validateOptionalType("Identifier"), + key: validateType("FlowType"), + value: validateType("FlowType"), + "static": validate$6(assertValueType("boolean")), + variance: validateOptionalType("Variance") + } + }); + defineType$3("ObjectTypeProperty", { + visitor: ["key", "value", "variance"], + aliases: ["UserWhitespacable"], + fields: { + key: validateType(["Identifier", "StringLiteral"]), + value: validateType("FlowType"), + kind: validate$6(assertOneOf("init", "get", "set")), + "static": validate$6(assertValueType("boolean")), + proto: validate$6(assertValueType("boolean")), + optional: validate$6(assertValueType("boolean")), + variance: validateOptionalType("Variance"), + method: validate$6(assertValueType("boolean")) + } + }); + defineType$3("ObjectTypeSpreadProperty", { + visitor: ["argument"], + aliases: ["UserWhitespacable"], + fields: { + argument: validateType("FlowType") + } + }); + defineType$3("OpaqueType", { + visitor: ["id", "typeParameters", "supertype", "impltype"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: validateType("Identifier"), + typeParameters: validateOptionalType("TypeParameterDeclaration"), + supertype: validateOptionalType("FlowType"), + impltype: validateType("FlowType") + } + }); + defineType$3("QualifiedTypeIdentifier", { + visitor: ["id", "qualification"], + fields: { + id: validateType("Identifier"), + qualification: validateType(["Identifier", "QualifiedTypeIdentifier"]) + } + }); + defineType$3("StringLiteralTypeAnnotation", { + builder: ["value"], + aliases: ["FlowType"], + fields: { + value: validate$6(assertValueType("string")) + } + }); + defineType$3("StringTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] + }); + defineType$3("SymbolTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] + }); + defineType$3("ThisTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] + }); + defineType$3("TupleTypeAnnotation", { + visitor: ["types"], + aliases: ["FlowType"], + fields: { + types: validate$6(arrayOfType("FlowType")) + } + }); + defineType$3("TypeofTypeAnnotation", { + visitor: ["argument"], + aliases: ["FlowType"], + fields: { + argument: validateType("FlowType") + } + }); + defineType$3("TypeAlias", { + visitor: ["id", "typeParameters", "right"], + aliases: ["FlowDeclaration", "Statement", "Declaration"], + fields: { + id: validateType("Identifier"), + typeParameters: validateOptionalType("TypeParameterDeclaration"), + right: validateType("FlowType") + } + }); + defineType$3("TypeAnnotation", { + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: validateType("FlowType") + } + }); + defineType$3("TypeCastExpression", { + visitor: ["expression", "typeAnnotation"], + aliases: ["ExpressionWrapper", "Expression"], + fields: { + expression: validateType("Expression"), + typeAnnotation: validateType("TypeAnnotation") + } + }); + defineType$3("TypeParameter", { + visitor: ["bound", "default", "variance"], + fields: { + name: validate$6(assertValueType("string")), + bound: validateOptionalType("TypeAnnotation"), + "default": validateOptionalType("FlowType"), + variance: validateOptionalType("Variance") + } + }); + defineType$3("TypeParameterDeclaration", { + visitor: ["params"], + fields: { + params: validate$6(arrayOfType("TypeParameter")) + } + }); + defineType$3("TypeParameterInstantiation", { + visitor: ["params"], + fields: { + params: validate$6(arrayOfType("FlowType")) + } + }); + defineType$3("UnionTypeAnnotation", { + visitor: ["types"], + aliases: ["FlowType"], + fields: { + types: validate$6(arrayOfType("FlowType")) + } + }); + defineType$3("Variance", { + builder: ["kind"], + fields: { + kind: validate$6(assertOneOf("minus", "plus")) + } + }); + defineType$3("VoidTypeAnnotation", { + aliases: ["FlowType", "FlowBaseAnnotation"] + }); + defineType$3("EnumDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "body"], + fields: { + id: validateType("Identifier"), + body: validateType(["EnumBooleanBody", "EnumNumberBody", "EnumStringBody", "EnumSymbolBody"]) + } + }); + defineType$3("EnumBooleanBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicitType: validate$6(assertValueType("boolean")), + members: validateArrayOfType("EnumBooleanMember"), + hasUnknownMembers: validate$6(assertValueType("boolean")) + } + }); + defineType$3("EnumNumberBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicitType: validate$6(assertValueType("boolean")), + members: validateArrayOfType("EnumNumberMember"), + hasUnknownMembers: validate$6(assertValueType("boolean")) + } + }); + defineType$3("EnumStringBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicitType: validate$6(assertValueType("boolean")), + members: validateArrayOfType(["EnumStringMember", "EnumDefaultedMember"]), + hasUnknownMembers: validate$6(assertValueType("boolean")) + } + }); + defineType$3("EnumSymbolBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + members: validateArrayOfType("EnumDefaultedMember"), + hasUnknownMembers: validate$6(assertValueType("boolean")) + } + }); + defineType$3("EnumBooleanMember", { + aliases: ["EnumMember"], + visitor: ["id"], + fields: { + id: validateType("Identifier"), + init: validateType("BooleanLiteral") + } + }); + defineType$3("EnumNumberMember", { + aliases: ["EnumMember"], + visitor: ["id", "init"], + fields: { + id: validateType("Identifier"), + init: validateType("NumericLiteral") + } + }); + defineType$3("EnumStringMember", { + aliases: ["EnumMember"], + visitor: ["id", "init"], + fields: { + id: validateType("Identifier"), + init: validateType("StringLiteral") + } + }); + defineType$3("EnumDefaultedMember", { + aliases: ["EnumMember"], + visitor: ["id"], + fields: { + id: validateType("Identifier") + } + }); + defineType$3("IndexedAccessType", { + visitor: ["objectType", "indexType"], + aliases: ["FlowType"], + fields: { + objectType: validateType("FlowType"), + indexType: validateType("FlowType") + } + }); + defineType$3("OptionalIndexedAccessType", { + visitor: ["objectType", "indexType"], + aliases: ["FlowType"], + fields: { + objectType: validateType("FlowType"), + indexType: validateType("FlowType"), + optional: validate$6(assertValueType("boolean")) + } + }); + + var defineType$2 = defineAliasedType("JSX"); + defineType$2("JSXAttribute", { + visitor: ["name", "value"], + aliases: ["Immutable"], + fields: { + name: { + validate: assertNodeType("JSXIdentifier", "JSXNamespacedName") + }, + value: { + optional: true, + validate: assertNodeType("JSXElement", "JSXFragment", "StringLiteral", "JSXExpressionContainer") + } + } + }); + defineType$2("JSXClosingElement", { + visitor: ["name"], + aliases: ["Immutable"], + fields: { + name: { + validate: assertNodeType("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName") + } + } + }); + defineType$2("JSXElement", { + builder: ["openingElement", "closingElement", "children", "selfClosing"], + visitor: ["openingElement", "children", "closingElement"], + aliases: ["Immutable", "Expression"], + fields: Object.assign({ + openingElement: { + validate: assertNodeType("JSXOpeningElement") + }, + closingElement: { + optional: true, + validate: assertNodeType("JSXClosingElement") + }, + children: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment"))) + } + }, { + selfClosing: { + validate: assertValueType("boolean"), + optional: true + } + }) + }); + defineType$2("JSXEmptyExpression", {}); + defineType$2("JSXExpressionContainer", { + visitor: ["expression"], + aliases: ["Immutable"], + fields: { + expression: { + validate: assertNodeType("Expression", "JSXEmptyExpression") + } + } + }); + defineType$2("JSXSpreadChild", { + visitor: ["expression"], + aliases: ["Immutable"], + fields: { + expression: { + validate: assertNodeType("Expression") + } + } + }); + defineType$2("JSXIdentifier", { + builder: ["name"], + fields: { + name: { + validate: assertValueType("string") + } + } + }); + defineType$2("JSXMemberExpression", { + visitor: ["object", "property"], + fields: { + object: { + validate: assertNodeType("JSXMemberExpression", "JSXIdentifier") + }, + property: { + validate: assertNodeType("JSXIdentifier") + } + } + }); + defineType$2("JSXNamespacedName", { + visitor: ["namespace", "name"], + fields: { + namespace: { + validate: assertNodeType("JSXIdentifier") + }, + name: { + validate: assertNodeType("JSXIdentifier") + } + } + }); + defineType$2("JSXOpeningElement", { + builder: ["name", "attributes", "selfClosing"], + visitor: ["name", "attributes"], + aliases: ["Immutable"], + fields: { + name: { + validate: assertNodeType("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName") + }, + selfClosing: { + "default": false + }, + attributes: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("JSXAttribute", "JSXSpreadAttribute"))) + }, + typeParameters: { + validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"), + optional: true + } + } + }); + defineType$2("JSXSpreadAttribute", { + visitor: ["argument"], + fields: { + argument: { + validate: assertNodeType("Expression") + } + } + }); + defineType$2("JSXText", { + aliases: ["Immutable"], + builder: ["value"], + fields: { + value: { + validate: assertValueType("string") + } + } + }); + defineType$2("JSXFragment", { + builder: ["openingFragment", "closingFragment", "children"], + visitor: ["openingFragment", "children", "closingFragment"], + aliases: ["Immutable", "Expression"], + fields: { + openingFragment: { + validate: assertNodeType("JSXOpeningFragment") + }, + closingFragment: { + validate: assertNodeType("JSXClosingFragment") + }, + children: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment"))) + } + } + }); + defineType$2("JSXOpeningFragment", { + aliases: ["Immutable"] + }); + defineType$2("JSXClosingFragment", { + aliases: ["Immutable"] + }); + + var PLACEHOLDERS = ["Identifier", "StringLiteral", "Expression", "Statement", "Declaration", "BlockStatement", "ClassBody", "Pattern"]; + var PLACEHOLDERS_ALIAS = { + Declaration: ["Statement"], + Pattern: ["PatternLike", "LVal"] + }; + for (var _i$2 = 0, _PLACEHOLDERS = PLACEHOLDERS; _i$2 < _PLACEHOLDERS.length; _i$2++) { + var type$2 = _PLACEHOLDERS[_i$2]; + var alias = ALIAS_KEYS[type$2]; + if (alias != null && alias.length) PLACEHOLDERS_ALIAS[type$2] = alias; + } + var PLACEHOLDERS_FLIPPED_ALIAS = {}; + Object.keys(PLACEHOLDERS_ALIAS).forEach(function (type) { + PLACEHOLDERS_ALIAS[type].forEach(function (alias) { + if (!Object.hasOwnProperty.call(PLACEHOLDERS_FLIPPED_ALIAS, alias)) { + PLACEHOLDERS_FLIPPED_ALIAS[alias] = []; + } + PLACEHOLDERS_FLIPPED_ALIAS[alias].push(type); + }); + }); + + var defineType$1 = defineAliasedType("Miscellaneous"); + { + defineType$1("Noop", { + visitor: [] + }); + } + defineType$1("Placeholder", { + visitor: [], + builder: ["expectedNode", "name"], + fields: { + name: { + validate: assertNodeType("Identifier") + }, + expectedNode: { + validate: assertOneOf.apply(void 0, _toConsumableArray(PLACEHOLDERS)) + } + } + }); + defineType$1("V8IntrinsicIdentifier", { + builder: ["name"], + fields: { + name: { + validate: assertValueType("string") + } + } + }); + + defineType$5("ArgumentPlaceholder", {}); + defineType$5("BindExpression", { + visitor: ["object", "callee"], + aliases: ["Expression"], + fields: !browser$1$1.env.BABEL_TYPES_8_BREAKING ? { + object: { + validate: Object.assign(function () {}, { + oneOfNodeTypes: ["Expression"] + }) + }, + callee: { + validate: Object.assign(function () {}, { + oneOfNodeTypes: ["Expression"] + }) + } + } : { + object: { + validate: assertNodeType("Expression") + }, + callee: { + validate: assertNodeType("Expression") + } + } + }); + defineType$5("ImportAttribute", { + visitor: ["key", "value"], + fields: { + key: { + validate: assertNodeType("Identifier", "StringLiteral") + }, + value: { + validate: assertNodeType("StringLiteral") + } + } + }); + defineType$5("Decorator", { + visitor: ["expression"], + fields: { + expression: { + validate: assertNodeType("Expression") + } + } + }); + defineType$5("DoExpression", { + visitor: ["body"], + builder: ["body", "async"], + aliases: ["Expression"], + fields: { + body: { + validate: assertNodeType("BlockStatement") + }, + async: { + validate: assertValueType("boolean"), + "default": false + } + } + }); + defineType$5("ExportDefaultSpecifier", { + visitor: ["exported"], + aliases: ["ModuleSpecifier"], + fields: { + exported: { + validate: assertNodeType("Identifier") + } + } + }); + defineType$5("RecordExpression", { + visitor: ["properties"], + aliases: ["Expression"], + fields: { + properties: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("ObjectProperty", "SpreadElement"))) + } + } + }); + defineType$5("TupleExpression", { + fields: { + elements: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Expression", "SpreadElement"))), + "default": [] + } + }, + visitor: ["elements"], + aliases: ["Expression"] + }); + defineType$5("DecimalLiteral", { + builder: ["value"], + fields: { + value: { + validate: assertValueType("string") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] + }); + defineType$5("ModuleExpression", { + visitor: ["body"], + fields: { + body: { + validate: assertNodeType("Program") + } + }, + aliases: ["Expression"] + }); + defineType$5("TopicReference", { + aliases: ["Expression"] + }); + defineType$5("PipelineTopicExpression", { + builder: ["expression"], + visitor: ["expression"], + fields: { + expression: { + validate: assertNodeType("Expression") + } + }, + aliases: ["Expression"] + }); + defineType$5("PipelineBareFunction", { + builder: ["callee"], + visitor: ["callee"], + fields: { + callee: { + validate: assertNodeType("Expression") + } + }, + aliases: ["Expression"] + }); + defineType$5("PipelinePrimaryTopicReference", { + aliases: ["Expression"] + }); + + var defineType = defineAliasedType("TypeScript"); + var bool$d = assertValueType("boolean"); + var tSFunctionTypeAnnotationCommon = function tSFunctionTypeAnnotationCommon() { + return { + returnType: { + validate: assertNodeType("TSTypeAnnotation", "Noop"), + optional: true + }, + typeParameters: { + validate: assertNodeType("TSTypeParameterDeclaration", "Noop"), + optional: true + } + }; + }; + defineType("TSParameterProperty", { + aliases: ["LVal"], + visitor: ["parameter"], + fields: { + accessibility: { + validate: assertOneOf("public", "private", "protected"), + optional: true + }, + readonly: { + validate: assertValueType("boolean"), + optional: true + }, + parameter: { + validate: assertNodeType("Identifier", "AssignmentPattern") + }, + override: { + validate: assertValueType("boolean"), + optional: true + }, + decorators: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + optional: true + } + } + }); + defineType("TSDeclareFunction", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "typeParameters", "params", "returnType"], + fields: Object.assign({}, functionDeclarationCommon(), tSFunctionTypeAnnotationCommon()) + }); + defineType("TSDeclareMethod", { + visitor: ["decorators", "key", "typeParameters", "params", "returnType"], + fields: Object.assign({}, classMethodOrDeclareMethodCommon(), tSFunctionTypeAnnotationCommon()) + }); + defineType("TSQualifiedName", { + aliases: ["TSEntityName"], + visitor: ["left", "right"], + fields: { + left: validateType("TSEntityName"), + right: validateType("Identifier") + } + }); + var signatureDeclarationCommon = function signatureDeclarationCommon() { + var _ref; + return _ref = { + typeParameters: validateOptionalType("TSTypeParameterDeclaration") + }, _ref["parameters"] = validateArrayOfType(["Identifier", "RestElement"]), _ref["typeAnnotation"] = validateOptionalType("TSTypeAnnotation"), _ref; + }; + var callConstructSignatureDeclaration = { + aliases: ["TSTypeElement"], + visitor: ["typeParameters", "parameters", "typeAnnotation"], + fields: signatureDeclarationCommon() + }; + defineType("TSCallSignatureDeclaration", callConstructSignatureDeclaration); + defineType("TSConstructSignatureDeclaration", callConstructSignatureDeclaration); + var namedTypeElementCommon = function namedTypeElementCommon() { + return { + key: validateType("Expression"), + computed: { + "default": false + }, + optional: validateOptional(bool$d) + }; + }; + defineType("TSPropertySignature", { + aliases: ["TSTypeElement"], + visitor: ["key", "typeAnnotation", "initializer"], + fields: Object.assign({}, namedTypeElementCommon(), { + readonly: validateOptional(bool$d), + typeAnnotation: validateOptionalType("TSTypeAnnotation"), + initializer: validateOptionalType("Expression"), + kind: { + validate: assertOneOf("get", "set") + } + }) + }); + defineType("TSMethodSignature", { + aliases: ["TSTypeElement"], + visitor: ["key", "typeParameters", "parameters", "typeAnnotation"], + fields: Object.assign({}, signatureDeclarationCommon(), namedTypeElementCommon(), { + kind: { + validate: assertOneOf("method", "get", "set") + } + }) + }); + defineType("TSIndexSignature", { + aliases: ["TSTypeElement"], + visitor: ["parameters", "typeAnnotation"], + fields: { + readonly: validateOptional(bool$d), + "static": validateOptional(bool$d), + parameters: validateArrayOfType("Identifier"), + typeAnnotation: validateOptionalType("TSTypeAnnotation") + } + }); + var tsKeywordTypes = ["TSAnyKeyword", "TSBooleanKeyword", "TSBigIntKeyword", "TSIntrinsicKeyword", "TSNeverKeyword", "TSNullKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSUndefinedKeyword", "TSUnknownKeyword", "TSVoidKeyword"]; + for (var _i$1 = 0, _tsKeywordTypes = tsKeywordTypes; _i$1 < _tsKeywordTypes.length; _i$1++) { + var type$1 = _tsKeywordTypes[_i$1]; + defineType(type$1, { + aliases: ["TSType", "TSBaseType"], + visitor: [], + fields: {} + }); + } + defineType("TSThisType", { + aliases: ["TSType", "TSBaseType"], + visitor: [], + fields: {} + }); + var fnOrCtrBase = { + aliases: ["TSType"], + visitor: ["typeParameters", "parameters", "typeAnnotation"] + }; + defineType("TSFunctionType", Object.assign({}, fnOrCtrBase, { + fields: signatureDeclarationCommon() + })); + defineType("TSConstructorType", Object.assign({}, fnOrCtrBase, { + fields: Object.assign({}, signatureDeclarationCommon(), { + "abstract": validateOptional(bool$d) + }) + })); + defineType("TSTypeReference", { + aliases: ["TSType"], + visitor: ["typeName", "typeParameters"], + fields: { + typeName: validateType("TSEntityName"), + typeParameters: validateOptionalType("TSTypeParameterInstantiation") + } + }); + defineType("TSTypePredicate", { + aliases: ["TSType"], + visitor: ["parameterName", "typeAnnotation"], + builder: ["parameterName", "typeAnnotation", "asserts"], + fields: { + parameterName: validateType(["Identifier", "TSThisType"]), + typeAnnotation: validateOptionalType("TSTypeAnnotation"), + asserts: validateOptional(bool$d) + } + }); + defineType("TSTypeQuery", { + aliases: ["TSType"], + visitor: ["exprName", "typeParameters"], + fields: { + exprName: validateType(["TSEntityName", "TSImportType"]), + typeParameters: validateOptionalType("TSTypeParameterInstantiation") + } + }); + defineType("TSTypeLiteral", { + aliases: ["TSType"], + visitor: ["members"], + fields: { + members: validateArrayOfType("TSTypeElement") + } + }); + defineType("TSArrayType", { + aliases: ["TSType"], + visitor: ["elementType"], + fields: { + elementType: validateType("TSType") + } + }); + defineType("TSTupleType", { + aliases: ["TSType"], + visitor: ["elementTypes"], + fields: { + elementTypes: validateArrayOfType(["TSType", "TSNamedTupleMember"]) + } + }); + defineType("TSOptionalType", { + aliases: ["TSType"], + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: validateType("TSType") + } + }); + defineType("TSRestType", { + aliases: ["TSType"], + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: validateType("TSType") + } + }); + defineType("TSNamedTupleMember", { + visitor: ["label", "elementType"], + builder: ["label", "elementType", "optional"], + fields: { + label: validateType("Identifier"), + optional: { + validate: bool$d, + "default": false + }, + elementType: validateType("TSType") + } + }); + var unionOrIntersection = { + aliases: ["TSType"], + visitor: ["types"], + fields: { + types: validateArrayOfType("TSType") + } + }; + defineType("TSUnionType", unionOrIntersection); + defineType("TSIntersectionType", unionOrIntersection); + defineType("TSConditionalType", { + aliases: ["TSType"], + visitor: ["checkType", "extendsType", "trueType", "falseType"], + fields: { + checkType: validateType("TSType"), + extendsType: validateType("TSType"), + trueType: validateType("TSType"), + falseType: validateType("TSType") + } + }); + defineType("TSInferType", { + aliases: ["TSType"], + visitor: ["typeParameter"], + fields: { + typeParameter: validateType("TSTypeParameter") + } + }); + defineType("TSParenthesizedType", { + aliases: ["TSType"], + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: validateType("TSType") + } + }); + defineType("TSTypeOperator", { + aliases: ["TSType"], + visitor: ["typeAnnotation"], + fields: { + operator: validate$6(assertValueType("string")), + typeAnnotation: validateType("TSType") + } + }); + defineType("TSIndexedAccessType", { + aliases: ["TSType"], + visitor: ["objectType", "indexType"], + fields: { + objectType: validateType("TSType"), + indexType: validateType("TSType") + } + }); + defineType("TSMappedType", { + aliases: ["TSType"], + visitor: ["typeParameter", "typeAnnotation", "nameType"], + fields: { + readonly: validateOptional(assertOneOf(true, false, "+", "-")), + typeParameter: validateType("TSTypeParameter"), + optional: validateOptional(assertOneOf(true, false, "+", "-")), + typeAnnotation: validateOptionalType("TSType"), + nameType: validateOptionalType("TSType") + } + }); + defineType("TSLiteralType", { + aliases: ["TSType", "TSBaseType"], + visitor: ["literal"], + fields: { + literal: { + validate: function () { + var unaryExpression = assertNodeType("NumericLiteral", "BigIntLiteral"); + var unaryOperator = assertOneOf("-"); + var literal = assertNodeType("NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral", "TemplateLiteral"); + function validator(parent, key, node) { + if (is$1("UnaryExpression", node)) { + unaryOperator(node, "operator", node.operator); + unaryExpression(node, "argument", node.argument); + } else { + literal(parent, key, node); + } + } + validator.oneOfNodeTypes = ["NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral", "TemplateLiteral", "UnaryExpression"]; + return validator; + }() + } + } + }); + defineType("TSExpressionWithTypeArguments", { + aliases: ["TSType"], + visitor: ["expression", "typeParameters"], + fields: { + expression: validateType("TSEntityName"), + typeParameters: validateOptionalType("TSTypeParameterInstantiation") + } + }); + defineType("TSInterfaceDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "typeParameters", "extends", "body"], + fields: { + declare: validateOptional(bool$d), + id: validateType("Identifier"), + typeParameters: validateOptionalType("TSTypeParameterDeclaration"), + "extends": validateOptional(arrayOfType("TSExpressionWithTypeArguments")), + body: validateType("TSInterfaceBody") + } + }); + defineType("TSInterfaceBody", { + visitor: ["body"], + fields: { + body: validateArrayOfType("TSTypeElement") + } + }); + defineType("TSTypeAliasDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "typeParameters", "typeAnnotation"], + fields: { + declare: validateOptional(bool$d), + id: validateType("Identifier"), + typeParameters: validateOptionalType("TSTypeParameterDeclaration"), + typeAnnotation: validateType("TSType") + } + }); + defineType("TSInstantiationExpression", { + aliases: ["Expression"], + visitor: ["expression", "typeParameters"], + fields: { + expression: validateType("Expression"), + typeParameters: validateOptionalType("TSTypeParameterInstantiation") + } + }); + var TSTypeExpression$1 = { + aliases: ["Expression", "LVal", "PatternLike"], + visitor: ["expression", "typeAnnotation"], + fields: { + expression: validateType("Expression"), + typeAnnotation: validateType("TSType") + } + }; + defineType("TSAsExpression", TSTypeExpression$1); + defineType("TSSatisfiesExpression", TSTypeExpression$1); + defineType("TSTypeAssertion", { + aliases: ["Expression", "LVal", "PatternLike"], + visitor: ["typeAnnotation", "expression"], + fields: { + typeAnnotation: validateType("TSType"), + expression: validateType("Expression") + } + }); + defineType("TSEnumDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "members"], + fields: { + declare: validateOptional(bool$d), + "const": validateOptional(bool$d), + id: validateType("Identifier"), + members: validateArrayOfType("TSEnumMember"), + initializer: validateOptionalType("Expression") + } + }); + defineType("TSEnumMember", { + visitor: ["id", "initializer"], + fields: { + id: validateType(["Identifier", "StringLiteral"]), + initializer: validateOptionalType("Expression") + } + }); + defineType("TSModuleDeclaration", { + aliases: ["Statement", "Declaration"], + visitor: ["id", "body"], + fields: { + declare: validateOptional(bool$d), + global: validateOptional(bool$d), + id: validateType(["Identifier", "StringLiteral"]), + body: validateType(["TSModuleBlock", "TSModuleDeclaration"]) + } + }); + defineType("TSModuleBlock", { + aliases: ["Scopable", "Block", "BlockParent", "FunctionParent"], + visitor: ["body"], + fields: { + body: validateArrayOfType("Statement") + } + }); + defineType("TSImportType", { + aliases: ["TSType"], + visitor: ["argument", "qualifier", "typeParameters"], + fields: { + argument: validateType("StringLiteral"), + qualifier: validateOptionalType("TSEntityName"), + typeParameters: validateOptionalType("TSTypeParameterInstantiation") + } + }); + defineType("TSImportEqualsDeclaration", { + aliases: ["Statement"], + visitor: ["id", "moduleReference"], + fields: { + isExport: validate$6(bool$d), + id: validateType("Identifier"), + moduleReference: validateType(["TSEntityName", "TSExternalModuleReference"]), + importKind: { + validate: assertOneOf("type", "value"), + optional: true + } + } + }); + defineType("TSExternalModuleReference", { + visitor: ["expression"], + fields: { + expression: validateType("StringLiteral") + } + }); + defineType("TSNonNullExpression", { + aliases: ["Expression", "LVal", "PatternLike"], + visitor: ["expression"], + fields: { + expression: validateType("Expression") + } + }); + defineType("TSExportAssignment", { + aliases: ["Statement"], + visitor: ["expression"], + fields: { + expression: validateType("Expression") + } + }); + defineType("TSNamespaceExportDeclaration", { + aliases: ["Statement"], + visitor: ["id"], + fields: { + id: validateType("Identifier") + } + }); + defineType("TSTypeAnnotation", { + visitor: ["typeAnnotation"], + fields: { + typeAnnotation: { + validate: assertNodeType("TSType") + } + } + }); + defineType("TSTypeParameterInstantiation", { + visitor: ["params"], + fields: { + params: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("TSType"))) + } + } + }); + defineType("TSTypeParameterDeclaration", { + visitor: ["params"], + fields: { + params: { + validate: chain$1(assertValueType("array"), assertEach(assertNodeType("TSTypeParameter"))) + } + } + }); + defineType("TSTypeParameter", { + builder: ["constraint", "default", "name"], + visitor: ["constraint", "default"], + fields: { + name: { + validate: assertValueType("string") + }, + "in": { + validate: assertValueType("boolean"), + optional: true + }, + out: { + validate: assertValueType("boolean"), + optional: true + }, + "const": { + validate: assertValueType("boolean"), + optional: true + }, + constraint: { + validate: assertNodeType("TSType"), + optional: true + }, + "default": { + validate: assertNodeType("TSType"), + optional: true + } + } + }); + + var DEPRECATED_ALIASES$1 = { + ModuleDeclaration: "ImportOrExportDeclaration" + }; + + Object.keys(DEPRECATED_ALIASES$1).forEach(function (deprecatedAlias) { + FLIPPED_ALIAS_KEYS$3[deprecatedAlias] = FLIPPED_ALIAS_KEYS$3[DEPRECATED_ALIASES$1[deprecatedAlias]]; + }); + toFastProperties(VISITOR_KEYS$5); + toFastProperties(ALIAS_KEYS); + toFastProperties(FLIPPED_ALIAS_KEYS$3); + toFastProperties(NODE_FIELDS); + toFastProperties(BUILDER_KEYS); + toFastProperties(DEPRECATED_KEYS$1); + toFastProperties(PLACEHOLDERS_ALIAS); + toFastProperties(PLACEHOLDERS_FLIPPED_ALIAS); + var TYPES$1 = [].concat(Object.keys(VISITOR_KEYS$5), Object.keys(FLIPPED_ALIAS_KEYS$3), Object.keys(DEPRECATED_KEYS$1)); + + function validate$5(node, key, val) { + if (!node) return; + var fields = NODE_FIELDS[node.type]; + if (!fields) return; + var field = fields[key]; + validateField(node, key, val, field); + validateChild(node, key, val); + } + function validateField(node, key, val, field) { + if (!(field != null && field.validate)) return; + if (field.optional && val == null) return; + field.validate(node, key, val); + } + function validateChild(node, key, val) { + if (val == null) return; + var validate = NODE_PARENT_VALIDATIONS[val.type]; + if (!validate) return; + validate(node, key, val); + } + + function validateNode(node) { + var keys = BUILDER_KEYS[node.type]; + for (var _iterator = _createForOfIteratorHelperLoose(keys), _step; !(_step = _iterator()).done;) { + var key = _step.value; + validate$5(node, key, node[key]); + } + return node; + } + + function arrayExpression$1(elements) { + if (elements === void 0) { + elements = []; + } + return validateNode({ + type: "ArrayExpression", + elements: elements + }); + } + function assignmentExpression$d(operator, left, right) { + return validateNode({ + type: "AssignmentExpression", + operator: operator, + left: left, + right: right + }); + } + function binaryExpression$5(operator, left, right) { + return validateNode({ + type: "BinaryExpression", + operator: operator, + left: left, + right: right + }); + } + function interpreterDirective$1(value) { + return validateNode({ + type: "InterpreterDirective", + value: value + }); + } + function directive$1(value) { + return validateNode({ + type: "Directive", + value: value + }); + } + function directiveLiteral$1(value) { + return validateNode({ + type: "DirectiveLiteral", + value: value + }); + } + function blockStatement$6(body, directives) { + if (directives === void 0) { + directives = []; + } + return validateNode({ + type: "BlockStatement", + body: body, + directives: directives + }); + } + function breakStatement(label) { + if (label === void 0) { + label = null; + } + return validateNode({ + type: "BreakStatement", + label: label + }); + } + function callExpression$e(callee, _arguments) { + return validateNode({ + type: "CallExpression", + callee: callee, + arguments: _arguments + }); + } + function catchClause(param, body) { + if (param === void 0) { + param = null; + } + return validateNode({ + type: "CatchClause", + param: param, + body: body + }); + } + function conditionalExpression$4(test, consequent, alternate) { + return validateNode({ + type: "ConditionalExpression", + test: test, + consequent: consequent, + alternate: alternate + }); + } + function continueStatement(label) { + if (label === void 0) { + label = null; + } + return validateNode({ + type: "ContinueStatement", + label: label + }); + } + function debuggerStatement() { + return { + type: "DebuggerStatement" + }; + } + function doWhileStatement(test, body) { + return validateNode({ + type: "DoWhileStatement", + test: test, + body: body + }); + } + function emptyStatement$1() { + return { + type: "EmptyStatement" + }; + } + function expressionStatement$a(expression) { + return validateNode({ + type: "ExpressionStatement", + expression: expression + }); + } + function file$2(program, comments, tokens) { + if (comments === void 0) { + comments = null; + } + if (tokens === void 0) { + tokens = null; + } + return validateNode({ + type: "File", + program: program, + comments: comments, + tokens: tokens + }); + } + function forInStatement(left, right, body) { + return validateNode({ + type: "ForInStatement", + left: left, + right: right, + body: body + }); + } + function forStatement(init, test, update, body) { + if (init === void 0) { + init = null; + } + if (test === void 0) { + test = null; + } + if (update === void 0) { + update = null; + } + return validateNode({ + type: "ForStatement", + init: init, + test: test, + update: update, + body: body + }); + } + function functionDeclaration(id, params, body, generator, async) { + if (id === void 0) { + id = null; + } + if (generator === void 0) { + generator = false; + } + if (async === void 0) { + async = false; + } + return validateNode({ + type: "FunctionDeclaration", + id: id, + params: params, + body: body, + generator: generator, + async: async + }); + } + function functionExpression$2(id, params, body, generator, async) { + if (id === void 0) { + id = null; + } + if (generator === void 0) { + generator = false; + } + if (async === void 0) { + async = false; + } + return validateNode({ + type: "FunctionExpression", + id: id, + params: params, + body: body, + generator: generator, + async: async + }); + } + function identifier$i(name) { + return validateNode({ + type: "Identifier", + name: name + }); + } + function ifStatement(test, consequent, alternate) { + if (alternate === void 0) { + alternate = null; + } + return validateNode({ + type: "IfStatement", + test: test, + consequent: consequent, + alternate: alternate + }); + } + function labeledStatement(label, body) { + return validateNode({ + type: "LabeledStatement", + label: label, + body: body + }); + } + function stringLiteral$8(value) { + return validateNode({ + type: "StringLiteral", + value: value + }); + } + function numericLiteral$8(value) { + return validateNode({ + type: "NumericLiteral", + value: value + }); + } + function nullLiteral$2() { + return { + type: "NullLiteral" + }; + } + function booleanLiteral$4(value) { + return validateNode({ + type: "BooleanLiteral", + value: value + }); + } + function regExpLiteral(pattern, flags) { + if (flags === void 0) { + flags = ""; + } + return validateNode({ + type: "RegExpLiteral", + pattern: pattern, + flags: flags + }); + } + function logicalExpression$3(operator, left, right) { + return validateNode({ + type: "LogicalExpression", + operator: operator, + left: left, + right: right + }); + } + function memberExpression$c(object, property, computed, optional) { + if (computed === void 0) { + computed = false; + } + if (optional === void 0) { + optional = null; + } + return validateNode({ + type: "MemberExpression", + object: object, + property: property, + computed: computed, + optional: optional + }); + } + function newExpression(callee, _arguments) { + return validateNode({ + type: "NewExpression", + callee: callee, + arguments: _arguments + }); + } + function program$3(body, directives, sourceType, interpreter) { + if (directives === void 0) { + directives = []; + } + if (sourceType === void 0) { + sourceType = "script"; + } + if (interpreter === void 0) { + interpreter = null; + } + return validateNode({ + type: "Program", + body: body, + directives: directives, + sourceType: sourceType, + interpreter: interpreter, + sourceFile: null + }); + } + function objectExpression$3(properties) { + return validateNode({ + type: "ObjectExpression", + properties: properties + }); + } + function objectMethod(kind, key, params, body, computed, generator, async) { + if (kind === void 0) { + kind = "method"; + } + if (computed === void 0) { + computed = false; + } + if (generator === void 0) { + generator = false; + } + if (async === void 0) { + async = false; + } + return validateNode({ + type: "ObjectMethod", + kind: kind, + key: key, + params: params, + body: body, + computed: computed, + generator: generator, + async: async + }); + } + function objectProperty$1(key, value, computed, shorthand, decorators) { + if (computed === void 0) { + computed = false; + } + if (shorthand === void 0) { + shorthand = false; + } + if (decorators === void 0) { + decorators = null; + } + return validateNode({ + type: "ObjectProperty", + key: key, + value: value, + computed: computed, + shorthand: shorthand, + decorators: decorators + }); + } + function restElement$2(argument) { + return validateNode({ + type: "RestElement", + argument: argument + }); + } + function returnStatement$3(argument) { + if (argument === void 0) { + argument = null; + } + return validateNode({ + type: "ReturnStatement", + argument: argument + }); + } + function sequenceExpression$7(expressions) { + return validateNode({ + type: "SequenceExpression", + expressions: expressions + }); + } + function parenthesizedExpression(expression) { + return validateNode({ + type: "ParenthesizedExpression", + expression: expression + }); + } + function switchCase(test, consequent) { + if (test === void 0) { + test = null; + } + return validateNode({ + type: "SwitchCase", + test: test, + consequent: consequent + }); + } + function switchStatement(discriminant, cases) { + return validateNode({ + type: "SwitchStatement", + discriminant: discriminant, + cases: cases + }); + } + function thisExpression$4() { + return { + type: "ThisExpression" + }; + } + function throwStatement(argument) { + return validateNode({ + type: "ThrowStatement", + argument: argument + }); + } + function tryStatement(block, handler, finalizer) { + if (handler === void 0) { + handler = null; + } + if (finalizer === void 0) { + finalizer = null; + } + return validateNode({ + type: "TryStatement", + block: block, + handler: handler, + finalizer: finalizer + }); + } + function unaryExpression$7(operator, argument, prefix) { + if (prefix === void 0) { + prefix = true; + } + return validateNode({ + type: "UnaryExpression", + operator: operator, + argument: argument, + prefix: prefix + }); + } + function updateExpression$1(operator, argument, prefix) { + if (prefix === void 0) { + prefix = false; + } + return validateNode({ + type: "UpdateExpression", + operator: operator, + argument: argument, + prefix: prefix + }); + } + function variableDeclaration$8(kind, declarations) { + return validateNode({ + type: "VariableDeclaration", + kind: kind, + declarations: declarations + }); + } + function variableDeclarator$8(id, init) { + if (init === void 0) { + init = null; + } + return validateNode({ + type: "VariableDeclarator", + id: id, + init: init + }); + } + function whileStatement(test, body) { + return validateNode({ + type: "WhileStatement", + test: test, + body: body + }); + } + function withStatement(object, body) { + return validateNode({ + type: "WithStatement", + object: object, + body: body + }); + } + function assignmentPattern(left, right) { + return validateNode({ + type: "AssignmentPattern", + left: left, + right: right + }); + } + function arrayPattern(elements) { + return validateNode({ + type: "ArrayPattern", + elements: elements + }); + } + function arrowFunctionExpression$4(params, body, async) { + if (async === void 0) { + async = false; + } + return validateNode({ + type: "ArrowFunctionExpression", + params: params, + body: body, + async: async, + expression: null + }); + } + function classBody(body) { + return validateNode({ + type: "ClassBody", + body: body + }); + } + function classExpression(id, superClass, body, decorators) { + if (id === void 0) { + id = null; + } + if (superClass === void 0) { + superClass = null; + } + if (decorators === void 0) { + decorators = null; + } + return validateNode({ + type: "ClassExpression", + id: id, + superClass: superClass, + body: body, + decorators: decorators + }); + } + function classDeclaration(id, superClass, body, decorators) { + if (superClass === void 0) { + superClass = null; + } + if (decorators === void 0) { + decorators = null; + } + return validateNode({ + type: "ClassDeclaration", + id: id, + superClass: superClass, + body: body, + decorators: decorators + }); + } + function exportAllDeclaration(source) { + return validateNode({ + type: "ExportAllDeclaration", + source: source + }); + } + function exportDefaultDeclaration(declaration) { + return validateNode({ + type: "ExportDefaultDeclaration", + declaration: declaration + }); + } + function exportNamedDeclaration$2(declaration, specifiers, source) { + if (declaration === void 0) { + declaration = null; + } + if (specifiers === void 0) { + specifiers = []; + } + if (source === void 0) { + source = null; + } + return validateNode({ + type: "ExportNamedDeclaration", + declaration: declaration, + specifiers: specifiers, + source: source + }); + } + function exportSpecifier$2(local, exported) { + return validateNode({ + type: "ExportSpecifier", + local: local, + exported: exported + }); + } + function forOfStatement(left, right, body, _await) { + if (_await === void 0) { + _await = false; + } + return validateNode({ + type: "ForOfStatement", + left: left, + right: right, + body: body, + "await": _await + }); + } + function importDeclaration$1(specifiers, source) { + return validateNode({ + type: "ImportDeclaration", + specifiers: specifiers, + source: source + }); + } + function importDefaultSpecifier$1(local) { + return validateNode({ + type: "ImportDefaultSpecifier", + local: local + }); + } + function importNamespaceSpecifier$1(local) { + return validateNode({ + type: "ImportNamespaceSpecifier", + local: local + }); + } + function importSpecifier$1(local, imported) { + return validateNode({ + type: "ImportSpecifier", + local: local, + imported: imported + }); + } + function metaProperty$1(meta, property) { + return validateNode({ + type: "MetaProperty", + meta: meta, + property: property + }); + } + function classMethod(kind, key, params, body, computed, _static, generator, async) { + if (kind === void 0) { + kind = "method"; + } + if (computed === void 0) { + computed = false; + } + if (_static === void 0) { + _static = false; + } + if (generator === void 0) { + generator = false; + } + if (async === void 0) { + async = false; + } + return validateNode({ + type: "ClassMethod", + kind: kind, + key: key, + params: params, + body: body, + computed: computed, + "static": _static, + generator: generator, + async: async + }); + } + function objectPattern$1(properties) { + return validateNode({ + type: "ObjectPattern", + properties: properties + }); + } + function spreadElement$2(argument) { + return validateNode({ + type: "SpreadElement", + argument: argument + }); + } + function _super$1() { + return { + type: "Super" + }; + } + function taggedTemplateExpression(tag, quasi) { + return validateNode({ + type: "TaggedTemplateExpression", + tag: tag, + quasi: quasi + }); + } + function templateElement(value, tail) { + if (tail === void 0) { + tail = false; + } + return validateNode({ + type: "TemplateElement", + value: value, + tail: tail + }); + } + function templateLiteral(quasis, expressions) { + return validateNode({ + type: "TemplateLiteral", + quasis: quasis, + expressions: expressions + }); + } + function yieldExpression$2(argument, delegate) { + if (argument === void 0) { + argument = null; + } + if (delegate === void 0) { + delegate = false; + } + return validateNode({ + type: "YieldExpression", + argument: argument, + delegate: delegate + }); + } + function awaitExpression$1(argument) { + return validateNode({ + type: "AwaitExpression", + argument: argument + }); + } + function _import() { + return { + type: "Import" + }; + } + function bigIntLiteral(value) { + return validateNode({ + type: "BigIntLiteral", + value: value + }); + } + function exportNamespaceSpecifier(exported) { + return validateNode({ + type: "ExportNamespaceSpecifier", + exported: exported + }); + } + function optionalMemberExpression$2(object, property, computed, optional) { + if (computed === void 0) { + computed = false; + } + return validateNode({ + type: "OptionalMemberExpression", + object: object, + property: property, + computed: computed, + optional: optional + }); + } + function optionalCallExpression$2(callee, _arguments, optional) { + return validateNode({ + type: "OptionalCallExpression", + callee: callee, + arguments: _arguments, + optional: optional + }); + } + function classProperty(key, value, typeAnnotation, decorators, computed, _static) { + if (value === void 0) { + value = null; + } + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + if (decorators === void 0) { + decorators = null; + } + if (computed === void 0) { + computed = false; + } + if (_static === void 0) { + _static = false; + } + return validateNode({ + type: "ClassProperty", + key: key, + value: value, + typeAnnotation: typeAnnotation, + decorators: decorators, + computed: computed, + "static": _static + }); + } + function classAccessorProperty(key, value, typeAnnotation, decorators, computed, _static) { + if (value === void 0) { + value = null; + } + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + if (decorators === void 0) { + decorators = null; + } + if (computed === void 0) { + computed = false; + } + if (_static === void 0) { + _static = false; + } + return validateNode({ + type: "ClassAccessorProperty", + key: key, + value: value, + typeAnnotation: typeAnnotation, + decorators: decorators, + computed: computed, + "static": _static + }); + } + function classPrivateProperty(key, value, decorators, _static) { + if (value === void 0) { + value = null; + } + if (decorators === void 0) { + decorators = null; + } + if (_static === void 0) { + _static = false; + } + return validateNode({ + type: "ClassPrivateProperty", + key: key, + value: value, + decorators: decorators, + "static": _static + }); + } + function classPrivateMethod(kind, key, params, body, _static) { + if (kind === void 0) { + kind = "method"; + } + if (_static === void 0) { + _static = false; + } + return validateNode({ + type: "ClassPrivateMethod", + kind: kind, + key: key, + params: params, + body: body, + "static": _static + }); + } + function privateName(id) { + return validateNode({ + type: "PrivateName", + id: id + }); + } + function staticBlock(body) { + return validateNode({ + type: "StaticBlock", + body: body + }); + } + function anyTypeAnnotation$2() { + return { + type: "AnyTypeAnnotation" + }; + } + function arrayTypeAnnotation$1(elementType) { + return validateNode({ + type: "ArrayTypeAnnotation", + elementType: elementType + }); + } + function booleanTypeAnnotation$1() { + return { + type: "BooleanTypeAnnotation" + }; + } + function booleanLiteralTypeAnnotation(value) { + return validateNode({ + type: "BooleanLiteralTypeAnnotation", + value: value + }); + } + function nullLiteralTypeAnnotation$1() { + return { + type: "NullLiteralTypeAnnotation" + }; + } + function classImplements(id, typeParameters) { + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "ClassImplements", + id: id, + typeParameters: typeParameters + }); + } + function declareClass(id, typeParameters, _extends, body) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (_extends === void 0) { + _extends = null; + } + return validateNode({ + type: "DeclareClass", + id: id, + typeParameters: typeParameters, + "extends": _extends, + body: body + }); + } + function declareFunction(id) { + return validateNode({ + type: "DeclareFunction", + id: id + }); + } + function declareInterface(id, typeParameters, _extends, body) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (_extends === void 0) { + _extends = null; + } + return validateNode({ + type: "DeclareInterface", + id: id, + typeParameters: typeParameters, + "extends": _extends, + body: body + }); + } + function declareModule(id, body, kind) { + if (kind === void 0) { + kind = null; + } + return validateNode({ + type: "DeclareModule", + id: id, + body: body, + kind: kind + }); + } + function declareModuleExports(typeAnnotation) { + return validateNode({ + type: "DeclareModuleExports", + typeAnnotation: typeAnnotation + }); + } + function declareTypeAlias(id, typeParameters, right) { + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "DeclareTypeAlias", + id: id, + typeParameters: typeParameters, + right: right + }); + } + function declareOpaqueType(id, typeParameters, supertype) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (supertype === void 0) { + supertype = null; + } + return validateNode({ + type: "DeclareOpaqueType", + id: id, + typeParameters: typeParameters, + supertype: supertype + }); + } + function declareVariable(id) { + return validateNode({ + type: "DeclareVariable", + id: id + }); + } + function declareExportDeclaration(declaration, specifiers, source) { + if (declaration === void 0) { + declaration = null; + } + if (specifiers === void 0) { + specifiers = null; + } + if (source === void 0) { + source = null; + } + return validateNode({ + type: "DeclareExportDeclaration", + declaration: declaration, + specifiers: specifiers, + source: source + }); + } + function declareExportAllDeclaration(source) { + return validateNode({ + type: "DeclareExportAllDeclaration", + source: source + }); + } + function declaredPredicate(value) { + return validateNode({ + type: "DeclaredPredicate", + value: value + }); + } + function existsTypeAnnotation() { + return { + type: "ExistsTypeAnnotation" + }; + } + function functionTypeAnnotation(typeParameters, params, rest, returnType) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (rest === void 0) { + rest = null; + } + return validateNode({ + type: "FunctionTypeAnnotation", + typeParameters: typeParameters, + params: params, + rest: rest, + returnType: returnType + }); + } + function functionTypeParam(name, typeAnnotation) { + if (name === void 0) { + name = null; + } + return validateNode({ + type: "FunctionTypeParam", + name: name, + typeAnnotation: typeAnnotation + }); + } + function genericTypeAnnotation$1(id, typeParameters) { + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "GenericTypeAnnotation", + id: id, + typeParameters: typeParameters + }); + } + function inferredPredicate() { + return { + type: "InferredPredicate" + }; + } + function interfaceExtends(id, typeParameters) { + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "InterfaceExtends", + id: id, + typeParameters: typeParameters + }); + } + function interfaceDeclaration(id, typeParameters, _extends, body) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (_extends === void 0) { + _extends = null; + } + return validateNode({ + type: "InterfaceDeclaration", + id: id, + typeParameters: typeParameters, + "extends": _extends, + body: body + }); + } + function interfaceTypeAnnotation(_extends, body) { + if (_extends === void 0) { + _extends = null; + } + return validateNode({ + type: "InterfaceTypeAnnotation", + "extends": _extends, + body: body + }); + } + function intersectionTypeAnnotation(types) { + return validateNode({ + type: "IntersectionTypeAnnotation", + types: types + }); + } + function mixedTypeAnnotation() { + return { + type: "MixedTypeAnnotation" + }; + } + function emptyTypeAnnotation() { + return { + type: "EmptyTypeAnnotation" + }; + } + function nullableTypeAnnotation(typeAnnotation) { + return validateNode({ + type: "NullableTypeAnnotation", + typeAnnotation: typeAnnotation + }); + } + function numberLiteralTypeAnnotation(value) { + return validateNode({ + type: "NumberLiteralTypeAnnotation", + value: value + }); + } + function numberTypeAnnotation$2() { + return { + type: "NumberTypeAnnotation" + }; + } + function objectTypeAnnotation(properties, indexers, callProperties, internalSlots, exact) { + if (indexers === void 0) { + indexers = []; + } + if (callProperties === void 0) { + callProperties = []; + } + if (internalSlots === void 0) { + internalSlots = []; + } + if (exact === void 0) { + exact = false; + } + return validateNode({ + type: "ObjectTypeAnnotation", + properties: properties, + indexers: indexers, + callProperties: callProperties, + internalSlots: internalSlots, + exact: exact + }); + } + function objectTypeInternalSlot(id, value, optional, _static, method) { + return validateNode({ + type: "ObjectTypeInternalSlot", + id: id, + value: value, + optional: optional, + "static": _static, + method: method + }); + } + function objectTypeCallProperty(value) { + return validateNode({ + type: "ObjectTypeCallProperty", + value: value, + "static": null + }); + } + function objectTypeIndexer(id, key, value, variance) { + if (id === void 0) { + id = null; + } + if (variance === void 0) { + variance = null; + } + return validateNode({ + type: "ObjectTypeIndexer", + id: id, + key: key, + value: value, + variance: variance, + "static": null + }); + } + function objectTypeProperty(key, value, variance) { + if (variance === void 0) { + variance = null; + } + return validateNode({ + type: "ObjectTypeProperty", + key: key, + value: value, + variance: variance, + kind: null, + method: null, + optional: null, + proto: null, + "static": null + }); + } + function objectTypeSpreadProperty(argument) { + return validateNode({ + type: "ObjectTypeSpreadProperty", + argument: argument + }); + } + function opaqueType(id, typeParameters, supertype, impltype) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (supertype === void 0) { + supertype = null; + } + return validateNode({ + type: "OpaqueType", + id: id, + typeParameters: typeParameters, + supertype: supertype, + impltype: impltype + }); + } + function qualifiedTypeIdentifier(id, qualification) { + return validateNode({ + type: "QualifiedTypeIdentifier", + id: id, + qualification: qualification + }); + } + function stringLiteralTypeAnnotation(value) { + return validateNode({ + type: "StringLiteralTypeAnnotation", + value: value + }); + } + function stringTypeAnnotation$2() { + return { + type: "StringTypeAnnotation" + }; + } + function symbolTypeAnnotation() { + return { + type: "SymbolTypeAnnotation" + }; + } + function thisTypeAnnotation() { + return { + type: "ThisTypeAnnotation" + }; + } + function tupleTypeAnnotation$1(types) { + return validateNode({ + type: "TupleTypeAnnotation", + types: types + }); + } + function typeofTypeAnnotation(argument) { + return validateNode({ + type: "TypeofTypeAnnotation", + argument: argument + }); + } + function typeAlias(id, typeParameters, right) { + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "TypeAlias", + id: id, + typeParameters: typeParameters, + right: right + }); + } + function typeAnnotation(typeAnnotation) { + return validateNode({ + type: "TypeAnnotation", + typeAnnotation: typeAnnotation + }); + } + function typeCastExpression(expression, typeAnnotation) { + return validateNode({ + type: "TypeCastExpression", + expression: expression, + typeAnnotation: typeAnnotation + }); + } + function typeParameter(bound, _default, variance) { + if (bound === void 0) { + bound = null; + } + if (_default === void 0) { + _default = null; + } + if (variance === void 0) { + variance = null; + } + return validateNode({ + type: "TypeParameter", + bound: bound, + "default": _default, + variance: variance, + name: null + }); + } + function typeParameterDeclaration(params) { + return validateNode({ + type: "TypeParameterDeclaration", + params: params + }); + } + function typeParameterInstantiation(params) { + return validateNode({ + type: "TypeParameterInstantiation", + params: params + }); + } + function unionTypeAnnotation$1(types) { + return validateNode({ + type: "UnionTypeAnnotation", + types: types + }); + } + function variance(kind) { + return validateNode({ + type: "Variance", + kind: kind + }); + } + function voidTypeAnnotation$3() { + return { + type: "VoidTypeAnnotation" + }; + } + function enumDeclaration(id, body) { + return validateNode({ + type: "EnumDeclaration", + id: id, + body: body + }); + } + function enumBooleanBody(members) { + return validateNode({ + type: "EnumBooleanBody", + members: members, + explicitType: null, + hasUnknownMembers: null + }); + } + function enumNumberBody(members) { + return validateNode({ + type: "EnumNumberBody", + members: members, + explicitType: null, + hasUnknownMembers: null + }); + } + function enumStringBody(members) { + return validateNode({ + type: "EnumStringBody", + members: members, + explicitType: null, + hasUnknownMembers: null + }); + } + function enumSymbolBody(members) { + return validateNode({ + type: "EnumSymbolBody", + members: members, + hasUnknownMembers: null + }); + } + function enumBooleanMember(id) { + return validateNode({ + type: "EnumBooleanMember", + id: id, + init: null + }); + } + function enumNumberMember(id, init) { + return validateNode({ + type: "EnumNumberMember", + id: id, + init: init + }); + } + function enumStringMember(id, init) { + return validateNode({ + type: "EnumStringMember", + id: id, + init: init + }); + } + function enumDefaultedMember(id) { + return validateNode({ + type: "EnumDefaultedMember", + id: id + }); + } + function indexedAccessType(objectType, indexType) { + return validateNode({ + type: "IndexedAccessType", + objectType: objectType, + indexType: indexType + }); + } + function optionalIndexedAccessType(objectType, indexType) { + return validateNode({ + type: "OptionalIndexedAccessType", + objectType: objectType, + indexType: indexType, + optional: null + }); + } + function jsxAttribute(name, value) { + if (value === void 0) { + value = null; + } + return validateNode({ + type: "JSXAttribute", + name: name, + value: value + }); + } + function jsxClosingElement(name) { + return validateNode({ + type: "JSXClosingElement", + name: name + }); + } + function jsxElement(openingElement, closingElement, children, selfClosing) { + if (closingElement === void 0) { + closingElement = null; + } + if (selfClosing === void 0) { + selfClosing = null; + } + return validateNode({ + type: "JSXElement", + openingElement: openingElement, + closingElement: closingElement, + children: children, + selfClosing: selfClosing + }); + } + function jsxEmptyExpression() { + return { + type: "JSXEmptyExpression" + }; + } + function jsxExpressionContainer$1(expression) { + return validateNode({ + type: "JSXExpressionContainer", + expression: expression + }); + } + function jsxSpreadChild(expression) { + return validateNode({ + type: "JSXSpreadChild", + expression: expression + }); + } + function jsxIdentifier$2(name) { + return validateNode({ + type: "JSXIdentifier", + name: name + }); + } + function jsxMemberExpression$1(object, property) { + return validateNode({ + type: "JSXMemberExpression", + object: object, + property: property + }); + } + function jsxNamespacedName(namespace, name) { + return validateNode({ + type: "JSXNamespacedName", + namespace: namespace, + name: name + }); + } + function jsxOpeningElement(name, attributes, selfClosing) { + if (selfClosing === void 0) { + selfClosing = false; + } + return validateNode({ + type: "JSXOpeningElement", + name: name, + attributes: attributes, + selfClosing: selfClosing + }); + } + function jsxSpreadAttribute(argument) { + return validateNode({ + type: "JSXSpreadAttribute", + argument: argument + }); + } + function jsxText(value) { + return validateNode({ + type: "JSXText", + value: value + }); + } + function jsxFragment(openingFragment, closingFragment, children) { + return validateNode({ + type: "JSXFragment", + openingFragment: openingFragment, + closingFragment: closingFragment, + children: children + }); + } + function jsxOpeningFragment() { + return { + type: "JSXOpeningFragment" + }; + } + function jsxClosingFragment() { + return { + type: "JSXClosingFragment" + }; + } + function noop$1() { + return { + type: "Noop" + }; + } + function placeholder(expectedNode, name) { + return validateNode({ + type: "Placeholder", + expectedNode: expectedNode, + name: name + }); + } + function v8IntrinsicIdentifier(name) { + return validateNode({ + type: "V8IntrinsicIdentifier", + name: name + }); + } + function argumentPlaceholder() { + return { + type: "ArgumentPlaceholder" + }; + } + function bindExpression(object, callee) { + return validateNode({ + type: "BindExpression", + object: object, + callee: callee + }); + } + function importAttribute(key, value) { + return validateNode({ + type: "ImportAttribute", + key: key, + value: value + }); + } + function decorator(expression) { + return validateNode({ + type: "Decorator", + expression: expression + }); + } + function doExpression(body, async) { + if (async === void 0) { + async = false; + } + return validateNode({ + type: "DoExpression", + body: body, + async: async + }); + } + function exportDefaultSpecifier(exported) { + return validateNode({ + type: "ExportDefaultSpecifier", + exported: exported + }); + } + function recordExpression(properties) { + return validateNode({ + type: "RecordExpression", + properties: properties + }); + } + function tupleExpression(elements) { + if (elements === void 0) { + elements = []; + } + return validateNode({ + type: "TupleExpression", + elements: elements + }); + } + function decimalLiteral(value) { + return validateNode({ + type: "DecimalLiteral", + value: value + }); + } + function moduleExpression(body) { + return validateNode({ + type: "ModuleExpression", + body: body + }); + } + function topicReference() { + return { + type: "TopicReference" + }; + } + function pipelineTopicExpression(expression) { + return validateNode({ + type: "PipelineTopicExpression", + expression: expression + }); + } + function pipelineBareFunction(callee) { + return validateNode({ + type: "PipelineBareFunction", + callee: callee + }); + } + function pipelinePrimaryTopicReference() { + return { + type: "PipelinePrimaryTopicReference" + }; + } + function tsParameterProperty(parameter) { + return validateNode({ + type: "TSParameterProperty", + parameter: parameter + }); + } + function tsDeclareFunction(id, typeParameters, params, returnType) { + if (id === void 0) { + id = null; + } + if (typeParameters === void 0) { + typeParameters = null; + } + if (returnType === void 0) { + returnType = null; + } + return validateNode({ + type: "TSDeclareFunction", + id: id, + typeParameters: typeParameters, + params: params, + returnType: returnType + }); + } + function tsDeclareMethod(decorators, key, typeParameters, params, returnType) { + if (decorators === void 0) { + decorators = null; + } + if (typeParameters === void 0) { + typeParameters = null; + } + if (returnType === void 0) { + returnType = null; + } + return validateNode({ + type: "TSDeclareMethod", + decorators: decorators, + key: key, + typeParameters: typeParameters, + params: params, + returnType: returnType + }); + } + function tsQualifiedName(left, right) { + return validateNode({ + type: "TSQualifiedName", + left: left, + right: right + }); + } + function tsCallSignatureDeclaration(typeParameters, parameters, typeAnnotation) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + return validateNode({ + type: "TSCallSignatureDeclaration", + typeParameters: typeParameters, + parameters: parameters, + typeAnnotation: typeAnnotation + }); + } + function tsConstructSignatureDeclaration(typeParameters, parameters, typeAnnotation) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + return validateNode({ + type: "TSConstructSignatureDeclaration", + typeParameters: typeParameters, + parameters: parameters, + typeAnnotation: typeAnnotation + }); + } + function tsPropertySignature(key, typeAnnotation, initializer) { + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + if (initializer === void 0) { + initializer = null; + } + return validateNode({ + type: "TSPropertySignature", + key: key, + typeAnnotation: typeAnnotation, + initializer: initializer, + kind: null + }); + } + function tsMethodSignature(key, typeParameters, parameters, typeAnnotation) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + return validateNode({ + type: "TSMethodSignature", + key: key, + typeParameters: typeParameters, + parameters: parameters, + typeAnnotation: typeAnnotation, + kind: null + }); + } + function tsIndexSignature(parameters, typeAnnotation) { + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + return validateNode({ + type: "TSIndexSignature", + parameters: parameters, + typeAnnotation: typeAnnotation + }); + } + function tsAnyKeyword() { + return { + type: "TSAnyKeyword" + }; + } + function tsBooleanKeyword() { + return { + type: "TSBooleanKeyword" + }; + } + function tsBigIntKeyword() { + return { + type: "TSBigIntKeyword" + }; + } + function tsIntrinsicKeyword() { + return { + type: "TSIntrinsicKeyword" + }; + } + function tsNeverKeyword() { + return { + type: "TSNeverKeyword" + }; + } + function tsNullKeyword() { + return { + type: "TSNullKeyword" + }; + } + function tsNumberKeyword() { + return { + type: "TSNumberKeyword" + }; + } + function tsObjectKeyword() { + return { + type: "TSObjectKeyword" + }; + } + function tsStringKeyword() { + return { + type: "TSStringKeyword" + }; + } + function tsSymbolKeyword() { + return { + type: "TSSymbolKeyword" + }; + } + function tsUndefinedKeyword() { + return { + type: "TSUndefinedKeyword" + }; + } + function tsUnknownKeyword() { + return { + type: "TSUnknownKeyword" + }; + } + function tsVoidKeyword() { + return { + type: "TSVoidKeyword" + }; + } + function tsThisType() { + return { + type: "TSThisType" + }; + } + function tsFunctionType(typeParameters, parameters, typeAnnotation) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + return validateNode({ + type: "TSFunctionType", + typeParameters: typeParameters, + parameters: parameters, + typeAnnotation: typeAnnotation + }); + } + function tsConstructorType(typeParameters, parameters, typeAnnotation) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + return validateNode({ + type: "TSConstructorType", + typeParameters: typeParameters, + parameters: parameters, + typeAnnotation: typeAnnotation + }); + } + function tsTypeReference(typeName, typeParameters) { + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "TSTypeReference", + typeName: typeName, + typeParameters: typeParameters + }); + } + function tsTypePredicate(parameterName, typeAnnotation, asserts) { + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + if (asserts === void 0) { + asserts = null; + } + return validateNode({ + type: "TSTypePredicate", + parameterName: parameterName, + typeAnnotation: typeAnnotation, + asserts: asserts + }); + } + function tsTypeQuery(exprName, typeParameters) { + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "TSTypeQuery", + exprName: exprName, + typeParameters: typeParameters + }); + } + function tsTypeLiteral(members) { + return validateNode({ + type: "TSTypeLiteral", + members: members + }); + } + function tsArrayType(elementType) { + return validateNode({ + type: "TSArrayType", + elementType: elementType + }); + } + function tsTupleType(elementTypes) { + return validateNode({ + type: "TSTupleType", + elementTypes: elementTypes + }); + } + function tsOptionalType(typeAnnotation) { + return validateNode({ + type: "TSOptionalType", + typeAnnotation: typeAnnotation + }); + } + function tsRestType(typeAnnotation) { + return validateNode({ + type: "TSRestType", + typeAnnotation: typeAnnotation + }); + } + function tsNamedTupleMember(label, elementType, optional) { + if (optional === void 0) { + optional = false; + } + return validateNode({ + type: "TSNamedTupleMember", + label: label, + elementType: elementType, + optional: optional + }); + } + function tsUnionType(types) { + return validateNode({ + type: "TSUnionType", + types: types + }); + } + function tsIntersectionType(types) { + return validateNode({ + type: "TSIntersectionType", + types: types + }); + } + function tsConditionalType(checkType, extendsType, trueType, falseType) { + return validateNode({ + type: "TSConditionalType", + checkType: checkType, + extendsType: extendsType, + trueType: trueType, + falseType: falseType + }); + } + function tsInferType(typeParameter) { + return validateNode({ + type: "TSInferType", + typeParameter: typeParameter + }); + } + function tsParenthesizedType(typeAnnotation) { + return validateNode({ + type: "TSParenthesizedType", + typeAnnotation: typeAnnotation + }); + } + function tsTypeOperator(typeAnnotation) { + return validateNode({ + type: "TSTypeOperator", + typeAnnotation: typeAnnotation, + operator: null + }); + } + function tsIndexedAccessType(objectType, indexType) { + return validateNode({ + type: "TSIndexedAccessType", + objectType: objectType, + indexType: indexType + }); + } + function tsMappedType(typeParameter, typeAnnotation, nameType) { + if (typeAnnotation === void 0) { + typeAnnotation = null; + } + if (nameType === void 0) { + nameType = null; + } + return validateNode({ + type: "TSMappedType", + typeParameter: typeParameter, + typeAnnotation: typeAnnotation, + nameType: nameType + }); + } + function tsLiteralType(literal) { + return validateNode({ + type: "TSLiteralType", + literal: literal + }); + } + function tsExpressionWithTypeArguments(expression, typeParameters) { + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "TSExpressionWithTypeArguments", + expression: expression, + typeParameters: typeParameters + }); + } + function tsInterfaceDeclaration(id, typeParameters, _extends, body) { + if (typeParameters === void 0) { + typeParameters = null; + } + if (_extends === void 0) { + _extends = null; + } + return validateNode({ + type: "TSInterfaceDeclaration", + id: id, + typeParameters: typeParameters, + "extends": _extends, + body: body + }); + } + function tsInterfaceBody(body) { + return validateNode({ + type: "TSInterfaceBody", + body: body + }); + } + function tsTypeAliasDeclaration(id, typeParameters, typeAnnotation) { + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "TSTypeAliasDeclaration", + id: id, + typeParameters: typeParameters, + typeAnnotation: typeAnnotation + }); + } + function tsInstantiationExpression(expression, typeParameters) { + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "TSInstantiationExpression", + expression: expression, + typeParameters: typeParameters + }); + } + function tsAsExpression(expression, typeAnnotation) { + return validateNode({ + type: "TSAsExpression", + expression: expression, + typeAnnotation: typeAnnotation + }); + } + function tsSatisfiesExpression(expression, typeAnnotation) { + return validateNode({ + type: "TSSatisfiesExpression", + expression: expression, + typeAnnotation: typeAnnotation + }); + } + function tsTypeAssertion(typeAnnotation, expression) { + return validateNode({ + type: "TSTypeAssertion", + typeAnnotation: typeAnnotation, + expression: expression + }); + } + function tsEnumDeclaration(id, members) { + return validateNode({ + type: "TSEnumDeclaration", + id: id, + members: members + }); + } + function tsEnumMember(id, initializer) { + if (initializer === void 0) { + initializer = null; + } + return validateNode({ + type: "TSEnumMember", + id: id, + initializer: initializer + }); + } + function tsModuleDeclaration(id, body) { + return validateNode({ + type: "TSModuleDeclaration", + id: id, + body: body + }); + } + function tsModuleBlock(body) { + return validateNode({ + type: "TSModuleBlock", + body: body + }); + } + function tsImportType(argument, qualifier, typeParameters) { + if (qualifier === void 0) { + qualifier = null; + } + if (typeParameters === void 0) { + typeParameters = null; + } + return validateNode({ + type: "TSImportType", + argument: argument, + qualifier: qualifier, + typeParameters: typeParameters + }); + } + function tsImportEqualsDeclaration(id, moduleReference) { + return validateNode({ + type: "TSImportEqualsDeclaration", + id: id, + moduleReference: moduleReference, + isExport: null + }); + } + function tsExternalModuleReference(expression) { + return validateNode({ + type: "TSExternalModuleReference", + expression: expression + }); + } + function tsNonNullExpression(expression) { + return validateNode({ + type: "TSNonNullExpression", + expression: expression + }); + } + function tsExportAssignment(expression) { + return validateNode({ + type: "TSExportAssignment", + expression: expression + }); + } + function tsNamespaceExportDeclaration(id) { + return validateNode({ + type: "TSNamespaceExportDeclaration", + id: id + }); + } + function tsTypeAnnotation(typeAnnotation) { + return validateNode({ + type: "TSTypeAnnotation", + typeAnnotation: typeAnnotation + }); + } + function tsTypeParameterInstantiation(params) { + return validateNode({ + type: "TSTypeParameterInstantiation", + params: params + }); + } + function tsTypeParameterDeclaration(params) { + return validateNode({ + type: "TSTypeParameterDeclaration", + params: params + }); + } + function tsTypeParameter(constraint, _default, name) { + if (constraint === void 0) { + constraint = null; + } + if (_default === void 0) { + _default = null; + } + return validateNode({ + type: "TSTypeParameter", + constraint: constraint, + "default": _default, + name: name + }); + } + function NumberLiteral(value) { + deprecationWarning$1("NumberLiteral", "NumericLiteral", "The node type "); + return numericLiteral$8(value); + } + function RegexLiteral(pattern, flags) { + if (flags === void 0) { + flags = ""; + } + deprecationWarning$1("RegexLiteral", "RegExpLiteral", "The node type "); + return regExpLiteral(pattern, flags); + } + function RestProperty(argument) { + deprecationWarning$1("RestProperty", "RestElement", "The node type "); + return restElement$2(argument); + } + function SpreadProperty(argument) { + deprecationWarning$1("SpreadProperty", "SpreadElement", "The node type "); + return spreadElement$2(argument); + } + + function cleanJSXElementLiteralChild(child, args) { + var lines = child.value.split(/\r\n|\n|\r/); + var lastNonEmptyLine = 0; + for (var i = 0; i < lines.length; i++) { + if (lines[i].match(/[^ \t]/)) { + lastNonEmptyLine = i; + } + } + var str = ""; + for (var _i = 0; _i < lines.length; _i++) { + var line = lines[_i]; + var isFirstLine = _i === 0; + var isLastLine = _i === lines.length - 1; + var isLastNonEmptyLine = _i === lastNonEmptyLine; + var trimmedLine = line.replace(/\t/g, " "); + if (!isFirstLine) { + trimmedLine = trimmedLine.replace(/^[ ]+/, ""); + } + if (!isLastLine) { + trimmedLine = trimmedLine.replace(/[ ]+$/, ""); + } + if (trimmedLine) { + if (!isLastNonEmptyLine) { + trimmedLine += " "; + } + str += trimmedLine; + } + } + if (str) args.push(inherits$3(stringLiteral$8(str), child)); + } + + function buildChildren(node) { + var elements = []; + for (var i = 0; i < node.children.length; i++) { + var child = node.children[i]; + if (isJSXText(child)) { + cleanJSXElementLiteralChild(child, elements); + continue; + } + if (isJSXExpressionContainer$1(child)) child = child.expression; + if (isJSXEmptyExpression(child)) continue; + elements.push(child); + } + return elements; + } + + function isNode(node) { + return !!(node && VISITOR_KEYS$5[node.type]); + } + + function assertNode(node) { + if (!isNode(node)) { + var _node$type; + var type = (_node$type = node == null ? void 0 : node.type) != null ? _node$type : JSON.stringify(node); + throw new TypeError("Not a valid node of type \"" + type + "\""); + } + } + + function assert$2(type, node, opts) { + if (!is$1(type, node, opts)) { + throw new Error("Expected type \"" + type + "\" with option " + JSON.stringify(opts) + ", " + ("but instead got \"" + node.type + "\".")); + } + } + function assertArrayExpression(node, opts) { + assert$2("ArrayExpression", node, opts); + } + function assertAssignmentExpression(node, opts) { + assert$2("AssignmentExpression", node, opts); + } + function assertBinaryExpression(node, opts) { + assert$2("BinaryExpression", node, opts); + } + function assertInterpreterDirective(node, opts) { + assert$2("InterpreterDirective", node, opts); + } + function assertDirective(node, opts) { + assert$2("Directive", node, opts); + } + function assertDirectiveLiteral(node, opts) { + assert$2("DirectiveLiteral", node, opts); + } + function assertBlockStatement(node, opts) { + assert$2("BlockStatement", node, opts); + } + function assertBreakStatement(node, opts) { + assert$2("BreakStatement", node, opts); + } + function assertCallExpression(node, opts) { + assert$2("CallExpression", node, opts); + } + function assertCatchClause(node, opts) { + assert$2("CatchClause", node, opts); + } + function assertConditionalExpression(node, opts) { + assert$2("ConditionalExpression", node, opts); + } + function assertContinueStatement(node, opts) { + assert$2("ContinueStatement", node, opts); + } + function assertDebuggerStatement(node, opts) { + assert$2("DebuggerStatement", node, opts); + } + function assertDoWhileStatement(node, opts) { + assert$2("DoWhileStatement", node, opts); + } + function assertEmptyStatement(node, opts) { + assert$2("EmptyStatement", node, opts); + } + function assertExpressionStatement$1(node, opts) { + assert$2("ExpressionStatement", node, opts); + } + function assertFile(node, opts) { + assert$2("File", node, opts); + } + function assertForInStatement(node, opts) { + assert$2("ForInStatement", node, opts); + } + function assertForStatement(node, opts) { + assert$2("ForStatement", node, opts); + } + function assertFunctionDeclaration(node, opts) { + assert$2("FunctionDeclaration", node, opts); + } + function assertFunctionExpression(node, opts) { + assert$2("FunctionExpression", node, opts); + } + function assertIdentifier(node, opts) { + assert$2("Identifier", node, opts); + } + function assertIfStatement(node, opts) { + assert$2("IfStatement", node, opts); + } + function assertLabeledStatement(node, opts) { + assert$2("LabeledStatement", node, opts); + } + function assertStringLiteral(node, opts) { + assert$2("StringLiteral", node, opts); + } + function assertNumericLiteral(node, opts) { + assert$2("NumericLiteral", node, opts); + } + function assertNullLiteral(node, opts) { + assert$2("NullLiteral", node, opts); + } + function assertBooleanLiteral(node, opts) { + assert$2("BooleanLiteral", node, opts); + } + function assertRegExpLiteral(node, opts) { + assert$2("RegExpLiteral", node, opts); + } + function assertLogicalExpression(node, opts) { + assert$2("LogicalExpression", node, opts); + } + function assertMemberExpression(node, opts) { + assert$2("MemberExpression", node, opts); + } + function assertNewExpression(node, opts) { + assert$2("NewExpression", node, opts); + } + function assertProgram(node, opts) { + assert$2("Program", node, opts); + } + function assertObjectExpression(node, opts) { + assert$2("ObjectExpression", node, opts); + } + function assertObjectMethod(node, opts) { + assert$2("ObjectMethod", node, opts); + } + function assertObjectProperty(node, opts) { + assert$2("ObjectProperty", node, opts); + } + function assertRestElement(node, opts) { + assert$2("RestElement", node, opts); + } + function assertReturnStatement(node, opts) { + assert$2("ReturnStatement", node, opts); + } + function assertSequenceExpression(node, opts) { + assert$2("SequenceExpression", node, opts); + } + function assertParenthesizedExpression(node, opts) { + assert$2("ParenthesizedExpression", node, opts); + } + function assertSwitchCase(node, opts) { + assert$2("SwitchCase", node, opts); + } + function assertSwitchStatement(node, opts) { + assert$2("SwitchStatement", node, opts); + } + function assertThisExpression(node, opts) { + assert$2("ThisExpression", node, opts); + } + function assertThrowStatement(node, opts) { + assert$2("ThrowStatement", node, opts); + } + function assertTryStatement(node, opts) { + assert$2("TryStatement", node, opts); + } + function assertUnaryExpression(node, opts) { + assert$2("UnaryExpression", node, opts); + } + function assertUpdateExpression(node, opts) { + assert$2("UpdateExpression", node, opts); + } + function assertVariableDeclaration(node, opts) { + assert$2("VariableDeclaration", node, opts); + } + function assertVariableDeclarator(node, opts) { + assert$2("VariableDeclarator", node, opts); + } + function assertWhileStatement(node, opts) { + assert$2("WhileStatement", node, opts); + } + function assertWithStatement(node, opts) { + assert$2("WithStatement", node, opts); + } + function assertAssignmentPattern(node, opts) { + assert$2("AssignmentPattern", node, opts); + } + function assertArrayPattern(node, opts) { + assert$2("ArrayPattern", node, opts); + } + function assertArrowFunctionExpression(node, opts) { + assert$2("ArrowFunctionExpression", node, opts); + } + function assertClassBody(node, opts) { + assert$2("ClassBody", node, opts); + } + function assertClassExpression(node, opts) { + assert$2("ClassExpression", node, opts); + } + function assertClassDeclaration(node, opts) { + assert$2("ClassDeclaration", node, opts); + } + function assertExportAllDeclaration(node, opts) { + assert$2("ExportAllDeclaration", node, opts); + } + function assertExportDefaultDeclaration(node, opts) { + assert$2("ExportDefaultDeclaration", node, opts); + } + function assertExportNamedDeclaration(node, opts) { + assert$2("ExportNamedDeclaration", node, opts); + } + function assertExportSpecifier$1(node, opts) { + assert$2("ExportSpecifier", node, opts); + } + function assertForOfStatement(node, opts) { + assert$2("ForOfStatement", node, opts); + } + function assertImportDeclaration(node, opts) { + assert$2("ImportDeclaration", node, opts); + } + function assertImportDefaultSpecifier(node, opts) { + assert$2("ImportDefaultSpecifier", node, opts); + } + function assertImportNamespaceSpecifier(node, opts) { + assert$2("ImportNamespaceSpecifier", node, opts); + } + function assertImportSpecifier(node, opts) { + assert$2("ImportSpecifier", node, opts); + } + function assertMetaProperty(node, opts) { + assert$2("MetaProperty", node, opts); + } + function assertClassMethod(node, opts) { + assert$2("ClassMethod", node, opts); + } + function assertObjectPattern(node, opts) { + assert$2("ObjectPattern", node, opts); + } + function assertSpreadElement(node, opts) { + assert$2("SpreadElement", node, opts); + } + function assertSuper(node, opts) { + assert$2("Super", node, opts); + } + function assertTaggedTemplateExpression(node, opts) { + assert$2("TaggedTemplateExpression", node, opts); + } + function assertTemplateElement(node, opts) { + assert$2("TemplateElement", node, opts); + } + function assertTemplateLiteral(node, opts) { + assert$2("TemplateLiteral", node, opts); + } + function assertYieldExpression(node, opts) { + assert$2("YieldExpression", node, opts); + } + function assertAwaitExpression(node, opts) { + assert$2("AwaitExpression", node, opts); + } + function assertImport(node, opts) { + assert$2("Import", node, opts); + } + function assertBigIntLiteral(node, opts) { + assert$2("BigIntLiteral", node, opts); + } + function assertExportNamespaceSpecifier(node, opts) { + assert$2("ExportNamespaceSpecifier", node, opts); + } + function assertOptionalMemberExpression(node, opts) { + assert$2("OptionalMemberExpression", node, opts); + } + function assertOptionalCallExpression(node, opts) { + assert$2("OptionalCallExpression", node, opts); + } + function assertClassProperty(node, opts) { + assert$2("ClassProperty", node, opts); + } + function assertClassAccessorProperty(node, opts) { + assert$2("ClassAccessorProperty", node, opts); + } + function assertClassPrivateProperty(node, opts) { + assert$2("ClassPrivateProperty", node, opts); + } + function assertClassPrivateMethod(node, opts) { + assert$2("ClassPrivateMethod", node, opts); + } + function assertPrivateName(node, opts) { + assert$2("PrivateName", node, opts); + } + function assertStaticBlock(node, opts) { + assert$2("StaticBlock", node, opts); + } + function assertAnyTypeAnnotation(node, opts) { + assert$2("AnyTypeAnnotation", node, opts); + } + function assertArrayTypeAnnotation(node, opts) { + assert$2("ArrayTypeAnnotation", node, opts); + } + function assertBooleanTypeAnnotation(node, opts) { + assert$2("BooleanTypeAnnotation", node, opts); + } + function assertBooleanLiteralTypeAnnotation(node, opts) { + assert$2("BooleanLiteralTypeAnnotation", node, opts); + } + function assertNullLiteralTypeAnnotation(node, opts) { + assert$2("NullLiteralTypeAnnotation", node, opts); + } + function assertClassImplements(node, opts) { + assert$2("ClassImplements", node, opts); + } + function assertDeclareClass(node, opts) { + assert$2("DeclareClass", node, opts); + } + function assertDeclareFunction(node, opts) { + assert$2("DeclareFunction", node, opts); + } + function assertDeclareInterface(node, opts) { + assert$2("DeclareInterface", node, opts); + } + function assertDeclareModule(node, opts) { + assert$2("DeclareModule", node, opts); + } + function assertDeclareModuleExports(node, opts) { + assert$2("DeclareModuleExports", node, opts); + } + function assertDeclareTypeAlias(node, opts) { + assert$2("DeclareTypeAlias", node, opts); + } + function assertDeclareOpaqueType(node, opts) { + assert$2("DeclareOpaqueType", node, opts); + } + function assertDeclareVariable(node, opts) { + assert$2("DeclareVariable", node, opts); + } + function assertDeclareExportDeclaration(node, opts) { + assert$2("DeclareExportDeclaration", node, opts); + } + function assertDeclareExportAllDeclaration(node, opts) { + assert$2("DeclareExportAllDeclaration", node, opts); + } + function assertDeclaredPredicate(node, opts) { + assert$2("DeclaredPredicate", node, opts); + } + function assertExistsTypeAnnotation(node, opts) { + assert$2("ExistsTypeAnnotation", node, opts); + } + function assertFunctionTypeAnnotation(node, opts) { + assert$2("FunctionTypeAnnotation", node, opts); + } + function assertFunctionTypeParam(node, opts) { + assert$2("FunctionTypeParam", node, opts); + } + function assertGenericTypeAnnotation(node, opts) { + assert$2("GenericTypeAnnotation", node, opts); + } + function assertInferredPredicate(node, opts) { + assert$2("InferredPredicate", node, opts); + } + function assertInterfaceExtends(node, opts) { + assert$2("InterfaceExtends", node, opts); + } + function assertInterfaceDeclaration(node, opts) { + assert$2("InterfaceDeclaration", node, opts); + } + function assertInterfaceTypeAnnotation(node, opts) { + assert$2("InterfaceTypeAnnotation", node, opts); + } + function assertIntersectionTypeAnnotation(node, opts) { + assert$2("IntersectionTypeAnnotation", node, opts); + } + function assertMixedTypeAnnotation(node, opts) { + assert$2("MixedTypeAnnotation", node, opts); + } + function assertEmptyTypeAnnotation(node, opts) { + assert$2("EmptyTypeAnnotation", node, opts); + } + function assertNullableTypeAnnotation(node, opts) { + assert$2("NullableTypeAnnotation", node, opts); + } + function assertNumberLiteralTypeAnnotation(node, opts) { + assert$2("NumberLiteralTypeAnnotation", node, opts); + } + function assertNumberTypeAnnotation(node, opts) { + assert$2("NumberTypeAnnotation", node, opts); + } + function assertObjectTypeAnnotation(node, opts) { + assert$2("ObjectTypeAnnotation", node, opts); + } + function assertObjectTypeInternalSlot(node, opts) { + assert$2("ObjectTypeInternalSlot", node, opts); + } + function assertObjectTypeCallProperty(node, opts) { + assert$2("ObjectTypeCallProperty", node, opts); + } + function assertObjectTypeIndexer(node, opts) { + assert$2("ObjectTypeIndexer", node, opts); + } + function assertObjectTypeProperty(node, opts) { + assert$2("ObjectTypeProperty", node, opts); + } + function assertObjectTypeSpreadProperty(node, opts) { + assert$2("ObjectTypeSpreadProperty", node, opts); + } + function assertOpaqueType(node, opts) { + assert$2("OpaqueType", node, opts); + } + function assertQualifiedTypeIdentifier(node, opts) { + assert$2("QualifiedTypeIdentifier", node, opts); + } + function assertStringLiteralTypeAnnotation(node, opts) { + assert$2("StringLiteralTypeAnnotation", node, opts); + } + function assertStringTypeAnnotation(node, opts) { + assert$2("StringTypeAnnotation", node, opts); + } + function assertSymbolTypeAnnotation(node, opts) { + assert$2("SymbolTypeAnnotation", node, opts); + } + function assertThisTypeAnnotation(node, opts) { + assert$2("ThisTypeAnnotation", node, opts); + } + function assertTupleTypeAnnotation(node, opts) { + assert$2("TupleTypeAnnotation", node, opts); + } + function assertTypeofTypeAnnotation(node, opts) { + assert$2("TypeofTypeAnnotation", node, opts); + } + function assertTypeAlias(node, opts) { + assert$2("TypeAlias", node, opts); + } + function assertTypeAnnotation(node, opts) { + assert$2("TypeAnnotation", node, opts); + } + function assertTypeCastExpression(node, opts) { + assert$2("TypeCastExpression", node, opts); + } + function assertTypeParameter(node, opts) { + assert$2("TypeParameter", node, opts); + } + function assertTypeParameterDeclaration(node, opts) { + assert$2("TypeParameterDeclaration", node, opts); + } + function assertTypeParameterInstantiation(node, opts) { + assert$2("TypeParameterInstantiation", node, opts); + } + function assertUnionTypeAnnotation(node, opts) { + assert$2("UnionTypeAnnotation", node, opts); + } + function assertVariance(node, opts) { + assert$2("Variance", node, opts); + } + function assertVoidTypeAnnotation(node, opts) { + assert$2("VoidTypeAnnotation", node, opts); + } + function assertEnumDeclaration(node, opts) { + assert$2("EnumDeclaration", node, opts); + } + function assertEnumBooleanBody(node, opts) { + assert$2("EnumBooleanBody", node, opts); + } + function assertEnumNumberBody(node, opts) { + assert$2("EnumNumberBody", node, opts); + } + function assertEnumStringBody(node, opts) { + assert$2("EnumStringBody", node, opts); + } + function assertEnumSymbolBody(node, opts) { + assert$2("EnumSymbolBody", node, opts); + } + function assertEnumBooleanMember(node, opts) { + assert$2("EnumBooleanMember", node, opts); + } + function assertEnumNumberMember(node, opts) { + assert$2("EnumNumberMember", node, opts); + } + function assertEnumStringMember(node, opts) { + assert$2("EnumStringMember", node, opts); + } + function assertEnumDefaultedMember(node, opts) { + assert$2("EnumDefaultedMember", node, opts); + } + function assertIndexedAccessType(node, opts) { + assert$2("IndexedAccessType", node, opts); + } + function assertOptionalIndexedAccessType(node, opts) { + assert$2("OptionalIndexedAccessType", node, opts); + } + function assertJSXAttribute(node, opts) { + assert$2("JSXAttribute", node, opts); + } + function assertJSXClosingElement(node, opts) { + assert$2("JSXClosingElement", node, opts); + } + function assertJSXElement(node, opts) { + assert$2("JSXElement", node, opts); + } + function assertJSXEmptyExpression(node, opts) { + assert$2("JSXEmptyExpression", node, opts); + } + function assertJSXExpressionContainer(node, opts) { + assert$2("JSXExpressionContainer", node, opts); + } + function assertJSXSpreadChild(node, opts) { + assert$2("JSXSpreadChild", node, opts); + } + function assertJSXIdentifier(node, opts) { + assert$2("JSXIdentifier", node, opts); + } + function assertJSXMemberExpression(node, opts) { + assert$2("JSXMemberExpression", node, opts); + } + function assertJSXNamespacedName(node, opts) { + assert$2("JSXNamespacedName", node, opts); + } + function assertJSXOpeningElement(node, opts) { + assert$2("JSXOpeningElement", node, opts); + } + function assertJSXSpreadAttribute(node, opts) { + assert$2("JSXSpreadAttribute", node, opts); + } + function assertJSXText(node, opts) { + assert$2("JSXText", node, opts); + } + function assertJSXFragment(node, opts) { + assert$2("JSXFragment", node, opts); + } + function assertJSXOpeningFragment(node, opts) { + assert$2("JSXOpeningFragment", node, opts); + } + function assertJSXClosingFragment(node, opts) { + assert$2("JSXClosingFragment", node, opts); + } + function assertNoop(node, opts) { + assert$2("Noop", node, opts); + } + function assertPlaceholder(node, opts) { + assert$2("Placeholder", node, opts); + } + function assertV8IntrinsicIdentifier(node, opts) { + assert$2("V8IntrinsicIdentifier", node, opts); + } + function assertArgumentPlaceholder(node, opts) { + assert$2("ArgumentPlaceholder", node, opts); + } + function assertBindExpression(node, opts) { + assert$2("BindExpression", node, opts); + } + function assertImportAttribute(node, opts) { + assert$2("ImportAttribute", node, opts); + } + function assertDecorator(node, opts) { + assert$2("Decorator", node, opts); + } + function assertDoExpression(node, opts) { + assert$2("DoExpression", node, opts); + } + function assertExportDefaultSpecifier(node, opts) { + assert$2("ExportDefaultSpecifier", node, opts); + } + function assertRecordExpression(node, opts) { + assert$2("RecordExpression", node, opts); + } + function assertTupleExpression(node, opts) { + assert$2("TupleExpression", node, opts); + } + function assertDecimalLiteral(node, opts) { + assert$2("DecimalLiteral", node, opts); + } + function assertModuleExpression(node, opts) { + assert$2("ModuleExpression", node, opts); + } + function assertTopicReference(node, opts) { + assert$2("TopicReference", node, opts); + } + function assertPipelineTopicExpression(node, opts) { + assert$2("PipelineTopicExpression", node, opts); + } + function assertPipelineBareFunction(node, opts) { + assert$2("PipelineBareFunction", node, opts); + } + function assertPipelinePrimaryTopicReference(node, opts) { + assert$2("PipelinePrimaryTopicReference", node, opts); + } + function assertTSParameterProperty(node, opts) { + assert$2("TSParameterProperty", node, opts); + } + function assertTSDeclareFunction(node, opts) { + assert$2("TSDeclareFunction", node, opts); + } + function assertTSDeclareMethod(node, opts) { + assert$2("TSDeclareMethod", node, opts); + } + function assertTSQualifiedName(node, opts) { + assert$2("TSQualifiedName", node, opts); + } + function assertTSCallSignatureDeclaration(node, opts) { + assert$2("TSCallSignatureDeclaration", node, opts); + } + function assertTSConstructSignatureDeclaration(node, opts) { + assert$2("TSConstructSignatureDeclaration", node, opts); + } + function assertTSPropertySignature(node, opts) { + assert$2("TSPropertySignature", node, opts); + } + function assertTSMethodSignature(node, opts) { + assert$2("TSMethodSignature", node, opts); + } + function assertTSIndexSignature(node, opts) { + assert$2("TSIndexSignature", node, opts); + } + function assertTSAnyKeyword(node, opts) { + assert$2("TSAnyKeyword", node, opts); + } + function assertTSBooleanKeyword(node, opts) { + assert$2("TSBooleanKeyword", node, opts); + } + function assertTSBigIntKeyword(node, opts) { + assert$2("TSBigIntKeyword", node, opts); + } + function assertTSIntrinsicKeyword(node, opts) { + assert$2("TSIntrinsicKeyword", node, opts); + } + function assertTSNeverKeyword(node, opts) { + assert$2("TSNeverKeyword", node, opts); + } + function assertTSNullKeyword(node, opts) { + assert$2("TSNullKeyword", node, opts); + } + function assertTSNumberKeyword(node, opts) { + assert$2("TSNumberKeyword", node, opts); + } + function assertTSObjectKeyword(node, opts) { + assert$2("TSObjectKeyword", node, opts); + } + function assertTSStringKeyword(node, opts) { + assert$2("TSStringKeyword", node, opts); + } + function assertTSSymbolKeyword(node, opts) { + assert$2("TSSymbolKeyword", node, opts); + } + function assertTSUndefinedKeyword(node, opts) { + assert$2("TSUndefinedKeyword", node, opts); + } + function assertTSUnknownKeyword(node, opts) { + assert$2("TSUnknownKeyword", node, opts); + } + function assertTSVoidKeyword(node, opts) { + assert$2("TSVoidKeyword", node, opts); + } + function assertTSThisType(node, opts) { + assert$2("TSThisType", node, opts); + } + function assertTSFunctionType(node, opts) { + assert$2("TSFunctionType", node, opts); + } + function assertTSConstructorType(node, opts) { + assert$2("TSConstructorType", node, opts); + } + function assertTSTypeReference(node, opts) { + assert$2("TSTypeReference", node, opts); + } + function assertTSTypePredicate(node, opts) { + assert$2("TSTypePredicate", node, opts); + } + function assertTSTypeQuery(node, opts) { + assert$2("TSTypeQuery", node, opts); + } + function assertTSTypeLiteral(node, opts) { + assert$2("TSTypeLiteral", node, opts); + } + function assertTSArrayType(node, opts) { + assert$2("TSArrayType", node, opts); + } + function assertTSTupleType(node, opts) { + assert$2("TSTupleType", node, opts); + } + function assertTSOptionalType(node, opts) { + assert$2("TSOptionalType", node, opts); + } + function assertTSRestType(node, opts) { + assert$2("TSRestType", node, opts); + } + function assertTSNamedTupleMember(node, opts) { + assert$2("TSNamedTupleMember", node, opts); + } + function assertTSUnionType(node, opts) { + assert$2("TSUnionType", node, opts); + } + function assertTSIntersectionType(node, opts) { + assert$2("TSIntersectionType", node, opts); + } + function assertTSConditionalType(node, opts) { + assert$2("TSConditionalType", node, opts); + } + function assertTSInferType(node, opts) { + assert$2("TSInferType", node, opts); + } + function assertTSParenthesizedType(node, opts) { + assert$2("TSParenthesizedType", node, opts); + } + function assertTSTypeOperator(node, opts) { + assert$2("TSTypeOperator", node, opts); + } + function assertTSIndexedAccessType(node, opts) { + assert$2("TSIndexedAccessType", node, opts); + } + function assertTSMappedType(node, opts) { + assert$2("TSMappedType", node, opts); + } + function assertTSLiteralType(node, opts) { + assert$2("TSLiteralType", node, opts); + } + function assertTSExpressionWithTypeArguments(node, opts) { + assert$2("TSExpressionWithTypeArguments", node, opts); + } + function assertTSInterfaceDeclaration(node, opts) { + assert$2("TSInterfaceDeclaration", node, opts); + } + function assertTSInterfaceBody(node, opts) { + assert$2("TSInterfaceBody", node, opts); + } + function assertTSTypeAliasDeclaration(node, opts) { + assert$2("TSTypeAliasDeclaration", node, opts); + } + function assertTSInstantiationExpression(node, opts) { + assert$2("TSInstantiationExpression", node, opts); + } + function assertTSAsExpression(node, opts) { + assert$2("TSAsExpression", node, opts); + } + function assertTSSatisfiesExpression(node, opts) { + assert$2("TSSatisfiesExpression", node, opts); + } + function assertTSTypeAssertion(node, opts) { + assert$2("TSTypeAssertion", node, opts); + } + function assertTSEnumDeclaration(node, opts) { + assert$2("TSEnumDeclaration", node, opts); + } + function assertTSEnumMember(node, opts) { + assert$2("TSEnumMember", node, opts); + } + function assertTSModuleDeclaration(node, opts) { + assert$2("TSModuleDeclaration", node, opts); + } + function assertTSModuleBlock(node, opts) { + assert$2("TSModuleBlock", node, opts); + } + function assertTSImportType(node, opts) { + assert$2("TSImportType", node, opts); + } + function assertTSImportEqualsDeclaration(node, opts) { + assert$2("TSImportEqualsDeclaration", node, opts); + } + function assertTSExternalModuleReference(node, opts) { + assert$2("TSExternalModuleReference", node, opts); + } + function assertTSNonNullExpression(node, opts) { + assert$2("TSNonNullExpression", node, opts); + } + function assertTSExportAssignment(node, opts) { + assert$2("TSExportAssignment", node, opts); + } + function assertTSNamespaceExportDeclaration(node, opts) { + assert$2("TSNamespaceExportDeclaration", node, opts); + } + function assertTSTypeAnnotation(node, opts) { + assert$2("TSTypeAnnotation", node, opts); + } + function assertTSTypeParameterInstantiation(node, opts) { + assert$2("TSTypeParameterInstantiation", node, opts); + } + function assertTSTypeParameterDeclaration(node, opts) { + assert$2("TSTypeParameterDeclaration", node, opts); + } + function assertTSTypeParameter(node, opts) { + assert$2("TSTypeParameter", node, opts); + } + function assertStandardized(node, opts) { + assert$2("Standardized", node, opts); + } + function assertExpression$1(node, opts) { + assert$2("Expression", node, opts); + } + function assertBinary(node, opts) { + assert$2("Binary", node, opts); + } + function assertScopable(node, opts) { + assert$2("Scopable", node, opts); + } + function assertBlockParent(node, opts) { + assert$2("BlockParent", node, opts); + } + function assertBlock(node, opts) { + assert$2("Block", node, opts); + } + function assertStatement(node, opts) { + assert$2("Statement", node, opts); + } + function assertTerminatorless(node, opts) { + assert$2("Terminatorless", node, opts); + } + function assertCompletionStatement(node, opts) { + assert$2("CompletionStatement", node, opts); + } + function assertConditional(node, opts) { + assert$2("Conditional", node, opts); + } + function assertLoop(node, opts) { + assert$2("Loop", node, opts); + } + function assertWhile(node, opts) { + assert$2("While", node, opts); + } + function assertExpressionWrapper(node, opts) { + assert$2("ExpressionWrapper", node, opts); + } + function assertFor(node, opts) { + assert$2("For", node, opts); + } + function assertForXStatement(node, opts) { + assert$2("ForXStatement", node, opts); + } + function assertFunction$1(node, opts) { + assert$2("Function", node, opts); + } + function assertFunctionParent(node, opts) { + assert$2("FunctionParent", node, opts); + } + function assertPureish(node, opts) { + assert$2("Pureish", node, opts); + } + function assertDeclaration(node, opts) { + assert$2("Declaration", node, opts); + } + function assertPatternLike(node, opts) { + assert$2("PatternLike", node, opts); + } + function assertLVal(node, opts) { + assert$2("LVal", node, opts); + } + function assertTSEntityName(node, opts) { + assert$2("TSEntityName", node, opts); + } + function assertLiteral(node, opts) { + assert$2("Literal", node, opts); + } + function assertImmutable(node, opts) { + assert$2("Immutable", node, opts); + } + function assertUserWhitespacable(node, opts) { + assert$2("UserWhitespacable", node, opts); + } + function assertMethod(node, opts) { + assert$2("Method", node, opts); + } + function assertObjectMember(node, opts) { + assert$2("ObjectMember", node, opts); + } + function assertProperty(node, opts) { + assert$2("Property", node, opts); + } + function assertUnaryLike(node, opts) { + assert$2("UnaryLike", node, opts); + } + function assertPattern(node, opts) { + assert$2("Pattern", node, opts); + } + function assertClass(node, opts) { + assert$2("Class", node, opts); + } + function assertImportOrExportDeclaration(node, opts) { + assert$2("ImportOrExportDeclaration", node, opts); + } + function assertExportDeclaration(node, opts) { + assert$2("ExportDeclaration", node, opts); + } + function assertModuleSpecifier(node, opts) { + assert$2("ModuleSpecifier", node, opts); + } + function assertAccessor(node, opts) { + assert$2("Accessor", node, opts); + } + function assertPrivate(node, opts) { + assert$2("Private", node, opts); + } + function assertFlow(node, opts) { + assert$2("Flow", node, opts); + } + function assertFlowType(node, opts) { + assert$2("FlowType", node, opts); + } + function assertFlowBaseAnnotation(node, opts) { + assert$2("FlowBaseAnnotation", node, opts); + } + function assertFlowDeclaration(node, opts) { + assert$2("FlowDeclaration", node, opts); + } + function assertFlowPredicate(node, opts) { + assert$2("FlowPredicate", node, opts); + } + function assertEnumBody(node, opts) { + assert$2("EnumBody", node, opts); + } + function assertEnumMember(node, opts) { + assert$2("EnumMember", node, opts); + } + function assertJSX(node, opts) { + assert$2("JSX", node, opts); + } + function assertMiscellaneous(node, opts) { + assert$2("Miscellaneous", node, opts); + } + function assertTypeScript(node, opts) { + assert$2("TypeScript", node, opts); + } + function assertTSTypeElement(node, opts) { + assert$2("TSTypeElement", node, opts); + } + function assertTSType(node, opts) { + assert$2("TSType", node, opts); + } + function assertTSBaseType(node, opts) { + assert$2("TSBaseType", node, opts); + } + function assertNumberLiteral(node, opts) { + deprecationWarning$1("assertNumberLiteral", "assertNumericLiteral"); + assert$2("NumberLiteral", node, opts); + } + function assertRegexLiteral(node, opts) { + deprecationWarning$1("assertRegexLiteral", "assertRegExpLiteral"); + assert$2("RegexLiteral", node, opts); + } + function assertRestProperty(node, opts) { + deprecationWarning$1("assertRestProperty", "assertRestElement"); + assert$2("RestProperty", node, opts); + } + function assertSpreadProperty(node, opts) { + deprecationWarning$1("assertSpreadProperty", "assertSpreadElement"); + assert$2("SpreadProperty", node, opts); + } + function assertModuleDeclaration(node, opts) { + deprecationWarning$1("assertModuleDeclaration", "assertImportOrExportDeclaration"); + assert$2("ModuleDeclaration", node, opts); + } + + function createTypeAnnotationBasedOnTypeof$1(type) { + switch (type) { + case "string": + return stringTypeAnnotation$2(); + case "number": + return numberTypeAnnotation$2(); + case "undefined": + return voidTypeAnnotation$3(); + case "boolean": + return booleanTypeAnnotation$1(); + case "function": + return genericTypeAnnotation$1(identifier$i("Function")); + case "object": + return genericTypeAnnotation$1(identifier$i("Object")); + case "symbol": + return genericTypeAnnotation$1(identifier$i("Symbol")); + case "bigint": + return anyTypeAnnotation$2(); + } + throw new Error("Invalid typeof value: " + type); + } + + function getQualifiedName$1(node) { + return isIdentifier$j(node) ? node.name : node.id.name + "." + getQualifiedName$1(node.qualification); + } + function removeTypeDuplicates$1(nodesIn) { + var nodes = Array.from(nodesIn); + var generics = new Map(); + var bases = new Map(); + var typeGroups = new Set(); + var types = []; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (!node) continue; + if (types.indexOf(node) >= 0) { + continue; + } + if (isAnyTypeAnnotation$1(node)) { + return [node]; + } + if (isFlowBaseAnnotation$1(node)) { + bases.set(node.type, node); + continue; + } + if (isUnionTypeAnnotation$2(node)) { + if (!typeGroups.has(node.types)) { + nodes.push.apply(nodes, _toConsumableArray(node.types)); + typeGroups.add(node.types); + } + continue; + } + if (isGenericTypeAnnotation$1(node)) { + var name = getQualifiedName$1(node.id); + if (generics.has(name)) { + var existing = generics.get(name); + if (existing.typeParameters) { + if (node.typeParameters) { + var _existing$typeParamet; + (_existing$typeParamet = existing.typeParameters.params).push.apply(_existing$typeParamet, _toConsumableArray(node.typeParameters.params)); + existing.typeParameters.params = removeTypeDuplicates$1(existing.typeParameters.params); + } + } else { + existing = node.typeParameters; + } + } else { + generics.set(name, node); + } + continue; + } + types.push(node); + } + for (var _iterator = _createForOfIteratorHelperLoose(bases), _step; !(_step = _iterator()).done;) { + var _step$value = _slicedToArray(_step.value, 2), + baseType = _step$value[1]; + types.push(baseType); + } + for (var _iterator2 = _createForOfIteratorHelperLoose(generics), _step2; !(_step2 = _iterator2()).done;) { + var _step2$value = _slicedToArray(_step2.value, 2), + genericName = _step2$value[1]; + types.push(genericName); + } + return types; + } + + function createFlowUnionType$1(types) { + var flattened = removeTypeDuplicates$1(types); + if (flattened.length === 1) { + return flattened[0]; + } else { + return unionTypeAnnotation$1(flattened); + } + } + + function getQualifiedName(node) { + return isIdentifier$j(node) ? node.name : node.right.name + "." + getQualifiedName(node.left); + } + function removeTypeDuplicates(nodesIn) { + var nodes = Array.from(nodesIn); + var generics = new Map(); + var bases = new Map(); + var typeGroups = new Set(); + var types = []; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (!node) continue; + if (types.indexOf(node) >= 0) { + continue; + } + if (isTSAnyKeyword(node)) { + return [node]; + } + if (isTSBaseType(node)) { + bases.set(node.type, node); + continue; + } + if (isTSUnionType$1(node)) { + if (!typeGroups.has(node.types)) { + nodes.push.apply(nodes, _toConsumableArray(node.types)); + typeGroups.add(node.types); + } + continue; + } + if (isTSTypeReference$1(node) && node.typeParameters) { + var name = getQualifiedName(node.typeName); + if (generics.has(name)) { + var existing = generics.get(name); + if (existing.typeParameters) { + if (node.typeParameters) { + var _existing$typeParamet; + (_existing$typeParamet = existing.typeParameters.params).push.apply(_existing$typeParamet, _toConsumableArray(node.typeParameters.params)); + existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params); + } + } else { + existing = node.typeParameters; + } + } else { + generics.set(name, node); + } + continue; + } + types.push(node); + } + for (var _iterator = _createForOfIteratorHelperLoose(bases), _step; !(_step = _iterator()).done;) { + var _step$value = _slicedToArray(_step.value, 2), + baseType = _step$value[1]; + types.push(baseType); + } + for (var _iterator2 = _createForOfIteratorHelperLoose(generics), _step2; !(_step2 = _iterator2()).done;) { + var _step2$value = _slicedToArray(_step2.value, 2), + genericName = _step2$value[1]; + types.push(genericName); + } + return types; + } + + function createTSUnionType$1(typeAnnotations) { + var types = typeAnnotations.map(function (type) { + return isTSTypeAnnotation$1(type) ? type.typeAnnotation : type; + }); + var flattened = removeTypeDuplicates(types); + if (flattened.length === 1) { + return flattened[0]; + } else { + return tsUnionType(flattened); + } + } + + var has$9 = Function.call.bind(Object.prototype.hasOwnProperty); + function cloneIfNode(obj, deep, withoutLoc, commentsCache) { + if (obj && typeof obj.type === "string") { + return cloneNodeInternal(obj, deep, withoutLoc, commentsCache); + } + return obj; + } + function cloneIfNodeOrArray(obj, deep, withoutLoc, commentsCache) { + if (Array.isArray(obj)) { + return obj.map(function (node) { + return cloneIfNode(node, deep, withoutLoc, commentsCache); + }); + } + return cloneIfNode(obj, deep, withoutLoc, commentsCache); + } + function cloneNode$j(node, deep, withoutLoc) { + if (deep === void 0) { + deep = true; + } + if (withoutLoc === void 0) { + withoutLoc = false; + } + return cloneNodeInternal(node, deep, withoutLoc, new Map()); + } + function cloneNodeInternal(node, deep, withoutLoc, commentsCache) { + if (deep === void 0) { + deep = true; + } + if (withoutLoc === void 0) { + withoutLoc = false; + } + if (!node) return node; + var type = node.type; + var newNode = { + type: node.type + }; + if (isIdentifier$j(node)) { + newNode.name = node.name; + if (has$9(node, "optional") && typeof node.optional === "boolean") { + newNode.optional = node.optional; + } + if (has$9(node, "typeAnnotation")) { + newNode.typeAnnotation = deep ? cloneIfNodeOrArray(node.typeAnnotation, true, withoutLoc, commentsCache) : node.typeAnnotation; + } + } else if (!has$9(NODE_FIELDS, type)) { + throw new Error("Unknown node type: \"" + type + "\""); + } else { + for (var _i = 0, _Object$keys = Object.keys(NODE_FIELDS[type]); _i < _Object$keys.length; _i++) { + var field = _Object$keys[_i]; + if (has$9(node, field)) { + if (deep) { + newNode[field] = isFile(node) && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc, commentsCache) : cloneIfNodeOrArray(node[field], true, withoutLoc, commentsCache); + } else { + newNode[field] = node[field]; + } + } + } + } + if (has$9(node, "loc")) { + if (withoutLoc) { + newNode.loc = null; + } else { + newNode.loc = node.loc; + } + } + if (has$9(node, "leadingComments")) { + newNode.leadingComments = maybeCloneComments(node.leadingComments, deep, withoutLoc, commentsCache); + } + if (has$9(node, "innerComments")) { + newNode.innerComments = maybeCloneComments(node.innerComments, deep, withoutLoc, commentsCache); + } + if (has$9(node, "trailingComments")) { + newNode.trailingComments = maybeCloneComments(node.trailingComments, deep, withoutLoc, commentsCache); + } + if (has$9(node, "extra")) { + newNode.extra = Object.assign({}, node.extra); + } + return newNode; + } + function maybeCloneComments(comments, deep, withoutLoc, commentsCache) { + if (!comments || !deep) { + return comments; + } + return comments.map(function (comment) { + var cache = commentsCache.get(comment); + if (cache) return cache; + var type = comment.type, + value = comment.value, + loc = comment.loc; + var ret = { + type: type, + value: value, + loc: loc + }; + if (withoutLoc) { + ret.loc = null; + } + commentsCache.set(comment, ret); + return ret; + }); + } + + function clone(node) { + return cloneNode$j(node, false); + } + + function cloneDeep$1(node) { + return cloneNode$j(node); + } + + function cloneDeepWithoutLoc(node) { + return cloneNode$j(node, true, true); + } + + function cloneWithoutLoc(node) { + return cloneNode$j(node, false, true); + } + + function addComments$1(node, type, comments) { + if (!comments || !node) return node; + var key = type + "Comments"; + if (node[key]) { + if (type === "leading") { + node[key] = comments.concat(node[key]); + } else { + var _node$key; + (_node$key = node[key]).push.apply(_node$key, _toConsumableArray(comments)); + } + } else { + node[key] = comments; + } + return node; + } + + function addComment$2(node, type, content, line) { + return addComments$1(node, type, [{ + type: line ? "CommentLine" : "CommentBlock", + value: content + }]); + } + + function inherit(key, child, parent) { + if (child && parent) { + child[key] = Array.from(new Set([].concat(child[key], parent[key]).filter(Boolean))); + } + } + + function inheritInnerComments(child, parent) { + inherit("innerComments", child, parent); + } + + function inheritLeadingComments$1(child, parent) { + inherit("leadingComments", child, parent); + } + + function inheritTrailingComments$1(child, parent) { + inherit("trailingComments", child, parent); + } + + function inheritsComments$1(child, parent) { + inheritTrailingComments$1(child, parent); + inheritLeadingComments$1(child, parent); + inheritInnerComments(child, parent); + return child; + } + + function removeComments$1(node) { + COMMENT_KEYS.forEach(function (key) { + node[key] = null; + }); + return node; + } + + var STANDARDIZED_TYPES = FLIPPED_ALIAS_KEYS$3["Standardized"]; + var EXPRESSION_TYPES = FLIPPED_ALIAS_KEYS$3["Expression"]; + var BINARY_TYPES = FLIPPED_ALIAS_KEYS$3["Binary"]; + var SCOPABLE_TYPES = FLIPPED_ALIAS_KEYS$3["Scopable"]; + var BLOCKPARENT_TYPES = FLIPPED_ALIAS_KEYS$3["BlockParent"]; + var BLOCK_TYPES = FLIPPED_ALIAS_KEYS$3["Block"]; + var STATEMENT_TYPES = FLIPPED_ALIAS_KEYS$3["Statement"]; + var TERMINATORLESS_TYPES = FLIPPED_ALIAS_KEYS$3["Terminatorless"]; + var COMPLETIONSTATEMENT_TYPES = FLIPPED_ALIAS_KEYS$3["CompletionStatement"]; + var CONDITIONAL_TYPES = FLIPPED_ALIAS_KEYS$3["Conditional"]; + var LOOP_TYPES = FLIPPED_ALIAS_KEYS$3["Loop"]; + var WHILE_TYPES = FLIPPED_ALIAS_KEYS$3["While"]; + var EXPRESSIONWRAPPER_TYPES = FLIPPED_ALIAS_KEYS$3["ExpressionWrapper"]; + var FOR_TYPES = FLIPPED_ALIAS_KEYS$3["For"]; + var FORXSTATEMENT_TYPES = FLIPPED_ALIAS_KEYS$3["ForXStatement"]; + var FUNCTION_TYPES$1 = FLIPPED_ALIAS_KEYS$3["Function"]; + var FUNCTIONPARENT_TYPES = FLIPPED_ALIAS_KEYS$3["FunctionParent"]; + var PUREISH_TYPES = FLIPPED_ALIAS_KEYS$3["Pureish"]; + var DECLARATION_TYPES = FLIPPED_ALIAS_KEYS$3["Declaration"]; + var PATTERNLIKE_TYPES = FLIPPED_ALIAS_KEYS$3["PatternLike"]; + var LVAL_TYPES = FLIPPED_ALIAS_KEYS$3["LVal"]; + var TSENTITYNAME_TYPES = FLIPPED_ALIAS_KEYS$3["TSEntityName"]; + var LITERAL_TYPES = FLIPPED_ALIAS_KEYS$3["Literal"]; + var IMMUTABLE_TYPES = FLIPPED_ALIAS_KEYS$3["Immutable"]; + var USERWHITESPACABLE_TYPES = FLIPPED_ALIAS_KEYS$3["UserWhitespacable"]; + var METHOD_TYPES = FLIPPED_ALIAS_KEYS$3["Method"]; + var OBJECTMEMBER_TYPES = FLIPPED_ALIAS_KEYS$3["ObjectMember"]; + var PROPERTY_TYPES = FLIPPED_ALIAS_KEYS$3["Property"]; + var UNARYLIKE_TYPES = FLIPPED_ALIAS_KEYS$3["UnaryLike"]; + var PATTERN_TYPES = FLIPPED_ALIAS_KEYS$3["Pattern"]; + var CLASS_TYPES = FLIPPED_ALIAS_KEYS$3["Class"]; + var IMPORTOREXPORTDECLARATION_TYPES = FLIPPED_ALIAS_KEYS$3["ImportOrExportDeclaration"]; + var EXPORTDECLARATION_TYPES = FLIPPED_ALIAS_KEYS$3["ExportDeclaration"]; + var MODULESPECIFIER_TYPES = FLIPPED_ALIAS_KEYS$3["ModuleSpecifier"]; + var ACCESSOR_TYPES = FLIPPED_ALIAS_KEYS$3["Accessor"]; + var PRIVATE_TYPES = FLIPPED_ALIAS_KEYS$3["Private"]; + var FLOW_TYPES = FLIPPED_ALIAS_KEYS$3["Flow"]; + var FLOWTYPE_TYPES = FLIPPED_ALIAS_KEYS$3["FlowType"]; + var FLOWBASEANNOTATION_TYPES = FLIPPED_ALIAS_KEYS$3["FlowBaseAnnotation"]; + var FLOWDECLARATION_TYPES = FLIPPED_ALIAS_KEYS$3["FlowDeclaration"]; + var FLOWPREDICATE_TYPES = FLIPPED_ALIAS_KEYS$3["FlowPredicate"]; + var ENUMBODY_TYPES = FLIPPED_ALIAS_KEYS$3["EnumBody"]; + var ENUMMEMBER_TYPES = FLIPPED_ALIAS_KEYS$3["EnumMember"]; + var JSX_TYPES = FLIPPED_ALIAS_KEYS$3["JSX"]; + var MISCELLANEOUS_TYPES = FLIPPED_ALIAS_KEYS$3["Miscellaneous"]; + var TYPESCRIPT_TYPES = FLIPPED_ALIAS_KEYS$3["TypeScript"]; + var TSTYPEELEMENT_TYPES = FLIPPED_ALIAS_KEYS$3["TSTypeElement"]; + var TSTYPE_TYPES = FLIPPED_ALIAS_KEYS$3["TSType"]; + var TSBASETYPE_TYPES = FLIPPED_ALIAS_KEYS$3["TSBaseType"]; + var MODULEDECLARATION_TYPES = IMPORTOREXPORTDECLARATION_TYPES; + + function toBlock(node, parent) { + if (isBlockStatement$2(node)) { + return node; + } + var blockNodes = []; + if (isEmptyStatement(node)) { + blockNodes = []; + } else { + if (!isStatement$8(node)) { + if (isFunction$5(parent)) { + node = returnStatement$3(node); + } else { + node = expressionStatement$a(node); + } + } + blockNodes = [node]; + } + return blockStatement$6(blockNodes); + } + + function ensureBlock$1(node, key) { + if (key === void 0) { + key = "body"; + } + var result = toBlock(node[key], node); + node[key] = result; + return result; + } + + function toIdentifier$1(input) { + input = input + ""; + var name = ""; + for (var _iterator = _createForOfIteratorHelperLoose(input), _step; !(_step = _iterator()).done;) { + var c = _step.value; + name += isIdentifierChar(c.codePointAt(0)) ? c : "-"; + } + name = name.replace(/^[-0-9]+/, ""); + name = name.replace(/[-\s]+(.)?/g, function (match, c) { + return c ? c.toUpperCase() : ""; + }); + if (!isValidIdentifier$1(name)) { + name = "_" + name; + } + return name || "_"; + } + + function toBindingIdentifierName$1(name) { + name = toIdentifier$1(name); + if (name === "eval" || name === "arguments") name = "_" + name; + return name; + } + + function toComputedKey$2(node, key) { + if (key === void 0) { + key = node.key || node.property; + } + if (!node.computed && isIdentifier$j(key)) key = stringLiteral$8(key.name); + return key; + } + + function toExpression$1(node) { + if (isExpressionStatement$3(node)) { + node = node.expression; + } + if (isExpression$4(node)) { + return node; + } + if (isClass$2(node)) { + node.type = "ClassExpression"; + } else if (isFunction$5(node)) { + node.type = "FunctionExpression"; + } + if (!isExpression$4(node)) { + throw new Error("cannot turn " + node.type + " to an expression"); + } + return node; + } + + function traverseFast$2(node, enter, opts) { + if (!node) return; + var keys = VISITOR_KEYS$5[node.type]; + if (!keys) return; + opts = opts || {}; + enter(node, opts); + for (var _iterator = _createForOfIteratorHelperLoose(keys), _step; !(_step = _iterator()).done;) { + var key = _step.value; + var subNode = node[key]; + if (Array.isArray(subNode)) { + for (var _iterator2 = _createForOfIteratorHelperLoose(subNode), _step2; !(_step2 = _iterator2()).done;) { + var _node = _step2.value; + traverseFast$2(_node, enter, opts); + } + } else { + traverseFast$2(subNode, enter, opts); + } + } + } + + var CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; + var CLEAR_KEYS_PLUS_COMMENTS = [].concat(_toConsumableArray(COMMENT_KEYS), ["comments"], CLEAR_KEYS); + function removeProperties$1(node, opts) { + if (opts === void 0) { + opts = {}; + } + var map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; + for (var _iterator = _createForOfIteratorHelperLoose(map), _step; !(_step = _iterator()).done;) { + var _key = _step.value; + if (node[_key] != null) node[_key] = undefined; + } + for (var _i = 0, _Object$keys = Object.keys(node); _i < _Object$keys.length; _i++) { + var key = _Object$keys[_i]; + if (key[0] === "_" && node[key] != null) node[key] = undefined; + } + var symbols = Object.getOwnPropertySymbols(node); + for (var _iterator2 = _createForOfIteratorHelperLoose(symbols), _step2; !(_step2 = _iterator2()).done;) { + var sym = _step2.value; + node[sym] = null; + } + } + + function removePropertiesDeep$1(tree, opts) { + traverseFast$2(tree, removeProperties$1, opts); + return tree; + } + + function toKeyAlias(node, key) { + if (key === void 0) { + key = node.key; + } + var alias; + if (node.kind === "method") { + return toKeyAlias.increment() + ""; + } else if (isIdentifier$j(key)) { + alias = key.name; + } else if (isStringLiteral$6(key)) { + alias = JSON.stringify(key.value); + } else { + alias = JSON.stringify(removePropertiesDeep$1(cloneNode$j(key))); + } + if (node.computed) { + alias = "[" + alias + "]"; + } + if (node["static"]) { + alias = "static:" + alias; + } + return alias; + } + toKeyAlias.uid = 0; + toKeyAlias.increment = function () { + if (toKeyAlias.uid >= Number.MAX_SAFE_INTEGER) { + return toKeyAlias.uid = 0; + } else { + return toKeyAlias.uid++; + } + }; + + function getBindingIdentifiers$2(node, duplicates, outerOnly) { + var search = [].concat(node); + var ids = Object.create(null); + while (search.length) { + var id = search.shift(); + if (!id) continue; + var keys = getBindingIdentifiers$2.keys[id.type]; + if (isIdentifier$j(id)) { + if (duplicates) { + var _ids = ids[id.name] = ids[id.name] || []; + _ids.push(id); + } else { + ids[id.name] = id; + } + continue; + } + if (isExportDeclaration$3(id) && !isExportAllDeclaration$1(id)) { + if (isDeclaration$1(id.declaration)) { + search.push(id.declaration); + } + continue; + } + if (outerOnly) { + if (isFunctionDeclaration$2(id)) { + search.push(id.id); + continue; + } + if (isFunctionExpression$1(id)) { + continue; + } + } + if (keys) { + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var nodes = id[key]; + if (nodes) { + Array.isArray(nodes) ? search.push.apply(search, _toConsumableArray(nodes)) : search.push(nodes); + } + } + } + } + return ids; + } + getBindingIdentifiers$2.keys = { + DeclareClass: ["id"], + DeclareFunction: ["id"], + DeclareModule: ["id"], + DeclareVariable: ["id"], + DeclareInterface: ["id"], + DeclareTypeAlias: ["id"], + DeclareOpaqueType: ["id"], + InterfaceDeclaration: ["id"], + TypeAlias: ["id"], + OpaqueType: ["id"], + CatchClause: ["param"], + LabeledStatement: ["label"], + UnaryExpression: ["argument"], + AssignmentExpression: ["left"], + ImportSpecifier: ["local"], + ImportNamespaceSpecifier: ["local"], + ImportDefaultSpecifier: ["local"], + ImportDeclaration: ["specifiers"], + ExportSpecifier: ["exported"], + ExportNamespaceSpecifier: ["exported"], + ExportDefaultSpecifier: ["exported"], + FunctionDeclaration: ["id", "params"], + FunctionExpression: ["id", "params"], + ArrowFunctionExpression: ["params"], + ObjectMethod: ["params"], + ClassMethod: ["params"], + ClassPrivateMethod: ["params"], + ForInStatement: ["left"], + ForOfStatement: ["left"], + ClassDeclaration: ["id"], + ClassExpression: ["id"], + RestElement: ["argument"], + UpdateExpression: ["argument"], + ObjectProperty: ["value"], + AssignmentPattern: ["left"], + ArrayPattern: ["elements"], + ObjectPattern: ["properties"], + VariableDeclaration: ["declarations"], + VariableDeclarator: ["id"] + }; + + function gatherSequenceExpressions(nodes, scope, declars) { + var exprs = []; + var ensureLastUndefined = true; + for (var _iterator = _createForOfIteratorHelperLoose(nodes), _step; !(_step = _iterator()).done;) { + var node = _step.value; + if (!isEmptyStatement(node)) { + ensureLastUndefined = false; + } + if (isExpression$4(node)) { + exprs.push(node); + } else if (isExpressionStatement$3(node)) { + exprs.push(node.expression); + } else if (isVariableDeclaration$3(node)) { + if (node.kind !== "var") return; + for (var _iterator2 = _createForOfIteratorHelperLoose(node.declarations), _step2; !(_step2 = _iterator2()).done;) { + var declar = _step2.value; + var bindings = getBindingIdentifiers$2(declar); + for (var _i = 0, _Object$keys = Object.keys(bindings); _i < _Object$keys.length; _i++) { + var key = _Object$keys[_i]; + declars.push({ + kind: node.kind, + id: cloneNode$j(bindings[key]) + }); + } + if (declar.init) { + exprs.push(assignmentExpression$d("=", declar.id, declar.init)); + } + } + ensureLastUndefined = true; + } else if (isIfStatement$2(node)) { + var consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode(); + var alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode(); + if (!consequent || !alternate) return; + exprs.push(conditionalExpression$4(node.test, consequent, alternate)); + } else if (isBlockStatement$2(node)) { + var body = gatherSequenceExpressions(node.body, scope, declars); + if (!body) return; + exprs.push(body); + } else if (isEmptyStatement(node)) { + if (nodes.indexOf(node) === 0) { + ensureLastUndefined = true; + } + } else { + return; + } + } + if (ensureLastUndefined) { + exprs.push(scope.buildUndefinedNode()); + } + if (exprs.length === 1) { + return exprs[0]; + } else { + return sequenceExpression$7(exprs); + } + } + + function toSequenceExpression$1(nodes, scope) { + if (!(nodes != null && nodes.length)) return; + var declars = []; + var result = gatherSequenceExpressions(nodes, scope, declars); + if (!result) return; + for (var _i = 0, _declars = declars; _i < _declars.length; _i++) { + var declar = _declars[_i]; + scope.push(declar); + } + return result; + } + + function toStatement(node, ignore) { + if (isStatement$8(node)) { + return node; + } + var mustHaveId = false; + var newType; + if (isClass$2(node)) { + mustHaveId = true; + newType = "ClassDeclaration"; + } else if (isFunction$5(node)) { + mustHaveId = true; + newType = "FunctionDeclaration"; + } else if (isAssignmentExpression$4(node)) { + return expressionStatement$a(node); + } + if (mustHaveId && !node.id) { + newType = false; + } + if (!newType) { + if (ignore) { + return false; + } else { + throw new Error("cannot turn " + node.type + " to a statement"); + } + } + node.type = newType; + return node; + } + + var objectToString$1 = Function.call.bind(Object.prototype.toString); + function isRegExp$1(value) { + return objectToString$1(value) === "[object RegExp]"; + } + function isPlainObject(value) { + if (typeof value !== "object" || value === null || Object.prototype.toString.call(value) !== "[object Object]") { + return false; + } + var proto = Object.getPrototypeOf(value); + return proto === null || Object.getPrototypeOf(proto) === null; + } + function valueToNode$1(value) { + if (value === undefined) { + return identifier$i("undefined"); + } + if (value === true || value === false) { + return booleanLiteral$4(value); + } + if (value === null) { + return nullLiteral$2(); + } + if (typeof value === "string") { + return stringLiteral$8(value); + } + if (typeof value === "number") { + var result; + if (Number.isFinite(value)) { + result = numericLiteral$8(Math.abs(value)); + } else { + var numerator; + if (Number.isNaN(value)) { + numerator = numericLiteral$8(0); + } else { + numerator = numericLiteral$8(1); + } + result = binaryExpression$5("/", numerator, numericLiteral$8(0)); + } + if (value < 0 || Object.is(value, -0)) { + result = unaryExpression$7("-", result); + } + return result; + } + if (isRegExp$1(value)) { + var pattern = value.source; + var flags = value.toString().match(/\/([a-z]+|)$/)[1]; + return regExpLiteral(pattern, flags); + } + if (Array.isArray(value)) { + return arrayExpression$1(value.map(valueToNode$1)); + } + if (isPlainObject(value)) { + var props = []; + for (var _i = 0, _Object$keys = Object.keys(value); _i < _Object$keys.length; _i++) { + var key = _Object$keys[_i]; + var nodeKey = void 0; + if (isValidIdentifier$1(key)) { + nodeKey = identifier$i(key); + } else { + nodeKey = stringLiteral$8(key); + } + props.push(objectProperty$1(nodeKey, valueToNode$1(value[key]))); + } + return objectExpression$3(props); + } + throw new Error("don't know how to turn this value into a node"); + } + + function appendToMemberExpression(member, append, computed) { + if (computed === void 0) { + computed = false; + } + member.object = memberExpression$c(member.object, member.property, member.computed); + member.property = append; + member.computed = !!computed; + return member; + } + + function inherits$3(child, parent) { + if (!child || !parent) return child; + for (var _iterator = _createForOfIteratorHelperLoose(INHERIT_KEYS.optional), _step; !(_step = _iterator()).done;) { + var _key = _step.value; + if (child[_key] == null) { + child[_key] = parent[_key]; + } + } + for (var _i = 0, _Object$keys = Object.keys(parent); _i < _Object$keys.length; _i++) { + var key = _Object$keys[_i]; + if (key[0] === "_" && key !== "__clone") { + child[key] = parent[key]; + } + } + for (var _iterator2 = _createForOfIteratorHelperLoose(INHERIT_KEYS.force), _step2; !(_step2 = _iterator2()).done;) { + var _key2 = _step2.value; + child[_key2] = parent[_key2]; + } + inheritsComments$1(child, parent); + return child; + } + + function prependToMemberExpression(member, prepend) { + if (isSuper$3(member.object)) { + throw new Error("Cannot prepend node to super property access (`super.foo`)."); + } + member.object = memberExpression$c(prepend, member.object); + return member; + } + + function getOuterBindingIdentifiers$2(node, duplicates) { + return getBindingIdentifiers$2(node, duplicates, true); + } + + function traverse$2(node, handlers, state) { + if (typeof handlers === "function") { + handlers = { + enter: handlers + }; + } + var _handlers = handlers, + enter = _handlers.enter, + exit = _handlers.exit; + traverseSimpleImpl(node, enter, exit, state, []); + } + function traverseSimpleImpl(node, enter, exit, state, ancestors) { + var keys = VISITOR_KEYS$5[node.type]; + if (!keys) return; + if (enter) enter(node, ancestors, state); + for (var _iterator = _createForOfIteratorHelperLoose(keys), _step; !(_step = _iterator()).done;) { + var key = _step.value; + var subNode = node[key]; + if (Array.isArray(subNode)) { + for (var i = 0; i < subNode.length; i++) { + var child = subNode[i]; + if (!child) continue; + ancestors.push({ + node: node, + key: key, + index: i + }); + traverseSimpleImpl(child, enter, exit, state, ancestors); + ancestors.pop(); + } + } else if (subNode) { + ancestors.push({ + node: node, + key: key + }); + traverseSimpleImpl(subNode, enter, exit, state, ancestors); + ancestors.pop(); + } + } + if (exit) exit(node, ancestors, state); + } + + function isBinding$1(node, parent, grandparent) { + if (grandparent && node.type === "Identifier" && parent.type === "ObjectProperty" && grandparent.type === "ObjectExpression") { + return false; + } + var keys = getBindingIdentifiers$2.keys[parent.type]; + if (keys) { + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = parent[key]; + if (Array.isArray(val)) { + if (val.indexOf(node) >= 0) return true; + } else { + if (val === node) return true; + } + } + } + return false; + } + + function isLet(node) { + return isVariableDeclaration$3(node) && (node.kind !== "var" || node[BLOCK_SCOPED_SYMBOL]); + } + + function isBlockScoped$2(node) { + return isFunctionDeclaration$2(node) || isClassDeclaration$2(node) || isLet(node); + } + + function isImmutable(node) { + if (isType$2(node.type, "Immutable")) return true; + if (isIdentifier$j(node)) { + if (node.name === "undefined") { + return true; + } else { + return false; + } + } + return false; + } + + function isNodesEquivalent(a, b) { + if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) { + return a === b; + } + if (a.type !== b.type) { + return false; + } + var fields = Object.keys(NODE_FIELDS[a.type] || a.type); + var visitorKeys = VISITOR_KEYS$5[a.type]; + for (var _i = 0, _fields = fields; _i < _fields.length; _i++) { + var field = _fields[_i]; + var val_a = a[field]; + var val_b = b[field]; + if (typeof val_a !== typeof val_b) { + return false; + } + if (val_a == null && val_b == null) { + continue; + } else if (val_a == null || val_b == null) { + return false; + } + if (Array.isArray(val_a)) { + if (!Array.isArray(val_b)) { + return false; + } + if (val_a.length !== val_b.length) { + return false; + } + for (var i = 0; i < val_a.length; i++) { + if (!isNodesEquivalent(val_a[i], val_b[i])) { + return false; + } + } + continue; + } + if (typeof val_a === "object" && !(visitorKeys != null && visitorKeys.includes(field))) { + for (var _i2 = 0, _Object$keys = Object.keys(val_a); _i2 < _Object$keys.length; _i2++) { + var key = _Object$keys[_i2]; + if (val_a[key] !== val_b[key]) { + return false; + } + } + continue; + } + if (!isNodesEquivalent(val_a, val_b)) { + return false; + } + } + return true; + } + + function isReferenced$2(node, parent, grandparent) { + switch (parent.type) { + case "MemberExpression": + case "OptionalMemberExpression": + if (parent.property === node) { + return !!parent.computed; + } + return parent.object === node; + case "JSXMemberExpression": + return parent.object === node; + case "VariableDeclarator": + return parent.init === node; + case "ArrowFunctionExpression": + return parent.body === node; + case "PrivateName": + return false; + case "ClassMethod": + case "ClassPrivateMethod": + case "ObjectMethod": + if (parent.key === node) { + return !!parent.computed; + } + return false; + case "ObjectProperty": + if (parent.key === node) { + return !!parent.computed; + } + return !grandparent || grandparent.type !== "ObjectPattern"; + case "ClassProperty": + case "ClassAccessorProperty": + if (parent.key === node) { + return !!parent.computed; + } + return true; + case "ClassPrivateProperty": + return parent.key !== node; + case "ClassDeclaration": + case "ClassExpression": + return parent.superClass === node; + case "AssignmentExpression": + return parent.right === node; + case "AssignmentPattern": + return parent.right === node; + case "LabeledStatement": + return false; + case "CatchClause": + return false; + case "RestElement": + return false; + case "BreakStatement": + case "ContinueStatement": + return false; + case "FunctionDeclaration": + case "FunctionExpression": + return false; + case "ExportNamespaceSpecifier": + case "ExportDefaultSpecifier": + return false; + case "ExportSpecifier": + if (grandparent != null && grandparent.source) { + return false; + } + return parent.local === node; + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "ImportSpecifier": + return false; + case "ImportAttribute": + return false; + case "JSXAttribute": + return false; + case "ObjectPattern": + case "ArrayPattern": + return false; + case "MetaProperty": + return false; + case "ObjectTypeProperty": + return parent.key !== node; + case "TSEnumMember": + return parent.id !== node; + case "TSPropertySignature": + if (parent.key === node) { + return !!parent.computed; + } + return true; + } + return true; + } + + function isScope$1(node, parent) { + if (isBlockStatement$2(node) && (isFunction$5(parent) || isCatchClause(parent))) { + return false; + } + if (isPattern(node) && (isFunction$5(parent) || isCatchClause(parent))) { + return true; + } + return isScopable(node); + } + + function isSpecifierDefault(specifier) { + return isImportDefaultSpecifier$1(specifier) || isIdentifier$j(specifier.imported || specifier.exported, { + name: "default" + }); + } + + var RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]); + function isValidES3Identifier(name) { + return isValidIdentifier$1(name) && !RESERVED_WORDS_ES3_ONLY.has(name); + } + + function isVar$1(node) { + return isVariableDeclaration$3(node, { + kind: "var" + }) && !node[BLOCK_SCOPED_SYMBOL]; + } + + var react$3 = { + isReactComponent: isReactComponent, + isCompatTag: isCompatTag$1, + buildChildren: buildChildren + }; + + var t$8 = /*#__PURE__*/Object.freeze({ + __proto__: null, + react: react$3, + assertNode: assertNode, + createTypeAnnotationBasedOnTypeof: createTypeAnnotationBasedOnTypeof$1, + createUnionTypeAnnotation: createFlowUnionType$1, + createFlowUnionType: createFlowUnionType$1, + createTSUnionType: createTSUnionType$1, + cloneNode: cloneNode$j, + clone: clone, + cloneDeep: cloneDeep$1, + cloneDeepWithoutLoc: cloneDeepWithoutLoc, + cloneWithoutLoc: cloneWithoutLoc, + addComment: addComment$2, + addComments: addComments$1, + inheritInnerComments: inheritInnerComments, + inheritLeadingComments: inheritLeadingComments$1, + inheritsComments: inheritsComments$1, + inheritTrailingComments: inheritTrailingComments$1, + removeComments: removeComments$1, + ensureBlock: ensureBlock$1, + toBindingIdentifierName: toBindingIdentifierName$1, + toBlock: toBlock, + toComputedKey: toComputedKey$2, + toExpression: toExpression$1, + toIdentifier: toIdentifier$1, + toKeyAlias: toKeyAlias, + toSequenceExpression: toSequenceExpression$1, + toStatement: toStatement, + valueToNode: valueToNode$1, + appendToMemberExpression: appendToMemberExpression, + inherits: inherits$3, + prependToMemberExpression: prependToMemberExpression, + removeProperties: removeProperties$1, + removePropertiesDeep: removePropertiesDeep$1, + removeTypeDuplicates: removeTypeDuplicates$1, + getBindingIdentifiers: getBindingIdentifiers$2, + getOuterBindingIdentifiers: getOuterBindingIdentifiers$2, + traverse: traverse$2, + traverseFast: traverseFast$2, + shallowEqual: shallowEqual$2, + is: is$1, + isBinding: isBinding$1, + isBlockScoped: isBlockScoped$2, + isImmutable: isImmutable, + isLet: isLet, + isNode: isNode, + isNodesEquivalent: isNodesEquivalent, + isPlaceholderType: isPlaceholderType, + isReferenced: isReferenced$2, + isScope: isScope$1, + isSpecifierDefault: isSpecifierDefault, + isType: isType$2, + isValidES3Identifier: isValidES3Identifier, + isValidIdentifier: isValidIdentifier$1, + isVar: isVar$1, + matchesPattern: matchesPattern$2, + validate: validate$5, + buildMatchMemberExpression: buildMatchMemberExpression$1, + __internal__deprecationWarning: deprecationWarning$1, + assertArrayExpression: assertArrayExpression, + assertAssignmentExpression: assertAssignmentExpression, + assertBinaryExpression: assertBinaryExpression, + assertInterpreterDirective: assertInterpreterDirective, + assertDirective: assertDirective, + assertDirectiveLiteral: assertDirectiveLiteral, + assertBlockStatement: assertBlockStatement, + assertBreakStatement: assertBreakStatement, + assertCallExpression: assertCallExpression, + assertCatchClause: assertCatchClause, + assertConditionalExpression: assertConditionalExpression, + assertContinueStatement: assertContinueStatement, + assertDebuggerStatement: assertDebuggerStatement, + assertDoWhileStatement: assertDoWhileStatement, + assertEmptyStatement: assertEmptyStatement, + assertExpressionStatement: assertExpressionStatement$1, + assertFile: assertFile, + assertForInStatement: assertForInStatement, + assertForStatement: assertForStatement, + assertFunctionDeclaration: assertFunctionDeclaration, + assertFunctionExpression: assertFunctionExpression, + assertIdentifier: assertIdentifier, + assertIfStatement: assertIfStatement, + assertLabeledStatement: assertLabeledStatement, + assertStringLiteral: assertStringLiteral, + assertNumericLiteral: assertNumericLiteral, + assertNullLiteral: assertNullLiteral, + assertBooleanLiteral: assertBooleanLiteral, + assertRegExpLiteral: assertRegExpLiteral, + assertLogicalExpression: assertLogicalExpression, + assertMemberExpression: assertMemberExpression, + assertNewExpression: assertNewExpression, + assertProgram: assertProgram, + assertObjectExpression: assertObjectExpression, + assertObjectMethod: assertObjectMethod, + assertObjectProperty: assertObjectProperty, + assertRestElement: assertRestElement, + assertReturnStatement: assertReturnStatement, + assertSequenceExpression: assertSequenceExpression, + assertParenthesizedExpression: assertParenthesizedExpression, + assertSwitchCase: assertSwitchCase, + assertSwitchStatement: assertSwitchStatement, + assertThisExpression: assertThisExpression, + assertThrowStatement: assertThrowStatement, + assertTryStatement: assertTryStatement, + assertUnaryExpression: assertUnaryExpression, + assertUpdateExpression: assertUpdateExpression, + assertVariableDeclaration: assertVariableDeclaration, + assertVariableDeclarator: assertVariableDeclarator, + assertWhileStatement: assertWhileStatement, + assertWithStatement: assertWithStatement, + assertAssignmentPattern: assertAssignmentPattern, + assertArrayPattern: assertArrayPattern, + assertArrowFunctionExpression: assertArrowFunctionExpression, + assertClassBody: assertClassBody, + assertClassExpression: assertClassExpression, + assertClassDeclaration: assertClassDeclaration, + assertExportAllDeclaration: assertExportAllDeclaration, + assertExportDefaultDeclaration: assertExportDefaultDeclaration, + assertExportNamedDeclaration: assertExportNamedDeclaration, + assertExportSpecifier: assertExportSpecifier$1, + assertForOfStatement: assertForOfStatement, + assertImportDeclaration: assertImportDeclaration, + assertImportDefaultSpecifier: assertImportDefaultSpecifier, + assertImportNamespaceSpecifier: assertImportNamespaceSpecifier, + assertImportSpecifier: assertImportSpecifier, + assertMetaProperty: assertMetaProperty, + assertClassMethod: assertClassMethod, + assertObjectPattern: assertObjectPattern, + assertSpreadElement: assertSpreadElement, + assertSuper: assertSuper, + assertTaggedTemplateExpression: assertTaggedTemplateExpression, + assertTemplateElement: assertTemplateElement, + assertTemplateLiteral: assertTemplateLiteral, + assertYieldExpression: assertYieldExpression, + assertAwaitExpression: assertAwaitExpression, + assertImport: assertImport, + assertBigIntLiteral: assertBigIntLiteral, + assertExportNamespaceSpecifier: assertExportNamespaceSpecifier, + assertOptionalMemberExpression: assertOptionalMemberExpression, + assertOptionalCallExpression: assertOptionalCallExpression, + assertClassProperty: assertClassProperty, + assertClassAccessorProperty: assertClassAccessorProperty, + assertClassPrivateProperty: assertClassPrivateProperty, + assertClassPrivateMethod: assertClassPrivateMethod, + assertPrivateName: assertPrivateName, + assertStaticBlock: assertStaticBlock, + assertAnyTypeAnnotation: assertAnyTypeAnnotation, + assertArrayTypeAnnotation: assertArrayTypeAnnotation, + assertBooleanTypeAnnotation: assertBooleanTypeAnnotation, + assertBooleanLiteralTypeAnnotation: assertBooleanLiteralTypeAnnotation, + assertNullLiteralTypeAnnotation: assertNullLiteralTypeAnnotation, + assertClassImplements: assertClassImplements, + assertDeclareClass: assertDeclareClass, + assertDeclareFunction: assertDeclareFunction, + assertDeclareInterface: assertDeclareInterface, + assertDeclareModule: assertDeclareModule, + assertDeclareModuleExports: assertDeclareModuleExports, + assertDeclareTypeAlias: assertDeclareTypeAlias, + assertDeclareOpaqueType: assertDeclareOpaqueType, + assertDeclareVariable: assertDeclareVariable, + assertDeclareExportDeclaration: assertDeclareExportDeclaration, + assertDeclareExportAllDeclaration: assertDeclareExportAllDeclaration, + assertDeclaredPredicate: assertDeclaredPredicate, + assertExistsTypeAnnotation: assertExistsTypeAnnotation, + assertFunctionTypeAnnotation: assertFunctionTypeAnnotation, + assertFunctionTypeParam: assertFunctionTypeParam, + assertGenericTypeAnnotation: assertGenericTypeAnnotation, + assertInferredPredicate: assertInferredPredicate, + assertInterfaceExtends: assertInterfaceExtends, + assertInterfaceDeclaration: assertInterfaceDeclaration, + assertInterfaceTypeAnnotation: assertInterfaceTypeAnnotation, + assertIntersectionTypeAnnotation: assertIntersectionTypeAnnotation, + assertMixedTypeAnnotation: assertMixedTypeAnnotation, + assertEmptyTypeAnnotation: assertEmptyTypeAnnotation, + assertNullableTypeAnnotation: assertNullableTypeAnnotation, + assertNumberLiteralTypeAnnotation: assertNumberLiteralTypeAnnotation, + assertNumberTypeAnnotation: assertNumberTypeAnnotation, + assertObjectTypeAnnotation: assertObjectTypeAnnotation, + assertObjectTypeInternalSlot: assertObjectTypeInternalSlot, + assertObjectTypeCallProperty: assertObjectTypeCallProperty, + assertObjectTypeIndexer: assertObjectTypeIndexer, + assertObjectTypeProperty: assertObjectTypeProperty, + assertObjectTypeSpreadProperty: assertObjectTypeSpreadProperty, + assertOpaqueType: assertOpaqueType, + assertQualifiedTypeIdentifier: assertQualifiedTypeIdentifier, + assertStringLiteralTypeAnnotation: assertStringLiteralTypeAnnotation, + assertStringTypeAnnotation: assertStringTypeAnnotation, + assertSymbolTypeAnnotation: assertSymbolTypeAnnotation, + assertThisTypeAnnotation: assertThisTypeAnnotation, + assertTupleTypeAnnotation: assertTupleTypeAnnotation, + assertTypeofTypeAnnotation: assertTypeofTypeAnnotation, + assertTypeAlias: assertTypeAlias, + assertTypeAnnotation: assertTypeAnnotation, + assertTypeCastExpression: assertTypeCastExpression, + assertTypeParameter: assertTypeParameter, + assertTypeParameterDeclaration: assertTypeParameterDeclaration, + assertTypeParameterInstantiation: assertTypeParameterInstantiation, + assertUnionTypeAnnotation: assertUnionTypeAnnotation, + assertVariance: assertVariance, + assertVoidTypeAnnotation: assertVoidTypeAnnotation, + assertEnumDeclaration: assertEnumDeclaration, + assertEnumBooleanBody: assertEnumBooleanBody, + assertEnumNumberBody: assertEnumNumberBody, + assertEnumStringBody: assertEnumStringBody, + assertEnumSymbolBody: assertEnumSymbolBody, + assertEnumBooleanMember: assertEnumBooleanMember, + assertEnumNumberMember: assertEnumNumberMember, + assertEnumStringMember: assertEnumStringMember, + assertEnumDefaultedMember: assertEnumDefaultedMember, + assertIndexedAccessType: assertIndexedAccessType, + assertOptionalIndexedAccessType: assertOptionalIndexedAccessType, + assertJSXAttribute: assertJSXAttribute, + assertJSXClosingElement: assertJSXClosingElement, + assertJSXElement: assertJSXElement, + assertJSXEmptyExpression: assertJSXEmptyExpression, + assertJSXExpressionContainer: assertJSXExpressionContainer, + assertJSXSpreadChild: assertJSXSpreadChild, + assertJSXIdentifier: assertJSXIdentifier, + assertJSXMemberExpression: assertJSXMemberExpression, + assertJSXNamespacedName: assertJSXNamespacedName, + assertJSXOpeningElement: assertJSXOpeningElement, + assertJSXSpreadAttribute: assertJSXSpreadAttribute, + assertJSXText: assertJSXText, + assertJSXFragment: assertJSXFragment, + assertJSXOpeningFragment: assertJSXOpeningFragment, + assertJSXClosingFragment: assertJSXClosingFragment, + assertNoop: assertNoop, + assertPlaceholder: assertPlaceholder, + assertV8IntrinsicIdentifier: assertV8IntrinsicIdentifier, + assertArgumentPlaceholder: assertArgumentPlaceholder, + assertBindExpression: assertBindExpression, + assertImportAttribute: assertImportAttribute, + assertDecorator: assertDecorator, + assertDoExpression: assertDoExpression, + assertExportDefaultSpecifier: assertExportDefaultSpecifier, + assertRecordExpression: assertRecordExpression, + assertTupleExpression: assertTupleExpression, + assertDecimalLiteral: assertDecimalLiteral, + assertModuleExpression: assertModuleExpression, + assertTopicReference: assertTopicReference, + assertPipelineTopicExpression: assertPipelineTopicExpression, + assertPipelineBareFunction: assertPipelineBareFunction, + assertPipelinePrimaryTopicReference: assertPipelinePrimaryTopicReference, + assertTSParameterProperty: assertTSParameterProperty, + assertTSDeclareFunction: assertTSDeclareFunction, + assertTSDeclareMethod: assertTSDeclareMethod, + assertTSQualifiedName: assertTSQualifiedName, + assertTSCallSignatureDeclaration: assertTSCallSignatureDeclaration, + assertTSConstructSignatureDeclaration: assertTSConstructSignatureDeclaration, + assertTSPropertySignature: assertTSPropertySignature, + assertTSMethodSignature: assertTSMethodSignature, + assertTSIndexSignature: assertTSIndexSignature, + assertTSAnyKeyword: assertTSAnyKeyword, + assertTSBooleanKeyword: assertTSBooleanKeyword, + assertTSBigIntKeyword: assertTSBigIntKeyword, + assertTSIntrinsicKeyword: assertTSIntrinsicKeyword, + assertTSNeverKeyword: assertTSNeverKeyword, + assertTSNullKeyword: assertTSNullKeyword, + assertTSNumberKeyword: assertTSNumberKeyword, + assertTSObjectKeyword: assertTSObjectKeyword, + assertTSStringKeyword: assertTSStringKeyword, + assertTSSymbolKeyword: assertTSSymbolKeyword, + assertTSUndefinedKeyword: assertTSUndefinedKeyword, + assertTSUnknownKeyword: assertTSUnknownKeyword, + assertTSVoidKeyword: assertTSVoidKeyword, + assertTSThisType: assertTSThisType, + assertTSFunctionType: assertTSFunctionType, + assertTSConstructorType: assertTSConstructorType, + assertTSTypeReference: assertTSTypeReference, + assertTSTypePredicate: assertTSTypePredicate, + assertTSTypeQuery: assertTSTypeQuery, + assertTSTypeLiteral: assertTSTypeLiteral, + assertTSArrayType: assertTSArrayType, + assertTSTupleType: assertTSTupleType, + assertTSOptionalType: assertTSOptionalType, + assertTSRestType: assertTSRestType, + assertTSNamedTupleMember: assertTSNamedTupleMember, + assertTSUnionType: assertTSUnionType, + assertTSIntersectionType: assertTSIntersectionType, + assertTSConditionalType: assertTSConditionalType, + assertTSInferType: assertTSInferType, + assertTSParenthesizedType: assertTSParenthesizedType, + assertTSTypeOperator: assertTSTypeOperator, + assertTSIndexedAccessType: assertTSIndexedAccessType, + assertTSMappedType: assertTSMappedType, + assertTSLiteralType: assertTSLiteralType, + assertTSExpressionWithTypeArguments: assertTSExpressionWithTypeArguments, + assertTSInterfaceDeclaration: assertTSInterfaceDeclaration, + assertTSInterfaceBody: assertTSInterfaceBody, + assertTSTypeAliasDeclaration: assertTSTypeAliasDeclaration, + assertTSInstantiationExpression: assertTSInstantiationExpression, + assertTSAsExpression: assertTSAsExpression, + assertTSSatisfiesExpression: assertTSSatisfiesExpression, + assertTSTypeAssertion: assertTSTypeAssertion, + assertTSEnumDeclaration: assertTSEnumDeclaration, + assertTSEnumMember: assertTSEnumMember, + assertTSModuleDeclaration: assertTSModuleDeclaration, + assertTSModuleBlock: assertTSModuleBlock, + assertTSImportType: assertTSImportType, + assertTSImportEqualsDeclaration: assertTSImportEqualsDeclaration, + assertTSExternalModuleReference: assertTSExternalModuleReference, + assertTSNonNullExpression: assertTSNonNullExpression, + assertTSExportAssignment: assertTSExportAssignment, + assertTSNamespaceExportDeclaration: assertTSNamespaceExportDeclaration, + assertTSTypeAnnotation: assertTSTypeAnnotation, + assertTSTypeParameterInstantiation: assertTSTypeParameterInstantiation, + assertTSTypeParameterDeclaration: assertTSTypeParameterDeclaration, + assertTSTypeParameter: assertTSTypeParameter, + assertStandardized: assertStandardized, + assertExpression: assertExpression$1, + assertBinary: assertBinary, + assertScopable: assertScopable, + assertBlockParent: assertBlockParent, + assertBlock: assertBlock, + assertStatement: assertStatement, + assertTerminatorless: assertTerminatorless, + assertCompletionStatement: assertCompletionStatement, + assertConditional: assertConditional, + assertLoop: assertLoop, + assertWhile: assertWhile, + assertExpressionWrapper: assertExpressionWrapper, + assertFor: assertFor, + assertForXStatement: assertForXStatement, + assertFunction: assertFunction$1, + assertFunctionParent: assertFunctionParent, + assertPureish: assertPureish, + assertDeclaration: assertDeclaration, + assertPatternLike: assertPatternLike, + assertLVal: assertLVal, + assertTSEntityName: assertTSEntityName, + assertLiteral: assertLiteral, + assertImmutable: assertImmutable, + assertUserWhitespacable: assertUserWhitespacable, + assertMethod: assertMethod, + assertObjectMember: assertObjectMember, + assertProperty: assertProperty, + assertUnaryLike: assertUnaryLike, + assertPattern: assertPattern, + assertClass: assertClass, + assertImportOrExportDeclaration: assertImportOrExportDeclaration, + assertExportDeclaration: assertExportDeclaration, + assertModuleSpecifier: assertModuleSpecifier, + assertAccessor: assertAccessor, + assertPrivate: assertPrivate, + assertFlow: assertFlow, + assertFlowType: assertFlowType, + assertFlowBaseAnnotation: assertFlowBaseAnnotation, + assertFlowDeclaration: assertFlowDeclaration, + assertFlowPredicate: assertFlowPredicate, + assertEnumBody: assertEnumBody, + assertEnumMember: assertEnumMember, + assertJSX: assertJSX, + assertMiscellaneous: assertMiscellaneous, + assertTypeScript: assertTypeScript, + assertTSTypeElement: assertTSTypeElement, + assertTSType: assertTSType, + assertTSBaseType: assertTSBaseType, + assertNumberLiteral: assertNumberLiteral, + assertRegexLiteral: assertRegexLiteral, + assertRestProperty: assertRestProperty, + assertSpreadProperty: assertSpreadProperty, + assertModuleDeclaration: assertModuleDeclaration, + arrayExpression: arrayExpression$1, + assignmentExpression: assignmentExpression$d, + binaryExpression: binaryExpression$5, + interpreterDirective: interpreterDirective$1, + directive: directive$1, + directiveLiteral: directiveLiteral$1, + blockStatement: blockStatement$6, + breakStatement: breakStatement, + callExpression: callExpression$e, + catchClause: catchClause, + conditionalExpression: conditionalExpression$4, + continueStatement: continueStatement, + debuggerStatement: debuggerStatement, + doWhileStatement: doWhileStatement, + emptyStatement: emptyStatement$1, + expressionStatement: expressionStatement$a, + file: file$2, + forInStatement: forInStatement, + forStatement: forStatement, + functionDeclaration: functionDeclaration, + functionExpression: functionExpression$2, + identifier: identifier$i, + ifStatement: ifStatement, + labeledStatement: labeledStatement, + stringLiteral: stringLiteral$8, + numericLiteral: numericLiteral$8, + nullLiteral: nullLiteral$2, + booleanLiteral: booleanLiteral$4, + regExpLiteral: regExpLiteral, + logicalExpression: logicalExpression$3, + memberExpression: memberExpression$c, + newExpression: newExpression, + program: program$3, + objectExpression: objectExpression$3, + objectMethod: objectMethod, + objectProperty: objectProperty$1, + restElement: restElement$2, + returnStatement: returnStatement$3, + sequenceExpression: sequenceExpression$7, + parenthesizedExpression: parenthesizedExpression, + switchCase: switchCase, + switchStatement: switchStatement, + thisExpression: thisExpression$4, + throwStatement: throwStatement, + tryStatement: tryStatement, + unaryExpression: unaryExpression$7, + updateExpression: updateExpression$1, + variableDeclaration: variableDeclaration$8, + variableDeclarator: variableDeclarator$8, + whileStatement: whileStatement, + withStatement: withStatement, + assignmentPattern: assignmentPattern, + arrayPattern: arrayPattern, + arrowFunctionExpression: arrowFunctionExpression$4, + classBody: classBody, + classExpression: classExpression, + classDeclaration: classDeclaration, + exportAllDeclaration: exportAllDeclaration, + exportDefaultDeclaration: exportDefaultDeclaration, + exportNamedDeclaration: exportNamedDeclaration$2, + exportSpecifier: exportSpecifier$2, + forOfStatement: forOfStatement, + importDeclaration: importDeclaration$1, + importDefaultSpecifier: importDefaultSpecifier$1, + importNamespaceSpecifier: importNamespaceSpecifier$1, + importSpecifier: importSpecifier$1, + metaProperty: metaProperty$1, + classMethod: classMethod, + objectPattern: objectPattern$1, + spreadElement: spreadElement$2, + 'super': _super$1, + taggedTemplateExpression: taggedTemplateExpression, + templateElement: templateElement, + templateLiteral: templateLiteral, + yieldExpression: yieldExpression$2, + awaitExpression: awaitExpression$1, + 'import': _import, + bigIntLiteral: bigIntLiteral, + exportNamespaceSpecifier: exportNamespaceSpecifier, + optionalMemberExpression: optionalMemberExpression$2, + optionalCallExpression: optionalCallExpression$2, + classProperty: classProperty, + classAccessorProperty: classAccessorProperty, + classPrivateProperty: classPrivateProperty, + classPrivateMethod: classPrivateMethod, + privateName: privateName, + staticBlock: staticBlock, + anyTypeAnnotation: anyTypeAnnotation$2, + arrayTypeAnnotation: arrayTypeAnnotation$1, + booleanTypeAnnotation: booleanTypeAnnotation$1, + booleanLiteralTypeAnnotation: booleanLiteralTypeAnnotation, + nullLiteralTypeAnnotation: nullLiteralTypeAnnotation$1, + classImplements: classImplements, + declareClass: declareClass, + declareFunction: declareFunction, + declareInterface: declareInterface, + declareModule: declareModule, + declareModuleExports: declareModuleExports, + declareTypeAlias: declareTypeAlias, + declareOpaqueType: declareOpaqueType, + declareVariable: declareVariable, + declareExportDeclaration: declareExportDeclaration, + declareExportAllDeclaration: declareExportAllDeclaration, + declaredPredicate: declaredPredicate, + existsTypeAnnotation: existsTypeAnnotation, + functionTypeAnnotation: functionTypeAnnotation, + functionTypeParam: functionTypeParam, + genericTypeAnnotation: genericTypeAnnotation$1, + inferredPredicate: inferredPredicate, + interfaceExtends: interfaceExtends, + interfaceDeclaration: interfaceDeclaration, + interfaceTypeAnnotation: interfaceTypeAnnotation, + intersectionTypeAnnotation: intersectionTypeAnnotation, + mixedTypeAnnotation: mixedTypeAnnotation, + emptyTypeAnnotation: emptyTypeAnnotation, + nullableTypeAnnotation: nullableTypeAnnotation, + numberLiteralTypeAnnotation: numberLiteralTypeAnnotation, + numberTypeAnnotation: numberTypeAnnotation$2, + objectTypeAnnotation: objectTypeAnnotation, + objectTypeInternalSlot: objectTypeInternalSlot, + objectTypeCallProperty: objectTypeCallProperty, + objectTypeIndexer: objectTypeIndexer, + objectTypeProperty: objectTypeProperty, + objectTypeSpreadProperty: objectTypeSpreadProperty, + opaqueType: opaqueType, + qualifiedTypeIdentifier: qualifiedTypeIdentifier, + stringLiteralTypeAnnotation: stringLiteralTypeAnnotation, + stringTypeAnnotation: stringTypeAnnotation$2, + symbolTypeAnnotation: symbolTypeAnnotation, + thisTypeAnnotation: thisTypeAnnotation, + tupleTypeAnnotation: tupleTypeAnnotation$1, + typeofTypeAnnotation: typeofTypeAnnotation, + typeAlias: typeAlias, + typeAnnotation: typeAnnotation, + typeCastExpression: typeCastExpression, + typeParameter: typeParameter, + typeParameterDeclaration: typeParameterDeclaration, + typeParameterInstantiation: typeParameterInstantiation, + unionTypeAnnotation: unionTypeAnnotation$1, + variance: variance, + voidTypeAnnotation: voidTypeAnnotation$3, + enumDeclaration: enumDeclaration, + enumBooleanBody: enumBooleanBody, + enumNumberBody: enumNumberBody, + enumStringBody: enumStringBody, + enumSymbolBody: enumSymbolBody, + enumBooleanMember: enumBooleanMember, + enumNumberMember: enumNumberMember, + enumStringMember: enumStringMember, + enumDefaultedMember: enumDefaultedMember, + indexedAccessType: indexedAccessType, + optionalIndexedAccessType: optionalIndexedAccessType, + jsxAttribute: jsxAttribute, + jSXAttribute: jsxAttribute, + jsxClosingElement: jsxClosingElement, + jSXClosingElement: jsxClosingElement, + jsxElement: jsxElement, + jSXElement: jsxElement, + jsxEmptyExpression: jsxEmptyExpression, + jSXEmptyExpression: jsxEmptyExpression, + jsxExpressionContainer: jsxExpressionContainer$1, + jSXExpressionContainer: jsxExpressionContainer$1, + jsxSpreadChild: jsxSpreadChild, + jSXSpreadChild: jsxSpreadChild, + jsxIdentifier: jsxIdentifier$2, + jSXIdentifier: jsxIdentifier$2, + jsxMemberExpression: jsxMemberExpression$1, + jSXMemberExpression: jsxMemberExpression$1, + jsxNamespacedName: jsxNamespacedName, + jSXNamespacedName: jsxNamespacedName, + jsxOpeningElement: jsxOpeningElement, + jSXOpeningElement: jsxOpeningElement, + jsxSpreadAttribute: jsxSpreadAttribute, + jSXSpreadAttribute: jsxSpreadAttribute, + jsxText: jsxText, + jSXText: jsxText, + jsxFragment: jsxFragment, + jSXFragment: jsxFragment, + jsxOpeningFragment: jsxOpeningFragment, + jSXOpeningFragment: jsxOpeningFragment, + jsxClosingFragment: jsxClosingFragment, + jSXClosingFragment: jsxClosingFragment, + noop: noop$1, + placeholder: placeholder, + v8IntrinsicIdentifier: v8IntrinsicIdentifier, + argumentPlaceholder: argumentPlaceholder, + bindExpression: bindExpression, + importAttribute: importAttribute, + decorator: decorator, + doExpression: doExpression, + exportDefaultSpecifier: exportDefaultSpecifier, + recordExpression: recordExpression, + tupleExpression: tupleExpression, + decimalLiteral: decimalLiteral, + moduleExpression: moduleExpression, + topicReference: topicReference, + pipelineTopicExpression: pipelineTopicExpression, + pipelineBareFunction: pipelineBareFunction, + pipelinePrimaryTopicReference: pipelinePrimaryTopicReference, + tsParameterProperty: tsParameterProperty, + tSParameterProperty: tsParameterProperty, + tsDeclareFunction: tsDeclareFunction, + tSDeclareFunction: tsDeclareFunction, + tsDeclareMethod: tsDeclareMethod, + tSDeclareMethod: tsDeclareMethod, + tsQualifiedName: tsQualifiedName, + tSQualifiedName: tsQualifiedName, + tsCallSignatureDeclaration: tsCallSignatureDeclaration, + tSCallSignatureDeclaration: tsCallSignatureDeclaration, + tsConstructSignatureDeclaration: tsConstructSignatureDeclaration, + tSConstructSignatureDeclaration: tsConstructSignatureDeclaration, + tsPropertySignature: tsPropertySignature, + tSPropertySignature: tsPropertySignature, + tsMethodSignature: tsMethodSignature, + tSMethodSignature: tsMethodSignature, + tsIndexSignature: tsIndexSignature, + tSIndexSignature: tsIndexSignature, + tsAnyKeyword: tsAnyKeyword, + tSAnyKeyword: tsAnyKeyword, + tsBooleanKeyword: tsBooleanKeyword, + tSBooleanKeyword: tsBooleanKeyword, + tsBigIntKeyword: tsBigIntKeyword, + tSBigIntKeyword: tsBigIntKeyword, + tsIntrinsicKeyword: tsIntrinsicKeyword, + tSIntrinsicKeyword: tsIntrinsicKeyword, + tsNeverKeyword: tsNeverKeyword, + tSNeverKeyword: tsNeverKeyword, + tsNullKeyword: tsNullKeyword, + tSNullKeyword: tsNullKeyword, + tsNumberKeyword: tsNumberKeyword, + tSNumberKeyword: tsNumberKeyword, + tsObjectKeyword: tsObjectKeyword, + tSObjectKeyword: tsObjectKeyword, + tsStringKeyword: tsStringKeyword, + tSStringKeyword: tsStringKeyword, + tsSymbolKeyword: tsSymbolKeyword, + tSSymbolKeyword: tsSymbolKeyword, + tsUndefinedKeyword: tsUndefinedKeyword, + tSUndefinedKeyword: tsUndefinedKeyword, + tsUnknownKeyword: tsUnknownKeyword, + tSUnknownKeyword: tsUnknownKeyword, + tsVoidKeyword: tsVoidKeyword, + tSVoidKeyword: tsVoidKeyword, + tsThisType: tsThisType, + tSThisType: tsThisType, + tsFunctionType: tsFunctionType, + tSFunctionType: tsFunctionType, + tsConstructorType: tsConstructorType, + tSConstructorType: tsConstructorType, + tsTypeReference: tsTypeReference, + tSTypeReference: tsTypeReference, + tsTypePredicate: tsTypePredicate, + tSTypePredicate: tsTypePredicate, + tsTypeQuery: tsTypeQuery, + tSTypeQuery: tsTypeQuery, + tsTypeLiteral: tsTypeLiteral, + tSTypeLiteral: tsTypeLiteral, + tsArrayType: tsArrayType, + tSArrayType: tsArrayType, + tsTupleType: tsTupleType, + tSTupleType: tsTupleType, + tsOptionalType: tsOptionalType, + tSOptionalType: tsOptionalType, + tsRestType: tsRestType, + tSRestType: tsRestType, + tsNamedTupleMember: tsNamedTupleMember, + tSNamedTupleMember: tsNamedTupleMember, + tsUnionType: tsUnionType, + tSUnionType: tsUnionType, + tsIntersectionType: tsIntersectionType, + tSIntersectionType: tsIntersectionType, + tsConditionalType: tsConditionalType, + tSConditionalType: tsConditionalType, + tsInferType: tsInferType, + tSInferType: tsInferType, + tsParenthesizedType: tsParenthesizedType, + tSParenthesizedType: tsParenthesizedType, + tsTypeOperator: tsTypeOperator, + tSTypeOperator: tsTypeOperator, + tsIndexedAccessType: tsIndexedAccessType, + tSIndexedAccessType: tsIndexedAccessType, + tsMappedType: tsMappedType, + tSMappedType: tsMappedType, + tsLiteralType: tsLiteralType, + tSLiteralType: tsLiteralType, + tsExpressionWithTypeArguments: tsExpressionWithTypeArguments, + tSExpressionWithTypeArguments: tsExpressionWithTypeArguments, + tsInterfaceDeclaration: tsInterfaceDeclaration, + tSInterfaceDeclaration: tsInterfaceDeclaration, + tsInterfaceBody: tsInterfaceBody, + tSInterfaceBody: tsInterfaceBody, + tsTypeAliasDeclaration: tsTypeAliasDeclaration, + tSTypeAliasDeclaration: tsTypeAliasDeclaration, + tsInstantiationExpression: tsInstantiationExpression, + tSInstantiationExpression: tsInstantiationExpression, + tsAsExpression: tsAsExpression, + tSAsExpression: tsAsExpression, + tsSatisfiesExpression: tsSatisfiesExpression, + tSSatisfiesExpression: tsSatisfiesExpression, + tsTypeAssertion: tsTypeAssertion, + tSTypeAssertion: tsTypeAssertion, + tsEnumDeclaration: tsEnumDeclaration, + tSEnumDeclaration: tsEnumDeclaration, + tsEnumMember: tsEnumMember, + tSEnumMember: tsEnumMember, + tsModuleDeclaration: tsModuleDeclaration, + tSModuleDeclaration: tsModuleDeclaration, + tsModuleBlock: tsModuleBlock, + tSModuleBlock: tsModuleBlock, + tsImportType: tsImportType, + tSImportType: tsImportType, + tsImportEqualsDeclaration: tsImportEqualsDeclaration, + tSImportEqualsDeclaration: tsImportEqualsDeclaration, + tsExternalModuleReference: tsExternalModuleReference, + tSExternalModuleReference: tsExternalModuleReference, + tsNonNullExpression: tsNonNullExpression, + tSNonNullExpression: tsNonNullExpression, + tsExportAssignment: tsExportAssignment, + tSExportAssignment: tsExportAssignment, + tsNamespaceExportDeclaration: tsNamespaceExportDeclaration, + tSNamespaceExportDeclaration: tsNamespaceExportDeclaration, + tsTypeAnnotation: tsTypeAnnotation, + tSTypeAnnotation: tsTypeAnnotation, + tsTypeParameterInstantiation: tsTypeParameterInstantiation, + tSTypeParameterInstantiation: tsTypeParameterInstantiation, + tsTypeParameterDeclaration: tsTypeParameterDeclaration, + tSTypeParameterDeclaration: tsTypeParameterDeclaration, + tsTypeParameter: tsTypeParameter, + tSTypeParameter: tsTypeParameter, + numberLiteral: NumberLiteral, + regexLiteral: RegexLiteral, + restProperty: RestProperty, + spreadProperty: SpreadProperty, + ArrayExpression: arrayExpression$1, + AssignmentExpression: assignmentExpression$d, + BinaryExpression: binaryExpression$5, + InterpreterDirective: interpreterDirective$1, + Directive: directive$1, + DirectiveLiteral: directiveLiteral$1, + BlockStatement: blockStatement$6, + BreakStatement: breakStatement, + CallExpression: callExpression$e, + CatchClause: catchClause, + ConditionalExpression: conditionalExpression$4, + ContinueStatement: continueStatement, + DebuggerStatement: debuggerStatement, + DoWhileStatement: doWhileStatement, + EmptyStatement: emptyStatement$1, + ExpressionStatement: expressionStatement$a, + File: file$2, + ForInStatement: forInStatement, + ForStatement: forStatement, + FunctionDeclaration: functionDeclaration, + FunctionExpression: functionExpression$2, + Identifier: identifier$i, + IfStatement: ifStatement, + LabeledStatement: labeledStatement, + StringLiteral: stringLiteral$8, + NumericLiteral: numericLiteral$8, + NullLiteral: nullLiteral$2, + BooleanLiteral: booleanLiteral$4, + RegExpLiteral: regExpLiteral, + LogicalExpression: logicalExpression$3, + MemberExpression: memberExpression$c, + NewExpression: newExpression, + Program: program$3, + ObjectExpression: objectExpression$3, + ObjectMethod: objectMethod, + ObjectProperty: objectProperty$1, + RestElement: restElement$2, + ReturnStatement: returnStatement$3, + SequenceExpression: sequenceExpression$7, + ParenthesizedExpression: parenthesizedExpression, + SwitchCase: switchCase, + SwitchStatement: switchStatement, + ThisExpression: thisExpression$4, + ThrowStatement: throwStatement, + TryStatement: tryStatement, + UnaryExpression: unaryExpression$7, + UpdateExpression: updateExpression$1, + VariableDeclaration: variableDeclaration$8, + VariableDeclarator: variableDeclarator$8, + WhileStatement: whileStatement, + WithStatement: withStatement, + AssignmentPattern: assignmentPattern, + ArrayPattern: arrayPattern, + ArrowFunctionExpression: arrowFunctionExpression$4, + ClassBody: classBody, + ClassExpression: classExpression, + ClassDeclaration: classDeclaration, + ExportAllDeclaration: exportAllDeclaration, + ExportDefaultDeclaration: exportDefaultDeclaration, + ExportNamedDeclaration: exportNamedDeclaration$2, + ExportSpecifier: exportSpecifier$2, + ForOfStatement: forOfStatement, + ImportDeclaration: importDeclaration$1, + ImportDefaultSpecifier: importDefaultSpecifier$1, + ImportNamespaceSpecifier: importNamespaceSpecifier$1, + ImportSpecifier: importSpecifier$1, + MetaProperty: metaProperty$1, + ClassMethod: classMethod, + ObjectPattern: objectPattern$1, + SpreadElement: spreadElement$2, + Super: _super$1, + TaggedTemplateExpression: taggedTemplateExpression, + TemplateElement: templateElement, + TemplateLiteral: templateLiteral, + YieldExpression: yieldExpression$2, + AwaitExpression: awaitExpression$1, + Import: _import, + BigIntLiteral: bigIntLiteral, + ExportNamespaceSpecifier: exportNamespaceSpecifier, + OptionalMemberExpression: optionalMemberExpression$2, + OptionalCallExpression: optionalCallExpression$2, + ClassProperty: classProperty, + ClassAccessorProperty: classAccessorProperty, + ClassPrivateProperty: classPrivateProperty, + ClassPrivateMethod: classPrivateMethod, + PrivateName: privateName, + StaticBlock: staticBlock, + AnyTypeAnnotation: anyTypeAnnotation$2, + ArrayTypeAnnotation: arrayTypeAnnotation$1, + BooleanTypeAnnotation: booleanTypeAnnotation$1, + BooleanLiteralTypeAnnotation: booleanLiteralTypeAnnotation, + NullLiteralTypeAnnotation: nullLiteralTypeAnnotation$1, + ClassImplements: classImplements, + DeclareClass: declareClass, + DeclareFunction: declareFunction, + DeclareInterface: declareInterface, + DeclareModule: declareModule, + DeclareModuleExports: declareModuleExports, + DeclareTypeAlias: declareTypeAlias, + DeclareOpaqueType: declareOpaqueType, + DeclareVariable: declareVariable, + DeclareExportDeclaration: declareExportDeclaration, + DeclareExportAllDeclaration: declareExportAllDeclaration, + DeclaredPredicate: declaredPredicate, + ExistsTypeAnnotation: existsTypeAnnotation, + FunctionTypeAnnotation: functionTypeAnnotation, + FunctionTypeParam: functionTypeParam, + GenericTypeAnnotation: genericTypeAnnotation$1, + InferredPredicate: inferredPredicate, + InterfaceExtends: interfaceExtends, + InterfaceDeclaration: interfaceDeclaration, + InterfaceTypeAnnotation: interfaceTypeAnnotation, + IntersectionTypeAnnotation: intersectionTypeAnnotation, + MixedTypeAnnotation: mixedTypeAnnotation, + EmptyTypeAnnotation: emptyTypeAnnotation, + NullableTypeAnnotation: nullableTypeAnnotation, + NumberLiteralTypeAnnotation: numberLiteralTypeAnnotation, + NumberTypeAnnotation: numberTypeAnnotation$2, + ObjectTypeAnnotation: objectTypeAnnotation, + ObjectTypeInternalSlot: objectTypeInternalSlot, + ObjectTypeCallProperty: objectTypeCallProperty, + ObjectTypeIndexer: objectTypeIndexer, + ObjectTypeProperty: objectTypeProperty, + ObjectTypeSpreadProperty: objectTypeSpreadProperty, + OpaqueType: opaqueType, + QualifiedTypeIdentifier: qualifiedTypeIdentifier, + StringLiteralTypeAnnotation: stringLiteralTypeAnnotation, + StringTypeAnnotation: stringTypeAnnotation$2, + SymbolTypeAnnotation: symbolTypeAnnotation, + ThisTypeAnnotation: thisTypeAnnotation, + TupleTypeAnnotation: tupleTypeAnnotation$1, + TypeofTypeAnnotation: typeofTypeAnnotation, + TypeAlias: typeAlias, + TypeAnnotation: typeAnnotation, + TypeCastExpression: typeCastExpression, + TypeParameter: typeParameter, + TypeParameterDeclaration: typeParameterDeclaration, + TypeParameterInstantiation: typeParameterInstantiation, + UnionTypeAnnotation: unionTypeAnnotation$1, + Variance: variance, + VoidTypeAnnotation: voidTypeAnnotation$3, + EnumDeclaration: enumDeclaration, + EnumBooleanBody: enumBooleanBody, + EnumNumberBody: enumNumberBody, + EnumStringBody: enumStringBody, + EnumSymbolBody: enumSymbolBody, + EnumBooleanMember: enumBooleanMember, + EnumNumberMember: enumNumberMember, + EnumStringMember: enumStringMember, + EnumDefaultedMember: enumDefaultedMember, + IndexedAccessType: indexedAccessType, + OptionalIndexedAccessType: optionalIndexedAccessType, + JSXAttribute: jsxAttribute, + JSXClosingElement: jsxClosingElement, + JSXElement: jsxElement, + JSXEmptyExpression: jsxEmptyExpression, + JSXExpressionContainer: jsxExpressionContainer$1, + JSXSpreadChild: jsxSpreadChild, + JSXIdentifier: jsxIdentifier$2, + JSXMemberExpression: jsxMemberExpression$1, + JSXNamespacedName: jsxNamespacedName, + JSXOpeningElement: jsxOpeningElement, + JSXSpreadAttribute: jsxSpreadAttribute, + JSXText: jsxText, + JSXFragment: jsxFragment, + JSXOpeningFragment: jsxOpeningFragment, + JSXClosingFragment: jsxClosingFragment, + Noop: noop$1, + Placeholder: placeholder, + V8IntrinsicIdentifier: v8IntrinsicIdentifier, + ArgumentPlaceholder: argumentPlaceholder, + BindExpression: bindExpression, + ImportAttribute: importAttribute, + Decorator: decorator, + DoExpression: doExpression, + ExportDefaultSpecifier: exportDefaultSpecifier, + RecordExpression: recordExpression, + TupleExpression: tupleExpression, + DecimalLiteral: decimalLiteral, + ModuleExpression: moduleExpression, + TopicReference: topicReference, + PipelineTopicExpression: pipelineTopicExpression, + PipelineBareFunction: pipelineBareFunction, + PipelinePrimaryTopicReference: pipelinePrimaryTopicReference, + TSParameterProperty: tsParameterProperty, + TSDeclareFunction: tsDeclareFunction, + TSDeclareMethod: tsDeclareMethod, + TSQualifiedName: tsQualifiedName, + TSCallSignatureDeclaration: tsCallSignatureDeclaration, + TSConstructSignatureDeclaration: tsConstructSignatureDeclaration, + TSPropertySignature: tsPropertySignature, + TSMethodSignature: tsMethodSignature, + TSIndexSignature: tsIndexSignature, + TSAnyKeyword: tsAnyKeyword, + TSBooleanKeyword: tsBooleanKeyword, + TSBigIntKeyword: tsBigIntKeyword, + TSIntrinsicKeyword: tsIntrinsicKeyword, + TSNeverKeyword: tsNeverKeyword, + TSNullKeyword: tsNullKeyword, + TSNumberKeyword: tsNumberKeyword, + TSObjectKeyword: tsObjectKeyword, + TSStringKeyword: tsStringKeyword, + TSSymbolKeyword: tsSymbolKeyword, + TSUndefinedKeyword: tsUndefinedKeyword, + TSUnknownKeyword: tsUnknownKeyword, + TSVoidKeyword: tsVoidKeyword, + TSThisType: tsThisType, + TSFunctionType: tsFunctionType, + TSConstructorType: tsConstructorType, + TSTypeReference: tsTypeReference, + TSTypePredicate: tsTypePredicate, + TSTypeQuery: tsTypeQuery, + TSTypeLiteral: tsTypeLiteral, + TSArrayType: tsArrayType, + TSTupleType: tsTupleType, + TSOptionalType: tsOptionalType, + TSRestType: tsRestType, + TSNamedTupleMember: tsNamedTupleMember, + TSUnionType: tsUnionType, + TSIntersectionType: tsIntersectionType, + TSConditionalType: tsConditionalType, + TSInferType: tsInferType, + TSParenthesizedType: tsParenthesizedType, + TSTypeOperator: tsTypeOperator, + TSIndexedAccessType: tsIndexedAccessType, + TSMappedType: tsMappedType, + TSLiteralType: tsLiteralType, + TSExpressionWithTypeArguments: tsExpressionWithTypeArguments, + TSInterfaceDeclaration: tsInterfaceDeclaration, + TSInterfaceBody: tsInterfaceBody, + TSTypeAliasDeclaration: tsTypeAliasDeclaration, + TSInstantiationExpression: tsInstantiationExpression, + TSAsExpression: tsAsExpression, + TSSatisfiesExpression: tsSatisfiesExpression, + TSTypeAssertion: tsTypeAssertion, + TSEnumDeclaration: tsEnumDeclaration, + TSEnumMember: tsEnumMember, + TSModuleDeclaration: tsModuleDeclaration, + TSModuleBlock: tsModuleBlock, + TSImportType: tsImportType, + TSImportEqualsDeclaration: tsImportEqualsDeclaration, + TSExternalModuleReference: tsExternalModuleReference, + TSNonNullExpression: tsNonNullExpression, + TSExportAssignment: tsExportAssignment, + TSNamespaceExportDeclaration: tsNamespaceExportDeclaration, + TSTypeAnnotation: tsTypeAnnotation, + TSTypeParameterInstantiation: tsTypeParameterInstantiation, + TSTypeParameterDeclaration: tsTypeParameterDeclaration, + TSTypeParameter: tsTypeParameter, + NumberLiteral: NumberLiteral, + RegexLiteral: RegexLiteral, + RestProperty: RestProperty, + SpreadProperty: SpreadProperty, + STANDARDIZED_TYPES: STANDARDIZED_TYPES, + EXPRESSION_TYPES: EXPRESSION_TYPES, + BINARY_TYPES: BINARY_TYPES, + SCOPABLE_TYPES: SCOPABLE_TYPES, + BLOCKPARENT_TYPES: BLOCKPARENT_TYPES, + BLOCK_TYPES: BLOCK_TYPES, + STATEMENT_TYPES: STATEMENT_TYPES, + TERMINATORLESS_TYPES: TERMINATORLESS_TYPES, + COMPLETIONSTATEMENT_TYPES: COMPLETIONSTATEMENT_TYPES, + CONDITIONAL_TYPES: CONDITIONAL_TYPES, + LOOP_TYPES: LOOP_TYPES, + WHILE_TYPES: WHILE_TYPES, + EXPRESSIONWRAPPER_TYPES: EXPRESSIONWRAPPER_TYPES, + FOR_TYPES: FOR_TYPES, + FORXSTATEMENT_TYPES: FORXSTATEMENT_TYPES, + FUNCTION_TYPES: FUNCTION_TYPES$1, + FUNCTIONPARENT_TYPES: FUNCTIONPARENT_TYPES, + PUREISH_TYPES: PUREISH_TYPES, + DECLARATION_TYPES: DECLARATION_TYPES, + PATTERNLIKE_TYPES: PATTERNLIKE_TYPES, + LVAL_TYPES: LVAL_TYPES, + TSENTITYNAME_TYPES: TSENTITYNAME_TYPES, + LITERAL_TYPES: LITERAL_TYPES, + IMMUTABLE_TYPES: IMMUTABLE_TYPES, + USERWHITESPACABLE_TYPES: USERWHITESPACABLE_TYPES, + METHOD_TYPES: METHOD_TYPES, + OBJECTMEMBER_TYPES: OBJECTMEMBER_TYPES, + PROPERTY_TYPES: PROPERTY_TYPES, + UNARYLIKE_TYPES: UNARYLIKE_TYPES, + PATTERN_TYPES: PATTERN_TYPES, + CLASS_TYPES: CLASS_TYPES, + IMPORTOREXPORTDECLARATION_TYPES: IMPORTOREXPORTDECLARATION_TYPES, + EXPORTDECLARATION_TYPES: EXPORTDECLARATION_TYPES, + MODULESPECIFIER_TYPES: MODULESPECIFIER_TYPES, + ACCESSOR_TYPES: ACCESSOR_TYPES, + PRIVATE_TYPES: PRIVATE_TYPES, + FLOW_TYPES: FLOW_TYPES, + FLOWTYPE_TYPES: FLOWTYPE_TYPES, + FLOWBASEANNOTATION_TYPES: FLOWBASEANNOTATION_TYPES, + FLOWDECLARATION_TYPES: FLOWDECLARATION_TYPES, + FLOWPREDICATE_TYPES: FLOWPREDICATE_TYPES, + ENUMBODY_TYPES: ENUMBODY_TYPES, + ENUMMEMBER_TYPES: ENUMMEMBER_TYPES, + JSX_TYPES: JSX_TYPES, + MISCELLANEOUS_TYPES: MISCELLANEOUS_TYPES, + TYPESCRIPT_TYPES: TYPESCRIPT_TYPES, + TSTYPEELEMENT_TYPES: TSTYPEELEMENT_TYPES, + TSTYPE_TYPES: TSTYPE_TYPES, + TSBASETYPE_TYPES: TSBASETYPE_TYPES, + MODULEDECLARATION_TYPES: MODULEDECLARATION_TYPES, + STATEMENT_OR_BLOCK_KEYS: STATEMENT_OR_BLOCK_KEYS$1, + FLATTENABLE_KEYS: FLATTENABLE_KEYS, + FOR_INIT_KEYS: FOR_INIT_KEYS, + COMMENT_KEYS: COMMENT_KEYS, + LOGICAL_OPERATORS: LOGICAL_OPERATORS$3, + UPDATE_OPERATORS: UPDATE_OPERATORS, + BOOLEAN_NUMBER_BINARY_OPERATORS: BOOLEAN_NUMBER_BINARY_OPERATORS$1, + EQUALITY_BINARY_OPERATORS: EQUALITY_BINARY_OPERATORS, + COMPARISON_BINARY_OPERATORS: COMPARISON_BINARY_OPERATORS, + BOOLEAN_BINARY_OPERATORS: BOOLEAN_BINARY_OPERATORS$1, + NUMBER_BINARY_OPERATORS: NUMBER_BINARY_OPERATORS$1, + BINARY_OPERATORS: BINARY_OPERATORS, + ASSIGNMENT_OPERATORS: ASSIGNMENT_OPERATORS, + BOOLEAN_UNARY_OPERATORS: BOOLEAN_UNARY_OPERATORS$1, + NUMBER_UNARY_OPERATORS: NUMBER_UNARY_OPERATORS$1, + STRING_UNARY_OPERATORS: STRING_UNARY_OPERATORS$1, + UNARY_OPERATORS: UNARY_OPERATORS, + INHERIT_KEYS: INHERIT_KEYS, + BLOCK_SCOPED_SYMBOL: BLOCK_SCOPED_SYMBOL, + NOT_LOCAL_BINDING: NOT_LOCAL_BINDING$2, + VISITOR_KEYS: VISITOR_KEYS$5, + ALIAS_KEYS: ALIAS_KEYS, + FLIPPED_ALIAS_KEYS: FLIPPED_ALIAS_KEYS$3, + NODE_FIELDS: NODE_FIELDS, + BUILDER_KEYS: BUILDER_KEYS, + DEPRECATED_ALIASES: DEPRECATED_ALIASES$1, + DEPRECATED_KEYS: DEPRECATED_KEYS$1, + NODE_PARENT_VALIDATIONS: NODE_PARENT_VALIDATIONS, + PLACEHOLDERS: PLACEHOLDERS, + PLACEHOLDERS_ALIAS: PLACEHOLDERS_ALIAS, + PLACEHOLDERS_FLIPPED_ALIAS: PLACEHOLDERS_FLIPPED_ALIAS, + TYPES: TYPES$1, + isArrayExpression: isArrayExpression$2, + isAssignmentExpression: isAssignmentExpression$4, + isBinaryExpression: isBinaryExpression$1, + isInterpreterDirective: isInterpreterDirective, + isDirective: isDirective, + isDirectiveLiteral: isDirectiveLiteral, + isBlockStatement: isBlockStatement$2, + isBreakStatement: isBreakStatement, + isCallExpression: isCallExpression$8, + isCatchClause: isCatchClause, + isConditionalExpression: isConditionalExpression$1, + isContinueStatement: isContinueStatement, + isDebuggerStatement: isDebuggerStatement, + isDoWhileStatement: isDoWhileStatement, + isEmptyStatement: isEmptyStatement, + isExpressionStatement: isExpressionStatement$3, + isFile: isFile, + isForInStatement: isForInStatement$1, + isForStatement: isForStatement$3, + isFunctionDeclaration: isFunctionDeclaration$2, + isFunctionExpression: isFunctionExpression$1, + isIdentifier: isIdentifier$j, + isIfStatement: isIfStatement$2, + isLabeledStatement: isLabeledStatement, + isStringLiteral: isStringLiteral$6, + isNumericLiteral: isNumericLiteral, + isNullLiteral: isNullLiteral$2, + isBooleanLiteral: isBooleanLiteral, + isRegExpLiteral: isRegExpLiteral$2, + isLogicalExpression: isLogicalExpression$1, + isMemberExpression: isMemberExpression$8, + isNewExpression: isNewExpression$4, + isProgram: isProgram$1, + isObjectExpression: isObjectExpression$3, + isObjectMethod: isObjectMethod$1, + isObjectProperty: isObjectProperty$5, + isRestElement: isRestElement$3, + isReturnStatement: isReturnStatement$1, + isSequenceExpression: isSequenceExpression$2, + isParenthesizedExpression: isParenthesizedExpression$1, + isSwitchCase: isSwitchCase, + isSwitchStatement: isSwitchStatement$1, + isThisExpression: isThisExpression$2, + isThrowStatement: isThrowStatement$1, + isTryStatement: isTryStatement, + isUnaryExpression: isUnaryExpression$1, + isUpdateExpression: isUpdateExpression$2, + isVariableDeclaration: isVariableDeclaration$3, + isVariableDeclarator: isVariableDeclarator$2, + isWhileStatement: isWhileStatement$1, + isWithStatement: isWithStatement, + isAssignmentPattern: isAssignmentPattern$5, + isArrayPattern: isArrayPattern$1, + isArrowFunctionExpression: isArrowFunctionExpression$1, + isClassBody: isClassBody$2, + isClassExpression: isClassExpression$1, + isClassDeclaration: isClassDeclaration$2, + isExportAllDeclaration: isExportAllDeclaration$1, + isExportDefaultDeclaration: isExportDefaultDeclaration$3, + isExportNamedDeclaration: isExportNamedDeclaration$3, + isExportSpecifier: isExportSpecifier, + isForOfStatement: isForOfStatement$2, + isImportDeclaration: isImportDeclaration$2, + isImportDefaultSpecifier: isImportDefaultSpecifier$1, + isImportNamespaceSpecifier: isImportNamespaceSpecifier$1, + isImportSpecifier: isImportSpecifier$1, + isMetaProperty: isMetaProperty$1, + isClassMethod: isClassMethod, + isObjectPattern: isObjectPattern$2, + isSpreadElement: isSpreadElement$1, + isSuper: isSuper$3, + isTaggedTemplateExpression: isTaggedTemplateExpression$2, + isTemplateElement: isTemplateElement, + isTemplateLiteral: isTemplateLiteral$2, + isYieldExpression: isYieldExpression$1, + isAwaitExpression: isAwaitExpression$1, + isImport: isImport, + isBigIntLiteral: isBigIntLiteral, + isExportNamespaceSpecifier: isExportNamespaceSpecifier$1, + isOptionalMemberExpression: isOptionalMemberExpression$3, + isOptionalCallExpression: isOptionalCallExpression$3, + isClassProperty: isClassProperty, + isClassAccessorProperty: isClassAccessorProperty, + isClassPrivateProperty: isClassPrivateProperty, + isClassPrivateMethod: isClassPrivateMethod, + isPrivateName: isPrivateName$3, + isStaticBlock: isStaticBlock, + isAnyTypeAnnotation: isAnyTypeAnnotation$1, + isArrayTypeAnnotation: isArrayTypeAnnotation$2, + isBooleanTypeAnnotation: isBooleanTypeAnnotation$1, + isBooleanLiteralTypeAnnotation: isBooleanLiteralTypeAnnotation, + isNullLiteralTypeAnnotation: isNullLiteralTypeAnnotation, + isClassImplements: isClassImplements, + isDeclareClass: isDeclareClass, + isDeclareFunction: isDeclareFunction, + isDeclareInterface: isDeclareInterface, + isDeclareModule: isDeclareModule, + isDeclareModuleExports: isDeclareModuleExports, + isDeclareTypeAlias: isDeclareTypeAlias, + isDeclareOpaqueType: isDeclareOpaqueType, + isDeclareVariable: isDeclareVariable, + isDeclareExportDeclaration: isDeclareExportDeclaration$1, + isDeclareExportAllDeclaration: isDeclareExportAllDeclaration, + isDeclaredPredicate: isDeclaredPredicate, + isExistsTypeAnnotation: isExistsTypeAnnotation, + isFunctionTypeAnnotation: isFunctionTypeAnnotation, + isFunctionTypeParam: isFunctionTypeParam, + isGenericTypeAnnotation: isGenericTypeAnnotation$1, + isInferredPredicate: isInferredPredicate, + isInterfaceExtends: isInterfaceExtends, + isInterfaceDeclaration: isInterfaceDeclaration, + isInterfaceTypeAnnotation: isInterfaceTypeAnnotation, + isIntersectionTypeAnnotation: isIntersectionTypeAnnotation$1, + isMixedTypeAnnotation: isMixedTypeAnnotation$1, + isEmptyTypeAnnotation: isEmptyTypeAnnotation$1, + isNullableTypeAnnotation: isNullableTypeAnnotation$1, + isNumberLiteralTypeAnnotation: isNumberLiteralTypeAnnotation, + isNumberTypeAnnotation: isNumberTypeAnnotation$1, + isObjectTypeAnnotation: isObjectTypeAnnotation, + isObjectTypeInternalSlot: isObjectTypeInternalSlot, + isObjectTypeCallProperty: isObjectTypeCallProperty, + isObjectTypeIndexer: isObjectTypeIndexer, + isObjectTypeProperty: isObjectTypeProperty, + isObjectTypeSpreadProperty: isObjectTypeSpreadProperty, + isOpaqueType: isOpaqueType, + isQualifiedTypeIdentifier: isQualifiedTypeIdentifier, + isStringLiteralTypeAnnotation: isStringLiteralTypeAnnotation, + isStringTypeAnnotation: isStringTypeAnnotation$1, + isSymbolTypeAnnotation: isSymbolTypeAnnotation, + isThisTypeAnnotation: isThisTypeAnnotation, + isTupleTypeAnnotation: isTupleTypeAnnotation$1, + isTypeofTypeAnnotation: isTypeofTypeAnnotation, + isTypeAlias: isTypeAlias, + isTypeAnnotation: isTypeAnnotation$2, + isTypeCastExpression: isTypeCastExpression$1, + isTypeParameter: isTypeParameter, + isTypeParameterDeclaration: isTypeParameterDeclaration, + isTypeParameterInstantiation: isTypeParameterInstantiation, + isUnionTypeAnnotation: isUnionTypeAnnotation$2, + isVariance: isVariance, + isVoidTypeAnnotation: isVoidTypeAnnotation$1, + isEnumDeclaration: isEnumDeclaration, + isEnumBooleanBody: isEnumBooleanBody, + isEnumNumberBody: isEnumNumberBody, + isEnumStringBody: isEnumStringBody, + isEnumSymbolBody: isEnumSymbolBody, + isEnumBooleanMember: isEnumBooleanMember, + isEnumNumberMember: isEnumNumberMember, + isEnumStringMember: isEnumStringMember, + isEnumDefaultedMember: isEnumDefaultedMember, + isIndexedAccessType: isIndexedAccessType$1, + isOptionalIndexedAccessType: isOptionalIndexedAccessType, + isJSXAttribute: isJSXAttribute, + isJSXClosingElement: isJSXClosingElement, + isJSXElement: isJSXElement, + isJSXEmptyExpression: isJSXEmptyExpression, + isJSXExpressionContainer: isJSXExpressionContainer$1, + isJSXSpreadChild: isJSXSpreadChild, + isJSXIdentifier: isJSXIdentifier$3, + isJSXMemberExpression: isJSXMemberExpression$2, + isJSXNamespacedName: isJSXNamespacedName$1, + isJSXOpeningElement: isJSXOpeningElement, + isJSXSpreadAttribute: isJSXSpreadAttribute$1, + isJSXText: isJSXText, + isJSXFragment: isJSXFragment, + isJSXOpeningFragment: isJSXOpeningFragment, + isJSXClosingFragment: isJSXClosingFragment, + isNoop: isNoop, + isPlaceholder: isPlaceholder$1, + isV8IntrinsicIdentifier: isV8IntrinsicIdentifier, + isArgumentPlaceholder: isArgumentPlaceholder, + isBindExpression: isBindExpression, + isImportAttribute: isImportAttribute, + isDecorator: isDecorator, + isDoExpression: isDoExpression, + isExportDefaultSpecifier: isExportDefaultSpecifier$1, + isRecordExpression: isRecordExpression$1, + isTupleExpression: isTupleExpression$1, + isDecimalLiteral: isDecimalLiteral, + isModuleExpression: isModuleExpression, + isTopicReference: isTopicReference$1, + isPipelineTopicExpression: isPipelineTopicExpression, + isPipelineBareFunction: isPipelineBareFunction, + isPipelinePrimaryTopicReference: isPipelinePrimaryTopicReference, + isTSParameterProperty: isTSParameterProperty, + isTSDeclareFunction: isTSDeclareFunction, + isTSDeclareMethod: isTSDeclareMethod, + isTSQualifiedName: isTSQualifiedName, + isTSCallSignatureDeclaration: isTSCallSignatureDeclaration, + isTSConstructSignatureDeclaration: isTSConstructSignatureDeclaration, + isTSPropertySignature: isTSPropertySignature, + isTSMethodSignature: isTSMethodSignature, + isTSIndexSignature: isTSIndexSignature, + isTSAnyKeyword: isTSAnyKeyword, + isTSBooleanKeyword: isTSBooleanKeyword, + isTSBigIntKeyword: isTSBigIntKeyword, + isTSIntrinsicKeyword: isTSIntrinsicKeyword, + isTSNeverKeyword: isTSNeverKeyword, + isTSNullKeyword: isTSNullKeyword, + isTSNumberKeyword: isTSNumberKeyword, + isTSObjectKeyword: isTSObjectKeyword, + isTSStringKeyword: isTSStringKeyword, + isTSSymbolKeyword: isTSSymbolKeyword, + isTSUndefinedKeyword: isTSUndefinedKeyword, + isTSUnknownKeyword: isTSUnknownKeyword, + isTSVoidKeyword: isTSVoidKeyword, + isTSThisType: isTSThisType, + isTSFunctionType: isTSFunctionType, + isTSConstructorType: isTSConstructorType, + isTSTypeReference: isTSTypeReference$1, + isTSTypePredicate: isTSTypePredicate, + isTSTypeQuery: isTSTypeQuery, + isTSTypeLiteral: isTSTypeLiteral, + isTSArrayType: isTSArrayType$2, + isTSTupleType: isTSTupleType, + isTSOptionalType: isTSOptionalType$1, + isTSRestType: isTSRestType$1, + isTSNamedTupleMember: isTSNamedTupleMember, + isTSUnionType: isTSUnionType$1, + isTSIntersectionType: isTSIntersectionType$1, + isTSConditionalType: isTSConditionalType, + isTSInferType: isTSInferType, + isTSParenthesizedType: isTSParenthesizedType, + isTSTypeOperator: isTSTypeOperator, + isTSIndexedAccessType: isTSIndexedAccessType, + isTSMappedType: isTSMappedType, + isTSLiteralType: isTSLiteralType, + isTSExpressionWithTypeArguments: isTSExpressionWithTypeArguments, + isTSInterfaceDeclaration: isTSInterfaceDeclaration, + isTSInterfaceBody: isTSInterfaceBody$1, + isTSTypeAliasDeclaration: isTSTypeAliasDeclaration, + isTSInstantiationExpression: isTSInstantiationExpression$1, + isTSAsExpression: isTSAsExpression$2, + isTSSatisfiesExpression: isTSSatisfiesExpression$2, + isTSTypeAssertion: isTSTypeAssertion$2, + isTSEnumDeclaration: isTSEnumDeclaration$1, + isTSEnumMember: isTSEnumMember, + isTSModuleDeclaration: isTSModuleDeclaration, + isTSModuleBlock: isTSModuleBlock, + isTSImportType: isTSImportType, + isTSImportEqualsDeclaration: isTSImportEqualsDeclaration, + isTSExternalModuleReference: isTSExternalModuleReference, + isTSNonNullExpression: isTSNonNullExpression$2, + isTSExportAssignment: isTSExportAssignment, + isTSNamespaceExportDeclaration: isTSNamespaceExportDeclaration, + isTSTypeAnnotation: isTSTypeAnnotation$1, + isTSTypeParameterInstantiation: isTSTypeParameterInstantiation, + isTSTypeParameterDeclaration: isTSTypeParameterDeclaration, + isTSTypeParameter: isTSTypeParameter, + isStandardized: isStandardized, + isExpression: isExpression$4, + isBinary: isBinary$3, + isScopable: isScopable, + isBlockParent: isBlockParent, + isBlock: isBlock, + isStatement: isStatement$8, + isTerminatorless: isTerminatorless, + isCompletionStatement: isCompletionStatement, + isConditional: isConditional$1, + isLoop: isLoop$1, + isWhile: isWhile, + isExpressionWrapper: isExpressionWrapper, + isFor: isFor$2, + isForXStatement: isForXStatement$1, + isFunction: isFunction$5, + isFunctionParent: isFunctionParent, + isPureish: isPureish$2, + isDeclaration: isDeclaration$1, + isPatternLike: isPatternLike, + isLVal: isLVal, + isTSEntityName: isTSEntityName, + isLiteral: isLiteral$6, + isUserWhitespacable: isUserWhitespacable, + isMethod: isMethod$1, + isObjectMember: isObjectMember, + isProperty: isProperty$1, + isUnaryLike: isUnaryLike$1, + isPattern: isPattern, + isClass: isClass$2, + isImportOrExportDeclaration: isImportOrExportDeclaration, + isExportDeclaration: isExportDeclaration$3, + isModuleSpecifier: isModuleSpecifier$1, + isAccessor: isAccessor, + isPrivate: isPrivate, + isFlow: isFlow$1, + isFlowType: isFlowType$1, + isFlowBaseAnnotation: isFlowBaseAnnotation$1, + isFlowDeclaration: isFlowDeclaration, + isFlowPredicate: isFlowPredicate, + isEnumBody: isEnumBody, + isEnumMember: isEnumMember, + isJSX: isJSX, + isMiscellaneous: isMiscellaneous, + isTypeScript: isTypeScript, + isTSTypeElement: isTSTypeElement, + isTSType: isTSType, + isTSBaseType: isTSBaseType, + isNumberLiteral: isNumberLiteral, + isRegexLiteral: isRegexLiteral, + isRestProperty: isRestProperty$1, + isSpreadProperty: isSpreadProperty$1, + isModuleDeclaration: isModuleDeclaration + }); + + var DEPRECATED_KEYS = DEPRECATED_KEYS$1, + DEPRECATED_ALIASES = DEPRECATED_ALIASES$1, + FLIPPED_ALIAS_KEYS$2 = FLIPPED_ALIAS_KEYS$3, + TYPES = TYPES$1, + deprecationWarning = deprecationWarning$1; + function isVirtualType(type) { + return type in virtualTypes; + } + function isExplodedVisitor(visitor) { + return visitor == null ? void 0 : visitor._exploded; + } + function explode$1(visitor) { + if (isExplodedVisitor(visitor)) return visitor; + visitor._exploded = true; + for (var _i = 0, _arr = Object.keys(visitor); _i < _arr.length; _i++) { + var nodeType = _arr[_i]; + if (shouldIgnoreKey(nodeType)) continue; + var parts = nodeType.split("|"); + if (parts.length === 1) continue; + var fns = visitor[nodeType]; + delete visitor[nodeType]; + for (var _iterator = _createForOfIteratorHelperLoose(parts), _step; !(_step = _iterator()).done;) { + var part = _step.value; + visitor[part] = fns; + } + } + verify(visitor); + delete visitor.__esModule; + ensureEntranceObjects(visitor); + ensureCallbackArrays(visitor); + for (var _i2 = 0, _Object$keys = Object.keys(visitor); _i2 < _Object$keys.length; _i2++) { + var _nodeType = _Object$keys[_i2]; + if (shouldIgnoreKey(_nodeType)) continue; + if (!isVirtualType(_nodeType)) continue; + var _fns = visitor[_nodeType]; + for (var _i3 = 0, _Object$keys2 = Object.keys(_fns); _i3 < _Object$keys2.length; _i3++) { + var type = _Object$keys2[_i3]; + _fns[type] = wrapCheck(_nodeType, _fns[type]); + } + delete visitor[_nodeType]; + var types = virtualTypes[_nodeType]; + if (types !== null) { + for (var _iterator2 = _createForOfIteratorHelperLoose(types), _step2; !(_step2 = _iterator2()).done;) { + var _type = _step2.value; + if (visitor[_type]) { + mergePair(visitor[_type], _fns); + } else { + visitor[_type] = _fns; + } + } + } else { + mergePair(visitor, _fns); + } + } + for (var _i4 = 0, _arr2 = Object.keys(visitor); _i4 < _arr2.length; _i4++) { + var _nodeType2 = _arr2[_i4]; + if (shouldIgnoreKey(_nodeType2)) continue; + var aliases = FLIPPED_ALIAS_KEYS$2[_nodeType2]; + if (_nodeType2 in DEPRECATED_KEYS) { + var deprecatedKey = DEPRECATED_KEYS[_nodeType2]; + deprecationWarning(_nodeType2, deprecatedKey, "Visitor "); + aliases = [deprecatedKey]; + } else if (_nodeType2 in DEPRECATED_ALIASES) { + var deprecatedAlias = DEPRECATED_ALIASES[_nodeType2]; + deprecationWarning(_nodeType2, deprecatedAlias, "Visitor "); + aliases = FLIPPED_ALIAS_KEYS$2[deprecatedAlias]; + } + if (!aliases) continue; + var _fns2 = visitor[_nodeType2]; + delete visitor[_nodeType2]; + for (var _iterator3 = _createForOfIteratorHelperLoose(aliases), _step3; !(_step3 = _iterator3()).done;) { + var alias = _step3.value; + var existing = visitor[alias]; + if (existing) { + mergePair(existing, _fns2); + } else { + visitor[alias] = Object.assign({}, _fns2); + } + } + } + for (var _i5 = 0, _Object$keys3 = Object.keys(visitor); _i5 < _Object$keys3.length; _i5++) { + var _nodeType3 = _Object$keys3[_i5]; + if (shouldIgnoreKey(_nodeType3)) continue; + ensureCallbackArrays(visitor[_nodeType3]); + } + return visitor; + } + function verify(visitor) { + if (visitor._verified) return; + if (typeof visitor === "function") { + throw new Error("You passed `traverse()` a function when it expected a visitor object, " + "are you sure you didn't mean `{ enter: Function }`?"); + } + for (var _i6 = 0, _arr3 = Object.keys(visitor); _i6 < _arr3.length; _i6++) { + var nodeType = _arr3[_i6]; + if (nodeType === "enter" || nodeType === "exit") { + validateVisitorMethods(nodeType, visitor[nodeType]); + } + if (shouldIgnoreKey(nodeType)) continue; + if (TYPES.indexOf(nodeType) < 0) { + throw new Error("You gave us a visitor for the node type " + nodeType + " but it's not a valid type"); + } + var _visitors = visitor[nodeType]; + if (typeof _visitors === "object") { + for (var _i7 = 0, _Object$keys4 = Object.keys(_visitors); _i7 < _Object$keys4.length; _i7++) { + var visitorKey = _Object$keys4[_i7]; + if (visitorKey === "enter" || visitorKey === "exit") { + validateVisitorMethods(nodeType + "." + visitorKey, _visitors[visitorKey]); + } else { + throw new Error("You passed `traverse()` a visitor object with the property " + (nodeType + " that has the invalid property " + visitorKey)); + } + } + } + } + visitor._verified = true; + } + function validateVisitorMethods(path, val) { + var fns = [].concat(val); + for (var _iterator4 = _createForOfIteratorHelperLoose(fns), _step4; !(_step4 = _iterator4()).done;) { + var fn = _step4.value; + if (typeof fn !== "function") { + throw new TypeError("Non-function found defined in " + path + " with type " + typeof fn); + } + } + } + function merge$1(visitors, states, wrapper) { + if (states === void 0) { + states = []; + } + var mergedVisitor = {}; + for (var i = 0; i < visitors.length; i++) { + var visitor = explode$1(visitors[i]); + var state = states[i]; + var topVisitor = visitor; + if (state || wrapper) { + topVisitor = wrapWithStateOrWrapper(topVisitor, state, wrapper); + } + mergePair(mergedVisitor, topVisitor); + for (var _i8 = 0, _arr4 = Object.keys(visitor); _i8 < _arr4.length; _i8++) { + var key = _arr4[_i8]; + if (shouldIgnoreKey(key)) continue; + var typeVisitor = visitor[key]; + if (state || wrapper) { + typeVisitor = wrapWithStateOrWrapper(typeVisitor, state, wrapper); + } + var nodeVisitor = mergedVisitor[key] || (mergedVisitor[key] = {}); + mergePair(nodeVisitor, typeVisitor); + } + } + return mergedVisitor; + } + function wrapWithStateOrWrapper(oldVisitor, state, wrapper) { + var newVisitor = {}; + var _loop = function _loop() { + var phase = _arr5[_i9]; + var fns = oldVisitor[phase]; + if (!Array.isArray(fns)) return "continue"; + fns = fns.map(function (fn) { + var newFn = fn; + if (state) { + newFn = function newFn(path) { + fn.call(state, path, state); + }; + } + if (wrapper) { + newFn = wrapper(state == null ? void 0 : state.key, phase, newFn); + } + if (newFn !== fn) { + newFn.toString = function () { + return fn.toString(); + }; + } + return newFn; + }); + newVisitor[phase] = fns; + }; + for (var _i9 = 0, _arr5 = ["enter", "exit"]; _i9 < _arr5.length; _i9++) { + var _ret = _loop(); + if (_ret === "continue") continue; + } + return newVisitor; + } + function ensureEntranceObjects(obj) { + for (var _i10 = 0, _arr6 = Object.keys(obj); _i10 < _arr6.length; _i10++) { + var key = _arr6[_i10]; + if (shouldIgnoreKey(key)) continue; + var fns = obj[key]; + if (typeof fns === "function") { + obj[key] = { + enter: fns + }; + } + } + } + function ensureCallbackArrays(obj) { + if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter]; + if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit]; + } + function wrapCheck(nodeType, fn) { + var newFn = function newFn(path) { + if (path["is" + nodeType]()) { + return fn.apply(this, arguments); + } + }; + newFn.toString = function () { + return fn.toString(); + }; + return newFn; + } + function shouldIgnoreKey(key) { + if (key[0] === "_") return true; + if (key === "enter" || key === "exit" || key === "shouldSkip") return true; + if (key === "denylist" || key === "noScope" || key === "skipKeys") { + return true; + } + { + if (key === "blacklist") { + return true; + } + } + return false; + } + function mergePair(dest, src) { + for (var _i11 = 0, _arr7 = ["enter", "exit"]; _i11 < _arr7.length; _i11++) { + var phase = _arr7[_i11]; + if (!src[phase]) continue; + dest[phase] = [].concat(dest[phase] || [], src[phase]); + } + } + + var visitors = /*#__PURE__*/Object.freeze({ + __proto__: null, + isExplodedVisitor: isExplodedVisitor, + explode: explode$1, + verify: verify, + merge: merge$1 + }); + + var pathsCache = new WeakMap(); + var scope = new WeakMap(); + function clear() { + clearPath(); + clearScope(); + } + function clearPath() { + pathsCache = new WeakMap(); + } + function clearScope() { + scope = new WeakMap(); + } + var nullHub = Object.freeze({}); + function getCachedPaths(hub, parent) { + var _pathsCache$get, _hub; + { + hub = null; + } + return (_pathsCache$get = pathsCache.get((_hub = hub) != null ? _hub : nullHub)) == null ? void 0 : _pathsCache$get.get(parent); + } + function getOrCreateCachedPaths(hub, parent) { + var _hub2, _hub3; + { + hub = null; + } + var parents = pathsCache.get((_hub2 = hub) != null ? _hub2 : nullHub); + if (!parents) pathsCache.set((_hub3 = hub) != null ? _hub3 : nullHub, parents = new WeakMap()); + var paths = parents.get(parent); + if (!paths) parents.set(parent, paths = new Map()); + return paths; + } + + var cache$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + get path () { return pathsCache; }, + get scope () { return scope; }, + clear: clear, + clearPath: clearPath, + clearScope: clearScope, + getCachedPaths: getCachedPaths, + getOrCreateCachedPaths: getOrCreateCachedPaths + }); + + var browser$3 = {exports: {}}; + + var ms; + var hasRequiredMs; + function requireMs() { + if (hasRequiredMs) return ms; + hasRequiredMs = 1; + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + ms = function ms(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options["long"] ? fmtLong(val) : fmtShort(val); + } + throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); + }; + function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } + } + function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; + } + function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; + } + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + } + return ms; + } + + function setup$1(env) { + createDebug.debug = createDebug; + createDebug["default"] = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = requireMs(); + createDebug.destroy = destroy; + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + createDebug.names = []; + createDebug.skips = []; + createDebug.formatters = {}; + function selectColor(namespace) { + var hash = 0; + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; + } + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + function createDebug(namespace) { + var prevTime; + var enableOverride = null; + var namespacesCache; + var enabledCache; + function debug() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + if (!debug.enabled) { + return; + } + var self = debug; + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + if (typeof args[0] !== 'string') { + args.unshift('%O'); + } + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + if (match === '%%') { + return '%'; + } + index++; + var formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); + args.splice(index, 1); + index--; + } + return match; + }); + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: function get() { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + return enabledCache; + }, + set: function set(v) { + enableOverride = v; + } + }); + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + return debug; + } + function extend(namespace, delimiter) { + var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + for (i = 0; i < len; i++) { + if (!split[i]) { + continue; + } + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + function disable() { + var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { + return '-' + namespace; + }))).join(','); + createDebug.enable(''); + return namespaces; + } + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + var i; + var len; + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + return false; + } + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); + } + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + createDebug.enable(createDebug.load()); + return createDebug; + } + var common = setup$1; + + browser$3.exports; + (function (module, exports) { + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = localstorage(); + exports.destroy = function () { + var warned = false; + return function () { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; + }(); + exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; + function useColors() { + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + if (!this.useColors) { + return; + } + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + lastC = index; + } + }); + args.splice(lastC, 0, c); + } + exports.log = console.debug || console.log || function () {}; + function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {} + } + function load() { + var r; + try { + r = exports.storage.getItem('debug'); + } catch (error) {} + if (!r && typeof browser$1$1 !== 'undefined' && 'env' in browser$1$1) { + r = browser$1$1.env.DEBUG; + } + return r; + } + function localstorage() { + try { + return localStorage; + } catch (error) {} + } + module.exports = common(exports); + var formatters = module.exports.formatters; + formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } + }; + })(browser$3, browser$3.exports); + var browserExports = browser$3.exports; + + var cloneNode$i = cloneNode$j, + exportNamedDeclaration$1 = exportNamedDeclaration$2, + exportSpecifier$1 = exportSpecifier$2, + identifier$h = identifier$i, + variableDeclaration$7 = variableDeclaration$8, + variableDeclarator$7 = variableDeclarator$8; + function splitExportDeclaration(exportDeclaration) { + if (!exportDeclaration.isExportDeclaration() || exportDeclaration.isExportAllDeclaration()) { + throw new Error("Only default and named export declarations can be split."); + } + if (exportDeclaration.isExportDefaultDeclaration()) { + var _declaration = exportDeclaration.get("declaration"); + var standaloneDeclaration = _declaration.isFunctionDeclaration() || _declaration.isClassDeclaration(); + var exportExpr = _declaration.isFunctionExpression() || _declaration.isClassExpression(); + var scope = _declaration.isScope() ? _declaration.scope.parent : _declaration.scope; + var id = _declaration.node.id; + var needBindingRegistration = false; + if (!id) { + needBindingRegistration = true; + id = scope.generateUidIdentifier("default"); + if (standaloneDeclaration || exportExpr) { + _declaration.node.id = cloneNode$i(id); + } + } else if (exportExpr && scope.hasBinding(id.name)) { + needBindingRegistration = true; + id = scope.generateUidIdentifier(id.name); + } + var updatedDeclaration = standaloneDeclaration ? _declaration.node : variableDeclaration$7("var", [variableDeclarator$7(cloneNode$i(id), _declaration.node)]); + var updatedExportDeclaration = exportNamedDeclaration$1(null, [exportSpecifier$1(cloneNode$i(id), identifier$h("default"))]); + exportDeclaration.insertAfter(updatedExportDeclaration); + exportDeclaration.replaceWith(updatedDeclaration); + if (needBindingRegistration) { + scope.registerDeclaration(exportDeclaration); + } + return exportDeclaration; + } else if (exportDeclaration.get("specifiers").length > 0) { + throw new Error("It doesn't make sense to split exported specifiers."); + } + var declaration = exportDeclaration.get("declaration"); + var bindingIdentifiers = declaration.getOuterBindingIdentifiers(); + var specifiers = Object.keys(bindingIdentifiers).map(function (name) { + return exportSpecifier$1(identifier$h(name), identifier$h(name)); + }); + var aliasDeclar = exportNamedDeclaration$1(null, specifiers); + exportDeclaration.insertAfter(aliasDeclar); + exportDeclaration.replaceWith(declaration.node); + return exportDeclaration; + } + + function requeueComputedKeyAndDecorators(path) { + var context = path.context, + node = path.node; + if (node.computed) { + context.maybeQueue(path.get("key")); + } + if (node.decorators) { + for (var _iterator = _createForOfIteratorHelperLoose(path.get("decorators")), _step; !(_step = _iterator()).done;) { + var decorator = _step.value; + context.maybeQueue(decorator); + } + } + } + var visitor$5 = { + FunctionParent: function FunctionParent(path) { + if (path.isArrowFunctionExpression()) { + return; + } else { + path.skip(); + if (path.isMethod()) { + requeueComputedKeyAndDecorators(path); + } + } + }, + Property: function Property(path) { + if (path.isObjectProperty()) { + return; + } + path.skip(); + requeueComputedKeyAndDecorators(path); + } + }; + + var renameVisitor = { + ReferencedIdentifier: function ReferencedIdentifier(_ref, state) { + var node = _ref.node; + if (node.name === state.oldName) { + node.name = state.newName; + } + }, + Scope: function Scope(path, state) { + if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) { + path.skip(); + if (path.isMethod()) { + requeueComputedKeyAndDecorators(path); + } + } + }, + ObjectProperty: function ObjectProperty(_ref2, state) { + var node = _ref2.node, + scope = _ref2.scope; + var _ref3 = node.key, + name = _ref3.name; + if (node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier) { + var _node$extra; + node.shorthand = false; + if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false; + } + }, + "AssignmentExpression|Declaration|VariableDeclarator": function AssignmentExpressionDeclarationVariableDeclarator(path, state) { + if (path.isVariableDeclaration()) return; + var ids = path.getOuterBindingIdentifiers(); + for (var name in ids) { + if (name === state.oldName) ids[name].name = state.newName; + } + } + }; + var Renamer = function () { + function Renamer(binding, oldName, newName) { + this.newName = newName; + this.oldName = oldName; + this.binding = binding; + } + var _proto = Renamer.prototype; + _proto.maybeConvertFromExportDeclaration = function maybeConvertFromExportDeclaration(parentDeclar) { + var maybeExportDeclar = parentDeclar.parentPath; + if (!maybeExportDeclar.isExportDeclaration()) { + return; + } + if (maybeExportDeclar.isExportDefaultDeclaration()) { + var declaration = maybeExportDeclar.node.declaration; + if (isDeclaration$1(declaration) && !declaration.id) { + return; + } + } + if (maybeExportDeclar.isExportAllDeclaration()) { + return; + } + splitExportDeclaration(maybeExportDeclar); + }; + _proto.maybeConvertFromClassFunctionDeclaration = function maybeConvertFromClassFunctionDeclaration(path) { + return path; + }; + _proto.maybeConvertFromClassFunctionExpression = function maybeConvertFromClassFunctionExpression(path) { + return path; + }; + _proto.rename = function rename() { + var binding = this.binding, + oldName = this.oldName, + newName = this.newName; + var scope = binding.scope, + path = binding.path; + var parentDeclar = path.find(function (path) { + return path.isDeclaration() || path.isFunctionExpression() || path.isClassExpression(); + }); + if (parentDeclar) { + var bindingIds = parentDeclar.getOuterBindingIdentifiers(); + if (bindingIds[oldName] === binding.identifier) { + this.maybeConvertFromExportDeclaration(parentDeclar); + } + } + var blockToTraverse = arguments[0] || scope.block; + traverseNode(blockToTraverse, explode$1(renameVisitor), scope, this, scope.path, { + discriminant: true + }); + if (!arguments[0]) { + scope.removeOwnBinding(oldName); + scope.bindings[newName] = binding; + this.binding.identifier.name = newName; + } + if (parentDeclar) { + this.maybeConvertFromClassFunctionDeclaration(path); + this.maybeConvertFromClassFunctionExpression(path); + } + }; + return _createClass(Renamer); + }(); + + var Binding = function () { + function Binding(_ref) { + var identifier = _ref.identifier, + scope = _ref.scope, + path = _ref.path, + kind = _ref.kind; + this.identifier = void 0; + this.scope = void 0; + this.path = void 0; + this.kind = void 0; + this.constantViolations = []; + this.constant = true; + this.referencePaths = []; + this.referenced = false; + this.references = 0; + this.identifier = identifier; + this.scope = scope; + this.path = path; + this.kind = kind; + if ((kind === "var" || kind === "hoisted") && isDeclaredInLoop(path || function () { + throw new Error("Internal Babel error: unreachable "); + }())) { + this.reassign(path); + } + this.clearValue(); + } + var _proto = Binding.prototype; + _proto.deoptValue = function deoptValue() { + this.clearValue(); + this.hasDeoptedValue = true; + }; + _proto.setValue = function setValue(value) { + if (this.hasDeoptedValue) return; + this.hasValue = true; + this.value = value; + }; + _proto.clearValue = function clearValue() { + this.hasDeoptedValue = false; + this.hasValue = false; + this.value = null; + }; + _proto.reassign = function reassign(path) { + this.constant = false; + if (this.constantViolations.indexOf(path) !== -1) { + return; + } + this.constantViolations.push(path); + }; + _proto.reference = function reference(path) { + if (this.referencePaths.indexOf(path) !== -1) { + return; + } + this.referenced = true; + this.references++; + this.referencePaths.push(path); + }; + _proto.dereference = function dereference() { + this.references--; + this.referenced = !!this.references; + }; + return _createClass(Binding); + }(); + function isDeclaredInLoop(path) { + for (var parentPath = path.parentPath, key = path.key; parentPath; _parentPath = parentPath, parentPath = _parentPath.parentPath, key = _parentPath.key, _parentPath) { + var _parentPath; + if (parentPath.isFunctionParent()) return false; + if (parentPath.isWhile() || parentPath.isForXStatement() || parentPath.isForStatement() && key === "body") { + return true; + } + } + return false; + } + + var builtin = { + "Array": false, + "ArrayBuffer": false, + Atomics: false, + BigInt: false, + BigInt64Array: false, + BigUint64Array: false, + "Boolean": false, + constructor: false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + globalThis: false, + hasOwnProperty: false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + isPrototypeOf: false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + propertyIsEnumerable: false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + SharedArrayBuffer: false, + "String": false, + "Symbol": false, + "SyntaxError": false, + toLocaleString: false, + toString: false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + valueOf: false, + "WeakMap": false, + "WeakSet": false + }; + var es5 = { + "Array": false, + "Boolean": false, + constructor: false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Function": false, + hasOwnProperty: false, + "Infinity": false, + "isFinite": false, + "isNaN": false, + isPrototypeOf: false, + "JSON": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + propertyIsEnumerable: false, + "RangeError": false, + "ReferenceError": false, + "RegExp": false, + "String": false, + "SyntaxError": false, + toLocaleString: false, + toString: false, + "TypeError": false, + "undefined": false, + "unescape": false, + "URIError": false, + valueOf: false + }; + var es2015 = { + "Array": false, + "ArrayBuffer": false, + "Boolean": false, + constructor: false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + hasOwnProperty: false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + isPrototypeOf: false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + propertyIsEnumerable: false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + "String": false, + "Symbol": false, + "SyntaxError": false, + toLocaleString: false, + toString: false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + valueOf: false, + "WeakMap": false, + "WeakSet": false + }; + var es2017 = { + "Array": false, + "ArrayBuffer": false, + Atomics: false, + "Boolean": false, + constructor: false, + "DataView": false, + "Date": false, + "decodeURI": false, + "decodeURIComponent": false, + "encodeURI": false, + "encodeURIComponent": false, + "Error": false, + "escape": false, + "eval": false, + "EvalError": false, + "Float32Array": false, + "Float64Array": false, + "Function": false, + hasOwnProperty: false, + "Infinity": false, + "Int16Array": false, + "Int32Array": false, + "Int8Array": false, + "isFinite": false, + "isNaN": false, + isPrototypeOf: false, + "JSON": false, + "Map": false, + "Math": false, + "NaN": false, + "Number": false, + "Object": false, + "parseFloat": false, + "parseInt": false, + "Promise": false, + propertyIsEnumerable: false, + "Proxy": false, + "RangeError": false, + "ReferenceError": false, + "Reflect": false, + "RegExp": false, + "Set": false, + SharedArrayBuffer: false, + "String": false, + "Symbol": false, + "SyntaxError": false, + toLocaleString: false, + toString: false, + "TypeError": false, + "Uint16Array": false, + "Uint32Array": false, + "Uint8Array": false, + "Uint8ClampedArray": false, + "undefined": false, + "unescape": false, + "URIError": false, + valueOf: false, + "WeakMap": false, + "WeakSet": false + }; + var browser$2 = { + AbortController: false, + AbortSignal: false, + addEventListener: false, + alert: false, + AnalyserNode: false, + Animation: false, + AnimationEffectReadOnly: false, + AnimationEffectTiming: false, + AnimationEffectTimingReadOnly: false, + AnimationEvent: false, + AnimationPlaybackEvent: false, + AnimationTimeline: false, + applicationCache: false, + ApplicationCache: false, + ApplicationCacheErrorEvent: false, + atob: false, + Attr: false, + Audio: false, + AudioBuffer: false, + AudioBufferSourceNode: false, + AudioContext: false, + AudioDestinationNode: false, + AudioListener: false, + AudioNode: false, + AudioParam: false, + AudioProcessingEvent: false, + AudioScheduledSourceNode: false, + "AudioWorkletGlobalScope ": false, + AudioWorkletNode: false, + AudioWorkletProcessor: false, + BarProp: false, + BaseAudioContext: false, + BatteryManager: false, + BeforeUnloadEvent: false, + BiquadFilterNode: false, + Blob: false, + BlobEvent: false, + blur: false, + BroadcastChannel: false, + btoa: false, + BudgetService: false, + ByteLengthQueuingStrategy: false, + Cache: false, + caches: false, + CacheStorage: false, + cancelAnimationFrame: false, + cancelIdleCallback: false, + CanvasCaptureMediaStreamTrack: false, + CanvasGradient: false, + CanvasPattern: false, + CanvasRenderingContext2D: false, + ChannelMergerNode: false, + ChannelSplitterNode: false, + CharacterData: false, + clearInterval: false, + clearTimeout: false, + clientInformation: false, + ClipboardEvent: false, + close: false, + closed: false, + CloseEvent: false, + Comment: false, + CompositionEvent: false, + confirm: false, + console: false, + ConstantSourceNode: false, + ConvolverNode: false, + CountQueuingStrategy: false, + createImageBitmap: false, + Credential: false, + CredentialsContainer: false, + crypto: false, + Crypto: false, + CryptoKey: false, + CSS: false, + CSSConditionRule: false, + CSSFontFaceRule: false, + CSSGroupingRule: false, + CSSImportRule: false, + CSSKeyframeRule: false, + CSSKeyframesRule: false, + CSSMediaRule: false, + CSSNamespaceRule: false, + CSSPageRule: false, + CSSRule: false, + CSSRuleList: false, + CSSStyleDeclaration: false, + CSSStyleRule: false, + CSSStyleSheet: false, + CSSSupportsRule: false, + CustomElementRegistry: false, + customElements: false, + CustomEvent: false, + DataTransfer: false, + DataTransferItem: false, + DataTransferItemList: false, + defaultstatus: false, + defaultStatus: false, + DelayNode: false, + DeviceMotionEvent: false, + DeviceOrientationEvent: false, + devicePixelRatio: false, + dispatchEvent: false, + document: false, + Document: false, + DocumentFragment: false, + DocumentType: false, + DOMError: false, + DOMException: false, + DOMImplementation: false, + DOMMatrix: false, + DOMMatrixReadOnly: false, + DOMParser: false, + DOMPoint: false, + DOMPointReadOnly: false, + DOMQuad: false, + DOMRect: false, + DOMRectReadOnly: false, + DOMStringList: false, + DOMStringMap: false, + DOMTokenList: false, + DragEvent: false, + DynamicsCompressorNode: false, + Element: false, + ErrorEvent: false, + event: false, + Event: false, + EventSource: false, + EventTarget: false, + external: false, + fetch: false, + File: false, + FileList: false, + FileReader: false, + find: false, + focus: false, + FocusEvent: false, + FontFace: false, + FontFaceSetLoadEvent: false, + FormData: false, + frameElement: false, + frames: false, + GainNode: false, + Gamepad: false, + GamepadButton: false, + GamepadEvent: false, + getComputedStyle: false, + getSelection: false, + HashChangeEvent: false, + Headers: false, + history: false, + History: false, + HTMLAllCollection: false, + HTMLAnchorElement: false, + HTMLAreaElement: false, + HTMLAudioElement: false, + HTMLBaseElement: false, + HTMLBodyElement: false, + HTMLBRElement: false, + HTMLButtonElement: false, + HTMLCanvasElement: false, + HTMLCollection: false, + HTMLContentElement: false, + HTMLDataElement: false, + HTMLDataListElement: false, + HTMLDetailsElement: false, + HTMLDialogElement: false, + HTMLDirectoryElement: false, + HTMLDivElement: false, + HTMLDListElement: false, + HTMLDocument: false, + HTMLElement: false, + HTMLEmbedElement: false, + HTMLFieldSetElement: false, + HTMLFontElement: false, + HTMLFormControlsCollection: false, + HTMLFormElement: false, + HTMLFrameElement: false, + HTMLFrameSetElement: false, + HTMLHeadElement: false, + HTMLHeadingElement: false, + HTMLHRElement: false, + HTMLHtmlElement: false, + HTMLIFrameElement: false, + HTMLImageElement: false, + HTMLInputElement: false, + HTMLLabelElement: false, + HTMLLegendElement: false, + HTMLLIElement: false, + HTMLLinkElement: false, + HTMLMapElement: false, + HTMLMarqueeElement: false, + HTMLMediaElement: false, + HTMLMenuElement: false, + HTMLMetaElement: false, + HTMLMeterElement: false, + HTMLModElement: false, + HTMLObjectElement: false, + HTMLOListElement: false, + HTMLOptGroupElement: false, + HTMLOptionElement: false, + HTMLOptionsCollection: false, + HTMLOutputElement: false, + HTMLParagraphElement: false, + HTMLParamElement: false, + HTMLPictureElement: false, + HTMLPreElement: false, + HTMLProgressElement: false, + HTMLQuoteElement: false, + HTMLScriptElement: false, + HTMLSelectElement: false, + HTMLShadowElement: false, + HTMLSlotElement: false, + HTMLSourceElement: false, + HTMLSpanElement: false, + HTMLStyleElement: false, + HTMLTableCaptionElement: false, + HTMLTableCellElement: false, + HTMLTableColElement: false, + HTMLTableElement: false, + HTMLTableRowElement: false, + HTMLTableSectionElement: false, + HTMLTemplateElement: false, + HTMLTextAreaElement: false, + HTMLTimeElement: false, + HTMLTitleElement: false, + HTMLTrackElement: false, + HTMLUListElement: false, + HTMLUnknownElement: false, + HTMLVideoElement: false, + IDBCursor: false, + IDBCursorWithValue: false, + IDBDatabase: false, + IDBFactory: false, + IDBIndex: false, + IDBKeyRange: false, + IDBObjectStore: false, + IDBOpenDBRequest: false, + IDBRequest: false, + IDBTransaction: false, + IDBVersionChangeEvent: false, + IdleDeadline: false, + IIRFilterNode: false, + Image: false, + ImageBitmap: false, + ImageBitmapRenderingContext: false, + ImageCapture: false, + ImageData: false, + indexedDB: false, + innerHeight: false, + innerWidth: false, + InputEvent: false, + IntersectionObserver: false, + IntersectionObserverEntry: false, + "Intl": false, + isSecureContext: false, + KeyboardEvent: false, + KeyframeEffect: false, + KeyframeEffectReadOnly: false, + length: false, + localStorage: false, + location: true, + Location: false, + locationbar: false, + matchMedia: false, + MediaDeviceInfo: false, + MediaDevices: false, + MediaElementAudioSourceNode: false, + MediaEncryptedEvent: false, + MediaError: false, + MediaKeyMessageEvent: false, + MediaKeySession: false, + MediaKeyStatusMap: false, + MediaKeySystemAccess: false, + MediaList: false, + MediaQueryList: false, + MediaQueryListEvent: false, + MediaRecorder: false, + MediaSettingsRange: false, + MediaSource: false, + MediaStream: false, + MediaStreamAudioDestinationNode: false, + MediaStreamAudioSourceNode: false, + MediaStreamEvent: false, + MediaStreamTrack: false, + MediaStreamTrackEvent: false, + menubar: false, + MessageChannel: false, + MessageEvent: false, + MessagePort: false, + MIDIAccess: false, + MIDIConnectionEvent: false, + MIDIInput: false, + MIDIInputMap: false, + MIDIMessageEvent: false, + MIDIOutput: false, + MIDIOutputMap: false, + MIDIPort: false, + MimeType: false, + MimeTypeArray: false, + MouseEvent: false, + moveBy: false, + moveTo: false, + MutationEvent: false, + MutationObserver: false, + MutationRecord: false, + name: false, + NamedNodeMap: false, + NavigationPreloadManager: false, + navigator: false, + Navigator: false, + NetworkInformation: false, + Node: false, + NodeFilter: false, + NodeIterator: false, + NodeList: false, + Notification: false, + OfflineAudioCompletionEvent: false, + OfflineAudioContext: false, + offscreenBuffering: false, + OffscreenCanvas: true, + onabort: true, + onafterprint: true, + onanimationend: true, + onanimationiteration: true, + onanimationstart: true, + onappinstalled: true, + onauxclick: true, + onbeforeinstallprompt: true, + onbeforeprint: true, + onbeforeunload: true, + onblur: true, + oncancel: true, + oncanplay: true, + oncanplaythrough: true, + onchange: true, + onclick: true, + onclose: true, + oncontextmenu: true, + oncuechange: true, + ondblclick: true, + ondevicemotion: true, + ondeviceorientation: true, + ondeviceorientationabsolute: true, + ondrag: true, + ondragend: true, + ondragenter: true, + ondragleave: true, + ondragover: true, + ondragstart: true, + ondrop: true, + ondurationchange: true, + onemptied: true, + onended: true, + onerror: true, + onfocus: true, + ongotpointercapture: true, + onhashchange: true, + oninput: true, + oninvalid: true, + onkeydown: true, + onkeypress: true, + onkeyup: true, + onlanguagechange: true, + onload: true, + onloadeddata: true, + onloadedmetadata: true, + onloadstart: true, + onlostpointercapture: true, + onmessage: true, + onmessageerror: true, + onmousedown: true, + onmouseenter: true, + onmouseleave: true, + onmousemove: true, + onmouseout: true, + onmouseover: true, + onmouseup: true, + onmousewheel: true, + onoffline: true, + ononline: true, + onpagehide: true, + onpageshow: true, + onpause: true, + onplay: true, + onplaying: true, + onpointercancel: true, + onpointerdown: true, + onpointerenter: true, + onpointerleave: true, + onpointermove: true, + onpointerout: true, + onpointerover: true, + onpointerup: true, + onpopstate: true, + onprogress: true, + onratechange: true, + onrejectionhandled: true, + onreset: true, + onresize: true, + onscroll: true, + onsearch: true, + onseeked: true, + onseeking: true, + onselect: true, + onstalled: true, + onstorage: true, + onsubmit: true, + onsuspend: true, + ontimeupdate: true, + ontoggle: true, + ontransitionend: true, + onunhandledrejection: true, + onunload: true, + onvolumechange: true, + onwaiting: true, + onwheel: true, + open: false, + openDatabase: false, + opener: false, + Option: false, + origin: false, + OscillatorNode: false, + outerHeight: false, + outerWidth: false, + PageTransitionEvent: false, + pageXOffset: false, + pageYOffset: false, + PannerNode: false, + parent: false, + Path2D: false, + PaymentAddress: false, + PaymentRequest: false, + PaymentRequestUpdateEvent: false, + PaymentResponse: false, + performance: false, + Performance: false, + PerformanceEntry: false, + PerformanceLongTaskTiming: false, + PerformanceMark: false, + PerformanceMeasure: false, + PerformanceNavigation: false, + PerformanceNavigationTiming: false, + PerformanceObserver: false, + PerformanceObserverEntryList: false, + PerformancePaintTiming: false, + PerformanceResourceTiming: false, + PerformanceTiming: false, + PeriodicWave: false, + Permissions: false, + PermissionStatus: false, + personalbar: false, + PhotoCapabilities: false, + Plugin: false, + PluginArray: false, + PointerEvent: false, + PopStateEvent: false, + postMessage: false, + Presentation: false, + PresentationAvailability: false, + PresentationConnection: false, + PresentationConnectionAvailableEvent: false, + PresentationConnectionCloseEvent: false, + PresentationConnectionList: false, + PresentationReceiver: false, + PresentationRequest: false, + print: false, + ProcessingInstruction: false, + ProgressEvent: false, + PromiseRejectionEvent: false, + prompt: false, + PushManager: false, + PushSubscription: false, + PushSubscriptionOptions: false, + queueMicrotask: false, + RadioNodeList: false, + Range: false, + ReadableStream: false, + registerProcessor: false, + RemotePlayback: false, + removeEventListener: false, + Request: false, + requestAnimationFrame: false, + requestIdleCallback: false, + resizeBy: false, + ResizeObserver: false, + ResizeObserverEntry: false, + resizeTo: false, + Response: false, + RTCCertificate: false, + RTCDataChannel: false, + RTCDataChannelEvent: false, + RTCDtlsTransport: false, + RTCIceCandidate: false, + RTCIceGatherer: false, + RTCIceTransport: false, + RTCPeerConnection: false, + RTCPeerConnectionIceEvent: false, + RTCRtpContributingSource: false, + RTCRtpReceiver: false, + RTCRtpSender: false, + RTCSctpTransport: false, + RTCSessionDescription: false, + RTCStatsReport: false, + RTCTrackEvent: false, + screen: false, + Screen: false, + screenLeft: false, + ScreenOrientation: false, + screenTop: false, + screenX: false, + screenY: false, + ScriptProcessorNode: false, + scroll: false, + scrollbars: false, + scrollBy: false, + scrollTo: false, + scrollX: false, + scrollY: false, + SecurityPolicyViolationEvent: false, + Selection: false, + self: false, + ServiceWorker: false, + ServiceWorkerContainer: false, + ServiceWorkerRegistration: false, + sessionStorage: false, + setInterval: false, + setTimeout: false, + ShadowRoot: false, + SharedWorker: false, + SourceBuffer: false, + SourceBufferList: false, + speechSynthesis: false, + SpeechSynthesisEvent: false, + SpeechSynthesisUtterance: false, + StaticRange: false, + status: false, + statusbar: false, + StereoPannerNode: false, + stop: false, + Storage: false, + StorageEvent: false, + StorageManager: false, + styleMedia: false, + StyleSheet: false, + StyleSheetList: false, + SubtleCrypto: false, + SVGAElement: false, + SVGAngle: false, + SVGAnimatedAngle: false, + SVGAnimatedBoolean: false, + SVGAnimatedEnumeration: false, + SVGAnimatedInteger: false, + SVGAnimatedLength: false, + SVGAnimatedLengthList: false, + SVGAnimatedNumber: false, + SVGAnimatedNumberList: false, + SVGAnimatedPreserveAspectRatio: false, + SVGAnimatedRect: false, + SVGAnimatedString: false, + SVGAnimatedTransformList: false, + SVGAnimateElement: false, + SVGAnimateMotionElement: false, + SVGAnimateTransformElement: false, + SVGAnimationElement: false, + SVGCircleElement: false, + SVGClipPathElement: false, + SVGComponentTransferFunctionElement: false, + SVGDefsElement: false, + SVGDescElement: false, + SVGDiscardElement: false, + SVGElement: false, + SVGEllipseElement: false, + SVGFEBlendElement: false, + SVGFEColorMatrixElement: false, + SVGFEComponentTransferElement: false, + SVGFECompositeElement: false, + SVGFEConvolveMatrixElement: false, + SVGFEDiffuseLightingElement: false, + SVGFEDisplacementMapElement: false, + SVGFEDistantLightElement: false, + SVGFEDropShadowElement: false, + SVGFEFloodElement: false, + SVGFEFuncAElement: false, + SVGFEFuncBElement: false, + SVGFEFuncGElement: false, + SVGFEFuncRElement: false, + SVGFEGaussianBlurElement: false, + SVGFEImageElement: false, + SVGFEMergeElement: false, + SVGFEMergeNodeElement: false, + SVGFEMorphologyElement: false, + SVGFEOffsetElement: false, + SVGFEPointLightElement: false, + SVGFESpecularLightingElement: false, + SVGFESpotLightElement: false, + SVGFETileElement: false, + SVGFETurbulenceElement: false, + SVGFilterElement: false, + SVGForeignObjectElement: false, + SVGGElement: false, + SVGGeometryElement: false, + SVGGradientElement: false, + SVGGraphicsElement: false, + SVGImageElement: false, + SVGLength: false, + SVGLengthList: false, + SVGLinearGradientElement: false, + SVGLineElement: false, + SVGMarkerElement: false, + SVGMaskElement: false, + SVGMatrix: false, + SVGMetadataElement: false, + SVGMPathElement: false, + SVGNumber: false, + SVGNumberList: false, + SVGPathElement: false, + SVGPatternElement: false, + SVGPoint: false, + SVGPointList: false, + SVGPolygonElement: false, + SVGPolylineElement: false, + SVGPreserveAspectRatio: false, + SVGRadialGradientElement: false, + SVGRect: false, + SVGRectElement: false, + SVGScriptElement: false, + SVGSetElement: false, + SVGStopElement: false, + SVGStringList: false, + SVGStyleElement: false, + SVGSVGElement: false, + SVGSwitchElement: false, + SVGSymbolElement: false, + SVGTextContentElement: false, + SVGTextElement: false, + SVGTextPathElement: false, + SVGTextPositioningElement: false, + SVGTitleElement: false, + SVGTransform: false, + SVGTransformList: false, + SVGTSpanElement: false, + SVGUnitTypes: false, + SVGUseElement: false, + SVGViewElement: false, + TaskAttributionTiming: false, + Text: false, + TextDecoder: false, + TextEncoder: false, + TextEvent: false, + TextMetrics: false, + TextTrack: false, + TextTrackCue: false, + TextTrackCueList: false, + TextTrackList: false, + TimeRanges: false, + toolbar: false, + top: false, + Touch: false, + TouchEvent: false, + TouchList: false, + TrackEvent: false, + TransitionEvent: false, + TreeWalker: false, + UIEvent: false, + URL: false, + URLSearchParams: false, + ValidityState: false, + visualViewport: false, + VisualViewport: false, + VTTCue: false, + WaveShaperNode: false, + WebAssembly: false, + WebGL2RenderingContext: false, + WebGLActiveInfo: false, + WebGLBuffer: false, + WebGLContextEvent: false, + WebGLFramebuffer: false, + WebGLProgram: false, + WebGLQuery: false, + WebGLRenderbuffer: false, + WebGLRenderingContext: false, + WebGLSampler: false, + WebGLShader: false, + WebGLShaderPrecisionFormat: false, + WebGLSync: false, + WebGLTexture: false, + WebGLTransformFeedback: false, + WebGLUniformLocation: false, + WebGLVertexArrayObject: false, + WebSocket: false, + WheelEvent: false, + window: false, + Window: false, + Worker: false, + WritableStream: false, + XMLDocument: false, + XMLHttpRequest: false, + XMLHttpRequestEventTarget: false, + XMLHttpRequestUpload: false, + XMLSerializer: false, + XPathEvaluator: false, + XPathExpression: false, + XPathResult: false, + XSLTProcessor: false + }; + var worker = { + addEventListener: false, + applicationCache: false, + atob: false, + Blob: false, + BroadcastChannel: false, + btoa: false, + Cache: false, + caches: false, + clearInterval: false, + clearTimeout: false, + close: true, + console: false, + fetch: false, + FileReaderSync: false, + FormData: false, + Headers: false, + IDBCursor: false, + IDBCursorWithValue: false, + IDBDatabase: false, + IDBFactory: false, + IDBIndex: false, + IDBKeyRange: false, + IDBObjectStore: false, + IDBOpenDBRequest: false, + IDBRequest: false, + IDBTransaction: false, + IDBVersionChangeEvent: false, + ImageData: false, + importScripts: true, + indexedDB: false, + location: false, + MessageChannel: false, + MessagePort: false, + name: false, + navigator: false, + Notification: false, + onclose: true, + onconnect: true, + onerror: true, + onlanguagechange: true, + onmessage: true, + onoffline: true, + ononline: true, + onrejectionhandled: true, + onunhandledrejection: true, + performance: false, + Performance: false, + PerformanceEntry: false, + PerformanceMark: false, + PerformanceMeasure: false, + PerformanceNavigation: false, + PerformanceResourceTiming: false, + PerformanceTiming: false, + postMessage: true, + "Promise": false, + queueMicrotask: false, + removeEventListener: false, + Request: false, + Response: false, + self: true, + ServiceWorkerRegistration: false, + setInterval: false, + setTimeout: false, + TextDecoder: false, + TextEncoder: false, + URL: false, + URLSearchParams: false, + WebSocket: false, + Worker: false, + WorkerGlobalScope: false, + XMLHttpRequest: false + }; + var node$1 = { + __dirname: false, + __filename: false, + Buffer: false, + clearImmediate: false, + clearInterval: false, + clearTimeout: false, + console: false, + exports: true, + global: false, + "Intl": false, + module: false, + process: false, + queueMicrotask: false, + require: false, + setImmediate: false, + setInterval: false, + setTimeout: false, + TextDecoder: false, + TextEncoder: false, + URL: false, + URLSearchParams: false + }; + var commonjs = { + exports: true, + global: false, + module: false, + require: false + }; + var amd = { + define: false, + require: false + }; + var mocha = { + after: false, + afterEach: false, + before: false, + beforeEach: false, + context: false, + describe: false, + it: false, + mocha: false, + run: false, + setup: false, + specify: false, + suite: false, + suiteSetup: false, + suiteTeardown: false, + teardown: false, + test: false, + xcontext: false, + xdescribe: false, + xit: false, + xspecify: false + }; + var jasmine = { + afterAll: false, + afterEach: false, + beforeAll: false, + beforeEach: false, + describe: false, + expect: false, + fail: false, + fdescribe: false, + fit: false, + it: false, + jasmine: false, + pending: false, + runs: false, + spyOn: false, + spyOnProperty: false, + waits: false, + waitsFor: false, + xdescribe: false, + xit: false + }; + var jest = { + afterAll: false, + afterEach: false, + beforeAll: false, + beforeEach: false, + describe: false, + expect: false, + fdescribe: false, + fit: false, + it: false, + jest: false, + pit: false, + require: false, + test: false, + xdescribe: false, + xit: false, + xtest: false + }; + var qunit = { + asyncTest: false, + deepEqual: false, + equal: false, + expect: false, + module: false, + notDeepEqual: false, + notEqual: false, + notOk: false, + notPropEqual: false, + notStrictEqual: false, + ok: false, + propEqual: false, + QUnit: false, + raises: false, + start: false, + stop: false, + strictEqual: false, + test: false, + throws: false + }; + var phantomjs = { + console: true, + exports: true, + phantom: true, + require: true, + WebPage: true + }; + var couch = { + emit: false, + exports: false, + getRow: false, + log: false, + module: false, + provides: false, + require: false, + respond: false, + send: false, + start: false, + sum: false + }; + var rhino = { + defineClass: false, + deserialize: false, + gc: false, + help: false, + importClass: false, + importPackage: false, + java: false, + load: false, + loadClass: false, + Packages: false, + print: false, + quit: false, + readFile: false, + readUrl: false, + runCommand: false, + seal: false, + serialize: false, + spawn: false, + sync: false, + toint32: false, + version: false + }; + var nashorn = { + __DIR__: false, + __FILE__: false, + __LINE__: false, + com: false, + edu: false, + exit: false, + java: false, + Java: false, + javafx: false, + JavaImporter: false, + javax: false, + JSAdapter: false, + load: false, + loadWithNewGlobal: false, + org: false, + Packages: false, + print: false, + quit: false + }; + var wsh = { + ActiveXObject: true, + Enumerator: true, + GetObject: true, + ScriptEngine: true, + ScriptEngineBuildVersion: true, + ScriptEngineMajorVersion: true, + ScriptEngineMinorVersion: true, + VBArray: true, + WScript: true, + WSH: true, + XDomainRequest: true + }; + var jquery = { + $: false, + jQuery: false + }; + var yui = { + YAHOO: false, + YAHOO_config: false, + YUI: false, + YUI_config: false + }; + var shelljs = { + cat: false, + cd: false, + chmod: false, + config: false, + cp: false, + dirs: false, + echo: false, + env: false, + error: false, + exec: false, + exit: false, + find: false, + grep: false, + ln: false, + ls: false, + mkdir: false, + mv: false, + popd: false, + pushd: false, + pwd: false, + rm: false, + sed: false, + set: false, + target: false, + tempdir: false, + test: false, + touch: false, + which: false + }; + var prototypejs = { + $: false, + $$: false, + $A: false, + $break: false, + $continue: false, + $F: false, + $H: false, + $R: false, + $w: false, + Abstract: false, + Ajax: false, + Autocompleter: false, + Builder: false, + Class: false, + Control: false, + Draggable: false, + Draggables: false, + Droppables: false, + Effect: false, + Element: false, + Enumerable: false, + Event: false, + Field: false, + Form: false, + Hash: false, + Insertion: false, + ObjectRange: false, + PeriodicalExecuter: false, + Position: false, + Prototype: false, + Scriptaculous: false, + Selector: false, + Sortable: false, + SortableObserver: false, + Sound: false, + Template: false, + Toggle: false, + Try: false + }; + var meteor = { + _: false, + $: false, + Accounts: false, + AccountsClient: false, + AccountsCommon: false, + AccountsServer: false, + App: false, + Assets: false, + Blaze: false, + check: false, + Cordova: false, + DDP: false, + DDPRateLimiter: false, + DDPServer: false, + Deps: false, + EJSON: false, + Email: false, + HTTP: false, + Log: false, + Match: false, + Meteor: false, + Mongo: false, + MongoInternals: false, + Npm: false, + Package: false, + Plugin: false, + process: false, + Random: false, + ReactiveDict: false, + ReactiveVar: false, + Router: false, + ServiceConfiguration: false, + Session: false, + share: false, + Spacebars: false, + Template: false, + Tinytest: false, + Tracker: false, + UI: false, + Utils: false, + WebApp: false, + WebAppInternals: false + }; + var mongo = { + _isWindows: false, + _rand: false, + BulkWriteResult: false, + cat: false, + cd: false, + connect: false, + db: false, + getHostName: false, + getMemInfo: false, + hostname: false, + ISODate: false, + listFiles: false, + load: false, + ls: false, + md5sumFile: false, + mkdir: false, + Mongo: false, + NumberInt: false, + NumberLong: false, + ObjectId: false, + PlanCache: false, + print: false, + printjson: false, + pwd: false, + quit: false, + removeFile: false, + rs: false, + sh: false, + UUID: false, + version: false, + WriteResult: false + }; + var applescript = { + $: false, + Application: false, + Automation: false, + console: false, + delay: false, + Library: false, + ObjC: false, + ObjectSpecifier: false, + Path: false, + Progress: false, + Ref: false + }; + var serviceworker = { + addEventListener: false, + applicationCache: false, + atob: false, + Blob: false, + BroadcastChannel: false, + btoa: false, + Cache: false, + caches: false, + CacheStorage: false, + clearInterval: false, + clearTimeout: false, + Client: false, + clients: false, + Clients: false, + close: true, + console: false, + ExtendableEvent: false, + ExtendableMessageEvent: false, + fetch: false, + FetchEvent: false, + FileReaderSync: false, + FormData: false, + Headers: false, + IDBCursor: false, + IDBCursorWithValue: false, + IDBDatabase: false, + IDBFactory: false, + IDBIndex: false, + IDBKeyRange: false, + IDBObjectStore: false, + IDBOpenDBRequest: false, + IDBRequest: false, + IDBTransaction: false, + IDBVersionChangeEvent: false, + ImageData: false, + importScripts: false, + indexedDB: false, + location: false, + MessageChannel: false, + MessagePort: false, + name: false, + navigator: false, + Notification: false, + onclose: true, + onconnect: true, + onerror: true, + onfetch: true, + oninstall: true, + onlanguagechange: true, + onmessage: true, + onmessageerror: true, + onnotificationclick: true, + onnotificationclose: true, + onoffline: true, + ononline: true, + onpush: true, + onpushsubscriptionchange: true, + onrejectionhandled: true, + onsync: true, + onunhandledrejection: true, + performance: false, + Performance: false, + PerformanceEntry: false, + PerformanceMark: false, + PerformanceMeasure: false, + PerformanceNavigation: false, + PerformanceResourceTiming: false, + PerformanceTiming: false, + postMessage: true, + "Promise": false, + queueMicrotask: false, + registration: false, + removeEventListener: false, + Request: false, + Response: false, + self: false, + ServiceWorker: false, + ServiceWorkerContainer: false, + ServiceWorkerGlobalScope: false, + ServiceWorkerMessageEvent: false, + ServiceWorkerRegistration: false, + setInterval: false, + setTimeout: false, + skipWaiting: false, + TextDecoder: false, + TextEncoder: false, + URL: false, + URLSearchParams: false, + WebSocket: false, + WindowClient: false, + Worker: false, + WorkerGlobalScope: false, + XMLHttpRequest: false + }; + var atomtest = { + advanceClock: false, + fakeClearInterval: false, + fakeClearTimeout: false, + fakeSetInterval: false, + fakeSetTimeout: false, + resetTimeouts: false, + waitsForPromise: false + }; + var embertest = { + andThen: false, + click: false, + currentPath: false, + currentRouteName: false, + currentURL: false, + fillIn: false, + find: false, + findAll: false, + findWithAssert: false, + keyEvent: false, + pauseTest: false, + resumeTest: false, + triggerEvent: false, + visit: false, + wait: false + }; + var protractor = { + $: false, + $$: false, + browser: false, + by: false, + By: false, + DartObject: false, + element: false, + protractor: false + }; + var webextensions = { + browser: false, + chrome: false, + opr: false + }; + var greasemonkey = { + cloneInto: false, + createObjectIn: false, + exportFunction: false, + GM: false, + GM_addStyle: false, + GM_deleteValue: false, + GM_getResourceText: false, + GM_getResourceURL: false, + GM_getValue: false, + GM_info: false, + GM_listValues: false, + GM_log: false, + GM_openInTab: false, + GM_registerMenuCommand: false, + GM_setClipboard: false, + GM_setValue: false, + GM_xmlhttpRequest: false, + unsafeWindow: false + }; + var devtools = { + $: false, + $_: false, + $$: false, + $0: false, + $1: false, + $2: false, + $3: false, + $4: false, + $x: false, + chrome: false, + clear: false, + copy: false, + debug: false, + dir: false, + dirxml: false, + getEventListeners: false, + inspect: false, + keys: false, + monitor: false, + monitorEvents: false, + profile: false, + profileEnd: false, + queryObjects: false, + table: false, + undebug: false, + unmonitor: false, + unmonitorEvents: false, + values: false + }; + var require$$0$a = { + builtin: builtin, + es5: es5, + es2015: es2015, + es2017: es2017, + browser: browser$2, + worker: worker, + node: node$1, + commonjs: commonjs, + amd: amd, + mocha: mocha, + jasmine: jasmine, + jest: jest, + qunit: qunit, + phantomjs: phantomjs, + couch: couch, + rhino: rhino, + nashorn: nashorn, + wsh: wsh, + jquery: jquery, + yui: yui, + shelljs: shelljs, + prototypejs: prototypejs, + meteor: meteor, + mongo: mongo, + applescript: applescript, + serviceworker: serviceworker, + atomtest: atomtest, + embertest: embertest, + protractor: protractor, + "shared-node-browser": { + clearInterval: false, + clearTimeout: false, + console: false, + setInterval: false, + setTimeout: false, + URL: false, + URLSearchParams: false + }, + webextensions: webextensions, + greasemonkey: greasemonkey, + devtools: devtools + }; + + var globalsBABEL_8_BREAKINGFalse; + var hasRequiredGlobalsBABEL_8_BREAKINGFalse; + function requireGlobalsBABEL_8_BREAKINGFalse() { + if (hasRequiredGlobalsBABEL_8_BREAKINGFalse) return globalsBABEL_8_BREAKINGFalse; + hasRequiredGlobalsBABEL_8_BREAKINGFalse = 1; + globalsBABEL_8_BREAKINGFalse = require$$0$a; + return globalsBABEL_8_BREAKINGFalse; + } + + function bool$c(value) { + if (value == null) return false; + return value && value !== "false" && value !== "0"; + } + var globals$1 = bool$c(browser$1$1.env["BABEL_8_BREAKING"]) ? requireGlobalsBABEL_8_BREAKINGFalse() : requireGlobalsBABEL_8_BREAKINGFalse(); + + var NOT_LOCAL_BINDING$1 = NOT_LOCAL_BINDING$2, + callExpression$d = callExpression$e, + cloneNode$h = cloneNode$j, + getBindingIdentifiers$1 = getBindingIdentifiers$2, + identifier$g = identifier$i, + isArrayExpression$1 = isArrayExpression$2, + isBinary$2 = isBinary$3, + isClass$1 = isClass$2, + isClassBody$1 = isClassBody$2, + isClassDeclaration$1 = isClassDeclaration$2, + isExportAllDeclaration = isExportAllDeclaration$1, + isExportDefaultDeclaration$2 = isExportDefaultDeclaration$3, + isExportNamedDeclaration$2 = isExportNamedDeclaration$3, + isFunctionDeclaration$1 = isFunctionDeclaration$2, + isIdentifier$i = isIdentifier$j, + isImportDeclaration$1 = isImportDeclaration$2, + isLiteral$5 = isLiteral$6, + isMethod = isMethod$1, + isModuleSpecifier = isModuleSpecifier$1, + isNullLiteral$1 = isNullLiteral$2, + isObjectExpression$2 = isObjectExpression$3, + isProperty = isProperty$1, + isPureish$1 = isPureish$2, + isRegExpLiteral$1 = isRegExpLiteral$2, + isSuper$2 = isSuper$3, + isTaggedTemplateExpression$1 = isTaggedTemplateExpression$2, + isTemplateLiteral$1 = isTemplateLiteral$2, + isThisExpression$1 = isThisExpression$2, + isUnaryExpression = isUnaryExpression$1, + isVariableDeclaration$2 = isVariableDeclaration$3, + matchesPattern$1 = matchesPattern$2, + memberExpression$b = memberExpression$c, + numericLiteral$7 = numericLiteral$8, + toIdentifier = toIdentifier$1, + unaryExpression$6 = unaryExpression$7, + variableDeclaration$6 = variableDeclaration$8, + variableDeclarator$6 = variableDeclarator$8, + isRecordExpression = isRecordExpression$1, + isTupleExpression = isTupleExpression$1, + isObjectProperty$4 = isObjectProperty$5, + isTopicReference = isTopicReference$1, + isMetaProperty = isMetaProperty$1, + isPrivateName$2 = isPrivateName$3, + isExportDeclaration$2 = isExportDeclaration$3; + function gatherNodeParts(node, parts) { + switch (node == null ? void 0 : node.type) { + default: + if (isImportDeclaration$1(node) || isExportDeclaration$2(node)) { + var _node$specifiers; + if ((isExportAllDeclaration(node) || isExportNamedDeclaration$2(node) || isImportDeclaration$1(node)) && node.source) { + gatherNodeParts(node.source, parts); + } else if ((isExportNamedDeclaration$2(node) || isImportDeclaration$1(node)) && (_node$specifiers = node.specifiers) != null && _node$specifiers.length) { + for (var _iterator = _createForOfIteratorHelperLoose(node.specifiers), _step; !(_step = _iterator()).done;) { + var e = _step.value; + gatherNodeParts(e, parts); + } + } else if ((isExportDefaultDeclaration$2(node) || isExportNamedDeclaration$2(node)) && node.declaration) { + gatherNodeParts(node.declaration, parts); + } + } else if (isModuleSpecifier(node)) { + gatherNodeParts(node.local, parts); + } else if (isLiteral$5(node) && !isNullLiteral$1(node) && !isRegExpLiteral$1(node) && !isTemplateLiteral$1(node)) { + parts.push(node.value); + } + break; + case "MemberExpression": + case "OptionalMemberExpression": + case "JSXMemberExpression": + gatherNodeParts(node.object, parts); + gatherNodeParts(node.property, parts); + break; + case "Identifier": + case "JSXIdentifier": + parts.push(node.name); + break; + case "CallExpression": + case "OptionalCallExpression": + case "NewExpression": + gatherNodeParts(node.callee, parts); + break; + case "ObjectExpression": + case "ObjectPattern": + for (var _iterator2 = _createForOfIteratorHelperLoose(node.properties), _step2; !(_step2 = _iterator2()).done;) { + var _e = _step2.value; + gatherNodeParts(_e, parts); + } + break; + case "SpreadElement": + case "RestElement": + gatherNodeParts(node.argument, parts); + break; + case "ObjectProperty": + case "ObjectMethod": + case "ClassProperty": + case "ClassMethod": + case "ClassPrivateProperty": + case "ClassPrivateMethod": + gatherNodeParts(node.key, parts); + break; + case "ThisExpression": + parts.push("this"); + break; + case "Super": + parts.push("super"); + break; + case "Import": + parts.push("import"); + break; + case "DoExpression": + parts.push("do"); + break; + case "YieldExpression": + parts.push("yield"); + gatherNodeParts(node.argument, parts); + break; + case "AwaitExpression": + parts.push("await"); + gatherNodeParts(node.argument, parts); + break; + case "AssignmentExpression": + gatherNodeParts(node.left, parts); + break; + case "VariableDeclarator": + gatherNodeParts(node.id, parts); + break; + case "FunctionExpression": + case "FunctionDeclaration": + case "ClassExpression": + case "ClassDeclaration": + gatherNodeParts(node.id, parts); + break; + case "PrivateName": + gatherNodeParts(node.id, parts); + break; + case "ParenthesizedExpression": + gatherNodeParts(node.expression, parts); + break; + case "UnaryExpression": + case "UpdateExpression": + gatherNodeParts(node.argument, parts); + break; + case "MetaProperty": + gatherNodeParts(node.meta, parts); + gatherNodeParts(node.property, parts); + break; + case "JSXElement": + gatherNodeParts(node.openingElement, parts); + break; + case "JSXOpeningElement": + gatherNodeParts(node.name, parts); + break; + case "JSXFragment": + gatherNodeParts(node.openingFragment, parts); + break; + case "JSXOpeningFragment": + parts.push("Fragment"); + break; + case "JSXNamespacedName": + gatherNodeParts(node.namespace, parts); + gatherNodeParts(node.name, parts); + break; + } + } + var collectorVisitor = { + ForStatement: function ForStatement(path) { + var declar = path.get("init"); + if (declar.isVar()) { + var scope = path.scope; + var parentScope = scope.getFunctionParent() || scope.getProgramParent(); + parentScope.registerBinding("var", declar); + } + }, + Declaration: function Declaration(path) { + if (path.isBlockScoped()) return; + if (path.isImportDeclaration()) return; + if (path.isExportDeclaration()) return; + var parent = path.scope.getFunctionParent() || path.scope.getProgramParent(); + parent.registerDeclaration(path); + }, + ImportDeclaration: function ImportDeclaration(path) { + var parent = path.scope.getBlockParent(); + parent.registerDeclaration(path); + }, + ReferencedIdentifier: function ReferencedIdentifier(path, state) { + state.references.push(path); + }, + ForXStatement: function ForXStatement(path, state) { + var left = path.get("left"); + if (left.isPattern() || left.isIdentifier()) { + state.constantViolations.push(path); + } else if (left.isVar()) { + var scope = path.scope; + var parentScope = scope.getFunctionParent() || scope.getProgramParent(); + parentScope.registerBinding("var", left); + } + }, + ExportDeclaration: { + exit: function exit(path) { + var node = path.node, + scope = path.scope; + if (isExportAllDeclaration(node)) return; + var declar = node.declaration; + if (isClassDeclaration$1(declar) || isFunctionDeclaration$1(declar)) { + var id = declar.id; + if (!id) return; + var binding = scope.getBinding(id.name); + binding == null ? void 0 : binding.reference(path); + } else if (isVariableDeclaration$2(declar)) { + for (var _iterator3 = _createForOfIteratorHelperLoose(declar.declarations), _step3; !(_step3 = _iterator3()).done;) { + var decl = _step3.value; + for (var _i = 0, _Object$keys = Object.keys(getBindingIdentifiers$1(decl)); _i < _Object$keys.length; _i++) { + var _name = _Object$keys[_i]; + var _binding = scope.getBinding(_name); + _binding == null ? void 0 : _binding.reference(path); + } + } + } + } + }, + LabeledStatement: function LabeledStatement(path) { + path.scope.getBlockParent().registerDeclaration(path); + }, + AssignmentExpression: function AssignmentExpression(path, state) { + state.assignments.push(path); + }, + UpdateExpression: function UpdateExpression(path, state) { + state.constantViolations.push(path); + }, + UnaryExpression: function UnaryExpression(path, state) { + if (path.node.operator === "delete") { + state.constantViolations.push(path); + } + }, + BlockScoped: function BlockScoped(path) { + var scope = path.scope; + if (scope.path === path) scope = scope.parent; + var parent = scope.getBlockParent(); + parent.registerDeclaration(path); + if (path.isClassDeclaration() && path.node.id) { + var id = path.node.id; + var _name2 = id.name; + path.scope.bindings[_name2] = path.scope.parent.getBinding(_name2); + } + }, + CatchClause: function CatchClause(path) { + path.scope.registerBinding("let", path); + }, + Function: function Function(path) { + var params = path.get("params"); + for (var _iterator4 = _createForOfIteratorHelperLoose(params), _step4; !(_step4 = _iterator4()).done;) { + var param = _step4.value; + path.scope.registerBinding("param", param); + } + if (path.isFunctionExpression() && path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING$1]) { + path.scope.registerBinding("local", path.get("id"), path); + } + }, + ClassExpression: function ClassExpression(path) { + if (path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING$1]) { + path.scope.registerBinding("local", path); + } + } + }; + var uid = 0; + var Scope$1 = function () { + function Scope(path) { + this.uid = void 0; + this.path = void 0; + this.block = void 0; + this.labels = void 0; + this.inited = void 0; + this.bindings = void 0; + this.references = void 0; + this.globals = void 0; + this.uids = void 0; + this.data = void 0; + this.crawling = void 0; + var node = path.node; + var cached = scope.get(node); + if ((cached == null ? void 0 : cached.path) === path) { + return cached; + } + scope.set(node, this); + this.uid = uid++; + this.block = node; + this.path = path; + this.labels = new Map(); + this.inited = false; + } + var _proto = Scope.prototype; + _proto.traverse = function traverse$1(node, opts, state) { + traverse(node, opts, this, state, this.path); + }; + _proto.generateDeclaredUidIdentifier = function generateDeclaredUidIdentifier(name) { + var id = this.generateUidIdentifier(name); + this.push({ + id: id + }); + return cloneNode$h(id); + }; + _proto.generateUidIdentifier = function generateUidIdentifier(name) { + return identifier$g(this.generateUid(name)); + }; + _proto.generateUid = function generateUid(name) { + if (name === void 0) { + name = "temp"; + } + name = toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, ""); + var uid; + var i = 1; + do { + uid = this._generateUid(name, i); + i++; + } while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid)); + var program = this.getProgramParent(); + program.references[uid] = true; + program.uids[uid] = true; + return uid; + }; + _proto._generateUid = function _generateUid(name, i) { + var id = name; + if (i > 1) id += i; + return "_" + id; + }; + _proto.generateUidBasedOnNode = function generateUidBasedOnNode(node, defaultName) { + var parts = []; + gatherNodeParts(node, parts); + var id = parts.join("$"); + id = id.replace(/^_/, "") || defaultName || "ref"; + return this.generateUid(id.slice(0, 20)); + }; + _proto.generateUidIdentifierBasedOnNode = function generateUidIdentifierBasedOnNode(node, defaultName) { + return identifier$g(this.generateUidBasedOnNode(node, defaultName)); + }; + _proto.isStatic = function isStatic(node) { + if (isThisExpression$1(node) || isSuper$2(node) || isTopicReference(node)) { + return true; + } + if (isIdentifier$i(node)) { + var binding = this.getBinding(node.name); + if (binding) { + return binding.constant; + } else { + return this.hasBinding(node.name); + } + } + return false; + }; + _proto.maybeGenerateMemoised = function maybeGenerateMemoised(node, dontPush) { + if (this.isStatic(node)) { + return null; + } else { + var id = this.generateUidIdentifierBasedOnNode(node); + if (!dontPush) { + this.push({ + id: id + }); + return cloneNode$h(id); + } + return id; + } + }; + _proto.checkBlockScopedCollisions = function checkBlockScopedCollisions(local, kind, name, id) { + if (kind === "param") return; + if (local.kind === "local") return; + var duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && kind === "const"; + if (duplicate) { + throw this.hub.buildError(id, "Duplicate declaration \"" + name + "\"", TypeError); + } + }; + _proto.rename = function rename(oldName, newName) { + var binding = this.getBinding(oldName); + if (binding) { + newName || (newName = this.generateUidIdentifier(oldName).name); + var renamer = new Renamer(binding, oldName, newName); + { + renamer.rename(arguments[2]); + } + } + }; + _proto._renameFromMap = function _renameFromMap(map, oldName, newName, value) { + if (map[oldName]) { + map[newName] = value; + map[oldName] = null; + } + }; + _proto.dump = function dump() { + var sep = "-".repeat(60); + console.log(sep); + var scope = this; + do { + console.log("#", scope.block.type); + for (var _i2 = 0, _Object$keys2 = Object.keys(scope.bindings); _i2 < _Object$keys2.length; _i2++) { + var _name3 = _Object$keys2[_i2]; + var binding = scope.bindings[_name3]; + console.log(" -", _name3, { + constant: binding.constant, + references: binding.references, + violations: binding.constantViolations.length, + kind: binding.kind + }); + } + } while (scope = scope.parent); + console.log(sep); + }; + _proto.toArray = function toArray(node, i, arrayLikeIsIterable) { + if (isIdentifier$i(node)) { + var binding = this.getBinding(node.name); + if (binding != null && binding.constant && binding.path.isGenericType("Array")) { + return node; + } + } + if (isArrayExpression$1(node)) { + return node; + } + if (isIdentifier$i(node, { + name: "arguments" + })) { + return callExpression$d(memberExpression$b(memberExpression$b(memberExpression$b(identifier$g("Array"), identifier$g("prototype")), identifier$g("slice")), identifier$g("call")), [node]); + } + var helperName; + var args = [node]; + if (i === true) { + helperName = "toConsumableArray"; + } else if (typeof i === "number") { + args.push(numericLiteral$7(i)); + helperName = "slicedToArray"; + } else { + helperName = "toArray"; + } + if (arrayLikeIsIterable) { + args.unshift(this.hub.addHelper(helperName)); + helperName = "maybeArrayLike"; + } + return callExpression$d(this.hub.addHelper(helperName), args); + }; + _proto.hasLabel = function hasLabel(name) { + return !!this.getLabel(name); + }; + _proto.getLabel = function getLabel(name) { + return this.labels.get(name); + }; + _proto.registerLabel = function registerLabel(path) { + this.labels.set(path.node.label.name, path); + }; + _proto.registerDeclaration = function registerDeclaration(path) { + if (path.isLabeledStatement()) { + this.registerLabel(path); + } else if (path.isFunctionDeclaration()) { + this.registerBinding("hoisted", path.get("id"), path); + } else if (path.isVariableDeclaration()) { + var declarations = path.get("declarations"); + var kind = path.node.kind; + for (var _iterator5 = _createForOfIteratorHelperLoose(declarations), _step5; !(_step5 = _iterator5()).done;) { + var declar = _step5.value; + this.registerBinding(kind === "using" || kind === "await using" ? "const" : kind, declar); + } + } else if (path.isClassDeclaration()) { + if (path.node.declare) return; + this.registerBinding("let", path); + } else if (path.isImportDeclaration()) { + var isTypeDeclaration = path.node.importKind === "type" || path.node.importKind === "typeof"; + var specifiers = path.get("specifiers"); + for (var _iterator6 = _createForOfIteratorHelperLoose(specifiers), _step6; !(_step6 = _iterator6()).done;) { + var specifier = _step6.value; + var isTypeSpecifier = isTypeDeclaration || specifier.isImportSpecifier() && (specifier.node.importKind === "type" || specifier.node.importKind === "typeof"); + this.registerBinding(isTypeSpecifier ? "unknown" : "module", specifier); + } + } else if (path.isExportDeclaration()) { + var _declar = path.get("declaration"); + if (_declar.isClassDeclaration() || _declar.isFunctionDeclaration() || _declar.isVariableDeclaration()) { + this.registerDeclaration(_declar); + } + } else { + this.registerBinding("unknown", path); + } + }; + _proto.buildUndefinedNode = function buildUndefinedNode() { + return unaryExpression$6("void", numericLiteral$7(0), true); + }; + _proto.registerConstantViolation = function registerConstantViolation(path) { + var ids = path.getBindingIdentifiers(); + for (var _i3 = 0, _Object$keys3 = Object.keys(ids); _i3 < _Object$keys3.length; _i3++) { + var _this$getBinding; + var _name4 = _Object$keys3[_i3]; + (_this$getBinding = this.getBinding(_name4)) == null ? void 0 : _this$getBinding.reassign(path); + } + }; + _proto.registerBinding = function registerBinding(kind, path, bindingPath) { + if (bindingPath === void 0) { + bindingPath = path; + } + if (!kind) throw new ReferenceError("no `kind`"); + if (path.isVariableDeclaration()) { + var declarators = path.get("declarations"); + for (var _iterator7 = _createForOfIteratorHelperLoose(declarators), _step7; !(_step7 = _iterator7()).done;) { + var declar = _step7.value; + this.registerBinding(kind, declar); + } + return; + } + var parent = this.getProgramParent(); + var ids = path.getOuterBindingIdentifiers(true); + for (var _i4 = 0, _Object$keys4 = Object.keys(ids); _i4 < _Object$keys4.length; _i4++) { + var _name5 = _Object$keys4[_i4]; + parent.references[_name5] = true; + for (var _iterator8 = _createForOfIteratorHelperLoose(ids[_name5]), _step8; !(_step8 = _iterator8()).done;) { + var id = _step8.value; + var local = this.getOwnBinding(_name5); + if (local) { + if (local.identifier === id) continue; + this.checkBlockScopedCollisions(local, kind, _name5, id); + } + if (local) { + this.registerConstantViolation(bindingPath); + } else { + this.bindings[_name5] = new Binding({ + identifier: id, + scope: this, + path: bindingPath, + kind: kind + }); + } + } + } + }; + _proto.addGlobal = function addGlobal(node) { + this.globals[node.name] = node; + }; + _proto.hasUid = function hasUid(name) { + var scope = this; + do { + if (scope.uids[name]) return true; + } while (scope = scope.parent); + return false; + }; + _proto.hasGlobal = function hasGlobal(name) { + var scope = this; + do { + if (scope.globals[name]) return true; + } while (scope = scope.parent); + return false; + }; + _proto.hasReference = function hasReference(name) { + return !!this.getProgramParent().references[name]; + }; + _proto.isPure = function isPure(node, constantsOnly) { + if (isIdentifier$i(node)) { + var binding = this.getBinding(node.name); + if (!binding) return false; + if (constantsOnly) return binding.constant; + return true; + } else if (isThisExpression$1(node) || isMetaProperty(node) || isTopicReference(node) || isPrivateName$2(node)) { + return true; + } else if (isClass$1(node)) { + var _node$decorators; + if (node.superClass && !this.isPure(node.superClass, constantsOnly)) { + return false; + } + if (((_node$decorators = node.decorators) == null ? void 0 : _node$decorators.length) > 0) { + return false; + } + return this.isPure(node.body, constantsOnly); + } else if (isClassBody$1(node)) { + for (var _iterator9 = _createForOfIteratorHelperLoose(node.body), _step9; !(_step9 = _iterator9()).done;) { + var method = _step9.value; + if (!this.isPure(method, constantsOnly)) return false; + } + return true; + } else if (isBinary$2(node)) { + return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly); + } else if (isArrayExpression$1(node) || isTupleExpression(node)) { + for (var _iterator10 = _createForOfIteratorHelperLoose(node.elements), _step10; !(_step10 = _iterator10()).done;) { + var elem = _step10.value; + if (elem !== null && !this.isPure(elem, constantsOnly)) return false; + } + return true; + } else if (isObjectExpression$2(node) || isRecordExpression(node)) { + for (var _iterator11 = _createForOfIteratorHelperLoose(node.properties), _step11; !(_step11 = _iterator11()).done;) { + var prop = _step11.value; + if (!this.isPure(prop, constantsOnly)) return false; + } + return true; + } else if (isMethod(node)) { + var _node$decorators2; + if (node.computed && !this.isPure(node.key, constantsOnly)) return false; + if (((_node$decorators2 = node.decorators) == null ? void 0 : _node$decorators2.length) > 0) { + return false; + } + return true; + } else if (isProperty(node)) { + var _node$decorators3; + if (node.computed && !this.isPure(node.key, constantsOnly)) return false; + if (((_node$decorators3 = node.decorators) == null ? void 0 : _node$decorators3.length) > 0) { + return false; + } + if (isObjectProperty$4(node) || node["static"]) { + if (node.value !== null && !this.isPure(node.value, constantsOnly)) { + return false; + } + } + return true; + } else if (isUnaryExpression(node)) { + return this.isPure(node.argument, constantsOnly); + } else if (isTaggedTemplateExpression$1(node)) { + return matchesPattern$1(node.tag, "String.raw") && !this.hasBinding("String", true) && this.isPure(node.quasi, constantsOnly); + } else if (isTemplateLiteral$1(node)) { + for (var _iterator12 = _createForOfIteratorHelperLoose(node.expressions), _step12; !(_step12 = _iterator12()).done;) { + var expression = _step12.value; + if (!this.isPure(expression, constantsOnly)) return false; + } + return true; + } else { + return isPureish$1(node); + } + }; + _proto.setData = function setData(key, val) { + return this.data[key] = val; + }; + _proto.getData = function getData(key) { + var scope = this; + do { + var data = scope.data[key]; + if (data != null) return data; + } while (scope = scope.parent); + }; + _proto.removeData = function removeData(key) { + var scope = this; + do { + var data = scope.data[key]; + if (data != null) scope.data[key] = null; + } while (scope = scope.parent); + }; + _proto.init = function init() { + if (!this.inited) { + this.inited = true; + this.crawl(); + } + }; + _proto.crawl = function crawl() { + var path = this.path; + this.references = Object.create(null); + this.bindings = Object.create(null); + this.globals = Object.create(null); + this.uids = Object.create(null); + this.data = Object.create(null); + var programParent = this.getProgramParent(); + if (programParent.crawling) return; + var state = { + references: [], + constantViolations: [], + assignments: [] + }; + this.crawling = true; + if (path.type !== "Program" && isExplodedVisitor(collectorVisitor)) { + for (var _iterator13 = _createForOfIteratorHelperLoose(collectorVisitor.enter), _step13; !(_step13 = _iterator13()).done;) { + var _visit = _step13.value; + _visit.call(state, path, state); + } + var typeVisitors = collectorVisitor[path.type]; + if (typeVisitors) { + for (var _iterator14 = _createForOfIteratorHelperLoose(typeVisitors.enter), _step14; !(_step14 = _iterator14()).done;) { + var visit = _step14.value; + visit.call(state, path, state); + } + } + } + path.traverse(collectorVisitor, state); + this.crawling = false; + for (var _iterator15 = _createForOfIteratorHelperLoose(state.assignments), _step15; !(_step15 = _iterator15()).done;) { + var _path = _step15.value; + var ids = _path.getBindingIdentifiers(); + for (var _i5 = 0, _Object$keys5 = Object.keys(ids); _i5 < _Object$keys5.length; _i5++) { + var _name6 = _Object$keys5[_i5]; + if (_path.scope.getBinding(_name6)) continue; + programParent.addGlobal(ids[_name6]); + } + _path.scope.registerConstantViolation(_path); + } + for (var _iterator16 = _createForOfIteratorHelperLoose(state.references), _step16; !(_step16 = _iterator16()).done;) { + var ref = _step16.value; + var binding = ref.scope.getBinding(ref.node.name); + if (binding) { + binding.reference(ref); + } else { + programParent.addGlobal(ref.node); + } + } + for (var _iterator17 = _createForOfIteratorHelperLoose(state.constantViolations), _step17; !(_step17 = _iterator17()).done;) { + var _path2 = _step17.value; + _path2.scope.registerConstantViolation(_path2); + } + }; + _proto.push = function push(opts) { + var path = this.path; + if (path.isPattern()) { + path = this.getPatternParent().path; + } else if (!path.isBlockStatement() && !path.isProgram()) { + path = this.getBlockParent().path; + } + if (path.isSwitchStatement()) { + path = (this.getFunctionParent() || this.getProgramParent()).path; + } + var init = opts.init, + unique = opts.unique, + _opts$kind = opts.kind, + kind = _opts$kind === void 0 ? "var" : _opts$kind, + id = opts.id; + if (!init && !unique && (kind === "var" || kind === "let") && path.isFunction() && !path.node.name && isCallExpression$8(path.parent, { + callee: path.node + }) && path.parent.arguments.length <= path.node.params.length && isIdentifier$j(id)) { + path.pushContainer("params", id); + path.scope.registerBinding("param", path.get("params")[path.node.params.length - 1]); + return; + } + if (path.isLoop() || path.isCatchClause() || path.isFunction()) { + path.ensureBlock(); + path = path.get("body"); + } + var blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist; + var dataKey = "declaration:" + kind + ":" + blockHoist; + var declarPath = !unique && path.getData(dataKey); + if (!declarPath) { + var declar = variableDeclaration$6(kind, []); + declar._blockHoist = blockHoist; + var _unshiftContainer = path.unshiftContainer("body", [declar]); + var _unshiftContainer2 = _slicedToArray(_unshiftContainer, 1); + declarPath = _unshiftContainer2[0]; + if (!unique) path.setData(dataKey, declarPath); + } + var declarator = variableDeclarator$6(id, init); + var len = declarPath.node.declarations.push(declarator); + path.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]); + }; + _proto.getProgramParent = function getProgramParent() { + var scope = this; + do { + if (scope.path.isProgram()) { + return scope; + } + } while (scope = scope.parent); + throw new Error("Couldn't find a Program"); + }; + _proto.getFunctionParent = function getFunctionParent() { + var scope = this; + do { + if (scope.path.isFunctionParent()) { + return scope; + } + } while (scope = scope.parent); + return null; + }; + _proto.getBlockParent = function getBlockParent() { + var scope = this; + do { + if (scope.path.isBlockParent()) { + return scope; + } + } while (scope = scope.parent); + throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program..."); + }; + _proto.getPatternParent = function getPatternParent() { + var scope = this; + do { + if (!scope.path.isPattern()) { + return scope.getBlockParent(); + } + } while (scope = scope.parent.parent); + throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program..."); + }; + _proto.getAllBindings = function getAllBindings() { + var ids = Object.create(null); + var scope = this; + do { + for (var _i6 = 0, _Object$keys6 = Object.keys(scope.bindings); _i6 < _Object$keys6.length; _i6++) { + var _key = _Object$keys6[_i6]; + if (_key in ids === false) { + ids[_key] = scope.bindings[_key]; + } + } + scope = scope.parent; + } while (scope); + return ids; + }; + _proto.getAllBindingsOfKind = function getAllBindingsOfKind() { + var ids = Object.create(null); + for (var _len = arguments.length, kinds = new Array(_len), _key2 = 0; _key2 < _len; _key2++) { + kinds[_key2] = arguments[_key2]; + } + for (var _i7 = 0, _kinds = kinds; _i7 < _kinds.length; _i7++) { + var kind = _kinds[_i7]; + var scope = this; + do { + for (var _i8 = 0, _Object$keys7 = Object.keys(scope.bindings); _i8 < _Object$keys7.length; _i8++) { + var _name7 = _Object$keys7[_i8]; + var binding = scope.bindings[_name7]; + if (binding.kind === kind) ids[_name7] = binding; + } + scope = scope.parent; + } while (scope); + } + return ids; + }; + _proto.bindingIdentifierEquals = function bindingIdentifierEquals(name, node) { + return this.getBindingIdentifier(name) === node; + }; + _proto.getBinding = function getBinding(name) { + var scope = this; + var previousPath; + do { + var binding = scope.getOwnBinding(name); + if (binding) { + var _previousPath; + if ((_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param" && binding.kind !== "local") ; else { + return binding; + } + } else if (!binding && name === "arguments" && scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) { + break; + } + previousPath = scope.path; + } while (scope = scope.parent); + }; + _proto.getOwnBinding = function getOwnBinding(name) { + return this.bindings[name]; + }; + _proto.getBindingIdentifier = function getBindingIdentifier(name) { + var _this$getBinding2; + return (_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.identifier; + }; + _proto.getOwnBindingIdentifier = function getOwnBindingIdentifier(name) { + var binding = this.bindings[name]; + return binding == null ? void 0 : binding.identifier; + }; + _proto.hasOwnBinding = function hasOwnBinding(name) { + return !!this.getOwnBinding(name); + }; + _proto.hasBinding = function hasBinding(name, opts) { + var _opts, _opts2, _opts3; + if (!name) return false; + if (this.hasOwnBinding(name)) return true; + { + if (typeof opts === "boolean") opts = { + noGlobals: opts + }; + } + if (this.parentHasBinding(name, opts)) return true; + if (!((_opts = opts) != null && _opts.noUids) && this.hasUid(name)) return true; + if (!((_opts2 = opts) != null && _opts2.noGlobals) && Scope.globals.includes(name)) return true; + if (!((_opts3 = opts) != null && _opts3.noGlobals) && Scope.contextVariables.includes(name)) return true; + return false; + }; + _proto.parentHasBinding = function parentHasBinding(name, opts) { + var _this$parent; + return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, opts); + }; + _proto.moveBindingTo = function moveBindingTo(name, scope) { + var info = this.getBinding(name); + if (info) { + info.scope.removeOwnBinding(name); + info.scope = scope; + scope.bindings[name] = info; + } + }; + _proto.removeOwnBinding = function removeOwnBinding(name) { + delete this.bindings[name]; + }; + _proto.removeBinding = function removeBinding(name) { + var _this$getBinding3; + (_this$getBinding3 = this.getBinding(name)) == null ? void 0 : _this$getBinding3.scope.removeOwnBinding(name); + var scope = this; + do { + if (scope.uids[name]) { + scope.uids[name] = false; + } + } while (scope = scope.parent); + }; + _createClass(Scope, [{ + key: "parent", + get: function get() { + var _parent; + var parent, + path = this.path; + do { + var shouldSkip = path.key === "key" || path.listKey === "decorators"; + path = path.parentPath; + if (shouldSkip && path.isMethod()) path = path.parentPath; + if (path && path.isScope()) parent = path; + } while (path && !parent); + return (_parent = parent) == null ? void 0 : _parent.scope; + } + }, { + key: "parentBlock", + get: function get() { + return this.path.parent; + } + }, { + key: "hub", + get: function get() { + return this.path.hub; + } + }]); + return Scope; + }(); + Scope$1.globals = Object.keys(globals$1.builtin); + Scope$1.contextVariables = ["arguments", "undefined", "Infinity", "NaN"]; + + var genMapping_umd$1 = {exports: {}}; + + var setArray_umd = {exports: {}}; + + setArray_umd.exports; + var hasRequiredSetArray_umd; + function requireSetArray_umd() { + if (hasRequiredSetArray_umd) return setArray_umd.exports; + hasRequiredSetArray_umd = 1; + (function (module, exports) { + (function (global, factory) { + factory(exports) ; + })(commonjsGlobal, function (exports) { + exports.get = void 0; + exports.put = void 0; + exports.pop = void 0; + var SetArray = _createClass(function SetArray() { + this._indexes = { + __proto__: null + }; + this.array = []; + }); + (function () { + exports.get = function (strarr, key) { + return strarr._indexes[key]; + }; + exports.put = function (strarr, key) { + var index = exports.get(strarr, key); + if (index !== undefined) return index; + var array = strarr.array, + indexes = strarr._indexes; + return indexes[key] = array.push(key) - 1; + }; + exports.pop = function (strarr) { + var array = strarr.array, + indexes = strarr._indexes; + if (array.length === 0) return; + var last = array.pop(); + indexes[last] = undefined; + }; + })(); + exports.SetArray = SetArray; + Object.defineProperty(exports, '__esModule', { + value: true + }); + }); + })(setArray_umd, setArray_umd.exports); + return setArray_umd.exports; + } + + var lookup = []; + var revLookup = []; + var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; + var inited = false; + function init () { + inited = true; + var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i]; + revLookup[code.charCodeAt(i)] = i; + } + + revLookup['-'.charCodeAt(0)] = 62; + revLookup['_'.charCodeAt(0)] = 63; + } + + function toByteArray (b64) { + if (!inited) { + init(); + } + var i, j, l, tmp, placeHolders, arr; + var len = b64.length; + + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // the number of equal signs (place holders) + // if there are two placeholders, than the two characters before it + // represent one byte + // if there is only one, then the three characters before it represent 2 bytes + // this is just a cheap hack to not do indexOf twice + placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0; + + // base64 is 4/3 + up to two characters of the original data + arr = new Arr(len * 3 / 4 - placeHolders); + + // if there are placeholders, only get up to the last complete 4 chars + l = placeHolders > 0 ? len - 4 : len; + + var L = 0; + + for (i = 0, j = 0; i < l; i += 4, j += 3) { + tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]; + arr[L++] = (tmp >> 16) & 0xFF; + arr[L++] = (tmp >> 8) & 0xFF; + arr[L++] = tmp & 0xFF; + } + + if (placeHolders === 2) { + tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4); + arr[L++] = tmp & 0xFF; + } else if (placeHolders === 1) { + tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2); + arr[L++] = (tmp >> 8) & 0xFF; + arr[L++] = tmp & 0xFF; + } + + return arr + } + + function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] + } + + function encodeChunk (uint8, start, end) { + var tmp; + var output = []; + for (var i = start; i < end; i += 3) { + tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]); + output.push(tripletToBase64(tmp)); + } + return output.join('') + } + + function fromByteArray (uint8) { + if (!inited) { + init(); + } + var tmp; + var len = uint8.length; + var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes + var output = ''; + var parts = []; + var maxChunkLength = 16383; // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))); + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1]; + output += lookup[tmp >> 2]; + output += lookup[(tmp << 4) & 0x3F]; + output += '=='; + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + (uint8[len - 1]); + output += lookup[tmp >> 10]; + output += lookup[(tmp >> 4) & 0x3F]; + output += lookup[(tmp << 2) & 0x3F]; + output += '='; + } + + parts.push(output); + + return parts.join('') + } + + function read (buffer, offset, isLE, mLen, nBytes) { + var e, m; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var nBits = -7; + var i = isLE ? (nBytes - 1) : 0; + var d = isLE ? -1 : 1; + var s = buffer[offset + i]; + + i += d; + + e = s & ((1 << (-nBits)) - 1); + s >>= (-nBits); + nBits += eLen; + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1); + e >>= (-nBits); + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) + } + + function write (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0); + var i = isLE ? 0 : (nBytes - 1); + var d = isLE ? 1 : -1; + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; + + value = Math.abs(value); + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m; + eLen += mLen; + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128; + } + + var toString = {}.toString; + + var isArray$2 = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; + }; + + /*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + + var INSPECT_MAX_BYTES = 50; + + /** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * Due to various browser bugs, sometimes the Object implementation will be used even + * when the browser supports typed arrays. + * + * Note: + * + * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, + * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. + * + * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. + * + * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of + * incorrect length in some situations. + + * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they + * get the Object implementation, which is slower but behaves correctly. + */ + Buffer$1.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined + ? global$1.TYPED_ARRAY_SUPPORT + : true; + + /* + * Export kMaxLength after typed array support is determined. + */ + kMaxLength(); + + function kMaxLength () { + return Buffer$1.TYPED_ARRAY_SUPPORT + ? 0x7fffffff + : 0x3fffffff + } + + function createBuffer (that, length) { + if (kMaxLength() < length) { + throw new RangeError('Invalid typed array length') + } + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = new Uint8Array(length); + that.__proto__ = Buffer$1.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + if (that === null) { + that = new Buffer$1(length); + } + that.length = length; + } + + return that + } + + /** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + + function Buffer$1 (arg, encodingOrOffset, length) { + if (!Buffer$1.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer$1)) { + return new Buffer$1(arg, encodingOrOffset, length) + } + + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new Error( + 'If encoding is specified then the first argument must be a string' + ) + } + return allocUnsafe(this, arg) + } + return from(this, arg, encodingOrOffset, length) + } + + Buffer$1.poolSize = 8192; // not used by this implementation + + // TODO: Legacy, not needed anymore. Remove in next major version. + Buffer$1._augment = function (arr) { + arr.__proto__ = Buffer$1.prototype; + return arr + }; + + function from (that, value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number') + } + + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + return fromArrayBuffer(that, value, encodingOrOffset, length) + } + + if (typeof value === 'string') { + return fromString(that, value, encodingOrOffset) + } + + return fromObject(that, value) + } + + /** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ + Buffer$1.from = function (value, encodingOrOffset, length) { + return from(null, value, encodingOrOffset, length) + }; + + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + Buffer$1.prototype.__proto__ = Uint8Array.prototype; + Buffer$1.__proto__ = Uint8Array; + if (typeof Symbol !== 'undefined' && Symbol.species && + Buffer$1[Symbol.species] === Buffer$1) ; + } + + function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number') + } else if (size < 0) { + throw new RangeError('"size" argument must not be negative') + } + } + + function alloc (that, size, fill, encoding) { + assertSize(size); + if (size <= 0) { + return createBuffer(that, size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' + ? createBuffer(that, size).fill(fill, encoding) + : createBuffer(that, size).fill(fill) + } + return createBuffer(that, size) + } + + /** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ + Buffer$1.alloc = function (size, fill, encoding) { + return alloc(null, size, fill, encoding) + }; + + function allocUnsafe (that, size) { + assertSize(size); + that = createBuffer(that, size < 0 ? 0 : checked(size) | 0); + if (!Buffer$1.TYPED_ARRAY_SUPPORT) { + for (var i = 0; i < size; ++i) { + that[i] = 0; + } + } + return that + } + + /** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ + Buffer$1.allocUnsafe = function (size) { + return allocUnsafe(null, size) + }; + /** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ + Buffer$1.allocUnsafeSlow = function (size) { + return allocUnsafe(null, size) + }; + + function fromString (that, string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8'; + } + + if (!Buffer$1.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding') + } + + var length = byteLength(string, encoding) | 0; + that = createBuffer(that, length); + + var actual = that.write(string, encoding); + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + that = that.slice(0, actual); + } + + return that + } + + function fromArrayLike (that, array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0; + that = createBuffer(that, length); + for (var i = 0; i < length; i += 1) { + that[i] = array[i] & 255; + } + return that + } + + function fromArrayBuffer (that, array, byteOffset, length) { + array.byteLength; // this throws if `array` is not a valid ArrayBuffer + + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('\'offset\' is out of bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('\'length\' is out of bounds') + } + + if (byteOffset === undefined && length === undefined) { + array = new Uint8Array(array); + } else if (length === undefined) { + array = new Uint8Array(array, byteOffset); + } else { + array = new Uint8Array(array, byteOffset, length); + } + + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = array; + that.__proto__ = Buffer$1.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + that = fromArrayLike(that, array); + } + return that + } + + function fromObject (that, obj) { + if (internalIsBuffer(obj)) { + var len = checked(obj.length) | 0; + that = createBuffer(that, len); + + if (that.length === 0) { + return that + } + + obj.copy(that, 0, 0, len); + return that + } + + if (obj) { + if ((typeof ArrayBuffer !== 'undefined' && + obj.buffer instanceof ArrayBuffer) || 'length' in obj) { + if (typeof obj.length !== 'number' || isnan(obj.length)) { + return createBuffer(that, 0) + } + return fromArrayLike(that, obj) + } + + if (obj.type === 'Buffer' && isArray$2(obj.data)) { + return fromArrayLike(that, obj.data) + } + } + + throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') + } + + function checked (length) { + // Note: cannot use `length < kMaxLength()` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= kMaxLength()) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + kMaxLength().toString(16) + ' bytes') + } + return length | 0 + } + Buffer$1.isBuffer = isBuffer$1; + function internalIsBuffer (b) { + return !!(b != null && b._isBuffer) + } + + Buffer$1.compare = function compare (a, b) { + if (!internalIsBuffer(a) || !internalIsBuffer(b)) { + throw new TypeError('Arguments must be Buffers') + } + + if (a === b) return 0 + + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 + }; + + Buffer$1.isEncoding = function isEncoding (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } + }; + + Buffer$1.concat = function concat (list, length) { + if (!isArray$2(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer$1.alloc(0) + } + + var i; + if (length === undefined) { + length = 0; + for (i = 0; i < list.length; ++i) { + length += list[i].length; + } + } + + var buffer = Buffer$1.allocUnsafe(length); + var pos = 0; + for (i = 0; i < list.length; ++i) { + var buf = list[i]; + if (!internalIsBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + buf.copy(buffer, pos); + pos += buf.length; + } + return buffer + }; + + function byteLength (string, encoding) { + if (internalIsBuffer(string)) { + return string.length + } + if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && + (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + string = '' + string; + } + + var len = string.length; + if (len === 0) return 0 + + // Use a for loop to avoid recursion + var loweredCase = false; + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + case undefined: + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) return utf8ToBytes(string).length // assume utf8 + encoding = ('' + encoding).toLowerCase(); + loweredCase = true; + } + } + } + Buffer$1.byteLength = byteLength; + + function slowToString (encoding, start, end) { + var loweredCase = false; + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0; + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length; + } + + if (end <= 0) { + return '' + } + + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0; + start >>>= 0; + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8'; + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase(); + loweredCase = true; + } + } + } + + // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect + // Buffer instances. + Buffer$1.prototype._isBuffer = true; + + function swap (b, n, m) { + var i = b[n]; + b[n] = b[m]; + b[m] = i; + } + + Buffer$1.prototype.swap16 = function swap16 () { + var len = this.length; + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1); + } + return this + }; + + Buffer$1.prototype.swap32 = function swap32 () { + var len = this.length; + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3); + swap(this, i + 1, i + 2); + } + return this + }; + + Buffer$1.prototype.swap64 = function swap64 () { + var len = this.length; + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7); + swap(this, i + 1, i + 6); + swap(this, i + 2, i + 5); + swap(this, i + 3, i + 4); + } + return this + }; + + Buffer$1.prototype.toString = function toString () { + var length = this.length | 0; + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) + }; + + Buffer$1.prototype.equals = function equals (b) { + if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer$1.compare(this, b) === 0 + }; + + Buffer$1.prototype.inspect = function inspect () { + var str = ''; + var max = INSPECT_MAX_BYTES; + if (this.length > 0) { + str = this.toString('hex', 0, max).match(/.{2}/g).join(' '); + if (this.length > max) str += ' ... '; + } + return '' + }; + + Buffer$1.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (!internalIsBuffer(target)) { + throw new TypeError('Argument must be a Buffer') + } + + if (start === undefined) { + start = 0; + } + if (end === undefined) { + end = target ? target.length : 0; + } + if (thisStart === undefined) { + thisStart = 0; + } + if (thisEnd === undefined) { + thisEnd = this.length; + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0; + end >>>= 0; + thisStart >>>= 0; + thisEnd >>>= 0; + + if (this === target) return 0 + + var x = thisEnd - thisStart; + var y = end - start; + var len = Math.min(x, y); + + var thisCopy = this.slice(thisStart, thisEnd); + var targetCopy = target.slice(start, end); + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i]; + y = targetCopy[i]; + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 + }; + + // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, + // OR the last index of `val` in `buffer` at offset <= `byteOffset`. + // + // Arguments: + // - buffer - a Buffer to search + // - val - a string, Buffer, or number + // - byteOffset - an index into `buffer`; will be clamped to an int32 + // - encoding - an optional encoding, relevant is val is a string + // - dir - true for indexOf, false for lastIndexOf + function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset; + byteOffset = 0; + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff; + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000; + } + byteOffset = +byteOffset; // Coerce to Number. + if (isNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1); + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset; + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1; + } else if (byteOffset < 0) { + if (dir) byteOffset = 0; + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer$1.from(val, encoding); + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (internalIsBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF; // Search for a byte value [0-255] + if (Buffer$1.TYPED_ARRAY_SUPPORT && + typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') + } + + function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1; + var arrLength = arr.length; + var valLength = val.length; + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase(); + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2; + arrLength /= 2; + valLength /= 2; + byteOffset /= 2; + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + var i; + if (dir) { + var foundIndex = -1; + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i; + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex; + foundIndex = -1; + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; + for (i = byteOffset; i >= 0; i--) { + var found = true; + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false; + break + } + } + if (found) return i + } + } + + return -1 + } + + Buffer$1.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 + }; + + Buffer$1.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) + }; + + Buffer$1.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) + }; + + function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0; + var remaining = buf.length - offset; + if (!length) { + length = remaining; + } else { + length = Number(length); + if (length > remaining) { + length = remaining; + } + } + + // must be an even number of digits + var strLen = string.length; + if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') + + if (length > strLen / 2) { + length = strLen / 2; + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16); + if (isNaN(parsed)) return i + buf[offset + i] = parsed; + } + return i + } + + function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) + } + + function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) + } + + function latin1Write (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) + } + + function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) + } + + function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) + } + + Buffer$1.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8'; + length = this.length; + offset = 0; + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset; + length = this.length; + offset = 0; + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset | 0; + if (isFinite(length)) { + length = length | 0; + if (encoding === undefined) encoding = 'utf8'; + } else { + encoding = length; + length = undefined; + } + // legacy write(string, encoding, offset, length) - remove in v0.13 + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + var remaining = this.length - offset; + if (length === undefined || length > remaining) length = remaining; + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8'; + + var loweredCase = false; + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + return asciiWrite(this, string, offset, length) + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase(); + loweredCase = true; + } + } + }; + + Buffer$1.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } + }; + + function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return fromByteArray(buf) + } else { + return fromByteArray(buf.slice(start, end)) + } + } + + function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end); + var res = []; + + var i = start; + while (i < end) { + var firstByte = buf[i]; + var codePoint = null; + var bytesPerSequence = (firstByte > 0xEF) ? 4 + : (firstByte > 0xDF) ? 3 + : (firstByte > 0xBF) ? 2 + : 1; + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint; + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte; + } + break + case 2: + secondByte = buf[i + 1]; + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F); + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint; + } + } + break + case 3: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F); + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint; + } + } + break + case 4: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + fourthByte = buf[i + 3]; + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F); + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint; + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD; + bytesPerSequence = 1; + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000; + res.push(codePoint >>> 10 & 0x3FF | 0xD800); + codePoint = 0xDC00 | codePoint & 0x3FF; + } + + res.push(codePoint); + i += bytesPerSequence; + } + + return decodeCodePointsArray(res) + } + + // Based on http://stackoverflow.com/a/22747272/680742, the browser with + // the lowest limit is Chrome, with 0x10000 args. + // We go 1 magnitude less, for safety + var MAX_ARGUMENTS_LENGTH = 0x1000; + + function decodeCodePointsArray (codePoints) { + var len = codePoints.length; + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = ''; + var i = 0; + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ); + } + return res + } + + function asciiSlice (buf, start, end) { + var ret = ''; + end = Math.min(buf.length, end); + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F); + } + return ret + } + + function latin1Slice (buf, start, end) { + var ret = ''; + end = Math.min(buf.length, end); + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]); + } + return ret + } + + function hexSlice (buf, start, end) { + var len = buf.length; + + if (!start || start < 0) start = 0; + if (!end || end < 0 || end > len) end = len; + + var out = ''; + for (var i = start; i < end; ++i) { + out += toHex(buf[i]); + } + return out + } + + function utf16leSlice (buf, start, end) { + var bytes = buf.slice(start, end); + var res = ''; + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); + } + return res + } + + Buffer$1.prototype.slice = function slice (start, end) { + var len = this.length; + start = ~~start; + end = end === undefined ? len : ~~end; + + if (start < 0) { + start += len; + if (start < 0) start = 0; + } else if (start > len) { + start = len; + } + + if (end < 0) { + end += len; + if (end < 0) end = 0; + } else if (end > len) { + end = len; + } + + if (end < start) end = start; + + var newBuf; + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + newBuf = this.subarray(start, end); + newBuf.__proto__ = Buffer$1.prototype; + } else { + var sliceLen = end - start; + newBuf = new Buffer$1(sliceLen, undefined); + for (var i = 0; i < sliceLen; ++i) { + newBuf[i] = this[i + start]; + } + } + + return newBuf + }; + + /* + * Need to make sure that buffer isn't trying to write out of bounds. + */ + function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') + } + + Buffer$1.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var val = this[offset]; + var mul = 1; + var i = 0; + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul; + } + + return val + }; + + Buffer$1.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + checkOffset(offset, byteLength, this.length); + } + + var val = this[offset + --byteLength]; + var mul = 1; + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul; + } + + return val + }; + + Buffer$1.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length); + return this[offset] + }; + + Buffer$1.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + return this[offset] | (this[offset + 1] << 8) + }; + + Buffer$1.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + return (this[offset] << 8) | this[offset + 1] + }; + + Buffer$1.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) + }; + + Buffer$1.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) + }; + + Buffer$1.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var val = this[offset]; + var mul = 1; + var i = 0; + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul; + } + mul *= 0x80; + + if (val >= mul) val -= Math.pow(2, 8 * byteLength); + + return val + }; + + Buffer$1.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var i = byteLength; + var mul = 1; + var val = this[offset + --i]; + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul; + } + mul *= 0x80; + + if (val >= mul) val -= Math.pow(2, 8 * byteLength); + + return val + }; + + Buffer$1.prototype.readInt8 = function readInt8 (offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length); + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) + }; + + Buffer$1.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + var val = this[offset] | (this[offset + 1] << 8); + return (val & 0x8000) ? val | 0xFFFF0000 : val + }; + + Buffer$1.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + var val = this[offset + 1] | (this[offset] << 8); + return (val & 0x8000) ? val | 0xFFFF0000 : val + }; + + Buffer$1.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) + }; + + Buffer$1.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) + }; + + Buffer$1.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return read(this, offset, true, 23, 4) + }; + + Buffer$1.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return read(this, offset, false, 23, 4) + }; + + Buffer$1.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length); + return read(this, offset, true, 52, 8) + }; + + Buffer$1.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length); + return read(this, offset, false, 52, 8) + }; + + function checkInt (buf, value, offset, ext, max, min) { + if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') + } + + Buffer$1.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1; + checkInt(this, value, offset, byteLength, maxBytes, 0); + } + + var mul = 1; + var i = 0; + this[offset] = value & 0xFF; + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF; + } + + return offset + byteLength + }; + + Buffer$1.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1; + checkInt(this, value, offset, byteLength, maxBytes, 0); + } + + var i = byteLength - 1; + var mul = 1; + this[offset + i] = value & 0xFF; + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF; + } + + return offset + byteLength + }; + + Buffer$1.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); + if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value); + this[offset] = (value & 0xff); + return offset + 1 + }; + + function objectWriteUInt16 (buf, value, offset, littleEndian) { + if (value < 0) value = 0xffff + value + 1; + for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { + buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> + (littleEndian ? i : 1 - i) * 8; + } + } + + Buffer$1.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff); + this[offset + 1] = (value >>> 8); + } else { + objectWriteUInt16(this, value, offset, true); + } + return offset + 2 + }; + + Buffer$1.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 8); + this[offset + 1] = (value & 0xff); + } else { + objectWriteUInt16(this, value, offset, false); + } + return offset + 2 + }; + + function objectWriteUInt32 (buf, value, offset, littleEndian) { + if (value < 0) value = 0xffffffff + value + 1; + for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { + buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff; + } + } + + Buffer$1.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + this[offset + 3] = (value >>> 24); + this[offset + 2] = (value >>> 16); + this[offset + 1] = (value >>> 8); + this[offset] = (value & 0xff); + } else { + objectWriteUInt32(this, value, offset, true); + } + return offset + 4 + }; + + Buffer$1.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 24); + this[offset + 1] = (value >>> 16); + this[offset + 2] = (value >>> 8); + this[offset + 3] = (value & 0xff); + } else { + objectWriteUInt32(this, value, offset, false); + } + return offset + 4 + }; + + Buffer$1.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1); + + checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + + var i = 0; + var mul = 1; + var sub = 0; + this[offset] = value & 0xFF; + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1; + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF; + } + + return offset + byteLength + }; + + Buffer$1.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1); + + checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + + var i = byteLength - 1; + var mul = 1; + var sub = 0; + this[offset + i] = value & 0xFF; + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1; + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF; + } + + return offset + byteLength + }; + + Buffer$1.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80); + if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value); + if (value < 0) value = 0xff + value + 1; + this[offset] = (value & 0xff); + return offset + 1 + }; + + Buffer$1.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff); + this[offset + 1] = (value >>> 8); + } else { + objectWriteUInt16(this, value, offset, true); + } + return offset + 2 + }; + + Buffer$1.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 8); + this[offset + 1] = (value & 0xff); + } else { + objectWriteUInt16(this, value, offset, false); + } + return offset + 2 + }; + + Buffer$1.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff); + this[offset + 1] = (value >>> 8); + this[offset + 2] = (value >>> 16); + this[offset + 3] = (value >>> 24); + } else { + objectWriteUInt32(this, value, offset, true); + } + return offset + 4 + }; + + Buffer$1.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); + if (value < 0) value = 0xffffffff + value + 1; + if (Buffer$1.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 24); + this[offset + 1] = (value >>> 16); + this[offset + 2] = (value >>> 8); + this[offset + 3] = (value & 0xff); + } else { + objectWriteUInt32(this, value, offset, false); + } + return offset + 4 + }; + + function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') + } + + function writeFloat (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 4); + } + write(buf, value, offset, littleEndian, 23, 4); + return offset + 4 + } + + Buffer$1.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) + }; + + Buffer$1.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) + }; + + function writeDouble (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 8); + } + write(buf, value, offset, littleEndian, 52, 8); + return offset + 8 + } + + Buffer$1.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) + }; + + Buffer$1.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) + }; + + // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) + Buffer$1.prototype.copy = function copy (target, targetStart, start, end) { + if (!start) start = 0; + if (!end && end !== 0) end = this.length; + if (targetStart >= target.length) targetStart = target.length; + if (!targetStart) targetStart = 0; + if (end > 0 && end < start) end = start; + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length; + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start; + } + + var len = end - start; + var i; + + if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start]; + } + } else if (len < 1000 || !Buffer$1.TYPED_ARRAY_SUPPORT) { + // ascending copy from start + for (i = 0; i < len; ++i) { + target[i + targetStart] = this[i + start]; + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, start + len), + targetStart + ); + } + + return len + }; + + // Usage: + // buffer.fill(number[, offset[, end]]) + // buffer.fill(buffer[, offset[, end]]) + // buffer.fill(string[, offset[, end]][, encoding]) + Buffer$1.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start; + start = 0; + end = this.length; + } else if (typeof end === 'string') { + encoding = end; + end = this.length; + } + if (val.length === 1) { + var code = val.charCodeAt(0); + if (code < 256) { + val = code; + } + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer$1.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + } else if (typeof val === 'number') { + val = val & 255; + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0; + end = end === undefined ? this.length : end >>> 0; + + if (!val) val = 0; + + var i; + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val; + } + } else { + var bytes = internalIsBuffer(val) + ? val + : utf8ToBytes(new Buffer$1(val, encoding).toString()); + var len = bytes.length; + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len]; + } + } + + return this + }; + + // HELPER FUNCTIONS + // ================ + + var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g; + + function base64clean (str) { + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = stringtrim(str).replace(INVALID_BASE64_RE, ''); + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '='; + } + return str + } + + function stringtrim (str) { + if (str.trim) return str.trim() + return str.replace(/^\s+|\s+$/g, '') + } + + function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) + } + + function utf8ToBytes (string, units) { + units = units || Infinity; + var codePoint; + var length = string.length; + var leadSurrogate = null; + var bytes = []; + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i); + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + continue + } + + // valid lead + leadSurrogate = codePoint; + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + leadSurrogate = codePoint; + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + } + + leadSurrogate = null; + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint); + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ); + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ); + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ); + } else { + throw new Error('Invalid code point') + } + } + + return bytes + } + + function asciiToBytes (str) { + var byteArray = []; + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF); + } + return byteArray + } + + function utf16leToBytes (str, units) { + var c, hi, lo; + var byteArray = []; + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i); + hi = c >> 8; + lo = c % 256; + byteArray.push(lo); + byteArray.push(hi); + } + + return byteArray + } + + + function base64ToBytes (str) { + return toByteArray(base64clean(str)) + } + + function blitBuffer (src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i]; + } + return i + } + + function isnan (val) { + return val !== val // eslint-disable-line no-self-compare + } + + + // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence + // The _isBuffer check is for Safari 5-7 support, because it's missing + // Object.prototype.constructor. Remove this eventually + function isBuffer$1(obj) { + return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj)) + } + + function isFastBuffer (obj) { + return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) + } + + // For Node v0.10 support. Remove this eventually. + function isSlowBuffer (obj) { + return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0)) + } + + var sourcemapCodec_umd$1 = {exports: {}}; + + sourcemapCodec_umd$1.exports; + var hasRequiredSourcemapCodec_umd$1; + function requireSourcemapCodec_umd$1() { + if (hasRequiredSourcemapCodec_umd$1) return sourcemapCodec_umd$1.exports; + hasRequiredSourcemapCodec_umd$1 = 1; + (function (module, exports) { + (function (global, factory) { + factory(exports) ; + })(commonjsGlobal, function (exports) { + + var comma = ','.charCodeAt(0); + var semicolon = ';'.charCodeAt(0); + var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + var intToChar = new Uint8Array(64); + var charToInt = new Uint8Array(128); + for (var i = 0; i < chars.length; i++) { + var c = chars.charCodeAt(i); + intToChar[i] = c; + charToInt[c] = i; + } + var td = typeof TextDecoder !== 'undefined' ? new TextDecoder() : typeof Buffer$1 !== 'undefined' ? { + decode: function decode(buf) { + var out = Buffer$1.from(buf.buffer, buf.byteOffset, buf.byteLength); + return out.toString(); + } + } : { + decode: function decode(buf) { + var out = ''; + for (var _i = 0; _i < buf.length; _i++) { + out += String.fromCharCode(buf[_i]); + } + return out; + } + }; + function decode(mappings) { + var state = new Int32Array(5); + var decoded = []; + var index = 0; + do { + var semi = indexOf(mappings, index); + var line = []; + var sorted = true; + var lastCol = 0; + state[0] = 0; + for (var _i2 = index; _i2 < semi; _i2++) { + var seg = void 0; + _i2 = decodeInteger(mappings, _i2, state, 0); + var col = state[0]; + if (col < lastCol) sorted = false; + lastCol = col; + if (hasMoreVlq(mappings, _i2, semi)) { + _i2 = decodeInteger(mappings, _i2, state, 1); + _i2 = decodeInteger(mappings, _i2, state, 2); + _i2 = decodeInteger(mappings, _i2, state, 3); + if (hasMoreVlq(mappings, _i2, semi)) { + _i2 = decodeInteger(mappings, _i2, state, 4); + seg = [col, state[1], state[2], state[3], state[4]]; + } else { + seg = [col, state[1], state[2], state[3]]; + } + } else { + seg = [col]; + } + line.push(seg); + } + if (!sorted) sort(line); + decoded.push(line); + index = semi + 1; + } while (index <= mappings.length); + return decoded; + } + function indexOf(mappings, index) { + var idx = mappings.indexOf(';', index); + return idx === -1 ? mappings.length : idx; + } + function decodeInteger(mappings, pos, state, j) { + var value = 0; + var shift = 0; + var integer = 0; + do { + var _c = mappings.charCodeAt(pos++); + integer = charToInt[_c]; + value |= (integer & 31) << shift; + shift += 5; + } while (integer & 32); + var shouldNegate = value & 1; + value >>>= 1; + if (shouldNegate) { + value = -0x80000000 | -value; + } + state[j] += value; + return pos; + } + function hasMoreVlq(mappings, i, length) { + if (i >= length) return false; + return mappings.charCodeAt(i) !== comma; + } + function sort(line) { + line.sort(sortComparator); + } + function sortComparator(a, b) { + return a[0] - b[0]; + } + function encode(decoded) { + var state = new Int32Array(5); + var bufLength = 1024 * 16; + var subLength = bufLength - 36; + var buf = new Uint8Array(bufLength); + var sub = buf.subarray(0, subLength); + var pos = 0; + var out = ''; + for (var _i3 = 0; _i3 < decoded.length; _i3++) { + var line = decoded[_i3]; + if (_i3 > 0) { + if (pos === bufLength) { + out += td.decode(buf); + pos = 0; + } + buf[pos++] = semicolon; + } + if (line.length === 0) continue; + state[0] = 0; + for (var j = 0; j < line.length; j++) { + var segment = line[j]; + if (pos > subLength) { + out += td.decode(sub); + buf.copyWithin(0, subLength, pos); + pos -= subLength; + } + if (j > 0) buf[pos++] = comma; + pos = encodeInteger(buf, pos, state, segment, 0); + if (segment.length === 1) continue; + pos = encodeInteger(buf, pos, state, segment, 1); + pos = encodeInteger(buf, pos, state, segment, 2); + pos = encodeInteger(buf, pos, state, segment, 3); + if (segment.length === 4) continue; + pos = encodeInteger(buf, pos, state, segment, 4); + } + } + return out + td.decode(buf.subarray(0, pos)); + } + function encodeInteger(buf, pos, state, segment, j) { + var next = segment[j]; + var num = next - state[j]; + state[j] = next; + num = num < 0 ? -num << 1 | 1 : num << 1; + do { + var clamped = num & 31; + num >>>= 5; + if (num > 0) clamped |= 32; + buf[pos++] = intToChar[clamped]; + } while (num > 0); + return pos; + } + exports.decode = decode; + exports.encode = encode; + Object.defineProperty(exports, '__esModule', { + value: true + }); + }); + })(sourcemapCodec_umd$1, sourcemapCodec_umd$1.exports); + return sourcemapCodec_umd$1.exports; + } + + var traceMapping_umd = {exports: {}}; + + var sourcemapCodec_umd = {exports: {}}; + + sourcemapCodec_umd.exports; + var hasRequiredSourcemapCodec_umd; + function requireSourcemapCodec_umd() { + if (hasRequiredSourcemapCodec_umd) return sourcemapCodec_umd.exports; + hasRequiredSourcemapCodec_umd = 1; + (function (module, exports) { + (function (global, factory) { + factory(exports) ; + })(commonjsGlobal, function (exports) { + + var comma = ','.charCodeAt(0); + var semicolon = ';'.charCodeAt(0); + var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + var intToChar = new Uint8Array(64); + var charToInt = new Uint8Array(128); + for (var i = 0; i < chars.length; i++) { + var c = chars.charCodeAt(i); + intToChar[i] = c; + charToInt[c] = i; + } + var td = typeof TextDecoder !== 'undefined' ? new TextDecoder() : typeof Buffer$1 !== 'undefined' ? { + decode: function decode(buf) { + var out = Buffer$1.from(buf.buffer, buf.byteOffset, buf.byteLength); + return out.toString(); + } + } : { + decode: function decode(buf) { + var out = ''; + for (var _i = 0; _i < buf.length; _i++) { + out += String.fromCharCode(buf[_i]); + } + return out; + } + }; + function decode(mappings) { + var state = new Int32Array(5); + var decoded = []; + var index = 0; + do { + var semi = indexOf(mappings, index); + var line = []; + var sorted = true; + var lastCol = 0; + state[0] = 0; + for (var _i2 = index; _i2 < semi; _i2++) { + var seg = void 0; + _i2 = decodeInteger(mappings, _i2, state, 0); + var col = state[0]; + if (col < lastCol) sorted = false; + lastCol = col; + if (hasMoreVlq(mappings, _i2, semi)) { + _i2 = decodeInteger(mappings, _i2, state, 1); + _i2 = decodeInteger(mappings, _i2, state, 2); + _i2 = decodeInteger(mappings, _i2, state, 3); + if (hasMoreVlq(mappings, _i2, semi)) { + _i2 = decodeInteger(mappings, _i2, state, 4); + seg = [col, state[1], state[2], state[3], state[4]]; + } else { + seg = [col, state[1], state[2], state[3]]; + } + } else { + seg = [col]; + } + line.push(seg); + } + if (!sorted) sort(line); + decoded.push(line); + index = semi + 1; + } while (index <= mappings.length); + return decoded; + } + function indexOf(mappings, index) { + var idx = mappings.indexOf(';', index); + return idx === -1 ? mappings.length : idx; + } + function decodeInteger(mappings, pos, state, j) { + var value = 0; + var shift = 0; + var integer = 0; + do { + var _c = mappings.charCodeAt(pos++); + integer = charToInt[_c]; + value |= (integer & 31) << shift; + shift += 5; + } while (integer & 32); + var shouldNegate = value & 1; + value >>>= 1; + if (shouldNegate) { + value = -0x80000000 | -value; + } + state[j] += value; + return pos; + } + function hasMoreVlq(mappings, i, length) { + if (i >= length) return false; + return mappings.charCodeAt(i) !== comma; + } + function sort(line) { + line.sort(sortComparator); + } + function sortComparator(a, b) { + return a[0] - b[0]; + } + function encode(decoded) { + var state = new Int32Array(5); + var bufLength = 1024 * 16; + var subLength = bufLength - 36; + var buf = new Uint8Array(bufLength); + var sub = buf.subarray(0, subLength); + var pos = 0; + var out = ''; + for (var _i3 = 0; _i3 < decoded.length; _i3++) { + var line = decoded[_i3]; + if (_i3 > 0) { + if (pos === bufLength) { + out += td.decode(buf); + pos = 0; + } + buf[pos++] = semicolon; + } + if (line.length === 0) continue; + state[0] = 0; + for (var j = 0; j < line.length; j++) { + var segment = line[j]; + if (pos > subLength) { + out += td.decode(sub); + buf.copyWithin(0, subLength, pos); + pos -= subLength; + } + if (j > 0) buf[pos++] = comma; + pos = encodeInteger(buf, pos, state, segment, 0); + if (segment.length === 1) continue; + pos = encodeInteger(buf, pos, state, segment, 1); + pos = encodeInteger(buf, pos, state, segment, 2); + pos = encodeInteger(buf, pos, state, segment, 3); + if (segment.length === 4) continue; + pos = encodeInteger(buf, pos, state, segment, 4); + } + } + return out + td.decode(buf.subarray(0, pos)); + } + function encodeInteger(buf, pos, state, segment, j) { + var next = segment[j]; + var num = next - state[j]; + state[j] = next; + num = num < 0 ? -num << 1 | 1 : num << 1; + do { + var clamped = num & 31; + num >>>= 5; + if (num > 0) clamped |= 32; + buf[pos++] = intToChar[clamped]; + } while (num > 0); + return pos; + } + exports.decode = decode; + exports.encode = encode; + Object.defineProperty(exports, '__esModule', { + value: true + }); + }); + })(sourcemapCodec_umd, sourcemapCodec_umd.exports); + return sourcemapCodec_umd.exports; + } + + var resolveUri_umd = {exports: {}}; + + resolveUri_umd.exports; + var hasRequiredResolveUri_umd; + function requireResolveUri_umd() { + if (hasRequiredResolveUri_umd) return resolveUri_umd.exports; + hasRequiredResolveUri_umd = 1; + (function (module, exports) { + (function (global, factory) { + module.exports = factory() ; + })(commonjsGlobal, function () { + var schemeRegex = /^[\w+.-]+:\/\//; + var urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; + var fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; + var UrlType; + (function (UrlType) { + UrlType[UrlType["Empty"] = 1] = "Empty"; + UrlType[UrlType["Hash"] = 2] = "Hash"; + UrlType[UrlType["Query"] = 3] = "Query"; + UrlType[UrlType["RelativePath"] = 4] = "RelativePath"; + UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath"; + UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative"; + UrlType[UrlType["Absolute"] = 7] = "Absolute"; + })(UrlType || (UrlType = {})); + function isAbsoluteUrl(input) { + return schemeRegex.test(input); + } + function isSchemeRelativeUrl(input) { + return input.startsWith('//'); + } + function isAbsolutePath(input) { + return input.startsWith('/'); + } + function isFileUrl(input) { + return input.startsWith('file:'); + } + function isRelative(input) { + return /^[.?#]/.test(input); + } + function parseAbsoluteUrl(input) { + var match = urlRegex.exec(input); + return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || ''); + } + function parseFileUrl(input) { + var match = fileRegex.exec(input); + var path = match[2]; + return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || ''); + } + function makeUrl(scheme, user, host, port, path, query, hash) { + return { + scheme: scheme, + user: user, + host: host, + port: port, + path: path, + query: query, + hash: hash, + type: UrlType.Absolute + }; + } + function parseUrl(input) { + if (isSchemeRelativeUrl(input)) { + var _url = parseAbsoluteUrl('http:' + input); + _url.scheme = ''; + _url.type = UrlType.SchemeRelative; + return _url; + } + if (isAbsolutePath(input)) { + var _url2 = parseAbsoluteUrl('http://foo.com' + input); + _url2.scheme = ''; + _url2.host = ''; + _url2.type = UrlType.AbsolutePath; + return _url2; + } + if (isFileUrl(input)) return parseFileUrl(input); + if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input); + var url = parseAbsoluteUrl('http://foo.com/' + input); + url.scheme = ''; + url.host = ''; + url.type = input ? input.startsWith('?') ? UrlType.Query : input.startsWith('#') ? UrlType.Hash : UrlType.RelativePath : UrlType.Empty; + return url; + } + function stripPathFilename(path) { + if (path.endsWith('/..')) return path; + var index = path.lastIndexOf('/'); + return path.slice(0, index + 1); + } + function mergePaths(url, base) { + normalizePath(base, base.type); + if (url.path === '/') { + url.path = base.path; + } else { + url.path = stripPathFilename(base.path) + url.path; + } + } + function normalizePath(url, type) { + var rel = type <= UrlType.RelativePath; + var pieces = url.path.split('/'); + var pointer = 1; + var positive = 0; + var addTrailingSlash = false; + for (var i = 1; i < pieces.length; i++) { + var piece = pieces[i]; + if (!piece) { + addTrailingSlash = true; + continue; + } + addTrailingSlash = false; + if (piece === '.') continue; + if (piece === '..') { + if (positive) { + addTrailingSlash = true; + positive--; + pointer--; + } else if (rel) { + pieces[pointer++] = piece; + } + continue; + } + pieces[pointer++] = piece; + positive++; + } + var path = ''; + for (var _i = 1; _i < pointer; _i++) { + path += '/' + pieces[_i]; + } + if (!path || addTrailingSlash && !path.endsWith('/..')) { + path += '/'; + } + url.path = path; + } + function resolve(input, base) { + if (!input && !base) return ''; + var url = parseUrl(input); + var inputType = url.type; + if (base && inputType !== UrlType.Absolute) { + var baseUrl = parseUrl(base); + var baseType = baseUrl.type; + switch (inputType) { + case UrlType.Empty: + url.hash = baseUrl.hash; + case UrlType.Hash: + url.query = baseUrl.query; + case UrlType.Query: + case UrlType.RelativePath: + mergePaths(url, baseUrl); + case UrlType.AbsolutePath: + url.user = baseUrl.user; + url.host = baseUrl.host; + url.port = baseUrl.port; + case UrlType.SchemeRelative: + url.scheme = baseUrl.scheme; + } + if (baseType > inputType) inputType = baseType; + } + normalizePath(url, inputType); + var queryHash = url.query + url.hash; + switch (inputType) { + case UrlType.Hash: + case UrlType.Query: + return queryHash; + case UrlType.RelativePath: + { + var path = url.path.slice(1); + if (!path) return queryHash || '.'; + if (isRelative(base || input) && !isRelative(path)) { + return './' + path + queryHash; + } + return path + queryHash; + } + case UrlType.AbsolutePath: + return url.path + queryHash; + default: + return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash; + } + } + return resolve; + }); + })(resolveUri_umd, resolveUri_umd.exports); + return resolveUri_umd.exports; + } + + traceMapping_umd.exports; + (function (module, exports) { + (function (global, factory) { + factory(exports, requireSourcemapCodec_umd(), requireResolveUri_umd()) ; + })(commonjsGlobal, function (exports, sourcemapCodec, resolveUri) { + + function _interopDefaultLegacy(e) { + return e && typeof e === 'object' && 'default' in e ? e : { + 'default': e + }; + } + var resolveUri__default = _interopDefaultLegacy(resolveUri); + function resolve(input, base) { + if (base && !base.endsWith('/')) base += '/'; + return resolveUri__default["default"](input, base); + } + function stripFilename(path) { + if (!path) return ''; + var index = path.lastIndexOf('/'); + return path.slice(0, index + 1); + } + var COLUMN = 0; + var SOURCES_INDEX = 1; + var SOURCE_LINE = 2; + var SOURCE_COLUMN = 3; + var NAMES_INDEX = 4; + var REV_GENERATED_LINE = 1; + var REV_GENERATED_COLUMN = 2; + function maybeSort(mappings, owned) { + var unsortedIndex = nextUnsortedSegmentLine(mappings, 0); + if (unsortedIndex === mappings.length) return mappings; + if (!owned) mappings = mappings.slice(); + for (var i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { + mappings[i] = sortSegments(mappings[i], owned); + } + return mappings; + } + function nextUnsortedSegmentLine(mappings, start) { + for (var i = start; i < mappings.length; i++) { + if (!isSorted(mappings[i])) return i; + } + return mappings.length; + } + function isSorted(line) { + for (var j = 1; j < line.length; j++) { + if (line[j][COLUMN] < line[j - 1][COLUMN]) { + return false; + } + } + return true; + } + function sortSegments(line, owned) { + if (!owned) line = line.slice(); + return line.sort(sortComparator); + } + function sortComparator(a, b) { + return a[COLUMN] - b[COLUMN]; + } + var found = false; + function binarySearch(haystack, needle, low, high) { + while (low <= high) { + var mid = low + (high - low >> 1); + var cmp = haystack[mid][COLUMN] - needle; + if (cmp === 0) { + found = true; + return mid; + } + if (cmp < 0) { + low = mid + 1; + } else { + high = mid - 1; + } + } + found = false; + return low - 1; + } + function upperBound(haystack, needle, index) { + for (var i = index + 1; i < haystack.length; index = i++) { + if (haystack[i][COLUMN] !== needle) break; + } + return index; + } + function lowerBound(haystack, needle, index) { + for (var i = index - 1; i >= 0; index = i--) { + if (haystack[i][COLUMN] !== needle) break; + } + return index; + } + function memoizedState() { + return { + lastKey: -1, + lastNeedle: -1, + lastIndex: -1 + }; + } + function memoizedBinarySearch(haystack, needle, state, key) { + var lastKey = state.lastKey, + lastNeedle = state.lastNeedle, + lastIndex = state.lastIndex; + var low = 0; + var high = haystack.length - 1; + if (key === lastKey) { + if (needle === lastNeedle) { + found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; + return lastIndex; + } + if (needle >= lastNeedle) { + low = lastIndex === -1 ? 0 : lastIndex; + } else { + high = lastIndex; + } + } + state.lastKey = key; + state.lastNeedle = needle; + return state.lastIndex = binarySearch(haystack, needle, low, high); + } + function buildBySources(decoded, memos) { + var sources = memos.map(buildNullArray); + for (var i = 0; i < decoded.length; i++) { + var line = decoded[i]; + for (var j = 0; j < line.length; j++) { + var seg = line[j]; + if (seg.length === 1) continue; + var sourceIndex = seg[SOURCES_INDEX]; + var sourceLine = seg[SOURCE_LINE]; + var sourceColumn = seg[SOURCE_COLUMN]; + var originalSource = sources[sourceIndex]; + var originalLine = originalSource[sourceLine] || (originalSource[sourceLine] = []); + var memo = memos[sourceIndex]; + var index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine)); + insert(originalLine, memo.lastIndex = index + 1, [sourceColumn, i, seg[COLUMN]]); + } + } + return sources; + } + function insert(array, index, value) { + for (var i = array.length; i > index; i--) { + array[i] = array[i - 1]; + } + array[index] = value; + } + function buildNullArray() { + return { + __proto__: null + }; + } + var AnyMap = function AnyMap(map, mapUrl) { + var parsed = typeof map === 'string' ? JSON.parse(map) : map; + if (!('sections' in parsed)) return new TraceMap(parsed, mapUrl); + var mappings = []; + var sources = []; + var sourcesContent = []; + var names = []; + recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, 0, 0, Infinity, Infinity); + var joined = { + version: 3, + file: parsed.file, + names: names, + sources: sources, + sourcesContent: sourcesContent, + mappings: mappings + }; + return exports.presortedDecodedMap(joined); + }; + function recurse(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) { + var sections = input.sections; + for (var i = 0; i < sections.length; i++) { + var _sections$i = sections[i], + map = _sections$i.map, + offset = _sections$i.offset; + var sl = stopLine; + var sc = stopColumn; + if (i + 1 < sections.length) { + var nextOffset = sections[i + 1].offset; + sl = Math.min(stopLine, lineOffset + nextOffset.line); + if (sl === stopLine) { + sc = Math.min(stopColumn, columnOffset + nextOffset.column); + } else if (sl < stopLine) { + sc = columnOffset + nextOffset.column; + } + } + addSection(map, mapUrl, mappings, sources, sourcesContent, names, lineOffset + offset.line, columnOffset + offset.column, sl, sc); + } + } + function addSection(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) { + if ('sections' in input) return recurse.apply(void 0, arguments); + var map = new TraceMap(input, mapUrl); + var sourcesOffset = sources.length; + var namesOffset = names.length; + var decoded = exports.decodedMappings(map); + var resolvedSources = map.resolvedSources, + contents = map.sourcesContent; + append(sources, resolvedSources); + append(names, map.names); + if (contents) append(sourcesContent, contents);else for (var i = 0; i < resolvedSources.length; i++) sourcesContent.push(null); + for (var _i = 0; _i < decoded.length; _i++) { + var lineI = lineOffset + _i; + if (lineI > stopLine) return; + var out = getLine(mappings, lineI); + var cOffset = _i === 0 ? columnOffset : 0; + var line = decoded[_i]; + for (var j = 0; j < line.length; j++) { + var seg = line[j]; + var column = cOffset + seg[COLUMN]; + if (lineI === stopLine && column >= stopColumn) return; + if (seg.length === 1) { + out.push([column]); + continue; + } + var sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; + var sourceLine = seg[SOURCE_LINE]; + var sourceColumn = seg[SOURCE_COLUMN]; + out.push(seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]); + } + } + } + function append(arr, other) { + for (var i = 0; i < other.length; i++) arr.push(other[i]); + } + function getLine(arr, index) { + for (var i = arr.length; i <= index; i++) arr[i] = []; + return arr[index]; + } + var LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)'; + var COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)'; + var LEAST_UPPER_BOUND = -1; + var GREATEST_LOWER_BOUND = 1; + exports.encodedMappings = void 0; + exports.decodedMappings = void 0; + exports.traceSegment = void 0; + exports.originalPositionFor = void 0; + exports.generatedPositionFor = void 0; + exports.allGeneratedPositionsFor = void 0; + exports.eachMapping = void 0; + exports.sourceContentFor = void 0; + exports.presortedDecodedMap = void 0; + exports.decodedMap = void 0; + exports.encodedMap = void 0; + var TraceMap = _createClass(function TraceMap(map, mapUrl) { + var isString = typeof map === 'string'; + if (!isString && map._decodedMemo) return map; + var parsed = isString ? JSON.parse(map) : map; + var version = parsed.version, + file = parsed.file, + names = parsed.names, + sourceRoot = parsed.sourceRoot, + sources = parsed.sources, + sourcesContent = parsed.sourcesContent; + this.version = version; + this.file = file; + this.names = names; + this.sourceRoot = sourceRoot; + this.sources = sources; + this.sourcesContent = sourcesContent; + var from = resolve(sourceRoot || '', stripFilename(mapUrl)); + this.resolvedSources = sources.map(function (s) { + return resolve(s || '', from); + }); + var mappings = parsed.mappings; + if (typeof mappings === 'string') { + this._encoded = mappings; + this._decoded = undefined; + } else { + this._encoded = undefined; + this._decoded = maybeSort(mappings, isString); + } + this._decodedMemo = memoizedState(); + this._bySources = undefined; + this._bySourceMemos = undefined; + }); + (function () { + exports.encodedMappings = function (map) { + var _a; + return (_a = map._encoded) !== null && _a !== void 0 ? _a : map._encoded = sourcemapCodec.encode(map._decoded); + }; + exports.decodedMappings = function (map) { + return map._decoded || (map._decoded = sourcemapCodec.decode(map._encoded)); + }; + exports.traceSegment = function (map, line, column) { + var decoded = exports.decodedMappings(map); + if (line >= decoded.length) return null; + var segments = decoded[line]; + var index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND); + return index === -1 ? null : segments[index]; + }; + exports.originalPositionFor = function (map, _ref) { + var line = _ref.line, + column = _ref.column, + bias = _ref.bias; + line--; + if (line < 0) throw new Error(LINE_GTR_ZERO); + if (column < 0) throw new Error(COL_GTR_EQ_ZERO); + var decoded = exports.decodedMappings(map); + if (line >= decoded.length) return OMapping(null, null, null, null); + var segments = decoded[line]; + var index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); + if (index === -1) return OMapping(null, null, null, null); + var segment = segments[index]; + if (segment.length === 1) return OMapping(null, null, null, null); + var names = map.names, + resolvedSources = map.resolvedSources; + return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null); + }; + exports.allGeneratedPositionsFor = function (map, _ref2) { + var source = _ref2.source, + line = _ref2.line, + column = _ref2.column, + bias = _ref2.bias; + return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true); + }; + exports.generatedPositionFor = function (map, _ref3) { + var source = _ref3.source, + line = _ref3.line, + column = _ref3.column, + bias = _ref3.bias; + return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false); + }; + exports.eachMapping = function (map, cb) { + var decoded = exports.decodedMappings(map); + var names = map.names, + resolvedSources = map.resolvedSources; + for (var i = 0; i < decoded.length; i++) { + var line = decoded[i]; + for (var j = 0; j < line.length; j++) { + var seg = line[j]; + var generatedLine = i + 1; + var generatedColumn = seg[0]; + var source = null; + var originalLine = null; + var originalColumn = null; + var name = null; + if (seg.length !== 1) { + source = resolvedSources[seg[1]]; + originalLine = seg[2] + 1; + originalColumn = seg[3]; + } + if (seg.length === 5) name = names[seg[4]]; + cb({ + generatedLine: generatedLine, + generatedColumn: generatedColumn, + source: source, + originalLine: originalLine, + originalColumn: originalColumn, + name: name + }); + } + } + }; + exports.sourceContentFor = function (map, source) { + var sources = map.sources, + resolvedSources = map.resolvedSources, + sourcesContent = map.sourcesContent; + if (sourcesContent == null) return null; + var index = sources.indexOf(source); + if (index === -1) index = resolvedSources.indexOf(source); + return index === -1 ? null : sourcesContent[index]; + }; + exports.presortedDecodedMap = function (map, mapUrl) { + var tracer = new TraceMap(clone(map, []), mapUrl); + tracer._decoded = map.mappings; + return tracer; + }; + exports.decodedMap = function (map) { + return clone(map, exports.decodedMappings(map)); + }; + exports.encodedMap = function (map) { + return clone(map, exports.encodedMappings(map)); + }; + function generatedPosition(map, source, line, column, bias, all) { + line--; + if (line < 0) throw new Error(LINE_GTR_ZERO); + if (column < 0) throw new Error(COL_GTR_EQ_ZERO); + var sources = map.sources, + resolvedSources = map.resolvedSources; + var sourceIndex = sources.indexOf(source); + if (sourceIndex === -1) sourceIndex = resolvedSources.indexOf(source); + if (sourceIndex === -1) return all ? [] : GMapping(null, null); + var generated = map._bySources || (map._bySources = buildBySources(exports.decodedMappings(map), map._bySourceMemos = sources.map(memoizedState))); + var segments = generated[sourceIndex][line]; + if (segments == null) return all ? [] : GMapping(null, null); + var memo = map._bySourceMemos[sourceIndex]; + if (all) return sliceGeneratedPositions(segments, memo, line, column, bias); + var index = traceSegmentInternal(segments, memo, line, column, bias); + if (index === -1) return GMapping(null, null); + var segment = segments[index]; + return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]); + } + })(); + function clone(map, mappings) { + return { + version: map.version, + file: map.file, + names: map.names, + sourceRoot: map.sourceRoot, + sources: map.sources, + sourcesContent: map.sourcesContent, + mappings: mappings + }; + } + function OMapping(source, line, column, name) { + return { + source: source, + line: line, + column: column, + name: name + }; + } + function GMapping(line, column) { + return { + line: line, + column: column + }; + } + function traceSegmentInternal(segments, memo, line, column, bias) { + var index = memoizedBinarySearch(segments, column, memo, line); + if (found) { + index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); + } else if (bias === LEAST_UPPER_BOUND) index++; + if (index === -1 || index === segments.length) return -1; + return index; + } + function sliceGeneratedPositions(segments, memo, line, column, bias) { + var min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND); + if (!found && bias === LEAST_UPPER_BOUND) min++; + if (min === -1 || min === segments.length) return []; + var matchedColumn = found ? column : segments[min][COLUMN]; + if (!found) min = lowerBound(segments, matchedColumn, min); + var max = upperBound(segments, matchedColumn, min); + var result = []; + for (; min <= max; min++) { + var segment = segments[min]; + result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN])); + } + return result; + } + exports.AnyMap = AnyMap; + exports.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND; + exports.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND; + exports.TraceMap = TraceMap; + Object.defineProperty(exports, '__esModule', { + value: true + }); + }); + })(traceMapping_umd, traceMapping_umd.exports); + var traceMapping_umdExports = traceMapping_umd.exports; + + genMapping_umd$1.exports; + (function (module, exports) { + (function (global, factory) { + factory(exports, requireSetArray_umd(), requireSourcemapCodec_umd$1(), traceMapping_umdExports) ; + })(commonjsGlobal, function (exports, setArray, sourcemapCodec, traceMapping) { + + var COLUMN = 0; + var SOURCES_INDEX = 1; + var SOURCE_LINE = 2; + var SOURCE_COLUMN = 3; + var NAMES_INDEX = 4; + var NO_NAME = -1; + exports.addSegment = void 0; + exports.addMapping = void 0; + exports.maybeAddSegment = void 0; + exports.maybeAddMapping = void 0; + exports.setSourceContent = void 0; + exports.toDecodedMap = void 0; + exports.toEncodedMap = void 0; + exports.fromMap = void 0; + exports.allMappings = void 0; + var addSegmentInternal; + var GenMapping = _createClass(function GenMapping(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + file = _ref.file, + sourceRoot = _ref.sourceRoot; + this._names = new setArray.SetArray(); + this._sources = new setArray.SetArray(); + this._sourcesContent = []; + this._mappings = []; + this.file = file; + this.sourceRoot = sourceRoot; + }); + (function () { + exports.addSegment = function (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) { + return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); + }; + exports.maybeAddSegment = function (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) { + return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); + }; + exports.addMapping = function (map, mapping) { + return addMappingInternal(false, map, mapping); + }; + exports.maybeAddMapping = function (map, mapping) { + return addMappingInternal(true, map, mapping); + }; + exports.setSourceContent = function (map, source, content) { + var sources = map._sources, + sourcesContent = map._sourcesContent; + sourcesContent[setArray.put(sources, source)] = content; + }; + exports.toDecodedMap = function (map) { + var file = map.file, + sourceRoot = map.sourceRoot, + mappings = map._mappings, + sources = map._sources, + sourcesContent = map._sourcesContent, + names = map._names; + removeEmptyFinalLines(mappings); + return { + version: 3, + file: file || undefined, + names: names.array, + sourceRoot: sourceRoot || undefined, + sources: sources.array, + sourcesContent: sourcesContent, + mappings: mappings + }; + }; + exports.toEncodedMap = function (map) { + var decoded = exports.toDecodedMap(map); + return Object.assign(Object.assign({}, decoded), { + mappings: sourcemapCodec.encode(decoded.mappings) + }); + }; + exports.allMappings = function (map) { + var out = []; + var mappings = map._mappings, + sources = map._sources, + names = map._names; + for (var i = 0; i < mappings.length; i++) { + var line = mappings[i]; + for (var j = 0; j < line.length; j++) { + var seg = line[j]; + var generated = { + line: i + 1, + column: seg[COLUMN] + }; + var source = undefined; + var original = undefined; + var name = undefined; + if (seg.length !== 1) { + source = sources.array[seg[SOURCES_INDEX]]; + original = { + line: seg[SOURCE_LINE] + 1, + column: seg[SOURCE_COLUMN] + }; + if (seg.length === 5) name = names.array[seg[NAMES_INDEX]]; + } + out.push({ + generated: generated, + source: source, + original: original, + name: name + }); + } + } + return out; + }; + exports.fromMap = function (input) { + var map = new traceMapping.TraceMap(input); + var gen = new GenMapping({ + file: map.file, + sourceRoot: map.sourceRoot + }); + putAll(gen._names, map.names); + putAll(gen._sources, map.sources); + gen._sourcesContent = map.sourcesContent || map.sources.map(function () { + return null; + }); + gen._mappings = traceMapping.decodedMappings(map); + return gen; + }; + addSegmentInternal = function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) { + var mappings = map._mappings, + sources = map._sources, + sourcesContent = map._sourcesContent, + names = map._names; + var line = getLine(mappings, genLine); + var index = getColumnIndex(line, genColumn); + if (!source) { + if (skipable && skipSourceless(line, index)) return; + return insert(line, index, [genColumn]); + } + var sourcesIndex = setArray.put(sources, source); + var namesIndex = name ? setArray.put(names, name) : NO_NAME; + if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null; + if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) { + return; + } + return insert(line, index, name ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] : [genColumn, sourcesIndex, sourceLine, sourceColumn]); + }; + })(); + function getLine(mappings, index) { + for (var i = mappings.length; i <= index; i++) { + mappings[i] = []; + } + return mappings[index]; + } + function getColumnIndex(line, genColumn) { + var index = line.length; + for (var i = index - 1; i >= 0; index = i--) { + var current = line[i]; + if (genColumn >= current[COLUMN]) break; + } + return index; + } + function insert(array, index, value) { + for (var i = array.length; i > index; i--) { + array[i] = array[i - 1]; + } + array[index] = value; + } + function removeEmptyFinalLines(mappings) { + var length = mappings.length; + var len = length; + for (var i = len - 1; i >= 0; len = i, i--) { + if (mappings[i].length > 0) break; + } + if (len < length) mappings.length = len; + } + function putAll(strarr, array) { + for (var i = 0; i < array.length; i++) setArray.put(strarr, array[i]); + } + function skipSourceless(line, index) { + if (index === 0) return true; + var prev = line[index - 1]; + return prev.length === 1; + } + function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) { + if (index === 0) return false; + var prev = line[index - 1]; + if (prev.length === 1) return false; + return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME); + } + function addMappingInternal(skipable, map, mapping) { + var generated = mapping.generated, + source = mapping.source, + original = mapping.original, + name = mapping.name, + content = mapping.content; + if (!source) { + return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null); + } + var s = source; + return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name, content); + } + exports.GenMapping = GenMapping; + Object.defineProperty(exports, '__esModule', { + value: true + }); + }); + })(genMapping_umd$1, genMapping_umd$1.exports); + var genMapping_umdExports$1 = genMapping_umd$1.exports; + + var SourceMap$1 = function () { + function SourceMap(opts, code) { + var _opts$sourceFileName; + this._map = void 0; + this._rawMappings = void 0; + this._sourceFileName = void 0; + this._lastGenLine = 0; + this._lastSourceLine = 0; + this._lastSourceColumn = 0; + this._inputMap = void 0; + var map = this._map = new genMapping_umdExports$1.GenMapping({ + sourceRoot: opts.sourceRoot + }); + this._sourceFileName = (_opts$sourceFileName = opts.sourceFileName) == null ? void 0 : _opts$sourceFileName.replace(/\\/g, "/"); + this._rawMappings = undefined; + if (opts.inputSourceMap) { + this._inputMap = new traceMapping_umdExports.TraceMap(opts.inputSourceMap); + var resolvedSources = this._inputMap.resolvedSources; + if (resolvedSources.length) { + for (var i = 0; i < resolvedSources.length; i++) { + var _this$_inputMap$sourc; + genMapping_umdExports$1.setSourceContent(map, resolvedSources[i], (_this$_inputMap$sourc = this._inputMap.sourcesContent) == null ? void 0 : _this$_inputMap$sourc[i]); + } + } + } + if (typeof code === "string" && !opts.inputSourceMap) { + genMapping_umdExports$1.setSourceContent(map, this._sourceFileName, code); + } else if (typeof code === "object") { + for (var _i = 0, _Object$keys = Object.keys(code); _i < _Object$keys.length; _i++) { + var _sourceFileName = _Object$keys[_i]; + genMapping_umdExports$1.setSourceContent(map, _sourceFileName.replace(/\\/g, "/"), code[_sourceFileName]); + } + } + } + var _proto = SourceMap.prototype; + _proto.get = function get() { + return genMapping_umdExports$1.toEncodedMap(this._map); + }; + _proto.getDecoded = function getDecoded() { + return genMapping_umdExports$1.toDecodedMap(this._map); + }; + _proto.getRawMappings = function getRawMappings() { + return this._rawMappings || (this._rawMappings = genMapping_umdExports$1.allMappings(this._map)); + }; + _proto.mark = function mark(generated, line, column, identifierName, identifierNamePos, filename) { + var _originalMapping; + this._rawMappings = undefined; + var originalMapping; + if (line != null) { + if (this._inputMap) { + originalMapping = traceMapping_umdExports.originalPositionFor(this._inputMap, { + line: line, + column: column + }); + if (!originalMapping.name && identifierNamePos) { + var originalIdentifierMapping = traceMapping_umdExports.originalPositionFor(this._inputMap, identifierNamePos); + if (originalIdentifierMapping.name) { + identifierName = originalIdentifierMapping.name; + } + } + } else { + originalMapping = { + source: (filename == null ? void 0 : filename.replace(/\\/g, "/")) || this._sourceFileName, + line: line, + column: column + }; + } + } + genMapping_umdExports$1.maybeAddMapping(this._map, { + name: identifierName, + generated: generated, + source: (_originalMapping = originalMapping) == null ? void 0 : _originalMapping.source, + original: originalMapping + }); + }; + return _createClass(SourceMap); + }(); + + var Buffer = function () { + function Buffer(map) { + this._map = null; + this._buf = ""; + this._str = ""; + this._appendCount = 0; + this._last = 0; + this._queue = []; + this._queueCursor = 0; + this._canMarkIdName = true; + this._position = { + line: 1, + column: 0 + }; + this._sourcePosition = { + identifierName: undefined, + identifierNamePos: undefined, + line: undefined, + column: undefined, + filename: undefined + }; + this._map = map; + this._allocQueue(); + } + var _proto = Buffer.prototype; + _proto._allocQueue = function _allocQueue() { + var queue = this._queue; + for (var i = 0; i < 16; i++) { + queue.push({ + "char": 0, + repeat: 1, + line: undefined, + column: undefined, + identifierName: undefined, + identifierNamePos: undefined, + filename: "" + }); + } + }; + _proto._pushQueue = function _pushQueue(_char, repeat, line, column, filename) { + var cursor = this._queueCursor; + if (cursor === this._queue.length) { + this._allocQueue(); + } + var item = this._queue[cursor]; + item["char"] = _char; + item.repeat = repeat; + item.line = line; + item.column = column; + item.filename = filename; + this._queueCursor++; + }; + _proto._popQueue = function _popQueue() { + if (this._queueCursor === 0) { + throw new Error("Cannot pop from empty queue"); + } + return this._queue[--this._queueCursor]; + }; + _proto.get = function get() { + this._flush(); + var map = this._map; + var result = { + code: (this._buf + this._str).trimRight(), + decodedMap: map == null ? void 0 : map.getDecoded(), + get __mergedMap() { + return this.map; + }, + get map() { + var resultMap = map ? map.get() : null; + result.map = resultMap; + return resultMap; + }, + set map(value) { + Object.defineProperty(result, "map", { + value: value, + writable: true + }); + }, + get rawMappings() { + var mappings = map == null ? void 0 : map.getRawMappings(); + result.rawMappings = mappings; + return mappings; + }, + set rawMappings(value) { + Object.defineProperty(result, "rawMappings", { + value: value, + writable: true + }); + } + }; + return result; + }; + _proto.append = function append(str, maybeNewline) { + this._flush(); + this._append(str, this._sourcePosition, maybeNewline); + }; + _proto.appendChar = function appendChar(_char2) { + this._flush(); + this._appendChar(_char2, 1, this._sourcePosition); + }; + _proto.queue = function queue(_char3) { + if (_char3 === 10) { + while (this._queueCursor !== 0) { + var _char4 = this._queue[this._queueCursor - 1]["char"]; + if (_char4 !== 32 && _char4 !== 9) { + break; + } + this._queueCursor--; + } + } + var sourcePosition = this._sourcePosition; + this._pushQueue(_char3, 1, sourcePosition.line, sourcePosition.column, sourcePosition.filename); + }; + _proto.queueIndentation = function queueIndentation(_char5, repeat) { + this._pushQueue(_char5, repeat, undefined, undefined, undefined); + }; + _proto._flush = function _flush() { + var queueCursor = this._queueCursor; + var queue = this._queue; + for (var i = 0; i < queueCursor; i++) { + var item = queue[i]; + this._appendChar(item["char"], item.repeat, item); + } + this._queueCursor = 0; + }; + _proto._appendChar = function _appendChar(_char6, repeat, sourcePos) { + this._last = _char6; + this._str += repeat > 1 ? String.fromCharCode(_char6).repeat(repeat) : String.fromCharCode(_char6); + if (_char6 !== 10) { + this._mark(sourcePos.line, sourcePos.column, sourcePos.identifierName, sourcePos.identifierNamePos, sourcePos.filename); + this._position.column += repeat; + } else { + this._position.line++; + this._position.column = 0; + } + if (this._canMarkIdName) { + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } + }; + _proto._append = function _append(str, sourcePos, maybeNewline) { + var len = str.length; + var position = this._position; + this._last = str.charCodeAt(len - 1); + if (++this._appendCount > 4096) { + +this._str; + this._buf += this._str; + this._str = str; + this._appendCount = 0; + } else { + this._str += str; + } + if (!maybeNewline && !this._map) { + position.column += len; + return; + } + var column = sourcePos.column, + identifierName = sourcePos.identifierName, + identifierNamePos = sourcePos.identifierNamePos, + filename = sourcePos.filename; + var line = sourcePos.line; + if ((identifierName != null || identifierNamePos != null) && this._canMarkIdName) { + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } + var i = str.indexOf("\n"); + var last = 0; + if (i !== 0) { + this._mark(line, column, identifierName, identifierNamePos, filename); + } + while (i !== -1) { + position.line++; + position.column = 0; + last = i + 1; + if (last < len && line !== undefined) { + this._mark(++line, 0, null, null, filename); + } + i = str.indexOf("\n", last); + } + position.column += len - last; + }; + _proto._mark = function _mark(line, column, identifierName, identifierNamePos, filename) { + var _this$_map; + (_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position, line, column, identifierName, identifierNamePos, filename); + }; + _proto.removeTrailingNewline = function removeTrailingNewline() { + var queueCursor = this._queueCursor; + if (queueCursor !== 0 && this._queue[queueCursor - 1]["char"] === 10) { + this._queueCursor--; + } + }; + _proto.removeLastSemicolon = function removeLastSemicolon() { + var queueCursor = this._queueCursor; + if (queueCursor !== 0 && this._queue[queueCursor - 1]["char"] === 59) { + this._queueCursor--; + } + }; + _proto.getLastChar = function getLastChar() { + var queueCursor = this._queueCursor; + return queueCursor !== 0 ? this._queue[queueCursor - 1]["char"] : this._last; + }; + _proto.getNewlineCount = function getNewlineCount() { + var queueCursor = this._queueCursor; + var count = 0; + if (queueCursor === 0) return this._last === 10 ? 1 : 0; + for (var i = queueCursor - 1; i >= 0; i--) { + if (this._queue[i]["char"] !== 10) { + break; + } + count++; + } + return count === queueCursor && this._last === 10 ? count + 1 : count; + }; + _proto.endsWithCharAndNewline = function endsWithCharAndNewline() { + var queue = this._queue; + var queueCursor = this._queueCursor; + if (queueCursor !== 0) { + var lastCp = queue[queueCursor - 1]["char"]; + if (lastCp !== 10) return; + if (queueCursor > 1) { + return queue[queueCursor - 2]["char"]; + } else { + return this._last; + } + } + }; + _proto.hasContent = function hasContent() { + return this._queueCursor !== 0 || !!this._last; + }; + _proto.exactSource = function exactSource(loc, cb) { + if (!this._map) { + cb(); + return; + } + this.source("start", loc); + var identifierName = loc.identifierName; + var sourcePos = this._sourcePosition; + if (identifierName) { + this._canMarkIdName = false; + sourcePos.identifierName = identifierName; + } + cb(); + if (identifierName) { + this._canMarkIdName = true; + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } + this.source("end", loc); + }; + _proto.source = function source(prop, loc) { + if (!this._map) return; + this._normalizePosition(prop, loc, 0); + }; + _proto.sourceWithOffset = function sourceWithOffset(prop, loc, columnOffset) { + if (!this._map) return; + this._normalizePosition(prop, loc, columnOffset); + }; + _proto.withSource = function withSource(prop, loc, cb) { + if (this._map) { + this.source(prop, loc); + } + cb(); + }; + _proto._normalizePosition = function _normalizePosition(prop, loc, columnOffset) { + var pos = loc[prop]; + var target = this._sourcePosition; + if (pos) { + target.line = pos.line; + target.column = Math.max(pos.column + columnOffset, 0); + target.filename = loc.filename; + } + }; + _proto.getCurrentColumn = function getCurrentColumn() { + var queue = this._queue; + var queueCursor = this._queueCursor; + var lastIndex = -1; + var len = 0; + for (var i = 0; i < queueCursor; i++) { + var item = queue[i]; + if (item["char"] === 10) { + lastIndex = len; + } + len += item.repeat; + } + return lastIndex === -1 ? this._position.column + len : len - 1 - lastIndex; + }; + _proto.getCurrentLine = function getCurrentLine() { + var count = 0; + var queue = this._queue; + for (var i = 0; i < this._queueCursor; i++) { + if (queue[i]["char"] === 10) { + count++; + } + } + return this._position.line + count; + }; + return _createClass(Buffer); + }(); + + var FLIPPED_ALIAS_KEYS$1 = FLIPPED_ALIAS_KEYS$3, + isArrayExpression = isArrayExpression$2, + isAssignmentExpression$3 = isAssignmentExpression$4, + isBinary$1 = isBinary$3, + isBlockStatement$1 = isBlockStatement$2, + isCallExpression$7 = isCallExpression$8, + isFunction$4 = isFunction$5, + isIdentifier$h = isIdentifier$j, + isLiteral$4 = isLiteral$6, + isMemberExpression$7 = isMemberExpression$8, + isObjectExpression$1 = isObjectExpression$3, + isOptionalCallExpression$2 = isOptionalCallExpression$3, + isOptionalMemberExpression$2 = isOptionalMemberExpression$3, + isStringLiteral$5 = isStringLiteral$6; + function crawlInternal(node, state) { + if (!node) return state; + if (isMemberExpression$7(node) || isOptionalMemberExpression$2(node)) { + crawlInternal(node.object, state); + if (node.computed) crawlInternal(node.property, state); + } else if (isBinary$1(node) || isAssignmentExpression$3(node)) { + crawlInternal(node.left, state); + crawlInternal(node.right, state); + } else if (isCallExpression$7(node) || isOptionalCallExpression$2(node)) { + state.hasCall = true; + crawlInternal(node.callee, state); + } else if (isFunction$4(node)) { + state.hasFunction = true; + } else if (isIdentifier$h(node)) { + state.hasHelper = state.hasHelper || node.callee && isHelper(node.callee); + } + return state; + } + function crawl(node) { + return crawlInternal(node, { + hasCall: false, + hasFunction: false, + hasHelper: false + }); + } + function isHelper(node) { + if (!node) return false; + if (isMemberExpression$7(node)) { + return isHelper(node.object) || isHelper(node.property); + } else if (isIdentifier$h(node)) { + return node.name === "require" || node.name.charCodeAt(0) === 95; + } else if (isCallExpression$7(node)) { + return isHelper(node.callee); + } else if (isBinary$1(node) || isAssignmentExpression$3(node)) { + return isIdentifier$h(node.left) && isHelper(node.left) || isHelper(node.right); + } else { + return false; + } + } + function isType$1(node) { + return isLiteral$4(node) || isObjectExpression$1(node) || isArrayExpression(node) || isIdentifier$h(node) || isMemberExpression$7(node); + } + var nodes = { + AssignmentExpression: function (_AssignmentExpression) { + function AssignmentExpression(_x) { + return _AssignmentExpression.apply(this, arguments); + } + AssignmentExpression.toString = function () { + return _AssignmentExpression.toString(); + }; + return AssignmentExpression; + }(function (node) { + var state = crawl(node.right); + if (state.hasCall && state.hasHelper || state.hasFunction) { + return state.hasFunction ? 1 | 2 : 2; + } + }), + SwitchCase: function (_SwitchCase) { + function SwitchCase(_x2, _x3) { + return _SwitchCase.apply(this, arguments); + } + SwitchCase.toString = function () { + return _SwitchCase.toString(); + }; + return SwitchCase; + }(function (node, parent) { + return (!!node.consequent.length || parent.cases[0] === node ? 1 : 0) | (!node.consequent.length && parent.cases[parent.cases.length - 1] === node ? 2 : 0); + }), + LogicalExpression: function (_LogicalExpression) { + function LogicalExpression(_x4) { + return _LogicalExpression.apply(this, arguments); + } + LogicalExpression.toString = function () { + return _LogicalExpression.toString(); + }; + return LogicalExpression; + }(function (node) { + if (isFunction$4(node.left) || isFunction$4(node.right)) { + return 2; + } + }), + Literal: function (_Literal) { + function Literal(_x5) { + return _Literal.apply(this, arguments); + } + Literal.toString = function () { + return _Literal.toString(); + }; + return Literal; + }(function (node) { + if (isStringLiteral$5(node) && node.value === "use strict") { + return 2; + } + }), + CallExpression: function (_CallExpression) { + function CallExpression(_x6) { + return _CallExpression.apply(this, arguments); + } + CallExpression.toString = function () { + return _CallExpression.toString(); + }; + return CallExpression; + }(function (node) { + if (isFunction$4(node.callee) || isHelper(node)) { + return 1 | 2; + } + }), + OptionalCallExpression: function (_OptionalCallExpression) { + function OptionalCallExpression(_x7) { + return _OptionalCallExpression.apply(this, arguments); + } + OptionalCallExpression.toString = function () { + return _OptionalCallExpression.toString(); + }; + return OptionalCallExpression; + }(function (node) { + if (isFunction$4(node.callee)) { + return 1 | 2; + } + }), + VariableDeclaration: function (_VariableDeclaration) { + function VariableDeclaration(_x8) { + return _VariableDeclaration.apply(this, arguments); + } + VariableDeclaration.toString = function () { + return _VariableDeclaration.toString(); + }; + return VariableDeclaration; + }(function (node) { + for (var i = 0; i < node.declarations.length; i++) { + var declar = node.declarations[i]; + var enabled = isHelper(declar.id) && !isType$1(declar.init); + if (!enabled && declar.init) { + var state = crawl(declar.init); + enabled = isHelper(declar.init) && state.hasCall || state.hasFunction; + } + if (enabled) { + return 1 | 2; + } + } + }), + IfStatement: function (_IfStatement) { + function IfStatement(_x9) { + return _IfStatement.apply(this, arguments); + } + IfStatement.toString = function () { + return _IfStatement.toString(); + }; + return IfStatement; + }(function (node) { + if (isBlockStatement$1(node.consequent)) { + return 1 | 2; + } + }) + }; + nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function (node, parent) { + if (parent.properties[0] === node) { + return 1; + } + }; + nodes.ObjectTypeCallProperty = function (node, parent) { + var _parent$properties; + if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) != null && _parent$properties.length)) { + return 1; + } + }; + nodes.ObjectTypeIndexer = function (node, parent) { + var _parent$properties2, _parent$callPropertie; + if (parent.indexers[0] === node && !((_parent$properties2 = parent.properties) != null && _parent$properties2.length) && !((_parent$callPropertie = parent.callProperties) != null && _parent$callPropertie.length)) { + return 1; + } + }; + nodes.ObjectTypeInternalSlot = function (node, parent) { + var _parent$properties3, _parent$callPropertie2, _parent$indexers; + if (parent.internalSlots[0] === node && !((_parent$properties3 = parent.properties) != null && _parent$properties3.length) && !((_parent$callPropertie2 = parent.callProperties) != null && _parent$callPropertie2.length) && !((_parent$indexers = parent.indexers) != null && _parent$indexers.length)) { + return 1; + } + }; + [["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + type = _ref2[0], + amounts = _ref2[1]; + [type].concat(FLIPPED_ALIAS_KEYS$1[type] || []).forEach(function (type) { + var ret = amounts ? 1 | 2 : 0; + nodes[type] = function () { + return ret; + }; + }); + }); + + var isArrayTypeAnnotation$1 = isArrayTypeAnnotation$2, + isArrowFunctionExpression = isArrowFunctionExpression$1, + isAssignmentExpression$2 = isAssignmentExpression$4, + isAwaitExpression = isAwaitExpression$1, + isBinary = isBinary$3, + isBinaryExpression = isBinaryExpression$1, + isUpdateExpression$1 = isUpdateExpression$2, + isCallExpression$6 = isCallExpression$8, + isClass = isClass$2, + isClassExpression = isClassExpression$1, + isConditional = isConditional$1, + isConditionalExpression = isConditionalExpression$1, + isExportDeclaration$1 = isExportDeclaration$3, + isExportDefaultDeclaration$1 = isExportDefaultDeclaration$3, + isExpressionStatement$2 = isExpressionStatement$3, + isFor$1 = isFor$2, + isForInStatement = isForInStatement$1, + isForOfStatement$1 = isForOfStatement$2, + isForStatement$2 = isForStatement$3, + isFunctionExpression = isFunctionExpression$1, + isIfStatement$1 = isIfStatement$2, + isIndexedAccessType = isIndexedAccessType$1, + isIntersectionTypeAnnotation = isIntersectionTypeAnnotation$1, + isLogicalExpression = isLogicalExpression$1, + isMemberExpression$6 = isMemberExpression$8, + isNewExpression$3 = isNewExpression$4, + isNullableTypeAnnotation = isNullableTypeAnnotation$1, + isObjectPattern$1 = isObjectPattern$2, + isOptionalCallExpression$1 = isOptionalCallExpression$3, + isOptionalMemberExpression$1 = isOptionalMemberExpression$3, + isReturnStatement = isReturnStatement$1, + isSequenceExpression$1 = isSequenceExpression$2, + isSwitchStatement = isSwitchStatement$1, + isTSArrayType$1 = isTSArrayType$2, + isTSAsExpression$1 = isTSAsExpression$2, + isTSInstantiationExpression = isTSInstantiationExpression$1, + isTSIntersectionType = isTSIntersectionType$1, + isTSNonNullExpression$1 = isTSNonNullExpression$2, + isTSOptionalType = isTSOptionalType$1, + isTSRestType = isTSRestType$1, + isTSTypeAssertion$1 = isTSTypeAssertion$2, + isTSUnionType = isTSUnionType$1, + isTaggedTemplateExpression = isTaggedTemplateExpression$2, + isThrowStatement = isThrowStatement$1, + isTypeAnnotation$1 = isTypeAnnotation$2, + isUnaryLike = isUnaryLike$1, + isUnionTypeAnnotation$1 = isUnionTypeAnnotation$2, + isVariableDeclarator$1 = isVariableDeclarator$2, + isWhileStatement = isWhileStatement$1, + isYieldExpression = isYieldExpression$1, + isTSSatisfiesExpression$1 = isTSSatisfiesExpression$2; + var PRECEDENCE = { + "||": 0, + "??": 0, + "|>": 0, + "&&": 1, + "|": 2, + "^": 3, + "&": 4, + "==": 5, + "===": 5, + "!=": 5, + "!==": 5, + "<": 6, + ">": 6, + "<=": 6, + ">=": 6, + "in": 6, + "instanceof": 6, + ">>": 7, + "<<": 7, + ">>>": 7, + "+": 8, + "-": 8, + "*": 9, + "/": 9, + "%": 9, + "**": 10 + }; + function isTSTypeExpression(node) { + return isTSAsExpression$1(node) || isTSSatisfiesExpression$1(node) || isTSTypeAssertion$1(node); + } + var isClassExtendsClause = function isClassExtendsClause(node, parent) { + return isClass(parent, { + superClass: node + }); + }; + var hasPostfixPart = function hasPostfixPart(node, parent) { + return (isMemberExpression$6(parent) || isOptionalMemberExpression$1(parent)) && parent.object === node || (isCallExpression$6(parent) || isOptionalCallExpression$1(parent) || isNewExpression$3(parent)) && parent.callee === node || isTaggedTemplateExpression(parent) && parent.tag === node || isTSNonNullExpression$1(parent); + }; + function NullableTypeAnnotation$1(node, parent) { + return isArrayTypeAnnotation$1(parent); + } + function FunctionTypeAnnotation$1(node, parent, printStack) { + if (printStack.length < 3) return; + return isUnionTypeAnnotation$1(parent) || isIntersectionTypeAnnotation(parent) || isArrayTypeAnnotation$1(parent) || isTypeAnnotation$1(parent) && isArrowFunctionExpression(printStack[printStack.length - 3]); + } + function UpdateExpression$2(node, parent) { + return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent); + } + function ObjectExpression$2(node, parent, printStack) { + return isFirstInContext(printStack, 1 | 2); + } + function DoExpression$1(node, parent, printStack) { + return !node.async && isFirstInContext(printStack, 1); + } + function Binary(node, parent) { + if (node.operator === "**" && isBinaryExpression(parent, { + operator: "**" + })) { + return parent.left === node; + } + if (isClassExtendsClause(node, parent)) { + return true; + } + if (hasPostfixPart(node, parent) || isUnaryLike(parent) || isAwaitExpression(parent)) { + return true; + } + if (isBinary(parent)) { + var parentOp = parent.operator; + var parentPos = PRECEDENCE[parentOp]; + var nodeOp = node.operator; + var nodePos = PRECEDENCE[nodeOp]; + if (parentPos === nodePos && parent.right === node && !isLogicalExpression(parent) || parentPos > nodePos) { + return true; + } + } + } + function UnionTypeAnnotation$1(node, parent) { + return isArrayTypeAnnotation$1(parent) || isNullableTypeAnnotation(parent) || isIntersectionTypeAnnotation(parent) || isUnionTypeAnnotation$1(parent); + } + function OptionalIndexedAccessType$1(node, parent) { + return isIndexedAccessType(parent, { + objectType: node + }); + } + function TSAsExpression$1() { + return true; + } + function TSUnionType$1(node, parent) { + return isTSArrayType$1(parent) || isTSOptionalType(parent) || isTSIntersectionType(parent) || isTSUnionType(parent) || isTSRestType(parent); + } + function TSInferType$1(node, parent) { + return isTSArrayType$1(parent) || isTSOptionalType(parent); + } + function TSInstantiationExpression$1(node, parent) { + return (isCallExpression$6(parent) || isOptionalCallExpression$1(parent) || isNewExpression$3(parent) || isTSInstantiationExpression(parent)) && !!parent.typeParameters; + } + function BinaryExpression$1(node, parent) { + return node.operator === "in" && (isVariableDeclarator$1(parent) || isFor$1(parent)); + } + function SequenceExpression$2(node, parent) { + if (isForStatement$2(parent) || isThrowStatement(parent) || isReturnStatement(parent) || isIfStatement$1(parent) && parent.test === node || isWhileStatement(parent) && parent.test === node || isForInStatement(parent) && parent.right === node || isSwitchStatement(parent) && parent.discriminant === node || isExpressionStatement$2(parent) && parent.expression === node) { + return false; + } + return true; + } + function YieldExpression$1(node, parent) { + return isBinary(parent) || isUnaryLike(parent) || hasPostfixPart(node, parent) || isAwaitExpression(parent) && isYieldExpression(node) || isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent); + } + function ClassExpression(node, parent, printStack) { + return isFirstInContext(printStack, 1 | 4); + } + function UnaryLike(node, parent) { + return hasPostfixPart(node, parent) || isBinaryExpression(parent, { + operator: "**", + left: node + }) || isClassExtendsClause(node, parent); + } + function FunctionExpression$1(node, parent, printStack) { + return isFirstInContext(printStack, 1 | 4); + } + function ArrowFunctionExpression$1(node, parent) { + return isExportDeclaration$1(parent) || ConditionalExpression$2(node, parent); + } + function ConditionalExpression$2(node, parent) { + if (isUnaryLike(parent) || isBinary(parent) || isConditionalExpression(parent, { + test: node + }) || isAwaitExpression(parent) || isTSTypeExpression(parent)) { + return true; + } + return UnaryLike(node, parent); + } + function OptionalMemberExpression$1(node, parent) { + return isCallExpression$6(parent, { + callee: node + }) || isMemberExpression$6(parent, { + object: node + }); + } + function AssignmentExpression$2(node, parent) { + if (isObjectPattern$1(node.left)) { + return true; + } else { + return ConditionalExpression$2(node, parent); + } + } + function LogicalExpression$1(node, parent) { + if (isTSTypeExpression(parent)) return true; + switch (node.operator) { + case "||": + if (!isLogicalExpression(parent)) return false; + return parent.operator === "??" || parent.operator === "&&"; + case "&&": + return isLogicalExpression(parent, { + operator: "??" + }); + case "??": + return isLogicalExpression(parent) && parent.operator !== "??"; + } + } + function Identifier$1(node, parent, printStack) { + var _node$extra; + if ((_node$extra = node.extra) != null && _node$extra.parenthesized && isAssignmentExpression$2(parent, { + left: node + }) && (isFunctionExpression(parent.right) || isClassExpression(parent.right)) && parent.right.id == null) { + return true; + } + if (node.name === "let") { + var isFollowedByBracket = isMemberExpression$6(parent, { + object: node, + computed: true + }) || isOptionalMemberExpression$1(parent, { + object: node, + computed: true, + optional: false + }); + return isFirstInContext(printStack, isFollowedByBracket ? 1 | 8 | 16 | 32 : 32); + } + return node.name === "async" && isForOfStatement$1(parent) && node === parent.left; + } + function isFirstInContext(printStack, checkParam) { + var expressionStatement = checkParam & 1; + var arrowBody = checkParam & 2; + var exportDefault = checkParam & 4; + var forHead = checkParam & 8; + var forInHead = checkParam & 16; + var forOfHead = checkParam & 32; + var i = printStack.length - 1; + if (i <= 0) return; + var node = printStack[i]; + i--; + var parent = printStack[i]; + while (i >= 0) { + if (expressionStatement && isExpressionStatement$2(parent, { + expression: node + }) || exportDefault && isExportDefaultDeclaration$1(parent, { + declaration: node + }) || arrowBody && isArrowFunctionExpression(parent, { + body: node + }) || forHead && isForStatement$2(parent, { + init: node + }) || forInHead && isForInStatement(parent, { + left: node + }) || forOfHead && isForOfStatement$1(parent, { + left: node + })) { + return true; + } + if (i > 0 && (hasPostfixPart(node, parent) && !isNewExpression$3(parent) || isSequenceExpression$1(parent) && parent.expressions[0] === node || isUpdateExpression$1(parent) && !parent.prefix || isConditional(parent, { + test: node + }) || isBinary(parent, { + left: node + }) || isAssignmentExpression$2(parent, { + left: node + }))) { + node = parent; + i--; + parent = printStack[i]; + } else { + return false; + } + } + return false; + } + + var parens = /*#__PURE__*/Object.freeze({ + __proto__: null, + NullableTypeAnnotation: NullableTypeAnnotation$1, + FunctionTypeAnnotation: FunctionTypeAnnotation$1, + UpdateExpression: UpdateExpression$2, + ObjectExpression: ObjectExpression$2, + DoExpression: DoExpression$1, + Binary: Binary, + UnionTypeAnnotation: UnionTypeAnnotation$1, + IntersectionTypeAnnotation: UnionTypeAnnotation$1, + OptionalIndexedAccessType: OptionalIndexedAccessType$1, + TSAsExpression: TSAsExpression$1, + TSSatisfiesExpression: TSAsExpression$1, + TSTypeAssertion: TSAsExpression$1, + TSUnionType: TSUnionType$1, + TSIntersectionType: TSUnionType$1, + TSInferType: TSInferType$1, + TSInstantiationExpression: TSInstantiationExpression$1, + BinaryExpression: BinaryExpression$1, + SequenceExpression: SequenceExpression$2, + YieldExpression: YieldExpression$1, + AwaitExpression: YieldExpression$1, + ClassExpression: ClassExpression, + UnaryLike: UnaryLike, + FunctionExpression: FunctionExpression$1, + ArrowFunctionExpression: ArrowFunctionExpression$1, + ConditionalExpression: ConditionalExpression$2, + OptionalMemberExpression: OptionalMemberExpression$1, + OptionalCallExpression: OptionalMemberExpression$1, + AssignmentExpression: AssignmentExpression$2, + LogicalExpression: LogicalExpression$1, + Identifier: Identifier$1 + }); + + var FLIPPED_ALIAS_KEYS = FLIPPED_ALIAS_KEYS$3, + isCallExpression$5 = isCallExpression$8, + isMemberExpression$5 = isMemberExpression$8, + isNewExpression$2 = isNewExpression$4; + function expandAliases(obj) { + var newObj = {}; + function add(type, func) { + var fn = newObj[type]; + newObj[type] = fn ? function (node, parent, stack) { + var result = fn(node, parent, stack); + return result == null ? func(node, parent, stack) : result; + } : func; + } + for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) { + var type = _Object$keys[_i]; + var aliases = FLIPPED_ALIAS_KEYS[type]; + if (aliases) { + for (var _iterator = _createForOfIteratorHelperLoose(aliases), _step; !(_step = _iterator()).done;) { + var alias = _step.value; + add(alias, obj[type]); + } + } else { + add(type, obj[type]); + } + } + return newObj; + } + var expandedParens = expandAliases(parens); + expandAliases(nodes); + function find$2(obj, node, parent, printStack) { + var fn = obj[node.type]; + return fn ? fn(node, parent, printStack) : null; + } + function isOrHasCallExpression(node) { + if (isCallExpression$5(node)) { + return true; + } + return isMemberExpression$5(node) && isOrHasCallExpression(node.object); + } + function needsParens$1(node, parent, printStack) { + if (!parent) return false; + if (isNewExpression$2(parent) && parent.callee === node) { + if (isOrHasCallExpression(node)) return true; + } + return find$2(expandedParens, node, parent, printStack); + } + + function TaggedTemplateExpression$1(node) { + this.print(node.tag, node); + this.print(node.typeParameters, node); + this.print(node.quasi, node); + } + function TemplateElement(node, parent) { + var isFirst = parent.quasis[0] === node; + var isLast = parent.quasis[parent.quasis.length - 1] === node; + var value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); + this.token(value, true); + } + function TemplateLiteral$1(node) { + var quasis = node.quasis; + for (var i = 0; i < quasis.length; i++) { + this.print(quasis[i], node); + if (i + 1 < quasis.length) { + this.print(node.expressions[i], node); + } + } + } + + var isCallExpression$4 = isCallExpression$8, + isLiteral$3 = isLiteral$6, + isMemberExpression$4 = isMemberExpression$8, + isNewExpression$1 = isNewExpression$4; + function UnaryExpression$1(node) { + var operator = node.operator; + if (operator === "void" || operator === "delete" || operator === "typeof" || operator === "throw") { + this.word(operator); + this.space(); + } else { + this.token(operator); + } + this.print(node.argument, node); + } + function DoExpression(node) { + if (node.async) { + this.word("async", true); + this.space(); + } + this.word("do"); + this.space(); + this.print(node.body, node); + } + function ParenthesizedExpression$1(node) { + this.tokenChar(40); + this.print(node.expression, node); + this.rightParens(node); + } + function UpdateExpression$1(node) { + if (node.prefix) { + this.token(node.operator); + this.print(node.argument, node); + } else { + this.printTerminatorless(node.argument, node, true); + this.token(node.operator); + } + } + function ConditionalExpression$1(node) { + this.print(node.test, node); + this.space(); + this.tokenChar(63); + this.space(); + this.print(node.consequent, node); + this.space(); + this.tokenChar(58); + this.space(); + this.print(node.alternate, node); + } + function NewExpression$1(node, parent) { + this.word("new"); + this.space(); + this.print(node.callee, node); + if (this.format.minified && node.arguments.length === 0 && !node.optional && !isCallExpression$4(parent, { + callee: node + }) && !isMemberExpression$4(parent) && !isNewExpression$1(parent)) { + return; + } + this.print(node.typeArguments, node); + this.print(node.typeParameters, node); + if (node.optional) { + this.token("?."); + } + this.tokenChar(40); + this.printList(node.arguments, node); + this.rightParens(node); + } + function SequenceExpression$1(node) { + this.printList(node.expressions, node); + } + function ThisExpression() { + this.word("this"); + } + function Super() { + this.word("super"); + } + function isDecoratorMemberExpression(node) { + switch (node.type) { + case "Identifier": + return true; + case "MemberExpression": + return !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object); + default: + return false; + } + } + function shouldParenthesizeDecoratorExpression(node) { + if (node.type === "ParenthesizedExpression") { + return false; + } + return !isDecoratorMemberExpression(node.type === "CallExpression" ? node.callee : node); + } + function _shouldPrintDecoratorsBeforeExport(node) { + if (typeof this.format.decoratorsBeforeExport === "boolean") { + return this.format.decoratorsBeforeExport; + } + return typeof node.start === "number" && node.start === node.declaration.start; + } + function Decorator(node) { + this.tokenChar(64); + var expression = node.expression; + if (shouldParenthesizeDecoratorExpression(expression)) { + this.tokenChar(40); + this.print(expression, node); + this.tokenChar(41); + } else { + this.print(expression, node); + } + this.newline(); + } + function OptionalMemberExpression(node) { + var computed = node.computed; + var optional = node.optional, + property = node.property; + this.print(node.object, node); + if (!computed && isMemberExpression$4(property)) { + throw new TypeError("Got a MemberExpression for MemberExpression property"); + } + if (isLiteral$3(property) && typeof property.value === "number") { + computed = true; + } + if (optional) { + this.token("?."); + } + if (computed) { + this.tokenChar(91); + this.print(property, node); + this.tokenChar(93); + } else { + if (!optional) { + this.tokenChar(46); + } + this.print(property, node); + } + } + function OptionalCallExpression(node) { + this.print(node.callee, node); + this.print(node.typeParameters, node); + if (node.optional) { + this.token("?."); + } + this.print(node.typeArguments, node); + this.tokenChar(40); + this.printList(node.arguments, node); + this.rightParens(node); + } + function CallExpression$1(node) { + this.print(node.callee, node); + this.print(node.typeArguments, node); + this.print(node.typeParameters, node); + this.tokenChar(40); + this.printList(node.arguments, node); + this.rightParens(node); + } + function Import() { + this.word("import"); + } + function AwaitExpression(node) { + this.word("await"); + if (node.argument) { + this.space(); + this.printTerminatorless(node.argument, node, false); + } + } + function YieldExpression(node) { + this.word("yield", true); + if (node.delegate) { + this.tokenChar(42); + if (node.argument) { + this.space(); + this.print(node.argument, node); + } + } else { + if (node.argument) { + this.space(); + this.printTerminatorless(node.argument, node, false); + } + } + } + function EmptyStatement() { + this.semicolon(true); + } + function ExpressionStatement(node) { + this.print(node.expression, node); + this.semicolon(); + } + function AssignmentPattern(node) { + this.print(node.left, node); + if (node.left.optional) this.tokenChar(63); + this.print(node.left.typeAnnotation, node); + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.right, node); + } + function AssignmentExpression$1(node, parent) { + var parens = this.inForStatementInitCounter && node.operator === "in" && !needsParens$1(node, parent); + if (parens) { + this.tokenChar(40); + } + this.print(node.left, node); + this.space(); + if (node.operator === "in" || node.operator === "instanceof") { + this.word(node.operator); + } else { + this.token(node.operator); + } + this.space(); + this.print(node.right, node); + if (parens) { + this.tokenChar(41); + } + } + function BindExpression(node) { + this.print(node.object, node); + this.token("::"); + this.print(node.callee, node); + } + function MemberExpression(node) { + this.print(node.object, node); + if (!node.computed && isMemberExpression$4(node.property)) { + throw new TypeError("Got a MemberExpression for MemberExpression property"); + } + var computed = node.computed; + if (isLiteral$3(node.property) && typeof node.property.value === "number") { + computed = true; + } + if (computed) { + this.tokenChar(91); + this.print(node.property, node); + this.tokenChar(93); + } else { + this.tokenChar(46); + this.print(node.property, node); + } + } + function MetaProperty(node) { + this.print(node.meta, node); + this.tokenChar(46); + this.print(node.property, node); + } + function PrivateName(node) { + this.tokenChar(35); + this.print(node.id, node); + } + function V8IntrinsicIdentifier(node) { + this.tokenChar(37); + this.word(node.name); + } + function ModuleExpression(node) { + this.word("module", true); + this.space(); + this.tokenChar(123); + this.indent(); + var body = node.body; + if (body.body.length || body.directives.length) { + this.newline(); + } + this.print(body, node); + this.dedent(); + this.rightBrace(node); + } + + var isFor = isFor$2, + isForStatement$1 = isForStatement$3, + isIfStatement = isIfStatement$2, + isStatement$7 = isStatement$8; + function WithStatement(node) { + this.word("with"); + this.space(); + this.tokenChar(40); + this.print(node.object, node); + this.tokenChar(41); + this.printBlock(node); + } + function IfStatement(node) { + this.word("if"); + this.space(); + this.tokenChar(40); + this.print(node.test, node); + this.tokenChar(41); + this.space(); + var needsBlock = node.alternate && isIfStatement(getLastStatement(node.consequent)); + if (needsBlock) { + this.tokenChar(123); + this.newline(); + this.indent(); + } + this.printAndIndentOnComments(node.consequent, node); + if (needsBlock) { + this.dedent(); + this.newline(); + this.tokenChar(125); + } + if (node.alternate) { + if (this.endsWith(125)) this.space(); + this.word("else"); + this.space(); + this.printAndIndentOnComments(node.alternate, node); + } + } + function getLastStatement(statement) { + var body = statement.body; + if (isStatement$7(body) === false) { + return statement; + } + return getLastStatement(body); + } + function ForStatement(node) { + this.word("for"); + this.space(); + this.tokenChar(40); + this.inForStatementInitCounter++; + this.print(node.init, node); + this.inForStatementInitCounter--; + this.tokenChar(59); + if (node.test) { + this.space(); + this.print(node.test, node); + } + this.tokenChar(59); + if (node.update) { + this.space(); + this.print(node.update, node); + } + this.tokenChar(41); + this.printBlock(node); + } + function WhileStatement(node) { + this.word("while"); + this.space(); + this.tokenChar(40); + this.print(node.test, node); + this.tokenChar(41); + this.printBlock(node); + } + function ForXStatement(node) { + this.word("for"); + this.space(); + var isForOf = node.type === "ForOfStatement"; + if (isForOf && node["await"]) { + this.word("await"); + this.space(); + } + this.noIndentInnerCommentsHere(); + this.tokenChar(40); + this.print(node.left, node); + this.space(); + this.word(isForOf ? "of" : "in"); + this.space(); + this.print(node.right, node); + this.tokenChar(41); + this.printBlock(node); + } + var ForInStatement = ForXStatement; + var ForOfStatement = ForXStatement; + function DoWhileStatement(node) { + this.word("do"); + this.space(); + this.print(node.body, node); + this.space(); + this.word("while"); + this.space(); + this.tokenChar(40); + this.print(node.test, node); + this.tokenChar(41); + this.semicolon(); + } + function printStatementAfterKeyword(printer, node, parent, isLabel) { + if (node) { + printer.space(); + printer.printTerminatorless(node, parent, isLabel); + } + printer.semicolon(); + } + function BreakStatement(node) { + this.word("break"); + printStatementAfterKeyword(this, node.label, node, true); + } + function ContinueStatement(node) { + this.word("continue"); + printStatementAfterKeyword(this, node.label, node, true); + } + function ReturnStatement(node) { + this.word("return"); + printStatementAfterKeyword(this, node.argument, node, false); + } + function ThrowStatement(node) { + this.word("throw"); + printStatementAfterKeyword(this, node.argument, node, false); + } + function LabeledStatement(node) { + this.print(node.label, node); + this.tokenChar(58); + this.space(); + this.print(node.body, node); + } + function TryStatement(node) { + this.word("try"); + this.space(); + this.print(node.block, node); + this.space(); + if (node.handlers) { + this.print(node.handlers[0], node); + } else { + this.print(node.handler, node); + } + if (node.finalizer) { + this.space(); + this.word("finally"); + this.space(); + this.print(node.finalizer, node); + } + } + function CatchClause(node) { + this.word("catch"); + this.space(); + if (node.param) { + this.tokenChar(40); + this.print(node.param, node); + this.print(node.param.typeAnnotation, node); + this.tokenChar(41); + this.space(); + } + this.print(node.body, node); + } + function SwitchStatement(node) { + this.word("switch"); + this.space(); + this.tokenChar(40); + this.print(node.discriminant, node); + this.tokenChar(41); + this.space(); + this.tokenChar(123); + this.printSequence(node.cases, node, { + indent: true, + addNewlines: function addNewlines(leading, cas) { + if (!leading && node.cases[node.cases.length - 1] === cas) return -1; + } + }); + this.rightBrace(node); + } + function SwitchCase(node) { + if (node.test) { + this.word("case"); + this.space(); + this.print(node.test, node); + this.tokenChar(58); + } else { + this.word("default"); + this.tokenChar(58); + } + if (node.consequent.length) { + this.newline(); + this.printSequence(node.consequent, node, { + indent: true + }); + } + } + function DebuggerStatement() { + this.word("debugger"); + this.semicolon(); + } + function VariableDeclaration(node, parent) { + if (node.declare) { + this.word("declare"); + this.space(); + } + var kind = node.kind; + this.word(kind, kind === "using" || kind === "await using"); + this.space(); + var hasInits = false; + if (!isFor(parent)) { + for (var _iterator = _createForOfIteratorHelperLoose(node.declarations), _step; !(_step = _iterator()).done;) { + var declar = _step.value; + if (declar.init) { + hasInits = true; + } + } + } + this.printList(node.declarations, node, { + separator: hasInits ? function () { + this.tokenChar(44); + this.newline(); + } : undefined, + indent: node.declarations.length > 1 ? true : false + }); + if (isFor(parent)) { + if (isForStatement$1(parent)) { + if (parent.init === node) return; + } else { + if (parent.left === node) return; + } + } + this.semicolon(); + } + function VariableDeclarator$1(node) { + this.print(node.id, node); + if (node.definite) this.tokenChar(33); + this.print(node.id.typeAnnotation, node); + if (node.init) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.init, node); + } + } + + var isExportDefaultDeclaration = isExportDefaultDeclaration$3, + isExportNamedDeclaration$1 = isExportNamedDeclaration$3; + function ClassDeclaration(node, parent) { + var inExport = isExportDefaultDeclaration(parent) || isExportNamedDeclaration$1(parent); + if (!inExport || !this._shouldPrintDecoratorsBeforeExport(parent)) { + this.printJoin(node.decorators, node); + } + if (node.declare) { + this.word("declare"); + this.space(); + } + if (node["abstract"]) { + this.word("abstract"); + this.space(); + } + this.word("class"); + if (node.id) { + this.space(); + this.print(node.id, node); + } + this.print(node.typeParameters, node); + if (node.superClass) { + this.space(); + this.word("extends"); + this.space(); + this.print(node.superClass, node); + this.print(node.superTypeParameters, node); + } + if (node["implements"]) { + this.space(); + this.word("implements"); + this.space(); + this.printList(node["implements"], node); + } + this.space(); + this.print(node.body, node); + } + function ClassBody(node) { + this.tokenChar(123); + if (node.body.length === 0) { + this.tokenChar(125); + } else { + this.newline(); + this.printSequence(node.body, node, { + indent: true + }); + if (!this.endsWith(10)) this.newline(); + this.rightBrace(node); + } + } + function ClassProperty(node) { + var _node$key$loc; + this.printJoin(node.decorators, node); + var endLine = (_node$key$loc = node.key.loc) == null || (_node$key$loc = _node$key$loc.end) == null ? void 0 : _node$key$loc.line; + if (endLine) this.catchUp(endLine); + this.tsPrintClassMemberModifiers(node); + if (node.computed) { + this.tokenChar(91); + this.print(node.key, node); + this.tokenChar(93); + } else { + this._variance(node); + this.print(node.key, node); + } + if (node.optional) { + this.tokenChar(63); + } + if (node.definite) { + this.tokenChar(33); + } + this.print(node.typeAnnotation, node); + if (node.value) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.value, node); + } + this.semicolon(); + } + function ClassAccessorProperty(node) { + var _node$key$loc2; + this.printJoin(node.decorators, node); + var endLine = (_node$key$loc2 = node.key.loc) == null || (_node$key$loc2 = _node$key$loc2.end) == null ? void 0 : _node$key$loc2.line; + if (endLine) this.catchUp(endLine); + this.tsPrintClassMemberModifiers(node); + this.word("accessor", true); + this.space(); + if (node.computed) { + this.tokenChar(91); + this.print(node.key, node); + this.tokenChar(93); + } else { + this._variance(node); + this.print(node.key, node); + } + if (node.optional) { + this.tokenChar(63); + } + if (node.definite) { + this.tokenChar(33); + } + this.print(node.typeAnnotation, node); + if (node.value) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.value, node); + } + this.semicolon(); + } + function ClassPrivateProperty(node) { + this.printJoin(node.decorators, node); + if (node["static"]) { + this.word("static"); + this.space(); + } + this.print(node.key, node); + this.print(node.typeAnnotation, node); + if (node.value) { + this.space(); + this.tokenChar(61); + this.space(); + this.print(node.value, node); + } + this.semicolon(); + } + function ClassMethod(node) { + this._classMethodHead(node); + this.space(); + this.print(node.body, node); + } + function ClassPrivateMethod(node) { + this._classMethodHead(node); + this.space(); + this.print(node.body, node); + } + function _classMethodHead(node) { + var _node$key$loc3; + this.printJoin(node.decorators, node); + var endLine = (_node$key$loc3 = node.key.loc) == null || (_node$key$loc3 = _node$key$loc3.end) == null ? void 0 : _node$key$loc3.line; + if (endLine) this.catchUp(endLine); + this.tsPrintClassMemberModifiers(node); + this._methodHead(node); + } + function StaticBlock(node) { + this.word("static"); + this.space(); + this.tokenChar(123); + if (node.body.length === 0) { + this.tokenChar(125); + } else { + this.newline(); + this.printSequence(node.body, node, { + indent: true + }); + this.rightBrace(node); + } + } + + var isIdentifier$g = isIdentifier$j; + function _params(node, idNode, parentNode) { + this.print(node.typeParameters, node); + var nameInfo = _getFuncIdName.call(this, idNode, parentNode); + if (nameInfo) { + this.sourceIdentifierName(nameInfo.name, nameInfo.pos); + } + this.tokenChar(40); + this._parameters(node.params, node); + this.tokenChar(41); + var noLineTerminator = node.type === "ArrowFunctionExpression"; + this.print(node.returnType, node, noLineTerminator); + this._noLineTerminator = noLineTerminator; + } + function _parameters(parameters, parent) { + var paramLength = parameters.length; + for (var i = 0; i < paramLength; i++) { + this._param(parameters[i], parent); + if (i < parameters.length - 1) { + this.tokenChar(44); + this.space(); + } + } + } + function _param(parameter, parent) { + this.printJoin(parameter.decorators, parameter); + this.print(parameter, parent); + if (parameter.optional) { + this.tokenChar(63); + } + this.print(parameter.typeAnnotation, parameter); + } + function _methodHead(node) { + var kind = node.kind; + var key = node.key; + if (kind === "get" || kind === "set") { + this.word(kind); + this.space(); + } + if (node.async) { + this.word("async", true); + this.space(); + } + if (kind === "method" || kind === "init") { + if (node.generator) { + this.tokenChar(42); + } + } + if (node.computed) { + this.tokenChar(91); + this.print(key, node); + this.tokenChar(93); + } else { + this.print(key, node); + } + if (node.optional) { + this.tokenChar(63); + } + this._params(node, node.computed && node.key.type !== "StringLiteral" ? undefined : node.key, undefined); + } + function _predicate(node, noLineTerminatorAfter) { + if (node.predicate) { + if (!node.returnType) { + this.tokenChar(58); + } + this.space(); + this.print(node.predicate, node, noLineTerminatorAfter); + } + } + function _functionHead(node, parent) { + if (node.async) { + this.word("async"); + this._endsWithInnerRaw = false; + this.space(); + } + this.word("function"); + if (node.generator) { + this._endsWithInnerRaw = false; + this.tokenChar(42); + } + this.space(); + if (node.id) { + this.print(node.id, node); + } + this._params(node, node.id, parent); + if (node.type !== "TSDeclareFunction") { + this._predicate(node); + } + } + function FunctionExpression(node, parent) { + this._functionHead(node, parent); + this.space(); + this.print(node.body, node); + } + function ArrowFunctionExpression(node, parent) { + if (node.async) { + this.word("async", true); + this.space(); + } + var firstParam; + if (!this.format.retainLines && node.params.length === 1 && isIdentifier$g(firstParam = node.params[0]) && !hasTypesOrComments(node, firstParam)) { + this.print(firstParam, node, true); + } else { + this._params(node, undefined, parent); + } + this._predicate(node, true); + this.space(); + this.printInnerComments(); + this.token("=>"); + this.space(); + this.print(node.body, node); + } + function hasTypesOrComments(node, param) { + var _param$leadingComment, _param$trailingCommen; + return !!(node.typeParameters || node.returnType || node.predicate || param.typeAnnotation || param.optional || (_param$leadingComment = param.leadingComments) != null && _param$leadingComment.length || (_param$trailingCommen = param.trailingComments) != null && _param$trailingCommen.length); + } + function _getFuncIdName(idNode, parent) { + var id = idNode; + if (!id && parent) { + var parentType = parent.type; + if (parentType === "VariableDeclarator") { + id = parent.id; + } else if (parentType === "AssignmentExpression" || parentType === "AssignmentPattern") { + id = parent.left; + } else if (parentType === "ObjectProperty" || parentType === "ClassProperty") { + if (!parent.computed || parent.key.type === "StringLiteral") { + id = parent.key; + } + } else if (parentType === "ClassPrivateProperty" || parentType === "ClassAccessorProperty") { + id = parent.key; + } + } + if (!id) return; + var nameInfo; + if (id.type === "Identifier") { + var _id$loc, _id$loc2; + nameInfo = { + pos: (_id$loc = id.loc) == null ? void 0 : _id$loc.start, + name: ((_id$loc2 = id.loc) == null ? void 0 : _id$loc2.identifierName) || id.name + }; + } else if (id.type === "PrivateName") { + var _id$loc3; + nameInfo = { + pos: (_id$loc3 = id.loc) == null ? void 0 : _id$loc3.start, + name: "#" + id.id.name + }; + } else if (id.type === "StringLiteral") { + var _id$loc4; + nameInfo = { + pos: (_id$loc4 = id.loc) == null ? void 0 : _id$loc4.start, + name: id.value + }; + } + return nameInfo; + } + + var isClassDeclaration = isClassDeclaration$2, + isExportDefaultSpecifier = isExportDefaultSpecifier$1, + isExportNamespaceSpecifier = isExportNamespaceSpecifier$1, + isImportDefaultSpecifier = isImportDefaultSpecifier$1, + isImportNamespaceSpecifier = isImportNamespaceSpecifier$1, + isStatement$6 = isStatement$8; + function ImportSpecifier(node) { + if (node.importKind === "type" || node.importKind === "typeof") { + this.word(node.importKind); + this.space(); + } + this.print(node.imported, node); + if (node.local && node.local.name !== node.imported.name) { + this.space(); + this.word("as"); + this.space(); + this.print(node.local, node); + } + } + function ImportDefaultSpecifier(node) { + this.print(node.local, node); + } + function ExportDefaultSpecifier(node) { + this.print(node.exported, node); + } + function ExportSpecifier(node) { + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + this.print(node.local, node); + if (node.exported && node.local.name !== node.exported.name) { + this.space(); + this.word("as"); + this.space(); + this.print(node.exported, node); + } + } + function ExportNamespaceSpecifier(node) { + this.tokenChar(42); + this.space(); + this.word("as"); + this.space(); + this.print(node.exported, node); + } + var warningShown = false; + function _printAttributes(node) { + var importAttributesKeyword = this.format.importAttributesKeyword; + var attributes = node.attributes, + assertions = node.assertions; + if (attributes && !importAttributesKeyword && !warningShown) { + warningShown = true; + console.warn("You are using import attributes, without specifying the desired output syntax.\nPlease specify the \"importAttributesKeyword\" generator option, whose value can be one of:\n - \"with\" : `import { a } from \"b\" with { type: \"json\" };`\n - \"assert\" : `import { a } from \"b\" assert { type: \"json\" };`\n - \"with-legacy\" : `import { a } from \"b\" with type: \"json\";`\n"); + } + var useAssertKeyword = importAttributesKeyword === "assert" || !importAttributesKeyword && assertions; + this.word(useAssertKeyword ? "assert" : "with"); + this.space(); + if (!useAssertKeyword && importAttributesKeyword !== "with") { + this.printList(attributes || assertions, node); + return; + } + this.tokenChar(123); + this.space(); + this.printList(attributes || assertions, node); + this.space(); + this.tokenChar(125); + } + function ExportAllDeclaration(node) { + var _node$attributes, _node$assertions; + this.word("export"); + this.space(); + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + this.tokenChar(42); + this.space(); + this.word("from"); + this.space(); + if ((_node$attributes = node.attributes) != null && _node$attributes.length || (_node$assertions = node.assertions) != null && _node$assertions.length) { + this.print(node.source, node, true); + this.space(); + this._printAttributes(node); + } else { + this.print(node.source, node); + } + this.semicolon(); + } + function maybePrintDecoratorsBeforeExport(printer, node) { + if (isClassDeclaration(node.declaration) && printer._shouldPrintDecoratorsBeforeExport(node)) { + printer.printJoin(node.declaration.decorators, node); + } + } + function ExportNamedDeclaration(node) { + maybePrintDecoratorsBeforeExport(this, node); + this.word("export"); + this.space(); + if (node.declaration) { + var declar = node.declaration; + this.print(declar, node); + if (!isStatement$6(declar)) this.semicolon(); + } else { + if (node.exportKind === "type") { + this.word("type"); + this.space(); + } + var specifiers = node.specifiers.slice(0); + var hasSpecial = false; + for (;;) { + var first = specifiers[0]; + if (isExportDefaultSpecifier(first) || isExportNamespaceSpecifier(first)) { + hasSpecial = true; + this.print(specifiers.shift(), node); + if (specifiers.length) { + this.tokenChar(44); + this.space(); + } + } else { + break; + } + } + if (specifiers.length || !specifiers.length && !hasSpecial) { + this.tokenChar(123); + if (specifiers.length) { + this.space(); + this.printList(specifiers, node); + this.space(); + } + this.tokenChar(125); + } + if (node.source) { + var _node$attributes2, _node$assertions2; + this.space(); + this.word("from"); + this.space(); + if ((_node$attributes2 = node.attributes) != null && _node$attributes2.length || (_node$assertions2 = node.assertions) != null && _node$assertions2.length) { + this.print(node.source, node, true); + this.space(); + this._printAttributes(node); + } else { + this.print(node.source, node); + } + } + this.semicolon(); + } + } + function ExportDefaultDeclaration(node) { + maybePrintDecoratorsBeforeExport(this, node); + this.word("export"); + this.noIndentInnerCommentsHere(); + this.space(); + this.word("default"); + this.space(); + var declar = node.declaration; + this.print(declar, node); + if (!isStatement$6(declar)) this.semicolon(); + } + function ImportDeclaration(node) { + var _node$attributes3, _node$assertions3; + this.word("import"); + this.space(); + var isTypeKind = node.importKind === "type" || node.importKind === "typeof"; + if (isTypeKind) { + this.noIndentInnerCommentsHere(); + this.word(node.importKind); + this.space(); + } else if (node.module) { + this.noIndentInnerCommentsHere(); + this.word("module"); + this.space(); + } + var specifiers = node.specifiers.slice(0); + var hasSpecifiers = !!specifiers.length; + while (hasSpecifiers) { + var first = specifiers[0]; + if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) { + this.print(specifiers.shift(), node); + if (specifiers.length) { + this.tokenChar(44); + this.space(); + } + } else { + break; + } + } + if (specifiers.length) { + this.tokenChar(123); + this.space(); + this.printList(specifiers, node); + this.space(); + this.tokenChar(125); + } else if (isTypeKind && !hasSpecifiers) { + this.tokenChar(123); + this.tokenChar(125); + } + if (hasSpecifiers || isTypeKind) { + this.space(); + this.word("from"); + this.space(); + } + if ((_node$attributes3 = node.attributes) != null && _node$attributes3.length || (_node$assertions3 = node.assertions) != null && _node$assertions3.length) { + this.print(node.source, node, true); + this.space(); + this._printAttributes(node); + } else { + this.print(node.source, node); + } + this.semicolon(); + } + function ImportAttribute(node) { + this.print(node.key); + this.tokenChar(58); + this.space(); + this.print(node.value); + } + function ImportNamespaceSpecifier(node) { + this.tokenChar(42); + this.space(); + this.word("as"); + this.space(); + this.print(node.local, node); + } + + var jsesc_1; + var hasRequiredJsesc; + function requireJsesc() { + if (hasRequiredJsesc) return jsesc_1; + hasRequiredJsesc = 1; + var object = {}; + var hasOwnProperty = object.hasOwnProperty; + var forOwn = function forOwn(object, callback) { + for (var key in object) { + if (hasOwnProperty.call(object, key)) { + callback(key, object[key]); + } + } + }; + var extend = function extend(destination, source) { + if (!source) { + return destination; + } + forOwn(source, function (key, value) { + destination[key] = value; + }); + return destination; + }; + var forEach = function forEach(array, callback) { + var length = array.length; + var index = -1; + while (++index < length) { + callback(array[index]); + } + }; + var toString = object.toString; + var isArray = Array.isArray; + var isBuffer = Buffer$1.isBuffer; + var isObject = function isObject(value) { + return toString.call(value) == '[object Object]'; + }; + var isString = function isString(value) { + return typeof value == 'string' || toString.call(value) == '[object String]'; + }; + var isNumber = function isNumber(value) { + return typeof value == 'number' || toString.call(value) == '[object Number]'; + }; + var isFunction = function isFunction(value) { + return typeof value == 'function'; + }; + var isMap = function isMap(value) { + return toString.call(value) == '[object Map]'; + }; + var isSet = function isSet(value) { + return toString.call(value) == '[object Set]'; + }; + var singleEscapes = { + '"': '\\"', + '\'': '\\\'', + '\\': '\\\\', + '\b': '\\b', + '\f': '\\f', + '\n': '\\n', + '\r': '\\r', + '\t': '\\t' + }; + var regexSingleEscape = /["'\\\b\f\n\r\t]/; + var regexDigit = /[0-9]/; + var regexWhitelist = /[ !#-&\(-\[\]-_a-~]/; + var jsesc = function jsesc(argument, options) { + var increaseIndentation = function increaseIndentation() { + oldIndent = indent; + ++options.indentLevel; + indent = options.indent.repeat(options.indentLevel); + }; + var defaults = { + 'escapeEverything': false, + 'minimal': false, + 'isScriptContext': false, + 'quotes': 'single', + 'wrap': false, + 'es6': false, + 'json': false, + 'compact': true, + 'lowercaseHex': false, + 'numbers': 'decimal', + 'indent': '\t', + 'indentLevel': 0, + '__inline1__': false, + '__inline2__': false + }; + var json = options && options.json; + if (json) { + defaults.quotes = 'double'; + defaults.wrap = true; + } + options = extend(defaults, options); + if (options.quotes != 'single' && options.quotes != 'double' && options.quotes != 'backtick') { + options.quotes = 'single'; + } + var quote = options.quotes == 'double' ? '"' : options.quotes == 'backtick' ? '`' : '\''; + var compact = options.compact; + var lowercaseHex = options.lowercaseHex; + var indent = options.indent.repeat(options.indentLevel); + var oldIndent = ''; + var inline1 = options.__inline1__; + var inline2 = options.__inline2__; + var newLine = compact ? '' : '\n'; + var result; + var isEmpty = true; + var useBinNumbers = options.numbers == 'binary'; + var useOctNumbers = options.numbers == 'octal'; + var useDecNumbers = options.numbers == 'decimal'; + var useHexNumbers = options.numbers == 'hexadecimal'; + if (json && argument && isFunction(argument.toJSON)) { + argument = argument.toJSON(); + } + if (!isString(argument)) { + if (isMap(argument)) { + if (argument.size == 0) { + return 'new Map()'; + } + if (!compact) { + options.__inline1__ = true; + options.__inline2__ = false; + } + return 'new Map(' + jsesc(Array.from(argument), options) + ')'; + } + if (isSet(argument)) { + if (argument.size == 0) { + return 'new Set()'; + } + return 'new Set(' + jsesc(Array.from(argument), options) + ')'; + } + if (isBuffer(argument)) { + if (argument.length == 0) { + return 'Buffer.from([])'; + } + return 'Buffer.from(' + jsesc(Array.from(argument), options) + ')'; + } + if (isArray(argument)) { + result = []; + options.wrap = true; + if (inline1) { + options.__inline1__ = false; + options.__inline2__ = true; + } + if (!inline2) { + increaseIndentation(); + } + forEach(argument, function (value) { + isEmpty = false; + if (inline2) { + options.__inline2__ = false; + } + result.push((compact || inline2 ? '' : indent) + jsesc(value, options)); + }); + if (isEmpty) { + return '[]'; + } + if (inline2) { + return '[' + result.join(', ') + ']'; + } + return '[' + newLine + result.join(',' + newLine) + newLine + (compact ? '' : oldIndent) + ']'; + } else if (isNumber(argument)) { + if (json) { + return JSON.stringify(argument); + } + if (useDecNumbers) { + return String(argument); + } + if (useHexNumbers) { + var hexadecimal = argument.toString(16); + if (!lowercaseHex) { + hexadecimal = hexadecimal.toUpperCase(); + } + return '0x' + hexadecimal; + } + if (useBinNumbers) { + return '0b' + argument.toString(2); + } + if (useOctNumbers) { + return '0o' + argument.toString(8); + } + } else if (!isObject(argument)) { + if (json) { + return JSON.stringify(argument) || 'null'; + } + return String(argument); + } else { + result = []; + options.wrap = true; + increaseIndentation(); + forOwn(argument, function (key, value) { + isEmpty = false; + result.push((compact ? '' : indent) + jsesc(key, options) + ':' + (compact ? '' : ' ') + jsesc(value, options)); + }); + if (isEmpty) { + return '{}'; + } + return '{' + newLine + result.join(',' + newLine) + newLine + (compact ? '' : oldIndent) + '}'; + } + } + var string = argument; + var index = -1; + var length = string.length; + result = ''; + while (++index < length) { + var character = string.charAt(index); + if (options.es6) { + var first = string.charCodeAt(index); + if (first >= 0xD800 && first <= 0xDBFF && length > index + 1) { + var second = string.charCodeAt(index + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + var codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + var _hexadecimal = codePoint.toString(16); + if (!lowercaseHex) { + _hexadecimal = _hexadecimal.toUpperCase(); + } + result += "\\u{" + _hexadecimal + '}'; + ++index; + continue; + } + } + } + if (!options.escapeEverything) { + if (regexWhitelist.test(character)) { + result += character; + continue; + } + if (character == '"') { + result += quote == character ? '\\"' : character; + continue; + } + if (character == '`') { + result += quote == character ? '\\`' : character; + continue; + } + if (character == '\'') { + result += quote == character ? '\\\'' : character; + continue; + } + } + if (character == '\0' && !json && !regexDigit.test(string.charAt(index + 1))) { + result += '\\0'; + continue; + } + if (regexSingleEscape.test(character)) { + result += singleEscapes[character]; + continue; + } + var charCode = character.charCodeAt(0); + if (options.minimal && charCode != 0x2028 && charCode != 0x2029) { + result += character; + continue; + } + var _hexadecimal2 = charCode.toString(16); + if (!lowercaseHex) { + _hexadecimal2 = _hexadecimal2.toUpperCase(); + } + var longhand = _hexadecimal2.length > 2 || json; + var escaped = '\\' + (longhand ? 'u' : 'x') + ('0000' + _hexadecimal2).slice(longhand ? -4 : -2); + result += escaped; + continue; + } + if (options.wrap) { + result = quote + result + quote; + } + if (quote == '`') { + result = result.replace(/\$\{/g, '\\\$\{'); + } + if (options.isScriptContext) { + return result.replace(/<\/(script|style)/gi, '<\\/$1').replace(/ # 0.1.0 @@ -54,24 +54,27 @@ feat: - [x] 支持了逻辑组件的属性简写 - [x] 支持 使用 onclick:stop 不带事件名 - [x] 组件属性结构 -- [ ] 支持 +- [x] 去除 .r 需要v的包裹 +- [x] 发包脚本 +- [ ] 多层嵌套的if有问题; if switch 待重构 - [ ] alins-compiler-web 将babel模改后直接引入 // 现在存在type="text/babel"直接babel被执行了 -- [ ] 发包脚本 - [ ] 文档 & 在线编译工具 - [ ] eslint-config-alins 验证 +- [ ] 重构branch、if、switch、ctx逻辑 +- [ ] 清理编译器ctx下相关逻辑 next Version new feature +- [x] create-alins - [ ] For 类型提示 - [ ] Async Data 类型标注 - [ ] alins-router - 官方路由库 (尽可能通用 能够直接使用原生js调用) -- [ ] alins-ssr - 服务端渲染(尽可能通用 能够直接使用原生js调用) - [ ] alins-ui - 官方ui库 - [ ] alins-store - 状态库 -- [ ] alins-renderer - 利用自定义 renderer 实现跨平台 - [ ] alins-style style 标签优化 处理 提高css可用性, style 值类型声明 (能够使用reactive库配合着使用原生js使用) - [ ] alins-style 支持兼容性扩展 -- [ ] alins-cli、alins-template (base on vite、vite-plugin-alins、eslint-config) +- [ ] alins-renderer - 利用自定义 renderer 实现跨平台 +- [ ] alins-ssr - 服务端渲染(尽可能通用 能够直接使用原生js调用) - [ ] 增加 变量声明和函数参数的 @reactive,增加 @static 注释 - [ ] For 支持解构 - [ ] 新增 Frag 组件,定位是用于可以挂载属性的 <>