(e,t)
| 38 | `;r.body.body=[n.types.classProperty(n.types.toExpression(Y),undefined,undefined,undefined,true,true),...a];const s=[];const i=n.types.newExpression(r,[]);if(W.length>0){s.push(...W)}if(z){J=true;s.push(z)}if(s.length>0){s.unshift(n.types.callExpression(n.types.super(),[n.types.cloneNode(_)]));r.body.body.push(createConstructorFromExpressions(s,false))}else{i.arguments.push(n.types.cloneNode(_))}const[o]=e.replaceWith(i);X=o.get("callee").get("body").get("body.0.key")}}if(!J&&z){e.node.body.body.push(n.types.staticBlock([n.types.expressionStatement(z)]))}let{superClass:Z}=Y;if(Z&&(f==="2023-11"||f==="2023-05")){const t=e.scope.maybeGenerateMemoised(Z);if(t){Y.superClass=n.types.assignmentExpression("=",t,Z);Z=t}}const ee=n.types.staticBlock([]);Y.body.body.unshift(ee);const te=ee.body;if(R.length>0){const e=X.get("body.body");let t;for(const r of e){if((r.isClassProperty()||r.isClassMethod())&&r.node.kind!=="constructor"){t=r;break}}if(t!=null){convertToComputedKey(t);prependExpressionsToComputedKey(R,t)}else{Y.body.body.unshift(n.types.classProperty(n.types.sequenceExpression([...R,n.types.stringLiteral("_")]),undefined,undefined,undefined,true,true));te.push(n.types.expressionStatement(n.types.unaryExpression("delete",n.types.memberExpression(n.types.thisExpression(),n.types.identifier("_")))))}R=[]}te.push(n.types.expressionStatement(createLocalsAssignment(H,G,q,B!=null?B:n.types.arrayExpression(F),n.types.numericLiteral(j),K?U:null,w,n.types.cloneNode(Z),t,f)));if(v){te.push(n.types.expressionStatement(n.types.callExpression(n.types.cloneNode(v),[n.types.thisExpression()])))}if(Q.length>0){te.push(...Q.map((e=>n.types.expressionStatement(e))))}e.insertBefore(x.map((e=>n.types.expressionStatement(e))));if(L){const t=E.getBinding(_.name);if(!t.constantViolations.length){e.insertBefore(n.types.variableDeclaration("let",[n.types.variableDeclarator(n.types.cloneNode(_))]))}else{const t=E.generateUidIdentifier("t"+_.name);const r=_;e.replaceWithMultiple([n.types.variableDeclaration("let",[n.types.variableDeclarator(n.types.cloneNode(r)),n.types.variableDeclarator(t)]),n.types.blockStatement([n.types.variableDeclaration("let",[n.types.variableDeclarator(n.types.cloneNode(_))]),e.node,n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(t),n.types.cloneNode(_)))]),n.types.expressionStatement(n.types.assignmentExpression("=",n.types.cloneNode(r),n.types.cloneNode(t)))])}}if(N.size>0){checkPrivateMethodUpdateError(e,N)}e.scope.crawl();return e}function createLocalsAssignment(e,t,r,s,i,a,o,l,c,p){let u,d;const f=[o?createSetFunctionNameCall(c,o):n.types.thisExpression(),s,r];{if(p!=="2023-11"){f.splice(1,2,r,s)}if(p==="2021-12"||p==="2022-03"&&!c.availableHelper("applyDecs2203R")){u=n.types.arrayPattern([...e,...t]);d=n.types.callExpression(c.addHelper(p==="2021-12"?"applyDecs":"applyDecs2203"),f);return n.types.assignmentExpression("=",u,d)}else if(p==="2022-03"){d=n.types.callExpression(c.addHelper("applyDecs2203R"),f)}else if(p==="2023-01"){if(a){f.push(createPrivateBrandCheckClosure(a))}d=n.types.callExpression(c.addHelper("applyDecs2301"),f)}else if(p==="2023-05"){if(a||l||i.value!==0){f.push(i)}if(a){f.push(createPrivateBrandCheckClosure(a))}else if(l){f.push(n.types.unaryExpression("void",n.types.numericLiteral(0)))}if(l)f.push(l);d=n.types.callExpression(c.addHelper("applyDecs2305"),f)}}if(p==="2023-11"){if(a||l||i.value!==0){f.push(i)}if(a){f.push(createPrivateBrandCheckClosure(a))}else if(l){f.push(n.types.unaryExpression("void",n.types.numericLiteral(0)))}if(l)f.push(l);d=n.types.callExpression(c.addHelper("applyDecs2311"),f)}if(e.length>0){if(t.length>0){u=n.types.objectPattern([n.types.objectProperty(n.types.identifier("e"),n.types.arrayPattern(e)),n.types.objectProperty(n.types.identifier("c"),n.types.arrayPattern(t))])}else{u=n.types.arrayPattern(e);d=n.types.memberExpression(d,n.types.identifier("e"),false,false)}}else{u=n.types.arrayPattern(t);d=n.types.memberExpression(d,n.types.identifier("c"),false,false)}return n.types.assignmentExpression("=",u,d)}function isProtoKey(e){return e.type==="Identifier"?e.name==="__proto__":e.value==="__proto__"}function isDecorated(e){return e.decorators&&e.decorators.length>0}function shouldTransformElement(e){switch(e.type){case"ClassAccessorProperty":return true;case"ClassMethod":case"ClassProperty":case"ClassPrivateMethod":case"ClassPrivateProperty":return isDecorated(e);default:return false}}function shouldTransformClass(e){return isDecorated(e)||e.body.body.some(shouldTransformElement)}function NamedEvaluationVisitoryFactory(e,t){function handleComputedProperty(e,t,r){switch(t.type){case"StringLiteral":return n.types.stringLiteral(t.value);case"NumericLiteral":case"BigIntLiteral":{const r=t.value+"";e.get("key").replaceWith(n.types.stringLiteral(r));return n.types.stringLiteral(r)}default:{const s=e.scope.maybeGenerateMemoised(t);e.get("key").replaceWith(n.types.assignmentExpression("=",s,createToPropertyKeyCall(r,t)));return n.types.cloneNode(s)}}}return{VariableDeclarator(r,n){const s=r.node.id;if(s.type==="Identifier"){const a=(0,i.skipTransparentExprWrappers)(r.get("init"));if(e(a)){const e=s.name;t(a,n,e)}}},AssignmentExpression(r,n){const s=r.node.left;if(s.type==="Identifier"){const a=(0,i.skipTransparentExprWrappers)(r.get("right"));if(e(a)){switch(r.node.operator){case"=":case"&&=":case"||=":case"??=":t(a,n,s.name)}}}},AssignmentPattern(r,n){const s=r.node.left;if(s.type==="Identifier"){const a=(0,i.skipTransparentExprWrappers)(r.get("right"));if(e(a)){const e=s.name;t(a,n,e)}}},ObjectExpression(r,s){for(const a of r.get("properties")){if(!a.isObjectProperty())continue;const{node:r}=a;const o=r.key;const l=(0,i.skipTransparentExprWrappers)(a.get("value"));if(e(l)){if(!r.computed){if(!isProtoKey(o)){if(o.type==="Identifier"){t(l,s,o.name)}else{const e=n.types.stringLiteral(o.value+"");t(l,s,e)}}}else{const e=handleComputedProperty(a,o,s);t(l,s,e)}}}},ClassPrivateProperty(r,s){const{node:a}=r;const o=(0,i.skipTransparentExprWrappers)(r.get("value"));if(e(o)){const e=n.types.stringLiteral("#"+a.key.id.name);t(o,s,e)}},ClassAccessorProperty(r,s){const{node:a}=r;const o=a.key;const l=(0,i.skipTransparentExprWrappers)(r.get("value"));if(e(l)){if(!a.computed){if(o.type==="Identifier"){t(l,s,o.name)}else if(o.type==="PrivateName"){const e=n.types.stringLiteral("#"+o.id.name);t(l,s,e)}else{const e=n.types.stringLiteral(o.value+"");t(l,s,e)}}else{const e=handleComputedProperty(r,o,s);t(l,s,e)}}},ClassProperty(r,s){const{node:a}=r;const o=a.key;const l=(0,i.skipTransparentExprWrappers)(r.get("value"));if(e(l)){if(!a.computed){if(o.type==="Identifier"){t(l,s,o.name)}else{const e=n.types.stringLiteral(o.value+"");t(l,s,e)}}else{const e=handleComputedProperty(r,o,s);t(l,s,e)}}}}}function isDecoratedAnonymousClassExpression(e){return e.isClassExpression({id:null})&&shouldTransformClass(e.node)}function generateLetUidIdentifier(e,t){const r=e.generateUidIdentifier(t);e.push({id:r,kind:"let"});return n.types.cloneNode(r)}function _default({assertVersion:e,assumption:t},{loose:s},i,a){var o,l;{if(i==="2023-11"||i==="2023-05"||i==="2023-01"){e("^7.21.0")}else if(i==="2021-12"){e("^7.16.0")}else{e("^7.19.0")}}const c=new WeakSet;const p=(o=t("constantSuper"))!=null?o:s;const u=(l=t("ignoreFunctionLength"))!=null?l:s;const d=NamedEvaluationVisitoryFactory(isDecoratedAnonymousClassExpression,visitClass);function visitClass(e,t,r){var n;if(c.has(e))return;const{node:s}=e;r!=null?r:r=(n=s.id)==null?void 0:n.name;const a=transformClass(e,t,p,u,r,d,i);if(a){c.add(a);return}c.add(e)}return{name:"proposal-decorators",inherits:a,visitor:Object.assign({ExportDefaultDeclaration(e,t){const{declaration:s}=e.node;if((s==null?void 0:s.type)==="ClassDeclaration"&&isDecorated(s)){const a=!s.id;{var i;(i=e.splitExportDeclaration)!=null?i:e.splitExportDeclaration=r(8026).NodePath.prototype.splitExportDeclaration}const o=e.splitExportDeclaration();if(a){visitClass(o,t,n.types.stringLiteral("default"))}}},ExportNamedDeclaration(e){const{declaration:t}=e.node;if((t==null?void 0:t.type)==="ClassDeclaration"&&isDecorated(t)){{var n;(n=e.splitExportDeclaration)!=null?n:e.splitExportDeclaration=r(8026).NodePath.prototype.splitExportDeclaration}e.splitExportDeclaration()}},Class(e,t){visitClass(e,t,undefined)}},d)}}},1409:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.FEATURES=void 0;t.enableFeature=enableFeature;t.isLoose=isLoose;t.shouldTransform=shouldTransform;var n=r(7009);const s=t.FEATURES=Object.freeze({fields:1<<1,privateMethods:1<<2,decorators:1<<3,privateIn:1<<4,staticBlocks:1<<5});const i=new Map([[s.fields,"@babel/plugin-transform-class-properties"],[s.privateMethods,"@babel/plugin-transform-private-methods"],[s.privateIn,"@babel/plugin-transform-private-property-in-object"]]);const a="@babel/plugin-class-features/featuresKey";const o="@babel/plugin-class-features/looseKey";{var l="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing"}{var canIgnoreLoose=function(e,t){return!!(e.get(l)&t)}}function enableFeature(e,t,r){if(!hasFeature(e,t)||canIgnoreLoose(e,t)){e.set(a,e.get(a)|t);if(r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"){setLoose(e,t,true);e.set(l,e.get(l)|t)}else if(r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"){setLoose(e,t,false);e.set(l,e.get(l)|t)}else{setLoose(e,t,r)}}let n;for(const[t,r]of i){if(!hasFeature(e,t))continue;{if(canIgnoreLoose(e,t))continue}const i=isLoose(e,t);if(n===!i){throw new Error("'loose' mode configuration must be the same for @babel/plugin-transform-class-properties, "+"@babel/plugin-transform-private-methods and "+"@babel/plugin-transform-private-property-in-object (when they are enabled)."+"\n\n"+getBabelShowConfigForHint(e))}else{n=i;{var s=r}}}if(n!==undefined){for(const[t,r]of i){if(hasFeature(e,t)&&isLoose(e,t)!==n){setLoose(e,t,n);console.warn(`Though the "loose" option was set to "${!n}" in your @babel/preset-env `+`config, it will not be used for ${r} since the "loose" mode option was set to `+`"${n}" for ${s}.\nThe "loose" option must be the `+`same for @babel/plugin-transform-class-properties, @babel/plugin-transform-private-methods `+`and @babel/plugin-transform-private-property-in-object (when they are enabled): you can `+`silence this warning by explicitly adding\n`+`\t["${r}", { "loose": ${n} }]\n`+`to the "plugins" section of your Babel config.`+"\n\n"+getBabelShowConfigForHint(e))}}}}function getBabelShowConfigForHint(e){let{filename:t}=e.opts;if(!t||t==="unknown"){t="[name of the input file]"}return`If you already set the same 'loose' mode for these plugins in your config, it's possible that they are enabled multiple times with different options.\nYou can re-run Babel with the BABEL_SHOW_CONFIG_FOR environment variable to show the loaded configuration:\n\tnpx cross-env BABEL_SHOW_CONFIG_FOR=${t} <your build command>\nSee https://babeljs.io/docs/configuration#print-effective-configs for more info.`}function hasFeature(e,t){return!!(e.get(a)&t)}function isLoose(e,t){return!!(e.get(o)&t)}function setLoose(e,t,r){if(r)e.set(o,e.get(o)|t);else e.set(o,e.get(o)&~t);{e.set(l,e.get(l)&~t)}}function shouldTransform(e,t){let r=null;let i=null;let a=null;let o=null;let l=null;if((0,n.hasOwnDecorators)(e.node)){r=e.get("decorators.0")}for(const t of e.get("body.body")){if(!r&&(0,n.hasOwnDecorators)(t.node)){r=t.get("decorators.0")}if(!i&&t.isClassProperty()){i=t}if(!a&&t.isClassPrivateProperty()){a=t}if(!o&&t.isClassPrivateMethod!=null&&t.isClassPrivateMethod()){o=t}if(!l&&t.isStaticBlock!=null&&t.isStaticBlock()){l=t}}if(r&&a){throw a.buildCodeFrameError("Private fields in decorated classes are not supported yet.")}if(r&&o){throw o.buildCodeFrameError("Private methods in decorated classes are not supported yet.")}if(r&&!hasFeature(t,s.decorators)){throw e.buildCodeFrameError("Decorators are not enabled."+"\nIf you are using "+'["@babel/plugin-proposal-decorators", { "version": "legacy" }], '+'make sure it comes *before* "@babel/plugin-transform-class-properties" '+"and enable loose mode, like so:\n"+'\t["@babel/plugin-proposal-decorators", { "version": "legacy" }]\n'+'\t["@babel/plugin-transform-class-properties", { "loose": true }]')}if(o&&!hasFeature(t,s.privateMethods)){throw o.buildCodeFrameError("Class private methods are not enabled. "+"Please add `@babel/plugin-transform-private-methods` to your configuration.")}if((i||a)&&!hasFeature(t,s.fields)&&!hasFeature(t,s.privateMethods)){throw e.buildCodeFrameError("Class fields are not enabled. "+"Please add `@babel/plugin-transform-class-properties` to your configuration.")}if(l&&!hasFeature(t,s.staticBlocks)){throw e.buildCodeFrameError("Static class blocks are not enabled. "+"Please add `@babel/plugin-transform-class-static-block` to your configuration.")}if(r||o||l){return true}if((i||a)&&hasFeature(t,s.fields)){return true}return false}},4697:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.buildCheckInRHS=buildCheckInRHS;t.buildFieldsInitNodes=buildFieldsInitNodes;t.buildPrivateNamesMap=buildPrivateNamesMap;t.buildPrivateNamesNodes=buildPrivateNamesNodes;t.privateNameVisitorFactory=privateNameVisitorFactory;t.transformPrivateNamesUsage=transformPrivateNamesUsage;var n=r(2358);var s=r(8026);var i=r(6721);var a=r(3034);var o=r(582);var l=r(344);var c=r(9102);var p=r(1238);{var newHelpers=e=>{return e.availableHelper("classPrivateFieldGet2")}}function buildPrivateNamesMap(e,t,r,s){const i=new Map;let a;for(const o of r){if(o.isPrivate()){const{name:r}=o.node.key.id;let l=i.get(r);if(!l){const n=!o.isProperty();const c=o.node.static;let p=false;let u;if(!t&&newHelpers(s)&&n&&!c){p=!!a;a!=null?a:a=o.scope.generateUidIdentifier(`${e}_brand`);u=a}else{u=o.scope.generateUidIdentifier(r)}l={id:u,static:c,method:n,initAdded:p};i.set(r,l)}if(o.isClassPrivateMethod()){if(o.node.kind==="get"){const{body:e}=o.node.body;let t;if(e.length===1&&n.types.isReturnStatement(t=e[0])&&n.types.isCallExpression(t=t.argument)&&t.arguments.length===1&&n.types.isThisExpression(t.arguments[0])&&n.types.isIdentifier(t=t.callee)){l.getId=n.types.cloneNode(t);l.getterDeclared=true}else{l.getId=o.scope.generateUidIdentifier(`get_${r}`)}}else if(o.node.kind==="set"){const{params:e}=o.node;const{body:t}=o.node.body;let s;if(t.length===1&&n.types.isExpressionStatement(s=t[0])&&n.types.isCallExpression(s=s.expression)&&s.arguments.length===2&&n.types.isThisExpression(s.arguments[0])&&n.types.isIdentifier(s.arguments[1],{name:e[0].name})&&n.types.isIdentifier(s=s.callee)){l.setId=n.types.cloneNode(s);l.setterDeclared=true}else{l.setId=o.scope.generateUidIdentifier(`set_${r}`)}}else if(o.node.kind==="method"){l.methodId=o.scope.generateUidIdentifier(r)}}i.set(r,l)}}return i}function buildPrivateNamesNodes(e,t,r,s){const i=[];const a=new Set;for(const[o,c]of e){const{static:e,method:p,getId:u,setId:d}=c;const f=u||d;const h=n.types.cloneNode(c.id);let m;if(t){m=n.types.callExpression(s.addHelper("classPrivateFieldLooseKey"),[n.types.stringLiteral(o)])}else if(r){m=n.types.callExpression(n.types.identifier("Symbol"),[n.types.stringLiteral(o)])}else if(!e){if(a.has(h.name))continue;a.add(h.name);m=n.types.newExpression(n.types.identifier(p&&(!f||newHelpers(s))?"WeakSet":"WeakMap"),[])}if(m){if(!r){(0,l.default)(m)}i.push(n.template.statement.ast`var ${h} = ${m}`)}}return i}function privateNameVisitorFactory(e){const t=s.visitors.environmentVisitor(Object.assign({},e));const r=Object.assign({},e,{Class(e){const{privateNamesMap:n}=this;const s=e.get("body.body");const i=new Map(n);const a=[];for(const e of s){if(!e.isPrivate())continue;const{name:t}=e.node.key.id;i.delete(t);a.push(t)}if(!a.length){return}e.get("body").traverse(t,Object.assign({},this,{redeclared:a}));e.traverse(r,Object.assign({},this,{privateNamesMap:i}));e.skipKey("body")}});return r}const u=privateNameVisitorFactory({PrivateName(e,{noDocumentAll:t}){const{privateNamesMap:r,redeclared:n}=this;const{node:s,parentPath:i}=e;if(!i.isMemberExpression({property:s})&&!i.isOptionalMemberExpression({property:s})){return}const{name:a}=s.id;if(!r.has(a))return;if(n!=null&&n.includes(a))return;this.handle(i,t)}});function unshadow(e,t,r){while((n=t)!=null&&n.hasBinding(e)&&!t.bindingIdentifierEquals(e,r)){var n;t.rename(e);t=t.parent}}function buildCheckInRHS(e,t,r){if(r||!(t.availableHelper!=null&&t.availableHelper("checkInRHS")))return e;return n.types.callExpression(t.addHelper("checkInRHS"),[e])}const d=privateNameVisitorFactory({BinaryExpression(e,{file:t}){const{operator:r,left:s,right:i}=e.node;if(r!=="in")return;if(!n.types.isPrivateName(s))return;const{privateFieldsAsProperties:a,privateNamesMap:o,redeclared:l}=this;const{name:c}=s.id;if(!o.has(c))return;if(l!=null&&l.includes(c))return;unshadow(this.classRef.name,e.scope,this.innerBinding);if(a){const{id:r}=o.get(c);e.replaceWith(n.template.expression.ast` |
| 39 | Object.prototype.hasOwnProperty.call(${buildCheckInRHS(i,t)}, ${n.types.cloneNode(r)}) |
| 40 | `);return}const{id:p,static:u}=o.get(c);if(u){e.replaceWith(n.template.expression.ast`${buildCheckInRHS(i,t)} === ${n.types.cloneNode(this.classRef)}`);return}e.replaceWith(n.template.expression.ast`${n.types.cloneNode(p)}.has(${buildCheckInRHS(i,t)})`)}});function readOnlyError(e,t){return n.types.callExpression(e.addHelper("readOnlyError"),[n.types.stringLiteral(`#${t}`)])}function writeOnlyError(e,t){if(!e.availableHelper("writeOnlyError")){console.warn(`@babel/helpers is outdated, update it to silence this warning.`);return n.types.buildUndefinedNode()}return n.types.callExpression(e.addHelper("writeOnlyError"),[n.types.stringLiteral(`#${t}`)])}function buildStaticPrivateFieldAccess(e,t){if(t)return e;return n.types.memberExpression(e,n.types.identifier("_"))}function autoInherits(e){return function(t){return n.types.inherits(e.apply(this,arguments),t.node)}}const f={memoise(e,t){const{scope:r}=e;const{object:n}=e.node;const s=r.maybeGenerateMemoised(n);if(!s){return}this.memoiser.set(n,s,t)},receiver(e){const{object:t}=e.node;if(this.memoiser.has(t)){return n.types.cloneNode(this.memoiser.get(t))}return n.types.cloneNode(t)},get:autoInherits((function(e){const{classRef:t,privateNamesMap:r,file:s,innerBinding:i,noUninitializedPrivateFieldAccess:a}=this;const o=e.node.property;const{name:l}=o.id;const{id:c,static:p,method:u,methodId:d,getId:f,setId:h}=r.get(l);const m=f||h;const cloneId=e=>n.types.inherits(n.types.cloneNode(e),o);if(p){unshadow(t.name,e.scope,i);if(!newHelpers(s)){const r=u&&!m?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return n.types.callExpression(s.addHelper(r),[this.receiver(e),n.types.cloneNode(t),cloneId(c)])}const r=this.receiver(e);const o=n.types.isIdentifier(r)&&r.name===t.name;if(!u){if(o){return buildStaticPrivateFieldAccess(cloneId(c),a)}return buildStaticPrivateFieldAccess(n.types.callExpression(s.addHelper("assertClassBrand"),[n.types.cloneNode(t),r,cloneId(c)]),a)}if(f){if(o){return n.types.callExpression(cloneId(f),[r])}return n.types.callExpression(s.addHelper("classPrivateGetter"),[n.types.cloneNode(t),r,cloneId(f)])}if(h){const e=n.types.buildUndefinedNode();if(o)return e;return n.types.sequenceExpression([n.types.callExpression(s.addHelper("assertClassBrand"),[n.types.cloneNode(t),r]),e])}if(o)return cloneId(c);return n.types.callExpression(s.addHelper("assertClassBrand"),[n.types.cloneNode(t),r,cloneId(c)])}if(u){if(m){if(!f){return n.types.sequenceExpression([this.receiver(e),writeOnlyError(s,l)])}if(!newHelpers(s)){return n.types.callExpression(s.addHelper("classPrivateFieldGet"),[this.receiver(e),cloneId(c)])}return n.types.callExpression(s.addHelper("classPrivateGetter"),[n.types.cloneNode(c),this.receiver(e),cloneId(f)])}if(!newHelpers(s)){return n.types.callExpression(s.addHelper("classPrivateMethodGet"),[this.receiver(e),n.types.cloneNode(c),cloneId(d)])}return n.types.callExpression(s.addHelper("assertClassBrand"),[n.types.cloneNode(c),this.receiver(e),cloneId(d)])}if(newHelpers(s)){return n.types.callExpression(s.addHelper("classPrivateFieldGet2"),[cloneId(c),this.receiver(e)])}return n.types.callExpression(s.addHelper("classPrivateFieldGet"),[this.receiver(e),cloneId(c)])})),boundGet(e){this.memoise(e,1);return n.types.callExpression(n.types.memberExpression(this.get(e),n.types.identifier("bind")),[this.receiver(e)])},set:autoInherits((function(e,t){const{classRef:r,privateNamesMap:s,file:i,noUninitializedPrivateFieldAccess:a}=this;const o=e.node.property;const{name:l}=o.id;const{id:c,static:p,method:u,setId:d,getId:f}=s.get(l);const h=f||d;const cloneId=e=>n.types.inherits(n.types.cloneNode(e),o);if(p){if(!newHelpers(i)){const s=u&&!h?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return n.types.callExpression(i.addHelper(s),[this.receiver(e),n.types.cloneNode(r),cloneId(c),t])}const s=this.receiver(e);const o=n.types.isIdentifier(s)&&s.name===r.name;if(u&&!d){const e=readOnlyError(i,l);if(o)return n.types.sequenceExpression([t,e]);return n.types.sequenceExpression([t,n.types.callExpression(i.addHelper("assertClassBrand"),[n.types.cloneNode(r),s]),readOnlyError(i,l)])}if(d){if(o){return n.types.callExpression(n.types.cloneNode(d),[s,t])}return n.types.callExpression(i.addHelper("classPrivateSetter"),[n.types.cloneNode(r),cloneId(d),s,t])}return n.types.assignmentExpression("=",buildStaticPrivateFieldAccess(cloneId(c),a),o?t:n.types.callExpression(i.addHelper("assertClassBrand"),[n.types.cloneNode(r),s,t]))}if(u){if(d){if(!newHelpers(i)){return n.types.callExpression(i.addHelper("classPrivateFieldSet"),[this.receiver(e),cloneId(c),t])}return n.types.callExpression(i.addHelper("classPrivateSetter"),[n.types.cloneNode(c),cloneId(d),this.receiver(e),t])}return n.types.sequenceExpression([this.receiver(e),t,readOnlyError(i,l)])}if(newHelpers(i)){return n.types.callExpression(i.addHelper("classPrivateFieldSet2"),[cloneId(c),this.receiver(e),t])}return n.types.callExpression(i.addHelper("classPrivateFieldSet"),[this.receiver(e),cloneId(c),t])})),destructureSet(e){const{classRef:t,privateNamesMap:r,file:s,noUninitializedPrivateFieldAccess:i}=this;const a=e.node.property;const{name:o}=a.id;const{id:l,static:c,method:p,setId:u}=r.get(o);const cloneId=e=>n.types.inherits(n.types.cloneNode(e),a);if(!newHelpers(s)){if(c){try{var d=s.addHelper("classStaticPrivateFieldDestructureSet")}catch(e){throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n"+"please update @babel/helpers to the latest version.")}return n.types.memberExpression(n.types.callExpression(d,[this.receiver(e),n.types.cloneNode(t),cloneId(l)]),n.types.identifier("value"))}return n.types.memberExpression(n.types.callExpression(s.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),cloneId(l)]),n.types.identifier("value"))}if(p&&!u){return n.types.memberExpression(n.types.sequenceExpression([e.node.object,readOnlyError(s,o)]),n.types.identifier("_"))}if(c&&!p){const t=this.get(e);if(!i||!n.types.isCallExpression(t)){return t}const r=t.arguments.pop();t.arguments.push(n.template.expression.ast`(_) => ${r} = _`);return n.types.memberExpression(n.types.callExpression(s.addHelper("toSetter"),[t]),n.types.identifier("_"))}const f=this.set(e,n.types.identifier("_"));if(!n.types.isCallExpression(f)||!n.types.isIdentifier(f.arguments[f.arguments.length-1],{name:"_"})){throw e.buildCodeFrameError("Internal Babel error while compiling this code. This is a Babel bug. "+"Please report it at https://github.com/babel/babel/issues.")}let h;if(n.types.isMemberExpression(f.callee,{computed:false})&&n.types.isIdentifier(f.callee.property)&&f.callee.property.name==="call"){h=[f.callee.object,n.types.arrayExpression(f.arguments.slice(1,-1)),f.arguments[0]]}else{h=[f.callee,n.types.arrayExpression(f.arguments.slice(0,-1))]}return n.types.memberExpression(n.types.callExpression(s.addHelper("toSetter"),h),n.types.identifier("_"))},call(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,false)},optionalCall(e,t){this.memoise(e,1);return(0,o.default)(this.get(e),this.receiver(e),t,true)},delete(){throw new Error("Internal Babel error: deleting private elements is a parsing error.")}};const h={get(e){const{privateNamesMap:t,file:r}=this;const{object:s}=e.node;const{name:i}=e.node.property.id;return n.template.expression`BASE(REF, PROP)[PROP]`({BASE:r.addHelper("classPrivateFieldLooseBase"),REF:n.types.cloneNode(s),PROP:n.types.cloneNode(t.get(i).id)})},set(){throw new Error("private name handler with loose = true don't need set()")},boundGet(e){return n.types.callExpression(n.types.memberExpression(this.get(e),n.types.identifier("bind")),[n.types.cloneNode(e.node.object)])},simpleSet(e){return this.get(e)},destructureSet(e){return this.get(e)},call(e,t){return n.types.callExpression(this.get(e),t)},optionalCall(e,t){return n.types.optionalCallExpression(this.get(e),t,true)},delete(){throw new Error("Internal Babel error: deleting private elements is a parsing error.")}};function transformPrivateNamesUsage(e,t,r,{privateFieldsAsProperties:n,noUninitializedPrivateFieldAccess:s,noDocumentAll:i,innerBinding:o},l){if(!r.size)return;const c=t.get("body");const p=n?h:f;(0,a.default)(c,u,Object.assign({privateNamesMap:r,classRef:e,file:l},p,{noDocumentAll:i,noUninitializedPrivateFieldAccess:s,innerBinding:o}));c.traverse(d,{privateNamesMap:r,classRef:e,file:l,privateFieldsAsProperties:n,innerBinding:o})}function buildPrivateFieldInitLoose(e,t,r){const{id:s}=r.get(t.node.key.id.name);const i=t.node.value||t.scope.buildUndefinedNode();return inheritPropComments(n.template.statement.ast` |
| 41 | Object.defineProperty(${e}, ${n.types.cloneNode(s)}, { |
| 42 | // configurable is false by default |
| 43 | // enumerable is false by default |
no test coverage detected
searching dependent graphs…