@gusto/baerly-storage 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/README.md +157 -92
  2. package/dist/API.md +64 -32
  3. package/dist/CHANGELOG.md +295 -5
  4. package/dist/RECIPES.md +125 -0
  5. package/dist/THIRD-PARTY-LICENSES.txt +22 -96
  6. package/dist/{app-config-BIzyAKzy.d.ts → app-config-DyiFK3_k.d.ts} +43 -11
  7. package/dist/app-config.d.ts +1 -1
  8. package/dist/auth.d.ts +1 -1
  9. package/dist/auth.js +13 -13
  10. package/dist/auth.js.map +1 -1
  11. package/dist/aws4fetch.esm-p7eEzLCs.js +1702 -0
  12. package/dist/aws4fetch.esm-p7eEzLCs.js.map +1 -0
  13. package/dist/baerly.js +35 -15
  14. package/dist/baerly.js.map +1 -1
  15. package/dist/baerly.spec.json +342 -0
  16. package/dist/{client-BJXF3XJA.d.ts → client-Fe8CwB73.d.ts} +3 -3
  17. package/dist/client-react.d.ts +3 -3
  18. package/dist/client-react.js +4 -4
  19. package/dist/client-react.js.map +1 -1
  20. package/dist/client.d.ts +4 -4
  21. package/dist/client.js +3 -3
  22. package/dist/{cloudflare-Cn2ibODt.js → cloudflare-DzKBrUlg.js} +2 -2
  23. package/dist/{cloudflare-Cn2ibODt.js.map → cloudflare-DzKBrUlg.js.map} +1 -1
  24. package/dist/cloudflare.d.ts +49 -6
  25. package/dist/cloudflare.js +55 -21
  26. package/dist/cloudflare.js.map +1 -1
  27. package/dist/config-1tv0-Yzm.js +2693 -0
  28. package/dist/config-1tv0-Yzm.js.map +1 -0
  29. package/dist/constants-CfeMWQWk.js +222 -0
  30. package/dist/constants-CfeMWQWk.js.map +1 -0
  31. package/dist/{cost-BZ_MDBmn.js → cost-DSMIVqzL.js} +42 -43
  32. package/dist/cost-DSMIVqzL.js.map +1 -0
  33. package/dist/{current-json-DsN7FNY1.js → current-json-C6nhPOm1.js} +6 -204
  34. package/dist/current-json-C6nhPOm1.js.map +1 -0
  35. package/dist/{db-CCT6tDfY.d.ts → db-DsPkOVEH.d.ts} +3 -3
  36. package/dist/{deploy-BKKyGlSJ.js → deploy-DonTr-CV.js} +4 -4
  37. package/dist/{deploy-BKKyGlSJ.js.map → deploy-DonTr-CV.js.map} +1 -1
  38. package/dist/dev-vite.d.ts +9 -5
  39. package/dist/dev-vite.js +5 -4
  40. package/dist/dev-vite.js.map +1 -1
  41. package/dist/dev.d.ts +1 -1
  42. package/dist/dev.js +1 -1
  43. package/dist/{doctor-BVU4GNXN.js → doctor-DSIyCDg_.js} +5 -8
  44. package/dist/{doctor-BVU4GNXN.js.map → doctor-DSIyCDg_.js.map} +1 -1
  45. package/dist/{dump-DPEAKub6.js → dump-Bh5k26VQ.js} +9 -32
  46. package/dist/dump-Bh5k26VQ.js.map +1 -0
  47. package/dist/{errors-DOdL95kK.js → errors-Dfa3p78c.js} +25 -5
  48. package/dist/errors-Dfa3p78c.js.map +1 -0
  49. package/dist/{export-BcuCLFFe.js → export-DtF5tDIM.js} +9 -32
  50. package/dist/{export-BcuCLFFe.js.map → export-DtF5tDIM.js.map} +1 -1
  51. package/dist/{fsck-RXgLOaJG.js → fsck-D_djMO5D.js} +10 -33
  52. package/dist/fsck-D_djMO5D.js.map +1 -0
  53. package/dist/{http-Bd4byR4n.js → http-DxM9MflO.js} +123 -35
  54. package/dist/http-DxM9MflO.js.map +1 -0
  55. package/dist/http.d.ts +42 -26
  56. package/dist/http.js +3 -2
  57. package/dist/{index-DnBGSeuU.d.ts → index-0rZcMBwy.d.ts} +2 -2
  58. package/dist/{index-Cmsxx-ZN.d.ts → index-B6oexfOB.d.ts} +7 -7
  59. package/dist/{index-BDceQQi-.d.ts → index-BNRh23K9.d.ts} +4 -4
  60. package/dist/{index-DW7GT6M2.d.ts → index-BYk9oCNf.d.ts} +193 -163
  61. package/dist/index.d.ts +6 -6
  62. package/dist/index.js +4 -4
  63. package/dist/{indexes-Cx7uMXm0.d.ts → indexes-Dn9hbGQG.d.ts} +2 -2
  64. package/dist/{inspect-DhI49PSi.js → inspect-6WZ-pC7-.js} +10 -33
  65. package/dist/inspect-6WZ-pC7-.js.map +1 -0
  66. package/dist/key-Di6yyxFu.js +35 -0
  67. package/dist/key-Di6yyxFu.js.map +1 -0
  68. package/dist/{log-tail-DXeDkWEp.js → log-tail-D98U1JBo.js} +31 -7
  69. package/dist/log-tail-D98U1JBo.js.map +1 -0
  70. package/dist/{maintenance-CWBQpZ2y.js → maintenance-B4Dki6Ig.js} +77 -22
  71. package/dist/maintenance-B4Dki6Ig.js.map +1 -0
  72. package/dist/{maintenance-BkhUr72A.d.ts → maintenance-B_e0T99L.d.ts} +28 -5
  73. package/dist/{maintenance-C_KSkVjd.js → maintenance-C7coQp4c.js} +17 -16
  74. package/dist/maintenance-C7coQp4c.js.map +1 -0
  75. package/dist/maintenance.d.ts +3 -3
  76. package/dist/maintenance.js +3 -3
  77. package/dist/node.d.ts +168 -65
  78. package/dist/node.js +3 -2
  79. package/dist/{normalize-XWY25_sG.js → normalize-rjnZLwS4.js} +2 -2
  80. package/dist/normalize-rjnZLwS4.js.map +1 -0
  81. package/dist/{observability-BYd-RzEx.js → observability-wzs3-BL_.js} +233 -71
  82. package/dist/observability-wzs3-BL_.js.map +1 -0
  83. package/dist/observability.d.ts +2 -2
  84. package/dist/observability.js +1 -1
  85. package/dist/{plan-DIu_B6fy.js → plan-a7PJHBCy.js} +2 -2
  86. package/dist/{plan-DIu_B6fy.js.map → plan-a7PJHBCy.js.map} +1 -1
  87. package/dist/{query-sQNO5vU_.js → query-rAtXNQQB.js} +96 -207
  88. package/dist/query-rAtXNQQB.js.map +1 -0
  89. package/dist/{rebuild-index-DP4CqSSs.js → rebuild-index-BVzQSZlm.js} +9 -32
  90. package/dist/rebuild-index-BVzQSZlm.js.map +1 -0
  91. package/dist/{request-BEF_OvMh.js → request-u0M51mhJ.js} +3 -3
  92. package/dist/{request-BEF_OvMh.js.map → request-u0M51mhJ.js.map} +1 -1
  93. package/dist/{restore-DpQYef6r.js → restore-R-4rbciV.js} +73 -100
  94. package/dist/restore-R-4rbciV.js.map +1 -0
  95. package/dist/runtime-spec-qL3_lTTU.js +391 -0
  96. package/dist/runtime-spec-qL3_lTTU.js.map +1 -0
  97. package/dist/s3-http-B-z8th6O.d.ts +60 -0
  98. package/dist/s3.d.ts +47 -0
  99. package/dist/s3.js +45 -0
  100. package/dist/s3.js.map +1 -0
  101. package/dist/{shared-secret-BJdSwpgw.js → shared-secret-DgEicd3x.js} +13 -5
  102. package/dist/shared-secret-DgEicd3x.js.map +1 -0
  103. package/dist/src-BG20LZs7.js +2271 -0
  104. package/dist/src-BG20LZs7.js.map +1 -0
  105. package/dist/{src-Db4-qVtM.js → src-CYHFDrKz.js} +51 -8
  106. package/dist/src-CYHFDrKz.js.map +1 -0
  107. package/dist/{src-CWpkSbvJ.js → src-DYZ4H1aF.js} +6 -5
  108. package/dist/src-DYZ4H1aF.js.map +1 -0
  109. package/dist/{subcommand-CP9NY2J4.js → subcommand-DoDA-K7d.js} +44 -6
  110. package/dist/subcommand-DoDA-K7d.js.map +1 -0
  111. package/dist/time-DUqvFMHq.js +119 -0
  112. package/dist/time-DUqvFMHq.js.map +1 -0
  113. package/dist/{usage-CTfDq9HR.js → usage-DBV1eQHC.js} +7 -22
  114. package/dist/usage-DBV1eQHC.js.map +1 -0
  115. package/dist/wire-izfGZDvr.js.map +1 -1
  116. package/package.json +52 -28
  117. package/dist/config-CGyBopy3.js +0 -5326
  118. package/dist/config-CGyBopy3.js.map +0 -1
  119. package/dist/cost-BZ_MDBmn.js.map +0 -1
  120. package/dist/current-json-DsN7FNY1.js.map +0 -1
  121. package/dist/dump-DPEAKub6.js.map +0 -1
  122. package/dist/errors-DOdL95kK.js.map +0 -1
  123. package/dist/fsck-RXgLOaJG.js.map +0 -1
  124. package/dist/http-Bd4byR4n.js.map +0 -1
  125. package/dist/inspect-DhI49PSi.js.map +0 -1
  126. package/dist/log-tail-DXeDkWEp.js.map +0 -1
  127. package/dist/maintenance-CWBQpZ2y.js.map +0 -1
  128. package/dist/maintenance-C_KSkVjd.js.map +0 -1
  129. package/dist/normalize-XWY25_sG.js.map +0 -1
  130. package/dist/observability-BYd-RzEx.js.map +0 -1
  131. package/dist/query-sQNO5vU_.js.map +0 -1
  132. package/dist/rebuild-index-DP4CqSSs.js.map +0 -1
  133. package/dist/restore-DpQYef6r.js.map +0 -1
  134. package/dist/shared-secret-BJdSwpgw.js.map +0 -1
  135. package/dist/src-CWpkSbvJ.js.map +0 -1
  136. package/dist/src-D24wDpzR.js +0 -6247
  137. package/dist/src-D24wDpzR.js.map +0 -1
  138. package/dist/src-Db4-qVtM.js.map +0 -1
  139. package/dist/subcommand-CP9NY2J4.js.map +0 -1
  140. package/dist/usage-CTfDq9HR.js.map +0 -1
  141. /package/dist/{chunk-EAsCxrDo.js → rolldown-runtime-EAsCxrDo.js} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"observability-BYd-RzEx.js","names":["getLogger","inspect","util","util.inspect","logtapeGetLogger"],"sources":["../packages/server/src/contract.ts","../node_modules/.pnpm/@logtape+logtape@2.1.3/node_modules/@logtape/logtape/dist/context.js","../node_modules/.pnpm/@logtape+logtape@2.1.3/node_modules/@logtape/logtape/dist/level.js","../node_modules/.pnpm/@logtape+logtape@2.1.3/node_modules/@logtape/logtape/dist/logger.js","../node_modules/.pnpm/@logtape+logtape@2.1.3/node_modules/@logtape/logtape/dist/filter.js","../node_modules/.pnpm/@logtape+logtape@2.1.3/node_modules/@logtape/logtape/dist/util.js","../node_modules/.pnpm/@logtape+logtape@2.1.3/node_modules/@logtape/logtape/dist/formatter.js","../node_modules/.pnpm/@logtape+logtape@2.1.3/node_modules/@logtape/logtape/dist/sink.js","../node_modules/.pnpm/@logtape+logtape@2.1.3/node_modules/@logtape/logtape/dist/config.js","../packages/server/src/observability/logger.ts","../packages/server/src/observability/derive-outcome.ts","../packages/server/src/observability/canonical.ts","../packages/server/src/observability/storage.ts"],"sourcesContent":["import type { LogEntry, BaerlyErrorCode } from \"@baerly/protocol\";\n\n/**\n * Wire envelope for every error response. Mirrors `BaerlyError` so\n * the client SDK reconstructs the same class shape it would see\n * in-process. `code` is the discriminant; `cause` is never sent on\n * the wire.\n */\nexport interface HttpErrorEnvelope {\n readonly error: {\n readonly code: BaerlyErrorCode;\n readonly message: string;\n /**\n * Field-path issues, present only when `code === \"SchemaError\"`.\n * Each entry is `{ path, message }` where `path` is the dotted\n * key list from the validator. Older clients see this field as\n * `unknown` and ignore it; new clients destructure it for form-\n * side rendering.\n */\n readonly issues?: ReadonlyArray<{\n readonly path: ReadonlyArray<string | number>;\n readonly message: string;\n }>;\n };\n}\n\n/**\n * Single drift surface for the {@link HttpErrorEnvelope} shape. The\n * router and both adapters call this — adding or renaming a field on\n * the wire is a one-edit change here.\n */\nexport const errorEnvelope = (\n code: BaerlyErrorCode,\n message: string,\n issues?: ReadonlyArray<{ path: ReadonlyArray<string | number>; message: string }>,\n): HttpErrorEnvelope => ({\n error: {\n code,\n message,\n ...(issues !== undefined && issues.length > 0 ? { issues } : {}),\n },\n});\n\n/**\n * Metadata embedded in every successful read response.\n *\n * - `manifest_pointer` is an opaque-to-the-consumer string cursor\n * identifying the `current.json` generation this read folded over.\n * Today's format is `\"<snapshot>@<tail_hint>\"` where `<snapshot>` is\n * the literal `\"none\"` when `CurrentJson.snapshot` is `null`. Treat\n * as opaque on the wire — the shape may change in a future minor\n * without breaking destructuring consumers.\n * - `fresh` is `true` iff this read advanced the locally-cached\n * pointer (cold path); `false` iff it served from the cached view\n * (cached pointer was unchanged).\n */\nexport interface HttpOkMeta {\n readonly manifest_pointer: string;\n readonly fresh: boolean;\n}\n\n/** Successful single-doc / single-result wrapper. */\nexport interface HttpOkEnvelope<T> {\n readonly data: T;\n readonly _meta: HttpOkMeta;\n}\n\n/**\n * Long-poll response. `events` is the slice of `LogEntry`s between\n * the request's `cursor` and `next_cursor`. Client passes\n * `next_cursor` back on the next call. Empty `events` + same\n * `next_cursor` means \"nothing changed within the budget\"\n * (default budget: ~25s).\n */\nexport interface SinceResponse {\n readonly events: ReadonlyArray<LogEntry>;\n readonly next_cursor: string;\n}\n\n/**\n * URL contract. Path segments are typed as template literals so\n * the router gets compile-time route-table checks. The\n * `tenant` derives from the `Verifier`'s output, not the URL —\n * URLs carry `app` / `table` / `id` only.\n */\nexport type Routes =\n /** Read one document. → `HttpOkEnvelope<DocumentData>` | 404. */\n | { method: \"GET\"; path: `/v1/c/${string}/${string}` }\n /** List rows matching a predicate (in query string). */\n | { method: \"GET\"; path: `/v1/c/${string}` }\n /** Insert. Body: `{ doc: DocumentData }`. */\n | { method: \"POST\"; path: `/v1/c/${string}` }\n /** JSON-merge-patch. Body: `{ patch: DocumentData }`. Response: `{ modified: number }`. */\n | { method: \"PATCH\"; path: `/v1/c/${string}/${string}` }\n /** Delete row by id. */\n | { method: \"DELETE\"; path: `/v1/c/${string}/${string}` }\n /** Long-poll log. Query: `?cursor=<opaque>`. Response: `SinceResponse`. */\n | { method: \"GET\"; path: `/v1/since` };\n\n/**\n * Status-code policy. Listed here so the client SDK and the\n * conformance suite share one source of truth.\n *\n * | Status | Meaning |\n * |--------|------------------------------------------------------------------|\n * | 200 | `GET` read → `HttpOkEnvelope<T>`. `GET /v1/since` → `SinceResponse`. `PATCH` → `{ modified: number }`. |\n * | 201 | `POST` insert success — body `{ _id }`. |\n * | 204 | `DELETE` success — no body. |\n * | 304 | Reserved. Long-poll idleness ships as 200 + empty events. |\n * | 400 | Body parse failed → `HttpErrorEnvelope` `code:\"SchemaError\"`. |\n * | 401 | `Verifier` returned null → `code:\"Unauthorized\"`, `message: \"Missing or invalid Authorization header\"`. |\n * | 403 | Auth ok but tenant prefix denied → `code:\"AccessDenied\"`. |\n * | 404 | Doc not found → `code:\"NotFound\"`. NOT used for \"tenant unknown\" (→ 401). |\n * | 409 | CAS lost → `code:\"Conflict\"`. |\n * | 413 | Request body exceeded `MAX_BODY_BYTES` → `code:\"PayloadTooLarge\"`. |\n * | 500 | Anything else → `code:\"Internal\"`. |\n */\nexport type HttpStatus = 200 | 201 | 204 | 304 | 400 | 401 | 403 | 404 | 409 | 413 | 500;\n","import { LoggerImpl } from \"./logger.js\";\n\n//#region src/context.ts\n/**\n* Internal symbol for storing category prefix in context.\n*/\nconst categoryPrefixSymbol = Symbol.for(\"logtape.categoryPrefix\");\n/**\n* Runs a callback with the given implicit context. Every single log record\n* in the callback will have the given context.\n*\n* If no `contextLocalStorage` is configured, this function does nothing and\n* just returns the return value of the callback. It also logs a warning to\n* the `[\"logtape\", \"meta\"]` logger in this case.\n* @param context The context to inject.\n* @param callback The callback to run.\n* @returns The return value of the callback.\n* @since 0.7.0\n*/\nfunction withContext(context, callback) {\n\tconst rootLogger = LoggerImpl.getLogger();\n\tif (rootLogger.contextLocalStorage == null) {\n\t\tLoggerImpl.getLogger([\"logtape\", \"meta\"]).warn(\"Context-local storage is not configured. Specify contextLocalStorage option in the configure() function.\");\n\t\treturn callback();\n\t}\n\tconst parentContext = rootLogger.contextLocalStorage.getStore() ?? {};\n\treturn rootLogger.contextLocalStorage.run({\n\t\t...parentContext,\n\t\t...context\n\t}, callback);\n}\n/**\n* Gets the current category prefix from context local storage.\n* @returns The current category prefix, or an empty array if not set.\n* @since 1.3.0\n*/\nfunction getCategoryPrefix() {\n\tconst rootLogger = LoggerImpl.getLogger();\n\tconst store = rootLogger.contextLocalStorage?.getStore();\n\tif (store == null) return [];\n\tconst prefix = store[categoryPrefixSymbol];\n\treturn Array.isArray(prefix) ? prefix : [];\n}\n/**\n* Gets the current implicit context from context local storage, excluding\n* internal symbol keys (like category prefix).\n* @returns The current implicit context without internal symbol keys.\n* @since 1.3.0\n*/\nfunction getImplicitContext() {\n\tconst rootLogger = LoggerImpl.getLogger();\n\tconst store = rootLogger.contextLocalStorage?.getStore();\n\tif (store == null) return {};\n\tconst result = {};\n\tfor (const key of Object.keys(store)) result[key] = store[key];\n\treturn result;\n}\n/**\n* Runs a callback with the given category prefix prepended to all log\n* categories within the callback context.\n*\n* This is useful for SDKs or libraries that want to add their own category\n* as a prefix to logs from their internal dependencies.\n*\n* If no `contextLocalStorage` is configured, this function does nothing and\n* just returns the return value of the callback. It also logs a warning to\n* the `[\"logtape\", \"meta\"]` logger in this case.\n*\n* @example Basic usage\n* ```typescript\n* import { getLogger, withCategoryPrefix } from \"@logtape/logtape\";\n*\n* export function sdkFunction() {\n* return withCategoryPrefix([\"my-sdk\"], () => {\n* // Any logs from internal libraries within this context\n* // will have [\"my-sdk\"] prepended to their category\n* return internalLibraryFunction();\n* });\n* }\n* ```\n*\n* @param prefix The category prefix to prepend. Can be a string or an array\n* of strings.\n* @param callback The callback to run.\n* @returns The return value of the callback.\n* @since 1.3.0\n*/\nfunction withCategoryPrefix(prefix, callback) {\n\tconst rootLogger = LoggerImpl.getLogger();\n\tif (rootLogger.contextLocalStorage == null) {\n\t\tLoggerImpl.getLogger([\"logtape\", \"meta\"]).warn(\"Context-local storage is not configured. Specify contextLocalStorage option in the configure() function.\");\n\t\treturn callback();\n\t}\n\tconst parentContext = rootLogger.contextLocalStorage.getStore() ?? {};\n\tconst parentPrefix = getCategoryPrefix();\n\tconst newPrefix = typeof prefix === \"string\" ? [prefix] : [...prefix];\n\treturn rootLogger.contextLocalStorage.run({\n\t\t...parentContext,\n\t\t[categoryPrefixSymbol]: [...parentPrefix, ...newPrefix]\n\t}, callback);\n}\n\n//#endregion\nexport { getCategoryPrefix, getImplicitContext, withCategoryPrefix, withContext };\n//# sourceMappingURL=context.js.map","//#region src/level.ts\nconst logLevels = [\n\t\"trace\",\n\t\"debug\",\n\t\"info\",\n\t\"warning\",\n\t\"error\",\n\t\"fatal\"\n];\n/**\n* Lists all available log levels with the order of their severity.\n* The `\"trace\"` level goes first, and the `\"fatal\"` level goes last.\n* @returns A new copy of the array of log levels.\n* @since 1.0.0\n*/\nfunction getLogLevels() {\n\treturn [...logLevels];\n}\n/**\n* Parses a log level from a string.\n*\n* @param level The log level as a string. This is case-insensitive.\n* @returns The log level.\n* @throws {TypeError} If the log level is invalid.\n*/\nfunction parseLogLevel(level) {\n\tlevel = level.toLowerCase();\n\tswitch (level) {\n\t\tcase \"trace\":\n\t\tcase \"debug\":\n\t\tcase \"info\":\n\t\tcase \"warning\":\n\t\tcase \"error\":\n\t\tcase \"fatal\": return level;\n\t\tdefault: throw new TypeError(`Invalid log level: ${level}.`);\n\t}\n}\n/**\n* Checks if a string is a valid log level. This function can be used as\n* as a type guard to narrow the type of a string to a {@link LogLevel}.\n*\n* @param level The log level as a string. This is case-sensitive.\n* @returns `true` if the string is a valid log level.\n*/\nfunction isLogLevel(level) {\n\tswitch (level) {\n\t\tcase \"trace\":\n\t\tcase \"debug\":\n\t\tcase \"info\":\n\t\tcase \"warning\":\n\t\tcase \"error\":\n\t\tcase \"fatal\": return true;\n\t\tdefault: return false;\n\t}\n}\n/**\n* Compares two log levels.\n* @param a The first log level.\n* @param b The second log level.\n* @returns A negative number if `a` is less than `b`, a positive number if `a`\n* is greater than `b`, or zero if they are equal.\n* @since 0.8.0\n*/\nfunction compareLogLevel(a, b) {\n\tconst aIndex = logLevels.indexOf(a);\n\tif (aIndex < 0) throw new TypeError(`Invalid log level: ${JSON.stringify(a)}.`);\n\tconst bIndex = logLevels.indexOf(b);\n\tif (bIndex < 0) throw new TypeError(`Invalid log level: ${JSON.stringify(b)}.`);\n\treturn aIndex - bIndex;\n}\n\n//#endregion\nexport { compareLogLevel, getLogLevels, isLogLevel, parseLogLevel };\n//# sourceMappingURL=level.js.map","import { getCategoryPrefix, getImplicitContext } from \"./context.js\";\nimport { compareLogLevel } from \"./level.js\";\n\n//#region src/logger.ts\n/**\n* Symbol to identify lazy values.\n*/\nconst lazySymbol = Symbol.for(\"logtape.lazy\");\nconst throttlingSummaryRecordSymbol = Symbol.for(\"LogTape.throttlingSummaryRecord\");\n/**\n* Checks if a value is a lazy value.\n*\n* @param value The value to check.\n* @returns `true` if the value is a lazy value, `false` otherwise.\n* @since 2.0.0\n*/\nfunction isLazy(value) {\n\treturn value != null && typeof value === \"object\" && lazySymbol in value && value[lazySymbol] === true;\n}\n/**\n* Creates a lazy value that is evaluated at logging time.\n*\n* This is useful for logging contextual properties that may change over time,\n* such as the current user or request context.\n*\n* @example\n* ```typescript\n* let currentUser: string | null = null;\n* const logger = getLogger(\"app\").with({ user: lazy(() => currentUser) });\n*\n* logger.info(\"User action\"); // logs with user: null\n* currentUser = \"alice\";\n* logger.info(\"User action\"); // logs with user: \"alice\"\n* ```\n*\n* @typeParam T The type of the value.\n* @param getter A function that returns the value.\n* @returns A lazy value.\n* @since 2.0.0\n*/\nfunction lazy(getter) {\n\treturn {\n\t\t[lazySymbol]: true,\n\t\tgetter\n\t};\n}\n/**\n* Resolves lazy values in a properties object.\n*\n* @param properties The properties object with potential lazy values.\n* @returns A new object with all lazy values resolved.\n*/\nfunction resolveProperties(properties) {\n\tconst resolved = {};\n\tfor (const key in properties) {\n\t\tconst value = properties[key];\n\t\tresolved[key] = isLazy(value) ? value.getter() : value;\n\t}\n\tconst symbolProperties = properties;\n\tconst symbolResolved = resolved;\n\tif (Object.prototype.propertyIsEnumerable.call(properties, throttlingSummaryRecordSymbol)) {\n\t\tconst value = symbolProperties[throttlingSummaryRecordSymbol];\n\t\tsymbolResolved[throttlingSummaryRecordSymbol] = isLazy(value) ? value.getter() : value;\n\t}\n\treturn resolved;\n}\nfunction isPromiseObject(value) {\n\tif (value instanceof Promise) return true;\n\treturn Object.prototype.toString.call(value) === \"[object Promise]\" && typeof value.then === \"function\";\n}\nfunction logStringMessage(logger, level, message, props) {\n\tif (typeof props !== \"function\") {\n\t\tconst properties = props ?? {};\n\t\tlogger.log(level, message, properties);\n\t\treturn;\n\t}\n\tif (!logger.isEnabledFor(level)) return Promise.resolve();\n\tconst result = props();\n\tif (isPromiseObject(result)) return Promise.resolve(result).then((resolvedProps) => {\n\t\tlogger.log(level, message, resolvedProps);\n\t});\n\tlogger.log(level, message, result);\n}\nfunction snapshotLogRecordProperties(record) {\n\tconst properties = resolveProperties(record.properties);\n\tconst descriptors = Object.getOwnPropertyDescriptors(record);\n\tdescriptors.properties = {\n\t\tvalue: properties,\n\t\tenumerable: true,\n\t\tconfigurable: true\n\t};\n\treturn Object.defineProperties({}, descriptors);\n}\n/**\n* Get a logger with the given category.\n*\n* ```typescript\n* const logger = getLogger([\"my-app\"]);\n* ```\n*\n* @param category The category of the logger. It can be a string or an array\n* of strings. If it is a string, it is equivalent to an array\n* with a single element.\n* @returns The logger.\n*/\nfunction getLogger(category = []) {\n\treturn LoggerImpl.getLogger(category);\n}\n/**\n* The symbol for the global root logger.\n*/\nconst globalRootLoggerSymbol = Symbol.for(\"logtape.rootLogger\");\nfunction isMetaLoggerCategory(category) {\n\treturn category.length === 2 && category[0] === \"logtape\" && category[1] === \"meta\";\n}\n/**\n* A logger implementation. Do not use this directly; use {@link getLogger}\n* instead. This class is exported for testing purposes.\n*/\nvar LoggerImpl = class LoggerImpl {\n\tparent;\n\tchildren;\n\tcategory;\n\tsinks;\n\tparentSinks = \"inherit\";\n\tfilters;\n\tlowestLevel = \"trace\";\n\tcontextLocalStorage;\n\tstatic getLogger(category = []) {\n\t\tlet rootLogger = globalRootLoggerSymbol in globalThis ? globalThis[globalRootLoggerSymbol] ?? null : null;\n\t\tif (rootLogger == null) {\n\t\t\trootLogger = new LoggerImpl(null, []);\n\t\t\tglobalThis[globalRootLoggerSymbol] = rootLogger;\n\t\t}\n\t\tif (typeof category === \"string\") return rootLogger.getChild(category);\n\t\tif (category.length === 0) return rootLogger;\n\t\treturn rootLogger.getChild(category);\n\t}\n\tstatic getNearestExistingLogger(category) {\n\t\tlet logger = LoggerImpl.getLogger();\n\t\tfor (const name of category) {\n\t\t\tconst childRef = logger.children[name];\n\t\t\tconst child = childRef instanceof LoggerImpl ? childRef : childRef?.deref();\n\t\t\tif (child == null) break;\n\t\t\tlogger = child;\n\t\t}\n\t\treturn logger;\n\t}\n\tconstructor(parent, category) {\n\t\tthis.parent = parent;\n\t\tthis.children = {};\n\t\tthis.category = category;\n\t\tthis.sinks = [];\n\t\tthis.filters = [];\n\t}\n\tgetChild(subcategory) {\n\t\tconst name = typeof subcategory === \"string\" ? subcategory : subcategory[0];\n\t\tconst childRef = this.children[name];\n\t\tlet child = childRef instanceof LoggerImpl ? childRef : childRef?.deref();\n\t\tif (child == null) {\n\t\t\tchild = new LoggerImpl(this, [...this.category, name]);\n\t\t\tthis.children[name] = \"WeakRef\" in globalThis ? new WeakRef(child) : child;\n\t\t}\n\t\tif (typeof subcategory === \"string\" || subcategory.length === 1) return child;\n\t\treturn child.getChild(subcategory.slice(1));\n\t}\n\t/**\n\t* Reset the logger. This removes all sinks and filters from the logger.\n\t*/\n\treset() {\n\t\twhile (this.sinks.length > 0) this.sinks.shift();\n\t\tthis.parentSinks = \"inherit\";\n\t\twhile (this.filters.length > 0) this.filters.shift();\n\t\tthis.lowestLevel = \"trace\";\n\t}\n\t/**\n\t* Reset the logger and all its descendants. This removes all sinks and\n\t* filters from the logger and all its descendants.\n\t*/\n\tresetDescendants() {\n\t\tfor (const child of Object.values(this.children)) {\n\t\t\tconst logger = child instanceof LoggerImpl ? child : child.deref();\n\t\t\tif (logger != null) logger.resetDescendants();\n\t\t}\n\t\tthis.reset();\n\t}\n\twith(properties) {\n\t\treturn new LoggerCtx(this, { ...properties });\n\t}\n\tfilter(record) {\n\t\tfor (const filter of this.filters) if (!filter(record)) return false;\n\t\tif (this.filters.length < 1) return this.parent?.filter(record) ?? true;\n\t\treturn true;\n\t}\n\t*getSinks(level) {\n\t\tif (this.lowestLevel === null || compareLogLevel(level, this.lowestLevel) < 0) return;\n\t\tif (this.parent != null && this.parentSinks === \"inherit\") for (const sink of this.parent.getSinks(level)) yield sink;\n\t\tfor (const sink of this.sinks) yield sink;\n\t}\n\tisEnabledFor(level) {\n\t\tconst categoryPrefix = isMetaLoggerCategory(this.category) ? [] : getCategoryPrefix();\n\t\tconst dispatcher = categoryPrefix.length > 0 ? LoggerImpl.getNearestExistingLogger([...categoryPrefix, ...this.category]) : this;\n\t\treturn dispatcher.isEnabledForResolved(level);\n\t}\n\tisEnabledForResolved(level) {\n\t\tif (this.lowestLevel === null || compareLogLevel(level, this.lowestLevel) < 0) return false;\n\t\tfor (const _ of this.getSinks(level)) return true;\n\t\treturn false;\n\t}\n\temit(record, bypassSinks) {\n\t\tconst baseCategory = \"category\" in record ? record.category : this.category;\n\t\tconst categoryPrefix = isMetaLoggerCategory(baseCategory) ? [] : getCategoryPrefix();\n\t\tconst fullCategory = categoryPrefix.length > 0 ? [...categoryPrefix, ...baseCategory] : baseCategory;\n\t\tconst descriptors = Object.getOwnPropertyDescriptors(record);\n\t\tdescriptors.category = {\n\t\t\tvalue: fullCategory,\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true\n\t\t};\n\t\tconst fullRecord = Object.defineProperties({}, descriptors);\n\t\tconst dispatcher = categoryPrefix.length > 0 ? LoggerImpl.getNearestExistingLogger(fullCategory) : this;\n\t\tdispatcher.emitResolved(fullRecord, bypassSinks);\n\t}\n\temitResolved(record, bypassSinks) {\n\t\tif (this.lowestLevel === null || compareLogLevel(record.level, this.lowestLevel) < 0 || !this.filter(record)) return;\n\t\tconst sinks = [...this.getSinks(record.level)];\n\t\tif (sinks.length < 1) return;\n\t\tlet snapshot;\n\t\tlet snapshotFailed = false;\n\t\tfor (const sink of sinks) {\n\t\t\tif (bypassSinks?.has(sink)) continue;\n\t\t\ttry {\n\t\t\t\tif (snapshot == null && !snapshotFailed) try {\n\t\t\t\t\tsnapshot = snapshotLogRecordProperties(record);\n\t\t\t\t} catch {\n\t\t\t\t\tsnapshotFailed = true;\n\t\t\t\t\tsnapshot = record;\n\t\t\t\t}\n\t\t\t\tsink(snapshot ?? record);\n\t\t\t} catch (error) {\n\t\t\t\tconst bypassSinks2 = new Set(bypassSinks);\n\t\t\t\tbypassSinks2.add(sink);\n\t\t\t\tmetaLogger.log(\"fatal\", \"Failed to emit a log record to sink {sink}: {error}\", {\n\t\t\t\t\tsink,\n\t\t\t\t\terror,\n\t\t\t\t\trecord\n\t\t\t\t}, bypassSinks2);\n\t\t\t}\n\t\t}\n\t}\n\tlog(level, rawMessage, properties, bypassSinks) {\n\t\tconst implicitContext = getImplicitContext();\n\t\tlet cachedProps = void 0;\n\t\tlet cachedMessage = void 0;\n\t\tconst record = typeof properties === \"function\" ? {\n\t\t\tcategory: this.category,\n\t\t\tlevel,\n\t\t\ttimestamp: Date.now(),\n\t\t\tget message() {\n\t\t\t\tif (cachedMessage == null) cachedMessage = parseMessageTemplate(rawMessage, this.properties);\n\t\t\t\treturn cachedMessage;\n\t\t\t},\n\t\t\trawMessage,\n\t\t\tget properties() {\n\t\t\t\tif (cachedProps == null) cachedProps = resolveProperties({\n\t\t\t\t\t...implicitContext,\n\t\t\t\t\t...properties()\n\t\t\t\t});\n\t\t\t\treturn cachedProps;\n\t\t\t}\n\t\t} : {\n\t\t\tcategory: this.category,\n\t\t\tlevel,\n\t\t\ttimestamp: Date.now(),\n\t\t\tget message() {\n\t\t\t\tif (cachedMessage == null) cachedMessage = parseMessageTemplate(rawMessage, this.properties);\n\t\t\t\treturn cachedMessage;\n\t\t\t},\n\t\t\trawMessage,\n\t\t\tget properties() {\n\t\t\t\tif (cachedProps == null) cachedProps = resolveProperties({\n\t\t\t\t\t...implicitContext,\n\t\t\t\t\t...properties\n\t\t\t\t});\n\t\t\t\treturn cachedProps;\n\t\t\t}\n\t\t};\n\t\tthis.emit(record, bypassSinks);\n\t}\n\tlogLazily(level, callback, properties = {}) {\n\t\tconst implicitContext = getImplicitContext();\n\t\tlet rawMessage = void 0;\n\t\tlet msg = void 0;\n\t\tfunction realizeMessage() {\n\t\t\tif (msg == null || rawMessage == null) {\n\t\t\t\tmsg = callback((tpl, ...values) => {\n\t\t\t\t\trawMessage = tpl;\n\t\t\t\t\treturn renderMessage(tpl, values);\n\t\t\t\t});\n\t\t\t\tif (rawMessage == null) throw new TypeError(\"No log record was made.\");\n\t\t\t}\n\t\t\treturn [msg, rawMessage];\n\t\t}\n\t\tthis.emit({\n\t\t\tcategory: this.category,\n\t\t\tlevel,\n\t\t\tget message() {\n\t\t\t\treturn realizeMessage()[0];\n\t\t\t},\n\t\t\tget rawMessage() {\n\t\t\t\treturn realizeMessage()[1];\n\t\t\t},\n\t\t\ttimestamp: Date.now(),\n\t\t\tproperties: {\n\t\t\t\t...implicitContext,\n\t\t\t\t...properties\n\t\t\t}\n\t\t});\n\t}\n\tlogTemplate(level, messageTemplate, values, properties = {}) {\n\t\tconst implicitContext = getImplicitContext();\n\t\tthis.emit({\n\t\t\tcategory: this.category,\n\t\t\tlevel,\n\t\t\tmessage: renderMessage(messageTemplate, values),\n\t\t\trawMessage: messageTemplate,\n\t\t\ttimestamp: Date.now(),\n\t\t\tproperties: {\n\t\t\t\t...implicitContext,\n\t\t\t\t...properties\n\t\t\t}\n\t\t});\n\t}\n\ttrace(message, ...values) {\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"trace\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"trace\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"trace\", \"{*}\", message);\n\t\telse this.logTemplate(\"trace\", message, values);\n\t}\n\tdebug(message, ...values) {\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"debug\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"debug\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"debug\", \"{*}\", message);\n\t\telse this.logTemplate(\"debug\", message, values);\n\t}\n\tinfo(message, ...values) {\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"info\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"info\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"info\", \"{*}\", message);\n\t\telse this.logTemplate(\"info\", message, values);\n\t}\n\tlogError(level, error, props) {\n\t\tif (typeof props !== \"function\") {\n\t\t\tthis.log(level, \"{error.message}\", {\n\t\t\t\t...props,\n\t\t\t\terror\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (!this.isEnabledFor(level)) return Promise.resolve();\n\t\tconst result = props();\n\t\tif (result instanceof Promise) return result.then((resolved) => {\n\t\t\tthis.log(level, \"{error.message}\", {\n\t\t\t\t...resolved,\n\t\t\t\terror\n\t\t\t});\n\t\t});\n\t\tthis.log(level, \"{error.message}\", {\n\t\t\t...result,\n\t\t\terror\n\t\t});\n\t}\n\twarn(message, ...values) {\n\t\tif (message instanceof Error) return this.logError(\"warning\", message, values[0]);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"warning\", message, { error: values[0] });\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"warning\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"warning\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"warning\", \"{*}\", message);\n\t\telse this.logTemplate(\"warning\", message, values);\n\t}\n\twarning(message, ...values) {\n\t\tif (message instanceof Error) return this.logError(\"warning\", message, values[0]);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"warning\", message, { error: values[0] });\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"warning\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"warning\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"warning\", \"{*}\", message);\n\t\telse this.logTemplate(\"warning\", message, values);\n\t}\n\terror(message, ...values) {\n\t\tif (message instanceof Error) return this.logError(\"error\", message, values[0]);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"error\", message, { error: values[0] });\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"error\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"error\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"error\", \"{*}\", message);\n\t\telse this.logTemplate(\"error\", message, values);\n\t}\n\tfatal(message, ...values) {\n\t\tif (message instanceof Error) return this.logError(\"fatal\", message, values[0]);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"fatal\", message, { error: values[0] });\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"fatal\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"fatal\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"fatal\", \"{*}\", message);\n\t\telse this.logTemplate(\"fatal\", message, values);\n\t}\n};\n/**\n* A logger implementation with contextual properties. Do not use this\n* directly; use {@link Logger.with} instead. This class is exported\n* for testing purposes.\n*/\nvar LoggerCtx = class LoggerCtx {\n\tlogger;\n\tproperties;\n\tconstructor(logger, properties) {\n\t\tthis.logger = logger;\n\t\tthis.properties = properties;\n\t}\n\tget category() {\n\t\treturn this.logger.category;\n\t}\n\tget parent() {\n\t\treturn this.logger.parent;\n\t}\n\tgetChild(subcategory) {\n\t\treturn this.logger.getChild(subcategory).with(this.properties);\n\t}\n\twith(properties) {\n\t\treturn new LoggerCtx(this.logger, {\n\t\t\t...this.properties,\n\t\t\t...properties\n\t\t});\n\t}\n\tlog(level, message, properties, bypassSinks) {\n\t\tconst contextProps = this.properties;\n\t\tthis.logger.log(level, message, typeof properties === \"function\" ? () => resolveProperties({\n\t\t\t...contextProps,\n\t\t\t...properties()\n\t\t}) : () => resolveProperties({\n\t\t\t...contextProps,\n\t\t\t...properties\n\t\t}), bypassSinks);\n\t}\n\tlogLazily(level, callback) {\n\t\tthis.logger.logLazily(level, callback, resolveProperties(this.properties));\n\t}\n\tlogTemplate(level, messageTemplate, values) {\n\t\tthis.logger.logTemplate(level, messageTemplate, values, resolveProperties(this.properties));\n\t}\n\temit(record) {\n\t\tconst recordWithContext = {\n\t\t\t...record,\n\t\t\tproperties: resolveProperties({\n\t\t\t\t...this.properties,\n\t\t\t\t...record.properties\n\t\t\t})\n\t\t};\n\t\tthis.logger.emit(recordWithContext);\n\t}\n\tisEnabledFor(level) {\n\t\treturn this.logger.isEnabledFor(level);\n\t}\n\ttrace(message, ...values) {\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"trace\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"trace\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"trace\", \"{*}\", message);\n\t\telse this.logTemplate(\"trace\", message, values);\n\t}\n\tdebug(message, ...values) {\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"debug\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"debug\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"debug\", \"{*}\", message);\n\t\telse this.logTemplate(\"debug\", message, values);\n\t}\n\tinfo(message, ...values) {\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"info\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"info\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"info\", \"{*}\", message);\n\t\telse this.logTemplate(\"info\", message, values);\n\t}\n\tlogError(level, error, props) {\n\t\tif (typeof props !== \"function\") {\n\t\t\tthis.log(level, \"{error.message}\", {\n\t\t\t\t...props,\n\t\t\t\terror\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (!this.isEnabledFor(level)) return Promise.resolve();\n\t\tconst result = props();\n\t\tif (result instanceof Promise) return result.then((resolved) => {\n\t\t\tthis.log(level, \"{error.message}\", {\n\t\t\t\t...resolved,\n\t\t\t\terror\n\t\t\t});\n\t\t});\n\t\tthis.log(level, \"{error.message}\", {\n\t\t\t...result,\n\t\t\terror\n\t\t});\n\t}\n\twarn(message, ...values) {\n\t\tif (message instanceof Error) return this.logError(\"warning\", message, values[0]);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"warning\", message, { error: values[0] });\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"warning\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"warning\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"warning\", \"{*}\", message);\n\t\telse this.logTemplate(\"warning\", message, values);\n\t}\n\twarning(message, ...values) {\n\t\tif (message instanceof Error) return this.logError(\"warning\", message, values[0]);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"warning\", message, { error: values[0] });\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"warning\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"warning\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"warning\", \"{*}\", message);\n\t\telse this.logTemplate(\"warning\", message, values);\n\t}\n\terror(message, ...values) {\n\t\tif (message instanceof Error) return this.logError(\"error\", message, values[0]);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"error\", message, { error: values[0] });\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"error\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"error\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"error\", \"{*}\", message);\n\t\telse this.logTemplate(\"error\", message, values);\n\t}\n\tfatal(message, ...values) {\n\t\tif (message instanceof Error) return this.logError(\"fatal\", message, values[0]);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"fatal\", message, { error: values[0] });\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"fatal\", message, values[0]);\n\t\telse if (typeof message === \"function\") this.logLazily(\"fatal\", message);\n\t\telse if (!Array.isArray(message)) this.log(\"fatal\", \"{*}\", message);\n\t\telse this.logTemplate(\"fatal\", message, values);\n\t}\n};\n/**\n* The meta logger. It is a logger with the category `[\"logtape\", \"meta\"]`.\n*/\nconst metaLogger = LoggerImpl.getLogger([\"logtape\", \"meta\"]);\n/**\n* Check if a property access key contains nested access patterns.\n* @param key The property key to check.\n* @returns True if the key contains nested access patterns.\n*/\nfunction isNestedAccess(key) {\n\treturn key.includes(\".\") || key.includes(\"[\") || key.includes(\"?.\");\n}\n/**\n* Safely access an own property from an object, blocking prototype pollution.\n*\n* @param obj The object to access the property from.\n* @param key The property key to access.\n* @returns The property value or undefined if not accessible.\n*/\nfunction getOwnProperty(obj, key) {\n\tif (key === \"__proto__\" || key === \"prototype\" || key === \"constructor\") return void 0;\n\tif ((typeof obj === \"object\" || typeof obj === \"function\") && obj !== null) return Object.prototype.hasOwnProperty.call(obj, key) ? obj[key] : void 0;\n\treturn void 0;\n}\n/**\n* Parse the next segment from a property path string.\n*\n* @param path The full property path string.\n* @param fromIndex The index to start parsing from.\n* @returns The parsed segment and next index, or null if parsing fails.\n*/\nfunction parseNextSegment(path, fromIndex) {\n\tconst len = path.length;\n\tlet i = fromIndex;\n\tif (i >= len) return null;\n\tlet segment;\n\tif (path[i] === \"[\") {\n\t\ti++;\n\t\tif (i >= len) return null;\n\t\tif (path[i] === \"\\\"\" || path[i] === \"'\") {\n\t\t\tconst quote = path[i];\n\t\t\ti++;\n\t\t\tlet segmentStr = \"\";\n\t\t\twhile (i < len && path[i] !== quote) if (path[i] === \"\\\\\") {\n\t\t\t\ti++;\n\t\t\t\tif (i < len) {\n\t\t\t\t\tconst escapeChar = path[i];\n\t\t\t\t\tswitch (escapeChar) {\n\t\t\t\t\t\tcase \"n\":\n\t\t\t\t\t\t\tsegmentStr += \"\\n\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"t\":\n\t\t\t\t\t\t\tsegmentStr += \"\t\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"r\":\n\t\t\t\t\t\t\tsegmentStr += \"\\r\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"b\":\n\t\t\t\t\t\t\tsegmentStr += \"\\b\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"f\":\n\t\t\t\t\t\t\tsegmentStr += \"\\f\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"v\":\n\t\t\t\t\t\t\tsegmentStr += \"\\v\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"0\":\n\t\t\t\t\t\t\tsegmentStr += \"\\0\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"\\\\\":\n\t\t\t\t\t\t\tsegmentStr += \"\\\\\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"\\\"\":\n\t\t\t\t\t\t\tsegmentStr += \"\\\"\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"'\":\n\t\t\t\t\t\t\tsegmentStr += \"'\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"u\":\n\t\t\t\t\t\t\tif (i + 4 < len) {\n\t\t\t\t\t\t\t\tconst hex = path.slice(i + 1, i + 5);\n\t\t\t\t\t\t\t\tconst codePoint = Number.parseInt(hex, 16);\n\t\t\t\t\t\t\t\tif (!Number.isNaN(codePoint)) {\n\t\t\t\t\t\t\t\t\tsegmentStr += String.fromCharCode(codePoint);\n\t\t\t\t\t\t\t\t\ti += 4;\n\t\t\t\t\t\t\t\t} else segmentStr += escapeChar;\n\t\t\t\t\t\t\t} else segmentStr += escapeChar;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault: segmentStr += escapeChar;\n\t\t\t\t\t}\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsegmentStr += path[i];\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i >= len) return null;\n\t\t\tsegment = segmentStr;\n\t\t\ti++;\n\t\t} else {\n\t\t\tconst startIndex = i;\n\t\t\twhile (i < len && path[i] !== \"]\" && path[i] !== \"'\" && path[i] !== \"\\\"\") i++;\n\t\t\tif (i >= len) return null;\n\t\t\tconst indexStr = path.slice(startIndex, i);\n\t\t\tif (indexStr.length === 0) return null;\n\t\t\tconst indexNum = Number(indexStr);\n\t\t\tsegment = Number.isNaN(indexNum) ? indexStr : indexNum;\n\t\t}\n\t\twhile (i < len && path[i] !== \"]\") i++;\n\t\tif (i < len) i++;\n\t} else {\n\t\tconst startIndex = i;\n\t\twhile (i < len && path[i] !== \".\" && path[i] !== \"[\" && path[i] !== \"?\" && path[i] !== \"]\") i++;\n\t\tsegment = path.slice(startIndex, i);\n\t\tif (segment.length === 0) return null;\n\t}\n\tif (i < len && path[i] === \".\") i++;\n\treturn {\n\t\tsegment,\n\t\tnextIndex: i\n\t};\n}\n/**\n* Access a property or index on an object or array.\n*\n* @param obj The object or array to access.\n* @param segment The property key or array index.\n* @returns The accessed value or undefined if not accessible.\n*/\nfunction accessProperty(obj, segment) {\n\tif (typeof segment === \"string\") return getOwnProperty(obj, segment);\n\tif (Array.isArray(obj) && segment >= 0 && segment < obj.length) return obj[segment];\n\treturn void 0;\n}\n/**\n* Resolve a nested property path from an object.\n*\n* There are two types of property access patterns:\n* 1. Array/index access: [0] or [\"prop\"]\n* 2. Property access: prop or prop?.next\n*\n* @param obj The object to traverse.\n* @param path The property path (e.g., \"user.name\", \"users[0].email\", \"user['full-name']\").\n* @returns The resolved value or undefined if path doesn't exist.\n*/\nfunction resolvePropertyPath(obj, path) {\n\tif (obj == null) return void 0;\n\tif (path.length === 0 || path.endsWith(\".\")) return void 0;\n\tlet current = obj;\n\tlet i = 0;\n\tconst len = path.length;\n\twhile (i < len) {\n\t\tconst isOptional = path.slice(i, i + 2) === \"?.\";\n\t\tif (isOptional) {\n\t\t\ti += 2;\n\t\t\tif (current == null) return void 0;\n\t\t} else if (current == null) return void 0;\n\t\tconst result = parseNextSegment(path, i);\n\t\tif (result === null) return void 0;\n\t\tconst { segment, nextIndex } = result;\n\t\ti = nextIndex;\n\t\tcurrent = accessProperty(current, segment);\n\t\tif (current === void 0) return void 0;\n\t}\n\treturn current;\n}\n/**\n* Parse a message template into a message template array and a values array.\n*\n* Placeholders to be replaced with `values` are indicated by keys in curly braces\n* (e.g., `{value}`). The system supports both simple property access and nested\n* property access patterns:\n*\n* **Simple property access:**\n* ```ts\n* parseMessageTemplate(\"Hello, {user}!\", { user: \"foo\" })\n* // Returns: [\"Hello, \", \"foo\", \"!\"]\n* ```\n*\n* **Nested property access (dot notation):**\n* ```ts\n* parseMessageTemplate(\"Hello, {user.name}!\", {\n* user: { name: \"foo\", email: \"foo@example.com\" }\n* })\n* // Returns: [\"Hello, \", \"foo\", \"!\"]\n* ```\n*\n* **Array indexing:**\n* ```ts\n* parseMessageTemplate(\"First: {users[0]}\", {\n* users: [\"foo\", \"bar\", \"baz\"]\n* })\n* // Returns: [\"First: \", \"foo\", \"\"]\n* ```\n*\n* **Bracket notation for special property names:**\n* ```ts\n* parseMessageTemplate(\"Name: {user[\\\"full-name\\\"]}\", {\n* user: { \"full-name\": \"foo bar\" }\n* })\n* // Returns: [\"Name: \", \"foo bar\", \"\"]\n* ```\n*\n* **Optional chaining for safe navigation:**\n* ```ts\n* parseMessageTemplate(\"Email: {user?.profile?.email}\", {\n* user: { name: \"foo\" }\n* })\n* // Returns: [\"Email: \", undefined, \"\"]\n* ```\n*\n* **Wildcard patterns:**\n* - `{*}` - Replaced with the entire properties object\n* - `{ key-with-whitespace }` - Whitespace is trimmed when looking up keys\n*\n* **Escaping:**\n* - `{{` and `}}` are escaped literal braces\n*\n* **Error handling:**\n* - Non-existent paths return `undefined`\n* - Malformed expressions resolve to `undefined` without throwing errors\n* - Out of bounds array access returns `undefined`\n*\n* @param template The message template string containing placeholders.\n* @param properties The values to replace placeholders with.\n* @returns The message template array with values interleaved between text segments.\n*/\nfunction parseMessageTemplate(template, properties) {\n\tconst length = template.length;\n\tif (length === 0) return [\"\"];\n\tif (!template.includes(\"{\")) return [template];\n\tconst message = [];\n\tlet startIndex = 0;\n\tfor (let i = 0; i < length; i++) {\n\t\tconst char = template[i];\n\t\tif (char === \"{\") {\n\t\t\tconst nextChar = i + 1 < length ? template[i + 1] : \"\";\n\t\t\tif (nextChar === \"{\") {\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst closeIndex = template.indexOf(\"}\", i + 1);\n\t\t\tif (closeIndex === -1) continue;\n\t\t\tconst beforeText = template.slice(startIndex, i);\n\t\t\tmessage.push(beforeText.replace(/{{/g, \"{\").replace(/}}/g, \"}\"));\n\t\t\tconst key = template.slice(i + 1, closeIndex);\n\t\t\tlet prop;\n\t\t\tconst trimmedKey = key.trim();\n\t\t\tif (trimmedKey === \"*\") prop = key in properties ? properties[key] : \"*\" in properties ? properties[\"*\"] : properties;\n\t\t\telse {\n\t\t\t\tif (key !== trimmedKey) prop = key in properties ? properties[key] : properties[trimmedKey];\n\t\t\t\telse prop = properties[key];\n\t\t\t\tif (prop === void 0 && isNestedAccess(trimmedKey)) prop = resolvePropertyPath(properties, trimmedKey);\n\t\t\t}\n\t\t\tmessage.push(prop);\n\t\t\ti = closeIndex;\n\t\t\tstartIndex = i + 1;\n\t\t} else if (char === \"}\" && i + 1 < length && template[i + 1] === \"}\") i++;\n\t}\n\tconst remainingText = template.slice(startIndex);\n\tmessage.push(remainingText.replace(/{{/g, \"{\").replace(/}}/g, \"}\"));\n\treturn message;\n}\n/**\n* Render a message template with values.\n* @param template The message template.\n* @param values The message template values.\n* @returns The message template values interleaved between the substitution\n* values.\n*/\nfunction renderMessage(template, values) {\n\tconst args = [];\n\tfor (let i = 0; i < template.length; i++) {\n\t\targs.push(template[i]);\n\t\tif (i < values.length) args.push(values[i]);\n\t}\n\treturn args;\n}\n\n//#endregion\nexport { LoggerImpl, getLogger, isLazy, lazy };\n//# sourceMappingURL=logger.js.map","//#region src/filter.ts\n/**\n* Converts a {@link FilterLike} value to an actual {@link Filter}.\n*\n* @param filter The filter-like value to convert.\n* @returns The actual filter.\n*/\nfunction toFilter(filter) {\n\tif (typeof filter === \"function\") return filter;\n\treturn getLevelFilter(filter);\n}\n/**\n* Returns a filter that accepts log records with the specified level.\n*\n* @param level The level to filter by. If `null`, the filter will reject all\n* records.\n* @returns The filter.\n*/\nfunction getLevelFilter(level) {\n\tif (level == null) return () => false;\n\tif (level === \"fatal\") return (record) => record.level === \"fatal\";\n\telse if (level === \"error\") return (record) => record.level === \"fatal\" || record.level === \"error\";\n\telse if (level === \"warning\") return (record) => record.level === \"fatal\" || record.level === \"error\" || record.level === \"warning\";\n\telse if (level === \"info\") return (record) => record.level === \"fatal\" || record.level === \"error\" || record.level === \"warning\" || record.level === \"info\";\n\telse if (level === \"debug\") return (record) => record.level === \"fatal\" || record.level === \"error\" || record.level === \"warning\" || record.level === \"info\" || record.level === \"debug\";\n\telse if (level === \"trace\") return () => true;\n\tthrow new TypeError(`Invalid log level: ${level}.`);\n}\n/**\n* Returns a stateful filter that rate-limits repeated log records.\n*\n* The default key treats records with the same category, level, and raw\n* message template as identical, ignoring substituted values. If summary\n* logging is enabled, the filter logs summaries as a side effect when\n* suppression ends, when a suppressed key is evicted, or when the filter is\n* disposed.\n*\n* @param options Throttling options.\n* @returns A throttling filter.\n* @since 2.1.0\n*/\nfunction getThrottlingFilter(options) {\n\tvalidatePositiveInteger(\"limit\", options.limit);\n\tvalidatePositiveNumber(\"windowMs\", options.windowMs);\n\tif (options.maxKeys != null) validatePositiveInteger(\"maxKeys\", options.maxKeys);\n\tconst limit = options.limit;\n\tconst windowMs = options.windowMs;\n\tconst mode = options.mode ?? \"fixed\";\n\tconst timeSource = options.timeSource ?? \"clock\";\n\tconst clock = options.clock ?? Date.now;\n\tconst getKey = options.key ?? getDefaultThrottlingKey;\n\tconst maxKeys = options.maxKeys === void 0 ? 1e3 : options.maxKeys;\n\tconst buckets = /* @__PURE__ */ new Map();\n\tconst summaryRecord = Symbol.for(\"LogTape.throttlingSummaryRecord\");\n\tlet accessCounter = 0;\n\tlet emittingSummary = false;\n\tif (mode !== \"fixed\" && mode !== \"sliding\") throw new TypeError(`Invalid throttling mode: ${String(mode)}.`);\n\tif (timeSource !== \"clock\" && timeSource !== \"record\") throw new TypeError(`Invalid throttling timeSource: ${String(timeSource)}.`);\n\tconst filter = (record) => {\n\t\tif (emittingSummary && isSummaryRecord(record)) return true;\n\t\tconst key = getKey(record);\n\t\tlet bucket = buckets.get(key);\n\t\tconst observedTime = timeSource === \"record\" ? record.timestamp : clock();\n\t\tconst now = bucket == null || timeSource === \"record\" ? observedTime : Math.max(observedTime, bucket.lastTime);\n\t\tif (bucket == null) {\n\t\t\tevictKeysIfNeeded(now);\n\t\t\tbucket = {\n\t\t\t\twindowStart: now,\n\t\t\t\tsummaryStartTime: now,\n\t\t\t\tacceptedAt: [],\n\t\t\t\tallowed: 0,\n\t\t\t\tsuppressed: 0,\n\t\t\t\tfirstRecord: record,\n\t\t\t\tlastRecord: record,\n\t\t\t\tlastTime: now,\n\t\t\t\tlastAccess: ++accessCounter\n\t\t\t};\n\t\t\tbuckets.set(key, bucket);\n\t\t\tevictKeysIfNeeded(now);\n\t\t} else bucket.lastAccess = ++accessCounter;\n\t\tif (mode === \"fixed\") return filterFixedWindow(key, bucket, record, now);\n\t\treturn filterSlidingWindow(key, bucket, record, now);\n\t};\n\tfilter[Symbol.dispose] = () => {\n\t\tfor (const [key, bucket] of buckets) {\n\t\t\tconst endTime = timeSource === \"record\" ? bucket.lastTime : Math.max(clock(), bucket.lastTime);\n\t\t\temitSummary(key, bucket, \"dispose\", endTime);\n\t\t}\n\t\tbuckets.clear();\n\t};\n\treturn filter;\n\tfunction filterFixedWindow(key, bucket, record, now) {\n\t\tif (now - bucket.windowStart >= windowMs) {\n\t\t\temitSummary(key, bucket, \"window\", now);\n\t\t\tbucket.windowStart = now;\n\t\t\tbucket.summaryStartTime = now;\n\t\t\tbucket.acceptedAt.length = 0;\n\t\t\tbucket.allowed = 0;\n\t\t\tbucket.suppressed = 0;\n\t\t\tbucket.firstRecord = record;\n\t\t}\n\t\tconst allowed = bucket.allowed < limit;\n\t\tif (allowed) bucket.allowed++;\n\t\telse bucket.suppressed++;\n\t\tbucket.lastRecord = record;\n\t\tbucket.lastTime = now;\n\t\treturn allowed;\n\t}\n\tfunction filterSlidingWindow(key, bucket, record, now) {\n\t\tpruneExpiredAcceptedAt(bucket, now);\n\t\tconst allowed = bucket.acceptedAt.length < limit;\n\t\tif (allowed) {\n\t\t\tif (bucket.suppressed > 0) {\n\t\t\t\temitSummary(key, bucket, \"window\", now);\n\t\t\t\tbucket.allowed = 0;\n\t\t\t\tbucket.suppressed = 0;\n\t\t\t\tbucket.summaryStartTime = now;\n\t\t\t\tbucket.firstRecord = record;\n\t\t\t}\n\t\t\tpushAcceptedAt(bucket, now);\n\t\t\tbucket.allowed++;\n\t\t} else bucket.suppressed++;\n\t\tbucket.lastRecord = record;\n\t\tbucket.lastTime = now;\n\t\treturn allowed;\n\t}\n\tfunction pruneExpiredAcceptedAt(bucket, now) {\n\t\tlet acceptedAtCount = 0;\n\t\tfor (let i = 0; i < bucket.acceptedAt.length; i++) {\n\t\t\tconst acceptedAt = bucket.acceptedAt[i];\n\t\t\tif (acceptedAt <= now && now - acceptedAt < windowMs) {\n\t\t\t\tbucket.acceptedAt[acceptedAtCount] = acceptedAt;\n\t\t\t\tacceptedAtCount++;\n\t\t\t}\n\t\t}\n\t\tbucket.acceptedAt.length = acceptedAtCount;\n\t}\n\tfunction pushAcceptedAt(bucket, acceptedAt) {\n\t\tbucket.acceptedAt.push(acceptedAt);\n\t}\n\tfunction evictKeysIfNeeded(now) {\n\t\tif (maxKeys == null) return;\n\t\twhile (buckets.size > maxKeys) {\n\t\t\tlet keyToEvict;\n\t\t\tlet oldestAccess = Infinity;\n\t\t\tfor (const [key, bucket$1] of buckets) if (bucket$1.lastAccess < oldestAccess) {\n\t\t\t\tkeyToEvict = key;\n\t\t\t\toldestAccess = bucket$1.lastAccess;\n\t\t\t}\n\t\t\tif (keyToEvict === void 0) return;\n\t\t\tconst bucket = buckets.get(keyToEvict);\n\t\t\tif (bucket != null) {\n\t\t\t\tconst endTime = timeSource === \"record\" ? bucket.lastTime : Math.max(now, bucket.lastTime);\n\t\t\t\temitSummary(keyToEvict, bucket, \"eviction\", endTime);\n\t\t\t\tbuckets.delete(keyToEvict);\n\t\t\t}\n\t\t}\n\t}\n\tfunction emitSummary(key, bucket, reason, endTime) {\n\t\tconst summaryOptions = options.summary;\n\t\tif (summaryOptions == null || bucket.suppressed < 1) return;\n\t\tconst summary = {\n\t\t\tkey,\n\t\t\tsuppressed: bucket.suppressed,\n\t\t\tallowed: bucket.allowed,\n\t\t\treason,\n\t\t\tstartTime: bucket.summaryStartTime,\n\t\t\tendTime,\n\t\t\tfirstRecord: bucket.firstRecord,\n\t\t\tlastRecord: bucket.lastRecord\n\t\t};\n\t\tconst level = typeof summaryOptions.level === \"function\" ? summaryOptions.level(summary) : summaryOptions.level ?? \"warning\";\n\t\tconst message = typeof summaryOptions.message === \"function\" ? summaryOptions.message(summary) : summaryOptions.message ?? \"Last log message was suppressed {suppressed} times.\";\n\t\tconst log = summaryOptions.logger[level];\n\t\tif (typeof log !== \"function\") return;\n\t\tconst properties = {\n\t\t\tkey: summary.key,\n\t\t\tsuppressed: summary.suppressed,\n\t\t\tallowed: summary.allowed,\n\t\t\treason: summary.reason,\n\t\t\tstartTime: summary.startTime,\n\t\t\tendTime: summary.endTime,\n\t\t\tfirstRecord: summary.firstRecord,\n\t\t\tlastRecord: summary.lastRecord,\n\t\t\t[summaryRecord]: true\n\t\t};\n\t\temittingSummary = true;\n\t\ttry {\n\t\t\tlog.call(summaryOptions.logger, message, properties);\n\t\t} finally {\n\t\t\temittingSummary = false;\n\t\t}\n\t}\n\tfunction isSummaryRecord(record) {\n\t\tconst properties = record.properties;\n\t\treturn properties != null && typeof properties === \"object\" && properties[summaryRecord] === true;\n\t}\n}\nfunction validatePositiveInteger(name, value) {\n\tif (!Number.isInteger(value) || value < 1) throw new RangeError(`${name} must be a positive integer.`);\n}\nfunction validatePositiveNumber(name, value) {\n\tif (!Number.isFinite(value) || value <= 0) throw new RangeError(`${name} must be a positive number.`);\n}\nfunction getDefaultThrottlingKey(record) {\n\tconst categoryKey = encodeKeyParts(record.category);\n\tconst rawMessage = getRawMessageTemplate(record.rawMessage);\n\tconst rawMessageKey = typeof rawMessage === \"string\" ? `s${encodeKeyPart(rawMessage)}` : `t${encodeKeyParts(rawMessage)}`;\n\treturn `c${categoryKey}l${encodeKeyPart(record.level)}r${rawMessageKey}`;\n}\nfunction getRawMessageTemplate(rawMessage) {\n\tif (typeof rawMessage === \"string\") return rawMessage;\n\tfor (const part of rawMessage) if (typeof part !== \"string\") return rawMessage.raw;\n\treturn rawMessage;\n}\nfunction encodeKeyParts(parts) {\n\tlet key = `${parts.length}:`;\n\tfor (const part of parts) key += encodeKeyPart(part);\n\treturn key;\n}\nfunction encodeKeyPart(part) {\n\treturn `${part.length}:${part}`;\n}\n\n//#endregion\nexport { getLevelFilter, getThrottlingFilter, toFilter };\n//# sourceMappingURL=filter.js.map","//#region src/util.ts\nfunction inspect(obj, options) {\n\tconst indent = options?.compact === true ? void 0 : 2;\n\treturn JSON.stringify(obj, null, indent);\n}\n\n//#endregion\nexport { inspect };\n//# sourceMappingURL=util.js.map","import * as util from \"#util\";\n\n//#region src/formatter.ts\n/**\n* The severity level abbreviations.\n*/\nconst levelAbbreviations = {\n\t\"trace\": \"TRC\",\n\t\"debug\": \"DBG\",\n\t\"info\": \"INF\",\n\t\"warning\": \"WRN\",\n\t\"error\": \"ERR\",\n\t\"fatal\": \"FTL\"\n};\n/**\n* A platform-specific inspect function. In Deno, this is {@link Deno.inspect},\n* and in Node.js/Bun it is `util.inspect()`. If neither is available, it\n* falls back to {@link JSON.stringify}.\n*\n* @param value The value to inspect.\n* @param options The options for inspecting the value.\n* If `colors` is `true`, the output will be ANSI-colored.\n* @returns The string representation of the value.\n*/\nconst platformInspect = typeof document !== \"undefined\" || typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\" ? (v) => JSON.stringify(v) : \"Deno\" in globalThis && \"inspect\" in globalThis.Deno && typeof globalThis.Deno.inspect === \"function\" ? (v, opts) => globalThis.Deno.inspect(v, {\n\tstrAbbreviateSize: Infinity,\n\titerableLimit: Infinity,\n\t...opts\n}) : util != null && \"inspect\" in util && typeof util.inspect === \"function\" ? (v, opts) => util.inspect(v, {\n\tmaxArrayLength: Infinity,\n\tmaxStringLength: Infinity,\n\t...opts\n}) : (v) => JSON.stringify(v);\nconst inspect = (value, options) => String(platformInspect(value, options));\nconst utf8Encoder = new TextEncoder();\nfunction renderMessageParts(msgParts, valueRenderer) {\n\tconst msgLen = msgParts.length;\n\tif (msgLen === 1) return msgParts[0];\n\tif (msgLen <= 6) {\n\t\tlet message = \"\";\n\t\tfor (let i = 0; i < msgLen; i++) message += i % 2 === 0 ? msgParts[i] : valueRenderer(msgParts[i]);\n\t\treturn message;\n\t}\n\tconst parts = new Array(msgLen);\n\tfor (let i = 0; i < msgLen; i++) parts[i] = i % 2 === 0 ? msgParts[i] : valueRenderer(msgParts[i]);\n\treturn parts.join(\"\");\n}\nfunction padZero(num) {\n\treturn num < 10 ? `0${num}` : `${num}`;\n}\nfunction padThree(num) {\n\treturn num < 10 ? `00${num}` : num < 100 ? `0${num}` : `${num}`;\n}\nconst fixedOffsetPattern = /^([+-])(0\\d|1\\d|2[0-3]):([0-5]\\d)$/;\nfunction formatOffset(minutes, full) {\n\tconst sign = minutes < 0 ? \"-\" : \"+\";\n\tconst absolute = Math.abs(minutes);\n\tconst hour = padZero(Math.floor(absolute / 60));\n\tconst minute = padZero(absolute % 60);\n\tif (!full && minute === \"00\") return `${sign}${hour}`;\n\treturn `${sign}${hour}:${minute}`;\n}\nfunction readPartsFromFormatter(formatter, ts) {\n\tconst parts = formatter.formatToParts(new Date(ts));\n\tlet year = \"\";\n\tlet month = \"\";\n\tlet day = \"\";\n\tlet hour = \"\";\n\tlet minute = \"\";\n\tlet second = \"\";\n\tfor (const part of parts) if (part.type === \"year\") year = part.value;\n\telse if (part.type === \"month\") month = part.value;\n\telse if (part.type === \"day\") day = part.value;\n\telse if (part.type === \"hour\") hour = part.value;\n\telse if (part.type === \"minute\") minute = part.value;\n\telse if (part.type === \"second\") second = part.value;\n\treturn {\n\t\tyear,\n\t\tmonth,\n\t\tday,\n\t\thour,\n\t\tminute,\n\t\tsecond\n\t};\n}\nfunction getDateParts(ts, config) {\n\tconst d = new Date(ts);\n\tconst ms = padThree(d.getUTCMilliseconds());\n\tif (config.kind === \"utc\") return {\n\t\tyear: `${d.getUTCFullYear()}`,\n\t\tmonth: padZero(d.getUTCMonth() + 1),\n\t\tday: padZero(d.getUTCDate()),\n\t\thour: padZero(d.getUTCHours()),\n\t\tminute: padZero(d.getUTCMinutes()),\n\t\tsecond: padZero(d.getUTCSeconds()),\n\t\tms,\n\t\toffsetMinutes: 0\n\t};\n\tif (config.kind === \"local\") return {\n\t\tyear: `${d.getFullYear()}`,\n\t\tmonth: padZero(d.getMonth() + 1),\n\t\tday: padZero(d.getDate()),\n\t\thour: padZero(d.getHours()),\n\t\tminute: padZero(d.getMinutes()),\n\t\tsecond: padZero(d.getSeconds()),\n\t\tms,\n\t\toffsetMinutes: -d.getTimezoneOffset()\n\t};\n\tif (config.kind === \"offset\") {\n\t\tconst shifted = new Date(ts + config.minutes * 6e4);\n\t\treturn {\n\t\t\tyear: `${shifted.getUTCFullYear()}`,\n\t\t\tmonth: padZero(shifted.getUTCMonth() + 1),\n\t\t\tday: padZero(shifted.getUTCDate()),\n\t\t\thour: padZero(shifted.getUTCHours()),\n\t\t\tminute: padZero(shifted.getUTCMinutes()),\n\t\t\tsecond: padZero(shifted.getUTCSeconds()),\n\t\t\tms,\n\t\t\toffsetMinutes: config.minutes\n\t\t};\n\t}\n\tconst parts = readPartsFromFormatter(config.formatter, ts);\n\tconst asUtc = Date.UTC(Number(parts.year), Number(parts.month) - 1, Number(parts.day), Number(parts.hour), Number(parts.minute), Number(parts.second), d.getUTCMilliseconds());\n\tconst offsetMinutes = Math.round((asUtc - ts) / 6e4);\n\treturn {\n\t\t...parts,\n\t\tms,\n\t\toffsetMinutes\n\t};\n}\nfunction resolveTimeZone(timeZone) {\n\tif (typeof timeZone === \"undefined\") return { kind: \"utc\" };\n\tif (timeZone === null) return { kind: \"local\" };\n\tconst offsetMatch = fixedOffsetPattern.exec(timeZone);\n\tif (offsetMatch != null) {\n\t\tconst sign = offsetMatch[1] === \"-\" ? -1 : 1;\n\t\tconst hours = Number(offsetMatch[2]);\n\t\tconst minutes = Number(offsetMatch[3]);\n\t\treturn {\n\t\t\tkind: \"offset\",\n\t\t\tminutes: sign * (hours * 60 + minutes)\n\t\t};\n\t}\n\tif (typeof Intl === \"undefined\" || typeof Intl.DateTimeFormat !== \"function\") throw new TypeError(`Invalid timeZone option: ${JSON.stringify(timeZone)}. This environment does not support IANA time zones.`);\n\ttry {\n\t\treturn {\n\t\t\tkind: \"iana\",\n\t\t\tformatter: new Intl.DateTimeFormat(\"en-CA\", {\n\t\t\t\ttimeZone,\n\t\t\t\thour12: false,\n\t\t\t\thourCycle: \"h23\",\n\t\t\t\tyear: \"numeric\",\n\t\t\t\tmonth: \"2-digit\",\n\t\t\t\tday: \"2-digit\",\n\t\t\t\thour: \"2-digit\",\n\t\t\t\tminute: \"2-digit\",\n\t\t\t\tsecond: \"2-digit\"\n\t\t\t})\n\t\t};\n\t} catch {\n\t\tthrow new TypeError(`Invalid timeZone option: ${JSON.stringify(timeZone)}. Expected an IANA time zone name (e.g., \"Asia/Seoul\") or a fixed UTC offset string (e.g., \"+09:00\").`);\n\t}\n}\nfunction createTimestampFormatter(pattern, timeZone) {\n\tif (pattern === \"none\") return () => null;\n\tif (pattern === \"rfc3339\" && timeZone.kind === \"utc\") return (ts) => new Date(ts).toISOString();\n\treturn (ts) => {\n\t\tconst parts = getDateParts(ts, timeZone);\n\t\tconst date = `${parts.year}-${parts.month}-${parts.day}`;\n\t\tconst time = `${parts.hour}:${parts.minute}:${parts.second}.${parts.ms}`;\n\t\tconst tzLong = formatOffset(parts.offsetMinutes, true);\n\t\tconst tzShort = formatOffset(parts.offsetMinutes, false);\n\t\tif (pattern === \"date-time-timezone\") return `${date} ${time} ${tzLong}`;\n\t\tif (pattern === \"date-time-tz\") return `${date} ${time} ${tzShort}`;\n\t\tif (pattern === \"date-time\") return `${date} ${time}`;\n\t\tif (pattern === \"time-timezone\") return `${time} ${tzLong}`;\n\t\tif (pattern === \"time-tz\") return `${time} ${tzShort}`;\n\t\tif (pattern === \"time\") return time;\n\t\tif (pattern === \"date\") return date;\n\t\treturn `${date}T${time}${tzLong}`;\n\t};\n}\nconst levelRenderersCache = {\n\tABBR: levelAbbreviations,\n\tabbr: {\n\t\ttrace: \"trc\",\n\t\tdebug: \"dbg\",\n\t\tinfo: \"inf\",\n\t\twarning: \"wrn\",\n\t\terror: \"err\",\n\t\tfatal: \"ftl\"\n\t},\n\tFULL: {\n\t\ttrace: \"TRACE\",\n\t\tdebug: \"DEBUG\",\n\t\tinfo: \"INFO\",\n\t\twarning: \"WARNING\",\n\t\terror: \"ERROR\",\n\t\tfatal: \"FATAL\"\n\t},\n\tfull: {\n\t\ttrace: \"trace\",\n\t\tdebug: \"debug\",\n\t\tinfo: \"info\",\n\t\twarning: \"warning\",\n\t\terror: \"error\",\n\t\tfatal: \"fatal\"\n\t},\n\tL: {\n\t\ttrace: \"T\",\n\t\tdebug: \"D\",\n\t\tinfo: \"I\",\n\t\twarning: \"W\",\n\t\terror: \"E\",\n\t\tfatal: \"F\"\n\t},\n\tl: {\n\t\ttrace: \"t\",\n\t\tdebug: \"d\",\n\t\tinfo: \"i\",\n\t\twarning: \"w\",\n\t\terror: \"e\",\n\t\tfatal: \"f\"\n\t}\n};\n/**\n* Helper function to get the line ending value based on the option.\n* @param lineEnding The line ending option.\n* @returns The line ending string.\n*/\nfunction getLineEndingValue(lineEnding) {\n\treturn lineEnding === \"crlf\" ? \"\\r\\n\" : \"\\n\";\n}\nfunction jsonReplacer(_key, value) {\n\tif (!(value instanceof Error)) return value;\n\tconst serialized = {\n\t\tname: value.name,\n\t\tmessage: value.message\n\t};\n\tif (typeof value.stack === \"string\") serialized.stack = value.stack;\n\tconst cause = value.cause;\n\tif (cause !== void 0) serialized.cause = cause;\n\tif (typeof AggregateError !== \"undefined\" && value instanceof AggregateError) serialized.errors = value.errors;\n\tfor (const key of Object.keys(value)) if (!(key in serialized)) serialized[key] = value[key];\n\treturn serialized;\n}\n/**\n* Get a text formatter with the specified options. Although it's flexible\n* enough to create a custom formatter, if you want more control, you can\n* create a custom formatter that satisfies the {@link TextFormatter} type\n* instead.\n*\n* For more information on the options, see {@link TextFormatterOptions}.\n*\n* By default, the formatter formats log records as follows:\n*\n* ```\n* 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!\n* ```\n* @param options The options for the text formatter.\n* @returns The text formatter.\n* @since 0.6.0\n*/\nfunction getTextFormatter(options = {}) {\n\tconst timestampRenderer = (() => {\n\t\tconst tsOption = options.timestamp;\n\t\tconst timeZone = resolveTimeZone(options.timeZone);\n\t\tif (tsOption == null) return createTimestampFormatter(\"date-time-timezone\", timeZone);\n\t\telse if (tsOption === \"disabled\") return createTimestampFormatter(\"none\", timeZone);\n\t\telse if (typeof tsOption === \"string\" && (tsOption === \"date-time-timezone\" || tsOption === \"date-time-tz\" || tsOption === \"date-time\" || tsOption === \"time-timezone\" || tsOption === \"time-tz\" || tsOption === \"time\" || tsOption === \"date\" || tsOption === \"rfc3339\" || tsOption === \"none\")) return createTimestampFormatter(tsOption, timeZone);\n\t\telse return tsOption;\n\t})();\n\tconst categorySeparator = options.category ?? \"·\";\n\tconst valueRenderer = options.value ? (v) => options.value(v, inspect) : inspect;\n\tconst levelRenderer = (() => {\n\t\tconst levelOption = options.level;\n\t\tif (levelOption == null || levelOption === \"ABBR\") return (level) => levelRenderersCache.ABBR[level];\n\t\telse if (levelOption === \"abbr\") return (level) => levelRenderersCache.abbr[level];\n\t\telse if (levelOption === \"FULL\") return (level) => levelRenderersCache.FULL[level];\n\t\telse if (levelOption === \"full\") return (level) => levelRenderersCache.full[level];\n\t\telse if (levelOption === \"L\") return (level) => levelRenderersCache.L[level];\n\t\telse if (levelOption === \"l\") return (level) => levelRenderersCache.l[level];\n\t\telse return levelOption;\n\t})();\n\tconst lineEnding = getLineEndingValue(options.lineEnding);\n\tconst formatter = options.format ?? (({ timestamp, level, category, message }) => `${timestamp ? `${timestamp} ` : \"\"}[${level}] ${category}: ${message}`);\n\treturn (record) => {\n\t\tconst message = renderMessageParts(record.message, valueRenderer);\n\t\tconst timestamp = timestampRenderer(record.timestamp);\n\t\tconst level = levelRenderer(record.level);\n\t\tconst category = typeof categorySeparator === \"function\" ? categorySeparator(record.category) : record.category.join(categorySeparator);\n\t\tconst values = {\n\t\t\ttimestamp,\n\t\t\tlevel,\n\t\t\tcategory,\n\t\t\tmessage,\n\t\t\trecord\n\t\t};\n\t\treturn `${formatter(values)}${lineEnding}`;\n\t};\n}\n/**\n* The default text formatter. This formatter formats log records as follows:\n*\n* ```\n* 2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!\n* ```\n*\n* @param record The log record to format.\n* @returns The formatted log record.\n*/\nconst defaultTextFormatter = getTextFormatter();\nconst RESET = \"\\x1B[0m\";\nconst ansiColors = {\n\tblack: \"\\x1B[30m\",\n\tred: \"\\x1B[31m\",\n\tgreen: \"\\x1B[32m\",\n\tyellow: \"\\x1B[33m\",\n\tblue: \"\\x1B[34m\",\n\tmagenta: \"\\x1B[35m\",\n\tcyan: \"\\x1B[36m\",\n\twhite: \"\\x1B[37m\"\n};\nconst ansiStyles = {\n\tbold: \"\\x1B[1m\",\n\tdim: \"\\x1B[2m\",\n\titalic: \"\\x1B[3m\",\n\tunderline: \"\\x1B[4m\",\n\tstrikethrough: \"\\x1B[9m\"\n};\nconst defaultLevelColors = {\n\ttrace: null,\n\tdebug: \"blue\",\n\tinfo: \"green\",\n\twarning: \"yellow\",\n\terror: \"red\",\n\tfatal: \"magenta\"\n};\n/**\n* Get an ANSI color formatter with the specified options.\n*\n* ![A preview of an ANSI color formatter.](https://i.imgur.com/I8LlBUf.png)\n* @param option The options for the ANSI color formatter.\n* @returns The ANSI color formatter.\n* @since 0.6.0\n*/\nfunction getAnsiColorFormatter(options = {}) {\n\tconst format = options.format;\n\tconst timestampStyle = typeof options.timestampStyle === \"undefined\" ? \"dim\" : options.timestampStyle;\n\tconst timestampColor = options.timestampColor ?? null;\n\tconst timestampPrefix = `${timestampStyle == null ? \"\" : ansiStyles[timestampStyle]}${timestampColor == null ? \"\" : ansiColors[timestampColor]}`;\n\tconst timestampSuffix = timestampStyle == null && timestampColor == null ? \"\" : RESET;\n\tconst levelStyle = typeof options.levelStyle === \"undefined\" ? \"bold\" : options.levelStyle;\n\tconst levelColors = options.levelColors ?? defaultLevelColors;\n\tconst categoryStyle = typeof options.categoryStyle === \"undefined\" ? \"dim\" : options.categoryStyle;\n\tconst categoryColor = options.categoryColor ?? null;\n\tconst categoryPrefix = `${categoryStyle == null ? \"\" : ansiStyles[categoryStyle]}${categoryColor == null ? \"\" : ansiColors[categoryColor]}`;\n\tconst categorySuffix = categoryStyle == null && categoryColor == null ? \"\" : RESET;\n\treturn getTextFormatter({\n\t\ttimestamp: \"date-time-tz\",\n\t\tvalue(value, fallbackInspect) {\n\t\t\treturn fallbackInspect(value, { colors: true });\n\t\t},\n\t\t...options,\n\t\tformat({ timestamp, level, category, message, record }) {\n\t\t\tconst levelColor = levelColors[record.level];\n\t\t\ttimestamp = timestamp == null ? null : `${timestampPrefix}${timestamp}${timestampSuffix}`;\n\t\t\tlevel = `${levelStyle == null ? \"\" : ansiStyles[levelStyle]}${levelColor == null ? \"\" : ansiColors[levelColor]}${level}${levelStyle == null && levelColor == null ? \"\" : RESET}`;\n\t\t\treturn format == null ? `${timestamp == null ? \"\" : `${timestamp} `}${level} ${categoryPrefix}${category}:${categorySuffix} ${message}` : format({\n\t\t\t\ttimestamp,\n\t\t\t\tlevel,\n\t\t\t\tcategory: `${categoryPrefix}${category}${categorySuffix}`,\n\t\t\t\tmessage,\n\t\t\t\trecord\n\t\t\t});\n\t\t}\n\t});\n}\n/**\n* A text formatter that uses ANSI colors to format log records.\n*\n* ![A preview of ansiColorFormatter.](https://i.imgur.com/I8LlBUf.png)\n*\n* @param record The log record to format.\n* @returns The formatted log record.\n* @since 0.5.0\n*/\nconst ansiColorFormatter = getAnsiColorFormatter();\n/**\n* Get a [JSON Lines] formatter with the specified options. The log records\n* will be rendered as JSON objects, one per line, which is a common format\n* for log files. This format is also known as Newline-Delimited JSON (NDJSON).\n* It looks like this:\n*\n* ```json\n* {\"@timestamp\":\"2023-11-14T22:13:20.000Z\",\"level\":\"INFO\",\"message\":\"Hello, world!\",\"logger\":\"my.logger\",\"properties\":{\"key\":\"value\"}}\n* ```\n*\n* [JSON Lines]: https://jsonlines.org/\n* @param options The options for the JSON Lines formatter.\n* @returns The JSON Lines formatter.\n* @since 0.11.0\n*/\nfunction getJsonLinesFormatter(options = {}) {\n\tconst lineEnding = getLineEndingValue(options.lineEnding);\n\tif (!options.categorySeparator && !options.message && !options.properties) return (record) => {\n\t\tif (record.message.length === 3) return JSON.stringify({\n\t\t\t\"@timestamp\": new Date(record.timestamp).toISOString(),\n\t\t\tlevel: record.level === \"warning\" ? \"WARN\" : record.level.toUpperCase(),\n\t\t\tmessage: record.message[0] + JSON.stringify(record.message[1]) + record.message[2],\n\t\t\tlogger: record.category.join(\".\"),\n\t\t\tproperties: record.properties\n\t\t}, jsonReplacer) + lineEnding;\n\t\tif (record.message.length === 1) return JSON.stringify({\n\t\t\t\"@timestamp\": new Date(record.timestamp).toISOString(),\n\t\t\tlevel: record.level === \"warning\" ? \"WARN\" : record.level.toUpperCase(),\n\t\t\tmessage: record.message[0],\n\t\t\tlogger: record.category.join(\".\"),\n\t\t\tproperties: record.properties\n\t\t}, jsonReplacer) + lineEnding;\n\t\tlet msg = record.message[0];\n\t\tfor (let i = 1; i < record.message.length; i++) msg += i & 1 ? JSON.stringify(record.message[i]) : record.message[i];\n\t\treturn JSON.stringify({\n\t\t\t\"@timestamp\": new Date(record.timestamp).toISOString(),\n\t\t\tlevel: record.level === \"warning\" ? \"WARN\" : record.level.toUpperCase(),\n\t\t\tmessage: msg,\n\t\t\tlogger: record.category.join(\".\"),\n\t\t\tproperties: record.properties\n\t\t}, jsonReplacer) + lineEnding;\n\t};\n\tconst isTemplateMessage = options.message === \"template\";\n\tconst propertiesOption = options.properties ?? \"nest:properties\";\n\tlet joinCategory;\n\tif (typeof options.categorySeparator === \"function\") joinCategory = options.categorySeparator;\n\telse {\n\t\tconst separator = options.categorySeparator ?? \".\";\n\t\tjoinCategory = (category) => category.join(separator);\n\t}\n\tlet getProperties;\n\tif (propertiesOption === \"flatten\") getProperties = (properties) => properties;\n\telse if (propertiesOption.startsWith(\"prepend:\")) {\n\t\tconst prefix = propertiesOption.substring(8);\n\t\tif (prefix === \"\") throw new TypeError(`Invalid properties option: ${JSON.stringify(propertiesOption)}. It must be of the form \"prepend:<prefix>\" where <prefix> is a non-empty string.`);\n\t\tgetProperties = (properties) => {\n\t\t\tconst result = {};\n\t\t\tfor (const key in properties) result[`${prefix}${key}`] = properties[key];\n\t\t\treturn result;\n\t\t};\n\t} else if (propertiesOption.startsWith(\"nest:\")) {\n\t\tconst key = propertiesOption.substring(5);\n\t\tgetProperties = (properties) => ({ [key]: properties });\n\t} else throw new TypeError(`Invalid properties option: ${JSON.stringify(propertiesOption)}. It must be \"flatten\", \"prepend:<prefix>\", or \"nest:<key>\".`);\n\tlet getMessage;\n\tif (isTemplateMessage) getMessage = (record) => {\n\t\tif (typeof record.rawMessage === \"string\") return record.rawMessage;\n\t\tlet msg = \"\";\n\t\tfor (let i = 0; i < record.rawMessage.length; i++) {\n\t\t\tif (i > 0) msg += \"{}\";\n\t\t\tmsg += record.rawMessage[i];\n\t\t}\n\t\treturn msg;\n\t};\n\telse getMessage = (record) => {\n\t\tconst msgLen = record.message.length;\n\t\tif (msgLen === 1) return record.message[0];\n\t\tlet msg = \"\";\n\t\tfor (let i = 0; i < msgLen; i++) msg += i % 2 < 1 ? record.message[i] : JSON.stringify(record.message[i]);\n\t\treturn msg;\n\t};\n\treturn (record) => {\n\t\treturn JSON.stringify({\n\t\t\t\"@timestamp\": new Date(record.timestamp).toISOString(),\n\t\t\tlevel: record.level === \"warning\" ? \"WARN\" : record.level.toUpperCase(),\n\t\t\tmessage: getMessage(record),\n\t\t\tlogger: joinCategory(record.category),\n\t\t\t...getProperties(record.properties)\n\t\t}, jsonReplacer) + lineEnding;\n\t};\n}\n/**\n* The default [JSON Lines] formatter. This formatter formats log records\n* as JSON objects, one per line, which is a common format for log files.\n* It looks like this:\n*\n* ```json\n* {\"@timestamp\":\"2023-11-14T22:13:20.000Z\",\"level\":\"INFO\",\"message\":\"Hello, world!\",\"logger\":\"my.logger\",\"properties\":{\"key\":\"value\"}}\n* ```\n*\n* You can customize the output by passing options to\n* {@link getJsonLinesFormatter}. For example, you can change the category\n* separator, the message format, and how the properties are formatted.\n*\n* [JSON Lines]: https://jsonlines.org/\n* @since 0.11.0\n*/\nconst jsonLinesFormatter = getJsonLinesFormatter();\nfunction renderStructuredMessage(record, template) {\n\tif (template) {\n\t\tif (typeof record.rawMessage === \"string\") return record.rawMessage;\n\t\treturn record.rawMessage.join(\"{}\");\n\t}\n\treturn renderMessageParts(record.message, stringifyLogfmtValue);\n}\nfunction filterLogfmtKey(key) {\n\tif (key === \"\") return null;\n\tlet needsEscape = false;\n\tfor (const char of key) {\n\t\tconst code = char.codePointAt(0);\n\t\tif (shouldEscapeLogfmtKeyChar(char, code)) {\n\t\t\tneedsEscape = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!needsEscape) return key;\n\tlet result = \"\";\n\tfor (const char of key) {\n\t\tconst code = char.codePointAt(0);\n\t\tif (shouldEscapeLogfmtKeyChar(char, code)) result += encodeLogfmtKeyChar(char);\n\t\telse result += char;\n\t}\n\treturn result;\n}\nfunction shouldEscapeLogfmtKeyChar(char, code) {\n\treturn code <= 32 || code === 127 || code === 65533 || char === \"=\" || char === \"\\\"\" || char === \"%\";\n}\nfunction encodeLogfmtKeyChar(char) {\n\tlet result = \"\";\n\tfor (const byte of utf8Encoder.encode(char)) result += `%${byte.toString(16).toUpperCase().padStart(2, \"0\")}`;\n\treturn result;\n}\nfunction stringifyLogfmtValue(value) {\n\tif (typeof value === \"string\") return value;\n\tif (value === null) return \"null\";\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\" || typeof value === \"undefined\" || typeof value === \"symbol\" || typeof value === \"function\") return String(value);\n\ttry {\n\t\tconst json = JSON.stringify(value, jsonReplacer);\n\t\tif (typeof json === \"string\") return unwrapJsonStringLiteral(json);\n\t} catch {}\n\treturn inspect(value, { colors: false });\n}\nfunction unwrapJsonStringLiteral(json) {\n\tif (json.startsWith(\"\\\"\") && json.endsWith(\"\\\"\")) return JSON.parse(json);\n\treturn json;\n}\nfunction quoteLogfmtValue(value, isString) {\n\tlet needsQuote = value === \"\" || isString && shouldQuoteStringLiteral(value);\n\tfor (const char of value) {\n\t\tconst code = char.codePointAt(0);\n\t\tif (shouldQuoteLogfmtValueChar(char, code)) {\n\t\t\tneedsQuote = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!needsQuote) return value;\n\tlet quoted = \"\";\n\tfor (const char of value) {\n\t\tconst code = char.codePointAt(0);\n\t\tquoted += escapeLogfmtValueChar(char, code);\n\t}\n\treturn `\"${quoted}\"`;\n}\nfunction shouldQuoteStringLiteral(value) {\n\treturn value === \"null\" || value === \"undefined\" || value === \"true\" || value === \"false\";\n}\nfunction shouldQuoteLogfmtValueChar(char, code) {\n\treturn code <= 32 || code === 127 || code === 65533 || char === \"=\" || char === \"\\\"\" || char === \"\\\\\";\n}\nfunction escapeLogfmtValueChar(char, code) {\n\tswitch (char) {\n\t\tcase \"\t\": return \"\\\\t\";\n\t\tcase \"\\n\": return \"\\\\n\";\n\t\tcase \"\\r\": return \"\\\\r\";\n\t\tcase \"\\\"\": return \"\\\\\\\"\";\n\t\tcase \"\\\\\": return \"\\\\\\\\\";\n\t\tdefault: return code <= 31 || code === 127 ? `\\\\u${code.toString(16).padStart(4, \"0\")}` : char;\n\t}\n}\nfunction formatLogfmtValue(value) {\n\tconst stringified = stringifyLogfmtValue(value);\n\treturn quoteLogfmtValue(stringified, typeof value === \"string\");\n}\nfunction pushLogfmtPair(pairs, key, value) {\n\tconst filteredKey = filterLogfmtKey(key);\n\tif (filteredKey == null) return;\n\tpairs.push(`${filteredKey}=${formatLogfmtValue(value)}`);\n}\n/**\n* Get a [logfmt] formatter with the specified options. The log records\n* will be rendered as space-delimited key-value pairs, one record per line.\n* It looks like this:\n*\n* ```text\n* time=2023-11-14T22:13:20.000Z level=info logger=my.logger msg=\"Hello, world!\" key=value\n* ```\n*\n* [logfmt]: https://brandur.org/logfmt\n* @param options The options for the logfmt formatter.\n* @returns The logfmt formatter.\n* @since 2.1.0\n*/\nfunction getLogfmtFormatter(options = {}) {\n\tconst prependPrefix = \"prepend:\";\n\tconst lineEnding = getLineEndingValue(options.lineEnding);\n\tconst timestampRenderer = createTimestampFormatter(\"rfc3339\", resolveTimeZone(options.timeZone));\n\tconst isTemplateMessage = options.message === \"template\";\n\tconst propertiesOption = options.properties ?? \"flatten\";\n\tlet joinCategory;\n\tif (typeof options.categorySeparator === \"function\") joinCategory = options.categorySeparator;\n\telse {\n\t\tconst separator = options.categorySeparator ?? \".\";\n\t\tjoinCategory = (category) => category.join(separator);\n\t}\n\tlet propertyPrefix = \"\";\n\tif (propertiesOption === \"flatten\") propertyPrefix = \"\";\n\telse if (propertiesOption.startsWith(prependPrefix)) {\n\t\tpropertyPrefix = propertiesOption.substring(prependPrefix.length);\n\t\tif (propertyPrefix === \"\") throw new TypeError(\"Invalid properties option: \" + JSON.stringify(propertiesOption) + \". It must be of the form \\\"prepend:<prefix>\\\" where <prefix> is a non-empty string.\");\n\t} else throw new TypeError(`Invalid properties option: ${JSON.stringify(propertiesOption)}. It must be \"flatten\" or \"prepend:<prefix>\".`);\n\treturn (record) => {\n\t\tconst pairs = [];\n\t\tpushLogfmtPair(pairs, \"time\", timestampRenderer(record.timestamp));\n\t\tpushLogfmtPair(pairs, \"level\", record.level);\n\t\tpushLogfmtPair(pairs, \"logger\", joinCategory(record.category));\n\t\tpushLogfmtPair(pairs, \"msg\", renderStructuredMessage(record, isTemplateMessage));\n\t\tfor (const key in record.properties) if (Object.prototype.hasOwnProperty.call(record.properties, key)) pushLogfmtPair(pairs, `${propertyPrefix}${key}`, record.properties[key]);\n\t\treturn `${pairs.join(\" \")}${lineEnding}`;\n\t};\n}\n/**\n* The default [logfmt] formatter. This formatter formats log records as\n* space-delimited key-value pairs, one record per line.\n*\n* [logfmt]: https://brandur.org/logfmt\n* @since 2.1.0\n*/\nconst logfmtFormatter = getLogfmtFormatter();\n/**\n* The styles for the log level in the console.\n*/\nconst logLevelStyles = {\n\t\"trace\": \"background-color: gray; color: white;\",\n\t\"debug\": \"background-color: gray; color: white;\",\n\t\"info\": \"background-color: white; color: black;\",\n\t\"warning\": \"background-color: orange; color: black;\",\n\t\"error\": \"background-color: red; color: white;\",\n\t\"fatal\": \"background-color: maroon; color: white;\"\n};\n/**\n* The default console formatter.\n*\n* @param record The log record to format.\n* @returns The formatted log record, as an array of arguments for\n* {@link console.log}.\n*/\nfunction defaultConsoleFormatter(record) {\n\tlet msg = \"\";\n\tconst values = [];\n\tfor (let i = 0; i < record.message.length; i++) if (i % 2 === 0) msg += record.message[i];\n\telse {\n\t\tmsg += \"%o\";\n\t\tvalues.push(record.message[i]);\n\t}\n\tconst date = new Date(record.timestamp);\n\tconst time = `${date.getUTCHours().toString().padStart(2, \"0\")}:${date.getUTCMinutes().toString().padStart(2, \"0\")}:${date.getUTCSeconds().toString().padStart(2, \"0\")}.${date.getUTCMilliseconds().toString().padStart(3, \"0\")}`;\n\treturn [\n\t\t`%c${time} %c${levelAbbreviations[record.level]}%c %c${record.category.join(\"·\")} %c${msg}`,\n\t\t\"color: gray;\",\n\t\tlogLevelStyles[record.level],\n\t\t\"background-color: default;\",\n\t\t\"color: gray;\",\n\t\t\"color: default;\",\n\t\t...values\n\t];\n}\n\n//#endregion\nexport { ansiColorFormatter, defaultConsoleFormatter, defaultTextFormatter, getAnsiColorFormatter, getJsonLinesFormatter, getLogfmtFormatter, getTextFormatter, jsonLinesFormatter, logfmtFormatter };\n//# sourceMappingURL=formatter.js.map","import { toFilter } from \"./filter.js\";\nimport { compareLogLevel } from \"./level.js\";\nimport { LoggerImpl } from \"./logger.js\";\nimport { defaultConsoleFormatter, defaultTextFormatter } from \"./formatter.js\";\n\n//#region src/sink.ts\n/**\n* Turns a sink into a filtered sink. The returned sink only logs records that\n* pass the filter.\n*\n* @example Filter a console sink to only log records with the info level\n* ```typescript\n* const sink = withFilter(getConsoleSink(), \"info\");\n* ```\n*\n* @param sink A sink to be filtered.\n* @param filter A filter to apply to the sink. It can be either a filter\n* function or a {@link LogLevel} string.\n* @returns A sink that only logs records that pass the filter.\n*/\nfunction withFilter(sink, filter) {\n\tconst filterFunc = toFilter(filter);\n\tconst filtered = (record) => {\n\t\tif (filterFunc(record)) sink(record);\n\t};\n\tconst disposableSink = sink;\n\tif (Symbol.dispose in disposableSink) filtered[Symbol.dispose] = disposableSink[Symbol.dispose]?.bind(sink);\n\tif (Symbol.asyncDispose in disposableSink) filtered[Symbol.asyncDispose] = disposableSink[Symbol.asyncDispose]?.bind(sink);\n\treturn filtered;\n}\n/**\n* A factory that returns a sink that writes to a {@link WritableStream}.\n*\n* Note that the `stream` is of Web Streams API, which is different from\n* Node.js streams. You can convert a Node.js stream to a Web Streams API\n* stream using [`stream.Writable.toWeb()`] method.\n*\n* [`stream.Writable.toWeb()`]: https://nodejs.org/api/stream.html#streamwritabletowebstreamwritable\n*\n* @example Sink to the standard error in Deno\n* ```typescript\n* const stderrSink = getStreamSink(Deno.stderr.writable);\n* ```\n*\n* @example Sink to the standard error in Node.js\n* ```typescript\n* import stream from \"node:stream\";\n* const stderrSink = getStreamSink(stream.Writable.toWeb(process.stderr));\n* ```\n*\n* @param stream The stream to write to.\n* @param options The options for the sink.\n* @returns A sink that writes to the stream.\n*/\nfunction getStreamSink(stream, options = {}) {\n\tconst formatter = options.formatter ?? defaultTextFormatter;\n\tconst encoder = options.encoder ?? new TextEncoder();\n\tconst writer = stream.getWriter();\n\tif (!options.nonBlocking) {\n\t\tlet lastPromise = Promise.resolve();\n\t\tconst sink = (record) => {\n\t\t\tconst bytes = encoder.encode(formatter(record));\n\t\t\tlastPromise = lastPromise.then(() => writer.ready).then(() => writer.write(bytes));\n\t\t};\n\t\tsink[Symbol.asyncDispose] = async () => {\n\t\t\tawait lastPromise;\n\t\t\tawait writer.close();\n\t\t};\n\t\treturn sink;\n\t}\n\tconst nonBlockingConfig = options.nonBlocking === true ? {} : options.nonBlocking;\n\tconst bufferSize = nonBlockingConfig.bufferSize ?? 100;\n\tconst flushInterval = nonBlockingConfig.flushInterval ?? 100;\n\tconst buffer = [];\n\tlet flushTimer = null;\n\tlet disposed = false;\n\tlet activeFlush = null;\n\tconst maxBufferSize = bufferSize * 2;\n\tasync function flush() {\n\t\tif (buffer.length === 0) return;\n\t\tconst records = buffer.splice(0);\n\t\tfor (const record of records) try {\n\t\t\tconst bytes = encoder.encode(formatter(record));\n\t\t\tawait writer.ready;\n\t\t\tawait writer.write(bytes);\n\t\t} catch {}\n\t}\n\tfunction scheduleFlush() {\n\t\tif (activeFlush) return;\n\t\tactiveFlush = flush().finally(() => {\n\t\t\tactiveFlush = null;\n\t\t});\n\t}\n\tfunction startFlushTimer() {\n\t\tif (flushTimer !== null || disposed) return;\n\t\tflushTimer = setInterval(() => {\n\t\t\tscheduleFlush();\n\t\t}, flushInterval);\n\t}\n\tconst nonBlockingSink = (record) => {\n\t\tif (disposed) return;\n\t\tif (buffer.length >= maxBufferSize) buffer.shift();\n\t\tbuffer.push(record);\n\t\tif (buffer.length >= bufferSize) scheduleFlush();\n\t\telse if (flushTimer === null) startFlushTimer();\n\t};\n\tnonBlockingSink[Symbol.asyncDispose] = async () => {\n\t\tdisposed = true;\n\t\tif (flushTimer !== null) {\n\t\t\tclearInterval(flushTimer);\n\t\t\tflushTimer = null;\n\t\t}\n\t\tawait flush();\n\t\ttry {\n\t\t\tawait writer.close();\n\t\t} catch {}\n\t};\n\treturn nonBlockingSink;\n}\n/**\n* A console sink factory that returns a sink that logs to the console.\n*\n* @param options The options for the sink.\n* @returns A sink that logs to the console. If `nonBlocking` is enabled,\n* returns a sink that also implements {@link Disposable}.\n*/\nfunction getConsoleSink(options = {}) {\n\tconst formatter = options.formatter ?? defaultConsoleFormatter;\n\tconst levelMap = {\n\t\ttrace: \"debug\",\n\t\tdebug: \"debug\",\n\t\tinfo: \"info\",\n\t\twarning: \"warn\",\n\t\terror: \"error\",\n\t\tfatal: \"error\",\n\t\t...options.levelMap ?? {}\n\t};\n\tconst console = options.console ?? globalThis.console;\n\tconst baseSink = (record) => {\n\t\tconst args = formatter(record);\n\t\tconst method = levelMap[record.level];\n\t\tif (method === void 0) throw new TypeError(`Invalid log level: ${record.level}.`);\n\t\tif (typeof args === \"string\") {\n\t\t\tconst msg = args.replace(/\\r?\\n$/, \"\");\n\t\t\tconsole[method](msg);\n\t\t} else console[method](...args);\n\t};\n\tif (!options.nonBlocking) return baseSink;\n\tconst nonBlockingConfig = options.nonBlocking === true ? {} : options.nonBlocking;\n\tconst bufferSize = nonBlockingConfig.bufferSize ?? 100;\n\tconst flushInterval = nonBlockingConfig.flushInterval ?? 100;\n\tconst buffer = [];\n\tlet flushTimer = null;\n\tlet scheduledFlushTimer = null;\n\tlet disposed = false;\n\tlet flushScheduled = false;\n\tconst maxBufferSize = bufferSize * 2;\n\tfunction flush() {\n\t\tif (buffer.length === 0) return;\n\t\tconst records = buffer.splice(0);\n\t\tfor (const record of records) try {\n\t\t\tbaseSink(record);\n\t\t} catch {}\n\t}\n\tfunction scheduleFlush() {\n\t\tif (flushScheduled) return;\n\t\tflushScheduled = true;\n\t\tscheduledFlushTimer = setTimeout(() => {\n\t\t\tscheduledFlushTimer = null;\n\t\t\tflushScheduled = false;\n\t\t\tflush();\n\t\t}, 0);\n\t}\n\tfunction startFlushTimer() {\n\t\tif (flushTimer !== null || disposed) return;\n\t\tflushTimer = setInterval(() => {\n\t\t\tflush();\n\t\t}, flushInterval);\n\t}\n\tconst nonBlockingSink = (record) => {\n\t\tif (disposed) return;\n\t\tif (buffer.length >= maxBufferSize) buffer.shift();\n\t\tbuffer.push(record);\n\t\tif (buffer.length >= bufferSize) scheduleFlush();\n\t\telse if (flushTimer === null) startFlushTimer();\n\t};\n\tnonBlockingSink[Symbol.dispose] = () => {\n\t\tdisposed = true;\n\t\tif (flushTimer !== null) {\n\t\t\tclearInterval(flushTimer);\n\t\t\tflushTimer = null;\n\t\t}\n\t\tif (scheduledFlushTimer !== null) {\n\t\t\tclearTimeout(scheduledFlushTimer);\n\t\t\tscheduledFlushTimer = null;\n\t\t\tflushScheduled = false;\n\t\t}\n\t\tflush();\n\t};\n\treturn nonBlockingSink;\n}\n/**\n* Converts an async sink into a regular sink with proper async handling.\n* The returned sink chains async operations to ensure proper ordering and\n* implements AsyncDisposable to wait for all pending operations on disposal.\n*\n* @example Create a sink that asynchronously posts to a webhook\n* ```typescript\n* const asyncSink: AsyncSink = async (record) => {\n* await fetch(\"https://example.com/logs\", {\n* method: \"POST\",\n* body: JSON.stringify(record),\n* });\n* };\n* const sink = fromAsyncSink(asyncSink);\n* ```\n*\n* @param asyncSink The async sink function to convert.\n* @returns A sink that properly handles async operations and disposal.\n* @since 1.0.0\n*/\nfunction fromAsyncSink(asyncSink) {\n\tlet lastPromise = Promise.resolve();\n\tconst sink = (record) => {\n\t\tlastPromise = lastPromise.then(() => asyncSink(record)).catch((error) => {\n\t\t\ttry {\n\t\t\t\tif (_asyncSinkError in record) return;\n\t\t\t\tconst metaLogger = LoggerImpl.getLogger([\"logtape\", \"meta\"]);\n\t\t\t\tconst errorRecord = {\n\t\t\t\t\tcategory: [\"logtape\", \"meta\"],\n\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\ttimestamp: Date.now(),\n\t\t\t\t\trawMessage: \"Async sink error: {error}\",\n\t\t\t\t\tmessage: [\n\t\t\t\t\t\t\"Async sink error: \",\n\t\t\t\t\t\terror,\n\t\t\t\t\t\t\"\"\n\t\t\t\t\t],\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\terror,\n\t\t\t\t\t\tsink: asyncSink,\n\t\t\t\t\t\trecord\n\t\t\t\t\t},\n\t\t\t\t\t[_asyncSinkError]: true\n\t\t\t\t};\n\t\t\t\tmetaLogger.emit(errorRecord, new Set([sink]));\n\t\t\t} catch {}\n\t\t});\n\t};\n\tsink[Symbol.asyncDispose] = async () => {\n\t\tfor (;;) {\n\t\t\tconst promise = lastPromise;\n\t\t\tawait promise;\n\t\t\tif (promise === lastPromise) break;\n\t\t}\n\t};\n\treturn sink;\n}\nconst _asyncSinkError = Symbol.for(\"logtape.asyncSinkError\");\n/**\n* Creates a sink that buffers log records until a trigger level is reached.\n* This pattern, known as \"fingers crossed\" logging, keeps detailed debug logs\n* in memory and only outputs them when an error or other significant event occurs.\n*\n* @example Basic usage with default settings\n* ```typescript\n* const sink = fingersCrossed(getConsoleSink());\n* // Debug and info logs are buffered\n* // When an error occurs, all buffered logs + the error are output\n* ```\n*\n* @example Custom trigger level and buffer size\n* ```typescript\n* const sink = fingersCrossed(getConsoleSink(), {\n* triggerLevel: \"warning\", // Trigger on warning or higher\n* maxBufferSize: 500 // Keep last 500 records\n* });\n* ```\n*\n* @example Category isolation\n* ```typescript\n* const sink = fingersCrossed(getConsoleSink(), {\n* isolateByCategory: \"descendant\" // Separate buffers per category\n* });\n* // Error in [\"app\"] triggers flush of [\"app\"] and [\"app\", \"module\"] buffers\n* // But not [\"other\"] buffer\n* ```\n*\n* @param sink The sink to wrap. Buffered records are sent to this sink when\n* triggered.\n* @param options Configuration options for the fingers crossed behavior.\n* @returns A sink that buffers records until the trigger level is reached.\n* @since 1.1.0\n*/\nfunction fingersCrossed(sink, options = {}) {\n\tconst triggerLevel = options.triggerLevel ?? \"error\";\n\tconst bufferLevel = options.bufferLevel;\n\tconst maxBufferSize = Math.max(0, options.maxBufferSize ?? 1e3);\n\tconst isolateByCategory = options.isolateByCategory;\n\tconst isolateByContext = options.isolateByContext;\n\tconst bufferTtlMs = isolateByContext?.bufferTtlMs;\n\tconst cleanupIntervalMs = isolateByContext?.cleanupIntervalMs ?? 3e4;\n\tconst maxContexts = isolateByContext?.maxContexts;\n\tconst hasTtl = bufferTtlMs != null && bufferTtlMs > 0;\n\tconst hasLru = maxContexts != null && maxContexts > 0;\n\ttry {\n\t\tcompareLogLevel(\"trace\", triggerLevel);\n\t} catch (error) {\n\t\tthrow new TypeError(`Invalid triggerLevel: ${JSON.stringify(triggerLevel)}. ${error instanceof Error ? error.message : String(error)}`);\n\t}\n\tif (bufferLevel != null) {\n\t\ttry {\n\t\t\tcompareLogLevel(\"trace\", bufferLevel);\n\t\t} catch (error) {\n\t\t\tthrow new TypeError(`Invalid bufferLevel: ${JSON.stringify(bufferLevel)}. ${error instanceof Error ? error.message : String(error)}`);\n\t\t}\n\t\tif (compareLogLevel(bufferLevel, triggerLevel) >= 0) throw new RangeError(`bufferLevel (${JSON.stringify(bufferLevel)}) must be lower than triggerLevel (${JSON.stringify(triggerLevel)}).`);\n\t}\n\tfunction isDescendant(parent, child) {\n\t\tif (parent.length === 0 || child.length === 0) return false;\n\t\tif (parent.length > child.length) return false;\n\t\treturn parent.every((p, i) => p === child[i]);\n\t}\n\tfunction isAncestor(child, parent) {\n\t\tif (child.length === 0 || parent.length === 0) return false;\n\t\tif (child.length < parent.length) return false;\n\t\treturn parent.every((p, i) => p === child[i]);\n\t}\n\tlet shouldFlushBuffer = null;\n\tif (isolateByCategory) if (typeof isolateByCategory === \"function\") shouldFlushBuffer = isolateByCategory;\n\telse switch (isolateByCategory) {\n\t\tcase \"descendant\":\n\t\t\tshouldFlushBuffer = (trigger, buffered) => isDescendant(trigger, buffered);\n\t\t\tbreak;\n\t\tcase \"ancestor\":\n\t\t\tshouldFlushBuffer = (trigger, buffered) => isAncestor(trigger, buffered);\n\t\t\tbreak;\n\t\tcase \"both\":\n\t\t\tshouldFlushBuffer = (trigger, buffered) => isDescendant(trigger, buffered) || isAncestor(trigger, buffered);\n\t\t\tbreak;\n\t}\n\tfunction getCategoryKey(category) {\n\t\treturn JSON.stringify(category);\n\t}\n\tfunction parseCategoryKey(key) {\n\t\treturn JSON.parse(key);\n\t}\n\tfunction getContextKey(properties) {\n\t\tif (!isolateByContext || isolateByContext.keys.length === 0) return \"\";\n\t\tconst contextValues = {};\n\t\tfor (const key of isolateByContext.keys) if (key in properties) contextValues[key] = properties[key];\n\t\treturn JSON.stringify(contextValues);\n\t}\n\tfunction getBufferKey(category, properties) {\n\t\tconst categoryKey = getCategoryKey(category);\n\t\tif (!isolateByContext) return categoryKey;\n\t\tconst contextKey = getContextKey(properties);\n\t\treturn `${categoryKey}:${contextKey}`;\n\t}\n\tfunction parseBufferKey(key) {\n\t\tif (!isolateByContext) return {\n\t\t\tcategory: parseCategoryKey(key),\n\t\t\tcontext: \"\"\n\t\t};\n\t\tconst separatorIndex = key.indexOf(\"]:\");\n\t\tif (separatorIndex === -1) return {\n\t\t\tcategory: parseCategoryKey(key),\n\t\t\tcontext: \"\"\n\t\t};\n\t\tconst categoryPart = key.substring(0, separatorIndex + 1);\n\t\tconst contextPart = key.substring(separatorIndex + 2);\n\t\treturn {\n\t\t\tcategory: parseCategoryKey(categoryPart),\n\t\t\tcontext: contextPart\n\t\t};\n\t}\n\tfunction cleanupExpiredBuffers(buffers, triggered) {\n\t\tif (!hasTtl) return;\n\t\tconst now = Date.now();\n\t\tconst expiredKeys = [];\n\t\tfor (const [key, metadata] of buffers) {\n\t\t\tif (metadata.buffer.length === 0) continue;\n\t\t\tconst lastRecordTimestamp = metadata.buffer[metadata.buffer.length - 1].timestamp;\n\t\t\tif (now - lastRecordTimestamp > bufferTtlMs) expiredKeys.push(key);\n\t\t}\n\t\tfor (const key of expiredKeys) {\n\t\t\tbuffers.delete(key);\n\t\t\ttriggered.delete(key);\n\t\t}\n\t\tfor (const [key, triggeredAt] of triggered) if (now - triggeredAt > bufferTtlMs) triggered.delete(key);\n\t}\n\tfunction evictLruBuffers(buffers, numToEvict) {\n\t\tif (!hasLru) return;\n\t\tconst toEvict = numToEvict ?? Math.max(0, buffers.size - maxContexts);\n\t\tif (toEvict <= 0) return;\n\t\tconst sortedEntries = Array.from(buffers.entries()).sort(([, a], [, b]) => a.lastAccess - b.lastAccess);\n\t\tfor (let i = 0; i < toEvict; i++) {\n\t\t\tconst [key] = sortedEntries[i];\n\t\t\tbuffers.delete(key);\n\t\t}\n\t}\n\tif (!isolateByCategory && !isolateByContext) {\n\t\tconst buffer = [];\n\t\tlet triggered = false;\n\t\treturn (record) => {\n\t\t\tif (triggered) {\n\t\t\t\tsink(record);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (compareLogLevel(record.level, triggerLevel) >= 0) {\n\t\t\t\ttriggered = true;\n\t\t\t\tfor (const bufferedRecord of buffer) sink(bufferedRecord);\n\t\t\t\tbuffer.length = 0;\n\t\t\t\tsink(record);\n\t\t\t} else if (bufferLevel != null && compareLogLevel(record.level, bufferLevel) > 0) sink(record);\n\t\t\telse {\n\t\t\t\tbuffer.push(record);\n\t\t\t\twhile (buffer.length > maxBufferSize) buffer.shift();\n\t\t\t}\n\t\t};\n\t} else {\n\t\tconst buffers = /* @__PURE__ */ new Map();\n\t\tconst triggered = /* @__PURE__ */ new Map();\n\t\tlet accessCounter = 0;\n\t\tlet cleanupTimer = null;\n\t\tif (hasTtl) cleanupTimer = setInterval(() => {\n\t\t\tcleanupExpiredBuffers(buffers, triggered);\n\t\t}, cleanupIntervalMs);\n\t\tconst fingersCrossedSink = (record) => {\n\t\t\tconst bufferKey = getBufferKey(record.category, record.properties);\n\t\t\tif (triggered.has(bufferKey)) {\n\t\t\t\ttriggered.set(bufferKey, Date.now());\n\t\t\t\tsink(record);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (compareLogLevel(record.level, triggerLevel) >= 0) {\n\t\t\t\tconst keysToFlush = /* @__PURE__ */ new Set();\n\t\t\t\tfor (const [bufferedKey] of buffers) if (bufferedKey === bufferKey) keysToFlush.add(bufferedKey);\n\t\t\t\telse {\n\t\t\t\t\tconst { category: bufferedCategory, context: bufferedContext } = parseBufferKey(bufferedKey);\n\t\t\t\t\tconst { context: triggerContext } = parseBufferKey(bufferKey);\n\t\t\t\t\tlet contextMatches = true;\n\t\t\t\t\tif (isolateByContext) contextMatches = bufferedContext === triggerContext;\n\t\t\t\t\tlet categoryMatches = false;\n\t\t\t\t\tif (!isolateByCategory) categoryMatches = contextMatches;\n\t\t\t\t\telse if (shouldFlushBuffer) try {\n\t\t\t\t\t\tcategoryMatches = shouldFlushBuffer(record.category, bufferedCategory);\n\t\t\t\t\t} catch {}\n\t\t\t\t\telse categoryMatches = getCategoryKey(record.category) === getCategoryKey(bufferedCategory);\n\t\t\t\t\tif (contextMatches && categoryMatches) keysToFlush.add(bufferedKey);\n\t\t\t\t}\n\t\t\t\tconst allRecordsToFlush = [];\n\t\t\t\tconst triggeredAt = Date.now();\n\t\t\t\tfor (const key of keysToFlush) {\n\t\t\t\t\tconst metadata = buffers.get(key);\n\t\t\t\t\tif (metadata) {\n\t\t\t\t\t\tallRecordsToFlush.push(...metadata.buffer);\n\t\t\t\t\t\tbuffers.delete(key);\n\t\t\t\t\t\ttriggered.set(key, triggeredAt);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tallRecordsToFlush.sort((a, b) => a.timestamp - b.timestamp);\n\t\t\t\tfor (const bufferedRecord of allRecordsToFlush) sink(bufferedRecord);\n\t\t\t\ttriggered.set(bufferKey, triggeredAt);\n\t\t\t\tsink(record);\n\t\t\t} else if (bufferLevel != null && compareLogLevel(record.level, bufferLevel) > 0) sink(record);\n\t\t\telse {\n\t\t\t\tlet metadata = buffers.get(bufferKey);\n\t\t\t\tif (!metadata) {\n\t\t\t\t\tif (hasLru && buffers.size >= maxContexts) {\n\t\t\t\t\t\tconst numToEvict = buffers.size - maxContexts + 1;\n\t\t\t\t\t\tevictLruBuffers(buffers, numToEvict);\n\t\t\t\t\t}\n\t\t\t\t\tmetadata = {\n\t\t\t\t\t\tbuffer: [],\n\t\t\t\t\t\tlastAccess: ++accessCounter\n\t\t\t\t\t};\n\t\t\t\t\tbuffers.set(bufferKey, metadata);\n\t\t\t\t} else metadata.lastAccess = ++accessCounter;\n\t\t\t\tmetadata.buffer.push(record);\n\t\t\t\twhile (metadata.buffer.length > maxBufferSize) metadata.buffer.shift();\n\t\t\t}\n\t\t};\n\t\tif (cleanupTimer !== null) fingersCrossedSink[Symbol.dispose] = () => {\n\t\t\tif (cleanupTimer !== null) {\n\t\t\t\tclearInterval(cleanupTimer);\n\t\t\t\tcleanupTimer = null;\n\t\t\t}\n\t\t};\n\t\treturn fingersCrossedSink;\n\t}\n}\n\n//#endregion\nexport { fingersCrossed, fromAsyncSink, getConsoleSink, getStreamSink, withFilter };\n//# sourceMappingURL=sink.js.map","import { toFilter } from \"./filter.js\";\nimport { LoggerImpl } from \"./logger.js\";\nimport { getConsoleSink } from \"./sink.js\";\n\n//#region src/config.ts\n/**\n* The current configuration, if any. Otherwise, `null`.\n*/\nlet currentConfig = null;\n/**\n* Strong references to the loggers.\n* This is to prevent the loggers from being garbage collected so that their\n* sinks and filters are not removed.\n*/\nconst strongRefs = /* @__PURE__ */ new Set();\n/**\n* Sync filter disposables to dispose when resetting the configuration.\n*/\nconst filterDisposables = /* @__PURE__ */ new Set();\n/**\n* Sync sink disposables to dispose when resetting the configuration.\n*/\nconst sinkDisposables = /* @__PURE__ */ new Set();\n/**\n* Async filter disposables to dispose when resetting the configuration.\n*/\nconst asyncFilterDisposables = /* @__PURE__ */ new Set();\n/**\n* Async sink disposables to dispose when resetting the configuration.\n*/\nconst asyncSinkDisposables = /* @__PURE__ */ new Set();\n/**\n* Check if a config is for the meta logger.\n*/\nfunction isLoggerConfigMeta(cfg) {\n\tconst category = Array.isArray(cfg.category) ? cfg.category : [cfg.category];\n\treturn category.length === 0 || category.length === 1 && category[0] === \"logtape\" || category.length === 2 && category[0] === \"logtape\" && category[1] === \"meta\";\n}\nfunction registerDisposeHook(allowAsync) {\n\tconst handler = allowAsync ? dispose : disposeSync;\n\tif (typeof globalThis.EdgeRuntime !== \"string\" && \"process\" in globalThis && !(\"Deno\" in globalThis)) {\n\t\tconst proc = globalThis.process;\n\t\tconst onMethod = proc?.[\"on\"];\n\t\tif (typeof onMethod === \"function\") {\n\t\t\tonMethod.call(proc, \"exit\", handler);\n\t\t\treturn;\n\t\t}\n\t}\n\tconst addEventListenerMethod = globalThis.addEventListener;\n\tif (typeof addEventListenerMethod !== \"function\") return;\n\tif (\"Deno\" in globalThis) addEventListenerMethod.call(globalThis, \"unload\", handler);\n\telse addEventListenerMethod.call(globalThis, \"pagehide\", handler);\n}\n/**\n* Configure the loggers with the specified configuration.\n*\n* Note that if the given sinks or filters are disposable, they will be\n* disposed when the configuration is reset, or when the process exits.\n*\n* @example\n* ```typescript\n* await configure({\n* sinks: {\n* console: getConsoleSink(),\n* },\n* filters: {\n* slow: (log) =>\n* \"duration\" in log.properties &&\n* log.properties.duration as number > 1000,\n* },\n* loggers: [\n* {\n* category: \"my-app\",\n* sinks: [\"console\"],\n* lowestLevel: \"info\",\n* },\n* {\n* category: [\"my-app\", \"sql\"],\n* filters: [\"slow\"],\n* lowestLevel: \"debug\",\n* },\n* {\n* category: \"logtape\",\n* sinks: [\"console\"],\n* lowestLevel: \"error\",\n* },\n* ],\n* });\n* ```\n*\n* @param config The configuration.\n*/\nasync function configure(config) {\n\tif (currentConfig != null && !config.reset) throw new ConfigError(\"Already configured; if you want to reset, turn on the reset flag.\");\n\tawait reset();\n\ttry {\n\t\tconfigureInternal(config, true);\n\t} catch (e) {\n\t\tif (e instanceof ConfigError) await reset();\n\t\tthrow e;\n\t}\n}\n/**\n* Configure sync loggers with the specified configuration.\n*\n* Note that if the given sinks or filters are disposable, they will be\n* disposed when the configuration is reset, or when the process exits.\n*\n* Also note that passing async sinks or filters will throw. If\n* necessary use {@link resetSync} or {@link disposeSync}.\n*\n* @example\n* ```typescript\n* configureSync({\n* sinks: {\n* console: getConsoleSink(),\n* },\n* loggers: [\n* {\n* category: \"my-app\",\n* sinks: [\"console\"],\n* lowestLevel: \"info\",\n* },\n* {\n* category: \"logtape\",\n* sinks: [\"console\"],\n* lowestLevel: \"error\",\n* },\n* ],\n* });\n* ```\n*\n* @param config The configuration.\n* @since 0.9.0\n*/\nfunction configureSync(config) {\n\tif (currentConfig != null && !config.reset) throw new ConfigError(\"Already configured; if you want to reset, turn on the reset flag.\");\n\tif (asyncFilterDisposables.size > 0 || asyncSinkDisposables.size > 0) throw new ConfigError(\"Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().\");\n\tresetSync();\n\ttry {\n\t\tconfigureInternal(config, false);\n\t} catch (e) {\n\t\tif (e instanceof ConfigError) resetSync();\n\t\tthrow e;\n\t}\n}\nfunction configureInternal(config, allowAsync) {\n\tcurrentConfig = config;\n\tlet metaConfigured = false;\n\tconst configuredCategories = /* @__PURE__ */ new Set();\n\tfor (const cfg of config.loggers) {\n\t\tif (isLoggerConfigMeta(cfg)) metaConfigured = true;\n\t\tconst categoryKey = Array.isArray(cfg.category) ? JSON.stringify(cfg.category) : JSON.stringify([cfg.category]);\n\t\tif (configuredCategories.has(categoryKey)) throw new ConfigError(`Duplicate logger configuration for category: ${categoryKey}. Each category can only be configured once.`);\n\t\tconfiguredCategories.add(categoryKey);\n\t\tconst logger = LoggerImpl.getLogger(cfg.category);\n\t\tfor (const sinkId of cfg.sinks ?? []) {\n\t\t\tconst sink = config.sinks[sinkId];\n\t\t\tif (!sink) throw new ConfigError(`Sink not found: ${sinkId}.`);\n\t\t\tlogger.sinks.push(sink);\n\t\t}\n\t\tlogger.parentSinks = cfg.parentSinks ?? \"inherit\";\n\t\tif (cfg.lowestLevel !== void 0) logger.lowestLevel = cfg.lowestLevel;\n\t\tfor (const filterId of cfg.filters ?? []) {\n\t\t\tconst filter = config.filters?.[filterId];\n\t\t\tif (filter === void 0) throw new ConfigError(`Filter not found: ${filterId}.`);\n\t\t\tlogger.filters.push(toFilter(filter));\n\t\t}\n\t\tstrongRefs.add(logger);\n\t}\n\tLoggerImpl.getLogger().contextLocalStorage = config.contextLocalStorage;\n\tfor (const sink of Object.values(config.sinks)) {\n\t\tif (Symbol.asyncDispose in sink) if (allowAsync) asyncSinkDisposables.add(sink);\n\t\telse throw new ConfigError(\"Async disposables cannot be used with configureSync().\");\n\t\tif (Symbol.dispose in sink) sinkDisposables.add(sink);\n\t}\n\tfor (const filter of Object.values(config.filters ?? {})) {\n\t\tif (filter == null || typeof filter === \"string\") continue;\n\t\tif (Symbol.asyncDispose in filter) {\n\t\t\tif (allowAsync) asyncFilterDisposables.add(filter);\n\t\t\telse throw new ConfigError(\"Async disposables cannot be used with configureSync().\");\n\t\t\tasyncSinkDisposables.delete(filter);\n\t\t}\n\t\tif (Symbol.dispose in filter) {\n\t\t\tfilterDisposables.add(filter);\n\t\t\tsinkDisposables.delete(filter);\n\t\t}\n\t}\n\tregisterDisposeHook(allowAsync);\n\tconst meta = LoggerImpl.getLogger([\"logtape\", \"meta\"]);\n\tif (!metaConfigured) meta.sinks.push(getConsoleSink());\n\tmeta.info(\"LogTape loggers are configured. Note that LogTape itself uses the meta logger, which has category {metaLoggerCategory}. The meta logger is used to log internal diagnostics such as sink exceptions. It's recommended to configure the meta logger with a separate sink so that you can easily notice if logging itself fails or is misconfigured. To turn off this message, configure the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.\", {\n\t\tmetaLoggerCategory: [\"logtape\", \"meta\"],\n\t\tdismissLevel: \"info\"\n\t});\n}\n/**\n* Get the current configuration, if any. Otherwise, `null`.\n* @returns The current configuration, if any. Otherwise, `null`.\n*/\nfunction getConfig() {\n\treturn currentConfig;\n}\n/**\n* Reset the configuration. Mostly for testing purposes.\n*/\nasync function reset() {\n\tawait dispose();\n\tresetInternal();\n}\n/**\n* Reset the configuration. Mostly for testing purposes. Will not clear async\n* sinks, only use with sync sinks. Use {@link reset} if you have async sinks.\n* @since 0.9.0\n*/\nfunction resetSync() {\n\tdisposeSync();\n\tresetInternal();\n}\nfunction resetInternal() {\n\tconst rootLogger = LoggerImpl.getLogger([]);\n\trootLogger.resetDescendants();\n\tdelete rootLogger.contextLocalStorage;\n\tstrongRefs.clear();\n\tcurrentConfig = null;\n}\n/**\n* Dispose of the disposables.\n*/\nasync function dispose() {\n\tconst errors = [];\n\ttry {\n\t\tdisposeSyncFilters();\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\ttry {\n\t\tawait disposeAsyncFilters();\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\ttry {\n\t\tdisposeSyncSinks();\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\ttry {\n\t\tawait disposeAsyncSinks();\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\tthrowDisposeErrors(errors);\n}\n/**\n* Dispose of the sync disposables. Async disposables will be untouched,\n* use {@link dispose} if you have async sinks.\n* @since 0.9.0\n*/\nfunction disposeSync() {\n\tconst errors = [];\n\ttry {\n\t\tdisposeSyncFilters();\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\ttry {\n\t\tdisposeSyncSinks();\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\tthrowDisposeErrors(errors);\n}\nfunction disposeSyncFilters() {\n\tdisposeSyncDisposables(filterDisposables);\n}\nfunction disposeSyncSinks() {\n\tdisposeSyncDisposables(sinkDisposables);\n}\nfunction disposeSyncDisposables(disposables) {\n\tconst errors = [];\n\ttry {\n\t\tfor (const disposable of disposables) try {\n\t\t\tdisposable[Symbol.dispose]();\n\t\t} catch (error) {\n\t\t\terrors.push(error);\n\t\t} finally {\n\t\t\tdisposables.delete(disposable);\n\t\t}\n\t} finally {\n\t\tdisposables.clear();\n\t}\n\tthrowDisposeErrors(errors);\n}\nasync function disposeAsyncFilters() {\n\tawait disposeAsyncDisposables(asyncFilterDisposables);\n}\nasync function disposeAsyncSinks() {\n\tawait disposeAsyncDisposables(asyncSinkDisposables);\n}\nasync function disposeAsyncDisposables(disposables) {\n\tconst promises = [];\n\ttry {\n\t\tfor (const disposable of disposables) try {\n\t\t\tpromises.push(Promise.resolve(disposable[Symbol.asyncDispose]()));\n\t\t} catch (error) {\n\t\t\tpromises.push(Promise.reject(error));\n\t\t} finally {\n\t\t\tdisposables.delete(disposable);\n\t\t}\n\t} finally {\n\t\tdisposables.clear();\n\t}\n\tawait settleDisposePromises(promises);\n}\nasync function settleDisposePromises(promises) {\n\tconst results = await Promise.allSettled(promises);\n\tthrowDisposeErrors(results.filter((result) => result.status === \"rejected\").map((result) => result.reason));\n}\nfunction throwDisposeErrors(errors) {\n\tif (errors.length < 1) return;\n\tif (errors.length === 1) throw errors[0];\n\tthrow new AggregateError(errors, \"Multiple errors occurred while disposing LogTape resources.\");\n}\n/**\n* A configuration error.\n*/\nvar ConfigError = class extends Error {\n\t/**\n\t* Constructs a new configuration error.\n\t* @param message The error message.\n\t*/\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"ConfigError\";\n\t}\n};\n\n//#endregion\nexport { ConfigError, configure, configureSync, dispose, disposeSync, getConfig, reset, resetSync };\n//# sourceMappingURL=config.js.map","/**\n * LogTape configuration entry point.\n *\n * `@logtape/logtape` ships a tiny library-first API: a global\n * `configure({ sinks, loggers })` and a `getLogger(category)` that\n * routes to the configured sinks. We expose a small wrapper so the\n * boot path can hand LogTape the built-in `\"console-json\"` shortcut\n * (or any custom `Sink` function — pretty rendering lives in\n * `@baerly/adapter-node` so picocolors stays off the kernel) and\n * an env-driven level override.\n *\n * The wrapper is intentionally thin: anything LogTape can do\n * (custom sinks, filters, child loggers via `getChild`) the caller\n * can do by importing LogTape directly. We add value only on the\n * defaults + env-shorthand surface.\n *\n * ## Categories\n *\n * Canonical category names live as constants ({@link CATEGORY}) so\n * downstream modules in this dispatch (and Dispatch 3+ wiring code)\n * type-check the string at the call site instead of fat-fingering\n * `\"baerly.htttp\"` and silently producing an unrouteable logger.\n *\n * ## Levels\n *\n * LogTape's canonical name for the warn level is `\"warning\"`. Our\n * config surface accepts the shorter `\"warn\"` because it matches\n * the rest of the project's vocabulary; we translate at the\n * configure boundary.\n *\n * ## Idempotency\n *\n * `configureObservability` is safe to call multiple times. LogTape's\n * own `configure` will reject re-configuration without `reset: true`;\n * we always pass `reset: true` so the last call wins and operators\n * can hot-swap config in dev without restarting.\n */\n\nimport {\n configure,\n getLogger as logtapeGetLogger,\n type Logger,\n type LogLevel,\n type Sink,\n} from \"@logtape/logtape\";\n\n/**\n * Canonical category names. Use these instead of bare strings.\n *\n * Each entry is a two-segment array (`[\"baerly\", \"<unit>\"]`) so\n * LogTape's hierarchical routing — categories descend by element,\n * not by string-split — picks up the parent `\"baerly\"` config we\n * register in {@link configureObservability}. Passing the dotted\n * string `\"baerly.http\"` would create a single-element sibling\n * category and miss the parent's sink wiring.\n */\nexport const CATEGORY = {\n http: [\"baerly\", \"http\"],\n storage: [\"baerly\", \"storage\"],\n} as const;\n\n/** Logical type of a `CATEGORY.*` value. */\nexport type CategoryName = (typeof CATEGORY)[keyof typeof CATEGORY];\n\n/** Friendly level names accepted by {@link configureObservability}. */\nexport type FriendlyLogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\n\n/**\n * `configureObservability` configuration.\n *\n * Anything `undefined` falls back through the env-var pipeline.\n */\nexport interface ObservabilityConfig {\n /**\n * Lowest level that reaches the sink. Records below this level\n * are dropped. Fallback chain:\n * `config.level → LOG_LEVEL env → \"info\"`.\n */\n readonly level?: FriendlyLogLevel;\n /**\n * Sink shorthand or a custom LogTape {@link Sink}.\n *\n * - `\"console-json\"` — one JSON object per line via `console.log`.\n * - A {@link Sink} function — passed through verbatim. Adapters\n * targeting TTY environments (e.g. `@baerly/adapter-node`'s\n * `baerlyDev()` Vite-mount path) construct a pretty sink locally\n * and pass it as a function; the kernel deliberately does not\n * ship a pretty-printer to keep `picocolors` off the runtime\n * closure.\n *\n * Default: `\"console-json\"`.\n */\n readonly sink?: \"console-json\" | Sink;\n}\n\n/**\n * Wire LogTape's global config.\n *\n * Idempotent — call as many times as you like. The adapter boot\n * path calls it once at init; tests call it once per\n * `beforeEach`.\n */\nexport const configureObservability = async (config: ObservabilityConfig = {}): Promise<void> => {\n const level = resolveLevel(config.level);\n const sink = resolveSink(config.sink);\n\n await configure({\n reset: true,\n sinks: { primary: sink },\n loggers: [\n // Bind every `baerly.*` category to our sink at the chosen level.\n { category: \"baerly\", sinks: [\"primary\"], lowestLevel: level },\n // LogTape itself logs to a meta category; route it to the same\n // sink at `error` so we see config issues without spamming.\n { category: [\"logtape\", \"meta\"], sinks: [\"primary\"], lowestLevel: \"error\" },\n ],\n });\n};\n\n/**\n * Thin re-export. Identical shape to `@logtape/logtape`'s `getLogger`.\n * Constants in {@link CATEGORY} are the canonical inputs; bare\n * strings still work for ad-hoc instrumentation.\n */\nexport const getLogger = (category: string | readonly string[]): Logger =>\n logtapeGetLogger(category);\n\n// ---------- internals ----------\n\n/** Map our friendly `\"warn\"` onto LogTape's canonical `\"warning\"`. */\nconst toLogTapeLevel = (l: FriendlyLogLevel): LogLevel => (l === \"warn\" ? \"warning\" : l);\n\nconst resolveLevel = (configLevel: FriendlyLogLevel | undefined): LogLevel => {\n if (configLevel !== undefined) {\n return toLogTapeLevel(configLevel);\n }\n const env = readEnv(\"LOG_LEVEL\")?.toLowerCase();\n if (env === \"debug\" || env === \"info\" || env === \"error\") {\n return env;\n }\n if (env === \"warn\" || env === \"warning\") {\n return \"warning\";\n }\n return \"info\";\n};\n\nconst resolveSink = (configSink: ObservabilityConfig[\"sink\"]): Sink => {\n if (typeof configSink === \"function\") {\n return configSink;\n }\n return jsonConsoleSink();\n};\n\nconst readEnv = (name: string): string | undefined => {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process\n ?.env;\n return env?.[name];\n};\n\n/**\n * Built-in JSON-line sink. Each record becomes one `console.log`\n * call with a flat object containing `timestamp`, `level`,\n * `category`, `message`, and the record's `properties`.\n */\nconst jsonConsoleSink = (): Sink => (record) => {\n const payload = {\n timestamp: record.timestamp,\n level: record.level,\n category: record.category.join(\".\"),\n message: record.message.map((m) => (typeof m === \"string\" ? m : JSON.stringify(m))).join(\"\"),\n ...record.properties,\n };\n // eslint-disable-next-line no-console -- intentional sink target\n console.log(JSON.stringify(payload));\n};\n","/**\n * Canonical-line outcome derivation for HTTP requests. Shared\n * helper used by `packages/server/src/http/router.ts` (Mode B\n * standalone branch) and both host adapters\n * (`@baerly/adapter-node`'s server.ts and\n * `@baerly/adapter-cloudflare`'s worker.ts).\n *\n * Classification rules (evaluated in order):\n *\n * 1. `error !== undefined && status >= 500` → `\"error\"`. The\n * handler threw and the wire status surfaced as 5xx; the\n * canonical line carries the diagnostic at error level.\n * 2. `status < 400` and `method === \"GET\"` → `\"read\"`.\n * 3. `status < 400` and any other method → `\"committed\"`.\n * 4. `status === 409` → `\"conflict\"`\n * (writer CAS loss).\n * 5. Anything else (other 4xx/5xx) → `\"error\"`.\n *\n * Pure function — no allocations beyond the returned string\n * literal, no logging, no side effects. Safe to call from any\n * scope.\n *\n * @param method - The HTTP method that produced this response.\n * Case-sensitive; pass `req.method` verbatim.\n * @param status - The wire status the caller will see. For thrown\n * errors that haven't yet mapped to a response,\n * pass the result of `mapError(err).status`.\n * @param error - The error object attached to the request (if\n * any). Optional — pass `undefined` on the\n * happy path.\n */\nexport type Outcome = \"read\" | \"committed\" | \"conflict\" | \"error\";\n\nexport const deriveOutcome = (method: string, status: number, error?: unknown): Outcome => {\n if (error !== undefined && status >= 500) {\n return \"error\";\n }\n if (status < 400) {\n return method === \"GET\" ? \"read\" : \"committed\";\n }\n if (status === 409) {\n return \"conflict\";\n }\n return \"error\";\n};\n","/**\n * Canonical-log-line flusher.\n *\n * One HTTP request emits exactly one canonical line at its end. The\n * line carries: the request id, the duration, the outcome string,\n * the HTTP status, every entry the per-request\n * {@link RequestScopedMetricsRecorder} accumulated, every entry the\n * {@link ObservabilityContext.fields} bag picked up along the way,\n * and a redacted error structure on the failure path.\n *\n * Every HTTP request emits a line; level is computed from\n * status/error.\n *\n * Level mapping at emit time:\n *\n * - `error` present → `error`\n * - `status >= 500` → `error`\n * - `status >= 400` → `warn`\n * - otherwise → `info`\n */\n\nimport { BaerlyError } from \"@baerly/protocol\";\nimport { errorEnvelope } from \"../contract.ts\";\nimport { CATEGORY, getLogger } from \"./logger.ts\";\nimport {\n createObservabilityContext,\n runWithContext,\n type ObservabilityContext,\n} from \"./context.ts\";\nimport { deriveOutcome } from \"./derive-outcome.ts\";\nimport type { RequestScopedMetricsRecorder } from \"./recorder.ts\";\n\n/** Options accepted by {@link flushCanonicalLine}. */\nexport interface FlushCanonicalLineOptions {\n readonly unit: \"http\";\n /** HTTP status code. Influences the level decision. */\n readonly status?: number;\n /**\n * Short outcome tag. In production all callsites route through\n * {@link deriveOutcome} which yields one of `\"read\"` /\n * `\"committed\"` / `\"conflict\"` / `\"error\"`; the field is typed\n * `string` so test fixtures and future units can pass a\n * unit-specific tag without type gymnastics.\n */\n readonly outcome: string;\n /** Thrown value on the failure path. */\n readonly error?: unknown;\n /** Caller-supplied extra fields, spread onto the line last (override fields/summary). */\n readonly extra?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * Emit (or suppress) the canonical line for this unit-of-work.\n *\n * Idempotent in the sense that the caller is expected to call it\n * exactly once per unit-of-work. Calling it twice will produce two\n * lines — there is no internal latch.\n */\nexport const flushCanonicalLine = (\n ctx: ObservabilityContext,\n recorder: RequestScopedMetricsRecorder,\n opts: FlushCanonicalLineOptions,\n): void => {\n const level = pickLevel(opts);\n const properties = buildProperties(ctx, recorder, opts, level);\n const logger = getLogger(CATEGORY.http);\n\n switch (level) {\n case \"error\": {\n logger.error(\"canonical\", properties);\n return;\n }\n case \"warn\": {\n logger.warn(\"canonical\", properties);\n return;\n }\n case \"info\": {\n logger.info(\"canonical\", properties);\n return;\n }\n }\n};\n\n/**\n * HTTP unit-of-work scope. Opens an {@link ObservabilityContext} from the\n * inbound `Request` (request id from `x-request-id` header or generated),\n * runs `fetch(req)` under {@link runWithContext}, and flushes the canonical\n * line in finally with `unit: \"http\"`.\n *\n * Production adapters open their own context BEFORE calling\n * `createRouter().fetch`; this helper is for standalone callers (tests,\n * one-off harnesses) that want one canonical line per request without\n * managing the bracket themselves.\n *\n * Behaviour mirrors what the legacy `app.use(\"*\", ...)` middleware\n * did in Mode B (no ambient context): canonical line on every\n * request in `finally`. Because this wrapper sits OUTSIDE\n * `app.fetch`, errors absorbed by `app.onError` reach the caller as\n * a non-2xx `Response` whose body is the {@link HttpErrorEnvelope};\n * the helper reconstructs a `BaerlyError` from that envelope so the\n * canonical line carries the same `{ code, message }` shape it would\n * have under the in-Hono middleware.\n */\nexport const withHttpObservability = async (\n req: Request,\n fetch: (req: Request) => Promise<Response> | Response,\n): Promise<Response> => {\n const requestId = req.headers.get(\"x-request-id\") ?? crypto.randomUUID();\n const ctx = createObservabilityContext({\n request_id: requestId,\n });\n\n const path = new URL(req.url).pathname;\n\n return runWithContext(ctx, async () => {\n let response: Response | undefined;\n let caughtError: unknown;\n try {\n response = await fetch(req);\n return response;\n } catch (error) {\n // Rare: a throw escaped `app.onError` (e.g. a non-Error\n // rejection that compose rethrows). The caller sees the throw;\n // we record it on the canonical line as best we can.\n caughtError = error;\n throw error;\n } finally {\n // Wire status: from the Response when the inner fetch resolved,\n // else 500 for the escaped-throw fallback (matches the\n // adapter-cloudflare worker.ts pattern).\n const status = response !== undefined ? response.status : 500;\n\n // Reconstruct the structured error from the wire envelope on\n // any non-2xx response. `app.onError` has already converted the\n // original throw into an `HttpErrorEnvelope` body; parsing it\n // back into a `BaerlyError` lets the canonical line carry the\n // same `{ code, message }` shape the in-Hono middleware would\n // have read off `c.error`.\n let effectiveError: unknown = caughtError;\n if (effectiveError === undefined && response !== undefined && status >= 400) {\n effectiveError = await reconstructErrorFromEnvelope(response);\n }\n\n flushCanonicalLine(ctx, ctx.recorder, {\n unit: \"http\",\n status,\n outcome: deriveOutcome(req.method, status, effectiveError),\n ...(effectiveError !== undefined && { error: effectiveError }),\n extra: { method: req.method, path },\n });\n }\n });\n};\n\n/**\n * Best-effort BaerlyError reconstruction from a non-2xx\n * {@link HttpErrorEnvelope}. Used by {@link withHttpObservability} to\n * preserve the canonical-line `error` shape across `app.onError`\n * (which swallows the original throw).\n *\n * Failures (non-JSON body, missing fields, already-consumed stream)\n * fall through to `undefined` — the canonical line then surfaces only\n * the wire status, which is the worst-case behaviour the legacy\n * middleware would have produced on an unrecognised throw shape.\n */\nconst reconstructErrorFromEnvelope = async (response: Response): Promise<unknown> => {\n try {\n const body = (await response.clone().json()) as {\n readonly error?: { readonly code?: string; readonly message?: string };\n };\n const code = body.error?.code;\n const message = body.error?.message;\n if (typeof code !== \"string\" || typeof message !== \"string\") {\n return undefined;\n }\n return new BaerlyError(code as BaerlyError[\"code\"], message);\n } catch {\n return undefined;\n }\n};\n\n/**\n * Verifier rejected the request — log the warn, flush the canonical\n * line, and return the 401 envelope Response. Adapters call this\n * inside `runWithContext(obsCtx, ...)` so the canonical line lands on\n * the same context the rest of the request would have used.\n *\n * Both adapters share this so the 401 wire shape AND the\n * observability record are byte-identical across runtimes.\n */\nexport const flushUnauthorizedAndRespond = (\n obsCtx: ObservabilityContext,\n req: Request,\n): Response => {\n getLogger(CATEGORY.http).warn(\"verifier_rejected\", { reason: \"null\" });\n const path = new URL(req.url).pathname;\n flushCanonicalLine(obsCtx, obsCtx.recorder, {\n unit: \"http\",\n status: 401,\n outcome: \"error\",\n extra: { method: req.method, path },\n });\n return new Response(\n JSON.stringify(errorEnvelope(\"Unauthorized\", \"Missing or invalid Authorization header\")),\n { status: 401, headers: { \"content-type\": \"application/json\" } },\n );\n};\n\n// ---------- internals ----------\n\ntype Level = \"info\" | \"warn\" | \"error\";\n\nconst pickLevel = (opts: FlushCanonicalLineOptions): Level => {\n if (opts.error !== undefined) {\n return \"error\";\n }\n if (opts.status !== undefined) {\n if (opts.status >= 500) {\n return \"error\";\n }\n if (opts.status >= 400) {\n return \"warn\";\n }\n }\n return \"info\";\n};\n\nconst buildProperties = (\n ctx: ObservabilityContext,\n recorder: RequestScopedMetricsRecorder,\n opts: FlushCanonicalLineOptions,\n level: Level,\n): Record<string, unknown> => {\n const duration_ms = Math.max(0, performance.now() - ctx.started_at);\n const props: Record<string, unknown> = {\n ...recorder.summarize(),\n request_id: ctx.request_id,\n duration_ms,\n outcome: opts.outcome,\n };\n if (opts.status !== undefined) {\n props[\"status\"] = opts.status;\n }\n\n // ctx.fields can override summary entries (operator-driven\n // override); opts.extra wins last so callers retain final say.\n for (const [k, v] of ctx.fields) {\n props[k] = v;\n }\n if (opts.extra !== undefined) {\n Object.assign(props, opts.extra);\n }\n\n if (opts.error !== undefined) {\n props[\"error\"] = serializeError(opts.error, level === \"error\");\n }\n\n return props;\n};\n\n/**\n * Shape carried by the canonical line under its `error` key.\n *\n * `code` is one of `BaerlyErrorCode` for known `BaerlyError`s, or the\n * literal `\"Internal\"` for anything else. The string-typing keeps the\n * consumer-side handling grep-friendly.\n */\nexport interface SerializedError {\n readonly code: string;\n readonly message: string;\n readonly stack?: string;\n}\n\n/**\n * Convert an unknown thrown value into a {@link SerializedError}.\n *\n * Two rules:\n *\n * 1. `BaerlyError` — preserve its `code` discriminant verbatim.\n * 2. Any other error or non-error value — collapse to\n * `{ code: \"Internal\", message: <stringified> }`.\n *\n * Stacks are included when `includeStack` is `true`. Callers pass\n * `level === \"error\"` to honor the \"stacks only at error level\" rule.\n *\n * @param err The thrown value (anything `try { ... } catch (e)` can yield).\n * @param includeStack If `true`, include the stack trace when `err` is\n * an `Error` (or `BaerlyError`) with a `stack` property. Defaults to `false`.\n */\nexport const serializeError = (err: unknown, includeStack = false): SerializedError => {\n if (err instanceof BaerlyError) {\n const base: SerializedError = { code: err.code, message: err.message };\n return includeStack && err.stack !== undefined ? { ...base, stack: err.stack } : base;\n }\n\n if (err instanceof Error) {\n const base: SerializedError = { code: \"Internal\", message: err.message };\n return includeStack && err.stack !== undefined ? { ...base, stack: err.stack } : base;\n }\n\n if (typeof err === \"object\" && err !== null) {\n try {\n return { code: \"Internal\", message: JSON.stringify(err) };\n } catch {\n return { code: \"Internal\", message: \"[unserializable object]\" };\n }\n }\n return { code: \"Internal\", message: String(err) };\n};\n","/**\n * `Storage` decorator that emits per-op observability:\n *\n * - One histogram observation per call: `db.storage.<op>.duration_ms`.\n * - One counter increment per call: `db.storage.<op>.calls_total`.\n * - One counter increment per class A / class B classification:\n * `db.storage.class_a_ops_total` / `db.storage.class_b_ops_total`.\n * We follow S3 pricing: PUT / DELETE / LIST count as class A;\n * GET counts as class B. (S3 charges Class A for PUT/POST/COPY/\n * LIST and Class B for GET/HEAD; DELETE is free under S3 but\n * we still count it as class A internally because it triggers\n * write-side traffic in the kernel's accounting.)\n * - On error: counter increment `db.storage.<op>.errors_total` and\n * re-throw the original value verbatim.\n *\n * Read paths are NOT decorated by default; consumers pass a\n * recorder when they want observation. The default no-op recorder\n * still works — every emission is a single function call.\n *\n * The decorator preserves the `Storage` contract exactly: same\n * input types, same output types, same `null`-on-not-found\n * convention, same `AsyncIterable` for `list`.\n *\n * The debug-level per-call log line is gated on\n * `getLogger(CATEGORY.storage).isEnabledFor(\"debug\")` so we don't\n * pay the formatting cost in production where the level is\n * `info` or higher. (LogTape provides `isEnabledFor` since 2.0.0.)\n */\n\nimport {\n type MetricsRecorder,\n noopMetricsRecorder,\n type Storage,\n type StorageGetOptions,\n type StorageGetResult,\n type StorageListEntry,\n type StoragePutOptions,\n type StoragePutResult,\n} from \"@baerly/protocol\";\nimport { getCurrentContext } from \"./context.ts\";\nimport { CATEGORY, getLogger } from \"./logger.ts\";\n\ntype Op = \"get\" | \"put\" | \"delete\" | \"list\";\n\nconst CLASS_A_OPS: ReadonlySet<Op> = new Set<Op>([\"put\", \"delete\", \"list\"]);\n\nconst ctxMetrics = (): MetricsRecorder => getCurrentContext()?.recorder ?? noopMetricsRecorder;\n\n/**\n * Wrap `inner` with metric emission. The returned object is itself\n * a `Storage` impl and passes the `Storage` conformance suite\n * (round-trip semantics, ETag preservation, `list` ordering — none\n * of which the decorator touches).\n *\n * Per-op counters and per-op duration histograms flow into the\n * active {@link ObservabilityContext}'s recorder (`ctxMetrics()`);\n * outside any context they fall through to {@link noopMetricsRecorder}.\n */\nexport const observableStorage = (inner: Storage): Storage => {\n const logger = getLogger(CATEGORY.storage);\n const debug = (\n op: Op,\n key: string,\n durationMs: number,\n outcome: string,\n bytes?: number,\n ): void => {\n if (!logger.isEnabledFor(\"debug\")) {\n return;\n }\n const props: Record<string, unknown> = { op, key, duration_ms: durationMs, outcome };\n if (bytes !== undefined) {\n props[\"bytes\"] = bytes;\n }\n logger.debug(\"storage\", props);\n };\n\n const recordCall = (op: Op): void => {\n const recorder = ctxMetrics();\n recorder.counter(`db.storage.${op}.calls_total`, 1);\n recorder.counter(\n CLASS_A_OPS.has(op) ? \"db.storage.class_a_ops_total\" : \"db.storage.class_b_ops_total\",\n 1,\n );\n };\n\n const recordError = (op: Op): void => {\n ctxMetrics().counter(`db.storage.${op}.errors_total`, 1);\n };\n\n const recordDuration = (op: Op, durationMs: number): void => {\n ctxMetrics().histogram(`db.storage.${op}.duration_ms`, durationMs);\n };\n\n return {\n async get(key: string, opts?: StorageGetOptions): Promise<StorageGetResult | null> {\n const op: Op = \"get\";\n recordCall(op);\n const start = performance.now();\n try {\n const result = await inner.get(key, opts);\n const dt = performance.now() - start;\n recordDuration(op, dt);\n debug(op, key, dt, result === null ? \"miss\" : \"hit\", result?.body.byteLength);\n return result;\n } catch (error) {\n const dt = performance.now() - start;\n recordDuration(op, dt);\n recordError(op);\n debug(op, key, dt, \"error\");\n throw error;\n }\n },\n\n async put(key: string, body: Uint8Array, opts?: StoragePutOptions): Promise<StoragePutResult> {\n const op: Op = \"put\";\n recordCall(op);\n const start = performance.now();\n try {\n const result = await inner.put(key, body, opts);\n const dt = performance.now() - start;\n recordDuration(op, dt);\n debug(op, key, dt, \"ok\", body.byteLength);\n return result;\n } catch (error) {\n const dt = performance.now() - start;\n recordDuration(op, dt);\n recordError(op);\n debug(op, key, dt, \"error\", body.byteLength);\n throw error;\n }\n },\n\n async delete(key: string, opts?: { signal?: AbortSignal }): Promise<void> {\n const op: Op = \"delete\";\n recordCall(op);\n const start = performance.now();\n try {\n await inner.delete(key, opts);\n const dt = performance.now() - start;\n recordDuration(op, dt);\n debug(op, key, dt, \"ok\");\n } catch (error) {\n const dt = performance.now() - start;\n recordDuration(op, dt);\n recordError(op);\n debug(op, key, dt, \"error\");\n throw error;\n }\n },\n\n list(\n prefix: string,\n opts?: { startAfter?: string; maxKeys?: number; signal?: AbortSignal },\n ): AsyncIterable<StorageListEntry> {\n const op: Op = \"list\";\n recordCall(op);\n const start = performance.now();\n const innerIter = inner.list(prefix, opts);\n return {\n async *[Symbol.asyncIterator]() {\n try {\n for await (const entry of innerIter) {\n yield entry;\n }\n const dt = performance.now() - start;\n recordDuration(op, dt);\n debug(op, prefix, dt, \"ok\");\n } catch (error) {\n const dt = performance.now() - start;\n recordDuration(op, dt);\n recordError(op);\n debug(op, prefix, dt, \"error\");\n throw error;\n }\n },\n };\n },\n };\n};\n"],"x_google_ignoreList":[1,2,3,4,5,6,7,8],"mappings":";;;;;;;;;AA+BA,MAAa,iBACX,MACA,SACA,YACuB,EACvB,OAAO;CACL;CACA;CACA,GAAI,WAAW,KAAA,KAAa,OAAO,SAAS,IAAI,EAAE,OAAO,IAAI,CAAC;AAChE,EACF;;;;;;ACnCA,MAAM,uBAAuB,OAAO,IAAI,wBAAwB;;;;;;AA8BhE,SAAS,oBAAoB;CAE5B,MAAM,QADa,WAAW,UACP,CAAC,CAAC,qBAAqB,SAAS;CACvD,IAAI,SAAS,MAAM,OAAO,CAAC;CAC3B,MAAM,SAAS,MAAM;CACrB,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC;AAC1C;;;;;;;AAOA,SAAS,qBAAqB;CAE7B,MAAM,QADa,WAAW,UACP,CAAC,CAAC,qBAAqB,SAAS;CACvD,IAAI,SAAS,MAAM,OAAO,CAAC;CAC3B,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG,OAAO,OAAO,MAAM;CAC1D,OAAO;AACR;;;ACvDA,MAAM,YAAY;CACjB;CACA;CACA;CACA;CACA;CACA;A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