"use strict";const p=require("../../../../../../../_virtual/builder.js");require("./options.js");require("./string.js");require("./literal.js");const h=require("../../../../../../../_virtual/options.js"),w=require("../../../../../../../_virtual/string.js"),x=require("../../../../../../../_virtual/literal.js");Object.defineProperty(p.__exports,"__esModule",{value:!0});p.__exports.default=_;var r=h.__exports,c=w.__exports,l=x.__exports;const d=(0,r.validate)({placeholderPattern:!1});function _(n,u){const i=new WeakMap,s=new WeakMap,o=u||(0,r.validate)(null);return Object.assign((e,...a)=>{if(typeof e=="string"){if(a.length>1)throw new Error("Unexpected extra params.");return f((0,c.default)(n,e,(0,r.merge)(o,(0,r.validate)(a[0]))))}else if(Array.isArray(e)){let t=i.get(e);return t||(t=(0,l.default)(n,e,o),i.set(e,t)),f(t(a))}else if(typeof e=="object"&&e){if(a.length>0)throw new Error("Unexpected extra params.");return _(n,(0,r.merge)(o,(0,r.validate)(e)))}throw new Error(`Unexpected template param ${typeof e}`)},{ast:(e,...a)=>{if(typeof e=="string"){if(a.length>1)throw new Error("Unexpected extra params.");return(0,c.default)(n,e,(0,r.merge)((0,r.merge)(o,(0,r.validate)(a[0])),d))()}else if(Array.isArray(e)){let t=s.get(e);return t||(t=(0,l.default)(n,e,(0,r.merge)(o,d)),s.set(e,t)),t(a)()}throw new Error(`Unexpected template param ${typeof e}`)}})}function f(n){let u="";try{throw new Error}catch(i){i.stack&&(u=i.stack.split(`
`).slice(3).join(`
`))}return i=>{try{return n(i)}catch(s){throw s.stack+=`
    =============
${u}`,s}}}
//# sourceMappingURL=builder.js.map
