1910 lines
1.1 MiB
JavaScript
1910 lines
1.1 MiB
JavaScript
|
(()=>{var e={9905:e=>{function webpackEmptyAsyncContext(e){return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");t.code="MODULE_NOT_FOUND";throw t}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=9905;e.exports=webpackEmptyAsyncContext},6143:function(e,t,r){(function(t,n){true?e.exports=n(r(4614)):0})(this,(function(e){"use strict";class OriginalSource{constructor(e,t){this.source=e;this.content=t}originalPositionFor(e,t,r){return{column:t,line:e,name:r,source:this.source,content:this.content}}}let t;class FastStringArray{constructor(){this.indexes=Object.create(null);this.array=[]}}(()=>{t=(e,t)=>{const{array:r,indexes:n}=e;let s=n[t];if(s===undefined){s=n[t]=r.length;r.push(t)}return s}})();const r=undefined;const n=null;let s;class SourceMapTree{constructor(e,t){this.map=e;this.sources=t}originalPositionFor(t,s,i){const a=e.traceSegment(this.map,t,s);if(a==null)return r;if(a.length===1)return n;const o=this.sources[a[1]];return o.originalPositionFor(a[2],a[3],a.length===5?this.map.names[a[4]]:i)}}(()=>{s=s=>{const i=[];const a=new FastStringArray;const o=new FastStringArray;const l=[];const{sources:c,map:u}=s;const p=u.names;const f=e.decodedMappings(u);let d=-1;for(let e=0;e<f.length;e++){const s=f[e];const u=[];let h=-1;let m=-1;let y=-1;for(let i=0;i<s.length;i++){const f=s[i];let g=n;if(f.length!==1){const e=c[f[1]];g=e.originalPositionFor(f[2],f[3],f.length===5?p[f[4]]:"");if(g===r)continue}const b=f[0];if(g===n){if(h===-1){continue}h=m=y=-1;u.push([b]);continue}const{column:T,line:S,name:E,content:x,source:v}=g;const P=t(o,v);l[P]=x;if(h===P&&m===S&&y===T){continue}d=e;h=P;m=S;y=T;u.push(E?[b,P,S,T,t(a,E)]:[b,P,S,T])}i.push(u)}if(i.length>d+1){i.length=d+1}return e.presortedDecodedMap(Object.assign({},s.map,{mappings:i,sourceRoot:undefined,names:a.array,sources:o.array,sourcesContent:l}))}})();function asArray(e){if(Array.isArray(e))return e;return[e]}function buildSourceMapTree(t,r){const n=asArray(t).map((t=>new e.TraceMap(t,"")));const s=n.pop();for(let e=0;e<n.length;e++){if(n[e].sources.length>1){throw new Error(`Transformation map ${e} must have exactly one source file.\n`+"Did you specify these with the most recent transformation maps first?")}}let i=build(s,r,"",0);for(let e=n.length-1;e>=0;e--){i=new SourceMapTree(n[e],[i])}return i}function build(t,r,n,s){const{resolvedSources:i,sourcesContent:a}=t;const o=s+1;const l=i.map(((t,s)=>{const i={importer:n,depth:o,source:t||"",content:undefined};const l=r(i.source,i);const{source:c,content:u}=i;if(!l){const e=u!==undefined?u:a?a[s]:null;return new OriginalSource(c,e)}return build(new e.TraceMap(l,c),r,c,o)}));return new SourceMapTree(t,l)}class SourceMap{constructor(t,r){this.version=3;this.file=t.file;this.mappings=r.decodedMappings?e.decodedMappings(t):e.encodedMappings(t);this.names=t.names;this.sourceRoot=t.sourceRoot;this.sources=t.sources;if(!r.excludeContent&&"sourcesContent"in t){this.sourcesContent=t.sourcesContent}}toString(){return JSON.stringify(this)}}function remapping(e,t,r){const n=typeof r==="object"?r:{excludeContent:!!r,decodedMappings:false};const i=buildSourceMapTree(e,t);return new SourceMap(s(i),n)}return remapping}))},5395:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.codeFrameColumns=codeFrameColumns;t["default"]=_default;var n=_interopRequireWildcard(r(9038));function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var e=new WeakMap;_getRequireWildcardCache=function(){return e};return e}function _interopRequireWildcard(e){if(e&&e.__esModule){return e}if(e===null||typeof e!=="object"&&typeof e!=="function"){return{default:e}}var t=_getRequireWildcardCache();if(t&&t.has(e)){return t.get(e)}var r={};var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e){if(Object.prototype.hasOwnProperty.call(e,s)){var i=n?Object.getOwnPropertyDescriptor(e,s):null;if(i&&(i.get||i.set)){Object.defineProperty(r,s,i)}else{r[s]=e[s]}}}r.default=e;if(t){t.set(e,r)}return r}let s
|
||
|
(function (root, factory) {
|
||
|
if (typeof define === "function" && define.amd) {
|
||
|
define(AMD_ARGUMENTS, factory);
|
||
|
} else if (typeof exports === "object") {
|
||
|
factory(COMMON_ARGUMENTS);
|
||
|
} else {
|
||
|
factory(BROWSER_ARGUMENTS);
|
||
|
}
|
||
|
})(UMD_ROOT, function (FACTORY_PARAMETERS) {
|
||
|
FACTORY_BODY
|
||
|
});
|
||
|
`(e);function buildGlobal(e){const t=m("babelHelpers");const r=[];const n=h(null,[m("global")],o(r));const s=b([d(l(n,[u(a("===",S("typeof",m("global")),T("undefined")),m("self"),m("global"))]))]);r.push(E("var",[x(t,i("=",y(m("global"),t),g([])))]));buildHelpers(r,t,e);return s}function buildModule(e){const t=[];const r=buildHelpers(t,null,e);t.unshift(p(null,Object.keys(r).map((e=>f(c(r[e]),m(e))))));return b(t,[],"module")}function buildUmd(e){const t=m("babelHelpers");const r=[];r.push(E("var",[x(t,m("global"))]));buildHelpers(r,t,e);return b([buildUmdWrapper({FACTORY_PARAMETERS:m("global"),BROWSER_ARGUMENTS:i("=",y(m("root"),t),g([])),COMMON_ARGUMENTS:m("exports"),AMD_ARGUMENTS:s([T("exports")]),FACTORY_BODY:r,UMD_ROOT:m("this")})])}function buildVar(e){const t=m("babelHelpers");const r=[];r.push(E("var",[x(t,g([]))]));const n=b(r);buildHelpers(r,t,e);r.push(d(t));return n}function buildHelpers(e,t,r){const getHelperReference=e=>t?y(t,m(e)):m(`_${e}`);const s={};helpers().list.forEach((function(t){if(r&&r.indexOf(t)<0)return;const i=s[t]=getHelperReference(t);helpers().ensure(t,n.default);const{nodes:a}=helpers().get(t,getHelperReference,i);e.push(...a)}));return s}function _default(e,t="global"){let r;const n={global:buildGlobal,module:buildModule,umd:buildUmd,var:buildVar}[t];if(n){r=n(e)}else{throw new Error(`Unsupported output type ${t}`)}return(0,_generator().default)(r).code}},1120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.transformFromAstSync=t.transformFromAstAsync=t.transformFromAst=void 0;function _gensync(){const e=r(6433);_gensync=function(){return e};return e}var n=r(4198);var s=r(7423);const i=_gensync()((function*(e,t,r){const i=yield*(0,n.default)(r);if(i===null)return null;if(!e)throw new Error("No AST given");return yield*(0,s.run)(i,t,e)}));const a=function transformFromAst(e,t,r,n){if(typeof r==="function"){n=r;r=undefined}if(n===undefined){return i.sync(e,t,r)}i.errback(e,t,r,n)};t.transformFromAst=a;const o=i.sync;t.transformFromAstSync=o;const l=i.async;t.transformFromAstAsync=l},8914:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.transformFileSync=t.transformFileAsync=t.transformFile=void 0;function _gensync(){const e=r(6433);_gensync=function(){return e};return e}var n=r(4198);var s=r(7423);var i=r(3575);({});const a=_gensync()((function*(e,t){const r=Object.assign({},t,{filename:e});const a=yield*(0,n.default)(r);if(a===null)return null;const o=yield*i.readFile(e,"utf8");return yield*(0,s.run)(a,o)}));const o=a.errback;t.transformFile=o;const l=a.sync;t.transformFileSync=l;const c=a.async;t.transformFileAsync=c},99:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.transformSync=t.transformAsync=t.transform=void 0;function _gensync(){const e=r(6433);_gensync=function(){return e};return e}var n=r(4198);var s=r(7423);const i=_gensync()((function*transform(e,t){const r=yield*(0,n.default)(t);if(r===null)return null;return yield*(0,s.run)(r,e)}));const a=function transform(e,t,r){if(typeof t==="function"){r=t;t=undefined}if(r===undefined)return i.sync(e,t);i.errback(e,t,r)};t.transform=a;const o=i.sync;t.transformSync=o;const l=i.async;t.transformAsync=l},1674:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=loadBlockHoistPlugin;function _traverse(){const e=r(7734);_traverse=function(){return e};return e}var n=r(5775);let s;function loadBlockHoistPlugin(){if(!s){s=new n.default(Object.assign({},i,{visitor:_traverse().default.explode(i.visitor)}),{})}return s}function priority(e){const t=e==null?void 0:e._blockHoist;if(t==null)return 1;if(t===true)return 2;return t}function stableSort(e){const t=Object.create(null);for(let r=0;r<e.length;r++){const n=e[r];const s=priority(n);const i=t[s]||(t[s]=[]);i.push(n)}const r=Object.keys(t).map((e=>+e)).sort(((e,t)=>t-e));let n=0;for(const s of r){const r=t[s];for(const t of r){e[n++]=t}}return e}const i={name:"internal.blockHoist",visitor:{Block:{exit({node:e}){const{body:t}=e;let r=Math.pow(2,30)-1;let n=false;for(let e=0;e<t.
|
||
|
Object.defineProperty(EXPORTS, "NAME", {
|
||
|
enumerable: true,
|
||
|
get: function() {
|
||
|
return NAMESPACE;
|
||
|
}
|
||
|
});
|
||
|
`:i.default.statement`EXPORTS.NAME = NAMESPACE;`)({EXPORTS:e.exportName,NAME:r,NAMESPACE:d(s)}))}if(t.reexportAll){const i=buildNamespaceReexport(e,d(s),r);i.loc=t.reexportAll.loc;n.push(i)}return n}const P={constant:i.default.statement`EXPORTS.EXPORT_NAME = NAMESPACE_IMPORT;`,constantComputed:i.default.statement`EXPORTS["EXPORT_NAME"] = NAMESPACE_IMPORT;`,spec:i.default.statement`
|
||
|
Object.defineProperty(EXPORTS, "EXPORT_NAME", {
|
||
|
enumerable: true,
|
||
|
get: function() {
|
||
|
return NAMESPACE_IMPORT;
|
||
|
},
|
||
|
});
|
||
|
`};const buildReexportsFromMeta=(e,t,r)=>{const n=t.lazy?f(g(t.name),[]):g(t.name);const{stringSpecifiers:s}=e;return Array.from(t.reexports,(([i,a])=>{let o=d(n);if(a==="default"&&t.interop==="node-default"){}else if(s.has(a)){o=T(o,S(a),true)}else{o=T(o,g(a))}const l={EXPORTS:e.exportName,EXPORT_NAME:i,NAMESPACE_IMPORT:o};if(r||b(o)){if(s.has(i)){return P.constantComputed(l)}else{return P.constant(l)}}else{return P.spec(l)}}))};function buildESModuleHeader(e,t=false){return(t?i.default.statement`
|
||
|
EXPORTS.__esModule = true;
|
||
|
`:i.default.statement`
|
||
|
Object.defineProperty(EXPORTS, "__esModule", {
|
||
|
value: true,
|
||
|
});
|
||
|
`)({EXPORTS:e.exportName})}function buildNamespaceReexport(e,t,r){return(r?i.default.statement`
|
||
|
Object.keys(NAMESPACE).forEach(function(key) {
|
||
|
if (key === "default" || key === "__esModule") return;
|
||
|
VERIFY_NAME_LIST;
|
||
|
if (key in EXPORTS && EXPORTS[key] === NAMESPACE[key]) return;
|
||
|
|
||
|
EXPORTS[key] = NAMESPACE[key];
|
||
|
});
|
||
|
`:i.default.statement`
|
||
|
Object.keys(NAMESPACE).forEach(function(key) {
|
||
|
if (key === "default" || key === "__esModule") return;
|
||
|
VERIFY_NAME_LIST;
|
||
|
if (key in EXPORTS && EXPORTS[key] === NAMESPACE[key]) return;
|
||
|
|
||
|
Object.defineProperty(EXPORTS, key, {
|
||
|
enumerable: true,
|
||
|
get: function() {
|
||
|
return NAMESPACE[key];
|
||
|
},
|
||
|
});
|
||
|
});
|
||
|
`)({NAMESPACE:t,EXPORTS:e.exportName,VERIFY_NAME_LIST:e.exportNameListName?(0,i.default)`
|
||
|
if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return;
|
||
|
`({EXPORTS_LIST:e.exportNameListName}):null})}function buildExportNameListDeclaration(e,t){const r=Object.create(null);for(const e of t.local.values()){for(const t of e.names){r[t]=true}}let n=false;for(const e of t.source.values()){for(const t of e.reexports.keys()){r[t]=true}for(const t of e.reexportNamespace){r[t]=true}n=n||!!e.reexportAll}if(!n||Object.keys(r).length===0)return null;const s=e.scope.generateUidIdentifier("exportNames");delete r.default;return{name:s.name,statement:x("var",[v(s,E(r))])}}function buildExportInitializationStatements(e,t,r=false,n=false){const s=[];for(const[e,r]of t.local){if(r.kind==="import"){}else if(r.kind==="hoisted"){s.push([r.names[0],buildInitStatement(t,r.names,g(e))])}else if(!n){for(const e of r.names){s.push([e,null])}}}for(const e of t.source.values()){if(!r){const r=buildReexportsFromMeta(t,e,false);const n=[...e.reexports.keys()];for(let e=0;e<r.length;e++){s.push([n[e],r[e]])}}if(!n){for(const t of e.reexportNamespace){s.push([t,null])}}}s.sort((([e],[t])=>{if(e<t)return-1;if(t<e)return 1;return 0}));const i=[];if(n){for(const[,e]of s){i.push(e)}}else{const r=100;for(let n=0;n<s.length;n+=r){let a=[];for(let o=0;o<r&&n+o<s.length;o++){const[r,l]=s[n+o];if(l!==null){if(a.length>0){i.push(buildInitStatement(t,a,e.scope.buildUndefinedNode()));a=[]}i.push(l)}else{a.push(r)}}if(a.length>0){i.push(buildInitStatement(t,a,e.scope.buildUndefinedNode()))}}}return i}const A={computed:i.default.expression`EXPORTS["NAME"] = VALUE`,default:i.default.expression`EXPORTS.NAME = VALUE`};function buildInitStatement(e,t,r){const{stringSpecifiers:n,exportName:s}=e;return y(t.reduce(((e,t)=>{const r={EXPORTS:s,NAME:t,VALUE:e};if(n.has(t)){return A.computed(r)}else{return A.default(r)}}),r))}},6943:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=normalizeModuleAndLoadMetadata;t.hasExports=hasExports;t.isSideEffectImport=isSideEffectImport;t.validateImportInteropOption=validateImportInteropOption;var n=r(1017);var s=r(7239);var i=r(1705);function hasExports(e){return e.hasExports}function isSideEffectImport(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function validateImportInteropOption(e){if(typeof e!=="function"&&e!=="none"&&e!=="babel"&&e!=="node"){throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`)}return e}function resolveImportInterop(e,t,r){if(typeof e==="function"){return validateImportInteropOption(e(t,r))}return e}function normalizeModuleAndLoadMetadata(e,t,{importInterop:r,initializeReexports:n=false,lazy:s=false,esNamespaceOnly:i=false,filename:a}){if(!t){t=e.scope.generateUidIdentifier("exports").name}const o=new Set;nameAnonymousExports(e);const{local:l,source:c,hasExports:u}=getModuleMetadata(e,{initializeReexports:n,lazy:s},o);removeModuleDeclarations(e);for(const[,e]of c){if(e.importsNamespace.size>0){e.name=e.importsNamespace.values().next().value}const t=resolveImportInterop(r,e.source,a);if(t==="none"){e.interop="none"}else if(t==="node"&&e.interop==="namespace"){e.interop="node-namespace"}else if(t==="node"&&e.interop==="default"){e.interop="node-default"}else if(i&&e.interop==="namespace"){e.interop="default"}}return{exportName:t,exportNameListName:null,hasExports:u,local:l,source:c,stringSpecifiers:o}}function getExportSpecifierName(e,t){if(e.isIdentifier()){return e.node.name}else if(e.isStringLiteral()){const r=e.node.value;if(!(0,s.isIdentifierName)(r)){t.add(r)}return r}else{throw new Error(`Expected export specifier to be either Identifier or StringLiteral, got ${e.node.type}`)}}function assertExportSpecifier(e){if(e.isExportSpecifier()){return}else if(e.isExportNamespaceSpecifier()){throw e.buildCodeFrameError("Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.")}else{throw e.buildCodeFrameError("Unexpected export specifier type")}}function getModuleMetadata(e,{lazy:t,initializeReexports:r},s){const i=getLocalEx
|
||
|
(function() {
|
||
|
throw new Error('"' + '${e}' + '" is read-only.');
|
||
|
})()
|
||
|
`;const P={ReferencedIdentifier(e){const{seen:t,buildImportReference:r,scope:n,imported:s,requeueInParent:i}=this;if(t.has(e.node))return;t.add(e.node);const a=e.node.name;const o=s.get(a);if(o){if(isInType(e)){throw e.buildCodeFrameError(`Cannot transform the imported binding "${a}" since it's also used in a type annotation. `+`Please strip type annotations using @babel/preset-typescript or @babel/preset-flow.`)}const t=e.scope.getBinding(a);const s=n.getBinding(a);if(s!==t)return;const l=r(o,e.node);l.loc=e.node.loc;if((e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&d(l)){e.replaceWith(T([b(0),l]))}else if(e.isJSXIdentifier()&&d(l)){const{object:t,property:r}=l;e.replaceWith(y(m(t.name),m(r.name)))}else{e.replaceWith(l)}i(e);e.skip()}},UpdateExpression(e){const{scope:t,seen:r,imported:n,exported:s,requeueInParent:i,buildImportReference:a}=this;if(r.has(e.node))return;r.add(e.node);const l=e.get("argument");if(l.isMemberExpression())return;const u=e.node;if(l.isIdentifier()){const r=l.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const i=s.get(r);const p=n.get(r);if((i==null?void 0:i.length)>0||p){if(p){e.replaceWith(o(u.operator[0]+"=",a(p,l.node),buildImportThrow(r)))}else if(u.prefix){e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,i,c(u)))}else{const n=t.generateDeclaredUidIdentifier(r);e.replaceWith(T([o("=",c(n),c(u)),buildBindingExportAssignmentExpression(this.metadata,i,f(r)),c(n)]))}}}i(e);e.skip()},AssignmentExpression:{exit(e){const{scope:t,seen:r,imported:s,exported:i,requeueInParent:a,buildImportReference:o}=this;if(r.has(e.node))return;r.add(e.node);const l=e.get("left");if(l.isMemberExpression())return;if(l.isIdentifier()){const r=l.node.name;if(t.getBinding(r)!==e.scope.getBinding(r)){return}const c=i.get(r);const u=s.get(r);if((c==null?void 0:c.length)>0||u){n(e.node.operator==="=","Path was not simplified");const t=e.node;if(u){t.left=o(u,t.left);t.right=T([t.right,buildImportThrow(r)])}e.replaceWith(buildBindingExportAssignmentExpression(this.metadata,c,t));a(e)}}else{const r=l.getOuterBindingIdentifiers();const n=Object.keys(r).filter((r=>t.getBinding(r)===e.scope.getBinding(r)));const o=n.find((e=>s.has(e)));if(o){e.node.right=T([e.node.right,buildImportThrow(o)])}const c=[];n.forEach((e=>{const t=i.get(e)||[];if(t.length>0){c.push(buildBindingExportAssignmentExpression(this.metadata,t,f(e)))}}));if(c.length>0){let t=T(c);if(e.parentPath.isExpressionStatement()){t=u(t);t._blockHoist=e.parentPath.node._blockHoist}const r=e.insertAfter(t)[0];a(r)}}}},"ForOfStatement|ForInStatement"(e){const{scope:t,node:r}=e;const{left:n}=r;const{exported:s,imported:i,scope:a}=this;if(!h(n)){let r=false,l;const f=e.get("body").scope;for(const e of Object.keys(p(n))){if(a.getBinding(e)===t.getBinding(e)){if(s.has(e)){r=true;if(f.hasOwnBinding(e)){f.rename(e)}}if(i.has(e)&&!l){l=e}}}if(!r&&!l){return}e.ensureBlock();const d=e.get("body");const h=t.generateUidIdentifierBasedOnNode(n);e.get("left").replaceWith(E("let",[x(c(h))]));t.registerDeclaration(e.get("left"));if(r){d.unshiftContainer("body",u(o("=",n,h)))}if(l){d.unshiftContainer("body",u(buildImportThrow(l)))}}}}},9094:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=rewriteThis;var n=r(5166);var s=r(7734);var i=r(6953);const{numericLiteral:a,unaryExpression:o}=i;function rewriteThis(e){(0,s.default)(e.node,Object.assign({},l,{noScope:true}))}const l=s.default.visitors.merge([n.default,{ThisExpression(e){e.replaceWith(o("void",a(0),true))}}])},7798:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=simplifyAccess;var n=r(6953);const{LOGICAL_OPERATORS:s,assignmentExpression:i,binaryExpression:a,cloneNode:o,identifier:l,logicalExpression:c,numericLiteral:u,sequenceExpression:p,unaryExpression:f}=n;function simplifyAccess(e,t,r=true){e.traverse(d,{scope:e.scope,bindingNames:t,seen:new WeakSet,includeUpdateExpression:r})}const d={UpdateExpression:{
|
||
|
export default function _AwaitValue(value) {
|
||
|
this.wrapped = value;
|
||
|
}
|
||
|
`;i.AsyncGenerator=helper("7.0.0-beta.0")`
|
||
|
import AwaitValue from "AwaitValue";
|
||
|
|
||
|
export default function AsyncGenerator(gen) {
|
||
|
var front, back;
|
||
|
|
||
|
function send(key, arg) {
|
||
|
return new Promise(function (resolve, reject) {
|
||
|
var request = {
|
||
|
key: key,
|
||
|
arg: arg,
|
||
|
resolve: resolve,
|
||
|
reject: reject,
|
||
|
next: null,
|
||
|
};
|
||
|
|
||
|
if (back) {
|
||
|
back = back.next = request;
|
||
|
} else {
|
||
|
front = back = request;
|
||
|
resume(key, arg);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function resume(key, arg) {
|
||
|
try {
|
||
|
var result = gen[key](arg)
|
||
|
var value = result.value;
|
||
|
var wrappedAwait = value instanceof AwaitValue;
|
||
|
|
||
|
Promise.resolve(wrappedAwait ? value.wrapped : value).then(
|
||
|
function (arg) {
|
||
|
if (wrappedAwait) {
|
||
|
resume(key === "return" ? "return" : "next", arg);
|
||
|
return
|
||
|
}
|
||
|
|
||
|
settle(result.done ? "return" : "normal", arg);
|
||
|
},
|
||
|
function (err) { resume("throw", err); });
|
||
|
} catch (err) {
|
||
|
settle("throw", err);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function settle(type, value) {
|
||
|
switch (type) {
|
||
|
case "return":
|
||
|
front.resolve({ value: value, done: true });
|
||
|
break;
|
||
|
case "throw":
|
||
|
front.reject(value);
|
||
|
break;
|
||
|
default:
|
||
|
front.resolve({ value: value, done: false });
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
front = front.next;
|
||
|
if (front) {
|
||
|
resume(front.key, front.arg);
|
||
|
} else {
|
||
|
back = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
this._invoke = send;
|
||
|
|
||
|
// Hide "return" method if generator return is not supported
|
||
|
if (typeof gen.return !== "function") {
|
||
|
this.return = undefined;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
AsyncGenerator.prototype[typeof Symbol === "function" && Symbol.asyncIterator || "@@asyncIterator"] = function () { return this; };
|
||
|
|
||
|
AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); };
|
||
|
AsyncGenerator.prototype.throw = function (arg) { return this._invoke("throw", arg); };
|
||
|
AsyncGenerator.prototype.return = function (arg) { return this._invoke("return", arg); };
|
||
|
`;i.wrapAsyncGenerator=helper("7.0.0-beta.0")`
|
||
|
import AsyncGenerator from "AsyncGenerator";
|
||
|
|
||
|
export default function _wrapAsyncGenerator(fn) {
|
||
|
return function () {
|
||
|
return new AsyncGenerator(fn.apply(this, arguments));
|
||
|
};
|
||
|
}
|
||
|
`;i.awaitAsyncGenerator=helper("7.0.0-beta.0")`
|
||
|
import AwaitValue from "AwaitValue";
|
||
|
|
||
|
export default function _awaitAsyncGenerator(value) {
|
||
|
return new AwaitValue(value);
|
||
|
}
|
||
|
`;i.asyncGeneratorDelegate=helper("7.0.0-beta.0")`
|
||
|
export default function _asyncGeneratorDelegate(inner, awaitWrap) {
|
||
|
var iter = {}, waiting = false;
|
||
|
|
||
|
function pump(key, value) {
|
||
|
waiting = true;
|
||
|
value = new Promise(function (resolve) { resolve(inner[key](value)); });
|
||
|
return { done: false, value: awaitWrap(value) };
|
||
|
};
|
||
|
|
||
|
iter[typeof Symbol !== "undefined" && Symbol.iterator || "@@iterator"] = function () { return this; };
|
||
|
|
||
|
iter.next = function (value) {
|
||
|
if (waiting) {
|
||
|
waiting = false;
|
||
|
return value;
|
||
|
}
|
||
|
return pump("next", value);
|
||
|
};
|
||
|
|
||
|
if (typeof inner.throw === "function") {
|
||
|
iter.throw = function (value) {
|
||
|
if (waiting) {
|
||
|
waiting = false;
|
||
|
throw value;
|
||
|
}
|
||
|
return pump("throw", value);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
if (typeof inner.return === "function") {
|
||
|
iter.return = function (value) {
|
||
|
if (waiting) {
|
||
|
waiting = false;
|
||
|
return value;
|
||
|
}
|
||
|
return pump("return", value);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
return iter;
|
||
|
}
|
||
|
`;i.asyncToGenerator=helper("7.0.0-beta.0")`
|
||
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||
|
try {
|
||
|
var info = gen[key](arg);
|
||
|
var value = info.value;
|
||
|
} catch (error) {
|
||
|
reject(error);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (info.done) {
|
||
|
resolve(value);
|
||
|
} else {
|
||
|
Promise.resolve(value).then(_next, _throw);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default function _asyncToGenerator(fn) {
|
||
|
return function () {
|
||
|
var self = this, args = arguments;
|
||
|
return new Promise(function (resolve, reject) {
|
||
|
var gen = fn.apply(self, args);
|
||
|
function _next(value) {
|
||
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
||
|
}
|
||
|
function _throw(err) {
|
||
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
||
|
}
|
||
|
|
||
|
_next(undefined);
|
||
|
});
|
||
|
};
|
||
|
}
|
||
|
`;i.classCallCheck=helper("7.0.0-beta.0")`
|
||
|
export default function _classCallCheck(instance, Constructor) {
|
||
|
if (!(instance instanceof Constructor)) {
|
||
|
throw new TypeError("Cannot call a class as a function");
|
||
|
}
|
||
|
}
|
||
|
`;i.createClass=helper("7.0.0-beta.0")`
|
||
|
function _defineProperties(target, props) {
|
||
|
for (var i = 0; i < props.length; i ++) {
|
||
|
var descriptor = props[i];
|
||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||
|
descriptor.configurable = true;
|
||
|
if ("value" in descriptor) descriptor.writable = true;
|
||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default function _createClass(Constructor, protoProps, staticProps) {
|
||
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
||
|
Object.defineProperty(Constructor, "prototype", { writable: false });
|
||
|
return Constructor;
|
||
|
}
|
||
|
`;i.defineEnumerableProperties=helper("7.0.0-beta.0")`
|
||
|
export default function _defineEnumerableProperties(obj, descs) {
|
||
|
for (var key in descs) {
|
||
|
var desc = descs[key];
|
||
|
desc.configurable = desc.enumerable = true;
|
||
|
if ("value" in desc) desc.writable = true;
|
||
|
Object.defineProperty(obj, key, desc);
|
||
|
}
|
||
|
|
||
|
// Symbols are not enumerated over by for-in loops. If native
|
||
|
// Symbols are available, fetch all of the descs object's own
|
||
|
// symbol properties and define them on our target object too.
|
||
|
if (Object.getOwnPropertySymbols) {
|
||
|
var objectSymbols = Object.getOwnPropertySymbols(descs);
|
||
|
for (var i = 0; i < objectSymbols.length; i++) {
|
||
|
var sym = objectSymbols[i];
|
||
|
var desc = descs[sym];
|
||
|
desc.configurable = desc.enumerable = true;
|
||
|
if ("value" in desc) desc.writable = true;
|
||
|
Object.defineProperty(obj, sym, desc);
|
||
|
}
|
||
|
}
|
||
|
return obj;
|
||
|
}
|
||
|
`;i.defaults=helper("7.0.0-beta.0")`
|
||
|
export default function _defaults(obj, defaults) {
|
||
|
var keys = Object.getOwnPropertyNames(defaults);
|
||
|
for (var i = 0; i < keys.length; i++) {
|
||
|
var key = keys[i];
|
||
|
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
||
|
if (value && value.configurable && obj[key] === undefined) {
|
||
|
Object.defineProperty(obj, key, value);
|
||
|
}
|
||
|
}
|
||
|
return obj;
|
||
|
}
|
||
|
`;i.defineProperty=helper("7.0.0-beta.0")`
|
||
|
export default function _defineProperty(obj, key, value) {
|
||
|
// Shortcircuit the slow defineProperty path when possible.
|
||
|
// We are trying to avoid issues where setters defined on the
|
||
|
// prototype cause side effects under the fast path of simple
|
||
|
// assignment. By checking for existence of the property with
|
||
|
// the in operator, we can optimize most of this overhead away.
|
||
|
if (key in obj) {
|
||
|
Object.defineProperty(obj, key, {
|
||
|
value: value,
|
||
|
enumerable: true,
|
||
|
configurable: true,
|
||
|
writable: true
|
||
|
});
|
||
|
} else {
|
||
|
obj[key] = value;
|
||
|
}
|
||
|
return obj;
|
||
|
}
|
||
|
`;i.extends=helper("7.0.0-beta.0")`
|
||
|
export default function _extends() {
|
||
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
||
|
for (var i = 1; i < arguments.length; i++) {
|
||
|
var source = arguments[i];
|
||
|
for (var key in source) {
|
||
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||
|
target[key] = source[key];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return target;
|
||
|
};
|
||
|
|
||
|
return _extends.apply(this, arguments);
|
||
|
}
|
||
|
`;i.objectSpread=helper("7.0.0-beta.0")`
|
||
|
import defineProperty from "defineProperty";
|
||
|
|
||
|
export default function _objectSpread(target) {
|
||
|
for (var i = 1; i < arguments.length; i++) {
|
||
|
var source = (arguments[i] != null) ? Object(arguments[i]) : {};
|
||
|
var ownKeys = Object.keys(source);
|
||
|
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||
|
ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||
|
}));
|
||
|
}
|
||
|
ownKeys.forEach(function(key) {
|
||
|
defineProperty(target, key, source[key]);
|
||
|
});
|
||
|
}
|
||
|
return target;
|
||
|
}
|
||
|
`;i.inherits=helper("7.0.0-beta.0")`
|
||
|
import setPrototypeOf from "setPrototypeOf";
|
||
|
|
||
|
export default function _inherits(subClass, superClass) {
|
||
|
if (typeof superClass !== "function" && superClass !== null) {
|
||
|
throw new TypeError("Super expression must either be null or a function");
|
||
|
}
|
||
|
// We can't use defineProperty to set the prototype in a single step because it
|
||
|
// doesn't work in Chrome <= 36. https://github.com/babel/babel/issues/14056
|
||
|
// V8 bug: https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
||
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||
|
constructor: {
|
||
|
value: subClass,
|
||
|
writable: true,
|
||
|
configurable: true
|
||
|
}
|
||
|
});
|
||
|
Object.defineProperty(subClass, "prototype", { writable: false });
|
||
|
if (superClass) setPrototypeOf(subClass, superClass);
|
||
|
}
|
||
|
`;i.inheritsLoose=helper("7.0.0-beta.0")`
|
||
|
import setPrototypeOf from "setPrototypeOf";
|
||
|
|
||
|
export default function _inheritsLoose(subClass, superClass) {
|
||
|
subClass.prototype = Object.create(superClass.prototype);
|
||
|
subClass.prototype.constructor = subClass;
|
||
|
setPrototypeOf(subClass, superClass);
|
||
|
}
|
||
|
`;i.getPrototypeOf=helper("7.0.0-beta.0")`
|
||
|
export default function _getPrototypeOf(o) {
|
||
|
_getPrototypeOf = Object.setPrototypeOf
|
||
|
? Object.getPrototypeOf.bind()
|
||
|
: function _getPrototypeOf(o) {
|
||
|
return o.__proto__ || Object.getPrototypeOf(o);
|
||
|
};
|
||
|
return _getPrototypeOf(o);
|
||
|
}
|
||
|
`;i.setPrototypeOf=helper("7.0.0-beta.0")`
|
||
|
export default function _setPrototypeOf(o, p) {
|
||
|
_setPrototypeOf = Object.setPrototypeOf
|
||
|
? Object.setPrototypeOf.bind()
|
||
|
: function _setPrototypeOf(o, p) {
|
||
|
o.__proto__ = p;
|
||
|
return o;
|
||
|
};
|
||
|
return _setPrototypeOf(o, p);
|
||
|
}
|
||
|
`;i.isNativeReflectConstruct=helper("7.9.0")`
|
||
|
export default function _isNativeReflectConstruct() {
|
||
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
||
|
|
||
|
// core-js@3
|
||
|
if (Reflect.construct.sham) return false;
|
||
|
|
||
|
// Proxy can't be polyfilled. Every browser implemented
|
||
|
// proxies before or at the same time as Reflect.construct,
|
||
|
// so if they support Proxy they also support Reflect.construct.
|
||
|
if (typeof Proxy === "function") return true;
|
||
|
|
||
|
// Since Reflect.construct can't be properly polyfilled, some
|
||
|
// implementations (e.g. core-js@2) don't set the correct internal slots.
|
||
|
// Those polyfills don't allow us to subclass built-ins, so we need to
|
||
|
// use our fallback implementation.
|
||
|
try {
|
||
|
// If the internal slots aren't set, this throws an error similar to
|
||
|
// TypeError: this is not a Boolean object.
|
||
|
|
||
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
||
|
return true;
|
||
|
} catch (e) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
`;i.construct=helper("7.0.0-beta.0")`
|
||
|
import setPrototypeOf from "setPrototypeOf";
|
||
|
import isNativeReflectConstruct from "isNativeReflectConstruct";
|
||
|
|
||
|
export default function _construct(Parent, args, Class) {
|
||
|
if (isNativeReflectConstruct()) {
|
||
|
_construct = Reflect.construct.bind();
|
||
|
} else {
|
||
|
// NOTE: If Parent !== Class, the correct __proto__ is set *after*
|
||
|
// calling the constructor.
|
||
|
_construct = function _construct(Parent, args, Class) {
|
||
|
var a = [null];
|
||
|
a.push.apply(a, args);
|
||
|
var Constructor = Function.bind.apply(Parent, a);
|
||
|
var instance = new Constructor();
|
||
|
if (Class) setPrototypeOf(instance, Class.prototype);
|
||
|
return instance;
|
||
|
};
|
||
|
}
|
||
|
// Avoid issues with Class being present but undefined when it wasn't
|
||
|
// present in the original call.
|
||
|
return _construct.apply(null, arguments);
|
||
|
}
|
||
|
`;i.isNativeFunction=helper("7.0.0-beta.0")`
|
||
|
export default function _isNativeFunction(fn) {
|
||
|
// Note: This function returns "true" for core-js functions.
|
||
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
||
|
}
|
||
|
`;i.wrapNativeSuper=helper("7.0.0-beta.0")`
|
||
|
import getPrototypeOf from "getPrototypeOf";
|
||
|
import setPrototypeOf from "setPrototypeOf";
|
||
|
import isNativeFunction from "isNativeFunction";
|
||
|
import construct from "construct";
|
||
|
|
||
|
export default function _wrapNativeSuper(Class) {
|
||
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||
|
|
||
|
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
||
|
if (Class === null || !isNativeFunction(Class)) return Class;
|
||
|
if (typeof Class !== "function") {
|
||
|
throw new TypeError("Super expression must either be null or a function");
|
||
|
}
|
||
|
if (typeof _cache !== "undefined") {
|
||
|
if (_cache.has(Class)) return _cache.get(Class);
|
||
|
_cache.set(Class, Wrapper);
|
||
|
}
|
||
|
function Wrapper() {
|
||
|
return construct(Class, arguments, getPrototypeOf(this).constructor)
|
||
|
}
|
||
|
Wrapper.prototype = Object.create(Class.prototype, {
|
||
|
constructor: {
|
||
|
value: Wrapper,
|
||
|
enumerable: false,
|
||
|
writable: true,
|
||
|
configurable: true,
|
||
|
}
|
||
|
});
|
||
|
|
||
|
return setPrototypeOf(Wrapper, Class);
|
||
|
}
|
||
|
|
||
|
return _wrapNativeSuper(Class)
|
||
|
}
|
||
|
`;i.instanceof=helper("7.0.0-beta.0")`
|
||
|
export default function _instanceof(left, right) {
|
||
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
||
|
return !!right[Symbol.hasInstance](left);
|
||
|
} else {
|
||
|
return left instanceof right;
|
||
|
}
|
||
|
}
|
||
|
`;i.interopRequireDefault=helper("7.0.0-beta.0")`
|
||
|
export default function _interopRequireDefault(obj) {
|
||
|
return obj && obj.__esModule ? obj : { default: obj };
|
||
|
}
|
||
|
`;i.interopRequireWildcard=helper("7.14.0")`
|
||
|
function _getRequireWildcardCache(nodeInterop) {
|
||
|
if (typeof WeakMap !== "function") return null;
|
||
|
|
||
|
var cacheBabelInterop = new WeakMap();
|
||
|
var cacheNodeInterop = new WeakMap();
|
||
|
return (_getRequireWildcardCache = function (nodeInterop) {
|
||
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||
|
})(nodeInterop);
|
||
|
}
|
||
|
|
||
|
export default function _interopRequireWildcard(obj, nodeInterop) {
|
||
|
if (!nodeInterop && obj && obj.__esModule) {
|
||
|
return obj;
|
||
|
}
|
||
|
|
||
|
if (obj === null || (typeof obj !== "object" && typeof obj !== "function")) {
|
||
|
return { default: obj }
|
||
|
}
|
||
|
|
||
|
var cache = _getRequireWildcardCache(nodeInterop);
|
||
|
if (cache && cache.has(obj)) {
|
||
|
return cache.get(obj);
|
||
|
}
|
||
|
|
||
|
var newObj = {};
|
||
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||
|
for (var key in obj) {
|
||
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||
|
var desc = hasPropertyDescriptor
|
||
|
? Object.getOwnPropertyDescriptor(obj, key)
|
||
|
: null;
|
||
|
if (desc && (desc.get || desc.set)) {
|
||
|
Object.defineProperty(newObj, key, desc);
|
||
|
} else {
|
||
|
newObj[key] = obj[key];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
newObj.default = obj;
|
||
|
if (cache) {
|
||
|
cache.set(obj, newObj);
|
||
|
}
|
||
|
return newObj;
|
||
|
}
|
||
|
`;i.newArrowCheck=helper("7.0.0-beta.0")`
|
||
|
export default function _newArrowCheck(innerThis, boundThis) {
|
||
|
if (innerThis !== boundThis) {
|
||
|
throw new TypeError("Cannot instantiate an arrow function");
|
||
|
}
|
||
|
}
|
||
|
`;i.objectDestructuringEmpty=helper("7.0.0-beta.0")`
|
||
|
export default function _objectDestructuringEmpty(obj) {
|
||
|
if (obj == null) throw new TypeError("Cannot destructure undefined");
|
||
|
}
|
||
|
`;i.objectWithoutPropertiesLoose=helper("7.0.0-beta.0")`
|
||
|
export default function _objectWithoutPropertiesLoose(source, excluded) {
|
||
|
if (source == null) return {};
|
||
|
|
||
|
var target = {};
|
||
|
var sourceKeys = Object.keys(source);
|
||
|
var key, i;
|
||
|
|
||
|
for (i = 0; i < sourceKeys.length; i++) {
|
||
|
key = sourceKeys[i];
|
||
|
if (excluded.indexOf(key) >= 0) continue;
|
||
|
target[key] = source[key];
|
||
|
}
|
||
|
|
||
|
return target;
|
||
|
}
|
||
|
`;i.objectWithoutProperties=helper("7.0.0-beta.0")`
|
||
|
import objectWithoutPropertiesLoose from "objectWithoutPropertiesLoose";
|
||
|
|
||
|
export default function _objectWithoutProperties(source, excluded) {
|
||
|
if (source == null) return {};
|
||
|
|
||
|
var target = objectWithoutPropertiesLoose(source, excluded);
|
||
|
var key, i;
|
||
|
|
||
|
if (Object.getOwnPropertySymbols) {
|
||
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
||
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
||
|
key = sourceSymbolKeys[i];
|
||
|
if (excluded.indexOf(key) >= 0) continue;
|
||
|
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
||
|
target[key] = source[key];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return target;
|
||
|
}
|
||
|
`;i.assertThisInitialized=helper("7.0.0-beta.0")`
|
||
|
export default function _assertThisInitialized(self) {
|
||
|
if (self === void 0) {
|
||
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
`;i.possibleConstructorReturn=helper("7.0.0-beta.0")`
|
||
|
import assertThisInitialized from "assertThisInitialized";
|
||
|
|
||
|
export default function _possibleConstructorReturn(self, call) {
|
||
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
||
|
return call;
|
||
|
} else if (call !== void 0) {
|
||
|
throw new TypeError("Derived constructors may only return object or undefined");
|
||
|
}
|
||
|
|
||
|
return assertThisInitialized(self);
|
||
|
}
|
||
|
`;i.createSuper=helper("7.9.0")`
|
||
|
import getPrototypeOf from "getPrototypeOf";
|
||
|
import isNativeReflectConstruct from "isNativeReflectConstruct";
|
||
|
import possibleConstructorReturn from "possibleConstructorReturn";
|
||
|
|
||
|
export default function _createSuper(Derived) {
|
||
|
var hasNativeReflectConstruct = isNativeReflectConstruct();
|
||
|
|
||
|
return function _createSuperInternal() {
|
||
|
var Super = getPrototypeOf(Derived), result;
|
||
|
if (hasNativeReflectConstruct) {
|
||
|
// NOTE: This doesn't work if this.__proto__.constructor has been modified.
|
||
|
var NewTarget = getPrototypeOf(this).constructor;
|
||
|
result = Reflect.construct(Super, arguments, NewTarget);
|
||
|
} else {
|
||
|
result = Super.apply(this, arguments);
|
||
|
}
|
||
|
return possibleConstructorReturn(this, result);
|
||
|
}
|
||
|
}
|
||
|
`;i.superPropBase=helper("7.0.0-beta.0")`
|
||
|
import getPrototypeOf from "getPrototypeOf";
|
||
|
|
||
|
export default function _superPropBase(object, property) {
|
||
|
// Yes, this throws if object is null to being with, that's on purpose.
|
||
|
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
||
|
object = getPrototypeOf(object);
|
||
|
if (object === null) break;
|
||
|
}
|
||
|
return object;
|
||
|
}
|
||
|
`;i.get=helper("7.0.0-beta.0")`
|
||
|
import superPropBase from "superPropBase";
|
||
|
|
||
|
export default function _get() {
|
||
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
||
|
_get = Reflect.get.bind();
|
||
|
} else {
|
||
|
_get = function _get(target, property, receiver) {
|
||
|
var base = superPropBase(target, property);
|
||
|
|
||
|
if (!base) return;
|
||
|
|
||
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
||
|
if (desc.get) {
|
||
|
// STEP 3. If receiver is not present, then set receiver to target.
|
||
|
return desc.get.call(arguments.length < 3 ? target : receiver);
|
||
|
}
|
||
|
|
||
|
return desc.value;
|
||
|
};
|
||
|
}
|
||
|
return _get.apply(this, arguments);
|
||
|
}
|
||
|
`;i.set=helper("7.0.0-beta.0")`
|
||
|
import superPropBase from "superPropBase";
|
||
|
import defineProperty from "defineProperty";
|
||
|
|
||
|
function set(target, property, value, receiver) {
|
||
|
if (typeof Reflect !== "undefined" && Reflect.set) {
|
||
|
set = Reflect.set;
|
||
|
} else {
|
||
|
set = function set(target, property, value, receiver) {
|
||
|
var base = superPropBase(target, property);
|
||
|
var desc;
|
||
|
|
||
|
if (base) {
|
||
|
desc = Object.getOwnPropertyDescriptor(base, property);
|
||
|
if (desc.set) {
|
||
|
desc.set.call(receiver, value);
|
||
|
return true;
|
||
|
} else if (!desc.writable) {
|
||
|
// Both getter and non-writable fall into this.
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Without a super that defines the property, spec boils down to
|
||
|
// "define on receiver" for some reason.
|
||
|
desc = Object.getOwnPropertyDescriptor(receiver, property);
|
||
|
if (desc) {
|
||
|
if (!desc.writable) {
|
||
|
// Setter, getter, and non-writable fall into this.
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
desc.value = value;
|
||
|
Object.defineProperty(receiver, property, desc);
|
||
|
} else {
|
||
|
// Avoid setters that may be defined on Sub's prototype, but not on
|
||
|
// the instance.
|
||
|
defineProperty(receiver, property, value);
|
||
|
}
|
||
|
|
||
|
return true;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
return set(target, property, value, receiver);
|
||
|
}
|
||
|
|
||
|
export default function _set(target, property, value, receiver, isStrict) {
|
||
|
var s = set(target, property, value, receiver || target);
|
||
|
if (!s && isStrict) {
|
||
|
throw new Error('failed to set property');
|
||
|
}
|
||
|
|
||
|
return value;
|
||
|
}
|
||
|
`;i.taggedTemplateLiteral=helper("7.0.0-beta.0")`
|
||
|
export default function _taggedTemplateLiteral(strings, raw) {
|
||
|
if (!raw) { raw = strings.slice(0); }
|
||
|
return Object.freeze(Object.defineProperties(strings, {
|
||
|
raw: { value: Object.freeze(raw) }
|
||
|
}));
|
||
|
}
|
||
|
`;i.taggedTemplateLiteralLoose=helper("7.0.0-beta.0")`
|
||
|
export default function _taggedTemplateLiteralLoose(strings, raw) {
|
||
|
if (!raw) { raw = strings.slice(0); }
|
||
|
strings.raw = raw;
|
||
|
return strings;
|
||
|
}
|
||
|
`;i.readOnlyError=helper("7.0.0-beta.0")`
|
||
|
export default function _readOnlyError(name) {
|
||
|
throw new TypeError("\\"" + name + "\\" is read-only");
|
||
|
}
|
||
|
`;i.writeOnlyError=helper("7.12.13")`
|
||
|
export default function _writeOnlyError(name) {
|
||
|
throw new TypeError("\\"" + name + "\\" is write-only");
|
||
|
}
|
||
|
`;i.classNameTDZError=helper("7.0.0-beta.0")`
|
||
|
export default function _classNameTDZError(name) {
|
||
|
throw new Error("Class \\"" + name + "\\" cannot be referenced in computed property keys.");
|
||
|
}
|
||
|
`;i.temporalUndefined=helper("7.0.0-beta.0")`
|
||
|
// This function isn't mean to be called, but to be used as a reference.
|
||
|
// We can't use a normal object because it isn't hoisted.
|
||
|
export default function _temporalUndefined() {}
|
||
|
`;i.tdz=helper("7.5.5")`
|
||
|
export default function _tdzError(name) {
|
||
|
throw new ReferenceError(name + " is not defined - temporal dead zone");
|
||
|
}
|
||
|
`;i.temporalRef=helper("7.0.0-beta.0")`
|
||
|
import undef from "temporalUndefined";
|
||
|
import err from "tdz";
|
||
|
|
||
|
export default function _temporalRef(val, name) {
|
||
|
return val === undef ? err(name) : val;
|
||
|
}
|
||
|
`;i.slicedToArray=helper("7.0.0-beta.0")`
|
||
|
import arrayWithHoles from "arrayWithHoles";
|
||
|
import iterableToArrayLimit from "iterableToArrayLimit";
|
||
|
import unsupportedIterableToArray from "unsupportedIterableToArray";
|
||
|
import nonIterableRest from "nonIterableRest";
|
||
|
|
||
|
export default function _slicedToArray(arr, i) {
|
||
|
return (
|
||
|
arrayWithHoles(arr) ||
|
||
|
iterableToArrayLimit(arr, i) ||
|
||
|
unsupportedIterableToArray(arr, i) ||
|
||
|
nonIterableRest()
|
||
|
);
|
||
|
}
|
||
|
`;i.slicedToArrayLoose=helper("7.0.0-beta.0")`
|
||
|
import arrayWithHoles from "arrayWithHoles";
|
||
|
import iterableToArrayLimitLoose from "iterableToArrayLimitLoose";
|
||
|
import unsupportedIterableToArray from "unsupportedIterableToArray";
|
||
|
import nonIterableRest from "nonIterableRest";
|
||
|
|
||
|
export default function _slicedToArrayLoose(arr, i) {
|
||
|
return (
|
||
|
arrayWithHoles(arr) ||
|
||
|
iterableToArrayLimitLoose(arr, i) ||
|
||
|
unsupportedIterableToArray(arr, i) ||
|
||
|
nonIterableRest()
|
||
|
);
|
||
|
}
|
||
|
`;i.toArray=helper("7.0.0-beta.0")`
|
||
|
import arrayWithHoles from "arrayWithHoles";
|
||
|
import iterableToArray from "iterableToArray";
|
||
|
import unsupportedIterableToArray from "unsupportedIterableToArray";
|
||
|
import nonIterableRest from "nonIterableRest";
|
||
|
|
||
|
export default function _toArray(arr) {
|
||
|
return (
|
||
|
arrayWithHoles(arr) ||
|
||
|
iterableToArray(arr) ||
|
||
|
unsupportedIterableToArray(arr) ||
|
||
|
nonIterableRest()
|
||
|
);
|
||
|
}
|
||
|
`;i.toConsumableArray=helper("7.0.0-beta.0")`
|
||
|
import arrayWithoutHoles from "arrayWithoutHoles";
|
||
|
import iterableToArray from "iterableToArray";
|
||
|
import unsupportedIterableToArray from "unsupportedIterableToArray";
|
||
|
import nonIterableSpread from "nonIterableSpread";
|
||
|
|
||
|
export default function _toConsumableArray(arr) {
|
||
|
return (
|
||
|
arrayWithoutHoles(arr) ||
|
||
|
iterableToArray(arr) ||
|
||
|
unsupportedIterableToArray(arr) ||
|
||
|
nonIterableSpread()
|
||
|
);
|
||
|
}
|
||
|
`;i.arrayWithoutHoles=helper("7.0.0-beta.0")`
|
||
|
import arrayLikeToArray from "arrayLikeToArray";
|
||
|
|
||
|
export default function _arrayWithoutHoles(arr) {
|
||
|
if (Array.isArray(arr)) return arrayLikeToArray(arr);
|
||
|
}
|
||
|
`;i.arrayWithHoles=helper("7.0.0-beta.0")`
|
||
|
export default function _arrayWithHoles(arr) {
|
||
|
if (Array.isArray(arr)) return arr;
|
||
|
}
|
||
|
`;i.maybeArrayLike=helper("7.9.0")`
|
||
|
import arrayLikeToArray from "arrayLikeToArray";
|
||
|
|
||
|
export default function _maybeArrayLike(next, arr, i) {
|
||
|
if (arr && !Array.isArray(arr) && typeof arr.length === "number") {
|
||
|
var len = arr.length;
|
||
|
return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len);
|
||
|
}
|
||
|
return next(arr, i);
|
||
|
}
|
||
|
`;i.iterableToArray=helper("7.0.0-beta.0")`
|
||
|
export default function _iterableToArray(iter) {
|
||
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
||
|
}
|
||
|
`;i.iterableToArrayLimit=helper("7.0.0-beta.0")`
|
||
|
export default function _iterableToArrayLimit(arr, i) {
|
||
|
// this is an expanded form of \`for...of\` that properly supports abrupt completions of
|
||
|
// iterators etc. variable names have been minimised to reduce the size of this massive
|
||
|
// helper. sometimes spec compliance is annoying :(
|
||
|
//
|
||
|
// _n = _iteratorNormalCompletion
|
||
|
// _d = _didIteratorError
|
||
|
// _e = _iteratorError
|
||
|
// _i = _iterator
|
||
|
// _s = _step
|
||
|
|
||
|
var _i = arr == null ? null : (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
|
||
|
if (_i == null) return;
|
||
|
|
||
|
var _arr = [];
|
||
|
var _n = true;
|
||
|
var _d = false;
|
||
|
var _s, _e;
|
||
|
try {
|
||
|
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
||
|
_arr.push(_s.value);
|
||
|
if (i && _arr.length === i) break;
|
||
|
}
|
||
|
} catch (err) {
|
||
|
_d = true;
|
||
|
_e = err;
|
||
|
} finally {
|
||
|
try {
|
||
|
if (!_n && _i["return"] != null) _i["return"]();
|
||
|
} finally {
|
||
|
if (_d) throw _e;
|
||
|
}
|
||
|
}
|
||
|
return _arr;
|
||
|
}
|
||
|
`;i.iterableToArrayLimitLoose=helper("7.0.0-beta.0")`
|
||
|
export default function _iterableToArrayLimitLoose(arr, i) {
|
||
|
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
|
||
|
if (_i == null) return;
|
||
|
|
||
|
var _arr = [];
|
||
|
for (_i = _i.call(arr), _step; !(_step = _i.next()).done;) {
|
||
|
_arr.push(_step.value);
|
||
|
if (i && _arr.length === i) break;
|
||
|
}
|
||
|
return _arr;
|
||
|
}
|
||
|
`;i.unsupportedIterableToArray=helper("7.9.0")`
|
||
|
import arrayLikeToArray from "arrayLikeToArray";
|
||
|
|
||
|
export default function _unsupportedIterableToArray(o, minLen) {
|
||
|
if (!o) return;
|
||
|
if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
||
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
||
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
||
|
if (n === "Map" || n === "Set") return Array.from(o);
|
||
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
||
|
return arrayLikeToArray(o, minLen);
|
||
|
}
|
||
|
`;i.arrayLikeToArray=helper("7.9.0")`
|
||
|
export default function _arrayLikeToArray(arr, len) {
|
||
|
if (len == null || len > arr.length) len = arr.length;
|
||
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
||
|
return arr2;
|
||
|
}
|
||
|
`;i.nonIterableSpread=helper("7.0.0-beta.0")`
|
||
|
export default function _nonIterableSpread() {
|
||
|
throw new TypeError(
|
||
|
"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
|
||
|
);
|
||
|
}
|
||
|
`;i.nonIterableRest=helper("7.0.0-beta.0")`
|
||
|
export default function _nonIterableRest() {
|
||
|
throw new TypeError(
|
||
|
"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
|
||
|
);
|
||
|
}
|
||
|
`;i.createForOfIteratorHelper=helper("7.9.0")`
|
||
|
import unsupportedIterableToArray from "unsupportedIterableToArray";
|
||
|
|
||
|
// s: start (create the iterator)
|
||
|
// n: next
|
||
|
// e: error (called whenever something throws)
|
||
|
// f: finish (always called at the end)
|
||
|
|
||
|
export default function _createForOfIteratorHelper(o, allowArrayLike) {
|
||
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
||
|
|
||
|
if (!it) {
|
||
|
// Fallback for engines without symbol support
|
||
|
if (
|
||
|
Array.isArray(o) ||
|
||
|
(it = unsupportedIterableToArray(o)) ||
|
||
|
(allowArrayLike && o && typeof o.length === "number")
|
||
|
) {
|
||
|
if (it) o = it;
|
||
|
var i = 0;
|
||
|
var F = function(){};
|
||
|
return {
|
||
|
s: F,
|
||
|
n: function() {
|
||
|
if (i >= o.length) return { done: true };
|
||
|
return { done: false, value: o[i++] };
|
||
|
},
|
||
|
e: function(e) { throw e; },
|
||
|
f: F,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||
|
}
|
||
|
|
||
|
var normalCompletion = true, didErr = false, err;
|
||
|
|
||
|
return {
|
||
|
s: function() {
|
||
|
it = it.call(o);
|
||
|
},
|
||
|
n: function() {
|
||
|
var step = it.next();
|
||
|
normalCompletion = step.done;
|
||
|
return step;
|
||
|
},
|
||
|
e: function(e) {
|
||
|
didErr = true;
|
||
|
err = e;
|
||
|
},
|
||
|
f: function() {
|
||
|
try {
|
||
|
if (!normalCompletion && it.return != null) it.return();
|
||
|
} finally {
|
||
|
if (didErr) throw err;
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
`;i.createForOfIteratorHelperLoose=helper("7.9.0")`
|
||
|
import unsupportedIterableToArray from "unsupportedIterableToArray";
|
||
|
|
||
|
export default function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
||
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
||
|
|
||
|
if (it) return (it = it.call(o)).next.bind(it);
|
||
|
|
||
|
// Fallback for engines without symbol support
|
||
|
if (
|
||
|
Array.isArray(o) ||
|
||
|
(it = unsupportedIterableToArray(o)) ||
|
||
|
(allowArrayLike && o && typeof o.length === "number")
|
||
|
) {
|
||
|
if (it) o = it;
|
||
|
var i = 0;
|
||
|
return function() {
|
||
|
if (i >= o.length) return { done: true };
|
||
|
return { done: false, value: o[i++] };
|
||
|
}
|
||
|
}
|
||
|
|
||
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||
|
}
|
||
|
`;i.skipFirstGeneratorNext=helper("7.0.0-beta.0")`
|
||
|
export default function _skipFirstGeneratorNext(fn) {
|
||
|
return function () {
|
||
|
var it = fn.apply(this, arguments);
|
||
|
it.next();
|
||
|
return it;
|
||
|
}
|
||
|
}
|
||
|
`;i.toPrimitive=helper("7.1.5")`
|
||
|
export default function _toPrimitive(
|
||
|
input,
|
||
|
hint /*: "default" | "string" | "number" | void */
|
||
|
) {
|
||
|
if (typeof input !== "object" || input === null) return input;
|
||
|
var prim = input[Symbol.toPrimitive];
|
||
|
if (prim !== undefined) {
|
||
|
var res = prim.call(input, hint || "default");
|
||
|
if (typeof res !== "object") return res;
|
||
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
||
|
}
|
||
|
return (hint === "string" ? String : Number)(input);
|
||
|
}
|
||
|
`;i.toPropertyKey=helper("7.1.5")`
|
||
|
import toPrimitive from "toPrimitive";
|
||
|
|
||
|
export default function _toPropertyKey(arg) {
|
||
|
var key = toPrimitive(arg, "string");
|
||
|
return typeof key === "symbol" ? key : String(key);
|
||
|
}
|
||
|
`;i.initializerWarningHelper=helper("7.0.0-beta.0")`
|
||
|
export default function _initializerWarningHelper(descriptor, context){
|
||
|
throw new Error(
|
||
|
'Decorating class property failed. Please ensure that ' +
|
||
|
'proposal-class-properties is enabled and runs after the decorators transform.'
|
||
|
);
|
||
|
}
|
||
|
`;i.initializerDefineProperty=helper("7.0.0-beta.0")`
|
||
|
export default function _initializerDefineProperty(target, property, descriptor, context){
|
||
|
if (!descriptor) return;
|
||
|
|
||
|
Object.defineProperty(target, property, {
|
||
|
enumerable: descriptor.enumerable,
|
||
|
configurable: descriptor.configurable,
|
||
|
writable: descriptor.writable,
|
||
|
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0,
|
||
|
});
|
||
|
}
|
||
|
`;i.applyDecoratedDescriptor=helper("7.0.0-beta.0")`
|
||
|
export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context){
|
||
|
var desc = {};
|
||
|
Object.keys(descriptor).forEach(function(key){
|
||
|
desc[key] = descriptor[key];
|
||
|
});
|
||
|
desc.enumerable = !!desc.enumerable;
|
||
|
desc.configurable = !!desc.configurable;
|
||
|
if ('value' in desc || desc.initializer){
|
||
|
desc.writable = true;
|
||
|
}
|
||
|
|
||
|
desc = decorators.slice().reverse().reduce(function(desc, decorator){
|
||
|
return decorator(target, property, desc) || desc;
|
||
|
}, desc);
|
||
|
|
||
|
if (context && desc.initializer !== void 0){
|
||
|
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
||
|
desc.initializer = undefined;
|
||
|
}
|
||
|
|
||
|
if (desc.initializer === void 0){
|
||
|
Object.defineProperty(target, property, desc);
|
||
|
desc = null;
|
||
|
}
|
||
|
|
||
|
return desc;
|
||
|
}
|
||
|
`;i.classPrivateFieldLooseKey=helper("7.0.0-beta.0")`
|
||
|
var id = 0;
|
||
|
export default function _classPrivateFieldKey(name) {
|
||
|
return "__private_" + (id++) + "_" + name;
|
||
|
}
|
||
|
`;i.classPrivateFieldLooseBase=helper("7.0.0-beta.0")`
|
||
|
export default function _classPrivateFieldBase(receiver, privateKey) {
|
||
|
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
|
||
|
throw new TypeError("attempted to use private field on non-instance");
|
||
|
}
|
||
|
return receiver;
|
||
|
}
|
||
|
`;i.classPrivateFieldGet=helper("7.0.0-beta.0")`
|
||
|
import classApplyDescriptorGet from "classApplyDescriptorGet";
|
||
|
import classExtractFieldDescriptor from "classExtractFieldDescriptor";
|
||
|
export default function _classPrivateFieldGet(receiver, privateMap) {
|
||
|
var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get");
|
||
|
return classApplyDescriptorGet(receiver, descriptor);
|
||
|
}
|
||
|
`;i.classPrivateFieldSet=helper("7.0.0-beta.0")`
|
||
|
import classApplyDescriptorSet from "classApplyDescriptorSet";
|
||
|
import classExtractFieldDescriptor from "classExtractFieldDescriptor";
|
||
|
export default function _classPrivateFieldSet(receiver, privateMap, value) {
|
||
|
var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set");
|
||
|
classApplyDescriptorSet(receiver, descriptor, value);
|
||
|
return value;
|
||
|
}
|
||
|
`;i.classPrivateFieldDestructureSet=helper("7.4.4")`
|
||
|
import classApplyDescriptorDestructureSet from "classApplyDescriptorDestructureSet";
|
||
|
import classExtractFieldDescriptor from "classExtractFieldDescriptor";
|
||
|
export default function _classPrivateFieldDestructureSet(receiver, privateMap) {
|
||
|
var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set");
|
||
|
return classApplyDescriptorDestructureSet(receiver, descriptor);
|
||
|
}
|
||
|
`;i.classExtractFieldDescriptor=helper("7.13.10")`
|
||
|
export default function _classExtractFieldDescriptor(receiver, privateMap, action) {
|
||
|
if (!privateMap.has(receiver)) {
|
||
|
throw new TypeError("attempted to " + action + " private field on non-instance");
|
||
|
}
|
||
|
return privateMap.get(receiver);
|
||
|
}
|
||
|
`;i.classStaticPrivateFieldSpecGet=helper("7.0.2")`
|
||
|
import classApplyDescriptorGet from "classApplyDescriptorGet";
|
||
|
import classCheckPrivateStaticAccess from "classCheckPrivateStaticAccess";
|
||
|
import classCheckPrivateStaticFieldDescriptor from "classCheckPrivateStaticFieldDescriptor";
|
||
|
export default function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
|
||
|
classCheckPrivateStaticAccess(receiver, classConstructor);
|
||
|
classCheckPrivateStaticFieldDescriptor(descriptor, "get");
|
||
|
return classApplyDescriptorGet(receiver, descriptor);
|
||
|
}
|
||
|
`;i.classStaticPrivateFieldSpecSet=helper("7.0.2")`
|
||
|
import classApplyDescriptorSet from "classApplyDescriptorSet";
|
||
|
import classCheckPrivateStaticAccess from "classCheckPrivateStaticAccess";
|
||
|
import classCheckPrivateStaticFieldDescriptor from "classCheckPrivateStaticFieldDescriptor";
|
||
|
export default function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) {
|
||
|
classCheckPrivateStaticAccess(receiver, classConstructor);
|
||
|
classCheckPrivateStaticFieldDescriptor(descriptor, "set");
|
||
|
classApplyDescriptorSet(receiver, descriptor, value);
|
||
|
return value;
|
||
|
}
|
||
|
`;i.classStaticPrivateMethodGet=helper("7.3.2")`
|
||
|
import classCheckPrivateStaticAccess from "classCheckPrivateStaticAccess";
|
||
|
export default function _classStaticPrivateMethodGet(receiver, classConstructor, method) {
|
||
|
classCheckPrivateStaticAccess(receiver, classConstructor);
|
||
|
return method;
|
||
|
}
|
||
|
`;i.classStaticPrivateMethodSet=helper("7.3.2")`
|
||
|
export default function _classStaticPrivateMethodSet() {
|
||
|
throw new TypeError("attempted to set read only static private field");
|
||
|
}
|
||
|
`;i.classApplyDescriptorGet=helper("7.13.10")`
|
||
|
export default function _classApplyDescriptorGet(receiver, descriptor) {
|
||
|
if (descriptor.get) {
|
||
|
return descriptor.get.call(receiver);
|
||
|
}
|
||
|
return descriptor.value;
|
||
|
}
|
||
|
`;i.classApplyDescriptorSet=helper("7.13.10")`
|
||
|
export default function _classApplyDescriptorSet(receiver, descriptor, value) {
|
||
|
if (descriptor.set) {
|
||
|
descriptor.set.call(receiver, value);
|
||
|
} else {
|
||
|
if (!descriptor.writable) {
|
||
|
// This should only throw in strict mode, but class bodies are
|
||
|
// always strict and private fields can only be used inside
|
||
|
// class bodies.
|
||
|
throw new TypeError("attempted to set read only private field");
|
||
|
}
|
||
|
descriptor.value = value;
|
||
|
}
|
||
|
}
|
||
|
`;i.classApplyDescriptorDestructureSet=helper("7.13.10")`
|
||
|
export default function _classApplyDescriptorDestructureSet(receiver, descriptor) {
|
||
|
if (descriptor.set) {
|
||
|
if (!("__destrObj" in descriptor)) {
|
||
|
descriptor.__destrObj = {
|
||
|
set value(v) {
|
||
|
descriptor.set.call(receiver, v)
|
||
|
},
|
||
|
};
|
||
|
}
|
||
|
return descriptor.__destrObj;
|
||
|
} else {
|
||
|
if (!descriptor.writable) {
|
||
|
// This should only throw in strict mode, but class bodies are
|
||
|
// always strict and private fields can only be used inside
|
||
|
// class bodies.
|
||
|
throw new TypeError("attempted to set read only private field");
|
||
|
}
|
||
|
|
||
|
return descriptor;
|
||
|
}
|
||
|
}
|
||
|
`;i.classStaticPrivateFieldDestructureSet=helper("7.13.10")`
|
||
|
import classApplyDescriptorDestructureSet from "classApplyDescriptorDestructureSet";
|
||
|
import classCheckPrivateStaticAccess from "classCheckPrivateStaticAccess";
|
||
|
import classCheckPrivateStaticFieldDescriptor from "classCheckPrivateStaticFieldDescriptor";
|
||
|
export default function _classStaticPrivateFieldDestructureSet(receiver, classConstructor, descriptor) {
|
||
|
classCheckPrivateStaticAccess(receiver, classConstructor);
|
||
|
classCheckPrivateStaticFieldDescriptor(descriptor, "set");
|
||
|
return classApplyDescriptorDestructureSet(receiver, descriptor);
|
||
|
}
|
||
|
`;i.classCheckPrivateStaticAccess=helper("7.13.10")`
|
||
|
export default function _classCheckPrivateStaticAccess(receiver, classConstructor) {
|
||
|
if (receiver !== classConstructor) {
|
||
|
throw new TypeError("Private static access of wrong provenance");
|
||
|
}
|
||
|
}
|
||
|
`;i.classCheckPrivateStaticFieldDescriptor=helper("7.13.10")`
|
||
|
export default function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
|
||
|
if (descriptor === undefined) {
|
||
|
throw new TypeError("attempted to " + action + " private static field before its declaration");
|
||
|
}
|
||
|
}
|
||
|
`;i.decorate=helper("7.1.5")`
|
||
|
import toArray from "toArray";
|
||
|
import toPropertyKey from "toPropertyKey";
|
||
|
|
||
|
// These comments are stripped by @babel/template
|
||
|
/*::
|
||
|
type PropertyDescriptor =
|
||
|
| {
|
||
|
value: any,
|
||
|
writable: boolean,
|
||
|
configurable: boolean,
|
||
|
enumerable: boolean,
|
||
|
}
|
||
|
| {
|
||
|
get?: () => any,
|
||
|
set?: (v: any) => void,
|
||
|
configurable: boolean,
|
||
|
enumerable: boolean,
|
||
|
};
|
||
|
|
||
|
type FieldDescriptor ={
|
||
|
writable: boolean,
|
||
|
configurable: boolean,
|
||
|
enumerable: boolean,
|
||
|
};
|
||
|
|
||
|
type Placement = "static" | "prototype" | "own";
|
||
|
type Key = string | symbol; // PrivateName is not supported yet.
|
||
|
|
||
|
type ElementDescriptor =
|
||
|
| {
|
||
|
kind: "method",
|
||
|
key: Key,
|
||
|
placement: Placement,
|
||
|
descriptor: PropertyDescriptor
|
||
|
}
|
||
|
| {
|
||
|
kind: "field",
|
||
|
key: Key,
|
||
|
placement: Placement,
|
||
|
descriptor: FieldDescriptor,
|
||
|
initializer?: () => any,
|
||
|
};
|
||
|
|
||
|
// This is exposed to the user code
|
||
|
type ElementObjectInput = ElementDescriptor & {
|
||
|
[@@toStringTag]?: "Descriptor"
|
||
|
};
|
||
|
|
||
|
// This is exposed to the user code
|
||
|
type ElementObjectOutput = ElementDescriptor & {
|
||
|
[@@toStringTag]?: "Descriptor"
|
||
|
extras?: ElementDescriptor[],
|
||
|
finisher?: ClassFinisher,
|
||
|
};
|
||
|
|
||
|
// This is exposed to the user code
|
||
|
type ClassObject = {
|
||
|
[@@toStringTag]?: "Descriptor",
|
||
|
kind: "class",
|
||
|
elements: ElementDescriptor[],
|
||
|
};
|
||
|
|
||
|
type ElementDecorator = (descriptor: ElementObjectInput) => ?ElementObjectOutput;
|
||
|
type ClassDecorator = (descriptor: ClassObject) => ?ClassObject;
|
||
|
type ClassFinisher = <A, B>(cl: Class<A>) => Class<B>;
|
||
|
|
||
|
// Only used by Babel in the transform output, not part of the spec.
|
||
|
type ElementDefinition =
|
||
|
| {
|
||
|
kind: "method",
|
||
|
value: any,
|
||
|
key: Key,
|
||
|
static?: boolean,
|
||
|
decorators?: ElementDecorator[],
|
||
|
}
|
||
|
| {
|
||
|
kind: "field",
|
||
|
value: () => any,
|
||
|
key: Key,
|
||
|
static?: boolean,
|
||
|
decorators?: ElementDecorator[],
|
||
|
};
|
||
|
|
||
|
declare function ClassFactory<C>(initialize: (instance: C) => void): {
|
||
|
F: Class<C>,
|
||
|
d: ElementDefinition[]
|
||
|
}
|
||
|
|
||
|
*/
|
||
|
|
||
|
/*::
|
||
|
// Various combinations with/without extras and with one or many finishers
|
||
|
|
||
|
type ElementFinisherExtras = {
|
||
|
element: ElementDescriptor,
|
||
|
finisher?: ClassFinisher,
|
||
|
extras?: ElementDescriptor[],
|
||
|
};
|
||
|
|
||
|
type ElementFinishersExtras = {
|
||
|
element: ElementDescriptor,
|
||
|
finishers: ClassFinisher[],
|
||
|
extras: ElementDescriptor[],
|
||
|
};
|
||
|
|
||
|
type ElementsFinisher = {
|
||
|
elements: ElementDescriptor[],
|
||
|
finisher?: ClassFinisher,
|
||
|
};
|
||
|
|
||
|
type ElementsFinishers = {
|
||
|
elements: ElementDescriptor[],
|
||
|
finishers: ClassFinisher[],
|
||
|
};
|
||
|
|
||
|
*/
|
||
|
|
||
|
/*::
|
||
|
|
||
|
type Placements = {
|
||
|
static: Key[],
|
||
|
prototype: Key[],
|
||
|
own: Key[],
|
||
|
};
|
||
|
|
||
|
*/
|
||
|
|
||
|
// ClassDefinitionEvaluation (Steps 26-*)
|
||
|
export default function _decorate(
|
||
|
decorators /*: ClassDecorator[] */,
|
||
|
factory /*: ClassFactory */,
|
||
|
superClass /*: ?Class<*> */,
|
||
|
mixins /*: ?Array<Function> */,
|
||
|
) /*: Class<*> */ {
|
||
|
var api = _getDecoratorsApi();
|
||
|
if (mixins) {
|
||
|
for (var i = 0; i < mixins.length; i++) {
|
||
|
api = mixins[i](api);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var r = factory(function initialize(O) {
|
||
|
api.initializeInstanceElements(O, decorated.elements);
|
||
|
}, superClass);
|
||
|
var decorated = api.decorateClass(
|
||
|
_coalesceClassElements(r.d.map(_createElementDescriptor)),
|
||
|
decorators,
|
||
|
);
|
||
|
|
||
|
api.initializeClassElements(r.F, decorated.elements);
|
||
|
|
||
|
return api.runClassFinishers(r.F, decorated.finishers);
|
||
|
}
|
||
|
|
||
|
function _getDecoratorsApi() {
|
||
|
_getDecoratorsApi = function() {
|
||
|
return api;
|
||
|
};
|
||
|
|
||
|
var api = {
|
||
|
elementsDefinitionOrder: [["method"], ["field"]],
|
||
|
|
||
|
// InitializeInstanceElements
|
||
|
initializeInstanceElements: function(
|
||
|
/*::<C>*/ O /*: C */,
|
||
|
elements /*: ElementDescriptor[] */,
|
||
|
) {
|
||
|
["method", "field"].forEach(function(kind) {
|
||
|
elements.forEach(function(element /*: ElementDescriptor */) {
|
||
|
if (element.kind === kind && element.placement === "own") {
|
||
|
this.defineClassElement(O, element);
|
||
|
}
|
||
|
}, this);
|
||
|
}, this);
|
||
|
},
|
||
|
|
||
|
// InitializeClassElements
|
||
|
initializeClassElements: function(
|
||
|
/*::<C>*/ F /*: Class<C> */,
|
||
|
elements /*: ElementDescriptor[] */,
|
||
|
) {
|
||
|
var proto = F.prototype;
|
||
|
|
||
|
["method", "field"].forEach(function(kind) {
|
||
|
elements.forEach(function(element /*: ElementDescriptor */) {
|
||
|
var placement = element.placement;
|
||
|
if (
|
||
|
element.kind === kind &&
|
||
|
(placement === "static" || placement === "prototype")
|
||
|
) {
|
||
|
var receiver = placement === "static" ? F : proto;
|
||
|
this.defineClassElement(receiver, element);
|
||
|
}
|
||
|
}, this);
|
||
|
}, this);
|
||
|
},
|
||
|
|
||
|
// DefineClassElement
|
||
|
defineClassElement: function(
|
||
|
/*::<C>*/ receiver /*: C | Class<C> */,
|
||
|
element /*: ElementDescriptor */,
|
||
|
) {
|
||
|
var descriptor /*: PropertyDescriptor */ = element.descriptor;
|
||
|
if (element.kind === "field") {
|
||
|
var initializer = element.initializer;
|
||
|
descriptor = {
|
||
|
enumerable: descriptor.enumerable,
|
||
|
writable: descriptor.writable,
|
||
|
configurable: descriptor.configurable,
|
||
|
value: initializer === void 0 ? void 0 : initializer.call(receiver),
|
||
|
};
|
||
|
}
|
||
|
Object.defineProperty(receiver, element.key, descriptor);
|
||
|
},
|
||
|
|
||
|
// DecorateClass
|
||
|
decorateClass: function(
|
||
|
elements /*: ElementDescriptor[] */,
|
||
|
decorators /*: ClassDecorator[] */,
|
||
|
) /*: ElementsFinishers */ {
|
||
|
var newElements /*: ElementDescriptor[] */ = [];
|
||
|
var finishers /*: ClassFinisher[] */ = [];
|
||
|
var placements /*: Placements */ = {
|
||
|
static: [],
|
||
|
prototype: [],
|
||
|
own: [],
|
||
|
};
|
||
|
|
||
|
elements.forEach(function(element /*: ElementDescriptor */) {
|
||
|
this.addElementPlacement(element, placements);
|
||
|
}, this);
|
||
|
|
||
|
elements.forEach(function(element /*: ElementDescriptor */) {
|
||
|
if (!_hasDecorators(element)) return newElements.push(element);
|
||
|
|
||
|
var elementFinishersExtras /*: ElementFinishersExtras */ = this.decorateElement(
|
||
|
element,
|
||
|
placements,
|
||
|
);
|
||
|
newElements.push(elementFinishersExtras.element);
|
||
|
newElements.push.apply(newElements, elementFinishersExtras.extras);
|
||
|
finishers.push.apply(finishers, elementFinishersExtras.finishers);
|
||
|
}, this);
|
||
|
|
||
|
if (!decorators) {
|
||
|
return { elements: newElements, finishers: finishers };
|
||
|
}
|
||
|
|
||
|
var result /*: ElementsFinishers */ = this.decorateConstructor(
|
||
|
newElements,
|
||
|
decorators,
|
||
|
);
|
||
|
finishers.push.apply(finishers, result.finishers);
|
||
|
result.finishers = finishers;
|
||
|
|
||
|
return result;
|
||
|
},
|
||
|
|
||
|
// AddElementPlacement
|
||
|
addElementPlacement: function(
|
||
|
element /*: ElementDescriptor */,
|
||
|
placements /*: Placements */,
|
||
|
silent /*: boolean */,
|
||
|
) {
|
||
|
var keys = placements[element.placement];
|
||
|
if (!silent && keys.indexOf(element.key) !== -1) {
|
||
|
throw new TypeError("Duplicated element (" + element.key + ")");
|
||
|
}
|
||
|
keys.push(element.key);
|
||
|
},
|
||
|
|
||
|
// DecorateElement
|
||
|
decorateElement: function(
|
||
|
element /*: ElementDescriptor */,
|
||
|
placements /*: Placements */,
|
||
|
) /*: ElementFinishersExtras */ {
|
||
|
var extras /*: ElementDescriptor[] */ = [];
|
||
|
var finishers /*: ClassFinisher[] */ = [];
|
||
|
|
||
|
for (
|
||
|
var decorators = element.decorators, i = decorators.length - 1;
|
||
|
i >= 0;
|
||
|
i--
|
||
|
) {
|
||
|
// (inlined) RemoveElementPlacement
|
||
|
var keys = placements[element.placement];
|
||
|
keys.splice(keys.indexOf(element.key), 1);
|
||
|
|
||
|
var elementObject /*: ElementObjectInput */ = this.fromElementDescriptor(
|
||
|
element,
|
||
|
);
|
||
|
var elementFinisherExtras /*: ElementFinisherExtras */ = this.toElementFinisherExtras(
|
||
|
(0, decorators[i])(elementObject) /*: ElementObjectOutput */ ||
|
||
|
elementObject,
|
||
|
);
|
||
|
|
||
|
element = elementFinisherExtras.element;
|
||
|
this.addElementPlacement(element, placements);
|
||
|
|
||
|
if (elementFinisherExtras.finisher) {
|
||
|
finishers.push(elementFinisherExtras.finisher);
|
||
|
}
|
||
|
|
||
|
var newExtras /*: ElementDescriptor[] | void */ =
|
||
|
elementFinisherExtras.extras;
|
||
|
if (newExtras) {
|
||
|
for (var j = 0; j < newExtras.length; j++) {
|
||
|
this.addElementPlacement(newExtras[j], placements);
|
||
|
}
|
||
|
extras.push.apply(extras, newExtras);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return { element: element, finishers: finishers, extras: extras };
|
||
|
},
|
||
|
|
||
|
// DecorateConstructor
|
||
|
decorateConstructor: function(
|
||
|
elements /*: ElementDescriptor[] */,
|
||
|
decorators /*: ClassDecorator[] */,
|
||
|
) /*: ElementsFinishers */ {
|
||
|
var finishers /*: ClassFinisher[] */ = [];
|
||
|
|
||
|
for (var i = decorators.length - 1; i >= 0; i--) {
|
||
|
var obj /*: ClassObject */ = this.fromClassDescriptor(elements);
|
||
|
var elementsAndFinisher /*: ElementsFinisher */ = this.toClassDescriptor(
|
||
|
(0, decorators[i])(obj) /*: ClassObject */ || obj,
|
||
|
);
|
||
|
|
||
|
if (elementsAndFinisher.finisher !== undefined) {
|
||
|
finishers.push(elementsAndFinisher.finisher);
|
||
|
}
|
||
|
|
||
|
if (elementsAndFinisher.elements !== undefined) {
|
||
|
elements = elementsAndFinisher.elements;
|
||
|
|
||
|
for (var j = 0; j < elements.length - 1; j++) {
|
||
|
for (var k = j + 1; k < elements.length; k++) {
|
||
|
if (
|
||
|
elements[j].key === elements[k].key &&
|
||
|
elements[j].placement === elements[k].placement
|
||
|
) {
|
||
|
throw new TypeError(
|
||
|
"Duplicated element (" + elements[j].key + ")",
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return { elements: elements, finishers: finishers };
|
||
|
},
|
||
|
|
||
|
// FromElementDescriptor
|
||
|
fromElementDescriptor: function(
|
||
|
element /*: ElementDescriptor */,
|
||
|
) /*: ElementObject */ {
|
||
|
var obj /*: ElementObject */ = {
|
||
|
kind: element.kind,
|
||
|
key: element.key,
|
||
|
placement: element.placement,
|
||
|
descriptor: element.descriptor,
|
||
|
};
|
||
|
|
||
|
var desc = {
|
||
|
value: "Descriptor",
|
||
|
configurable: true,
|
||
|
};
|
||
|
Object.defineProperty(obj, Symbol.toStringTag, desc);
|
||
|
|
||
|
if (element.kind === "field") obj.initializer = element.initializer;
|
||
|
|
||
|
return obj;
|
||
|
},
|
||
|
|
||
|
// ToElementDescriptors
|
||
|
toElementDescriptors: function(
|
||
|
elementObjects /*: ElementObject[] */,
|
||
|
) /*: ElementDescriptor[] */ {
|
||
|
if (elementObjects === undefined) return;
|
||
|
return toArray(elementObjects).map(function(elementObject) {
|
||
|
var element = this.toElementDescriptor(elementObject);
|
||
|
this.disallowProperty(elementObject, "finisher", "An element descriptor");
|
||
|
this.disallowProperty(elementObject, "extras", "An element descriptor");
|
||
|
return element;
|
||
|
}, this);
|
||
|
},
|
||
|
|
||
|
// ToElementDescriptor
|
||
|
toElementDescriptor: function(
|
||
|
elementObject /*: ElementObject */,
|
||
|
) /*: ElementDescriptor */ {
|
||
|
var kind = String(elementObject.kind);
|
||
|
if (kind !== "method" && kind !== "field") {
|
||
|
throw new TypeError(
|
||
|
'An element descriptor\\'s .kind property must be either "method" or' +
|
||
|
' "field", but a decorator created an element descriptor with' +
|
||
|
' .kind "' +
|
||
|
kind +
|
||
|
'"',
|
||
|
);
|
||
|
}
|
||
|
|
||
|
var key = toPropertyKey(elementObject.key);
|
||
|
|
||
|
var placement = String(elementObject.placement);
|
||
|
if (
|
||
|
placement !== "static" &&
|
||
|
placement !== "prototype" &&
|
||
|
placement !== "own"
|
||
|
) {
|
||
|
throw new TypeError(
|
||
|
'An element descriptor\\'s .placement property must be one of "static",' +
|
||
|
' "prototype" or "own", but a decorator created an element descriptor' +
|
||
|
' with .placement "' +
|
||
|
placement +
|
||
|
'"',
|
||
|
);
|
||
|
}
|
||
|
|
||
|
var descriptor /*: PropertyDescriptor */ = elementObject.descriptor;
|
||
|
|
||
|
this.disallowProperty(elementObject, "elements", "An element descriptor");
|
||
|
|
||
|
var element /*: ElementDescriptor */ = {
|
||
|
kind: kind,
|
||
|
key: key,
|
||
|
placement: placement,
|
||
|
descriptor: Object.assign({}, descriptor),
|
||
|
};
|
||
|
|
||
|
if (kind !== "field") {
|
||
|
this.disallowProperty(elementObject, "initializer", "A method descriptor");
|
||
|
} else {
|
||
|
this.disallowProperty(
|
||
|
descriptor,
|
||
|
"get",
|
||
|
"The property descriptor of a field descriptor",
|
||
|
);
|
||
|
this.disallowProperty(
|
||
|
descriptor,
|
||
|
"set",
|
||
|
"The property descriptor of a field descriptor",
|
||
|
);
|
||
|
this.disallowProperty(
|
||
|
descriptor,
|
||
|
"value",
|
||
|
"The property descriptor of a field descriptor",
|
||
|
);
|
||
|
|
||
|
element.initializer = elementObject.initializer;
|
||
|
}
|
||
|
|
||
|
return element;
|
||
|
},
|
||
|
|
||
|
toElementFinisherExtras: function(
|
||
|
elementObject /*: ElementObject */,
|
||
|
) /*: ElementFinisherExtras */ {
|
||
|
var element /*: ElementDescriptor */ = this.toElementDescriptor(
|
||
|
elementObject,
|
||
|
);
|
||
|
var finisher /*: ClassFinisher */ = _optionalCallableProperty(
|
||
|
elementObject,
|
||
|
"finisher",
|
||
|
);
|
||
|
var extras /*: ElementDescriptors[] */ = this.toElementDescriptors(
|
||
|
elementObject.extras,
|
||
|
);
|
||
|
|
||
|
return { element: element, finisher: finisher, extras: extras };
|
||
|
},
|
||
|
|
||
|
// FromClassDescriptor
|
||
|
fromClassDescriptor: function(
|
||
|
elements /*: ElementDescriptor[] */,
|
||
|
) /*: ClassObject */ {
|
||
|
var obj = {
|
||
|
kind: "class",
|
||
|
elements: elements.map(this.fromElementDescriptor, this),
|
||
|
};
|
||
|
|
||
|
var desc = { value: "Descriptor", configurable: true };
|
||
|
Object.defineProperty(obj, Symbol.toStringTag, desc);
|
||
|
|
||
|
return obj;
|
||
|
},
|
||
|
|
||
|
// ToClassDescriptor
|
||
|
toClassDescriptor: function(
|
||
|
obj /*: ClassObject */,
|
||
|
) /*: ElementsFinisher */ {
|
||
|
var kind = String(obj.kind);
|
||
|
if (kind !== "class") {
|
||
|
throw new TypeError(
|
||
|
'A class descriptor\\'s .kind property must be "class", but a decorator' +
|
||
|
' created a class descriptor with .kind "' +
|
||
|
kind +
|
||
|
'"',
|
||
|
);
|
||
|
}
|
||
|
|
||
|
this.disallowProperty(obj, "key", "A class descriptor");
|
||
|
this.disallowProperty(obj, "placement", "A class descriptor");
|
||
|
this.disallowProperty(obj, "descriptor", "A class descriptor");
|
||
|
this.disallowProperty(obj, "initializer", "A class descriptor");
|
||
|
this.disallowProperty(obj, "extras", "A class descriptor");
|
||
|
|
||
|
var finisher = _optionalCallableProperty(obj, "finisher");
|
||
|
var elements = this.toElementDescriptors(obj.elements);
|
||
|
|
||
|
return { elements: elements, finisher: finisher };
|
||
|
},
|
||
|
|
||
|
// RunClassFinishers
|
||
|
runClassFinishers: function(
|
||
|
constructor /*: Class<*> */,
|
||
|
finishers /*: ClassFinisher[] */,
|
||
|
) /*: Class<*> */ {
|
||
|
for (var i = 0; i < finishers.length; i++) {
|
||
|
var newConstructor /*: ?Class<*> */ = (0, finishers[i])(constructor);
|
||
|
if (newConstructor !== undefined) {
|
||
|
// NOTE: This should check if IsConstructor(newConstructor) is false.
|
||
|
if (typeof newConstructor !== "function") {
|
||
|
throw new TypeError("Finishers must return a constructor.");
|
||
|
}
|
||
|
constructor = newConstructor;
|
||
|
}
|
||
|
}
|
||
|
return constructor;
|
||
|
},
|
||
|
|
||
|
disallowProperty: function(obj, name, objectType) {
|
||
|
if (obj[name] !== undefined) {
|
||
|
throw new TypeError(objectType + " can't have a ." + name + " property.");
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
return api;
|
||
|
}
|
||
|
|
||
|
// ClassElementEvaluation
|
||
|
function _createElementDescriptor(
|
||
|
def /*: ElementDefinition */,
|
||
|
) /*: ElementDescriptor */ {
|
||
|
var key = toPropertyKey(def.key);
|
||
|
|
||
|
var descriptor /*: PropertyDescriptor */;
|
||
|
if (def.kind === "method") {
|
||
|
descriptor = {
|
||
|
value: def.value,
|
||
|
writable: true,
|
||
|
configurable: true,
|
||
|
enumerable: false,
|
||
|
};
|
||
|
} else if (def.kind === "get") {
|
||
|
descriptor = { get: def.value, configurable: true, enumerable: false };
|
||
|
} else if (def.kind === "set") {
|
||
|
descriptor = { set: def.value, configurable: true, enumerable: false };
|
||
|
} else if (def.kind === "field") {
|
||
|
descriptor = { configurable: true, writable: true, enumerable: true };
|
||
|
}
|
||
|
|
||
|
var element /*: ElementDescriptor */ = {
|
||
|
kind: def.kind === "field" ? "field" : "method",
|
||
|
key: key,
|
||
|
placement: def.static
|
||
|
? "static"
|
||
|
: def.kind === "field"
|
||
|
? "own"
|
||
|
: "prototype",
|
||
|
descriptor: descriptor,
|
||
|
};
|
||
|
if (def.decorators) element.decorators = def.decorators;
|
||
|
if (def.kind === "field") element.initializer = def.value;
|
||
|
|
||
|
return element;
|
||
|
}
|
||
|
|
||
|
// CoalesceGetterSetter
|
||
|
function _coalesceGetterSetter(
|
||
|
element /*: ElementDescriptor */,
|
||
|
other /*: ElementDescriptor */,
|
||
|
) {
|
||
|
if (element.descriptor.get !== undefined) {
|
||
|
other.descriptor.get = element.descriptor.get;
|
||
|
} else {
|
||
|
other.descriptor.set = element.descriptor.set;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// CoalesceClassElements
|
||
|
function _coalesceClassElements(
|
||
|
elements /*: ElementDescriptor[] */,
|
||
|
) /*: ElementDescriptor[] */ {
|
||
|
var newElements /*: ElementDescriptor[] */ = [];
|
||
|
|
||
|
var isSameElement = function(
|
||
|
other /*: ElementDescriptor */,
|
||
|
) /*: boolean */ {
|
||
|
return (
|
||
|
other.kind === "method" &&
|
||
|
other.key === element.key &&
|
||
|
other.placement === element.placement
|
||
|
);
|
||
|
};
|
||
|
|
||
|
for (var i = 0; i < elements.length; i++) {
|
||
|
var element /*: ElementDescriptor */ = elements[i];
|
||
|
var other /*: ElementDescriptor */;
|
||
|
|
||
|
if (
|
||
|
element.kind === "method" &&
|
||
|
(other = newElements.find(isSameElement))
|
||
|
) {
|
||
|
if (
|
||
|
_isDataDescriptor(element.descriptor) ||
|
||
|
_isDataDescriptor(other.descriptor)
|
||
|
) {
|
||
|
if (_hasDecorators(element) || _hasDecorators(other)) {
|
||
|
throw new ReferenceError(
|
||
|
"Duplicated methods (" + element.key + ") can't be decorated.",
|
||
|
);
|
||
|
}
|
||
|
other.descriptor = element.descriptor;
|
||
|
} else {
|
||
|
if (_hasDecorators(element)) {
|
||
|
if (_hasDecorators(other)) {
|
||
|
throw new ReferenceError(
|
||
|
"Decorators can't be placed on different accessors with for " +
|
||
|
"the same property (" +
|
||
|
element.key +
|
||
|
").",
|
||
|
);
|
||
|
}
|
||
|
other.decorators = element.decorators;
|
||
|
}
|
||
|
_coalesceGetterSetter(element, other);
|
||
|
}
|
||
|
} else {
|
||
|
newElements.push(element);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return newElements;
|
||
|
}
|
||
|
|
||
|
function _hasDecorators(element /*: ElementDescriptor */) /*: boolean */ {
|
||
|
return element.decorators && element.decorators.length;
|
||
|
}
|
||
|
|
||
|
function _isDataDescriptor(desc /*: PropertyDescriptor */) /*: boolean */ {
|
||
|
return (
|
||
|
desc !== undefined &&
|
||
|
!(desc.value === undefined && desc.writable === undefined)
|
||
|
);
|
||
|
}
|
||
|
|
||
|
function _optionalCallableProperty /*::<T>*/(
|
||
|
obj /*: T */,
|
||
|
name /*: $Keys<T> */,
|
||
|
) /*: ?Function */ {
|
||
|
var value = obj[name];
|
||
|
if (value !== undefined && typeof value !== "function") {
|
||
|
throw new TypeError("Expected '" + name + "' to be a function");
|
||
|
}
|
||
|
return value;
|
||
|
}
|
||
|
|
||
|
`;i.classPrivateMethodGet=helper("7.1.6")`
|
||
|
export default function _classPrivateMethodGet(receiver, privateSet, fn) {
|
||
|
if (!privateSet.has(receiver)) {
|
||
|
throw new TypeError("attempted to get private field on non-instance");
|
||
|
}
|
||
|
return fn;
|
||
|
}
|
||
|
`;i.checkPrivateRedeclaration=helper("7.14.1")`
|
||
|
export default function _checkPrivateRedeclaration(obj, privateCollection) {
|
||
|
if (privateCollection.has(obj)) {
|
||
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
||
|
}
|
||
|
}
|
||
|
`;i.classPrivateFieldInitSpec=helper("7.14.1")`
|
||
|
import checkPrivateRedeclaration from "checkPrivateRedeclaration";
|
||
|
|
||
|
export default function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
||
|
checkPrivateRedeclaration(obj, privateMap);
|
||
|
privateMap.set(obj, value);
|
||
|
}
|
||
|
`;i.classPrivateMethodInitSpec=helper("7.14.1")`
|
||
|
import checkPrivateRedeclaration from "checkPrivateRedeclaration";
|
||
|
|
||
|
export default function _classPrivateMethodInitSpec(obj, privateSet) {
|
||
|
checkPrivateRedeclaration(obj, privateSet);
|
||
|
privateSet.add(obj);
|
||
|
}
|
||
|
`;{i.classPrivateMethodSet=helper("7.1.6")`
|
||
|
export default function _classPrivateMethodSet() {
|
||
|
throw new TypeError("attempted to reassign private method");
|
||
|
}
|
||
|
`}i.identity=helper("7.17.0")`
|
||
|
export default function _identity(x) {
|
||
|
return x;
|
||
|
}
|
||
|
`},5262:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=void 0;t.ensure=ensure;t.get=get;t.getDependencies=getDependencies;t.list=void 0;t.minVersion=minVersion;var n=r(7734);var s=r(6953);var i=r(6337);const{assignmentExpression:a,cloneNode:o,expressionStatement:l,file:c,identifier:u}=s;function makePath(e){const t=[];for(;e.parentPath;e=e.parentPath){t.push(e.key);if(e.inList)t.push(e.listKey)}return t.reverse().join(".")}let p=undefined;function getHelperMetadata(e){const t=new Set;const r=new Set;const s=new Map;let a;let o;const l=[];const c=[];const u=[];const p={ImportDeclaration(e){const t=e.node.source.value;if(!i.default[t]){throw e.buildCodeFrameError(`Unknown helper ${t}`)}if(e.get("specifiers").length!==1||!e.get("specifiers.0").isImportDefaultSpecifier()){throw e.buildCodeFrameError("Helpers can only import a default value")}const r=e.node.specifiers[0].local;s.set(r,t);c.push(makePath(e))},ExportDefaultDeclaration(e){const t=e.get("declaration");if(!t.isFunctionDeclaration()||!t.node.id){throw t.buildCodeFrameError("Helpers can only export named function declarations")}a=t.node.id.name;o=makePath(e)},ExportAllDeclaration(e){throw e.buildCodeFrameError("Helpers can only export default")},ExportNamedDeclaration(e){throw e.buildCodeFrameError("Helpers can only export default")},Statement(e){if(e.isModuleDeclaration())return;e.skip()}};const f={Program(e){const t=e.scope.getAllBindings();Object.keys(t).forEach((e=>{if(e===a)return;if(s.has(t[e].identifier))return;r.add(e)}))},ReferencedIdentifier(e){const r=e.node.name;const n=e.scope.getBinding(r);if(!n){t.add(r)}else if(s.has(n.identifier)){u.push(makePath(e))}},AssignmentExpression(e){const t=e.get("left");if(!(a in t.getBindingIdentifiers()))return;if(!t.isIdentifier()){throw t.buildCodeFrameError("Only simple assignments to exports are allowed in helpers")}const r=e.scope.getBinding(a);if(r!=null&&r.scope.path.isProgram()){l.push(makePath(e))}}};(0,n.default)(e.ast,p,e.scope);(0,n.default)(e.ast,f,e.scope);if(!o)throw new Error("Helpers must have a default export.");l.reverse();return{globals:Array.from(t),localBindingNames:Array.from(r),dependencies:s,exportBindingAssignments:l,exportPath:o,exportName:a,importBindingsReferences:u,importPaths:c}}function permuteHelperAST(e,t,r,n,s){if(n&&!r){throw new Error("Unexpected local bindings for module-based helpers.")}if(!r)return;const{localBindingNames:i,dependencies:c,exportBindingAssignments:p,exportPath:f,exportName:d,importBindingsReferences:h,importPaths:m}=t;const y={};c.forEach(((e,t)=>{y[t.name]=typeof s==="function"&&s(e)||t}));const g={};const b=new Set(n||[]);i.forEach((e=>{let t=e;while(b.has(t))t="_"+t;if(t!==e)g[e]=t}));if(r.type==="Identifier"&&d!==r.name){g[d]=r.name}const{path:T}=e;const S=T.get(f);const E=m.map((e=>T.get(e)));const x=h.map((e=>T.get(e)));const v=S.get("declaration");if(r.type==="Identifier"){S.replaceWith(v)}else if(r.type==="MemberExpression"){p.forEach((e=>{const t=T.get(e);t.replaceWith(a("=",r,t.node))}));S.replaceWith(v);T.pushContainer("body",l(a("=",r,u(d))))}else{throw new Error("Unexpected helper format.")}Object.keys(g).forEach((e=>{T.scope.rename(e,g[e])}));for(const e of E)e.remove();for(const e of x){const t=o(y[e.node.name]);e.replaceWith(t)}}const f=Object.create(null);function loadHelper(e){if(!f[e]){const t=i.default[e];if(!t){throw Object.assign(new ReferenceError(`Unknown helper ${e}`),{code:"BABEL_HELPER_UNKNOWN",helper:e})}const fn=()=>{{if(!p){const e={ast:c(t.ast()),path:null};(0,n.default)(e.ast,{Program:t=>(e.path=t).stop()});return e}}return new p({filename:`babel-helper://${e}`},{ast:c(t.ast()),code:"[internal Babel helper code]",inputMap:null})};let r=null;f[e]={minVersion:t.minVersion,build(e,t,n){const s=fn();r||(r=getHelperMetadata(s));permuteHelperAST(s,r,t,n,e);return{nodes:s.ast.program.body,globals:r.globals}},getDependencies(){r||(r=getHelperMetadata(fn()));return Array.from(r.dependencies.values())}}}return f[e]}function get(e,t,r,n){return loadHelper(e).build(t,r,n)}function minVersion(e){return loa
|