"use strict";const n=require("quicktype-core"),y=async(s,t="Root",i={})=>{const{indentation:p=2}=i;let e=!1;try{e=Array.isArray(JSON.parse(s))}catch(u){throw new Error(String(u))}const a=n.jsonInputForTargetLanguage("typescript");await a.addSource({name:e?`${t}Element`:t,samples:[s]});const o=new n.InputData;o.addInput(a);const{lines:c}=await n.quicktype({inputData:o,lang:"typescript",rendererOptions:{"just-types":!0},indentation:" ".repeat(p)});let r=c.join(` `);return e&&(r=r+` export type ${t} = ${t}Element[];`),r};module.exports=y;