"use strict";const e=require("../../../../../../../_virtual/populate.js"),h=require("../../../../../@babel_types@7.18.7/node_modules/@babel/types/lib/index.js");Object.defineProperty(e.__exports,"__esModule",{value:!0});e.__exports.default=l;var w=h.__require();const{blockStatement:g,cloneNode:a,emptyStatement:_,expressionStatement:u,identifier:y,isStatement:b,isStringLiteral:A,stringLiteral:E,validate:d}=w;function l(t,r){const i=a(t.ast);return r&&(t.placeholders.forEach(s=>{if(!Object.prototype.hasOwnProperty.call(r,s.name)){const o=s.name;throw new Error(`Error: No substitution given for "${o}". If this is not meant to be a
            placeholder you may want to consider passing one of the following options to @babel/template:
            - { placeholderPattern: false, placeholderWhitelist: new Set(['${o}'])}
            - { placeholderPattern: /^${o}$/ }`)}}),Object.keys(r).forEach(s=>{if(!t.placeholderNames.has(s))throw new Error(`Unknown substitution "${s}" given`)})),t.placeholders.slice().reverse().forEach(s=>{try{v(s,i,r&&r[s.name]||null)}catch(o){throw o.message=`@babel/template placeholder "${s.name}": ${o.message}`,o}}),i}function v(t,r,i){t.isDuplicate&&(Array.isArray(i)?i=i.map(f=>a(f)):typeof i=="object"&&(i=a(i)));const{parent:s,key:o,index:n}=t.resolve(r);if(t.type==="string"){if(typeof i=="string"&&(i=E(i)),!i||!A(i))throw new Error("Expected string substitution")}else if(t.type==="statement")n===void 0?i?Array.isArray(i)?i=g(i):typeof i=="string"?i=u(y(i)):b(i)||(i=u(i)):i=_():i&&!Array.isArray(i)&&(typeof i=="string"&&(i=y(i)),b(i)||(i=u(i)));else if(t.type==="param"){if(typeof i=="string"&&(i=y(i)),n===void 0)throw new Error("Assertion failure.")}else if(typeof i=="string"&&(i=y(i)),Array.isArray(i))throw new Error("Cannot replace single expression with an array.");if(n===void 0)d(s,o,i),s[o]=i;else{const f=s[o].slice();t.type==="statement"||t.type==="param"?i==null?f.splice(n,1):Array.isArray(i)?f.splice(n,1,...i):f[n]=i:f[n]=i,d(s,o,f),s[o]=f}}
//# sourceMappingURL=populate.js.map
