UNPKG

@yugu/gogocode

Version:

The simplest tool to parse/transform/generate code on ast

1 lines 1.27 MB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).gogocode=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function n(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}var i=n,o=s;function a(e){if(i===setTimeout)return setTimeout(e,0);if((i===n||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}"function"==typeof r.setTimeout&&(i=setTimeout),"function"==typeof r.clearTimeout&&(o=clearTimeout);var u,c=[],l=!1,p=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):p=-1,c.length&&d())}function d(){if(!l){var e=a(h);l=!0;for(var t=c.length;t;){for(u=c,c=[];++p<t;)u&&u[p].run();p=-1,t=c.length}u=null,l=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===s||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{return o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function f(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new m(e,t)),1!==c.length||l||a(d)}function m(e,t){this.fun=e,this.array=t}m.prototype.run=function(){this.fun.apply(null,this.array)};function y(){}var g=y,v=y,x=y,E=y,b=y,S=y,T=y;var w=r.performance||{},A=w.now||w.mozNow||w.msNow||w.oNow||w.webkitNow||function(){return(new Date).getTime()};var D=new Date;var C={nextTick:f,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:g,addListener:v,once:x,off:E,removeListener:b,removeAllListeners:S,emit:T,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*A.call(w),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-D)/1e3}},P={},k=t(Object.freeze({__proto__:null,default:{}})),O={},_=function(e,t){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},_(e,t)};function N(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}_(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var I=function(){return I=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},I.apply(this,arguments)};function F(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]])}return r}function B(e,t,r,n){var s,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(i<3?s(o):i>3?s(t,r,o):s(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function L(e,t){return function(r,n){t(r,n,e)}}function M(e,t,r,n,s,i){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,u=n.kind,c="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?n.static?e:e.prototype:null,p=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),h=!1,d=r.length-1;d>=0;d--){var f={};for(var m in n)f[m]="access"===m?{}:n[m];for(var m in n.access)f.access[m]=n.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(e||null))};var y=(0,r[d])("accessor"===u?{get:p.get,set:p.set}:p[c],f);if("accessor"===u){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(a=o(y.get))&&(p.get=a),(a=o(y.set))&&(p.set=a),(a=o(y.init))&&s.unshift(a)}else(a=o(y))&&("field"===u?s.unshift(a):p[c]=a)}l&&Object.defineProperty(l,n.name,p),h=!0}function R(e,t,r){for(var n=arguments.length>2,s=0;s<t.length;s++)r=n?t[s].call(e,r):t[s].call(e);return n?r:void 0}function j(e){return"symbol"==typeof e?e:"".concat(e)}function U(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function $(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function q(e,t,r,n){return new(r||(r=Promise))((function(s,i){function o(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))}function V(e,t){var r,n,s,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(s=2&a[0]?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(6===a[0]&&i.label<s[1]){i.label=s[1],s=a;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(a);break}s[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=s=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}var z=Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function W(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||z(t,e,r)}function X(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function J(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,s,i=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){s={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(s)throw s.error}}return o}function K(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(J(arguments[t]));return e}function G(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),s=0;for(t=0;t<r;t++)for(var i=arguments[t],o=0,a=i.length;o<a;o++,s++)n[s]=i[o];return n}function Y(e,t,r){if(r||2===arguments.length)for(var n,s=0,i=t.length;s<i;s++)!n&&s in t||(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))}function H(e){return this instanceof H?(this.v=e,this):new H(e)}function Q(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,s=r.apply(e,t||[]),i=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),n[Symbol.asyncIterator]=function(){return this},n;function o(e,t){s[e]&&(n[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||a(e,t)}))},t&&(n[e]=t(n[e])))}function a(e,t){try{(r=s[e](t)).value instanceof H?Promise.resolve(r.value.v).then(u,c):l(i[0][2],r)}catch(e){l(i[0][3],e)}var r}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function Z(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,s){t[n]=e[n]?function(t){return(r=!r)?{value:H(e[n](t)),done:!1}:s?s(t):t}:s}}function ee(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=X(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,s){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,s,(t=e[r](t)).done,t.value)}))}}}function te(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var re=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},ne=function(e){return ne=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},ne(e)};function se(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=ne(e),n=0;n<r.length;n++)"default"!==r[n]&&z(t,e,r[n]);return re(t,e),t}function ie(e){return e&&e.__esModule?e:{default:e}}function oe(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function ae(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r}function ue(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function ce(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,s;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(s=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");s&&(n=function(){try{s.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var le="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function pe(e){function t(t){e.error=e.hasError?new le(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,n=0;return function s(){for(;r=e.stack.pop();)try{if(!r.async&&1===n)return n=0,e.stack.push(r),Promise.resolve().then(s);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(s,(function(e){return t(e),s()}))}else n|=1}catch(e){t(e)}if(1===n)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function he(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,(function(e,r,n,s,i){return r?t?".jsx":".js":!n||s&&i?n+s+"."+i.toLowerCase()+"js":e})):e}var de={__extends:N,__assign:I,__rest:F,__decorate:B,__param:L,__esDecorate:M,__runInitializers:R,__propKey:j,__setFunctionName:U,__metadata:$,__awaiter:q,__generator:V,__createBinding:z,__exportStar:W,__values:X,__read:J,__spread:K,__spreadArrays:G,__spreadArray:Y,__await:H,__asyncGenerator:Q,__asyncDelegator:Z,__asyncValues:ee,__makeTemplateObject:te,__importStar:se,__importDefault:ie,__classPrivateFieldGet:oe,__classPrivateFieldSet:ae,__classPrivateFieldIn:ue,__addDisposableResource:ce,__disposeResources:pe,__rewriteRelativeImportExtension:he},fe=t(Object.freeze({__proto__:null,__extends:N,get __assign(){return I},__rest:F,__decorate:B,__param:L,__esDecorate:M,__runInitializers:R,__propKey:j,__setFunctionName:U,__metadata:$,__awaiter:q,__generator:V,__createBinding:z,__exportStar:W,__values:X,__read:J,__spread:K,__spreadArrays:G,__spreadArray:Y,__await:H,__asyncGenerator:Q,__asyncDelegator:Z,__asyncValues:ee,__makeTemplateObject:te,__importStar:se,__importDefault:ie,__classPrivateFieldGet:oe,__classPrivateFieldSet:ae,__classPrivateFieldIn:ue,__addDisposableResource:ce,__disposeResources:pe,__rewriteRelativeImportExtension:he,default:de})),me={exports:{}},ye={};Object.defineProperty(ye,"__esModule",{value:!0}),ye.Def=void 0;var ge=fe,ve=Object.prototype,xe=ve.toString,Ee=ve.hasOwnProperty,be=function(){function e(){}return e.prototype.assert=function(e,t){if(!this.check(e,t)){var r=ke(e);throw new Error(r+" does not match type "+this)}return!0},e.prototype.arrayOf=function(){return new Se(this)},e}(),Se=function(e){function t(t){var r=e.call(this)||this;return r.elemType=t,r.kind="ArrayType",r}return ge.__extends(t,e),t.prototype.toString=function(){return"["+this.elemType+"]"},t.prototype.check=function(e,t){var r=this;return Array.isArray(e)&&e.every((function(e){return r.elemType.check(e,t)}))},t}(be),Te=function(e){function t(t){var r=e.call(this)||this;return r.value=t,r.kind="IdentityType",r}return ge.__extends(t,e),t.prototype.toString=function(){return String(this.value)},t.prototype.check=function(e,t){var r=e===this.value;return r||"function"!=typeof t||t(this,e),r},t}(be),we=function(e){function t(t){var r=e.call(this)||this;return r.fields=t,r.kind="ObjectType",r}return ge.__extends(t,e),t.prototype.toString=function(){return"{ "+this.fields.join(", ")+" }"},t.prototype.check=function(e,t){return xe.call(e)===xe.call({})&&this.fields.every((function(r){return r.type.check(e[r.name],t)}))},t}(be),Ae=function(e){function t(t){var r=e.call(this)||this;return r.types=t,r.kind="OrType",r}return ge.__extends(t,e),t.prototype.toString=function(){return this.types.join(" | ")},t.prototype.check=function(e,t){return this.types.some((function(r){return r.check(e,t)}))},t}(be),De=function(e){function t(t,r){var n=e.call(this)||this;return n.name=t,n.predicate=r,n.kind="PredicateType",n}return ge.__extends(t,e),t.prototype.toString=function(){return this.name},t.prototype.check=function(e,t){var r=this.predicate(e,t);return r||"function"!=typeof t||t(this,e),r},t}(be),Ce=function(){function e(e,t){this.type=e,this.typeName=t,this.baseNames=[],this.ownFields=Object.create(null),this.allSupertypes=Object.create(null),this.supertypeList=[],this.allFields=Object.create(null),this.fieldNames=[],this.finalized=!1,this.buildable=!1,this.buildParams=[]}return e.prototype.isSupertypeOf=function(t){if(t instanceof e){if(!0!==this.finalized||!0!==t.finalized)throw new Error("");return Ee.call(t.allSupertypes,this.typeName)}throw new Error(t+" is not a Def")},e.prototype.checkAllFields=function(e,t){var r=this.allFields;if(!0!==this.finalized)throw new Error(""+this.typeName);return null!==e&&"object"==typeof e&&Object.keys(r).every((function(n){var s=r[n],i=s.type,o=s.getValue(e);return i.check(o,t)}))},e.prototype.bases=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.baseNames;if(this.finalized){if(e.length!==r.length)throw new Error("");for(var n=0;n<e.length;n++)if(e[n]!==r[n])throw new Error("");return this}return e.forEach((function(e){r.indexOf(e)<0&&r.push(e)})),this},e}();ye.Def=Ce;var Pe=function(){function e(e,t,r,n){this.name=e,this.type=t,this.defaultFn=r,this.hidden=!!n}return e.prototype.toString=function(){return JSON.stringify(this.name)+": "+this.type},e.prototype.getValue=function(e){var t=e[this.name];return void 0!==t||"function"==typeof this.defaultFn&&(t=this.defaultFn.call(e)),t},e}();function ke(e){return Array.isArray(e)?"["+e.map(ke).join(", ")+"]":e&&"object"==typeof e?"{ "+Object.keys(e).map((function(t){return t+": "+e[t]})).join(", ")+" }":JSON.stringify(e)}ye.default=function(e){var t={or:function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return new Ae(e.map((function(e){return t.from(e)})))},from:function(e,s){if(e instanceof Se||e instanceof Te||e instanceof we||e instanceof Ae||e instanceof De)return e;if(e instanceof Ce)return e.type;if(a.check(e)){if(1!==e.length)throw new Error("only one element type is permitted for typed arrays");return new Se(t.from(e[0]))}if(u.check(e))return new we(Object.keys(e).map((function(r){return new Pe(r,t.from(e[r],r))})));if("function"==typeof e){var i=r.indexOf(e);if(i>=0)return n[i];if("string"!=typeof s)throw new Error("missing name");return new De(s,e)}return new Te(e)},def:function(e){return Ee.call(y,e)?y[e]:y[e]=new v(e)},hasDef:function(e){return Ee.call(y,e)}},r=[],n=[];function s(e,t){var s=xe.call(t),i=new De(e,(function(e){return xe.call(e)===s}));return t&&"function"==typeof t.constructor&&(r.push(t.constructor),n.push(i)),i}var i=s("string","truthy"),o=s("function",(function(){})),a=s("array",[]),u=s("object",{}),c=s("RegExp",/./),l=s("Date",new Date),p=s("number",3),h=s("boolean",!0),d=s("null",null),f=s("undefined",void 0),m={string:i,function:o,array:a,object:u,RegExp:c,Date:l,number:p,boolean:h,null:d,undefined:f},y=Object.create(null);function g(e){if(e&&"object"==typeof e){var t=e.type;if("string"==typeof t&&Ee.call(y,t)){var r=y[t];if(r.finalized)return r}}return null}var v=function(e){function r(t){var r=e.call(this,new De(t,(function(e,t){return r.check(e,t)})),t)||this;return r}return ge.__extends(r,e),r.prototype.check=function(e,t){if(!0!==this.finalized)throw new Error("prematurely checking unfinalized type "+this.typeName);if(null===e||"object"!=typeof e)return!1;var r=g(e);return r?t&&r===this?this.checkAllFields(e,t):!!this.isSupertypeOf(r)&&(!t||r.checkAllFields(e,t)&&this.checkAllFields(e,!1)):("SourceLocation"===this.typeName||"Position"===this.typeName)&&this.checkAllFields(e,t)},r.prototype.build=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(this.buildParams=t,this.buildable)return this;this.field("type",String,(function(){return e.typeName})),this.buildable=!0;var n=function(t,r,n,s){if(!Ee.call(t,r)){var i=e.allFields;if(!Ee.call(i,r))throw new Error(""+r);var o,a=i[r],u=a.type;if(s)o=n;else{if(!a.defaultFn){var c="no value or default function given for field "+JSON.stringify(r)+" of "+e.typeName+"("+e.buildParams.map((function(e){return i[e]})).join(", ")+")";throw new Error(c)}o=a.defaultFn.call(t)}if(!u.check(o))throw new Error(ke(o)+" does not match field "+a+" of type "+e.typeName);t[r]=o}},s=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var s=t.length;if(!e.finalized)throw new Error("attempting to instantiate unfinalized type "+e.typeName);var i=Object.create(E);if(e.buildParams.forEach((function(e,r){r<s?n(i,e,t[r],!0):n(i,e,null,!1)})),Object.keys(e.allFields).forEach((function(e){n(i,e,null,!1)})),i.type!==e.typeName)throw new Error("");return i};return s.from=function(t){if(!e.finalized)throw new Error("attempting to instantiate unfinalized type "+e.typeName);var r=Object.create(E);if(Object.keys(e.allFields).forEach((function(e){Ee.call(t,e)?n(r,e,t[e],!0):n(r,e,null,!1)})),r.type!==e.typeName)throw new Error("");return r},Object.defineProperty(x,b(this.typeName),{enumerable:!0,value:s}),this},r.prototype.field=function(e,r,n,s){return this.finalized?(console.error("Ignoring attempt to redefine field "+JSON.stringify(e)+" of finalized type "+JSON.stringify(this.typeName)),this):(this.ownFields[e]=new Pe(e,t.from(r),n,s),this)},r.prototype.finalize=function(){var e=this;if(!this.finalized){var t=this.allFields,r=this.allSupertypes;for(var n in this.baseNames.forEach((function(n){var s=y[n];if(!(s instanceof Ce)){var i="unknown supertype name "+JSON.stringify(n)+" for subtype "+JSON.stringify(e.typeName);throw new Error(i)}s.finalize(),D(t,s.allFields),D(r,s.allSupertypes)})),D(t,this.ownFields),r[this.typeName]=this,this.fieldNames.length=0,t)Ee.call(t,n)&&!t[n].hidden&&this.fieldNames.push(n);Object.defineProperty(T,this.typeName,{enumerable:!0,value:this.type}),this.finalized=!0,function(e,t){t.length=0,t.push(e);for(var r=Object.create(null),n=0;n<t.length;++n){e=t[n];var s=y[e];if(!0!==s.finalized)throw new Error("");Ee.call(r,e)&&delete t[r[e]],r[e]=n,t.push.apply(t,s.baseNames)}for(var i=0,o=i,a=t.length;o<a;++o)Ee.call(t,o)&&(t[i++]=t[o]);t.length=i}(this.typeName,this.supertypeList),this.buildable&&this.supertypeList.lastIndexOf("Expression")>=0&&function(e){var t=S(e);if(x[t])return;var r=x[b(e)];if(!r)return;var n=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return x.expressionStatement(r.apply(x,e))};n.from=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return x.expressionStatement(r.from.apply(x,e))},x[t]=n}(this.typeName)}},r}(Ce),x=Object.create(null),E={};function b(e){return e.replace(/^[A-Z]+/,(function(e){var t=e.length;switch(t){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,t-1).toLowerCase()+e.charAt(t-1)}}))}function S(e){return(e=b(e)).replace(/(Expression)?$/,"Statement")}var T={};function w(e){var t=g(e);if(t)return t.fieldNames.slice(0);if("type"in e)throw new Error("did not recognize object of type "+JSON.stringify(e.type));return Object.keys(e)}function A(e,t){var r=g(e);if(r){var n=r.allFields[t];if(n)return n.getValue(e)}return e&&e[t]}function D(e,t){return Object.keys(t).forEach((function(r){e[r]=t[r]})),e}return{Type:t,builtInTypes:m,getSupertypeNames:function(e){if(!Ee.call(y,e))throw new Error("");var t=y[e];if(!0!==t.finalized)throw new Error("");return t.supertypeList.slice(1)},computeSupertypeLookupTable:function(e){for(var t={},r=Object.keys(y),n=r.length,s=0;s<n;++s){var i=r[s],o=y[i];if(!0!==o.finalized)throw new Error(""+i);for(var a=0;a<o.supertypeList.length;++a){var u=o.supertypeList[a];if(Ee.call(e,u)){t[i]=u;break}}}return t},builders:x,defineMethod:function(e,t){var r=E[e];return f.check(t)?delete E[e]:(o.assert(t),Object.defineProperty(E,e,{enumerable:!0,configurable:!0,value:t})),r},getBuilderName:b,getStatementBuilderName:S,namedTypes:T,getFieldNames:w,getFieldValue:A,eachField:function(e,t,r){w(e).forEach((function(r){t.call(this,r,A(e,r))}),r)},someField:function(e,t,r){return w(e).some((function(r){return t.call(this,r,A(e,r))}),r)},finalize:function(){Object.keys(y).forEach((function(e){y[e].finalize()}))}}};var Oe={exports:{}},_e={exports:{}},Ne={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=fe.__importDefault(ye),n=Object.prototype.hasOwnProperty;t.default=function(e){var t=e.use(r.default),s=t.builtInTypes.array,i=t.builtInTypes.number,o=function e(t,r,n){if(!(this instanceof e))throw new Error("Path constructor cannot be invoked without 'new'");if(r){if(!(r instanceof e))throw new Error("")}else r=null,n=null;this.value=t,this.parentPath=r,this.name=n,this.__childCache=null},a=o.prototype;function u(e){return e.__childCache||(e.__childCache=Object.create(null))}function c(e,t){var r=u(e),s=e.getValueProperty(t),i=r[t];return n.call(r,t)&&i.value===s||(i=r[t]=new e.constructor(s,e,t)),i}function l(){}function p(e,t,r,o){if(s.assert(e.value),0===t)return l;var a=e.value.length;if(a<1)return l;var c=arguments.length;2===c?(r=0,o=a):3===c?(r=Math.max(r,0),o=a):(r=Math.max(r,0),o=Math.min(o,a)),i.assert(r),i.assert(o);for(var p=Object.create(null),h=u(e),d=r;d<o;++d)if(n.call(e.value,d)){var f=e.get(d);if(f.name!==d)throw new Error("");var m=d+t;f.name=m,p[m]=f,delete h[d]}return delete h.length,function(){for(var t in p){var r=p[t];if(r.name!==+t)throw new Error("");h[t]=r,e.value[t]=r.value}}}return a.getValueProperty=function(e){return this.value[e]},a.get=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=this,n=e.length,s=0;s<n;++s)r=c(r,e[s]);return r},a.each=function(e,t){var r=[],s=this.value.length,i=0;for(i=0;i<s;++i)n.call(this.value,i)&&(r[i]=this.get(i));for(t=t||this,i=0;i<s;++i)n.call(r,i)&&e.call(t,r[i])},a.map=function(e,t){var r=[];return this.each((function(t){r.push(e.call(this,t))}),t),r},a.filter=function(e,t){var r=[];return this.each((function(t){e.call(this,t)&&r.push(t)}),t),r},a.shift=function(){var e=p(this,-1),t=this.value.shift();return e(),t},a.unshift=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=p(this,e.length),n=this.value.unshift.apply(this.value,e);return r(),n},a.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.assert(this.value),delete u(this).length,this.value.push.apply(this.value,e)},a.pop=function(){s.assert(this.value);var e=u(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},a.insertAt=function(e){var t=arguments.length,r=p(this,t-1,e);if(r===l&&t<=1)return this;e=Math.max(e,0);for(var n=1;n<t;++n)this.value[e+n-1]=arguments[n];return r(),this},a.insertBefore=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=this.parentPath,n=e.length,s=[this.name],i=0;i<n;++i)s.push(e[i]);return r.insertAt.apply(r,s)},a.insertAfter=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=this.parentPath,n=e.length,s=[this.name+1],i=0;i<n;++i)s.push(e[i]);return r.insertAt.apply(r,s)},a.replace=function(e){var t=[],r=this.parentPath.value,n=u(this.parentPath),i=arguments.length;if(function(e){if(!(e instanceof o))throw new Error("");var t=e.parentPath;if(!t)return e;var r=t.value,n=u(t);if(r[e.name]===e.value)n[e.name]=e;else if(s.check(r)){var i=r.indexOf(e.value);i>=0&&(n[e.name=i]=e)}else r[e.name]=e.value,n[e.name]=e;if(r[e.name]!==e.value)throw new Error("");if(e.parentPath.get(e.name)!==e)throw new Error("")}(this),s.check(r)){for(var a=r.length,c=p(this.parentPath,i-1,this.name+1),l=[this.name,1],h=0;h<i;++h)l.push(arguments[h]);if(r.splice.apply(r,l)[0]!==this.value)throw new Error("");if(r.length!==a-1+i)throw new Error("");if(c(),0===i)delete this.value,delete n[this.name],this.__childCache=null;else{if(r[this.name]!==e)throw new Error("");for(this.value!==e&&(this.value=e,this.__childCache=null),h=0;h<i;++h)t.push(this.parentPath.get(this.name+h));if(t[0]!==this)throw new Error("")}}else if(1===i)this.value!==e&&(this.__childCache=null),this.value=r[this.name]=e,t.push(this);else{if(0!==i)throw new Error("Could not replace path");delete r[this.name],delete this.value,this.__childCache=null}return t},o},e.exports=t.default}(Ne,Ne.exports);var Ie={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=fe.__importDefault(ye),n=Object.prototype.hasOwnProperty;t.default=function(e){var t=e.use(r.default),s=t.Type,i=t.namedTypes,o=i.Node,a=i.Expression,u=t.builtInTypes.array,c=t.builders,l=function e(t,r){if(!(this instanceof e))throw new Error("Scope constructor cannot be invoked without 'new'");var n;if(h.assert(t.value),r){if(!(r instanceof e))throw new Error("");n=r.depth+1}else r=null,n=0;Object.defineProperties(this,{path:{value:t},node:{value:t.value},isGlobal:{value:!r,enumerable:!0},depth:{value:n},parent:{value:r},bindings:{value:{}},types:{value:{}}})},p=[i.Program,i.Function,i.CatchClause],h=s.or.apply(s,p);l.isEstablishedBy=function(e){return h.check(e)};var d=l.prototype;function f(e,r,s){var c=e.value;if(e.parent&&i.FunctionExpression.check(e.parent.node)&&e.parent.node.id&&y(e.parent.get("id"),r),c)if(u.check(c))e.each((function(e){m(e,r,s)}));else if(i.Function.check(c))e.get("params").each((function(e){y(e,r)})),m(e.get("body"),r,s);else if(i.TypeAlias&&i.TypeAlias.check(c)||i.InterfaceDeclaration&&i.InterfaceDeclaration.check(c)||i.TSTypeAliasDeclaration&&i.TSTypeAliasDeclaration.check(c)||i.TSInterfaceDeclaration&&i.TSInterfaceDeclaration.check(c))!function(e,t){var r=e.value;i.Pattern.assert(r),i.Identifier.check(r)&&(n.call(t,r.name)?t[r.name].push(e):t[r.name]=[e])}(e.get("id"),s);else if(i.VariableDeclarator.check(c)){var l=e.get("id");i.ObjectPattern.check(l.node)?l.node.properties.forEach((function(t,n){y(e.get("id","properties",n,"key"),r)})):y(e.get("id"),r),m(e.get("init"),r,s)}else"ImportSpecifier"===c.type||"ImportNamespaceSpecifier"===c.type||"ImportDefaultSpecifier"===c.type?y(e.get(c.local?"local":c.name?"name":"id"),r):o.check(c)&&!a.check(c)&&t.eachField(c,(function(t,n){var i=e.get(t);if(!function(e,t){if(e.value===t)return!0;if(Array.isArray(e.value)&&0===e.value.length&&Array.isArray(t)&&0===t.length)return!0;return!1}(i,n))throw new Error("");m(i,r,s)}));else;}function m(e,t,r){var s=e.value;if(!s||a.check(s));else if(i.FunctionDeclaration.check(s)&&null!==s.id)y(e.get("id"),t);else if(i.ClassDeclaration&&i.ClassDeclaration.check(s))y(e.get("id"),t);else if(h.check(s)){if(i.CatchClause.check(s)&&i.Identifier.check(s.param)){var o=s.param.name,u=n.call(t,o);f(e.get("body"),t,r),u||delete t[o]}}else f(e,t,r)}function y(e,t){var r=e.value;i.Pattern.assert(r),i.Identifier.check(r)?n.call(t,r.name)?t[r.name].push(e):t[r.name]=[e]:i.AssignmentPattern&&i.AssignmentPattern.check(r)?y(e.get("left"),t):i.ObjectPattern&&i.ObjectPattern.check(r)?e.get("properties").each((function(e){var r=e.value;i.Pattern.check(r)?y(e,t):i.Property.check(r)?y(e.get("value"),t):i.SpreadProperty&&i.SpreadProperty.check(r)&&y(e.get("argument"),t)})):i.ArrayPattern&&i.ArrayPattern.check(r)?e.get("elements").each((function(e){var r=e.value;i.Pattern.check(r)?y(e,t):i.SpreadElement&&i.SpreadElement.check(r)&&y(e.get("argument"),t)})):i.PropertyPattern&&i.PropertyPattern.check(r)?y(e.get("pattern"),t):(i.SpreadElementPattern&&i.SpreadElementPattern.check(r)||i.RestElement&&i.RestElement.check(r)||i.SpreadPropertyPattern&&i.SpreadPropertyPattern.check(r))&&y(e.get("argument"),t)}return d.didScan=!1,d.declares=function(e){return this.scan(),n.call(this.bindings,e)},d.declaresType=function(e){return this.scan(),n.call(this.types,e)},d.declareTemporary=function(e){if(e){if(!/^[a-z$_]/i.test(e))throw new Error("")}else e="t$";e+=this.depth.toString(36)+"$",this.scan();for(var r=0;this.declares(e+r);)++r;var n=e+r;return this.bindings[n]=t.builders.identifier(n)},d.injectTemporary=function(e,t){e||(e=this.declareTemporary());var r=this.path.get("body");return i.BlockStatement.check(r.value)&&(r=r.get("body")),r.unshift(c.variableDeclaration("var",[c.variableDeclarator(e,t||null)])),e},d.scan=function(e){if(e||!this.didScan){for(var t in this.bindings)delete this.bindings[t];!function(e,t,r){var n=e.value;if(h.assert(n),i.CatchClause.check(n)){var s=e.get("param");s.value&&y(s,t)}else f(e,t,r)}(this.path,this.bindings,this.types),this.didScan=!0}},d.getBindings=function(){return this.scan(),this.bindings},d.getTypes=function(){return this.scan(),this.types},d.lookup=function(e){for(var t=this;t&&!t.declares(e);t=t.parent);return t},d.lookupType=function(e){for(var t=this;t&&!t.declaresType(e);t=t.parent);return t},d.getGlobalScope=function(){for(var e=this;!e.isGlobal;)e=e.parent;return e},l},e.exports=t.default}(Ie,Ie.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=fe,n=r.__importDefault(ye),s=r.__importDefault(Ne.exports),i=r.__importDefault(Ie.exports);t.default=function(e){var t=e.use(n.default),r=t.namedTypes,o=t.builders,a=t.builtInTypes.number,u=t.builtInTypes.array,c=e.use(s.default),l=e.use(i.default),p=function e(t,r,n){if(!(this instanceof e))throw new Error("NodePath constructor cannot be invoked without 'new'");c.call(this,t,r,n)},h=p.prototype=Object.create(c.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}});function d(e){return r.BinaryExpression.check(e)||r.LogicalExpression.check(e)}Object.defineProperties(h,{node:{get:function(){return Object.defineProperty(this,"node",{configurable:!0,value:this._computeNode()}),this.node}},parent:{get:function(){return Object.defineProperty(this,"parent",{configurable:!0,value:this._computeParent()}),this.parent}},scope:{get:function(){return Object.defineProperty(this,"scope",{configurable:!0,value:this._computeScope()}),this.scope}}}),h.replace=function(){return delete this.node,delete this.parent,delete this.scope,c.prototype.replace.apply(this,arguments)},h.prune=function(){var e=this.parent;return this.replace(),function(e){if(r.VariableDeclaration.check(e.node)){var t=e.get("declarations").value;if(!t||0===t.length)return e.prune()}else if(r.ExpressionStatement.check(e.node)){if(!e.get("expression").value)return e.prune()}else r.IfStatement.check(e.node)&&function(e){var t=e.get("test").value,n=e.get("alternate").value,s=e.get("consequent").value;if(s||n){if(!s&&n){var i=o.unaryExpression("!",t,!0);r.UnaryExpression.check(t)&&"!"===t.operator&&(i=t.argument),e.get("test").replace(i),e.get("consequent").replace(n),e.get("alternate").replace()}}else{var a=o.expressionStatement(t);e.replace(a)}}(e);return e}(e)},h._computeNode=function(){var e=this.value;if(r.Node.check(e))return e;var t=this.parentPath;return t&&t.node||null},h._computeParent=function(){var e=this.value,t=this.parentPath;if(!r.Node.check(e)){for(;t&&!r.Node.check(t.value);)t=t.parentPath;t&&(t=t.parentPath)}for(;t&&!r.Node.check(t.value);)t=t.parentPath;return t||null},h._computeScope=function(){var e=this.value,t=this.parentPath,n=t&&t.scope;return r.Node.check(e)&&l.isEstablishedBy(e)&&(n=new l(this,n)),n||null},h.getValueProperty=function(e){return t.getFieldValue(this.value,e)},h.needsParens=function(e){var t=this.parentPath;if(!t)return!1;var n=this.value;if(!r.Expression.check(n))return!1;if("Identifier"===n.type)return!1;for(;!r.Node.check(t.value);)if(!(t=t.parentPath))return!1;var s=t.value;switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===s.type&&"object"===this.name&&s.object===n;case"BinaryExpression":case"LogicalExpression":switch(s.type){case"CallExpression":return"callee"===this.name&&s.callee===n;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===this.name&&s.object===n;case"BinaryExpression":case"LogicalExpression":var i=n,o=s.operator,u=f[o],c=i.operator,l=f[c];if(u>l)return!0;if(u===l&&"right"===this.name){if(s.right!==i)throw new Error("Nodes must be equal");return!0}default:return!1}case"SequenceExpression":switch(s.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(s.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===s.type&&a.check(n.value)&&"object"===this.name&&s.object===n;case"AssignmentExpression":case"ConditionalExpression":switch(s.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&s.callee===n;case"ConditionalExpression":return"test"===this.name&&s.test===n;case"MemberExpression":return"object"===this.name&&s.object===n;default:return!1}default:if("NewExpression"===s.type&&"callee"===this.name&&s.callee===n)return m(n)}return!(!0===e||this.canBeFirstInStatement()||!this.firstInStatement())};var f={};function m(e){return!!r.CallExpression.check(e)||(u.check(e)?e.some(m):!!r.Node.check(e)&&t.someField(e,(function(e,t){return m(t)})))}return[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach((function(e,t){e.forEach((function(e){f[e]=t}))})),h.canBeFirstInStatement=function(){var e=this.node;return!r.FunctionExpression.check(e)&&!r.ObjectExpression.check(e)},h.firstInStatement=function(){return function(e){for(var t,n;e.parent;e=e.parent){if(t=e.node,n=e.parent.node,r.BlockStatement.check(n)&&"body"===e.parent.name&&0===e.name){if(n.body[0]!==t)throw new Error("Nodes must be equal");return!0}if(r.ExpressionStatement.check(n)&&"expression"===e.name){if(n.expression!==t)throw new Error("Nodes must be equal");return!0}if(r.SequenceExpression.check(n)&&"expressions"===e.parent.name&&0===e.name){if(n.expressions[0]!==t)throw new Error("Nodes must be equal")}else if(r.CallExpression.check(n)&&"callee"===e.name){if(n.callee!==t)throw new Error("Nodes must be equal")}else if(r.MemberExpression.check(n)&&"object"===e.name){if(n.object!==t)throw new Error("Nodes must be equal")}else if(r.ConditionalExpression.check(n)&&"test"===e.name){if(n.test!==t)throw new Error("Nodes must be equal")}else if(d(n)&&"left"===e.name){if(n.left!==t)throw new Error("Nodes must be equal")}else{if(!r.UnaryExpression.check(n)||n.prefix||"argument"!==e.name)return!1;if(n.argument!==t)throw new Error("Nodes must be equal")}}return!0}(this)},p},e.exports=t.default}(_e,_e.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=fe,n=r.__importDefault(ye),s=r.__importDefault(_e.exports),i=Object.prototype.hasOwnProperty;t.default=function(e){var t=e.use(n.default),r=e.use(s.default),o=t.builtInTypes.array,a=t.builtInTypes.object,u=t.builtInTypes.function,c=function e(){if(!(this instanceof e))throw new Error("PathVisitor constructor cannot be invoked without 'new'");this._reusableContextStack=[],this._methodNameTable=function(e){var r=Object.create(null);for(var n in e)/^visit[A-Z]/.test(n)&&(r[n.slice(5)]=!0);for(var s=t.computeSupertypeLookupTable(r),i=Object.create(null),o=Object.keys(s),a=o.length,c=0;c<a;++c){var l=o[c];n="visit"+s[l],u.check(e[n])&&(i[l]=n)}return i}(this),this._shouldVisitComments=i.call(this._methodNameTable,"Block")||i.call(this._methodNameTable,"Line"),this.Context=d(this),this._visiting=!1,this._changeReported=!1};function l(e,t){for(var r in t)i.call(t,r)&&(e[r]=t[r]);return e}c.fromMethodsObject=function(e){if(e instanceof c)return e;if(!a.check(e))return new c;var t=function e(){if(!(this instanceof e))throw new Error("Visitor constructor cannot be invoked without 'new'");c.call(this)},r=t.prototype=Object.create(p);return r.constructor=t,l(r,e),l(t,c),u.assert(t.fromMethodsObject),u.assert(t.visit),new t},c.visit=function(e,t){return c.fromMethodsObject(t).visit(e)};var p=c.prototype;function h(e,n){if(!(e instanceof r))throw new Error("");if(!(n instanceof c))throw new Error("");var s=e.value;if(o.check(s))e.each(n.visitWithoutReset,n);else if(a.check(s)){var u=t.getFieldNames(s);n._shouldVisitComments&&s.comments&&u.indexOf("comments")<0&&u.push("comments");for(var l=u.length,p=[],h=0;h<l;++h){var d=u[h];i.call(s,d)||(s[d]=t.getFieldValue(s,d)),p.push(e.get(d))}for(h=0;h<l;++h)n.visitWithoutReset(p[h])}else;return e.value}function d(e){function t(n){if(!(this instanceof t))throw new Error("");if(!(this instanceof c))throw new Error("");if(!(n instanceof r))throw new Error("");Object.defineProperty(this,"visitor",{value:e,writable:!1,enumerable:!0,configurable:!1}),this.currentPath=n,this.needToCallTraverse=!0,Object.seal(this)}if(!(e instanceof c))throw new Error("");var n=t.prototype=Object.create(e);return n.constructor=t,l(n,f),t}p.visit=function(){if(this._visiting)throw new Error("Recursively calling visitor.visit(path) resets visitor state. Try this.visit(path) or this.traverse(path) instead.");this._visiting=!0,this._changeReported=!1,this._abortRequested=!1;for(var e,t=arguments.length,n=new Array(t),s=0;s<t;++s)n[s]=arguments[s];n[0]instanceof r||(n[0]=new r({root:n[0]}).get("root")),this.reset.apply(this,n);try{var i=this.visitWithoutReset(n[0]);e=!0}finally{if(this._visiting=!1,!e&&this._abortRequested)return n[0].value}return i},p.AbortRequest=function(){},p.abort=function(){var e=this;e._abortRequested=!0;var t=new e.AbortRequest;throw t.cancel=function(){e._abortRequested=!1},t},p.reset=function(e){},p.visitWithoutReset=function(e){if(this instanceof this.Context)return this.visitor.visitWithoutReset(e);if(!(e instanceof r))throw new Error("");var t=e.value,n=t&&"object"==typeof t&&"string"==typeof t.type&&this._methodNameTable[t.type];if(!n)return h(e,this);var s=this.acquireContext(e);try{return s.invokeVisitorMethod(n)}finally{this.releaseContext(s)}},p.acquireContext=function(e){return 0===this._reusableContextStack.length?new this.Context(e):this._reusableContextStack.pop().reset(e)},p.releaseContext=function(e){if(!(e instanceof this.Context))throw new Error("");this._reusableContextStack.push(e),e.currentPath=null},p.reportChanged=function(){this._changeReported=!0},p.wasChangeReported=function(){return this._changeReported};var f=Object.create(null);return f.reset=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof r))throw new Error("");return this.currentPath=e,this.needToCallTraverse=!0,this},f.invokeVisitorMethod=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(this.currentPath instanceof r))throw new Error("");var t=this.visitor[e].call(this,this.currentPath);if(!1===t?this.needToCallTraverse=!1:undefined!==t&&(this.currentPath=this.currentPath.replace(t)[0],this.needToCallTraverse&&this.traverse(this.currentPath)),!1!==this.needToCallTraverse)throw new Error("Must either call this.traverse or return false in "+e);var n=this.currentPath;return n&&n.value},f.traverse=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof r))throw new Error("");if(!(this.currentPath instanceof r))throw new Error("");return this.needToCallTraverse=!1,h(e,c.fromMethodsObject(t||this.visitor))},f.visit=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof r))throw new Error("");if(!(this.currentPath instanceof r))throw new Error("");return this.needToCallTraverse=!1,c.fromMethodsObject(t||this.visitor).visitWithoutReset(e)},f.reportChanged=function(){this.visitor.reportChanged()},f.abort=function(){this.needToCallTraverse=!1,this.visitor.abort()},c},e.exports=t.default}(Oe,Oe.exports);var Fe={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=fe.__importDefault(ye);t.default=function(e){var t=e.use(r.default),n=t.getFieldNames,s=t.getFieldValue,i=t.builtInTypes.array,o=t.builtInTypes.object,a=t.builtInTypes.Date,u=t.builtInTypes.RegExp,c=Object.prototype.hasOwnProperty;function l(e,t,r){return i.check(r)?r.length=0:r=null,h(e,t,r)}function p(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function h(e,t,r){return e===t||(i.check(e)?function(e,t,r){i.assert(e);var n=e.length;if(!i.check(t)||t.length!==n)return r&&r.push("length"),!1;for(var s=0;s<n;++s){if(r&&r.push(s),s in e!=s in t)return!1;if(!h(e[s],t[s],r))return!1;if(r){var o=r.pop();if(o!==s)throw new Error(""+o)}}return!0}(e,t,r):o.check(e)?function(e,t,r){if(o.assert(e),!o.check(t))return!1;if(e.type!==t.type)return r&&r.push("type"),!1;var i=n(e),a=i.length,u=n(t),l=u.length;if(a===l){for(var p=0;p<a;++p){var d=i[p],f=s(e,d),m=s(t,d);if(r&&r.push(d),!h(f,m,r))return!1;if(r){var y=r.pop();if(y!==d)throw new Error(""+y)}}return!0}if(!r)return!1;var g=Object.create(null);for(p=0;p<a;++p)g[i[p]]=!0;for(p=0;p<l;++p){if(d=u[p],!c.call(g,d))return r.push(d),!1;delete g[d]}for(d in g){r.push(d);break}return!1}(e,t,r):a.check(e)?a.check(t)&&+e==+t:u.check(e)?u.check(t)&&e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.ignoreCase===t.ignoreCase:e==t)}return l.assert=function(e,t){var r=[];if(!l(e,t,r)){if(0!==r.length)throw new Error("Nodes differ in the following path: "+r.map(p).join(""));if(e!==t)throw new Error("Nodes must be equal")}},l},e.exports=t.default}(Fe,Fe.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=fe,n=r.__importDefault(ye),s=r.__importDefault(Oe.exports),i=r.__importDefault(Fe.exports),o=r.__importDefault(Ne.exports),a=r.__importDefault(_e.exports);t.default=function(e){var t=function(){var e=[],t=[];function r(r){var s=e.indexOf(r);return-1===s&&(s=e.length,e.push(r),t[s]=r(n)),t[s]}var n={use:r};return n}(),r=t.use(n.default);e.forEach(t.use),r.finalize();var u=t.use(s.default);return{Type:r.Type,builtInTypes:r.builtInTypes,namedTypes:r.namedTypes,builders:r.builders,defineMethod:r.defineMethod,getFieldNames:r.getFieldNames,getFieldValue:r.getFieldValue,eachField:r.eachField,someField:r.someField,getSupertypeNames:r.getSupertypeNames,getBuilderName:r.getBuilderName,astNodesAreEquivalent:t.use(i.default),finalize:r.finalize,Path:t.use(o.default),NodePath:t.use(a.default),PathVisitor:u,use:t.use,visit:u.visit}},e.exports=t.default}(me,me.exports);var Be={exports:{}},Le={};Object.defineProperty(Le,"__esModule",{value:!0}),Le.LogicalOperators=Le.AssignmentOperators=Le.BinaryOperators=void 0,Le.BinaryOperators=["==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof"],Le.AssignmentOperators=["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&="],Le.LogicalOperators=["||","&&"];var Me={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=fe.__importDefault(ye);t.default=function(e){var t=e.use(r.default),n=t.Type,s=t.builtInTypes,i=s.number,o=n.or(s.string,s.number,s.boolean,s.null,s.undefined),a=n.from((function(e){if(null===e)return!0;var t=typeof e;return"object"!==t&&"function"!==t}),o.toString());return{geq:function(e){return n.from((function(t){return i.check(t)&&t>=e}),i+" >= "+e)},defaults:{null:function(){return null},emptyArray:function(){return[]},false:function(){return!1},true:function(){return!0},undefined:function(){},"use strict":function(){return"use strict"}},isPrimitive:a}},e.exports=t.default}(Me,Me.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=fe,n=Le,s=r.__importDefault(ye),i=r.__importDefault(Me.exports);t.default=function(e){var t=e.use(s.default).Type,r=t.def,o=t.or,a=e.use(i.default),u=a.defaults,c=a.geq;r("Printable").field("loc",o(r("SourceLocation"),null),u.null,!0),r("Node").bases("Printable").field("type",String).field("comments",o([r("Comment")],null),u.null,!0),r("SourceLocation").field("start",r("Position")).field("end",r("Position")).field("source",o(String,null),u.null),r("Position").field("line",c(1)).field("column",c(0)),r("File").bases("Node").build("program","name").field("program",r("Program")).field("name",o(String,null),u.null),r("Program").bases("Node").build("body").field("body",[r("Statement")]),r("Function").bases("Node").field("id",o(r("Identifier"),null),u.null).field("params",[r("Pattern")]).field("body",r("BlockStatement")).field("generator",Boolean,u.false).field("async",Boolean,u.false),r("Statement").bases("Node"),r("EmptyStatement").bases("Statement").build(),r("BlockStatement").bases("Statement").build("body").field("body",[r("Statement")]),r("ExpressionStatement").bases("Statement").build("expression").field("expression",r("Expression")),r("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",r("Expression")).field("consequent",r("Statement")).field("alternate",o(r("Statement"),null),u.null),r("LabeledStatement").bases("Statement").build("label","body").field("label",r("Identifier")).field("body",r("Statement")),r("BreakStatement").bases("Statement").build("label").field("label",o(r("Identifier"),null),u.null),r("ContinueStatement").bases("Statement").build("label").field("label",o(r("Identifier"),null),u.null),r("WithStatement").bases("Statement").build("object","body").field("object",r("Expression")).field("body",r("Statement")),r("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",r("Expression")).field("cases",[r("SwitchCase")]).field("lexical",Boolean,u.false),r("ReturnStatement").bases("Statement").build("argument").field("argument",o(r("Expression"),null)),r("ThrowStatement").bases("Statement").build("argument").field("argument",r("Expression")),r("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",r("BlockStatement")).field("handler",o(r("CatchClause"),null),(function(){return this.handlers&&this.handlers[0]||null})).field("handlers",[r("CatchClause")],(function(){return this.handler?[this.handler]:[]}),!0).field("guardedHandlers",[r("CatchClause")],u.emptyArray).field("finalizer",o(r("BlockStatement"),null),u.null),r("CatchClause").bases("Node").build("param","guard","body").field("param",r("Pattern")).field("guard",o(r("Expression"),null),u.null).field("body",r("BlockStatement")),r("WhileStatement").bases("Statement").build("test","body").field("test",r("Expression")).field("body",r("Statement")),r("DoWhileStatement").bases("Statement").build("body","test").field("body",r("Statement")).field("test",r("Expression")),r("ForStatement").bases("Statement").build("init","test","update","body").field("init",o(r("VariableDeclaration