consterror=newError("[toJSONSchema]: Non-representable type encountered: "+def.type);
throwerror;
}
}
constparent=_zod._zod.parent;
if(parent){
if(!obj.ref){
obj.ref=parent;
}
process(parent,seen,merged);
constseen3=seen.seen;
seen3.get(parent).isParent=true;
}
}
constmetadataRegistry=seen.metadataRegistry;
value=metadataRegistry.get(_zod);
if(value){
const_Object2=Object;
constmerged1=Object.assign(obj.schema,value);
}
lettmp26="input"===seen.io;
if(tmp26){
tmp26=isTransforming(_zod);
}
if(tmp26){
constschema2=obj.schema;
deletetmp2.examples;
constschema3=obj.schema;
deletetmp2.default;
}
if(tmp28){
constschema4=obj.schema;
if(null==schema4.default){
schema4.default=obj.schema._prefault;
}
}
constschema5=obj.schema;
deletetmp._prefault;
constseen4=seen.seen;
returnseen4.get(_zod).schema;
}
}
obj={path:[],schemaPath:[]};
}
functionextractDefs(ctx,_idmap){
letclosure_0=ctx;
constseen=ctx.seen;
letvalue=seen.get(_idmap);
constexports=value;
if(value){
const_Map=Map;
constmap=newMap();
constseen2=tmp.seen;
constentries=seen2.entries();
constiter=entries[Symbol.iterator]();
constnextResult=iter.next();
while(iter!==undefined){
lettmp81=nextResult;
lettmp82=ctx;
letmetadataRegistry2=tmp.metadataRegistry;
value=metadataRegistry2.get(nextResult[0]);
letid;
if(null!=value){
lettmp17=value;
id=tmp84.id;
}
lettmp19=id;
if(id){
lettmp20=map;
lettmp21=id;
letvalue1=obj.get(tmp19);
if(value1){
lettmp24=value1;
lettmp25=nextResult;
if(tmp23!==tmp81[0]){
let_Error2=Error;
lettmp30=id;
let_HermesInternal=HermesInternal;
letstr2="Duplicate schema id \"";
letstr3="\" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.";
lettmp31=new.target;
lettmp32=new.target;
leterror=newError("Duplicate schema id \""+tmp19+"\" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.");
lettmp34=error;
throwerror;
}
}
lettmp26=map;
lettmp27=id;
lettmp28=nextResult;
letresult=obj.set(tmp19,tmp81[0]);
}
continue;
}
functionextractToDef(arg0){
if(!arg0[1].schema.$ref){
consttmp4=(functionmakeURI(arg0){
letstr="definitions";
if("draft-2020-12"===outer1_0.target){
str="$defs";
}
if(outer1_0.external){
constregistry=outer1_0.external.registry;
constvalue=registry.get(arg0[0]);
letid;
if(null!=value){
id=value.id;
}
letfn=outer1_0.external.uri;
if(null==fn){
fn=(__shared)=>__shared;
}
if(id){
letobj={ref:fn(id)};
returnobj;
}else{
letid2=arg0[1].defId;
if(null==id2){
id2=arg0[1].schema.id;
}
if(null==id2){
outer1_0.counter=+outer1_0.counter+1;
id2=`schema${tmp13}`;
}
arg0[1].defId=id2;
obj={defId:id2};
const_HermesInternal2=HermesInternal;
obj.ref=""+fn("__shared")+"#/"+str+"/"+id2;
returnobj;
}
}elseif(arg0[1]===outer1_1){
constobj1={ref:"#"};
returnobj1;
}else{
const_HermesInternal=HermesInternal;
id=arg0[1].schema.id;
constcombined="#/"+str+"/";
if(null==id){
outer1_0.counter=+outer1_0.counter+1;
id=`__schema${tmp6}`;
}
obj={defId:id,ref:combined+id};
returnobj;
}
})(arg0);
constdefId=tmp4.defId;
const_Object=Object;
arg0[1].def=Object.assign({},arg0[1].schema);
if(defId){
tmp3.defId=defId;
}
constschema=tmp3.schema;
for(constkey10020inschema){
lettmp7=key10020;
deletetmp[tmp2];
continue;
}
schema.$ref=tmp4.ref;
}
}
if("throw"===tmp.cycles){
constseen4=tmp.seen;
constentries1=seen4.entries();
constiter3=entries1[Symbol.iterator]();
while(iter3!==undefined){
lettmp37=iter3.next()[1];
lettmp38=tmp37;
if(tmp37.cycle){
let_Error3=Error;
letcycle=tmp37.cycle;
letobj2=cycle;
letjoined;
if(null!=cycle){
lettmp40=cycle;
letstr5="/";
joined=obj2.join("/");
}
let_HermesInternal2=HermesInternal;
letstr6="Cycle detected: #/";
letstr7="/<root>\n\nSet the `cycles` parameter to `\"ref\"` to resolve cyclical schemas with defs.";
letprototype4=_Error3.prototype;
lettmp41=new.target;
lettmp42=new.target;
_Error3=new_Error3("Cycle detected: #/"+joined+"/<root>\n\nSet the `cycles` parameter to `\"ref\"` to resolve cyclical schemas with defs.");
lettmp44=_Error3;
throw_Error3;
}
}
}
constseen3=tmp.seen;
constentries2=seen3.entries();
constiter2=entries2[Symbol.iterator]();
constnextResult1=iter2.next();
while(iter2!==undefined){
lettmp88=nextResult1;
lettmp89=nextResult1[1];
lettmp90=_idmap;
if(tmp2!==nextResult1[0]){
lettmp53=ctx;
if(tmp.external){
lettmp54=ctx;
letregistry=tmp.external.registry;
lettmp55=nextResult1;
letvalue2=registry.get(tmp88[0]);
if(null!=value2){
lettmp58=value2;
id=tmp57.id;
}
lettmp60=_idmap;
lettmp61=nextResult1;
if(tmp2!==tmp88[0]){
lettmp62=id;
if(tmp59){
lettmp78=extractToDef;
lettmp79=nextResult1;
letextractToDefResult=extractToDef(tmp88);
continue;
}
}
}
lettmp63=ctx;
letmetadataRegistry=tmp.metadataRegistry;
lettmp64=nextResult1;
letvalue3=metadataRegistry.get(tmp88[0]);
letid1;
if(null!=value3){
lettmp68=value3;
id1=tmp66.id;
}
letcycle2=id1;
if(!id1){
lettmp69=tmp89;
cycle2=tmp89.cycle;
}
lettmp70=cycle2;
if(!cycle2){
lettmp71=tmp89;
lettmp72=tmp89.count>1;
lettmp73=tmp72;
if(tmp72){
lettmp74=ctx;
tmp73="ref"===tmp.reused;
}
tmp70=tmp73;
}
if(tmp70){
lettmp75=extractToDef;
lettmp76=nextResult1;
letextractToDefResult1=extractToDef(tmp88);
}
}else{
lettmp50=extractToDef;
lettmp51=nextResult1;
letextractToDefResult2=extractToDef(tmp88);
}
continue;
}
}else{
const_Error=Error;
consterror1=newError("Unprocessed schema. This is a bug in Zod.");