{
  "version": 3,
  "sources": ["../../../../shared/src/assert.ts"],
  "sourcesContent": ["/**\n * Throws an error when the condition is falsy, optionally pass in a message to\n * describe the error.\n *\n * Best to use asserts where data is about to be stored. Then errors are caught\n * early, close to the cause. Otherwise data with broken expectation might hang\n * around, only to cause errors when used later on, with no pointer back to what\n * caused that bad state.\n *\n * Note that when an assert fails, consider that a fatal error caused by buggy\n * code. The program should halt, or perhaps do some kind of high level\n * recovery, and the bug should be reported and fixed. Asserts are not well\n * suited to use as defensive programming, but are good to use to quickly\n * highlight mistakes while writing new code.\n *\n * And finally, both the condition should be cheap, and the message should not\n * do string interpolation, instead you can pass in multiple parts of the\n * message.\n */\nexport function assert(condition: unknown, ...msg: unknown[]): asserts condition {\n\tif (condition) return\n\n\tconst e = Error(\"Assertion Error\" + (msg.length > 0 ? \": \" + msg.join(\" \") : \"\"))\n\t// Hack the stack so the assert call itself disappears. Works in jest and in chrome.\n\tif (e.stack) {\n\t\ttry {\n\t\t\tconst lines = e.stack.split(\"\\n\")\n\t\t\tif (lines[1]?.includes(\"assert\")) {\n\t\t\t\tlines.splice(1, 1)\n\t\t\t\te.stack = lines.join(\"\\n\")\n\t\t\t} else if (lines[0]?.includes(\"assert\")) {\n\t\t\t\tlines.splice(0, 1)\n\t\t\t\te.stack = lines.join(\"\\n\")\n\t\t\t}\n\t\t} catch {\n\t\t\t// nothing\n\t\t}\n\t}\n\tthrow e\n}\n\n/**\n * Asserts that a code path is never entered. Additionally, asserts that the provided\n * value is evaluated to `never` by the type system, which means all possible discrete\n * types have been exhaustively checked by the time this statement is reached.\n */\nexport function assertNever(x: never, error?: unknown): never {\n\tif (error instanceof Error) {\n\t\tthrow error\n\t}\n\tif (error !== undefined) {\n\t\tthrow new Error(String(error))\n\t}\n\tthrow new Error(x ? `Unexpected value: ${x}` : \"Application entered invalid state\")\n}\n"],
  "mappings": ";AAmBO,SAAS,OAAO,cAAuB,KAAmC;AAChF,MAAI,UAAW;AAEf,QAAM,IAAI,MAAM,qBAAqB,IAAI,SAAS,IAAI,OAAO,IAAI,KAAK,GAAG,IAAI,GAAG;AAEhF,MAAI,EAAE,OAAO;AACZ,QAAI;AACH,YAAM,QAAQ,EAAE,MAAM,MAAM,IAAI;AAChC,UAAI,MAAM,CAAC,GAAG,SAAS,QAAQ,GAAG;AACjC,cAAM,OAAO,GAAG,CAAC;AACjB,UAAE,QAAQ,MAAM,KAAK,IAAI;AAAA,MAC1B,WAAW,MAAM,CAAC,GAAG,SAAS,QAAQ,GAAG;AACxC,cAAM,OAAO,GAAG,CAAC;AACjB,UAAE,QAAQ,MAAM,KAAK,IAAI;AAAA,MAC1B;AAAA,IACD,QAAQ;AAAA,IAER;AAAA,EACD;AACA,QAAM;AACP;AAOO,SAAS,YAAY,GAAU,OAAwB;AAC7D,MAAI,iBAAiB,OAAO;AAC3B,UAAM;AAAA,EACP;AACA,MAAI,UAAU,QAAW;AACxB,UAAM,IAAI,MAAM,OAAO,KAAK,CAAC;AAAA,EAC9B;AACA,QAAM,IAAI,MAAM,IAAI,qBAAqB,CAAC,KAAK,mCAAmC;AACnF;",
  "names": []
}
