"use strict";const h=require("../../../../../../../_virtual/parse.js"),f=require("../../../../../@babel_types@7.18.7/node_modules/@babel/types/lib/index.js");require("../../../../../@babel_parser@7.18.6/node_modules/@babel/parser/lib/index.js");require("../../../../../@babel_code-frame@7.18.6/node_modules/@babel/code-frame/lib/index.js");const m=require("../../../../../../../_virtual/index4.js"),_=require("../../../../../../../_virtual/index39.js");Object.defineProperty(h.__exports,"__esModule",{value:!0});h.__exports.default=A;var y=f.__require(),v=m.__exports,g=_.__exports;const{isCallExpression:b,isExpressionStatement:x,isFunction:P,isIdentifier:R,isJSXIdentifier:w,isNewExpression:L,isPlaceholder:d,isStatement:E,isStringLiteral:p,removePropertiesDeep:j,traverse:S}=y,q=/^[_$A-Z0-9]+$/;function A(l,r,e){const{placeholderWhitelist:t,placeholderPattern:i,preserveComments:s,syntacticPlaceholders:n}=e,a=F(r,e.parser,n);j(a,{preserveComments:s}),l.validate(a);const o={placeholders:[],placeholderNames:new Set},c={placeholders:[],placeholderNames:new Set},u={value:void 0};return S(a,N,{syntactic:o,legacy:c,isLegacyRef:u,placeholderWhitelist:t,placeholderPattern:i,syntacticPlaceholders:n}),Object.assign({ast:a},u.value?c:o)}function N(l,r,e){var t;let i;if(d(l)){if(e.syntacticPlaceholders===!1)throw new Error("%%foo%%-style placeholders can't be used when '.syntacticPlaceholders' is false.");i=l.name.name,e.isLegacyRef.value=!1}else{if(e.isLegacyRef.value===!1||e.syntacticPlaceholders)return;if(R(l)||w(l))i=l.name,e.isLegacyRef.value=!0;else if(p(l))i=l.value,e.isLegacyRef.value=!0;else return}if(!e.isLegacyRef.value&&(e.placeholderPattern!=null||e.placeholderWhitelist!=null))throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible with '.syntacticPlaceholders: true'");if(e.isLegacyRef.value&&(e.placeholderPattern===!1||!(e.placeholderPattern||q).test(i))&&!((t=e.placeholderWhitelist)!=null&&t.has(i)))return;r=r.slice();const{node:s,key:n}=r[r.length-1];let a;p(l)||d(l,{expectedNode:"StringLiteral"})?a="string":L(s)&&n==="arguments"||b(s)&&n==="arguments"||P(s)&&n==="params"?a="param":x(s)&&!d(l)?(a="statement",r=r.slice(0,-1)):E(l)&&d(l)?a="statement":a="other";const{placeholders:o,placeholderNames:c}=e.isLegacyRef.value?e.legacy:e.syntactic;o.push({name:i,type:a,resolve:u=>W(u,r),isDuplicate:c.has(i)}),c.add(i)}function W(l,r){let e=l;for(let s=0;s<r.length-1;s++){const{key:n,index:a}=r[s];a===void 0?e=e[n]:e=e[n][a]}const{key:t,index:i}=r[r.length-1];return{parent:e,key:t,index:i}}function F(l,r,e){const t=(r.plugins||[]).slice();e!==!1&&t.push("placeholders"),r=Object.assign({allowReturnOutsideFunction:!0,allowSuperOutsideMethod:!0,sourceType:"module"},r,{plugins:t});try{return(0,v.parse)(l,r)}catch(i){const s=i.loc;throw s&&(i.message+=`
`+(0,g.codeFrameColumns)(l,{start:s}),i.code="BABEL_TEMPLATE_PARSE_ERROR"),i}}
//# sourceMappingURL=parse.js.map
