UNPKG

@zcatpkg/gogocode

Version:

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

1 lines 1.09 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,a=s;function o(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&&(a=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=o(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(a===clearTimeout)return clearTimeout(e);if((a===s||!a)&&clearTimeout)return a=clearTimeout,clearTimeout(e);try{a(e)}catch(t){try{return a.call(null,e)}catch(t){return a.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||o(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,x=y,v=y,E=y,b=y,S=y,T=y;var A=r.performance||{},D=A.now||A.mozNow||A.msNow||A.oNow||A.webkitNow||function(){return(new Date).getTime()};var C=new Date;var w={nextTick:f,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:g,addListener:x,once:v,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*D.call(A),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-C)/1e3}},P={},k=t(Object.freeze({__proto__:null,default:{}})),N={},O=function(e,t){return O=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])},O(e,t)};var F=function(){return F=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},F.apply(this,arguments)};var _=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 I(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 B(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,s,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.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 a}function M(e){return this instanceof M?(this.v=e,this):new M(e)}var L=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};var R=Object.freeze({__proto__:null,__extends:function(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}O(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},get __assign(){return F},__rest:function(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},__decorate:function(e,t,r,n){var s,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,r,a):s(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},__param:function(e,t){return function(r,n){t(r,n,e)}},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__awaiter:function(e,t,r,n){return new(r||(r=Promise))((function(s,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function o(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(a,o)}u((n=n.apply(e,t||[])).next())}))},__generator:function(e,t){var r,n,s,i,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(i){return function(o){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,o])}}},__createBinding:_,__exportStar:function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||_(t,e,r)},__values:I,__read:B,__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(B(arguments[t]));return e},__spreadArrays:function(){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],a=0,o=i.length;a<o;a++,s++)n[s]=i[a];return n},__spreadArray:function(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))},__await:M,__asyncGenerator:function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,s=r.apply(e,t||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){s[e]&&(n[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||o(e,t)}))})}function o(e,t){try{(r=s[e](t)).value instanceof M?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){o("next",e)}function c(e){o("throw",e)}function l(e,t){e(t),i.shift(),i.length&&o(i[0][0],i[0][1])}},__asyncDelegator:function(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:M(e[n](t)),done:"return"===n}:s?s(t):t}:s}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=I(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)}))}}},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&_(t,e,r);return L(t,e),t},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__classPrivateFieldGet:function(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)},__classPrivateFieldSet:function(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},__classPrivateFieldIn:function(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)}}),j=t(R),U={exports:{}},$={};Object.defineProperty($,"__esModule",{value:!0}),$.Def=void 0;var V=j,z=Object.prototype,q=z.toString,X=z.hasOwnProperty,J=function(){function e(){}return e.prototype.assert=function(e,t){if(!this.check(e,t)){var r=ee(e);throw new Error(r+" does not match type "+this)}return!0},e.prototype.arrayOf=function(){return new K(this)},e}(),K=function(e){function t(t){var r=e.call(this)||this;return r.elemType=t,r.kind="ArrayType",r}return V.__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}(J),W=function(e){function t(t){var r=e.call(this)||this;return r.value=t,r.kind="IdentityType",r}return V.__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}(J),G=function(e){function t(t){var r=e.call(this)||this;return r.fields=t,r.kind="ObjectType",r}return V.__extends(t,e),t.prototype.toString=function(){return"{ "+this.fields.join(", ")+" }"},t.prototype.check=function(e,t){return q.call(e)===q.call({})&&this.fields.every((function(r){return r.type.check(e[r.name],t)}))},t}(J),H=function(e){function t(t){var r=e.call(this)||this;return r.types=t,r.kind="OrType",r}return V.__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}(J),Y=function(e){function t(t,r){var n=e.call(this)||this;return n.name=t,n.predicate=r,n.kind="PredicateType",n}return V.__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}(J),Q=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 X.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,a=s.getValue(e);return i.check(a,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}();$.Def=Q;var Z=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 ee(e){return Array.isArray(e)?"["+e.map(ee).join(", ")+"]":e&&"object"==typeof e?"{ "+Object.keys(e).map((function(t){return t+": "+e[t]})).join(", ")+" }":JSON.stringify(e)}$.default=function(e){var t={or:function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return new H(e.map((function(e){return t.from(e)})))},from:function(e,s){if(e instanceof K||e instanceof W||e instanceof G||e instanceof H||e instanceof Y)return e;if(e instanceof Q)return e.type;if(o.check(e)){if(1!==e.length)throw new Error("only one element type is permitted for typed arrays");return new K(t.from(e[0]))}if(u.check(e))return new G(Object.keys(e).map((function(r){return new Z(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 Y(s,e)}return new W(e)},def:function(e){return X.call(y,e)?y[e]:y[e]=new x(e)},hasDef:function(e){return X.call(y,e)}},r=[],n=[];function s(e,t){var s=q.call(t),i=new Y(e,(function(e){return q.call(e)===s}));return t&&"function"==typeof t.constructor&&(r.push(t.constructor),n.push(i)),i}var i=s("string","truthy"),a=s("function",(function(){})),o=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:a,array:o,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&&X.call(y,t)){var r=y[t];if(r.finalized)return r}}return null}var x=function(e){function r(t){var r=e.call(this,new Y(t,(function(e,t){return r.check(e,t)})),t)||this;return r}return V.__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(!X.call(t,r)){var i=e.allFields;if(!X.call(i,r))throw new Error(""+r);var a,o=i[r],u=o.type;if(s)a=n;else{if(!o.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)}a=o.defaultFn.call(t)}if(!u.check(a))throw new Error(ee(a)+" does not match field "+o+" of type "+e.typeName);t[r]=a}},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){X.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(v,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 Z(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 Q)){var i="unknown supertype name "+JSON.stringify(n)+" for subtype "+JSON.stringify(e.typeName);throw new Error(i)}s.finalize(),C(t,s.allFields),C(r,s.allSupertypes)})),C(t,this.ownFields),r[this.typeName]=this,this.fieldNames.length=0,t)X.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("");X.call(r,e)&&delete t[r[e]],r[e]=n,t.push.apply(t,s.baseNames)}for(var i=0,a=i,o=t.length;a<o;++a)X.call(t,a)&&(t[i++]=t[a]);t.length=i}(this.typeName,this.supertypeList),this.buildable&&this.supertypeList.lastIndexOf("Expression")>=0&&function(e){var t=S(e);if(v[t])return;var r=v[b(e)];if(!r)return;var n=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.expressionStatement(r.apply(v,e))};n.from=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.expressionStatement(r.from.apply(v,e))},v[t]=n}(this.typeName)}},r}(Q),v=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 A(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 D(e,t){var r=g(e);if(r){var n=r.allFields[t];if(n)return n.getValue(e)}return e&&e[t]}function C(e,t){return Object.keys(t).forEach((function(r){e[r]=t[r]})),e}return{Type:t,builtInTypes:m,getSupertypeNames:function(e){if(!X.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],a=y[i];if(!0!==a.finalized)throw new Error(""+i);for(var o=0;o<a.supertypeList.length;++o){var u=a.supertypeList[o];if(X.call(e,u)){t[i]=u;break}}}return t},builders:v,defineMethod:function(e,t){var r=E[e];return f.check(t)?delete E[e]:(a.assert(t),Object.defineProperty(E,e,{enumerable:!0,configurable:!0,value:t})),r},getBuilderName:b,getStatementBuilderName:S,namedTypes:T,getFieldNames:A,getFieldValue:D,eachField:function(e,t,r){A(e).forEach((function(r){t.call(this,r,D(e,r))}),r)},someField:function(e,t,r){return A(e).some((function(r){return t.call(this,r,D(e,r))}),r)},finalize:function(){Object.keys(y).forEach((function(e){y[e].finalize()}))}}};var te={exports:{}},re={exports:{}},ne={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j.__importDefault($),n=Object.prototype.hasOwnProperty;t.default=function(e){var t=e.use(r.default),s=t.builtInTypes.array,i=t.builtInTypes.number,a=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},o=a.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,a){if(s.assert(e.value),0===t)return l;var o=e.value.length;if(o<1)return l;var c=arguments.length;2===c?(r=0,a=o):3===c?(r=Math.max(r,0),a=o):(r=Math.max(r,0),a=Math.min(a,o)),i.assert(r),i.assert(a);for(var p=Object.create(null),h=u(e),d=r;d<a;++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}}}function h(e){if(!(e instanceof a))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("");return e}return o.getValueProperty=function(e){return this.value[e]},o.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},o.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])},o.map=function(e,t){var r=[];return this.each((function(t){r.push(e.call(this,t))}),t),r},o.filter=function(e,t){var r=[];return this.each((function(t){e.call(this,t)&&r.push(t)}),t),r},o.shift=function(){var e=p(this,-1),t=this.value.shift();return e(),t},o.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},o.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)},o.pop=function(){s.assert(this.value);var e=u(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},o.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},o.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)},o.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)},o.replace=function(e){var t=[],r=this.parentPath.value,n=u(this.parentPath),i=arguments.length;if(h(this),s.check(r)){for(var a=r.length,o=p(this.parentPath,i-1,this.name+1),c=[this.name,1],l=0;l<i;++l)c.push(arguments[l]);var d=r.splice.apply(r,c);if(d[0]!==this.value)throw new Error("");if(r.length!==a-1+i)throw new Error("");if(o(),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),l=0;l<i;++l)t.push(this.parentPath.get(this.name+l));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},a},e.exports=t.default}(ne,ne.exports);var se={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j.__importDefault($),n=Object.prototype.hasOwnProperty;t.default=function(e){var t=e.use(r.default),s=t.Type,i=t.namedTypes,a=i.Node,o=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):a.check(c)&&!o.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||o.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 a=s.param.name,u=n.call(t,a);f(e.get("body"),t,r),u||delete t[a]}}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}(se,se.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j,n=r.__importDefault($),s=r.__importDefault(ne.exports),i=r.__importDefault(se.exports);t.default=function(e){var t=e.use(n.default),r=t.namedTypes,a=t.builders,o=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=a.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 o=a.expressionStatement(t);e.replace(o)}}(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,a=s.operator,u=f[a],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&&o.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}(re,re.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j,n=r.__importDefault($),s=r.__importDefault(re.exports),i=Object.prototype.hasOwnProperty;t.default=function(e){var t=e.use(n.default),r=e.use(s.default),a=t.builtInTypes.array,o=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("visit".length)]=!0);for(var s=t.computeSupertypeLookupTable(r),i=Object.create(null),a=Object.keys(s),o=a.length,c=0;c<o;++c){var l=a[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(!o.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(a.check(s))e.each(n.visitWithoutReset,n);else if(o.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}(te,te.exports);var ie={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j.__importDefault($);t.default=function(e){var t=e.use(r.default),n=t.getFieldNames,s=t.getFieldValue,i=t.builtInTypes.array,a=t.builtInTypes.object,o=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 a=r.pop();if(a!==s)throw new Error(""+a)}}return!0}(e,t,r):a.check(e)?function(e,t,r){if(a.assert(e),!a.check(t))return!1;if(e.type!==t.type)return r&&r.push("type"),!1;var i=n(e),o=i.length,u=n(t),l=u.length;if(o===l){for(var p=0;p<o;++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<o;++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):o.check(e)?o.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}(ie,ie.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j,n=r.__importDefault($),s=r.__importDefault(te.exports),i=r.__importDefault(ie.exports),a=r.__importDefault(ne.exports),o=r.__importDefault(re.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(a.default),NodePath:t.use(o.default),PathVisitor:u,use:t.use,visit:u.visit}},e.exports=t.default}(U,U.exports);var ae={exports:{}},oe={};Object.defineProperty(oe,"__esModule",{value:!0}),oe.LogicalOperators=oe.AssignmentOperators=oe.BinaryOperators=void 0,oe.BinaryOperators=["==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof"],oe.AssignmentOperators=["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&="],oe.LogicalOperators=["||","&&"];var ue={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j.__importDefault($);t.default=function(e){var t=e.use(r.default),n=t.Type,s=t.builtInTypes,i=s.number,a=n.or(s.string,s.number,s.boolean,s.null,s.undefined),o=n.from((function(e){if(null===e)return!0;var t=typeof e;return"object"!==t&&"function"!==t}),a.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:o}},e.exports=t.default}(ue,ue.exports),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=j,n=oe,s=r.__importDefault($),i=r.__importDefault(ue.exports);t.default=function(e){var t=e.use(s.default).Type,r=t.def,a=t.or,o=e.use(i.default),u=o.defaults,c=o.geq;r("Printable").field("loc",a(r("SourceLocation"),null),u.null,!0),r("Node").bases("Printable").field("type",String).field("comments",a([r("Comment")],null),u.null,!0),r("SourceLocation").field("start",r("Position")).field("end",r("Position")).field("source",a(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",a(String,null),u.null),r("Program").bases("Node").build("body").field("body",[r("Statement")]),r("Function").bases("Node").field("id",a(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",a(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",a(r("Identifier"),null),u.null),r("ContinueStatement").bases("Statement").build("label").field("label",a(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",a(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",a(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",a(r("BlockStatement"),null),u.null),r("CatchClause").bases("Node").build("param","guard","body").field("param",r("Pattern")).field("guard",a(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",a(r("VariableDeclaration"),r("Expression"),null)).field("test",a(r("Expression"),null)).field("update",a(r("Expression"),null)).field("body",r("Statement")),r("ForInStatement").bases("Statement").build("left","right","body").field("left",a(r("VariableDeclaration"),r("Expression"))).field("right",r("Expression")).field("body",r("Statement")),r("DebuggerStatement").bases("Statement").build(),r("Declaration").bases("Statement"),r("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",r("Identifier")),r("FunctionExpression").bases("Function","Expression").build("id","params","body"),r("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",a("var","let","const")).field("declarations",[r("VariableDeclarator")]),r("VariableDeclarator").bases("Node").build("id","init").field("id",r("Pattern")).field("init",a(r("Expression"),null),u.null),r("Expression").bases("Node"),r("ThisExpression").bases("Expression").build(),r("ArrayExpression").bases("Expression").build("elements").field("elements",[a(r("Expression"),null)]),r("ObjectExpression").bases("Expression").build("properties").field("properties",[r("Property")]),r("Property").bases("Node").build("kind","key","value").field("kind",a("init","get","set")).field("key",a(r("Literal"),r("Identifier"))).field("value",r("Expression")),r("SequenceExpression").bases("Expression").build("expressions").field("expressions",[r("Expression")]);var l=a("-","+","!","~","typeof","void","delete");r("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",l).field("argument",r("Expression")).field("prefix",Boolean,u.true);var p=a.apply(void 0,n.BinaryOperators);r("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",p).field("left",r("Expression")).field("right",r("Expression"));var h=a.apply(void 0,n.AssignmentOperators);r("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",a(r("Pattern"),r("MemberExpression"))).field("right",r("Expression"));var d=a("++","--");r("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",d).field("argument",r("Expression")).field("prefix",Boolean);var f=a.apply(void 0,n.LogicalOperators);r("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",f).field("left",r("Expression")).field("right",r("Expression")),r("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",r("Expression")).field("consequent",r("Expression")).field("alternate",r("Expression")),r("NewExpression").bases("Expression").build("callee","arguments").field("callee",r("Expression")).field("arguments",[r("Expression")]),r("CallExpression").bases("Expression").build("callee","arguments").field("callee",r("Expression")).field("arguments",[r("Expression")]),r("MemberExpression").bases("Expression").build("object","property","computed").field("object",r("Expression")).field("property",a(r("Identifier"),r("Expression"))).field("computed",Boolean,(function(){var e=this.property.type;return"Literal"===e||"MemberExpression"===e||"BinaryExpression"===e})),r("Pattern").bases("Node"),r("SwitchCase").bases("Node").build("test","consequent").field("test",a(r("Expression"),null)).field("consequent",[r("Statement")]),r("Identifier").bases("Expression","Pattern").build("name").field("name",String).field("optional",Boolean,u.false),r("Literal").bases("Expression").build("value").field("value",a(String,Boolean,null,Number,RegExp)).field("regex",a({pattern:String,flags:String},null),(function(){if(this.value instanceof RegExp){var e="";return this.value.ignoreCase&&(e+="i"),this.value.multiline&&(e+="m"),this.value.global&&(e+="g"),{pattern:this.value.source,flags:e}}return null})),r("Comment").bases("Printable").field("value",String).field("leading",Boole