{
  "version": 3,
  "sources": ["../src-backend/json-schema.ts"],
  "sourcesContent": ["/**\n * The playground renders forms from JSON Schema, but `onMessage()` and\n * endpoint `body`/`query` accept any Standard Schema validator. Ask the\n * library to describe itself through the Standard JSON Schema interface,\n * falling back to the vendor's own converter for versions that predate it.\n */\n\n// specifier kept dynamic on purpose: these are the user's libraries, absent\n// from our own dependency tree\nconst optional = (name: string) => import(name).catch(() => undefined);\n\nconst vendorConverters: Record<string, (schema: any) => Promise<any>> = {\n  zod: async (schema) => (await optional('zod'))?.toJSONSchema(schema), // zod < 4.2\n  valibot: async (schema) => (await optional('@valibot/to-json-schema'))?.toJsonSchema(schema),\n  // effect 3 converts directly; effect 4 upgrades the schema to the interface above\n  effect: async (schema) => {\n    const effect = await optional('effect');\n    return effect?.JSONSchema?.make(schema) ?? toJSONSchema(effect?.Schema?.toStandardJSONSchemaV1(schema));\n  },\n};\n\n/**\n * Best-effort JSON Schema for a Standard Schema validator.\n *\n * Returns `null` when the validator can't describe itself \u2014 the UI falls back\n * to a free-form editor. Never throws: a validator the playground can't\n * introspect must not block a room join.\n */\nexport async function toJSONSchema(schema: any): Promise<any | null> {\n  const standard = schema?.['~standard'];\n  if (!standard) { return null; }\n\n  // Standard JSON Schema (@standard-schema/spec 1.1): zod >= 4.2, arktype,\n  // effect (via Schema.toStandardJSONSchemaV1()), sury, ...\n  try {\n    if (standard.jsonSchema) {\n      return standard.jsonSchema.input({ target: 'draft-2020-12' });\n    }\n  } catch (e) { /* target unsupported, or not describable */ }\n\n  try {\n    return await vendorConverters[standard.vendor]?.(schema) ?? null;\n  } catch (e) { /* converter not installed, or not describable */ }\n\n  return null;\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,WAAW,CAAC,SAAiB,OAAO,MAAM,MAAM,MAAM,MAAS;AAErE,IAAM,mBAAkE;AAAA,EACtE,KAAK,OAAO,WAAQ;AAZtB;AAY0B,uBAAM,SAAS,KAAK,MAApB,mBAAwB,aAAa;AAAA;AAAA;AAAA,EAC7D,SAAS,OAAO,WAAQ;AAb1B;AAa8B,uBAAM,SAAS,yBAAyB,MAAxC,mBAA4C,aAAa;AAAA;AAAA;AAAA,EAErF,QAAQ,OAAO,WAAW;AAf5B;AAgBI,UAAM,SAAS,MAAM,SAAS,QAAQ;AACtC,YAAO,4CAAQ,eAAR,mBAAoB,KAAK,YAAzB,YAAoC,cAAa,sCAAQ,WAAR,mBAAgB,uBAAuB,OAAO;AAAA,EACxG;AACF;AASA,eAAsB,aAAa,QAAkC;AA5BrE;AA6BE,QAAM,WAAW,iCAAS;AAC1B,MAAI,CAAC,UAAU;AAAE,WAAO;AAAA,EAAM;AAI9B,MAAI;AACF,QAAI,SAAS,YAAY;AACvB,aAAO,SAAS,WAAW,MAAM,EAAE,QAAQ,gBAAgB,CAAC;AAAA,IAC9D;AAAA,EACF,SAAS,GAAP;AAAA,EAAyD;AAE3D,MAAI;AACF,YAAO,aAAM,sBAAiB,SAAS,YAA1B,0CAAoC,aAA1C,YAAqD;AAAA,EAC9D,SAAS,GAAP;AAAA,EAA8D;AAEhE,SAAO;AACT;",
  "names": []
}
