{"version":3,"sources":["../../src/facade/to-object.ts"],"sourcesContent":["/**\r\n * Interface for objects that support conversion to plain JavaScript objects.\r\n */\r\nexport interface Jsonable {\r\n  toJSON(options?: { skipErrors?: boolean }): any;\r\n  toObject?(options?: { skipErrors?: boolean }): any;\r\n}\r\n\r\n/**\r\n * Converts a \"Jsonable\" value (one with `toObject` or `toJSON` methods)\r\n * into a plain JavaScript object/value.\r\n *\r\n * This function is the primary entry point for converting IO instances\r\n * back to standard JavaScript data structures.\r\n *\r\n * @param value - The value to convert. Must implement `toObject` or `toJSON`.\r\n * @param options - Conversion options.\r\n * @throws {TypeError} If the value is null/undefined or does not have conversion methods.\r\n * @returns The plain JavaScript representation.\r\n */\r\nexport function toObject(value: Jsonable, options?: { skipErrors?: boolean }): any {\r\n  if (value === null || value === undefined) {\r\n    throw new TypeError('io.toObject() expects a Jsonable value, received null/undefined');\r\n  }\r\n\r\n  const toObjectFn = (value as any).toObject;\r\n  if(typeof toObjectFn === 'function') {\r\n    return toObjectFn.call(value, options);\r\n  }\r\n\r\n  const toJSONFn = (value as any).toJSON;\r\n  if (typeof toJSONFn === 'function') {\r\n    return toJSONFn.call(value, options);\r\n  }\r\n\r\n  throw new TypeError('io.toObject() expects a Jsonable value (object with toObject() or toJSON())');\r\n}\r\n\r\n/**\r\n * Alias for `toObject`.\r\n */\r\nexport const toJSON = toObject;\r\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBO,SAAS,SAAS,OAAiB,SAAyC;AACjF,MAAI,UAAU,QAAQ,UAAU,QAAW;AACzC,UAAM,IAAI,UAAU,iEAAiE;AAAA,EACvF;AAEA,QAAM,aAAc,MAAc;AAClC,MAAG,OAAO,eAAe,YAAY;AACnC,WAAO,WAAW,KAAK,OAAO,OAAO;AAAA,EACvC;AAEA,QAAM,WAAY,MAAc;AAChC,MAAI,OAAO,aAAa,YAAY;AAClC,WAAO,SAAS,KAAK,OAAO,OAAO;AAAA,EACrC;AAEA,QAAM,IAAI,UAAU,6EAA6E;AACnG;AAKO,MAAM,SAAS;","names":[]}