UNPKG

riot

Version:

Simple and elegant component-based UI library

1 lines 349 kB
var e,t;e=this,t=function(e){"use strict";const t=new Map,n=Symbol(),r=new Set,i="is",a="value",s="ref",o=/^on/,l="mount",c="update",u="unmount",p="shouldUpdate",h="onBeforeMount",d="onMounted",f="onBeforeUpdate",m="onUpdated",y="onBeforeUnmount",g="onUnmounted",b="props",v="state",x="slots",S="root",E=Symbol(),T=Symbol(),_=Symbol(),k=Symbol(),P=Symbol();function w(e,t){return typeof e===t}function A(e){const t=e.ownerSVGElement;return!!t||null===t}function C(e){return"template"===e.tagName.toLowerCase()}function I(e){return w(e,"function")}function N(e){return!O(e)&&e.constructor===Object}function O(e){return null==e}function D(){return void 0!==globalThis.process}function L(e){return o.test(e)}const j=0,M=1,B=2,F=3,V=4,R={ATTRIBUTE:0,EVENT:M,TEXT:2,VALUE:3,REF:V};function U(e){return e.replace(/-(\w)/g,(e,t)=>t.toUpperCase())}function q(e,t){throw Error(e,{cause:t})}function z(e){const t=new Map,n=n=>(t.has(n)||t.set(n,e.call(this,n)))&&t.get(n);return n.cache=t,n}function W(e,t){return e.reduce((e,{type:n,name:r,evaluate:i})=>{const a=i(t);switch(!0){case!r&&0===n:return{...e,...a};case n===V:e.ref=a;break;case 3===n:e.value=a;break;default:e[U(r)]=a}return e},{})}const G=0,J=1,K=2,$=3,H=4,X={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};function Q(e){return Array.from(e.attributes).reduce((e,t)=>(e[U(t.name)]=t.value,e),{})}function Y(e){for(;e.firstChild;)e.removeChild(e.firstChild)}const Z=e=>e.remove(),ee=(e,t)=>t&&t.parentNode&&t.parentNode.insertBefore(e,t),te=(e,t)=>t&&t.parentNode&&t.parentNode.replaceChild(e,t);function ne(){return this}function re(e){return I(e)?e.prototype&&e.prototype.constructor?new e:e():e}function ie(e,t,n,r={}){return Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!1,configurable:!0,...r}),e}function ae(e,t,n){return Object.entries(t).forEach(([t,r])=>{ie(e,t,r,n)}),e}function se(e,t){return Object.entries(t).forEach(([t,n])=>{e[t]||(e[t]=n)}),e}const oe="exports",le="template",ce="riot",ue="RiotComponentWrapper",pe="RiotComponent",he="javascript",de="css",fe="template",me="script",ye="style",ge="textarea",be="isRaw",ve="isSelfClosing",xe="isVoid",Se="isBoolean",Ee="isCustom",Te="isSpread";var _e=Object.freeze({__proto__:null,CSS_OUTPUT_NAME:"css",IS_BOOLEAN:Se,IS_CUSTOM:Ee,IS_RAW:be,IS_SELF_CLOSING:ve,IS_SPREAD:Te,IS_VOID:xe,JAVASCRIPT_OUTPUT_NAME:he,JAVASCRIPT_TAG:me,STYLE_TAG:ye,TEMPLATE_OUTPUT_NAME:fe,TEXTAREA_TAG:ge}),ke=Object.freeze({__proto__:null,ATTR:2,CDATA:4,COMMENT:8,DOCTYPE:10,DOCUMENT:9,DOCUMENT_FRAGMENT:11,TAG:1,TEXT:3});const Pe=/^(?:\/[a-zA-Z]|[a-zA-Z][^\s>/]?)/,we=/(\/?[^\s>/]+)\s*(>)?/g,Ae=/(\S[^>/=\s]*)(?:\s*=\s*([^>/])?)?/g,Ce=/\.\.\./,Ie={script:/<\/script\s*>/gi,style:/<\/style\s*>/gi,textarea:/<\/textarea\s*>/gi},Ne=/^\/?(?:pre|textarea)$/;function Oe(e,t,n){return e.lastIndex=t,e.exec(n)}var De=e=>e.replace(/(?=[-[\](){^*+?.$|\\])/g,"\\");function Le(e,t,n){const r=/[`$\\]/g;let i;for(;r.lastIndex=t,r.exec(e);){if(i=e[(t=r.lastIndex)-1],"`"===i)return t;if("$"===i&&"{"===e[t++])return n.push("`","}"),t}throw function(e,t,n){n||(n=e.length);const r=(e.slice(0,n).match(/\r\n?|\n/g)||"").length+1;let i=0;for(;--n>=0&&!/[\r\n]/.test(e[n]);)++i;return`[${r},${i}]: Unclosed ES6 template literal.`}(e,0,t)}const je="[{(,;:?=|&!^~>%*/",Me=je+"+-",Be=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],Fe=Be.reduce((e,t)=>e+t.slice(-1),""),Ve=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,Re=/[$\w]/,Ue=/.*/g;function qe(e,t){for(;--t>=0&&/\s/.test(e[t]););return t}const ze=/'[^'\n\r\\]*(?:\\(?:\r\n?|[\S\s])[^'\n\r\\]*)*'/.source,We=`${ze}|${ze.replace(/'/g,'"')}`,Ge={};function Je(e,t,n,r){let i=0;switch(t){case"[":case"(":case"{":e.push("["===t?"]":"("===t?")":"}");break;case")":case"]":case"}":e.pop(),"}"===t&&"`"===e[e.length-1]&&(t=e.pop()),i=n+1;break;case"/":i=function(e,t){let n=Ue.lastIndex=t++;const r=(Ue.exec(e)||" ")[0].match(Ve);if(r){const i=n+r[0].length;n=qe(e,n);let a=e[n];if(n<0||je.includes(a))return i;if("."===a)"."===e[n-1]&&(t=i);else{if(("+"===a||"-"===a)&&(e[--n]!==a||(n=qe(e,n))<0||Me.includes(a=e[n])))return i;if(Fe.includes(a)){const r=n+1;for(;--n>=0&&Re.test(e[n]););Be.includes(e.slice(n+1,r))&&(t=i)}}}return t}(r,n)}return{char:t,index:i}}function Ke(e,t,n){const[r,i]=n,a=t+r.length,s=[],o=function(e){let t=Ge[e];if(!t){let n=De(e);e.length>1?n+="|[":n=/[{}[\]()]/.test(e)?"[":"["+n,Ge[e]=t=RegExp(`${We}|${n}\`/\\{}[\\]()]`,"g")}return t}(i);let l,c;for(o.lastIndex=a;c=o.exec(e);){const n=c.index,r=c[0];if(l=o.lastIndex,r===i&&!s.length)return{text:e.slice(a,n),start:t,end:l};const{char:u,index:p}=Je(s,r[0],n,e);l=p||l,o.lastIndex="`"===u?Le(e,l,s):l}}function $e(e){const t=e.last;e.last=null,t&&e.root&&e.builder.push(t)}function He(e,t,n){return e.slice(t,n)}function Xe(e,t,n,r={}){const i=He(e.data,t,n),a=r.expressions,s=r.unescape;let o=e.last;return e.pos=n,o&&3===o.type?(o.text+=i,o.end=n):($e(e),e.last=o={type:3,text:i,start:t,end:n}),a&&a.length&&(o.expressions=(o.expressions||[]).concat(a)),s&&(o.unescape=s),3}function Qe(e,t,n,r){const i=function(e,t){const{brackets:n}=e.options,r=e.regexCache[t];if(r)return r;const i=De(n[0]);return Object.assign(e.regexCache,{[t]:RegExp(`(${t})|${i}`,"g")}),e.regexCache[t]}(e,n);i.lastIndex=r;const{unescape:a,expressions:s,end:o}=function(e,t){const{data:n,options:r}=e,{brackets:i}=r,a=[];let s,o,l;for(;(l=t.exec(n))&&!l[1];)if(o=l.index,"\\"===n[o-1])s=l[0];else{const e=Ke(n,o,i);e&&(a.push(e),t.lastIndex=e.end)}return{unescape:s,expressions:a,end:l.index}}(e,i);return t?(a&&(t.unescape=a),s.length&&(t.expressions=s)):Xe(e,r,o,{expressions:s,unescape:a}),o}const Ye=e=>e.filter((e,t,n)=>n.indexOf(e)===t),Ze=["circle","ellipse","line","path","polygon","polyline","rect","stop","use"],et=["button","data","input","select","li","meter","option","output","progress","textarea","param"],tt=Ye(["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","animation","audio","canvas","clipPath","color-profile","cursor","defs","desc","discard","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","handler","hatch","hatchpath","hkern","iframe","image","linearGradient","listener","marker","mask","mesh","meshgradient","meshpatch","meshrow","metadata","missing-glyph","mpath","pattern","prefetch","radialGradient","script","set","solidColor","solidcolor","style","svg","switch","symbol","tbreak","text","textArea","textPath","title","tref","tspan","unknown","video","view","vkern"].concat(Ze)).sort(),nt=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function rt(e){return e.join("|")}function it(...e){return RegExp(`^/?(?:${rt(e.map(rt))})$`,"i")}const at=it(Ye(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","body","canvas","caption","cite","code","colgroup","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","html","i","iframe","ins","kbd","label","legend","main","map","mark","math","menu","nav","noscript","object","ol","optgroup","p","picture","pre","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","tfoot","th","thead","time","title","tr","u","ul","var","video"].concat(nt).concat(et)).sort()),st=it(tt),ot=it(nt),lt=it(Ze);it(et);const ct=it(["disabled","visible","checked","readonly","required","allowfullscreen","autofocus","autoplay","compact","controls","default","formnovalidate","hidden","ismap","itemscope","loop","multiple","muted","noresize","noshade","novalidate","nowrap","open","reversed","seamless","selected","sortable","truespeed","typemustmatch"]),ut=function(){const e=new WeakMap;return(...t)=>{if(e.has(t[0]))return e.get(t[0]);const n=(e=>RegExp(`(${e[0]}[^${e[1]}]*?${e[1]})`,"g"))(...t);return e.set(t[0],n),n}}(),pt=(e,t)=>Qe(e,t,"[>/\\s]",t.start);function ht(e,...t){return(...n)=>(n=[...t,...n]).length<e.length?ht(e,...n):e(...n)}function dt(e,t,n,r){const i=e.root,a={type:1,name:t,start:n,end:r};var s;s=t,[at,st].every(e=>!e.test(s))&&(a[Ee]=!0),function(e){return[ot,lt].some(t=>t.test(e))}(t)&&(a[xe]=!0),e.pos=r,i?(t===i.name?e.count++:t===i.close&&e.count--,$e(e)):(e.root={name:a.name,close:"/"+t},e.count=1),e.last=a}function ft(e){return e.replace(/\r/g,"\\r").replace(/\n/g,"\\n")}function mt(e){return e.replace(/\\/g,"\\\\")}const yt=Object.seal({get(){const e=this.store;return{[fe]:e.root.nodes[0],[de]:e[ye],[he]:e[me]}},push(e){const t=this.store;switch(e.type){case 8:this.pushComment(t,e);break;case 3:this.pushText(t,e);break;case 1:{const n=e.name,r="/",[i]=n;i!==r||e.isVoid?i!==r&&this.openTag(t,e):this.closeTag(t,e,n);break}}},pushComment(e,t){e.last.nodes.push(t)},closeTag(e,t){(e.scryle||e.last).end=t.end,e.root.nodes[0]&&(e.root.nodes[0].end=t.end),e.scryle?e.scryle=null:e.last=e.stack.pop()},openTag(e,t){const n=t.name,r=t.attributes,i=me===n&&!(e=>(e.attributes||[]).some(e=>"src"===e.name))(t)||n===ye;if(i)e[n]&&(this.store.data,t.start),e[n]=t,e.scryle=e[n];else{const r=e.last,i=t;r.nodes.push(i),(r[be]||Ne.test(n))&&(t[be]=!0),t[ve]||t[xe]||(e.stack.push(r),i.nodes=[],e.last=i)}r&&this.attrs(r)},attrs(e){e.forEach(e=>{e.value&&this.split(e,e.value,e.valueStart,!0)})},pushText(e,t){const n=t.text,r=e.scryle;if(r)r.text=t;else{const r=e.last,i=this.compact&&!r[be];if(i&&!/\S/.test(n))return;this.split(t,n,t.start,i),r.nodes.push(t)}},split(e,t,n,r){const i=e.expressions,a=[];if(i){let s=0;i.forEach(i=>{const o=t.slice(s,i.start-n),l=i.text;a.push(this.sanitise(e,o,r),ft(mt(l).trim())),s=i.end-n}),s<e.end&&a.push(this.sanitise(e,t.slice(s),r))}else a[0]=this.sanitise(e,t,r);e.parts=a.filter(e=>e)},sanitise(e,t,n){let r=e.unescape;if(r){let e=0;for(r="\\"+r;-1!==(e=t.indexOf(r,e));)t=t.slice(0,e)+t.slice(e+1),e++}return t=mt(t),n?t.replace(/\s+/g," "):ft(t)}});function gt(e,t){const n={type:1,name:"",start:0,end:0,nodes:[]};return Object.assign(Object.create(yt),{compact:!1!==t.compact,store:{last:n,stack:[],scryle:null,root:n,style:null,script:null,data:e}})}function bt(e,t){const n=ht(vt)(e,gt);return{parse:e=>function(e){const{data:t}=e;return xt(e),$e(e),e.count&&(e.count,e.pos),{data:t,output:e.builder.get()}}(n(e))}}function vt(e,t,n){const r=Object.assign({brackets:["{","}"],compact:!0,comments:!1},e);return{options:r,regexCache:{},pos:0,count:-1,root:null,last:null,scryle:null,builder:t(n,r),data:n}}function xt(e,t){const{data:n}=e,r=n.length;e.pos<r&&e.count&&xt(e,function(e,t){switch(t){case 1:return function(e){const{pos:t,data:n}=e,r=t-1,i=n.substring(t,t+2);switch(!0){case"!"===i[0]:return function(e,t,n){const r=n+2,i="--"===t.slice(r,r+2)?"--\x3e":">",a=t.indexOf(i,r);return function(e,t,n,r){e.pos=n,!0===e.options.comments&&($e(e),e.last={type:8,start:t,end:n,text:r})}(e,n,a+i.length,t.substring(n,a+i.length)),3}(e,n,r);case Pe.test(i):return function(e,t){const{data:n,pos:r}=e,i=we,a=Oe(i,r,n),s=i.lastIndex,o=a[1].toLowerCase();return o in Ie&&(e.scryle=o),dt(e,o,t,s),a[2]?3:2}(e,r);default:return Xe(e,r,t)}}(e);case 2:return function(e){const{data:t,last:n,pos:r,root:i}=e,a=n,s=/\S/g,o=Oe(s,r,t);switch(!0){case!o:e.pos=t.length;break;case">"===o[0]:return e.pos=a.end=s.lastIndex,a[ve]&&(e.scryle=null,i&&i.name===a.name&&e.count--),3;case"/"===o[0]:e.pos=s.lastIndex,a[ve]=!0;break;default:delete a[ve],function(e,t,n){const{data:r}=e,i=ut(e.options.brackets),a=Ae,s=a.lastIndex=i.lastIndex=t,o=a.exec(r),l=(u=o[1],p=e.options.brackets,u[0]===p[0]),c=l?[null,i.exec(r)[1],null]:o;var u,p;if(c){const t=function(e,t,n,r,i){const a={name:t[1],value:"",start:n,end:r},s=t[2];switch(!0){case(e=>Ce.test(e))(a.name):return function(e,t){const n=pt(e,t);return{[Te]:!0,start:t.start,expressions:t.expressions.map(e=>Object.assign(e,{text:e.text.replace(Ce,"").trim()})),end:n}}(e,a);case!0===i:return function(e,t){const n=pt(e,t);return{start:t.start,name:t.expressions[0].text.trim(),expressions:t.expressions,end:n}}(e,a);default:return function(e,t,n){const{data:r}=e;let{end:i}=t;var a;if(a=t.name,ct.test(a)&&(t[Se]=!0),n){let a=i;return'"'!==n&&"'"!==n&&(n="",a--),i=Qe(e,t,n||"[>/\\s]",a),Object.assign(t,{value:He(r,a,i),valueStart:a,end:n?++i:i})}return t}(e,a,s)}}(e,c,s,a.lastIndex,l);e.pos=n.end=t.end,n.attributes=function(e=[],t){return e.push(t),e}(n.attributes,t)}}(e,o.index,a)}return 2}(e);default:return function(e){const{pos:t,data:n,scryle:r}=e;switch(!0){case"string"==typeof r:{const i=r,a=Ie[i],s=Oe(a,t,n),o=s.index,l=a.lastIndex;e.scryle=null,o>t?function(e,t,n){const{pos:r}=e,i=n.index;t===ge?Qe(e,null,n[0],r):Xe(e,r,i)}(e,i,s):i!==ge&&(e.last.text={type:3,text:"",start:t,end:t}),dt(e,"/"+i,o,l);break}case"<"===n[t]:return e.pos++,1;default:Qe(e,null,"<",t)}return 3}(e)}}(e,t))}const St=_e,Et=ke,Tt="bindingTypes",_t="expressionTypes",kt="template",Pt="getComponent",wt="template",At="type",Ct="evaluate",It="name",Nt="attributes",Ot="if",Dt="each",Lt="key",jt="slot",Mt="name";St.IS_RAW;const Bt=St.IS_VOID,Ft=St.IS_CUSTOM,Vt=St.IS_BOOLEAN,Rt=St.IS_SPREAD;function Ut(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function qt(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){var n=!1;try{n=this instanceof e}catch{}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var zt={},Wt=function(e,t){return Wt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Wt(e,t)};function Gt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+t+" is not a constructor or null");function n(){this.constructor=e}Wt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Jt=function(){return Jt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Jt.apply(this,arguments)};function Kt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function $t(e,t,n,r){var i,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(s=(a<3?i(s):a>3?i(t,n,s):i(t,n))||s);return a>3&&s&&Object.defineProperty(t,n,s),s}function Ht(e,t){return function(n,r){t(n,r,e)}}function Xt(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function Qt(e,t,n,r){return new(n||(n=Promise))(function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}l((r=r.apply(e,t||[])).next())})}function Yt(e,t){var n,r,i,a,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(l){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}var Zt=Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function en(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||Zt(t,e,n)}function tn(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function nn(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return s}function rn(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(nn(arguments[t]));return e}function an(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var a=arguments[t],s=0,o=a.length;s<o;s++,i++)r[i]=a[s];return r}function sn(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function on(e){return this instanceof on?(this.v=e,this):new on(e)}function ln(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),a=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||o(e,t)})})}function o(e,t){try{(n=i[e](t)).value instanceof on?Promise.resolve(n.value.v).then(l,c):u(a[0][2],n)}catch(e){u(a[0][3],e)}var n}function l(e){o("next",e)}function c(e){o("throw",e)}function u(e,t){e(t),a.shift(),a.length&&o(a[0][0],a[0][1])}}function cn(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:on(e[r](t)),done:!1}:i?i(t):t}:i}}function un(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=tn(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){!function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}(r,i,(t=e[n](t)).done,t.value)})}}}function pn(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var hn=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function dn(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Zt(t,e,n);return hn(t,e),t}function fn(e){return e&&e.__esModule?e:{default:e}}function mn(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function yn(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}function gn(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 bn(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose]}if("function"!=typeof r)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var vn="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function xn(e){function t(t){e.error=e.hasError?new vn(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var r=e.stack.pop();try{var i=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(i).then(n,function(e){return t(e),n()})}catch(e){t(e)}}if(e.hasError)throw e.error}()}var Sn,En,Tn={__extends:Gt,__assign:Jt,__rest:Kt,__decorate:$t,__param:Ht,__metadata:Xt,__awaiter:Qt,__generator:Yt,__createBinding:Zt,__exportStar:en,__values:tn,__read:nn,__spread:rn,__spreadArrays:an,__spreadArray:sn,__await:on,__asyncGenerator:ln,__asyncDelegator:cn,__asyncValues:un,__makeTemplateObject:pn,__importStar:dn,__importDefault:fn,__classPrivateFieldGet:mn,__classPrivateFieldSet:yn,__classPrivateFieldIn:gn,__addDisposableResource:bn,__disposeResources:xn},_n=Object.freeze({__proto__:null,__addDisposableResource:bn,get __assign(){return Jt},__asyncDelegator:cn,__asyncGenerator:ln,__asyncValues:un,__await:on,__awaiter:Qt,__classPrivateFieldGet:mn,__classPrivateFieldIn:gn,__classPrivateFieldSet:yn,__createBinding:Zt,__decorate:$t,__disposeResources:xn,__esDecorate:function(e,t,n,r,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?r.static?e:e.prototype:null,p=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var f={};for(var m in r)f[m]="access"===m?{}:r[m];for(var m in r.access)f.access[m]=r.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var y=(0,n[d])("accessor"===l?{get:p.get,set:p.set}:p[c],f);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(o=s(y.get))&&(p.get=o),(o=s(y.set))&&(p.set=o),(o=s(y.init))&&i.unshift(o)}else(o=s(y))&&("field"===l?i.unshift(o):p[c]=o)}u&&Object.defineProperty(u,r.name,p),h=!0},__exportStar:en,__extends:Gt,__generator:Yt,__importDefault:fn,__importStar:dn,__makeTemplateObject:pn,__metadata:Xt,__param:Ht,__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:nn,__rest:Kt,__runInitializers:function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},__setFunctionName:function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})},__spread:rn,__spreadArray:sn,__spreadArrays:an,__values:tn,default:Tn}),kn=qt(_n),Pn={},wn={exports:{}},An={exports:{}},Cn={};function In(){if(Sn)return Cn;Sn=1,Object.defineProperty(Cn,"__esModule",{value:!0}),Cn.maybeSetModuleExports=void 0;var e=kn.__importDefault(Nn());return Cn.default=function(t){var n=t.use(e.default),r=n.Type,i=n.builtInTypes,a=i.number,s=r.or(i.string,i.number,i.boolean,i.null,i.undefined);return{geq:function(e){return r.from(function(t){return a.check(t)&&t>=e},a+" >= "+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:r.from(function(e){if(null===e)return!0;var t=typeof e;return"object"!==t&&"function"!==t},s.toString())}},Cn.maybeSetModuleExports=function(e){try{var t=e(),n=t.exports,r=n.default}catch(e){return}r&&r!==n&&"object"==typeof n&&(Object.assign(r,n,{default:r}),n.__esModule&&Object.defineProperty(r,"__esModule",{value:!0}),t.exports=r)},Cn}function Nn(){return En||(En=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Def=void 0;var n=kn,r=In(),i=Object.prototype,a=i.toString,s=i.hasOwnProperty,o=function(){function e(){}return e.prototype.assert=function(e,t){if(!this.check(e,t)){var n=m(e);throw Error(n+" does not match type "+this)}return!0},e.prototype.arrayOf=function(){return new l(this)},e}(),l=function(e){function t(t){var n=e.call(this)||this;return n.elemType=t,n.kind="ArrayType",n}return n.__extends(t,e),t.prototype.toString=function(){return"["+this.elemType+"]"},t.prototype.check=function(e,t){var n=this;return Array.isArray(e)&&e.every(function(e){return n.elemType.check(e,t)})},t}(o),c=function(e){function t(t){var n=e.call(this)||this;return n.value=t,n.kind="IdentityType",n}return n.__extends(t,e),t.prototype.toString=function(){return this.value+""},t.prototype.check=function(e,t){var n=e===this.value;return n||"function"!=typeof t||t(this,e),n},t}(o),u=function(e){function t(t){var n=e.call(this)||this;return n.fields=t,n.kind="ObjectType",n}return n.__extends(t,e),t.prototype.toString=function(){return"{ "+this.fields.join(", ")+" }"},t.prototype.check=function(e,t){return a.call(e)===a.call({})&&this.fields.every(function(n){return n.type.check(e[n.name],t)})},t}(o),p=function(e){function t(t){var n=e.call(this)||this;return n.types=t,n.kind="OrType",n}return n.__extends(t,e),t.prototype.toString=function(){return this.types.join(" | ")},t.prototype.check=function(e,t){return!!this.types.some(function(n){return n.check(e,!!t)})||("function"==typeof t&&t(this,e),!1)},t}(o),h=function(e){function t(t,n){var r=e.call(this)||this;return r.name=t,r.predicate=n,r.kind="PredicateType",r}return n.__extends(t,e),t.prototype.toString=function(){return this.name},t.prototype.check=function(e,t){var n=this.predicate(e,t);return n||"function"!=typeof t||t(this,e),n},t}(o),d=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 Error("");return s.call(t.allSupertypes,this.typeName)}throw Error(t+" is not a Def")},e.prototype.checkAllFields=function(e,t){var n=this.allFields;if(!0!==this.finalized)throw Error(""+this.typeName);return null!==e&&"object"==typeof e&&Object.keys(n).every(function(r){var i=n[r],a=i.type,s=i.getValue(e);return a.check(s,t)})},e.prototype.bases=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.baseNames;if(this.finalized){if(e.length!==n.length)throw Error("");for(var r=0;r<e.length;r++)if(e[r]!==n[r])throw Error("");return this}return e.forEach(function(e){n.indexOf(e)<0&&n.push(e)}),this},e}();t.Def=d;var f=function(){function e(e,t,n,r){this.name=e,this.type=t,this.defaultFn=n,this.hidden=!!r}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 m(e){return Array.isArray(e)?"["+e.map(m).join(", ")+"]":e&&"object"==typeof e?"{ "+Object.keys(e).map(function(t){return t+": "+e[t]}).join(", ")+" }":JSON.stringify(e)}t.default=function(e){var t={or:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new p(e.map(function(e){return t.from(e)}))},from:function(e,n){if(e instanceof l||e instanceof c||e instanceof u||e instanceof p||e instanceof h)return e;if(e instanceof d)return e.type;if(b.check(e)){if(1!==e.length)throw Error("only one element type is permitted for typed arrays");return new l(t.from(e[0]))}if(v.check(e))return new u(Object.keys(e).map(function(n){return new f(n,t.from(e[n],n))}));if("function"==typeof e){var a=r.indexOf(e);if(a>=0)return i[a];if("string"!=typeof n)throw Error("missing name");return new h(n,e)}return new c(e)},def:function(e){return s.call(A,e)?A[e]:A[e]=new I(e)},hasDef:function(e){return s.call(A,e)}},r=[],i=[];function o(e,t){var n=a.call(t),s=new h(e,function(e){return a.call(e)===n});return t&&"function"==typeof t.constructor&&(r.push(t.constructor),i.push(s)),s}var y=o("string","truthy"),g=o("function",function(){}),b=o("array",[]),v=o("object",{}),x=o("RegExp",/./),S=o("Date",new Date),E=o("number",3),T=o("boolean",!0),_=o("null",null),k=o("undefined",void 0),P="function"==typeof BigInt?o("BigInt",BigInt(1234)):new h("BigInt",function(){return!1}),w={string:y,function:g,array:b,object:v,RegExp:x,Date:S,number:E,boolean:T,null:_,undefined:k,BigInt:P},A=Object.create(null);function C(e){if(e&&"object"==typeof e){var t=e.type;if("string"==typeof t&&s.call(A,t)){var n=A[t];if(n.finalized)return n}}return null}var I=function(e){function r(t){var n=e.call(this,new h(t,function(e,t){return n.check(e,t)}),t)||this;return n}return n.__extends(r,e),r.prototype.check=function(e,t){if(!0!==this.finalized)throw Error("prematurely checking unfinalized type "+this.typeName);if(null===e||"object"!=typeof e)return!1;var n=C(e);return n?t&&n===this?this.checkAllFields(e,t):!!this.isSupertypeOf(n)&&(!t||n.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=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(this.buildParams=t,this.buildable)return this;this.field("type",String,function(){return e.typeName}),this.buildable=!0;var r=function(t,n,r,i){if(!s.call(t,n)){var a=e.allFields;if(!s.call(a,n))throw Error(""+n);var o,l=a[n],c=l.type;if(i)o=r;else{if(!l.defaultFn){var u="no value or default function given for field "+JSON.stringify(n)+" of "+e.typeName+"("+e.buildParams.map(function(e){return a[e]}).join(", ")+")";throw Error(u)}o=l.defaultFn.call(t)}if(!c.check(o))throw Error(m(o)+" does not match field "+l+" of type "+e.typeName);t[n]=o}},i=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t.length;if(!e.finalized)throw Error("attempting to instantiate unfinalized type "+e.typeName);var a=Object.create(O);if(e.buildParams.forEach(function(e,n){n<i?r(a,e,t[n],!0):r(a,e,null,!1)}),Object.keys(e.allFields).forEach(function(e){r(a,e,null,!1)}),a.type!==e.typeName)throw Error("");return a};return i.from=function(t){if(!e.finalized)throw Error("attempting to instantiate unfinalized type "+e.typeName);var n=Object.create(O);if(Object.keys(e.allFields).forEach(function(e){s.call(t,e)?r(n,e,t[e],!0):r(n,e,null,!1)}),n.type!==e.typeName)throw Error("");return n},Object.defineProperty(N,D(this.typeName),{enumerable:!0,value:i}),this},r.prototype.field=function(e,n,r,i){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 f(e,t.from(n),r,i),this)},r.prototype.finalize=function(){var e=this;if(!this.finalized){var t=this.allFields,n=this.allSupertypes;for(var r in this.baseNames.forEach(function(r){var i=A[r];if(!(i instanceof d)){var a="unknown supertype name "+JSON.stringify(r)+" for subtype "+JSON.stringify(e.typeName);throw Error(a)}i.finalize(),F(t,i.allFields),F(n,i.allSupertypes)}),F(t,this.ownFields),n[this.typeName]=this,this.fieldNames.length=0,t)s.call(t,r)&&!t[r].hidden&&this.fieldNames.push(r);Object.defineProperty(j,this.typeName,{enumerable:!0,value:this.type}),this.finalized=!0,function(e,t){t.length=0,t.push(e);for(var n=Object.create(null),r=0;r<t.length;++r){e=t[r];var i=A[e];if(!0!==i.finalized)throw Error("");s.call(n,e)&&delete t[n[e]],n[e]=r,t.push.apply(t,i.baseNames)}for(var a=0,o=a,l=t.length;o<l;++o)s.call(t,o)&&(t[a++]=t[o]);t.length=a}(this.typeName,this.supertypeList),this.buildable&&this.supertypeList.lastIndexOf("Expression")>=0&&function(e){var t=L(e);if(!N[t]){var n=N[D(e)];if(n){var r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return N.expressionStatement(n.apply(N,e))};r.from=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return N.expressionStatement(n.from.apply(N,e))},N[t]=r}}}(this.typeName)}},r}(d),N=Object.create(null),O={};function D(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 L(e){return(e=D(e)).replace(/(Expression)?$/,"Statement")}var j={};function M(e){var t=C(e);if(t)return t.fieldNames.slice(0);if("type"in e)throw Error("did not recognize object of type "+JSON.stringify(e.type));return Object.keys(e)}function B(e,t){var n=C(e);if(n){var r=n.allFields[t];if(r)return r.getValue(e)}return e&&e[t]}function F(e,t){return Object.keys(t).forEach(function(n){e[n]=t[n]}),e}return{Type:t,builtInTypes:w,getSupertypeNames:function(e){if(!s.call(A,e))throw Error("");var t=A[e];if(!0!==t.finalized)throw Error("");return t.supertypeList.slice(1)},computeSupertypeLookupTable:function(e){for(var t={},n=Object.keys(A),r=n.length,i=0;i<r;++i){var a=n[i],o=A[a];if(!0!==o.finalized)throw Error(""+a);for(var l=0;l<o.supertypeList.length;++l){var c=o.supertypeList[l];if(s.call(e,c)){t[a]=c;break}}}return t},builders:N,defineMethod:function(e,t){var n=O[e];return k.check(t)?delete O[e]:(g.assert(t),Object.defineProperty(O,e,{enumerable:!0,configurable:!0,value:t})),n},getBuilderName:D,getStatementBuilderName:L,namedTypes:j,getFieldNames:M,getFieldValue:B,eachField:function(e,t,n){M(e).forEach(function(n){t.call(this,n,B(e,n))},n)},someField:function(e,t,n){return M(e).some(function(n){return t.call(this,n,B(e,n))},n)},finalize:function(){Object.keys(A).forEach(function(e){A[e].finalize()})}}},(0,r.maybeSetModuleExports)(function(){return e})}(An,An.exports)),An.exports}var On,Dn={exports:{}},Ln={exports:{}},jn={exports:{}};function Mn(){return On||(On=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=kn,r=In(),i=n.__importDefault(Nn()),a=Object.prototype.hasOwnProperty;t.default=function(e){var t=e.use(i.default),n=t.builtInTypes.array,r=t.builtInTypes.number,s=function e(t,n,r){if(!(this instanceof e))throw Error("Path constructor cannot be invoked without 'new'");if(n){if(!(n instanceof e))throw Error("")}else n=null,r=null;this.value=t,this.parentPath=n,this.name=r,this.__childCache=null},o=s.prototype;function l(e){return e.__childCache||(e.__childCache=Object.create(null))}function c(e,t){var n=l(e),r=e.getValueProperty(t),i=n[t];return a.call(n,t)&&i.value===r||(i=n[t]=new e.constructor(r,e,t)),i}function u(){}function p(e,t,i,s){if(n.assert(e.value),0===t)return u;var o=e.value.length;if(o<1)return u;var c=arguments.length;2===c?(i=0,s=o):3===c?(i=Math.max(i,0),s=o):(i=Math.max(i,0),s=Math.min(s,o)),r.assert(i),r.assert(s);for(var p=Object.create(null),h=l(e),d=i;d<s;++d)if(a.call(e.value,d)){var f=e.get(d);if(f.name!==d)throw 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 n=p[t];if(n.name!==+t)throw Error("");h[t]=n,e.value[t]=n.value}}}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 n=this,r=e.length,i=0;i<r;++i)n=c(n,e[i]);return n},o.each=function(e,t){var n=[],r=this.value.length,i=0;for(i=0;i<r;++i)a.call(this.value,i)&&(n[i]=this.get(i));for(t=t||this,i=0;i<r;++i)a.call(n,i)&&e.call(t,n[i])},o.map=function(e,t){var n=[];return this.each(function(t){n.push(e.call(this,t))},t),n},o.filter=function(e,t){var n=[];return this.each(function(t){e.call(this,t)&&n.push(t)},t),n},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 n=p(this,e.length),r=this.value.unshift.apply(this.value,e);return n(),r},o.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.assert(this.value),delete l(this).length,this.value.push.apply(this.value,e)},o.pop=function(){n.assert(this.value);var e=l(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},o.insertAt=function(e){var t=arguments.length,n=p(this,t-1,e);if(n===u&&t<=1)return this;e=Math.max(e,0);for(var r=1;r<t;++r)this.value[e+r-1]=arguments[r];return n(),this},o.insertBefore=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=this.parentPath,r=e.length,i=[this.name],a=0;a<r;++a)i.push(e[a]);return n.insertAt.apply(n,i)},o.insertAfter=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=this.parentPath,r=e.length,i=[this.name+1],a=0;a<r;++a)i.push(e[a]);return n.insertAt.apply(n,i)},o.replace=function(e){var t=[],r=this.parentPath.value,i=l(this.parentPath),a=arguments.length;if(function(e){if(!(e instanceof s))throw Error("");var t=e.parentPath;if(!t)return e;var r=t.value,i=l(t);if(r[e.name]===e.value)i[e.name]=e;else if(n.check(r)){var a=r.indexOf(e.value);a>=0&&(i[e.name=a]=e)}else r[e.name]=e.value,i[e.name]=e;if(r[e.name]!==e.value)throw Error("");if(e.parentPath.get(e.name)!==e)throw Error("")}(this),n.check(r)){for(var o=r.length,c=p(this.parentPath,a-1,this.name+1),u=[this.name,1],h=0;h<a;++h)u.push(arguments[h]);if(r.splice.apply(r,u)[0]!==this.value)throw Error("");if(r.length!==o-1+a)throw Error("");if(c(),0===a)delete this.value,delete i[this.name],this.__childCache=null;else{if(r[this.name]!==e)throw Error("");for(this.value!==e&&(this.value=e,this.__childCache=null),h=0;h<a;++h)t.push(this.parentPath.get(this.name+h));if(t[0]!==this)throw Error("")}}else if(1===a)this.value!==e&&(this.__childCache=null),this.value=r[this.name]=e,t.push(this);else{if(0!==a)throw Error("Could not replace path");delete r[this.name],delete this.value,this.__childCache=null}return t},s},(0,r.maybeSetModuleExports)(function(){return e})}(jn,jn.exports)),jn.exports}var Bn,Fn,Vn,Rn={exports:{}};function Un(){return Fn||(Fn=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=kn,r=n.__importDefault(Nn()),i=n.__importDefault(Mn()),a=n.__importDefault((Bn||(Bn=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=kn,r=In(),i=n.__importDefault(Nn()),a=Object.prototype.hasOwnProperty;t.default=function(e){var t=e.use(i.default),n=t.Type,r=t.namedTypes,s=r.Node,o=r.Expression,l=t.builtInTypes.array,c=t.builders,u=function e(t,n){if(!(this instanceof e))throw Error("Scope constructor cannot be invoked without 'new'");var r;if(h.check(t.value)||p.assert(t.value),n){if(!(n instanceof e))throw Error("");r=n.depth+1}else n=null,r=0;Object.defineProperties(this,{path:{value:t},node:{value:t.value},isGlobal:{value:!n,enumerable:!0},depth:{value:r},parent:{value:n},bindings:{value:{}},types:{value:{}}})},p=n.or(r.Program,r.Function,r.CatchClause),h=n.or(r.Function,r.ClassDeclaration,r.ClassExpression,r.InterfaceDeclaration,r.TSInterfaceDeclaration,r.TypeAlias,r.TSTypeAliasDeclaration),d=n.or(r.TypeParameter,r.TSTypeParameter);u.isEstablishedBy=function(e){return p.check(e)||h.check(e)};var f=u.prototype;function m(e,n,i){var a=e.value;e.parent&&r.FunctionExpression.check(e.parent.node)&&e.parent.node.id&&g(e.parent.get("id"),n),a&&(l.check(a)?e.each(function(e){y(e,n,i)}):r.Function.check(a)?(e.get("params").each(function(e){g(e,n)}),y(e.get("body"),n,i),m(e.get("typeParameters"),n,i)):r.TypeAlias&&r.TypeAlias.check(a)||r.InterfaceDeclaration&&r.InterfaceDeclaration.check(a)||r.TSTypeAliasDeclaration&&r.TSTypeAliasDeclaration.check(a)||r.TSInterfaceDeclaration&&r.TSInterfaceDeclaration.check(a)?b(e.get("id"),i):r.VariableDeclarator.check(a)?(g(e.get("id"),n),y(e.get("init"),n,i)):"ImportSpecifier"===a.type||"ImportNamespaceSpecifier"===a.type||"ImportDefaultSpecifier"===a.type?g(e.get(a.local?"local":a.name?"name":"id"),n):s.check(a)&&!o.check(a)&&t.eachField(a,function(t,r){var a=e.get(t);if(!function(e,t){return e.value===t||!(!Array.isArray(e.value)||0!==e.value.length||!Array.isArray(t)||0!==t.length)}(a,r))throw Error("");y(a,n,i)}))}function y(e,t,n){var i=e.value;if(!i||o.check(i));else if(r.FunctionDeclaration.check(i)&&null!==i.id)g(e.get("id"),t);else if(r.ClassDeclaration&&r.ClassDeclaration.check(i)&&null!==i.id)g(e.get("id"),t),m(e.get("typeParameters"),t,n);else if(r.InterfaceDeclaration&&r.InterfaceDeclaration.check(i)||r.TSInterfaceDeclaration&&r.TSInterfaceDeclaration.check(i))b(e.get("id"),n);else if(p.check(i)){if(r.CatchClause.check(i)&&r.Identifier.check(i.param)){var s=i.param.name,l=a.call(t,s);m(e.get("body"),t,n),l||delete t[s]}}else m(e,t,n)}function g(e,t){var n=e.value;r.Pattern.assert(n),r.Identifier.check(n)?a.call(t,n.name)?t[n.name].push(e):t[n.name]=[e]:r.AssignmentPattern&&r.AssignmentPattern.check(n)?g(e.get("left"),t):r.ObjectPattern&&r.ObjectPattern.check(n)?e.get("properties").each(function(e){var n=e.value;r.Pattern.check(n)?g(e,t):r.Property.check(n)||r.ObjectProperty&&r.ObjectProperty.check(n)?g(e.get("value"),t):r.SpreadProperty&&r.SpreadProperty.check(n)&&g(e.get("argument"),t)}):r.ArrayPattern&&r.ArrayPattern.check(n)?e.get("elements").each(function(e){var n=e.value;r.Pattern.check(n)?g(e,t):r.SpreadElement&&r.SpreadElement.check(n)&&g(e.get("argument"),t)}):r.PropertyPattern&&r.PropertyPattern.check(n)?g(e.get("pattern"),t):(r.SpreadElementPattern&&r.SpreadElementPattern.check(n)||r.RestElement&&r.RestElement.check(n)||r.SpreadPropertyPattern&&r.SpreadPropertyPattern.check(n))&&g(e.get("argument"),t)}function b(e,t){var n=e.value;r.Pattern.assert(n),r.Identifier.check(n)&&(a.call(t,n.name)?t[n.name].push(e):t[n.name]=[e])}return f.didScan=!1,f.declares=function(e){return this.scan(),a.call(this.bindings,e)},f.declaresType=function(e){return this.scan(),a.call(this.types,e)},f.declareTemporary=function(e){if(e){if(!/^[a-z$_]/i.test(e))throw Error("")}else e="t$";e+=this.depth.toString(36)+"$",this.scan();for(var n=0;this.declares(e+n);)++n;var r=e+n;return this.bindings[r]=t.builders.identifier(r)},f.injectTemporary=function(e,t){e||(e=this.declareTemporary());var n=this.path.get("body");return r.BlockStatement.check(n.value)&&(n=n.get("body")),n.unshift(c.variableDeclaration("var",[c.variableDeclarator(e,t||null)])),e},f.scan=function(e){if(e||!this.didScan){for(var t in this.bindings)delete this.bindings[t];for(var t in this.types)delete this.types[t];!function(e,t,n){var i=e.value;if(h.check(i)){var s=e.get("typeParameters","params");l.check(s.value)&&s.each(function(e){!function(e,t){var n=e.value;d.assert(n),a.call(t,n.name)?t[n.name].push(e):t[n.name]=[e]}(e,n)})}p.check(i)&&(r.CatchClause.check(i)?g(e.get("param"),t):m(e,t,n))}(this.path,this.bindings,this.types),this.didScan=!0}},f.getBindings=function(){return this.scan(),this.bindings},f.getTypes=function(){return this.scan(),this.types},f.lookup=function(e){for(var t=this;t&&!t.declares(e);t=t.parent);return t},f.lookupType=function(e){for(var t=this;t&&!t.declaresType(e);t=t.parent);return t},f.getGlobalScope=function(){for(var e=this;!e.isGlobal;)e=e.parent;return e},u},(0,r.maybeSetModuleExports)(function(){return e})}(Rn,Rn.exports)),Rn.exports)),s=In();t.default=function(e){var t=e.use(r.default),n=t.namedTypes,s=t.builders,o=t.builtInTypes.number,l=t.builtInTypes.array,c=e.use(i.default),u=e.use(a.default),p=function e(t,n,r){if(!(this instanceof e))throw Error("NodePath constructor cannot be invoked without 'new'");c.call(this,t,n,r)},h=p.prototype=Object.create(c.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}});function d(e){return n.BinaryExpression.check(e)||n.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(n.VariableDeclaration.check(e.node)){var t=e.get("declarations").value;if(!t||0===t.length)return e.prune()}else if(n.ExpressionStatement.check(e.node)){if(!e.get("expression").value)return e.prune()}else n.IfStatement.check(e.node)&&function(e){var t=e.get("test").value,r=e.get("alternate").value,i=e.get("consequent").value;if(i||r){if(!i&&r){var a=s.unaryExpression("!",t,!0);n.UnaryExpression.check(t)&&"!"===t.operator&&(a=t.argument),e.get("test").replace(a),e.get("consequent").replace(r),e.get("alternate").replace()}}else{var o=s.expressionStatement(t);e.replace(o)}}(e);return e}(e)},h._computeNode=function(){var e=this.value;if(n.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(!n.Node.check(e)){for(;t&&!n.Node.check(t.value);)t=t.parentPath;t&&(t=t.parentPath)}for(;t&&!n.Node.check(t.value);)t=t.parentPath;return t||null},h._computeScope=function(){var e=this.value,t=this.parentPath,r=t&&t.scope;return n.Node.check(e)&&u.isEstablishedBy(e)&&(r=new u(this,r)),r||null},h.getValueProperty=function(e){return t.getFieldValue(this.value,e)},h.needsParens=function(e){var t=this.parentPath;if(!t)return!1;var r=this.value;if(!n.Expression.check(r))return!1;if("Identifier"===r.type)return!1;for(;!n.Node.check(t.value);)if(!(t=t.parentPath))return!1;var i=t.value;switch(r.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===i.type&&"object"===this.name&&i.object===r;case"BinaryExpression":case"LogicalExpression":switch(i.type){case"CallExpression":return"callee"===this.name&&i.callee===r;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===this.name&&i.object===r;case"BinaryExpression":case"LogicalExpression":var a=r,s=i.operator,l=f[s],c=a.operator,u=f[c];if(l>u)return!0;if(l===u&&"right"===this.name){if(i.right!==a)throw Error("Nodes must be equal");return!0}default:return!1}case"SequenceExpression":switch(i.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(i.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"===i.type&&o.check(r.value)&&"object"===this.name&&i.object===r;case"AssignmentExpression":case"ConditionalExpression":switch(i.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&i.callee===r;case"ConditionalExpression":return"test"===this.name&&i.test===r;case"MemberExpression":return"object"===this.name&&i.object===r;default:return!1}default:if("NewExpression"===i.type&&"callee"===this.name&&i.callee===r)return m(r)}return!(!0===e||this.canBeFirstInStatement()||!this.firstInStatement())};var f={};function m(e){return!!n.CallExpression.check(e)||(l.check(e)?e.some(m):!!n.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!n.FunctionExpression.check(e)&&!n.ObjectExpression.check(e)},h.firstInStatement=function(){return function(e){for(var t,r;e.parent;e=e.parent){if(t=e.node,r=e.parent.node,n.BlockStatement.check(r)&&"body"===e.parent.name&&0===e.name){if(r.body[0]!==t)throw Error("Nodes must be equal");return!0}if(n.ExpressionStatement.check(r)&&"expression"===e.name){if(r.expression!==t)throw Error("Nodes must be equal");return!0}if(n.SequenceExpression.check(r)&&"expressions"===e.parent.name&&0===e.name){if(r.expressions[0]!==t)throw Error("Nodes must be equal")}else if(n.CallExpression.check(r)&&"callee"===e.name){if(r.callee!==t)throw Error("Nodes must be equal")}else if(n.MemberExpression.check(r)&&"object"===e.name){if(r.object!==t)throw Error("Nodes must be equal")}else if(n.ConditionalExpression.check(r)&&"test"===e.name){if(r.test!==t)throw Error("Nodes must be equal"