@gusto/baerly-storage 0.5.0 → 0.7.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.
- package/README.md +47 -124
- package/dist/API.md +161 -511
- package/dist/CHANGELOG.md +1148 -307
- package/dist/RECIPES.md +398 -80
- package/dist/THIRD-PARTY-LICENSES.txt +5 -26
- package/dist/{app-config-DyiFK3_k.d.ts → app-config-C6qW7m8S.d.ts} +119 -111
- package/dist/app-config.d.ts +31 -1
- package/dist/app-config.js +1 -2
- package/dist/app-config.js.map +1 -1
- package/dist/auth.d.ts +33 -28
- package/dist/auth.js +549 -985
- package/dist/auth.js.map +1 -1
- package/dist/baerly.js +130 -138
- package/dist/baerly.js.map +1 -1
- package/dist/baerly.spec.json +97 -22
- package/dist/capacity-warning-header-BlVopyiI.js +16 -0
- package/dist/capacity-warning-header-BlVopyiI.js.map +1 -0
- package/dist/{client-Fe8CwB73.d.ts → client-CHQTXpef.d.ts} +121 -36
- package/dist/client-react.d.ts +67 -20
- package/dist/client-react.js +240 -54
- package/dist/client-react.js.map +1 -1
- package/dist/client.d.ts +5 -4
- package/dist/client.js +51 -16
- package/dist/client.js.map +1 -1
- package/dist/{cloudflare-DzKBrUlg.js → cloudflare-CKHYXccw.js} +504 -124
- package/dist/cloudflare-CKHYXccw.js.map +1 -0
- package/dist/cloudflare.d.ts +106 -71
- package/dist/cloudflare.js +334 -271
- package/dist/cloudflare.js.map +1 -1
- package/dist/code-resolution-CL_7L0wS.js +22 -0
- package/dist/code-resolution-CL_7L0wS.js.map +1 -0
- package/dist/collection-api-DbyhLAY8.d.ts +1001 -0
- package/dist/config-DEzInG6M.js +4035 -0
- package/dist/config-DEzInG6M.js.map +1 -0
- package/dist/constants-D3GSH3tc.js +469 -0
- package/dist/constants-D3GSH3tc.js.map +1 -0
- package/dist/{context-DRZ3tZ5l.js → context-rlpSnHFA.js} +17 -17
- package/dist/context-rlpSnHFA.js.map +1 -0
- package/dist/cost-B52llVDx.js +330 -0
- package/dist/cost-B52llVDx.js.map +1 -0
- package/dist/{current-json-C6nhPOm1.js → current-json-CC6lE4Aj.js} +115 -32
- package/dist/current-json-CC6lE4Aj.js.map +1 -0
- package/dist/db-plFUNTSF.d.ts +130 -0
- package/dist/db-read-seams-BSs0m1z1.js +3261 -0
- package/dist/db-read-seams-BSs0m1z1.js.map +1 -0
- package/dist/{deploy-DonTr-CV.js → deploy-Obj4nE-Z.js} +12 -16
- package/dist/deploy-Obj4nE-Z.js.map +1 -0
- package/dist/{dev-banner-CWHIk8tH.d.ts → dev-banner-B5AUHmu1.d.ts} +1 -4
- package/dist/dev-landing-BI5UdmOb.d.ts +32 -0
- package/dist/dev-landing-CD-si4dW.js +50 -0
- package/dist/dev-landing-CD-si4dW.js.map +1 -0
- package/dist/dev-vite.d.ts +38 -39
- package/dist/dev-vite.js +67 -36
- package/dist/dev-vite.js.map +1 -1
- package/dist/dev.d.ts +3 -2
- package/dist/dev.js +2 -1
- package/dist/doctor-BA0i-YAN.js +270 -0
- package/dist/doctor-BA0i-YAN.js.map +1 -0
- package/dist/dump-D1vX8ozg.js +133 -0
- package/dist/dump-D1vX8ozg.js.map +1 -0
- package/dist/errors-7Rk1HGCE.js +160 -0
- package/dist/errors-7Rk1HGCE.js.map +1 -0
- package/dist/{validate-DtljsCh1.js → export-BVL2EvYE.js} +409 -19
- package/dist/export-BVL2EvYE.js.map +1 -0
- package/dist/fsck-BWkPgov4.js +145 -0
- package/dist/fsck-BWkPgov4.js.map +1 -0
- package/dist/gcs-admin-Dso1HWQj.d.ts +127 -0
- package/dist/gcs.d.ts +30 -0
- package/dist/gcs.js +1 -0
- package/dist/goog4-signer-CeLIABoE.js +331 -0
- package/dist/goog4-signer-CeLIABoE.js.map +1 -0
- package/dist/{http-DGd5tbNs.js → http-Z5rZyYMX.js} +898 -271
- package/dist/http-Z5rZyYMX.js.map +1 -0
- package/dist/http-transport-DNUM8kU-.js +1299 -0
- package/dist/http-transport-DNUM8kU-.js.map +1 -0
- package/dist/http.d.ts +366 -294
- package/dist/http.js +2 -2
- package/dist/index-JJrIu1pO.d.ts +135 -0
- package/dist/index-LEgHN0qJ.d.ts +50 -0
- package/dist/{index-CuA9Mi3K.d.ts → index-RiEYj8t0.d.ts} +291 -78
- package/dist/index.d.ts +27 -6
- package/dist/index.js +3 -5
- package/dist/inspect-BTsVYZKd.js +196 -0
- package/dist/inspect-BTsVYZKd.js.map +1 -0
- package/dist/{key-Di6yyxFu.js → key-C4FPZ9Io.js} +3 -4
- package/dist/{key-Di6yyxFu.js.map → key-C4FPZ9Io.js.map} +1 -1
- package/dist/ledger-Dj_bGgo0.js +192 -0
- package/dist/ledger-Dj_bGgo0.js.map +1 -0
- package/dist/legacy-names-DgZBtgOh.js +47 -0
- package/dist/legacy-names-DgZBtgOh.js.map +1 -0
- package/dist/log-C9W15Dfo.d.ts +94 -0
- package/dist/log-tail-DWJbneBF.js +142 -0
- package/dist/log-tail-DWJbneBF.js.map +1 -0
- package/dist/log-walk-C-vA-WGJ.js +111 -0
- package/dist/log-walk-C-vA-WGJ.js.map +1 -0
- package/dist/maintenance-Dd-Yakqj.js +1709 -0
- package/dist/maintenance-Dd-Yakqj.js.map +1 -0
- package/dist/maintenance-DevB6z4e.js +2237 -0
- package/dist/maintenance-DevB6z4e.js.map +1 -0
- package/dist/maintenance.d.ts +100 -3
- package/dist/maintenance.js +1 -3
- package/dist/node.d.ts +130 -142
- package/dist/node.js +4 -3
- package/dist/{observability-BmflLCdF.js → observability-C-ISCCLE.js} +1275 -332
- package/dist/observability-C-ISCCLE.js.map +1 -0
- package/dist/observability.d.ts +27 -3
- package/dist/observability.js +3 -3
- package/dist/path-segment-DBXG26PW.js +363 -0
- package/dist/path-segment-DBXG26PW.js.map +1 -0
- package/dist/{plan-a7PJHBCy.js → plan-BvQbaNMe.js} +19 -11
- package/dist/plan-BvQbaNMe.js.map +1 -0
- package/dist/request-CRWiTrza.js +272 -0
- package/dist/request-CRWiTrza.js.map +1 -0
- package/dist/restore-U6Im8V1V.js +1467 -0
- package/dist/restore-U6Im8V1V.js.map +1 -0
- package/dist/retry-OBtLB2GC.js +126 -0
- package/dist/retry-OBtLB2GC.js.map +1 -0
- package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
- package/dist/{runtime-spec-Dsw2-n8S.js → runtime-spec-B5mg3pHF.js} +189 -28
- package/dist/runtime-spec-B5mg3pHF.js.map +1 -0
- package/dist/{s3-http-B-z8th6O.d.ts → s3-http-DBC_wiCL.d.ts} +18 -10
- package/dist/s3.d.ts +20 -7
- package/dist/s3.js +4 -5
- package/dist/s3.js.map +1 -1
- package/dist/sha256-4FfGQNPw.js +22 -0
- package/dist/sha256-4FfGQNPw.js.map +1 -0
- package/dist/{shared-secret-DgEicd3x.js → shared-secret-Vkur-8r0.js} +27 -15
- package/dist/shared-secret-Vkur-8r0.js.map +1 -0
- package/dist/sigv4-sign-5IUflUD_.js +507 -0
- package/dist/sigv4-sign-5IUflUD_.js.map +1 -0
- package/dist/snapshot-CknzkDM0.js +148 -0
- package/dist/snapshot-CknzkDM0.js.map +1 -0
- package/dist/{src-BL_JoPTn.js → src-Actga-bO.js} +1004 -378
- package/dist/src-Actga-bO.js.map +1 -0
- package/dist/src-D0MQfvOp.js +812 -0
- package/dist/src-D0MQfvOp.js.map +1 -0
- package/dist/src-Dr9uo3dc.js +501 -0
- package/dist/src-Dr9uo3dc.js.map +1 -0
- package/dist/{subcommand-DoDA-K7d.js → subcommand-BLoF66dG.js} +89 -16
- package/dist/subcommand-BLoF66dG.js.map +1 -0
- package/dist/{time-DUqvFMHq.js → time-DRxTP9iv.js} +15 -34
- package/dist/time-DRxTP9iv.js.map +1 -0
- package/dist/types-suVbsEWS.d.ts +116 -0
- package/dist/{usage-DBV1eQHC.js → usage-CPzVhrQr.js} +40 -45
- package/dist/usage-CPzVhrQr.js.map +1 -0
- package/dist/uuid-BuT_c404.js +333 -0
- package/dist/uuid-BuT_c404.js.map +1 -0
- package/dist/verifier-Bmlmndzo.d.ts +95 -0
- package/dist/{wire-izfGZDvr.js → wire-DndvKU-K.js} +2 -3
- package/dist/wire-DndvKU-K.js.map +1 -0
- package/package.json +96 -69
- package/dist/aws4fetch.esm-p7eEzLCs.js +0 -1702
- package/dist/aws4fetch.esm-p7eEzLCs.js.map +0 -1
- package/dist/bytes-BXdamO3L.js +0 -11
- package/dist/bytes-BXdamO3L.js.map +0 -1
- package/dist/cloudflare-DzKBrUlg.js.map +0 -1
- package/dist/config-1tv0-Yzm.js +0 -2693
- package/dist/config-1tv0-Yzm.js.map +0 -1
- package/dist/constants-CfeMWQWk.js +0 -222
- package/dist/constants-CfeMWQWk.js.map +0 -1
- package/dist/context-DRZ3tZ5l.js.map +0 -1
- package/dist/cost-DSMIVqzL.js +0 -203
- package/dist/cost-DSMIVqzL.js.map +0 -1
- package/dist/current-json-C6nhPOm1.js.map +0 -1
- package/dist/db-DsPkOVEH.d.ts +0 -254
- package/dist/deploy-DonTr-CV.js.map +0 -1
- package/dist/doctor-DSIyCDg_.js +0 -346
- package/dist/doctor-DSIyCDg_.js.map +0 -1
- package/dist/dump-Bh5k26VQ.js +0 -94
- package/dist/dump-Bh5k26VQ.js.map +0 -1
- package/dist/errors-Dfa3p78c.js +0 -78
- package/dist/errors-Dfa3p78c.js.map +0 -1
- package/dist/export-DtF5tDIM.js +0 -401
- package/dist/export-DtF5tDIM.js.map +0 -1
- package/dist/fsck-D_djMO5D.js +0 -279
- package/dist/fsck-D_djMO5D.js.map +0 -1
- package/dist/http-DGd5tbNs.js.map +0 -1
- package/dist/index-0rZcMBwy.d.ts +0 -115
- package/dist/index-BNRh23K9.d.ts +0 -162
- package/dist/index-BYk9oCNf.d.ts +0 -1112
- package/dist/indexes-Dn9hbGQG.d.ts +0 -22
- package/dist/inspect-6WZ-pC7-.js +0 -133
- package/dist/inspect-6WZ-pC7-.js.map +0 -1
- package/dist/log-tail-D98U1JBo.js +0 -522
- package/dist/log-tail-D98U1JBo.js.map +0 -1
- package/dist/maintenance-B4Dki6Ig.js +0 -2157
- package/dist/maintenance-B4Dki6Ig.js.map +0 -1
- package/dist/maintenance-B_e0T99L.d.ts +0 -537
- package/dist/maintenance-C7coQp4c.js +0 -1418
- package/dist/maintenance-C7coQp4c.js.map +0 -1
- package/dist/normalize-rjnZLwS4.js +0 -133
- package/dist/normalize-rjnZLwS4.js.map +0 -1
- package/dist/observability-BmflLCdF.js.map +0 -1
- package/dist/plan-a7PJHBCy.js.map +0 -1
- package/dist/query-rAtXNQQB.js +0 -1773
- package/dist/query-rAtXNQQB.js.map +0 -1
- package/dist/rebuild-index-BVzQSZlm.js +0 -81
- package/dist/rebuild-index-BVzQSZlm.js.map +0 -1
- package/dist/request-u0M51mhJ.js +0 -72
- package/dist/request-u0M51mhJ.js.map +0 -1
- package/dist/restore-R-4rbciV.js +0 -778
- package/dist/restore-R-4rbciV.js.map +0 -1
- package/dist/rolldown-runtime-EAsCxrDo.js +0 -14
- package/dist/runtime-spec-Dsw2-n8S.js.map +0 -1
- package/dist/shared-secret-DgEicd3x.js.map +0 -1
- package/dist/src-BL_JoPTn.js.map +0 -1
- package/dist/src-CYHFDrKz.js +0 -536
- package/dist/src-CYHFDrKz.js.map +0 -1
- package/dist/src-DYZ4H1aF.js +0 -392
- package/dist/src-DYZ4H1aF.js.map +0 -1
- package/dist/subcommand-DoDA-K7d.js.map +0 -1
- package/dist/time-DUqvFMHq.js.map +0 -1
- package/dist/usage-DBV1eQHC.js.map +0 -1
- package/dist/validate-DtljsCh1.js.map +0 -1
- package/dist/wire-izfGZDvr.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observability-C-ISCCLE.js","names":["getLogger","inspect","util","util.inspect","logtapeGetLogger","createObservabilityContext","createContext","currentContext"],"sources":["../packages/server/src/contract.ts","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/disposable.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/filter.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/level.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/scoped-config.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/source-location.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/logger.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/context.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/sanitize.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/circular.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/util.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/formatter.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/sink.js","../node_modules/.pnpm/@logtape+logtape@2.4.2/node_modules/@logtape/logtape/dist/config.js","../packages/server/src/observability/logger.ts","../packages/server/src/observability/derive-outcome.ts","../packages/server/src/observability/request-id.ts","../packages/server/src/observability/canonical.ts","../packages/server/src/observability/storage.ts","../packages/server/src/observability/index.ts"],"sourcesContent":["import {\n CODE_RESOLUTIONS,\n isRetriableCode,\n type LogEntry,\n type BaerlyErrorCode,\n} 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. `message` follows the HTTP message policy: caller-facing\n * errors carry actionable detail, predicate `InvalidConfig` keeps its\n * request-fix guidance, and storage/server diagnostics use generic text\n * so bucket keys, layout, ETags, and upstream response bodies stay\n * server-side.\n */\nexport interface HttpErrorEnvelope {\n readonly error: {\n readonly code: BaerlyErrorCode;\n readonly message: string;\n /** Whether retrying can succeed. Derived from `code` only (`isRetriableCode`) and always present, so non-SDK consumers need no code table. SDK clients derive it themselves and ignore this field. */\n readonly retriable: boolean;\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 /** Human-readable remediation hint. Present when the code has a per-code default or a site override; absent for opaque/transient codes. */\n readonly resolution?: string;\n /** The affected row's `_id`, present only when `code === \"AmbiguousCommit\"`. Additive. */\n readonly _id?: string;\n /** Suggested delay in seconds before retrying, present only when `code === \"MaintenancePending\"`. Mirrored by the `Retry-After` header. Additive. */\n readonly retryAfter?: number;\n };\n}\n\n/** Optional fields for {@link errorEnvelope}; the wire-bound subset of `BaerlyErrorOptions`. */\nexport interface ErrorEnvelopeOptions {\n /** Field-path issues; emitted only when non-empty. Meaningful for `code: \"SchemaError\"`. */\n readonly issues?: ReadonlyArray<{\n readonly path: ReadonlyArray<string | number>;\n readonly message: string;\n }>;\n /** Corrective action; overrides the code's default resolution. */\n readonly resolution?: string;\n /** The affected row's `_id`; emitted only when `code === \"AmbiguousCommit\"`. */\n readonly _id?: string;\n /** Suggested retry delay in seconds; emitted only when `code === \"MaintenancePending\"`. */\n readonly retryAfter?: number;\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. `retriable` is always present and\n * derived from `code` alone; older clients ignore it.\n *\n * @example\n * ```ts\n * errorEnvelope(\"InvalidConfig\", \"bad request\", { resolution: \"Pass ?collection=<name>.\" });\n * errorEnvelope(\"AmbiguousCommit\", \"unknown outcome\", { _id: \"t-1\" });\n * ```\n */\nexport const errorEnvelope = (\n code: BaerlyErrorCode,\n message: string,\n options?: ErrorEnvelopeOptions,\n): HttpErrorEnvelope => {\n const { issues, resolution, _id, retryAfter } = options ?? {};\n const resolved = resolution ?? CODE_RESOLUTIONS[code];\n return {\n error: {\n code,\n message,\n retriable: isRetriableCode(code),\n ...(issues !== undefined && issues.length > 0 ? { issues } : {}),\n ...(resolved !== undefined ? { resolution: resolved } : {}),\n ...(_id !== undefined && code === \"AmbiguousCommit\" ? { _id } : {}),\n ...(retryAfter !== undefined && code === \"MaintenancePending\" ? { retryAfter } : {}),\n },\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 * It is a digest of manifest state, not a bucket key; treat it as\n * opaque on the wire.\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 */\ninterface 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 *\n * `next_cursor` is **opaque**: echo it back verbatim, never parse it.\n * It pairs the last entry's `lsn` with the collection generation the\n * poll read, so a cursor from a collection that `baerly admin restore\n * --force` has since truncated can be rejected instead of silently\n * resuming into the new generation. `\"\"` means \"start from the\n * collection's log floor\" and is always valid.\n *\n * A `410 CursorExpired` on resume means the cursor is permanently dead:\n * the changes after it are no longer retained, or its generation was\n * truncated. Neither clears on retry: re-read, then restart with\n * `cursor: \"\"`. Retrying the rejected cursor loops forever. A malformed\n * cursor is `400 SchemaError`. See invariant 13 in\n * `docs/spec/sync-protocol.md`.\n */\nexport interface SinceResponse {\n readonly events: ReadonlyArray<LogEntry>;\n readonly next_cursor: string;\n}\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 | Caller request failed → `SchemaError` / `InvalidConfig` / `UnsatisfiablePredicate`. Predicate `InvalidConfig` guidance is public; server/storage config detail is scrubbed. |\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 | Lost race → `code:\"WriteConflict\"` (retriable, generic message). Create target exists → `code:\"AlreadyExists\"` (not retriable, message kept). Unresolved commit → `code:\"AmbiguousCommit\"` (not retriable, carries `_id`). |\n * | 409 | The request needs more work than this host does in one request → `code:\"CapacityExceeded\"` (not retriable, message kept; a read returns no rows, a write commits nothing). |\n * | 410 | `/v1/since` cursor can no longer resume → `code:\"CursorExpired\"` (not retriable, message kept; restart with `cursor: \"\"`). |\n * | 413 | Request body exceeded `MAX_BODY_BYTES` → `code:\"PayloadTooLarge\"`. |\n * | 415 | `POST` / `PATCH` / `PUT` body not typed `application/json` (or `+json`) → `code:\"UnsupportedMediaType\"`, refused before the body is read. |\n * | 503 | Maintenance is behind → `code:\"MaintenancePending\"` (retriable, message kept, `Retry-After` header and `retryAfter` seconds). |\n * | 502 | Storage/network upstream failed → `code:\"NetworkError\"` / `code:\"InvalidResponse\"` with a generic message. |\n * | 500 | Anything else → `code:\"Internal\"` with a generic message. |\n *\n * A successful write (`POST` / `PATCH` / `PUT` / `DELETE`) that leaves its\n * collection within 90% of the host's growth-refusal point also carries a\n * `Baerly-Capacity-Warning` header whose value names the state and the\n * app-side remedy. The body is unchanged; the header is absent while the\n * collection has room. `createBaerlyClient` passes it to `onWarning`.\n */\nexport type HttpStatus =\n | 200\n | 201\n | 204\n | 304\n | 400\n | 401\n | 403\n | 404\n | 409\n | 410\n | 413\n | 415\n | 500\n | 502\n | 503;\n","//#region src/disposable.ts\nconst disposeSymbol = Symbol.dispose ?? Symbol.for(\"Symbol.dispose\");\nconst asyncDisposeSymbol = Symbol.asyncDispose ?? Symbol.for(\"Symbol.asyncDispose\");\n\n//#endregion\nexport { asyncDisposeSymbol, disposeSymbol };\n//# sourceMappingURL=disposable.js.map","import { disposeSymbol } from \"./disposable.js\";\n\n//#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\tconst filter = createLevelFilter(level);\n\tlevelFilters.set(filter, level);\n\treturn filter;\n}\n/**\n* The levels of the filters made by {@link getLevelFilter}, so that they can\n* be described without being invoked. It is shared through `globalThis` like\n* the root logger, so that filters made by another copy of LogTape in the same\n* process (e.g., the CommonJS build next to the ESM build) are recognized too.\n*/\nconst levelFilters = getLevelFilters();\nfunction getLevelFilters() {\n\tconst registry = globalThis;\n\tconst key = Symbol.for(\"logtape.levelFilters\");\n\tconst map = registry[key];\n\tif (map instanceof WeakMap) return map;\n\tconst newMap = /* @__PURE__ */ new WeakMap();\n\tregistry[key] = newMap;\n\treturn newMap;\n}\n/**\n* Gets the level of a filter made by {@link getLevelFilter}, without invoking\n* the filter.\n* @param filter The filter to look up.\n* @returns The lowest level the filter accepts, `null` if it rejects all\n* records, or `undefined` if the filter was not made by\n* {@link getLevelFilter}.\n*/\nfunction getFilterLevel(filter) {\n\treturn levelFilters.get(filter);\n}\nfunction createLevelFilter(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[disposeSymbol] = () => {\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 { getFilterLevel, getLevelFilter, getThrottlingFilter, toFilter };\n//# sourceMappingURL=filter.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 { asyncDisposeSymbol, disposeSymbol } from \"./disposable.js\";\nimport { toFilter } from \"./filter.js\";\nimport { compareLogLevel, isLogLevel } from \"./level.js\";\n\n//#region src/scoped-config.ts\nconst scopedConfigSymbol = Symbol.for(\"logtape.scopedConfig\");\nconst defaultScopedLogger = {\n\tfilters: [],\n\tfilterIds: [],\n\tlowestLevel: \"trace\",\n\tparentSinks: \"inherit\",\n\tsinks: [],\n\tsinkIds: [],\n\tcaptureSourceLocation: void 0\n};\nconst noFilters = [];\nfunction compileScopedConfig(config, allowAsync, createError) {\n\tif (!isObjectLike(config)) throw createError(\"Configuration must be an object.\");\n\tif (!isObjectLike(config.sinks)) throw createError(\"Configuration must include a sinks object.\");\n\tif (!Array.isArray(config.loggers)) throw createError(\"Configuration must include a loggers array.\");\n\tif (config.filters !== void 0 && !isObjectLike(config.filters)) throw createError(\"Configuration filters must be an object.\");\n\tconst nodes = /* @__PURE__ */ new Map();\n\tconst configuredCategories = /* @__PURE__ */ new Set();\n\tlet capturesSourceLocation = false;\n\tfor (const logger of config.loggers) {\n\t\tif (!isObjectLike(logger)) throw createError(\"Logger configuration must be an object.\");\n\t\tconst loggerConfig = logger;\n\t\tconst category = normalizeCategory(loggerConfig.category, createError);\n\t\tif (loggerConfig.sinks !== void 0 && !Array.isArray(loggerConfig.sinks)) throw createError(\"Logger sinks must be an array.\");\n\t\tif (loggerConfig.filters !== void 0 && !Array.isArray(loggerConfig.filters)) throw createError(\"Logger filters must be an array.\");\n\t\tif (loggerConfig.parentSinks !== void 0 && loggerConfig.parentSinks !== \"inherit\" && loggerConfig.parentSinks !== \"override\" && loggerConfig.parentSinks !== \"forward\") throw createError(\"Logger parentSinks must be \\\"inherit\\\", \\\"override\\\", or \\\"forward\\\".\");\n\t\tif (loggerConfig.lowestLevel !== void 0 && loggerConfig.lowestLevel !== null && !isLogLevel(loggerConfig.lowestLevel)) throw createError(\"Logger lowestLevel must be a log level or null.\");\n\t\tif (loggerConfig.captureSourceLocation !== void 0 && typeof loggerConfig.captureSourceLocation !== \"boolean\") throw createError(\"Logger captureSourceLocation must be a boolean.\");\n\t\tconst key = categoryKey(category);\n\t\tif (configuredCategories.has(key)) throw createError(`Duplicate logger configuration for category: ${key}. Each category can only be configured once.`);\n\t\tconfiguredCategories.add(key);\n\t\tconst sinks$1 = [];\n\t\tconst sinkIds = loggerConfig.sinks ?? [];\n\t\tfor (const sinkId of sinkIds) {\n\t\t\tconst sink = config.sinks[sinkId];\n\t\t\tif (!sink) throw createError(`Sink not found: ${sinkId}.`);\n\t\t\tif (typeof sink !== \"function\") throw createError(`Sink must be a function: ${sinkId}.`);\n\t\t\tsinks$1.push(sink);\n\t\t}\n\t\tconst filters = [];\n\t\tconst filterIds = loggerConfig.filters ?? [];\n\t\tfor (const filterId of filterIds) {\n\t\t\tconst filter = config.filters?.[filterId];\n\t\t\tif (filter === void 0) throw createError(`Filter not found: ${filterId}.`);\n\t\t\tif (!isFilterLike(filter)) throw createError(`Filter must be a function, log level, or null: ${filterId}.`);\n\t\t\tfilters.push(toFilter(filter));\n\t\t}\n\t\tnodes.set(key, {\n\t\t\tfilters,\n\t\t\tfilterIds: [...filterIds],\n\t\t\tlowestLevel: loggerConfig.lowestLevel === void 0 ? \"trace\" : loggerConfig.lowestLevel,\n\t\t\tparentSinks: loggerConfig.parentSinks ?? \"inherit\",\n\t\t\tsinks: sinks$1,\n\t\t\tsinkIds: [...sinkIds],\n\t\t\tcaptureSourceLocation: loggerConfig.captureSourceLocation\n\t\t});\n\t\tif (loggerConfig.captureSourceLocation === true) capturesSourceLocation = true;\n\t}\n\tconst syncFilters = /* @__PURE__ */ new Set();\n\tconst asyncFilters = /* @__PURE__ */ new Set();\n\tconst syncSinks = /* @__PURE__ */ new Set();\n\tconst asyncSinks = /* @__PURE__ */ new Set();\n\tconst sinks = /* @__PURE__ */ new Set();\n\tfor (const sink of Object.values(config.sinks)) {\n\t\tif (!isObjectLike(sink)) continue;\n\t\tsinks.add(sink);\n\t\tif (asyncDisposeSymbol in sink) {\n\t\t\tif (!allowAsync) throw createError(\"Async disposables cannot be used with withConfigSync().\");\n\t\t\tasyncSinks.add(sink);\n\t\t} else if (disposeSymbol in sink) syncSinks.add(sink);\n\t}\n\tfor (const filter of Object.values(config.filters ?? {})) {\n\t\tif (!isObjectLike(filter)) continue;\n\t\tif (asyncDisposeSymbol in filter) {\n\t\t\tif (!allowAsync) throw createError(\"Async disposables cannot be used with withConfigSync().\");\n\t\t\tasyncFilters.add(filter);\n\t\t\tasyncSinks.delete(filter);\n\t\t} else if (disposeSymbol in filter) {\n\t\t\tsyncFilters.add(filter);\n\t\t\tsyncSinks.delete(filter);\n\t\t}\n\t}\n\treturn {\n\t\tasyncFilters,\n\t\tasyncSinks,\n\t\tcapturesSourceLocation,\n\t\tdispatchCache: /* @__PURE__ */ new Map(),\n\t\tdisposed: false,\n\t\tfilterCache: /* @__PURE__ */ new Map(),\n\t\tnodes,\n\t\tparent: void 0,\n\t\tsinks,\n\t\tsourceLocationCaptureCache: /* @__PURE__ */ new Map(),\n\t\tsyncFilters,\n\t\tsyncSinks\n\t};\n}\nfunction getCurrentScopedConfig(contextLocalStorage) {\n\tconst store = contextLocalStorage?.getStore();\n\tconst scopedConfig = store?.[scopedConfigSymbol];\n\treturn isCompiledScopedConfig(scopedConfig) ? getActiveScopedConfig(scopedConfig) : void 0;\n}\nfunction runWithScopedConfig(contextLocalStorage, scopedConfig, callback) {\n\tconst parentStore = contextLocalStorage.getStore() ?? {};\n\tscopedConfig.parent = getCurrentScopedConfig(contextLocalStorage);\n\treturn contextLocalStorage.run({\n\t\t...parentStore,\n\t\t[scopedConfigSymbol]: scopedConfig\n\t}, callback);\n}\n/**\n* Gets the compiled logger configured for exactly the given category in a\n* scoped configuration, without touching its dispatch or filter caches.\n*/\nfunction getScopedLogger(scopedConfig, category) {\n\treturn scopedConfig.nodes.get(categoryKey(category));\n}\nfunction scopedConfigHasSink(scopedConfig, category, level) {\n\treturn getScopedSinkDispatchPlan(scopedConfig, category, level).kind !== \"none\";\n}\n/**\n* Resolves whether source locations are captured for the given category\n* under the scoped configuration: the setting of the nearest configured\n* category, from the category itself up to the root, wins.\n*/\nfunction scopedConfigCapturesSourceLocation(scopedConfig, category) {\n\tif (!scopedConfig.capturesSourceLocation) return false;\n\tconst key = categoryKey(category);\n\tlet captures = scopedConfig.sourceLocationCaptureCache.get(key);\n\tif (captures == null) {\n\t\tcaptures = false;\n\t\tfor (let length = category.length; length >= 0; length--) {\n\t\t\tconst logger = scopedConfig.nodes.get(categoryKey(category.slice(0, length)));\n\t\t\tif (logger?.captureSourceLocation == null) continue;\n\t\t\tcaptures = logger.captureSourceLocation;\n\t\t\tbreak;\n\t\t}\n\t\tscopedConfig.sourceLocationCaptureCache.set(key, captures);\n\t}\n\treturn captures;\n}\nfunction emitWithScopedConfig(scopedConfig, record, bypassSinks, emitToSink) {\n\tconst plan = getScopedSinkDispatchPlan(scopedConfig, record.category, record.level);\n\tif (plan.kind === \"none\") return;\n\tif (!filterScopedRecord(scopedConfig, record.category, record)) return;\n\tif (plan.kind === \"one\") {\n\t\tif (!bypassSinks?.has(plan.sink)) emitToSink(plan.sink, bypassSinks);\n\t\treturn;\n\t}\n\tfor (const sink of plan.sinks) {\n\t\tif (bypassSinks?.has(sink)) continue;\n\t\temitToSink(sink, bypassSinks);\n\t}\n}\nasync function disposeScopedConfig(scopedConfig, retainedDisposables) {\n\tconst parentDisposables = getParentScopedDisposables(scopedConfig, retainedDisposables);\n\tscopedConfig.disposed = true;\n\tconst errors = [];\n\ttry {\n\t\tdisposeSyncDisposables(scopedConfig.syncFilters, parentDisposables);\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\ttry {\n\t\tawait disposeAsyncDisposables(scopedConfig.asyncFilters, parentDisposables);\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\ttry {\n\t\tdisposeSyncDisposables(scopedConfig.syncSinks, parentDisposables);\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\ttry {\n\t\tawait disposeAsyncDisposables(scopedConfig.asyncSinks, parentDisposables);\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\tthrowDisposeErrors(errors);\n}\nfunction disposeScopedConfigSync(scopedConfig, retainedDisposables) {\n\tconst parentDisposables = getParentScopedDisposables(scopedConfig, retainedDisposables);\n\tscopedConfig.disposed = true;\n\tconst errors = [];\n\ttry {\n\t\tdisposeSyncDisposables(scopedConfig.syncFilters, parentDisposables);\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\ttry {\n\t\tdisposeSyncDisposables(scopedConfig.syncSinks, parentDisposables);\n\t} catch (error) {\n\t\terrors.push(error);\n\t}\n\tthrowDisposeErrors(errors);\n}\nfunction throwCombinedErrors(primary, secondary) {\n\tthrow new AggregateError(flattenErrors(primary, secondary), \"Multiple errors occurred while running LogTape scoped configuration.\");\n}\nfunction isCompiledScopedConfig(value) {\n\treturn value != null && typeof value === \"object\" && \"nodes\" in value;\n}\nfunction isObjectLike(value) {\n\treturn value != null && (typeof value === \"object\" || typeof value === \"function\");\n}\nfunction isFilterLike(value) {\n\treturn value == null || typeof value === \"function\" || typeof value === \"string\" && isLogLevel(value);\n}\nfunction getActiveScopedConfig(scopedConfig) {\n\tlet activeConfig = scopedConfig;\n\twhile (activeConfig?.disposed) activeConfig = activeConfig.parent;\n\treturn activeConfig;\n}\nfunction getParentScopedDisposables(scopedConfig, extraRetained) {\n\tconst disposables = new Set(extraRetained);\n\tlet parent = scopedConfig.parent;\n\twhile (parent != null) {\n\t\tconst activeParent = getActiveScopedConfig(parent);\n\t\tif (activeParent == null) break;\n\t\taddScopedDisposables(disposables, activeParent);\n\t\tparent = activeParent.parent;\n\t}\n\treturn disposables;\n}\nfunction addScopedDisposables(disposables, scopedConfig) {\n\tfor (const disposable of scopedConfig.syncFilters) disposables.add(disposable);\n\tfor (const disposable of scopedConfig.asyncFilters) disposables.add(disposable);\n\tfor (const disposable of scopedConfig.syncSinks) disposables.add(disposable);\n\tfor (const disposable of scopedConfig.asyncSinks) disposables.add(disposable);\n}\nfunction normalizeCategory(category, createError) {\n\tif (typeof category === \"string\") return [category];\n\tif (!Array.isArray(category)) throw createError(\"Logger category must be a string or array of strings.\");\n\tif (category.some((part) => typeof part !== \"string\")) throw createError(\"Logger category must only contain strings.\");\n\treturn [...category];\n}\nfunction categoryKey(category) {\n\treturn JSON.stringify(category);\n}\nfunction getScopedSinkDispatchPlan(scopedConfig, category, level) {\n\tconst cacheKey = `${categoryKey(category)}:${level}`;\n\tlet plan = scopedConfig.dispatchCache.get(cacheKey);\n\tif (plan == null) {\n\t\tplan = getScopedSinkDispatchPlanForPrefix(scopedConfig, category, category.length, level);\n\t\tscopedConfig.dispatchCache.set(cacheKey, plan);\n\t}\n\treturn plan;\n}\nfunction getScopedSinkDispatchPlanForPrefix(scopedConfig, category, length, level) {\n\tconst prefix = category.slice(0, length);\n\tconst logger = scopedConfig.nodes.get(categoryKey(prefix)) ?? defaultScopedLogger;\n\tif (logger.lowestLevel === null || compareLogLevel(level, logger.lowestLevel) < 0) return { kind: \"none\" };\n\tconst parentPlan = length > 0 && logger.parentSinks === \"inherit\" ? getScopedSinkDispatchPlanForPrefix(scopedConfig, category, length - 1, level) : length > 0 && logger.parentSinks === \"forward\" ? wrapScopedSinks(collectScopedForwardSinks(scopedConfig, category, length - 1)) : { kind: \"none\" };\n\tlet firstSink;\n\tlet sinks;\n\tconst appendSink = (sink) => {\n\t\tif (sinks != null) sinks.push(sink);\n\t\telse if (firstSink == null) firstSink = sink;\n\t\telse sinks = [firstSink, sink];\n\t};\n\tif (parentPlan.kind === \"one\") appendSink(parentPlan.sink);\n\telse if (parentPlan.kind === \"many\") for (const sink of parentPlan.sinks) appendSink(sink);\n\tfor (const sink of logger.sinks) appendSink(sink);\n\tif (sinks != null) return {\n\t\tkind: \"many\",\n\t\tsinks\n\t};\n\tif (firstSink != null) return {\n\t\tkind: \"one\",\n\t\tsink: firstSink\n\t};\n\treturn { kind: \"none\" };\n}\nfunction collectScopedForwardSinks(scopedConfig, category, length) {\n\tconst logger = scopedConfig.nodes.get(categoryKey(category.slice(0, length))) ?? defaultScopedLogger;\n\tconst parentSinks = length > 0 && logger.parentSinks !== \"override\" ? collectScopedForwardSinks(scopedConfig, category, length - 1) : [];\n\tif (logger.sinks.length < 1) return parentSinks;\n\tif (parentSinks.length < 1) return logger.sinks;\n\treturn [...parentSinks, ...logger.sinks];\n}\nfunction wrapScopedSinks(sinks) {\n\tif (sinks.length < 1) return { kind: \"none\" };\n\tif (sinks.length === 1) return {\n\t\tkind: \"one\",\n\t\tsink: sinks[0]\n\t};\n\treturn {\n\t\tkind: \"many\",\n\t\tsinks\n\t};\n}\nfunction filterScopedRecord(scopedConfig, category, record) {\n\tconst key = categoryKey(category);\n\tlet filters = scopedConfig.filterCache.get(key);\n\tif (filters == null) {\n\t\tfilters = getScopedFilters(scopedConfig, category);\n\t\tscopedConfig.filterCache.set(key, filters);\n\t}\n\treturn filters.every((filter) => filter(record));\n}\nfunction getScopedFilters(scopedConfig, category) {\n\tfor (let length = category.length; length >= 0; length--) {\n\t\tconst logger = scopedConfig.nodes.get(categoryKey(category.slice(0, length)));\n\t\tif (logger == null || logger.filters.length < 1) continue;\n\t\treturn logger.filters;\n\t}\n\treturn noFilters;\n}\nfunction disposeSyncDisposables(disposables, retainedDisposables) {\n\tconst disposableList = filterRetainedDisposables(disposables, retainedDisposables);\n\tconst errors = [];\n\ttry {\n\t\tfor (const disposable of disposableList) try {\n\t\t\tdisposable[disposeSymbol]();\n\t\t} catch (error) {\n\t\t\terrors.push(error);\n\t\t}\n\t} finally {\n\t\tdisposables.clear();\n\t}\n\tthrowDisposeErrors(errors);\n}\nasync function disposeAsyncDisposables(disposables, retainedDisposables) {\n\tconst disposableList = filterRetainedDisposables(disposables, retainedDisposables);\n\tfor (const disposable of disposableList) disposables.delete(disposable);\n\ttry {\n\t\tconst results = await Promise.allSettled(disposableList.map((disposable) => Promise.resolve().then(() => disposable[asyncDisposeSymbol]())));\n\t\tthrowDisposeErrors(results.filter((result) => result.status === \"rejected\").map((result) => result.reason));\n\t} finally {\n\t\tdisposables.clear();\n\t}\n}\nfunction filterRetainedDisposables(disposables, retainedDisposables) {\n\treturn Array.from(disposables).filter((disposable) => !retainedDisposables.has(disposable));\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 scoped resources.\");\n}\nfunction flattenErrors(...errors) {\n\tconst flattened = [];\n\tfor (const error of errors) if (error instanceof AggregateError) flattened.push(...error.errors);\n\telse flattened.push(error);\n\treturn flattened;\n}\n\n//#endregion\nexport { compileScopedConfig, disposeScopedConfig, disposeScopedConfigSync, emitWithScopedConfig, getCurrentScopedConfig, getScopedLogger, runWithScopedConfig, scopedConfigCapturesSourceLocation, scopedConfigHasSink, throwCombinedErrors };\n//# sourceMappingURL=scoped-config.js.map","//#region src/source-location.ts\n/**\n* The prefix of each frame in V8 and JavaScriptCore (Bun) stack traces.\n*/\nconst v8FramePrefix = \" at \";\n/**\n* Matches a file that starts with a URL scheme (e.g., `file:`, `http:`,\n* `node:`, or a Windows drive letter), a slash, or a UNC prefix.\n*/\nconst absoluteFilePattern = /^(?:[A-Za-z][A-Za-z0-9+.-]*:|\\/|\\\\\\\\)/;\n/**\n* Matches a `file:line:column` location.\n*/\nconst locationPattern = /^(.+):(\\d+):(\\d+)$/;\n/**\n* Marks a location that matched the grammar but must not be reported.\n*/\nconst rejected = Symbol(\"rejected\");\n/**\n* Parses the source location of a frame from the stack trace of an `Error`\n* that was constructed without a message.\n*\n* The parser is deliberately conservative: whenever the frame could be read\n* in more than one way, or it does not point to a position in a source file\n* (native code, `eval()`, bytecode offsets), it returns `undefined` rather\n* than a possibly wrong location. It never throws.\n*\n* @param stack The `stack` property of an `Error` constructed without\n* a message.\n* @param frameIndex The zero-based index of the frame to parse, where `0`\n* is the function that constructed the `Error`.\n* @returns The source location of the frame, or `undefined` if it could not\n* be determined unambiguously.\n*/\nfunction parseSourceLocation(stack, frameIndex) {\n\tif (typeof stack !== \"string\") return void 0;\n\tconst lines = stack.split(\"\\n\");\n\tif (lines[0].trim() === \"Error\") {\n\t\tif (lines.length < 2 || !lines[1].startsWith(v8FramePrefix)) return void 0;\n\t\treturn parseV8Frame(lines[frameIndex + 1]);\n\t}\n\tif (lines[0] === \"\" || /^\\s/.test(lines[0])) return void 0;\n\treturn parseSpiderMonkeyFrame(lines[frameIndex]);\n}\nfunction parseV8Frame(frame) {\n\tif (frame == null || !frame.startsWith(v8FramePrefix)) return void 0;\n\tconst body = frame.slice(v8FramePrefix.length);\n\tif (body.includes(\"eval at \")) return void 0;\n\tif (!body.endsWith(\")\")) return accept(parseLocation(body.startsWith(\"async \") ? body.slice(6) : body));\n\tlet found;\n\tfor (let i = body.indexOf(\" (\"); i >= 0; i = body.indexOf(\" (\", i + 1)) {\n\t\tconst location = parseLocation(body.slice(i + 2, -1));\n\t\tif (location === rejected) return void 0;\n\t\tif (location == null) continue;\n\t\tif (found != null) return void 0;\n\t\tfound = location;\n\t}\n\treturn found;\n}\nfunction parseSpiderMonkeyFrame(frame) {\n\tif (frame == null) return void 0;\n\tconst whole = parseLocation(frame);\n\tif (whole === rejected) return void 0;\n\tif (whole != null && absoluteFilePattern.test(whole.file)) return void 0;\n\tlet found;\n\tfor (let i = frame.indexOf(\"@\"); i >= 0; i = frame.indexOf(\"@\", i + 1)) {\n\t\tconst location = parseLocation(frame.slice(i + 1));\n\t\tif (location === rejected) return void 0;\n\t\tif (location == null || !absoluteFilePattern.test(location.file)) continue;\n\t\tif (found != null) return void 0;\n\t\tfound = location;\n\t}\n\treturn found;\n}\nfunction accept(location) {\n\treturn location === rejected ? void 0 : location;\n}\nfunction parseLocation(location) {\n\tconst match = locationPattern.exec(location);\n\tif (match == null) return void 0;\n\tconst file = match[1];\n\tconst line = Number(match[2]);\n\tconst column = Number(match[3]);\n\tif (file === \"native\" || file === \"<anonymous>\" || file === \"[native code]\" || file.includes(\"address at \") || file.includes(\"eval at \") || file.includes(\" > eval\") || file.includes(\" > Function\") || line < 1 || column < 1) return rejected;\n\treturn {\n\t\tfile,\n\t\tline,\n\t\tcolumn\n\t};\n}\n\n//#endregion\nexport { parseSourceLocation };\n//# sourceMappingURL=source-location.js.map","import { getCategoryPrefix, getImplicitContextIfAny } from \"./context.js\";\nimport { compareLogLevel } from \"./level.js\";\nimport { emitWithScopedConfig, getCurrentScopedConfig, scopedConfigCapturesSourceLocation, scopedConfigHasSink } from \"./scoped-config.js\";\nimport { parseSourceLocation } from \"./source-location.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\");\nconst immediateSinkSymbol = Symbol.for(\"LogTape.sinkSnapshotPolicy.immediate\");\nconst internalStringLogRecords = /* @__PURE__ */ new WeakSet();\nconst resolvedStringLogRecords = /* @__PURE__ */ new WeakSet();\nlet globalSourceLocationCapture = false;\nlet scopedSourceLocationCaptures = 0;\nfunction isSourceLocationCaptureActive() {\n\treturn globalSourceLocationCapture || scopedSourceLocationCaptures > 0;\n}\nfunction attachSourceLocation(record, sourceLocation) {\n\tif (sourceLocation == null) return;\n\trecord.sourceLocation = sourceLocation;\n}\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, sourceLocation) {\n\tif (typeof props !== \"function\") {\n\t\tconst properties = props ?? {};\n\t\tlogger.log(level, message, properties, void 0, sourceLocation);\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, void 0, sourceLocation);\n\t});\n\tlogger.log(level, message, result, void 0, sourceLocation);\n}\nfunction snapshotLogRecordProperties(record) {\n\tif (resolvedStringLogRecords.has(record)) return record;\n\tconst properties = resolveProperties(record.properties);\n\tif (internalStringLogRecords.has(record)) {\n\t\tconst snapshot = {\n\t\t\tcategory: record.category,\n\t\t\tlevel: record.level,\n\t\t\tget message() {\n\t\t\t\treturn record.message;\n\t\t\t},\n\t\t\trawMessage: record.rawMessage,\n\t\t\ttimestamp: record.timestamp,\n\t\t\tproperties\n\t\t};\n\t\tattachSourceLocation(snapshot, record.sourceLocation);\n\t\treturn snapshot;\n\t}\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}\nfunction hasEnumerableProperties(properties) {\n\tif (properties == null || typeof properties !== \"object\") return false;\n\treturn Object.keys(properties).length > 0 || Object.prototype.propertyIsEnumerable.call(properties, throttlingSummaryRecordSymbol);\n}\nfunction shouldSnapshotForSink(sink) {\n\treturn sink[immediateSinkSymbol] !== true;\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* Enumerate every logger in the category tree rooted at the given logger,\n* including the given logger itself, in depth-first pre-order.\n*\n* ```typescript\n* const all = getLoggers(); // the whole tree, from the root down\n* const mine = getLoggers(\"my-app\"); // \"my-app\" and its descendants only\n* ```\n*\n* This only reflects loggers that have actually been *materialized* by a\n* `getLogger()` call somewhere in the running program. A category that has\n* been configured via `configure()` but never reached by a `getLogger()`\n* call (e.g. inside an unexecuted code path) will not appear.\n*\n* @param logger The logger (or its category, as a string or array of\n* strings) to start from. Defaults to the root logger.\n* @returns Every logger in the subtree, starting with the resolved logger\n* itself, in depth-first pre-order.\n* @since 2.4.0\n*/\nfunction getLoggers(logger) {\n\tconst category = logger == null ? [] : isCategory(logger) ? logger : logger.category;\n\treturn collectDescendants(LoggerImpl.getLogger(category));\n}\nfunction isCategory(value) {\n\treturn typeof value === \"string\" || Array.isArray(value);\n}\nfunction collectDescendants(logger) {\n\tconst loggers = [logger];\n\tfor (const childRef of Object.values(logger.children)) {\n\t\tconst child = childRef instanceof LoggerImpl ? childRef : childRef.deref();\n\t\tif (child != null) loggers.push(...collectDescendants(child));\n\t}\n\treturn loggers;\n}\n/**\n* The symbol for the global root logger.\n*/\nconst globalRootLoggerSymbol = Symbol.for(\"logtape.rootLogger\");\n/**\n* Checks whether the given category is the meta logger's category or one of\n* its descendants, to which category prefixes do not apply.\n*/\nfunction isMetaLoggerCategory(category) {\n\treturn category.length >= 2 && category[0] === \"logtape\" && category[1] === \"meta\";\n}\n/**\n* Finds the logger with the given category without creating it or any of its\n* ancestors.\n* @param category The category of the logger to find.\n* @returns The logger, or `undefined` if it has not been created.\n*/\nfunction findLogger(category) {\n\tlet logger = globalThis[globalRootLoggerSymbol];\n\tfor (const name of category) {\n\t\tif (logger == null) return void 0;\n\t\tconst childRef = Object.prototype.hasOwnProperty.call(logger.children, name) ? logger.children[name] : void 0;\n\t\tlogger = childRef == null || typeof childRef.deref !== \"function\" ? childRef : childRef.deref();\n\t}\n\treturn logger;\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\tfilters;\n\tcontextLocalStorage;\n\t/**\n\t* Whether to capture source locations for this logger and its\n\t* descendants. `undefined` inherits the setting from the parent.\n\t*/\n\tsourceLocationCapture = void 0;\n\t#parentSinks = \"inherit\";\n\t#lowestLevel = \"trace\";\n\t#sinkPlanCache = {};\n\t#forwardPlanCache = void 0;\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\tget parentSinks() {\n\t\treturn this.#parentSinks;\n\t}\n\tset parentSinks(value) {\n\t\tif (this.#parentSinks === value) return;\n\t\tthis.#parentSinks = value;\n\t}\n\tget lowestLevel() {\n\t\treturn this.#lowestLevel;\n\t}\n\tset lowestLevel(value) {\n\t\tif (this.#lowestLevel === value) return;\n\t\tthis.#lowestLevel = value;\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\tthis.sourceLocationCapture = void 0;\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\t/**\n\t* Sets whether the global configuration enables source location capture\n\t* for any category. Call this on the root logger only.\n\t*/\n\tsetGlobalSourceLocationCapture(enabled) {\n\t\tglobalSourceLocationCapture = enabled;\n\t}\n\t/**\n\t* Records that a scoped configuration which enables source location\n\t* capture for some category became active. Call this on the root logger\n\t* only, and balance it with\n\t* {@link LoggerImpl.releaseScopedSourceLocationCapture}.\n\t*/\n\tretainScopedSourceLocationCapture() {\n\t\tscopedSourceLocationCaptures++;\n\t}\n\t/**\n\t* Records that a scoped configuration retained with\n\t* {@link LoggerImpl.retainScopedSourceLocationCapture} ended. Call this on\n\t* the root logger only.\n\t*/\n\treleaseScopedSourceLocationCapture() {\n\t\tif (scopedSourceLocationCaptures > 0) scopedSourceLocationCaptures--;\n\t}\n\t/**\n\t* Captures where user code called the public logging method that called\n\t* this method, if source location capture is enabled for this logger and\n\t* a record of the given level could be emitted.\n\t*\n\t* It must be called directly by the public logging method that user code\n\t* called (e.g., {@link LoggerImpl.info} or {@link LoggerCtx.info}), and\n\t* not in tail position, because the location is read from the third frame\n\t* of a stack trace constructed here: this method, the logging method, and\n\t* then its caller. JavaScriptCore implements proper tail calls, so a call\n\t* in tail position would remove the logging method's frame.\n\t* @param level The log level of the record to be made.\n\t* @returns The source location, or `undefined` if capture is disabled, the\n\t* record would certainly be dropped, or the stack trace could not\n\t* be parsed.\n\t*/\n\tcaptureSourceLocation(level) {\n\t\tif (isMetaLoggerCategory(this.category)) return void 0;\n\t\tconst categoryPrefix = getCategoryPrefix();\n\t\tconst scopedConfig = getCurrentScopedConfig(LoggerImpl.getLogger().contextLocalStorage);\n\t\tif (scopedConfig != null) {\n\t\t\tconst category = categoryPrefix.length > 0 ? [...categoryPrefix, ...this.category] : this.category;\n\t\t\tif (!scopedConfigHasSink(scopedConfig, category, level) || !scopedConfigCapturesSourceLocation(scopedConfig, category)) return void 0;\n\t\t} else {\n\t\t\tconst dispatcher = this.getDispatcher(categoryPrefix);\n\t\t\tif (dispatcher.isCertainlyDroppedResolved(level) || !dispatcher.capturesSourceLocation()) return void 0;\n\t\t}\n\t\ttry {\n\t\t\treturn parseSourceLocation(new Error().stack, 2);\n\t\t} catch {\n\t\t\treturn void 0;\n\t\t}\n\t}\n\t/**\n\t* Resolves whether this logger or the nearest ancestor that configures it\n\t* captures source locations.\n\t*/\n\tcapturesSourceLocation() {\n\t\tif (this.sourceLocationCapture != null) return this.sourceLocationCapture;\n\t\treturn this.parent?.capturesSourceLocation() ?? false;\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\tconst plan = this.getSinkDispatchPlan(level);\n\t\tswitch (plan.kind) {\n\t\t\tcase \"none\": return;\n\t\t\tcase \"one\":\n\t\t\t\tyield plan.sink;\n\t\t\t\treturn;\n\t\t\tcase \"many\":\n\t\t\t\tyield* plan.sinks;\n\t\t\t\treturn;\n\t\t}\n\t}\n\tgetSinkDispatchPlan(level) {\n\t\tconst cached = this.#sinkPlanCache[level];\n\t\tif (cached != null && this.isSinkDispatchPlanFresh(level, cached)) return cached;\n\t\tconst plan = this.createSinkDispatchPlan(level, this.resolveParentPlan(level));\n\t\tthis.#sinkPlanCache[level] = plan;\n\t\treturn plan;\n\t}\n\tresolveParentPlan(level) {\n\t\tif (this.parent == null) return void 0;\n\t\tif (this.parentSinks === \"inherit\") return this.parent.getSinkDispatchPlan(level);\n\t\tif (this.parentSinks === \"forward\") return this.parent.getForwardSinkPlan();\n\t\treturn void 0;\n\t}\n\tisSinkDispatchPlanFresh(level, plan) {\n\t\tif (plan.lowestLevel !== this.lowestLevel || plan.parentSinks !== this.parentSinks || plan.localSinks.length !== this.sinks.length) return false;\n\t\tfor (let i = 0; i < plan.localSinks.length; i++) if (plan.localSinks[i] !== this.sinks[i]) return false;\n\t\treturn plan.parentPlan === this.resolveParentPlan(level);\n\t}\n\tgetForwardSinkPlan() {\n\t\tconst cached = this.#forwardPlanCache;\n\t\tif (cached != null && this.isForwardSinkPlanFresh(cached)) return cached;\n\t\tconst parentPlan = this.parent != null && this.parentSinks !== \"override\" ? this.parent.getForwardSinkPlan() : void 0;\n\t\tconst plan = this.createForwardSinkPlan(parentPlan);\n\t\tthis.#forwardPlanCache = plan;\n\t\treturn plan;\n\t}\n\tisForwardSinkPlanFresh(plan) {\n\t\tif (plan.parentSinks !== this.parentSinks || plan.localSinks.length !== this.sinks.length) return false;\n\t\tfor (let i = 0; i < plan.localSinks.length; i++) if (plan.localSinks[i] !== this.sinks[i]) return false;\n\t\tconst parentPlan = this.parent != null && this.parentSinks !== \"override\" ? this.parent.getForwardSinkPlan() : void 0;\n\t\treturn plan.parentPlan === parentPlan;\n\t}\n\tcreateForwardSinkPlan(parentPlan) {\n\t\tconst localSinks = [...this.sinks];\n\t\tconst sinks = parentPlan == null || parentPlan.sinks.length < 1 ? localSinks : [...parentPlan.sinks, ...localSinks];\n\t\treturn {\n\t\t\tkind: \"forward\",\n\t\t\tlocalSinks,\n\t\t\tparentSinks: this.parentSinks,\n\t\t\tparentPlan,\n\t\t\tsinks\n\t\t};\n\t}\n\tcreateSinkDispatchPlan(level, parentPlan) {\n\t\tconst state = {\n\t\t\tlocalSinks: [...this.sinks],\n\t\t\tparentSinks: this.parentSinks,\n\t\t\tlowestLevel: this.lowestLevel,\n\t\t\tparentPlan\n\t\t};\n\t\tif (state.lowestLevel === null) return {\n\t\t\t...state,\n\t\t\tkind: \"none\"\n\t\t};\n\t\tif (compareLogLevel(level, state.lowestLevel) < 0) return {\n\t\t\t...state,\n\t\t\tkind: \"none\"\n\t\t};\n\t\tlet firstSink;\n\t\tlet sinks;\n\t\tconst appendSink = (sink) => {\n\t\t\tif (sinks != null) sinks.push(sink);\n\t\t\telse if (firstSink == null) firstSink = sink;\n\t\t\telse sinks = [firstSink, sink];\n\t\t};\n\t\tif (parentPlan != null) {\n\t\t\tif (parentPlan.kind === \"one\") firstSink = parentPlan.sink;\n\t\t\telse if (parentPlan.kind === \"many\") sinks = [...parentPlan.sinks];\n\t\t\telse if (parentPlan.kind === \"forward\") {\n\t\t\t\tif (parentPlan.sinks.length === 1) firstSink = parentPlan.sinks[0];\n\t\t\t\telse if (parentPlan.sinks.length > 1) sinks = [...parentPlan.sinks];\n\t\t\t}\n\t\t}\n\t\tfor (const sink of state.localSinks) appendSink(sink);\n\t\tif (sinks != null) return {\n\t\t\t...state,\n\t\t\tkind: \"many\",\n\t\t\tsinks\n\t\t};\n\t\tif (firstSink != null) return {\n\t\t\t...state,\n\t\t\tkind: \"one\",\n\t\t\tsink: firstSink\n\t\t};\n\t\treturn {\n\t\t\t...state,\n\t\t\tkind: \"none\"\n\t\t};\n\t}\n\tisEnabledFor(level) {\n\t\tconst categoryPrefix = isMetaLoggerCategory(this.category) ? [] : getCategoryPrefix();\n\t\tconst scopedConfig = getCurrentScopedConfig(LoggerImpl.getLogger().contextLocalStorage);\n\t\tif (scopedConfig != null) return scopedConfigHasSink(scopedConfig, categoryPrefix.length > 0 ? [...categoryPrefix, ...this.category] : this.category, level);\n\t\treturn this.getDispatcher(categoryPrefix).isEnabledForResolved(level);\n\t}\n\t/**\n\t* Checks whether a record of the given level logged through this logger\n\t* would certainly be dropped without being seen by any filter or sink.\n\t* Logging methods use this to return before building a record.\n\t*\n\t* This assumes the context-local storage's store does not change between\n\t* synchronous reads within a single logging call, which holds for\n\t* `AsyncLocalStorage` and for the stores set up by `withContext()`,\n\t* `withCategoryPrefix()`, and `withConfig()`.\n\t* @param level The log level of the record.\n\t* @returns `true` if emitting such a record would have no observable\n\t* effect, `false` otherwise.\n\t*/\n\tisCertainlyDropped(level) {\n\t\tconst categoryPrefix = isMetaLoggerCategory(this.category) ? [] : getCategoryPrefix();\n\t\tconst scopedConfig = getCurrentScopedConfig(LoggerImpl.getLogger().contextLocalStorage);\n\t\tif (scopedConfig != null) return !scopedConfigHasSink(scopedConfig, categoryPrefix.length > 0 ? [...categoryPrefix, ...this.category] : this.category, level);\n\t\treturn this.getDispatcher(categoryPrefix).isCertainlyDroppedResolved(level);\n\t}\n\t/**\n\t* Checks whether a record of the given level dispatched by this logger,\n\t* without a scoped configuration, would certainly be dropped. See\n\t* {@link LoggerImpl.isCertainlyDropped}.\n\t*/\n\tisCertainlyDroppedResolved(level) {\n\t\tif (this.lowestLevel === null || compareLogLevel(level, this.lowestLevel) < 0) return true;\n\t\treturn !this.isEnabledForResolved(level) && !this.hasEffectiveFilters();\n\t}\n\t/**\n\t* Resolves the logger that actually dispatches records logged through this\n\t* logger under the given category prefix. It must stay in sync with\n\t* the dispatcher resolution in {@link LoggerImpl.emit}.\n\t*/\n\tgetDispatcher(categoryPrefix) {\n\t\treturn categoryPrefix.length > 0 ? LoggerImpl.getNearestExistingLogger([...categoryPrefix, ...this.category]) : this;\n\t}\n\t/**\n\t* Checks whether {@link LoggerImpl.filter} would run any filter, i.e.,\n\t* whether this logger or any of its ancestors has a filter.\n\t*/\n\thasEffectiveFilters() {\n\t\tif (this.filters.length > 0) return true;\n\t\treturn this.parent?.hasEffectiveFilters() ?? false;\n\t}\n\t/**\n\t* Checks whether {@link LoggerImpl.getSinks} would yield any sink for\n\t* the given level, without building or validating sink dispatch plans.\n\t* It must stay in sync with {@link LoggerImpl.createSinkDispatchPlan}.\n\t*/\n\tisEnabledForResolved(level) {\n\t\tif (this.lowestLevel === null || compareLogLevel(level, this.lowestLevel) < 0) return false;\n\t\tif (this.sinks.length > 0) return true;\n\t\tif (this.parent == null) return false;\n\t\tif (this.parentSinks === \"inherit\") return this.parent.isEnabledForResolved(level);\n\t\tif (this.parentSinks === \"forward\") return this.parent.hasForwardSinks();\n\t\treturn false;\n\t}\n\t/**\n\t* Checks whether {@link LoggerImpl.getForwardSinkPlan} would collect any\n\t* sink, i.e., whether this logger or an ancestor up to and including the\n\t* nearest one whose `parentSinks` is `\"override\"` has local sinks.\n\t*/\n\thasForwardSinks() {\n\t\tif (this.sinks.length > 0) return true;\n\t\treturn this.parent != null && this.parentSinks !== \"override\" && this.parent.hasForwardSinks();\n\t}\n\temit(record, bypassSinks) {\n\t\tconst hasCategory = \"category\" in record;\n\t\tconst baseCategory = hasCategory ? record.category : this.category;\n\t\tconst categoryPrefix = isMetaLoggerCategory(baseCategory) ? [] : getCategoryPrefix();\n\t\tconst fullCategory = categoryPrefix.length > 0 ? [...categoryPrefix, ...baseCategory] : baseCategory;\n\t\tif (categoryPrefix.length < 1 && Object.prototype.hasOwnProperty.call(record, \"category\")) {\n\t\t\tthis.emitResolved(record, bypassSinks);\n\t\t\treturn;\n\t\t}\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\tconst scopedConfig = getCurrentScopedConfig(LoggerImpl.getLogger().contextLocalStorage);\n\t\tif (scopedConfig != null) {\n\t\t\tlet snapshot$1;\n\t\t\tlet snapshotFailed$1 = false;\n\t\t\temitWithScopedConfig(scopedConfig, record, bypassSinks, (sink, activeBypassSinks) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (shouldSnapshotForSink(sink)) try {\n\t\t\t\t\t\tsnapshot$1 ??= snapshotLogRecordProperties(record);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tsnapshotFailed$1 = true;\n\t\t\t\t\t\tsnapshot$1 = record;\n\t\t\t\t\t}\n\t\t\t\t\tsink(snapshot$1 ?? record);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst bypassSinks2 = new Set(activeBypassSinks);\n\t\t\t\t\tbypassSinks2.add(sink);\n\t\t\t\t\tmetaLogger.log(\"fatal\", \"Failed to emit a log record to sink {sink}: {error}\", {\n\t\t\t\t\t\tsink,\n\t\t\t\t\t\terror,\n\t\t\t\t\t\trecord\n\t\t\t\t\t}, bypassSinks2);\n\t\t\t\t}\n\t\t\t\tif (snapshotFailed$1) snapshot$1 = record;\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (this.lowestLevel === null || compareLogLevel(record.level, this.lowestLevel) < 0 || !this.filter(record)) return;\n\t\tconst plan = this.getSinkDispatchPlan(record.level);\n\t\tif (plan.kind === \"none\") return;\n\t\tlet snapshot;\n\t\tlet snapshotFailed = false;\n\t\tif (plan.kind === \"one\") {\n\t\t\tconst sink = plan.sink;\n\t\t\tif (bypassSinks?.has(sink)) return;\n\t\t\ttry {\n\t\t\t\tif (shouldSnapshotForSink(sink)) 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\treturn;\n\t\t}\n\t\tfor (const sink of plan.sinks) {\n\t\t\tif (bypassSinks?.has(sink)) continue;\n\t\t\ttry {\n\t\t\t\tif (snapshot == null && !snapshotFailed && shouldSnapshotForSink(sink)) 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, sourceLocation) {\n\t\tif (this.isCertainlyDropped(level)) return;\n\t\tconst implicitContext = getImplicitContextIfAny();\n\t\tif (typeof properties !== \"function\" && implicitContext == null && !rawMessage.includes(\"{\") && !hasEnumerableProperties(properties)) {\n\t\t\tconst record$1 = {\n\t\t\t\tcategory: this.category,\n\t\t\t\tlevel,\n\t\t\t\tmessage: [rawMessage],\n\t\t\t\trawMessage,\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t\tproperties: {}\n\t\t\t};\n\t\t\tattachSourceLocation(record$1, sourceLocation);\n\t\t\tresolvedStringLogRecords.add(record$1);\n\t\t\tthis.emit(record$1, bypassSinks);\n\t\t\treturn;\n\t\t}\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\tattachSourceLocation(record, sourceLocation);\n\t\tinternalStringLogRecords.add(record);\n\t\tthis.emit(record, bypassSinks);\n\t}\n\tlogLazily(level, callback, properties = {}, sourceLocation) {\n\t\tif (this.isCertainlyDropped(level)) return;\n\t\tconst implicitContext = getImplicitContextIfAny();\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\tconst record = {\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\tattachSourceLocation(record, sourceLocation);\n\t\tthis.emit(record);\n\t}\n\tlogTemplate(level, messageTemplate, values, properties = {}, sourceLocation) {\n\t\tif (this.isCertainlyDropped(level)) return;\n\t\tconst implicitContext = getImplicitContextIfAny();\n\t\tconst record = {\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\tattachSourceLocation(record, sourceLocation);\n\t\tthis.emit(record);\n\t}\n\ttrace(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.captureSourceLocation(\"trace\") : void 0;\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"trace\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"trace\", message, void 0, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"trace\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"trace\", message, values, void 0, sourceLocation);\n\t}\n\tdebug(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.captureSourceLocation(\"debug\") : void 0;\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"debug\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"debug\", message, void 0, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"debug\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"debug\", message, values, void 0, sourceLocation);\n\t}\n\tinfo(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.captureSourceLocation(\"info\") : void 0;\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"info\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"info\", message, void 0, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"info\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"info\", message, values, void 0, sourceLocation);\n\t}\n\tlogError(level, error, props, sourceLocation) {\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}, void 0, sourceLocation);\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}, void 0, sourceLocation);\n\t\t});\n\t\tthis.log(level, \"{error.message}\", {\n\t\t\t...result,\n\t\t\terror\n\t\t}, void 0, sourceLocation);\n\t}\n\twarn(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.captureSourceLocation(\"warning\") : void 0;\n\t\tif (message instanceof Error) return this.logError(\"warning\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"warning\", message, { error: values[0] }, void 0, sourceLocation);\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"warning\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"warning\", message, void 0, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"warning\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"warning\", message, values, void 0, sourceLocation);\n\t}\n\twarning(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.captureSourceLocation(\"warning\") : void 0;\n\t\tif (message instanceof Error) return this.logError(\"warning\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"warning\", message, { error: values[0] }, void 0, sourceLocation);\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"warning\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"warning\", message, void 0, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"warning\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"warning\", message, values, void 0, sourceLocation);\n\t}\n\terror(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.captureSourceLocation(\"error\") : void 0;\n\t\tif (message instanceof Error) return this.logError(\"error\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"error\", message, { error: values[0] }, void 0, sourceLocation);\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"error\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"error\", message, void 0, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"error\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"error\", message, values, void 0, sourceLocation);\n\t}\n\tfatal(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.captureSourceLocation(\"fatal\") : void 0;\n\t\tif (message instanceof Error) return this.logError(\"fatal\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"fatal\", message, { error: values[0] }, void 0, sourceLocation);\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"fatal\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"fatal\", message, void 0, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"fatal\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"fatal\", message, values, void 0, sourceLocation);\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, sourceLocation) {\n\t\tif (this.logger.isCertainlyDropped(level)) return;\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, sourceLocation);\n\t}\n\tlogLazily(level, callback, sourceLocation) {\n\t\tif (this.logger.isCertainlyDropped(level)) return;\n\t\tthis.logger.logLazily(level, callback, resolveProperties(this.properties), sourceLocation);\n\t}\n\tlogTemplate(level, messageTemplate, values, sourceLocation) {\n\t\tif (this.logger.isCertainlyDropped(level)) return;\n\t\tthis.logger.logTemplate(level, messageTemplate, values, resolveProperties(this.properties), sourceLocation);\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\tconst sourceLocation = isSourceLocationCaptureActive() ? this.logger.captureSourceLocation(\"trace\") : void 0;\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"trace\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"trace\", message, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"trace\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"trace\", message, values, sourceLocation);\n\t}\n\tdebug(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.logger.captureSourceLocation(\"debug\") : void 0;\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"debug\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"debug\", message, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"debug\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"debug\", message, values, sourceLocation);\n\t}\n\tinfo(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.logger.captureSourceLocation(\"info\") : void 0;\n\t\tif (typeof message === \"string\") return logStringMessage(this, \"info\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"info\", message, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"info\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"info\", message, values, sourceLocation);\n\t}\n\tlogError(level, error, props, sourceLocation) {\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}, void 0, sourceLocation);\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}, void 0, sourceLocation);\n\t\t});\n\t\tthis.log(level, \"{error.message}\", {\n\t\t\t...result,\n\t\t\terror\n\t\t}, void 0, sourceLocation);\n\t}\n\twarn(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.logger.captureSourceLocation(\"warning\") : void 0;\n\t\tif (message instanceof Error) return this.logError(\"warning\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"warning\", message, { error: values[0] }, void 0, sourceLocation);\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"warning\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"warning\", message, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"warning\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"warning\", message, values, sourceLocation);\n\t}\n\twarning(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.logger.captureSourceLocation(\"warning\") : void 0;\n\t\tif (message instanceof Error) return this.logError(\"warning\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"warning\", message, { error: values[0] }, void 0, sourceLocation);\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"warning\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"warning\", message, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"warning\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"warning\", message, values, sourceLocation);\n\t}\n\terror(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.logger.captureSourceLocation(\"error\") : void 0;\n\t\tif (message instanceof Error) return this.logError(\"error\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"error\", message, { error: values[0] }, void 0, sourceLocation);\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"error\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"error\", message, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"error\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"error\", message, values, sourceLocation);\n\t}\n\tfatal(message, ...values) {\n\t\tconst sourceLocation = isSourceLocationCaptureActive() ? this.logger.captureSourceLocation(\"fatal\") : void 0;\n\t\tif (message instanceof Error) return this.logError(\"fatal\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"string\" && values[0] instanceof Error) this.log(\"fatal\", message, { error: values[0] }, void 0, sourceLocation);\n\t\telse if (typeof message === \"string\") return logStringMessage(this, \"fatal\", message, values[0], sourceLocation);\n\t\telse if (typeof message === \"function\") this.logLazily(\"fatal\", message, sourceLocation);\n\t\telse if (!Array.isArray(message)) this.log(\"fatal\", \"{*}\", message, void 0, sourceLocation);\n\t\telse this.logTemplate(\"fatal\", message, values, sourceLocation);\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, findLogger, getLogger, getLoggers, isLazy, isMetaLoggerCategory, lazy };\n//# sourceMappingURL=logger.js.map","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 only when user-visible context keys exist.\n*\n* This is intentionally not exported from the public entry point. Hot logging\n* paths use it to avoid allocating a fresh `{}` when no implicit context is\n* active, while `getImplicitContext()` keeps its public return contract.\n* @returns The current implicit context without internal symbol keys, or\n* `undefined` if there is no user-visible implicit context.\n*/\nfunction getImplicitContextIfAny() {\n\tconst rootLogger = LoggerImpl.getLogger();\n\tconst store = rootLogger.contextLocalStorage?.getStore();\n\tif (store == null) return void 0;\n\tconst keys = Object.keys(store);\n\tif (keys.length < 1) return void 0;\n\tconst result = {};\n\tfor (const key of keys) 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, getImplicitContextIfAny, withCategoryPrefix, withContext };\n//# sourceMappingURL=context.js.map","//#region src/sanitize.ts\n/**\n* The escape sequence emitted in place of a neutralized character.\n*/\nfunction escapeChar(charCode) {\n\tif (charCode === 10) return \"\\\\n\";\n\tif (charCode === 13) return \"\\\\r\";\n\tif (charCode === 27) return \"\\\\x1b\";\n\treturn `\\\\x${charCode.toString(16).padStart(2, \"0\")}`;\n}\n/**\n* Whether a character needs escaping on its own, ignoring ESC, which is\n* handled separately because it may introduce a sequence worth preserving.\n*/\nfunction isDangerous(charCode, escapeNewlines) {\n\tif (charCode === 9) return false;\n\tif (charCode === 10 || charCode === 13) return escapeNewlines;\n\tif (charCode < 32 || charCode === 127) return true;\n\treturn charCode >= 128 && charCode <= 159;\n}\n/**\n* Matches an SGR sequence anchored at the current position: CSI, its\n* parameter bytes, then the final byte `m`.\n*/\nconst sgrPattern = /^\\x1b\\[([0-9;:]*)m/;\n/**\n* The SGR sequence that clears every attribute.\n*/\nconst sgrReset = \"\\x1B[0m\";\n/**\n* Escapes control characters and ANSI escape sequences that would otherwise be\n* interpreted by a terminal or by a line-oriented log reader.\n*\n* A preserved SGR sequence that is left open is closed with `` `\\x1b[0m` `` at\n* the end of the text, so that styling an attacker sets cannot carry over into\n* whatever is printed next.\n*\n* ESC itself is escaped rather than the whole sequence it introduces: once the\n* introducer is gone, the remaining bytes (`` `[2J` ``, for instance) render as\n* ordinary text, so no sequence needs to be parsed to its end. The 8-bit C1\n* introducers (U+0080–U+009F) are escaped unconditionally, since none of them\n* is printable and each is a single code point with no sequence to inspect.\n*\n* @param text The text to neutralize.\n* @param options Which classes of characters to preserve.\n* @returns The neutralized text.\n* @since 2.0.23\n*/\nfunction sanitizeControlSequences(text, options = {}) {\n\tconst preserveSgr = options.sgr !== \"escape\";\n\tconst escapeNewlines = options.newlines === \"escape\";\n\tlet needsWork = false;\n\tfor (let i$1 = 0; i$1 < text.length; i$1++) {\n\t\tconst charCode = text.charCodeAt(i$1);\n\t\tif (charCode === 27 || isDangerous(charCode, escapeNewlines)) {\n\t\t\tneedsWork = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!needsWork) return text;\n\tlet result = \"\";\n\tlet i = 0;\n\tlet sgrOpen = false;\n\twhile (i < text.length) {\n\t\tconst charCode = text.charCodeAt(i);\n\t\tif (charCode === 27) {\n\t\t\tif (preserveSgr) {\n\t\t\t\tconst sgr = sgrPattern.exec(text.slice(i));\n\t\t\t\tif (sgr != null) {\n\t\t\t\t\tresult += sgr[0];\n\t\t\t\t\tsgrOpen = !isSgrReset(sgr[1]);\n\t\t\t\t\ti += sgr[0].length;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tresult += escapeChar(27);\n\t\t\ti++;\n\t\t} else if (isDangerous(charCode, escapeNewlines)) {\n\t\t\tresult += escapeChar(charCode);\n\t\t\ti++;\n\t\t} else {\n\t\t\tresult += text[i];\n\t\t\ti++;\n\t\t}\n\t}\n\treturn sgrOpen ? result + sgrReset : result;\n}\n/**\n* Whether an SGR sequence's parameters clear every attribute rather than set\n* one. `` `\\x1b[m` ``, `` `\\x1b[0m` ``, and `` `\\x1b[0;0m` `` all do.\n*/\nfunction isSgrReset(parameters) {\n\treturn /^0*$/.test(parameters.replace(/[;:]/g, \"\"));\n}\n/**\n* Builds the sanitizer a formatter applies to its message and category parts.\n*\n* @param options `false` to disable sanitization entirely, or the classes of\n* characters to preserve.\n* @returns A function that neutralizes a string, or `null` when sanitization\n* is disabled.\n* @since 2.0.23\n*/\nfunction getSanitizer(options) {\n\tif (options === false) return null;\n\tconst resolved = options ?? {};\n\treturn (text) => sanitizeControlSequences(text, resolved);\n}\n\n//#endregion\nexport { getSanitizer, sanitizeControlSequences };\n//# sourceMappingURL=sanitize.js.map","//#region src/circular.ts\n/**\n* Creates a {@link JSON.stringify} replacer which renders circular references\n* as the string `\"[Circular]\"` instead of letting {@link JSON.stringify} throw\n* a `TypeError`.\n*\n* The returned replacer keeps a stack of the values which are currently being\n* serialized, so a value that merely appears more than once, such as the same\n* object held by two sibling properties, is still serialized in full. Only a\n* value which contains itself is replaced.\n*\n* The replacer is stateful; create a new one for every {@link JSON.stringify}\n* call.\n*\n* Cycles are detected as the replacer sees them, which is *after* a `toJSON()`\n* method has run. A `toJSON()` method which allocates a fresh object referring\n* back to its owner on every call therefore still recurses without bound, just\n* as it does with a plain {@link JSON.stringify} call.\n*\n* @param inner An optional replacer to compose with. It runs first, and the\n* value it returns is what gets serialized. Cycles are detected\n* in both the original and the returned values, so a replacer\n* which allocates a new object for every visit (as the error\n* serializer does) cannot hide a cycle.\n* @returns A replacer function to pass to {@link JSON.stringify}.\n*/\nfunction createCircularReplacer(inner) {\n\tconst sources = [];\n\tconst results = [];\n\treturn function(key, value) {\n\t\tconst result = inner === void 0 ? value : inner.call(this, key, value);\n\t\tif (typeof result !== \"object\" || result === null) return result;\n\t\twhile (results.length > 0 && results[results.length - 1] !== this) {\n\t\t\tresults.pop();\n\t\t\tsources.pop();\n\t\t}\n\t\tfor (let i = 0; i < results.length; i++) if (results[i] === result || sources[i] === value) return \"[Circular]\";\n\t\tsources.push(value);\n\t\tresults.push(result);\n\t\treturn result;\n\t};\n}\n/**\n* Serializes a value the way {@link JSON.stringify} does, except that circular\n* references are rendered as the string `\"[Circular]\"` instead of throwing\n* a `TypeError`.\n*\n* The plain {@link JSON.stringify} call is attempted first and the cycle-safe\n* replacer is installed only if it throws, so values without cycles (by far the\n* common case) cost exactly what they cost before. The price is that a value\n* which does contain a cycle is traversed twice, so its getters and `toJSON()`\n* methods run twice. If the second attempt fails as well, its error is thrown;\n* values {@link JSON.stringify} cannot serialize at all, such as `BigInt`s,\n* therefore keep failing as before.\n*\n* Like {@link JSON.stringify}, this returns `undefined` rather than a string\n* for `undefined`, functions, and symbols. The return type says so, unlike\n* the built-in's own declaration, so that every caller has to pick its own\n* fallback for those values.\n*\n* @param value The value to serialize.\n* @param replacer An optional replacer to apply, as in {@link JSON.stringify}.\n* @param space An optional indentation, as in {@link JSON.stringify}.\n* @returns The JSON representation of the value.\n*/\nfunction stringifyWithoutCycles(value, replacer, space) {\n\ttry {\n\t\treturn JSON.stringify(value, replacer, space);\n\t} catch {\n\t\treturn JSON.stringify(value, createCircularReplacer(replacer), space);\n\t}\n}\n/**\n* Creates a {@link JSON.stringify} replacer which renders circular references\n* as the string `\"[Circular]\"`, like {@link createCircularReplacer}, and\n* additionally appends every reference it replaces to the given table.\n*\n* The replacer is stateful; create a new one for every {@link JSON.stringify}\n* call.\n*\n* @param references The table to append the replaced references to, in the\n* order they are encountered.\n* @returns A replacer function to pass to {@link JSON.stringify}.\n*/\nfunction createCircularKeyReplacer(references) {\n\tconst holders = [];\n\tconst keys = [];\n\treturn function(key, value) {\n\t\tif (typeof value !== \"object\" || value === null) return value;\n\t\twhile (holders.length > 0 && holders[holders.length - 1] !== this) {\n\t\t\tholders.pop();\n\t\t\tkeys.pop();\n\t\t}\n\t\tfor (let i = 0; i < holders.length; i++) if (holders[i] === value) {\n\t\t\treferences.push([[...keys.slice(1), key], i]);\n\t\t\treturn \"[Circular]\";\n\t\t}\n\t\tholders.push(value);\n\t\tkeys.push(key);\n\t\treturn value;\n\t};\n}\n/**\n* Serializes a value into a string suitable for use as an identity key, the\n* way {@link JSON.stringify} does, except that a value which contains\n* a circular reference is encoded instead of throwing a `TypeError`.\n*\n* Unlike {@link stringifyWithoutCycles}, which renders a circular reference as\n* the string `\"[Circular]\"` and is meant for output a human reads, this keeps\n* the references apart from the data. A key decides identity, so rendering\n* every reference as the same marker would not do: it loses which ancestor\n* a reference points back to, so `a.p.q = a` and `a.p.q = a.p` would come out\n* alike, and it cannot be told apart from a value which happens to spell the\n* marker itself. Any marker is forgeable by ordinary data, so the references\n* are recorded out of band instead.\n*\n* A value which contains a circular reference is therefore encoded as\n* `` `~${JSON.stringify([body, references])}` ``, where `body` is the ordinary\n* serialization with every circular reference replaced by `\"[Circular]\"`, and\n* `references` is a table of the references which were actually replaced, each\n* the location of the replaced value paired with the depth of the ancestor it\n* points back to. The locations tell a replaced reference from a value which\n* merely spells the marker, since ordinary data at a location is simply not in\n* the table, and the depths tell apart references which point at different\n* ancestors. The `~` prefix keeps such a key in a namespace of its own:\n* {@link JSON.stringify} output can begin with `{`, `[`, `\"`, `-`, a digit,\n* `t`, `f`, or `n`, but never `~`.\n*\n* What the key distinguishes is therefore what {@link JSON.stringify}\n* distinguishes (property order, dropped `undefined` properties, and a value\n* reached twice as a sibling expanded twice), plus the location and target of\n* every circular reference. It does not preserve the whole reference graph:\n* one self-referencing object held under two properties and two separate\n* identically shaped ones are equal keys, just as two siblings pointing at one\n* shared object and two equal copies of it already are.\n*\n* The plain {@link JSON.stringify} call is attempted first and the replacer is\n* installed only if it throws, so values without cycles (by far the common\n* case) cost exactly what they cost before. The price is that a value which\n* does contain one is traversed twice, so the second traversal may repeat the\n* getters and `toJSON()` methods the first one reached before it failed; a\n* getter which returns something different every time makes the key unstable,\n* as it would with any structural key. The encoding is applied only if the\n* second traversal actually replaced a reference, so a value which failed the\n* first attempt for some other reason keeps the key it would otherwise have\n* had. If the second attempt fails as well, its error is thrown; values\n* {@link JSON.stringify} cannot serialize at all, such as `BigInt`s, therefore\n* keep failing as before.\n*\n* Like {@link JSON.stringify}, this returns `undefined` rather than a string\n* for `undefined`, functions, and symbols. The return type says so, unlike\n* the built-in's own declaration, so that every caller has to pick its own\n* fallback for those values.\n*\n* @param value The value to serialize.\n* @returns A string which is equal for two values exactly when they are\n* equivalent in the sense described above.\n*/\nfunction stringifyKeyWithoutCycles(value) {\n\ttry {\n\t\treturn JSON.stringify(value);\n\t} catch {}\n\tconst references = [];\n\tconst body = JSON.stringify(value, createCircularKeyReplacer(references));\n\tif (body === void 0 || references.length < 1) return body;\n\treturn `~${JSON.stringify([body, references])}`;\n}\n\n//#endregion\nexport { createCircularReplacer, stringifyKeyWithoutCycles, stringifyWithoutCycles };\n//# sourceMappingURL=circular.js.map","import { stringifyWithoutCycles } from \"./circular.js\";\n\n//#region src/util.ts\nfunction inspect(obj, options) {\n\tconst indent = options?.compact === true ? void 0 : 2;\n\treturn stringifyWithoutCycles(obj, void 0, indent) ?? \"undefined\";\n}\n\n//#endregion\nexport { inspect };\n//# sourceMappingURL=util.js.map","import { createCircularReplacer, stringifyWithoutCycles } from \"./circular.js\";\nimport { getSanitizer, sanitizeControlSequences } from \"./sanitize.js\";\nimport * 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 JSON serialization, which renders circular references as\n* `\"[Circular]\"` rather than throwing.\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) => stringifyWithoutCycles(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) => stringifyWithoutCycles(v);\nconst inspect = (value, options) => String(platformInspect(value, options));\nconst utf8Encoder = new TextEncoder();\n/**\n* Builds the function that renders the values interpolated into a message\n* from {@link TextFormatterOptions.value}.\n*\n* @param value The `value` option.\n* @param sanitize The `sanitize` option, which also governs how strings are\n* neutralized under the `\"bare\"` preset.\n* @param fallback Renders the values that the option leaves to the default,\n* i.e., every value when the option is omitted, and every\n* non-string value under the `\"bare\"` preset.\n* @returns The value renderer.\n* @throws {TypeError} If the option is neither `\"bare\"` nor a function.\n*/\nfunction getValueRenderer(value, sanitize, fallback) {\n\tif (value == null) return fallback;\n\tif (typeof value === \"function\") return (v) => value(v, inspect);\n\tif (value !== \"bare\") throw new TypeError(`Invalid value option: ${JSON.stringify(value)}. It must be \"bare\" or a function.`);\n\tconst sanitizeBare = sanitize === false ? null : getSanitizer({\n\t\tsgr: \"escape\",\n\t\tnewlines: sanitize?.newlines ?? \"escape\"\n\t});\n\treturn sanitizeBare == null ? (v) => typeof v === \"string\" ? v : fallback(v) : (v) => typeof v === \"string\" ? sanitizeBare(v) : fallback(v);\n}\nfunction renderMessageParts(msgParts, valueRenderer, sanitize) {\n\tconst msgLen = msgParts.length;\n\tconst renderPart = sanitize == null ? (part) => part : (part) => sanitize(part);\n\tif (msgLen === 1) return renderPart(msgParts[0]);\n\tif (msgLen <= 6) {\n\t\tlet message = \"\";\n\t\tfor (let i = 0; i < msgLen; i++) message += i % 2 === 0 ? renderPart(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 ? renderPart(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}\n/**\n* Escapes the characters that {@link JSON.stringify} leaves as raw code points\n* but that a terminal reads as control codes: DEL and the C1 range\n* (U+0080–U+009F), whose members include the 8-bit `CSI` and `OSC`\n* introducers.\n*\n* The replacement is a JSON `\\uXXXX` escape rather than the text formatters'\n* `` `\\xNN` `` spelling, so the value survives {@link JSON.parse} unchanged.\n* Applying it to a whole serialized line is safe because every structural\n* character of JSON is ASCII, so a code point in this range can only ever be\n* literal data inside a string.\n*/\nconst jsonControlPattern = /[\\u007f-\\u009f]/g;\nfunction escapeJsonControlChars(json) {\n\treturn json.replace(jsonControlPattern, (char) => `\\\\u${char.charCodeAt(0).toString(16).padStart(4, \"0\")}`);\n}\nfunction bigintReplacer(_key, value) {\n\treturn typeof value === \"bigint\" ? value.toString() : value;\n}\nfunction stringifyJsonMessageValue(value) {\n\tif (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") return JSON.stringify(value);\n\treturn stringifyWithoutCycles(value, bigintReplacer);\n}\nfunction jsonReplacer(_key, value) {\n\tif (typeof value === \"bigint\") return value.toString();\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}\nfunction renderDefaultJsonLinesMessage(message) {\n\tconst messageLength = message.length;\n\tif (messageLength === 1) return message[0];\n\tif (messageLength === 3) return message[0] + stringifyJsonMessageValue(message[1]) + message[2];\n\tlet rendered = message[0];\n\tfor (let i = 1; i < messageLength; i++) rendered += i & 1 ? stringifyJsonMessageValue(message[i]) : message[i];\n\treturn rendered;\n}\nfunction stringifyJsonLinesField(key, value) {\n\tif (value != null && (typeof value === \"object\" || typeof value === \"function\" || typeof value === \"bigint\")) {\n\t\tconst toJSON = value.toJSON;\n\t\tif (typeof toJSON === \"function\") value = toJSON.call(value, key);\n\t}\n\treturn JSON.stringify(jsonReplacer(key, value), createCircularReplacer(jsonReplacer));\n}\nfunction formatDefaultJsonLinesRecord(record, lineEnding) {\n\tconst level = record.level === \"warning\" ? \"WARN\" : record.level.toUpperCase();\n\tconst messageJson = stringifyJsonLinesField(\"message\", renderDefaultJsonLinesMessage(record.message));\n\tconst propertiesJson = stringifyJsonLinesField(\"properties\", record.properties);\n\tlet line = `{\"@timestamp\":${JSON.stringify(new Date(record.timestamp).toISOString())},\"level\":${JSON.stringify(level)}`;\n\tif (messageJson !== void 0) line += `,\"message\":${messageJson}`;\n\tline += `,\"logger\":${JSON.stringify(record.category.join(\".\"))}`;\n\tif (propertiesJson !== void 0) line += `,\"properties\":${propertiesJson}`;\n\treturn escapeJsonControlChars(`${line}}`) + lineEnding;\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 sanitize = getSanitizer(options.sanitize);\n\tconst sanitizeCategory = getSanitizer(options.sanitize === false ? false : {\n\t\t...options.sanitize,\n\t\tsgr: \"escape\"\n\t});\n\tconst valueRenderer = getValueRenderer(options.value, options.sanitize, 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 sourceLocationRenderer = getSourceLocationRenderer(options.sourceLocation, options.sanitize === false ? null : getSanitizer({\n\t\t...options.sanitize,\n\t\tsgr: \"escape\",\n\t\tnewlines: \"escape\"\n\t}));\n\tconst formatter = options.format ?? (({ timestamp, level, category, message, sourceLocation }) => `${timestamp ? `${timestamp} ` : \"\"}[${level}] ${category}${sourceLocation == null ? \"\" : ` (${sourceLocation})`}: ${message}`);\n\treturn (record) => {\n\t\tconst message = renderMessageParts(record.message, valueRenderer, sanitize);\n\t\tconst timestamp = timestampRenderer(record.timestamp);\n\t\tconst level = levelRenderer(record.level);\n\t\tconst categoryParts = sanitizeCategory == null ? record.category : record.category.map(sanitizeCategory);\n\t\tconst category = typeof categorySeparator === \"function\" ? categorySeparator(categoryParts) : categoryParts.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\tif (sourceLocationRenderer != null) values.sourceLocation = record.sourceLocation == null ? null : sourceLocationRenderer(record.sourceLocation);\n\t\treturn `${formatter(values)}${lineEnding}`;\n\t};\n}\n/**\n* Builds the function that renders source locations for the\n* `sourceLocation` option of a formatter.\n* @param option The `sourceLocation` option.\n* @param sanitize The function to escape control characters in the rendered\n* location, if any.\n* @returns The renderer, or `null` if source locations are not shown.\n*/\nfunction getSourceLocationRenderer(option, sanitize) {\n\tif (option == null || option === false) return null;\n\tconst render = option === true ? (location) => `${location.file}:${location.line}:${location.column}` : option;\n\tif (sanitize == null) return render;\n\treturn (location) => sanitize(render(location));\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* \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\t...options.value === \"bare\" ? { value: getValueRenderer(\"bare\", options.sanitize, (v) => inspect(v, { colors: true })) } : {},\n\t\tformat({ timestamp, level, category, message, sourceLocation, 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\tif (format == null) return `${timestamp == null ? \"\" : `${timestamp} `}${level} ${categoryPrefix}${category}${sourceLocation == null ? \"\" : ` (${sourceLocation})`}:${categorySuffix} ${message}`;\n\t\t\tconst values = {\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\tif (sourceLocation !== void 0) values.sourceLocation = sourceLocation == null ? null : `${categoryPrefix}${sourceLocation}${categorySuffix}`;\n\t\t\treturn format(values);\n\t\t}\n\t});\n}\n/**\n* A text formatter that uses ANSI colors to format log records.\n*\n* \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* Bigint values in properties and interpolated messages are serialized as\n* decimal strings to preserve precision.\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) => formatDefaultJsonLinesRecord(record, lineEnding);\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] : stringifyJsonMessageValue(record.message[i]);\n\t\treturn msg;\n\t};\n\treturn (record) => {\n\t\treturn escapeJsonControlChars(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}, createCircularReplacer(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}\n/**\n* Whether a code point is one that a terminal reads as a control code even\n* though it is not a C0 control: DEL and the C1 range (U+0080–U+009F),\n* whose members include the 8-bit `CSI` and `OSC` introducers.\n*/\nfunction isTerminalControlCode(code) {\n\treturn code === 127 || code >= 128 && code <= 159;\n}\nfunction shouldEscapeLogfmtKeyChar(char, code) {\n\treturn code <= 32 || isTerminalControlCode(code) || 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 || isTerminalControlCode(code) || 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 || isTerminalControlCode(code) ? `\\\\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* Gets a console formatter with the specified options. Without options, the\n* returned formatter formats log records the same way as\n* {@link defaultConsoleFormatter}.\n*\n* @example Showing source locations in the browser console\n* ```typescript\n* import { configure, getConsoleFormatter, getConsoleSink } from \"@logtape/logtape\";\n*\n* await configure({\n* sinks: {\n* console: getConsoleSink({\n* formatter: getConsoleFormatter({ sourceLocation: true }),\n* }),\n* },\n* loggers: [\n* { category: \"my-app\", sinks: [\"console\"], captureSourceLocation: true },\n* ],\n* });\n* ```\n*\n* @param options The options for the console formatter.\n* @returns The console formatter.\n* @since 2.4.0\n*/\nfunction getConsoleFormatter(options = {}) {\n\tconst renderSourceLocation = getSourceLocationRenderer(options.sourceLocation, (text) => sanitizeControlSequences(text, {\n\t\tsgr: \"escape\",\n\t\tnewlines: \"escape\"\n\t}));\n\tif (renderSourceLocation == null) return defaultConsoleFormatter;\n\treturn (record) => formatConsoleRecord(record, record.sourceLocation == null ? void 0 : renderSourceLocation(record.sourceLocation));\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\treturn formatConsoleRecord(record, void 0);\n}\nfunction formatConsoleRecord(record, sourceLocation) {\n\tlet msg = \"\";\n\tconst values = [];\n\tfor (let i = 0; i < record.message.length; i++) if (i % 2 === 0) msg += sanitizeControlSequences(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\tconst category = record.category.map((c) => sanitizeControlSequences(c, { sgr: \"escape\" })).join(\"·\");\n\tif (sourceLocation == null) return [\n\t\t`%c${time} %c${levelAbbreviations[record.level]}%c %c${category} %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\treturn [\n\t\t`%c${time} %c${levelAbbreviations[record.level]}%c %c${category} (%s) %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\tsourceLocation,\n\t\t\"color: default;\",\n\t\t...values\n\t];\n}\n\n//#endregion\nexport { ansiColorFormatter, defaultConsoleFormatter, defaultTextFormatter, getAnsiColorFormatter, getConsoleFormatter, getJsonLinesFormatter, getLogfmtFormatter, getTextFormatter, jsonLinesFormatter, logfmtFormatter };\n//# sourceMappingURL=formatter.js.map","import { asyncDisposeSymbol, disposeSymbol } from \"./disposable.js\";\nimport { toFilter } from \"./filter.js\";\nimport { compareLogLevel } from \"./level.js\";\nimport { LoggerImpl } from \"./logger.js\";\nimport { stringifyKeyWithoutCycles } from \"./circular.js\";\nimport { defaultConsoleFormatter, defaultTextFormatter } from \"./formatter.js\";\n\n//#region src/sink.ts\nconst immediateSinkSymbol = Symbol.for(\"LogTape.sinkSnapshotPolicy.immediate\");\nfunction markSinkAsImmediate(sink) {\n\tObject.defineProperty(sink, immediateSinkSymbol, { value: true });\n\treturn sink;\n}\nfunction createSinkNotifications(sink, interval, onDrop, onError) {\n\tlet notificationDepth = 0;\n\tlet dropped = 0;\n\tlet timer = null;\n\tfunction notify(callback, event) {\n\t\tnotificationDepth++;\n\t\ttry {\n\t\t\tconst result = callback(event);\n\t\t\tif (result != null) Promise.resolve(result).catch(() => {});\n\t\t} catch {} finally {\n\t\t\tnotificationDepth--;\n\t\t}\n\t}\n\tfunction reportDrops() {\n\t\tconst count = dropped;\n\t\tdropped = 0;\n\t\tif (count > 0 && onDrop != null) notify(onDrop, {\n\t\t\tcount,\n\t\t\treason: \"overflow\"\n\t\t});\n\t}\n\treturn {\n\t\tget notifying() {\n\t\t\treturn notificationDepth > 0;\n\t\t},\n\t\tdrop() {\n\t\t\tif (onDrop == null) return;\n\t\t\tdropped++;\n\t\t\tif (timer == null) timer = setTimeout(() => {\n\t\t\t\ttimer = null;\n\t\t\t\treportDrops();\n\t\t\t}, interval);\n\t\t},\n\t\terror(error, operation, defer = false) {\n\t\t\tif (onError == null) return;\n\t\t\tconst event = {\n\t\t\t\terror,\n\t\t\t\tsink,\n\t\t\t\toperation\n\t\t\t};\n\t\t\tif (defer) queueMicrotask(() => notify(onError, event));\n\t\t\telse notify(onError, event);\n\t\t},\n\t\tdispose() {\n\t\t\tif (timer != null) {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\ttimer = null;\n\t\t\t}\n\t\t\treportDrops();\n\t\t}\n\t};\n}\nfunction isDrainable(sink) {\n\treturn typeof sink.drain === \"function\";\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 (disposeSymbol in disposableSink) filtered[disposeSymbol] = disposableSink[disposeSymbol]?.bind(sink);\n\tif (asyncDisposeSymbol in disposableSink) filtered[asyncDisposeSymbol] = disposableSink[asyncDisposeSymbol]?.bind(sink);\n\tif (isDrainable(sink)) filtered.drain = sink.drain.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* The returned sink is {@link Drainable}: its {@link Drainable.drain} method\n* waits for the records accepted so far to be written (or, in non-blocking\n* mode, to fail or be dropped) without closing the stream or releasing its\n* writer. In non-blocking mode, draining starts flushing the buffer\n* immediately instead of waiting for the flush interval, and never rejects\n* because of write failures, which that mode suppresses or passes to\n* the `onError` callback instead. In the default mode, a failed write makes\n* draining reject with the same error that disposal would.\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 closeStream = options.closeStream ?? true;\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[asyncDisposeSymbol] = async () => {\n\t\t\ttry {\n\t\t\t\tawait lastPromise;\n\t\t\t\tif (closeStream) await writer.close();\n\t\t\t} finally {\n\t\t\t\twriter.releaseLock();\n\t\t\t}\n\t\t};\n\t\tsink.drain = async () => {\n\t\t\tawait lastPromise;\n\t\t};\n\t\treturn markSinkAsImmediate(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 notifications = createSinkNotifications(\"stream\", flushInterval, nonBlockingConfig.onDrop, nonBlockingConfig.onError);\n\tconst buffer = [];\n\tlet flushTimer = null;\n\tlet disposed = false;\n\tlet disposePromise = null;\n\tlet activeFlush = null;\n\tlet startingFlush = false;\n\tlet flushOwned = false;\n\tconst maxBufferSize = bufferSize * 2;\n\tlet acceptedSeq = 0;\n\tlet batchNext = 1;\n\tlet batchEnd = 0;\n\tconst drainWaiters = [];\n\tfunction getSettledSeq() {\n\t\tif (batchNext <= batchEnd) return batchNext - 1;\n\t\tif (buffer.length > 0) return acceptedSeq - buffer.length;\n\t\treturn acceptedSeq;\n\t}\n\tfunction resolveDrainWaiters() {\n\t\tif (drainWaiters.length < 1) return;\n\t\tconst settledSeq = getSettledSeq();\n\t\tlet count = 0;\n\t\twhile (count < drainWaiters.length && drainWaiters[count].target <= settledSeq) count++;\n\t\tfor (const waiter of drainWaiters.splice(0, count)) waiter.resolve();\n\t}\n\tasync function flush() {\n\t\tif (buffer.length === 0) return;\n\t\tbatchEnd = acceptedSeq;\n\t\tbatchNext = acceptedSeq - buffer.length + 1;\n\t\tconst records = buffer.splice(0);\n\t\tfor (const record of records) {\n\t\t\tlet operation = \"format\";\n\t\t\ttry {\n\t\t\t\tconst text = formatter(record);\n\t\t\t\toperation = \"encode\";\n\t\t\t\tconst bytes = encoder.encode(text);\n\t\t\t\toperation = \"write\";\n\t\t\t\tawait writer.ready;\n\t\t\t\tawait writer.write(bytes);\n\t\t\t} catch (error) {\n\t\t\t\tnotifications.error(error, operation, startingFlush);\n\t\t\t}\n\t\t\tbatchNext++;\n\t\t\tresolveDrainWaiters();\n\t\t}\n\t}\n\tasync function runFlushLoop() {\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tawait flush();\n\t\t\t\tif (drainWaiters.length < 1 || buffer.length < 1) {\n\t\t\t\t\tflushOwned = false;\n\t\t\t\t\tactiveFlush = null;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tflushOwned = false;\n\t\t\tactiveFlush = null;\n\t\t}\n\t}\n\tfunction scheduleFlush() {\n\t\tif (flushOwned || disposed) return;\n\t\tflushOwned = true;\n\t\tstartingFlush = true;\n\t\ttry {\n\t\t\tactiveFlush = runFlushLoop();\n\t\t} finally {\n\t\t\tstartingFlush = false;\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 || notifications.notifying) return;\n\t\tlet dropped = false;\n\t\tif (buffer.length >= maxBufferSize && buffer.length > 0) {\n\t\t\tbuffer.shift();\n\t\t\tnotifications.drop();\n\t\t\tdropped = true;\n\t\t}\n\t\tbuffer.push(record);\n\t\tacceptedSeq++;\n\t\tif (dropped) resolveDrainWaiters();\n\t\tif (buffer.length >= bufferSize) scheduleFlush();\n\t\telse if (flushTimer === null) startFlushTimer();\n\t};\n\tnonBlockingSink[asyncDisposeSymbol] = () => {\n\t\tif (disposePromise != null) return disposePromise;\n\t\tlet complete;\n\t\tdisposePromise = new Promise((resolve) => {\n\t\t\tcomplete = resolve;\n\t\t});\n\t\tdisposed = true;\n\t\tif (flushTimer !== null) {\n\t\t\tclearInterval(flushTimer);\n\t\t\tflushTimer = null;\n\t\t}\n\t\tnotifications.dispose();\n\t\tcomplete((async () => {\n\t\t\ttry {\n\t\t\t\tawait Promise.resolve();\n\t\t\t\tawait activeFlush;\n\t\t\t\tawait flush();\n\t\t\t\tif (closeStream) try {\n\t\t\t\t\tawait writer.close();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tnotifications.error(error, \"close\");\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\twriter.releaseLock();\n\t\t\t}\n\t\t})());\n\t\treturn disposePromise;\n\t};\n\tnonBlockingSink.drain = () => {\n\t\tconst target = acceptedSeq;\n\t\tif (getSettledSeq() >= target) return Promise.resolve();\n\t\tconst promise = new Promise((resolve) => {\n\t\t\tdrainWaiters.push({\n\t\t\t\ttarget,\n\t\t\t\tresolve\n\t\t\t});\n\t\t});\n\t\tscheduleFlush();\n\t\treturn promise;\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 writeToConsole = (record, args) => {\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\tconst baseSink = (record) => {\n\t\twriteToConsole(record, formatter(record));\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 notifications = createSinkNotifications(\"console\", flushInterval, nonBlockingConfig.onDrop, nonBlockingConfig.onError);\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) {\n\t\t\tlet operation = \"format\";\n\t\t\ttry {\n\t\t\t\tconst args = formatter(record);\n\t\t\t\toperation = \"write\";\n\t\t\t\twriteToConsole(record, args);\n\t\t\t} catch (error) {\n\t\t\t\tnotifications.error(error, operation);\n\t\t\t}\n\t\t}\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 || notifications.notifying) return;\n\t\tif (buffer.length >= maxBufferSize && buffer.length > 0) {\n\t\t\tbuffer.shift();\n\t\t\tnotifications.drop();\n\t\t}\n\t\tbuffer.push(record);\n\t\tif (buffer.length >= bufferSize) scheduleFlush();\n\t\telse if (flushTimer === null) startFlushTimer();\n\t};\n\tnonBlockingSink[disposeSymbol] = () => {\n\t\tif (disposed) return;\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\tnotifications.dispose();\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* Records are passed to the async sink one at a time, in the order they\n* were logged. By default the number of waiting records is unbounded; use\n* {@link AsyncSinkOptions.maxQueueSize} to limit it.\n*\n* The returned sink is also {@link Drainable}: its {@link Drainable.drain}\n* method waits for the operations of the records accepted before the call\n* without disposing of the sink. Since failures of the async sink are\n* reported to the meta logger, draining resolves even if some of the covered\n* operations failed. Records that the meta logger emits while reporting\n* such failures are not covered.\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* @example Bound the queue and keep serverless requests alive\n* ```typescript\n* import { waitUntil } from \"@vercel/functions\";\n*\n* const sink = fromAsyncSink(asyncSink, {\n* maxQueueSize: 1000,\n* overflow: \"drop-oldest\",\n* onDrop: ({ count, reason }) => droppedLogs.add(count, { reason }),\n* waitUntil,\n* });\n* ```\n*\n* @param asyncSink The async sink function to convert.\n* @param options Options for queue limits and lifetime registration.\n* Available since 2.4.0.\n* @returns A sink that properly handles async operations and disposal.\n* @throws {RangeError} If `maxQueueSize` is not a positive integer or\n* `Infinity`.\n* @throws {TypeError} If `overflow` is not a known policy.\n* @since 1.0.0\n*/\nfunction fromAsyncSink(asyncSink, options = {}) {\n\tconst maxQueueSize = options.maxQueueSize ?? Infinity;\n\tif (maxQueueSize !== Infinity && !(Number.isInteger(maxQueueSize) && maxQueueSize >= 1)) throw new RangeError(`The maxQueueSize option must be a positive integer or Infinity, but got ${maxQueueSize}.`);\n\tconst overflow = options.overflow ?? \"drop-oldest\";\n\tif (overflow !== \"drop-oldest\" && overflow !== \"drop-newest\") throw new TypeError(`The overflow option must be either \"drop-oldest\" or \"drop-newest\", but got ${JSON.stringify(overflow)}.`);\n\tconst { onDrop, waitUntil } = options;\n\tlet lastPromise = Promise.resolve();\n\tlet head = null;\n\tlet tail = null;\n\tlet live = 0;\n\tlet inOnDrop = false;\n\tlet carriedDrops = 0;\n\tlet reportingCallbackError = false;\n\tfunction reportToMetaLogger(rawMessage, message, properties) {\n\t\ttry {\n\t\t\tconst metaLogger = LoggerImpl.getLogger([\"logtape\", \"meta\"]);\n\t\t\tconst errorRecord = {\n\t\t\t\tcategory: [\"logtape\", \"meta\"],\n\t\t\t\tlevel: \"error\",\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t\trawMessage,\n\t\t\t\tmessage,\n\t\t\t\tproperties,\n\t\t\t\t[_asyncSinkError]: true\n\t\t\t};\n\t\t\tmetaLogger.emit(errorRecord, new Set([sink]));\n\t\t} catch {}\n\t}\n\tfunction reportCallbackError(callback, error) {\n\t\tif (reportingCallbackError) return;\n\t\treportingCallbackError = true;\n\t\ttry {\n\t\t\treportToMetaLogger(\"Async sink {callback} callback failed: {error}\", [\n\t\t\t\t\"Async sink \",\n\t\t\t\tcallback,\n\t\t\t\t\" callback failed: \",\n\t\t\t\terror,\n\t\t\t\t\"\"\n\t\t\t], {\n\t\t\t\terror,\n\t\t\t\tcallback,\n\t\t\t\tsink: asyncSink\n\t\t\t});\n\t\t} finally {\n\t\t\treportingCallbackError = false;\n\t\t}\n\t}\n\tfunction invokeCallback(callback, invoke, diagnostic) {\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = invoke();\n\t\t} catch (error) {\n\t\t\treportCallbackError(callback, error);\n\t\t\treturn;\n\t\t}\n\t\tif (result == null) return;\n\t\ttry {\n\t\t\tconst then = result.then;\n\t\t\tif (typeof then !== \"function\") return;\n\t\t\tthen.call(result, void 0, (error) => {\n\t\t\t\tif (!diagnostic) reportCallbackError(callback, error);\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treportCallbackError(callback, error);\n\t\t}\n\t}\n\tfunction isDiagnostic(record) {\n\t\ttry {\n\t\t\treturn _asyncSinkError in record;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\tfunction notifyDrop(count, diagnostic) {\n\t\tif (onDrop == null) return;\n\t\tif (inOnDrop) {\n\t\t\tcarriedDrops += count;\n\t\t\treturn;\n\t\t}\n\t\tconst total = count + carriedDrops;\n\t\tcarriedDrops = 0;\n\t\tif (total < 1) return;\n\t\tinOnDrop = true;\n\t\ttry {\n\t\t\tinvokeCallback(\"onDrop\", () => onDrop({\n\t\t\t\tcount: total,\n\t\t\t\treason: \"overflow\"\n\t\t\t}), diagnostic);\n\t\t} finally {\n\t\t\tinOnDrop = false;\n\t\t}\n\t}\n\tasync function run(entry) {\n\t\tconst record = entry.record;\n\t\tif (record === void 0) return;\n\t\tlet failed = false;\n\t\tlet error;\n\t\ttry {\n\t\t\tawait asyncSink(record);\n\t\t} catch (e) {\n\t\t\tfailed = true;\n\t\t\terror = e;\n\t\t}\n\t\thead = entry.next;\n\t\tif (head === null) tail = null;\n\t\tentry.next = null;\n\t\tentry.record = void 0;\n\t\tlive--;\n\t\tif (!failed) return;\n\t\ttry {\n\t\t\tif (_asyncSinkError in record) return;\n\t\t\treportToMetaLogger(\"Async sink error: {error}\", [\n\t\t\t\t\"Async sink error: \",\n\t\t\t\terror,\n\t\t\t\t\"\"\n\t\t\t], {\n\t\t\t\terror,\n\t\t\t\tsink: asyncSink,\n\t\t\t\trecord\n\t\t\t});\n\t\t} catch {}\n\t}\n\tconst sink = (record) => {\n\t\tlet dropped = 0;\n\t\tif (live > maxQueueSize) {\n\t\t\tif (overflow === \"drop-newest\") {\n\t\t\t\tnotifyDrop(1, isDiagnostic(record));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst evicted = head.next;\n\t\t\thead.next = evicted.next;\n\t\t\tif (tail === evicted) tail = head;\n\t\t\tevicted.next = null;\n\t\t\tevicted.record = void 0;\n\t\t\tlive--;\n\t\t\tdropped = 1;\n\t\t}\n\t\tconst entry = {\n\t\t\trecord,\n\t\t\tnext: null\n\t\t};\n\t\tif (tail === null) head = entry;\n\t\telse tail.next = entry;\n\t\ttail = entry;\n\t\tlive++;\n\t\tconst promise = lastPromise.then(() => run(entry));\n\t\tlastPromise = promise;\n\t\tif (dropped < 1 && waitUntil == null) return;\n\t\tconst diagnostic = isDiagnostic(record);\n\t\tif (dropped > 0) notifyDrop(dropped, diagnostic);\n\t\tif (waitUntil != null) invokeCallback(\"waitUntil\", () => waitUntil(promise), diagnostic);\n\t};\n\tsink[asyncDisposeSymbol] = async () => {\n\t\tlet notified = false;\n\t\tfor (;;) {\n\t\t\tconst promise = lastPromise;\n\t\t\tawait promise;\n\t\t\tif (promise !== lastPromise) continue;\n\t\t\tif (!notified && carriedDrops > 0 && !inOnDrop) {\n\t\t\t\tnotified = true;\n\t\t\t\tnotifyDrop(0, false);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t};\n\tsink.drain = async () => {\n\t\tawait lastPromise;\n\t};\n\treturn sink;\n}\nconst _asyncSinkError = Symbol.for(\"logtape.asyncSinkError\");\nfunction fingersCrossed(sink, options = {}) {\n\tconst triggerLevel = options.triggerLevel ?? \"error\";\n\tconst afterTrigger = options.afterTrigger === void 0 ? \"passthrough\" : options.afterTrigger;\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\tfunction wrapSink(wrapped, disposeSelf) {\n\t\tconst disposableSink = sink;\n\t\tconst disposableWrapped = wrapped;\n\t\tconst disposeSink = disposableSink[disposeSymbol];\n\t\tconst asyncDisposeSink = disposableSink[asyncDisposeSymbol];\n\t\tif (disposeSelf != null || disposeSink != null) disposableWrapped[disposeSymbol] = () => {\n\t\t\tdisposeSelf?.();\n\t\t\tdisposeSink?.call(sink);\n\t\t};\n\t\tif (asyncDisposeSink != null) disposableWrapped[asyncDisposeSymbol] = async () => {\n\t\t\tdisposeSelf?.();\n\t\t\tawait asyncDisposeSink.call(sink);\n\t\t};\n\t\tif (isDrainable(sink)) disposableWrapped.drain = sink.drain.bind(sink);\n\t\treturn disposableWrapped;\n\t}\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\tif (afterTrigger !== \"passthrough\" && afterTrigger !== \"buffer\") throw new TypeError(`Invalid afterTrigger: ${JSON.stringify(afterTrigger)}. Expected \"passthrough\", \"buffer\", or undefined.`);\n\tconst keepTriggered = afterTrigger === \"passthrough\";\n\tfunction snapshotRecord(record) {\n\t\tif (maxBufferSize === 0 || options.snapshot == null) return record;\n\t\tconst snapshot = options.snapshot(record);\n\t\tif (snapshot == null || typeof snapshot !== \"object\") throw new TypeError(\"snapshot must return a log record object.\");\n\t\tif (\"then\" in snapshot && typeof snapshot.then === \"function\") {\n\t\t\tPromise.resolve(snapshot).catch(() => {});\n\t\t\tthrow new TypeError(\"snapshot must return a log record synchronously.\");\n\t\t}\n\t\treturn snapshot;\n\t}\n\tfunction getBufferAction(record) {\n\t\tconst action = options.bufferAction?.(record);\n\t\tif (action !== void 0 && action !== \"flush\" && action !== \"discard\") throw new TypeError(`Invalid buffer action: ${JSON.stringify(action)}. Expected \"flush\", \"discard\", or undefined.`);\n\t\treturn action;\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 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 stringifyKeyWithoutCycles(contextValues) ?? \"undefined\";\n\t}\n\tfunction getBufferKey(identity) {\n\t\tconst categoryKey = getCategoryKey(identity.category);\n\t\tif (!isolateByContext) return categoryKey;\n\t\treturn `${categoryKey}:${identity.context}`;\n\t}\n\tfunction getBufferIdentity(record) {\n\t\treturn {\n\t\t\tcategory: record.category,\n\t\t\tcontext: getContextKey(record.properties)\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, metadata] of triggered) if (now - metadata.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\tconst validateGlobalSelector = (selector) => {\n\t\t\tif (selector?.context != null || selector?.category != null) throw new TypeError(\"A buffer selector cannot be used without buffer isolation.\");\n\t\t};\n\t\tconst flush = (selector) => {\n\t\t\tvalidateGlobalSelector(selector);\n\t\t\tconst bufferedRecords = buffer.splice(0);\n\t\t\ttriggered = false;\n\t\t\tfor (const bufferedRecord of bufferedRecords) sink(bufferedRecord);\n\t\t};\n\t\tconst discard = (selector) => {\n\t\t\tvalidateGlobalSelector(selector);\n\t\t\tbuffer.length = 0;\n\t\t\ttriggered = false;\n\t\t};\n\t\tconst fingersCrossedSink = (record) => {\n\t\t\tconst action = getBufferAction(record);\n\t\t\tif (action === \"flush\") {\n\t\t\t\tflush();\n\t\t\t\tsink(record);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (action === \"discard\") {\n\t\t\t\tdiscard();\n\t\t\t\treturn;\n\t\t\t}\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\tif (keepTriggered) {\n\t\t\t\t\ttriggered = true;\n\t\t\t\t\tfor (const bufferedRecord of buffer) sink(bufferedRecord);\n\t\t\t\t\tbuffer.length = 0;\n\t\t\t\t} else {\n\t\t\t\t\tconst bufferedRecords = buffer.splice(0);\n\t\t\t\t\tfor (const bufferedRecord of bufferedRecords) sink(bufferedRecord);\n\t\t\t\t}\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(snapshotRecord(record));\n\t\t\t\twhile (buffer.length > maxBufferSize) buffer.shift();\n\t\t\t}\n\t\t};\n\t\tfingersCrossedSink.flush = flush;\n\t\tfingersCrossedSink.discard = discard;\n\t\treturn wrapSink(fingersCrossedSink);\n\t} else {\n\t\tconst buffers = /* @__PURE__ */ new Map();\n\t\tconst triggered = /* @__PURE__ */ new Map();\n\t\tlet accessCounter = 0;\n\t\tconst getRecordSelection = (identity) => {\n\t\t\treturn {\n\t\t\t\tcategory: isolateByCategory ? identity.category : void 0,\n\t\t\t\tcontext: isolateByContext ? identity.context : void 0\n\t\t\t};\n\t\t};\n\t\tconst getManualSelection = (selector) => {\n\t\t\tlet context;\n\t\t\tif (selector?.context != null) {\n\t\t\t\tif (!isolateByContext) throw new TypeError(\"A context selector requires isolateByContext.\");\n\t\t\t\tconst missingKeys = isolateByContext.keys.filter((key) => !(key in selector.context));\n\t\t\t\tif (missingKeys.length > 0) throw new TypeError(`Missing context selector keys: ${missingKeys.join(\", \")}.`);\n\t\t\t\tcontext = getContextKey(selector.context);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcategory: selector?.category,\n\t\t\t\tcontext\n\t\t\t};\n\t\t};\n\t\tconst matchesSelection = (identity, selection) => {\n\t\t\tif (selection.context != null && selection.context !== identity.context) return false;\n\t\t\tif (selection.category == null) return true;\n\t\t\tif (getCategoryKey(selection.category) === getCategoryKey(identity.category)) return true;\n\t\t\tif (!isolateByCategory || shouldFlushBuffer == null) return false;\n\t\t\ttry {\n\t\t\t\treturn shouldFlushBuffer(selection.category, identity.category);\n\t\t\t} catch {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t};\n\t\tconst takeBufferedRecords = (selection) => {\n\t\t\tconst selectedBuffers = [];\n\t\t\tconst records = [];\n\t\t\tfor (const [key, metadata] of buffers) {\n\t\t\t\tif (!matchesSelection(metadata, selection)) continue;\n\t\t\t\tselectedBuffers.push({\n\t\t\t\t\tkey,\n\t\t\t\t\tidentity: metadata\n\t\t\t\t});\n\t\t\t\trecords.push(...metadata.buffer);\n\t\t\t\tbuffers.delete(key);\n\t\t\t}\n\t\t\trecords.sort((a, b) => a.timestamp - b.timestamp);\n\t\t\treturn {\n\t\t\t\tselectedBuffers,\n\t\t\t\trecords\n\t\t\t};\n\t\t};\n\t\tconst releaseTriggeredState = (selection) => {\n\t\t\tfor (const [key, metadata] of triggered) if (matchesSelection(metadata, selection)) triggered.delete(key);\n\t\t};\n\t\tconst flushSelection = (selection) => {\n\t\t\tconst { records } = takeBufferedRecords(selection);\n\t\t\treleaseTriggeredState(selection);\n\t\t\tfor (const record of records) sink(record);\n\t\t};\n\t\tconst discardSelection = (selection) => {\n\t\t\tfor (const [key, metadata] of buffers) if (matchesSelection(metadata, selection)) buffers.delete(key);\n\t\t\treleaseTriggeredState(selection);\n\t\t};\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 identity = getBufferIdentity(record);\n\t\t\tconst bufferKey = getBufferKey(identity);\n\t\t\tconst selection = getRecordSelection(identity);\n\t\t\tconst action = getBufferAction(record);\n\t\t\tif (action === \"flush\") {\n\t\t\t\tflushSelection(selection);\n\t\t\t\tsink(record);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (action === \"discard\") {\n\t\t\t\tdiscardSelection(selection);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst triggeredMetadata = triggered.get(bufferKey);\n\t\t\tif (triggeredMetadata != null) {\n\t\t\t\ttriggeredMetadata.triggeredAt = 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 { selectedBuffers, records } = takeBufferedRecords(selection);\n\t\t\t\tconst triggeredAt = Date.now();\n\t\t\t\tif (keepTriggered) for (const { key, identity: identity$1 } of selectedBuffers) triggered.set(key, {\n\t\t\t\t\tcategory: identity$1.category,\n\t\t\t\t\tcontext: identity$1.context,\n\t\t\t\t\ttriggeredAt\n\t\t\t\t});\n\t\t\t\tfor (const bufferedRecord of records) sink(bufferedRecord);\n\t\t\t\tif (keepTriggered) triggered.set(bufferKey, {\n\t\t\t\t\tcategory: identity.category,\n\t\t\t\t\tcontext: identity.context,\n\t\t\t\t\ttriggeredAt\n\t\t\t\t});\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\tconst snapshot = snapshotRecord(record);\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\t...identity,\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(snapshot);\n\t\t\t\twhile (metadata.buffer.length > maxBufferSize) metadata.buffer.shift();\n\t\t\t}\n\t\t};\n\t\tfingersCrossedSink.flush = (selector) => {\n\t\t\tflushSelection(getManualSelection(selector));\n\t\t};\n\t\tfingersCrossedSink.discard = (selector) => {\n\t\t\tdiscardSelection(getManualSelection(selector));\n\t\t};\n\t\treturn wrapSink(fingersCrossedSink, cleanupTimer === null ? void 0 : () => {\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}\n}\n\n//#endregion\nexport { fingersCrossed, fromAsyncSink, getConsoleSink, getStreamSink, withFilter };\n//# sourceMappingURL=sink.js.map","import { asyncDisposeSymbol, disposeSymbol } from \"./disposable.js\";\nimport { toFilter } from \"./filter.js\";\nimport { compileScopedConfig, disposeScopedConfig, disposeScopedConfigSync, getCurrentScopedConfig, runWithScopedConfig, throwCombinedErrors } from \"./scoped-config.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;\nlet activeScopedConfigCount = 0;\nconst activeScopedConfigs = /* @__PURE__ */ new Set();\nlet globalConfigMutationInProgress = false;\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* The sinks installed by the current configuration, which {@link drain}\n* drains. Kept separately from {@link currentConfig} because the caller may\n* mutate the configuration object after configuring.\n*/\nconst installedSinks = /* @__PURE__ */ new Set();\nconst inspectionStateSymbol = Symbol.for(\"logtape.inspectionState\");\nfunction getInspectionState() {\n\tconst registry = globalThis;\n\tconst state = registry[inspectionStateSymbol];\n\tif (state != null && state.loggers instanceof WeakMap) return state;\n\tconst newState = {\n\t\tconfigured: false,\n\t\tloggers: /* @__PURE__ */ new WeakMap()\n\t};\n\tregistry[inspectionStateSymbol] = newState;\n\treturn newState;\n}\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();\nlet unregisterDisposeHook;\n/**\n* Gets the root logger to toggle source location capture on. The root logger\n* is shared through the global object, so it can be made by an older copy of\n* LogTape loaded by another package, which lacks these methods. Its loggers\n* never capture source locations, so the calls are just skipped then.\n*/\nfunction getSourceLocationRoot() {\n\treturn LoggerImpl.getLogger();\n}\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\tunregisterDisposeHook?.();\n\tunregisterDisposeHook = void 0;\n\tconst handler = allowAsync ? disposeInternal : disposeSyncInternal;\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\tunregisterDisposeHook = () => {\n\t\t\t\tconst offMethod = proc?.[\"off\"] ?? proc?.[\"removeListener\"];\n\t\t\t\tif (typeof offMethod === \"function\") offMethod.call(proc, \"exit\", handler);\n\t\t\t};\n\t\t\treturn;\n\t\t}\n\t}\n\tconst addEventListenerMethod = globalThis.addEventListener;\n\tif (typeof addEventListenerMethod !== \"function\") return;\n\tconst removeEventListenerMethod = globalThis.removeEventListener;\n\tif (\"Deno\" in globalThis) {\n\t\taddEventListenerMethod.call(globalThis, \"unload\", handler);\n\t\tif (typeof removeEventListenerMethod === \"function\") unregisterDisposeHook = () => {\n\t\t\tremoveEventListenerMethod.call(globalThis, \"unload\", handler);\n\t\t};\n\t} else {\n\t\taddEventListenerMethod.call(globalThis, \"pagehide\", handler);\n\t\tif (typeof removeEventListenerMethod === \"function\") unregisterDisposeHook = () => {\n\t\t\tremoveEventListenerMethod.call(globalThis, \"pagehide\", handler);\n\t\t};\n\t}\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\tawait runGlobalConfigMutation(\"configure()\", async () => {\n\t\tif (currentConfig != null && !config.reset) throw new ConfigError(\"Already configured; if you want to reset, turn on the reset flag.\");\n\t\tawait disposeInternal();\n\t\tresetInternal();\n\t\ttry {\n\t\t\tconfigureInternal(config, true);\n\t\t} catch (e) {\n\t\t\tif (e instanceof ConfigError) {\n\t\t\t\tawait disposeInternal();\n\t\t\t\tresetInternal();\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\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\trunGlobalConfigMutationSync(\"configureSync()\", () => {\n\t\tif (currentConfig != null && !config.reset) throw new ConfigError(\"Already configured; if you want to reset, turn on the reset flag.\");\n\t\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\t\tdisposeSyncInternal();\n\t\tresetInternal();\n\t\ttry {\n\t\t\tconfigureInternal(config, false);\n\t\t} catch (e) {\n\t\t\tif (e instanceof ConfigError) {\n\t\t\t\tdisposeSyncInternal();\n\t\t\t\tresetInternal();\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t});\n}\n/**\n* Runs a callback with a LogTape configuration scoped to the current execution\n* context.\n*\n* The process-global configuration must already provide\n* `contextLocalStorage`. The scoped configuration fully overrides global\n* logger routing while the callback and its async work run.\n*\n* @param config The scoped configuration.\n* @param callback The callback to run.\n* @returns The callback's resolved return value.\n* @since 2.3.0\n*/\nasync function withConfig(config, callback) {\n\tconst contextLocalStorage = getConfiguredContextLocalStorage(\"withConfig()\");\n\tconst scopedConfig = compileScopedConfig(config, true, (message) => new ConfigError(message));\n\tlet result;\n\tlet callbackError;\n\tlet callbackFailed = false;\n\tactiveScopedConfigCount++;\n\tactiveScopedConfigs.add(scopedConfig);\n\tconst capturesSourceLocation = scopedConfig.capturesSourceLocation;\n\tif (capturesSourceLocation) getSourceLocationRoot().retainScopedSourceLocationCapture?.();\n\ttry {\n\t\tresult = await runWithScopedConfig(contextLocalStorage, scopedConfig, callback);\n\t} catch (error) {\n\t\tcallbackFailed = true;\n\t\tcallbackError = error;\n\t}\n\ttry {\n\t\tawait disposeScopedConfig(scopedConfig, getRetainedDisposables(scopedConfig));\n\t} catch (disposeError) {\n\t\tif (callbackFailed) throwCombinedErrors(callbackError, disposeError);\n\t\tthrow disposeError;\n\t} finally {\n\t\tactiveScopedConfigs.delete(scopedConfig);\n\t\tactiveScopedConfigCount--;\n\t\tif (capturesSourceLocation) getSourceLocationRoot().releaseScopedSourceLocationCapture?.();\n\t}\n\tif (callbackFailed) throw callbackError;\n\treturn result;\n}\n/**\n* Runs a synchronous callback with a LogTape configuration scoped to the\n* current execution context.\n*\n* The scoped configuration must not contain async disposable sinks or filters.\n*\n* @param config The scoped configuration.\n* @param callback The callback to run.\n* @returns The callback's return value.\n* @since 2.3.0\n*/\nfunction withConfigSync(config, callback) {\n\tconst contextLocalStorage = getConfiguredContextLocalStorage(\"withConfigSync()\");\n\tconst scopedConfig = compileScopedConfig(config, false, (message) => new ConfigError(message));\n\tlet result;\n\tlet callbackError;\n\tlet callbackFailed = false;\n\tactiveScopedConfigCount++;\n\tactiveScopedConfigs.add(scopedConfig);\n\tconst capturesSourceLocation = scopedConfig.capturesSourceLocation;\n\tif (capturesSourceLocation) getSourceLocationRoot().retainScopedSourceLocationCapture?.();\n\ttry {\n\t\tresult = runWithScopedConfig(contextLocalStorage, scopedConfig, callback);\n\t\tif (isThenable(result)) {\n\t\t\tPromise.resolve(result).catch(() => {});\n\t\t\tcallbackFailed = true;\n\t\t\tcallbackError = new ConfigError(\"withConfigSync() callback must not return a promise. Use withConfig() for async callbacks.\");\n\t\t}\n\t} catch (error) {\n\t\tcallbackFailed = true;\n\t\tcallbackError = error;\n\t}\n\ttry {\n\t\tdisposeScopedConfigSync(scopedConfig, getRetainedDisposables(scopedConfig));\n\t} catch (disposeError) {\n\t\tif (callbackFailed) throwCombinedErrors(callbackError, disposeError);\n\t\tthrow disposeError;\n\t} finally {\n\t\tactiveScopedConfigs.delete(scopedConfig);\n\t\tactiveScopedConfigCount--;\n\t\tif (capturesSourceLocation) getSourceLocationRoot().releaseScopedSourceLocationCapture?.();\n\t}\n\tif (callbackFailed) throw callbackError;\n\treturn result;\n}\nfunction isThenable(value) {\n\treturn value != null && (typeof value === \"object\" || typeof value === \"function\") && \"then\" in value && typeof value.then === \"function\";\n}\nfunction getGlobalDisposables() {\n\treturn new Set([\n\t\t...filterDisposables,\n\t\t...asyncFilterDisposables,\n\t\t...sinkDisposables,\n\t\t...asyncSinkDisposables\n\t]);\n}\nfunction getRetainedDisposables(scopedConfig) {\n\tconst disposables = new Set(getGlobalDisposables());\n\tfor (const activeScopedConfig of activeScopedConfigs) {\n\t\tif (activeScopedConfig === scopedConfig || activeScopedConfig.disposed) continue;\n\t\taddScopedConfigDisposables(disposables, activeScopedConfig);\n\t}\n\treturn disposables;\n}\nfunction addScopedConfigDisposables(disposables, scopedConfig) {\n\tfor (const disposable of scopedConfig.syncFilters) disposables.add(disposable);\n\tfor (const disposable of scopedConfig.asyncFilters) disposables.add(disposable);\n\tfor (const disposable of scopedConfig.syncSinks) disposables.add(disposable);\n\tfor (const disposable of scopedConfig.asyncSinks) disposables.add(disposable);\n}\nfunction configureInternal(config, allowAsync) {\n\tcurrentConfig = config;\n\tgetInspectionState().configured = true;\n\tlet metaConfigured = false;\n\tlet capturesSourceLocation = 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\tif (cfg.captureSourceLocation !== void 0) {\n\t\t\tif (typeof cfg.captureSourceLocation !== \"boolean\") throw new ConfigError(\"Logger captureSourceLocation must be a boolean.\");\n\t\t\tlogger.sourceLocationCapture = cfg.captureSourceLocation;\n\t\t\tif (cfg.captureSourceLocation) capturesSourceLocation = true;\n\t\t}\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\tgetInspectionState().loggers.set(logger, {\n\t\t\tsinks: [...logger.sinks],\n\t\t\tsinkIds: [...cfg.sinks ?? []],\n\t\t\tfilters: [...logger.filters],\n\t\t\tfilterIds: [...cfg.filters ?? []]\n\t\t});\n\t\tstrongRefs.add(logger);\n\t}\n\tLoggerImpl.getLogger().contextLocalStorage = config.contextLocalStorage;\n\tgetSourceLocationRoot().setGlobalSourceLocationCapture?.(capturesSourceLocation);\n\tfor (const sink of Object.values(config.sinks)) {\n\t\tinstalledSinks.add(sink);\n\t\tif (asyncDisposeSymbol in sink) if (allowAsync) asyncSinkDisposables.add(sink);\n\t\telse throw new ConfigError(\"Async disposables cannot be used with configureSync().\");\n\t\tif (disposeSymbol 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 (asyncDisposeSymbol 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 (disposeSymbol 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 runGlobalConfigMutation(\"reset()\", async () => {\n\t\tawait disposeInternal();\n\t\tresetInternal();\n\t});\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\trunGlobalConfigMutationSync(\"resetSync()\", () => {\n\t\tdisposeSyncInternal();\n\t\tresetInternal();\n\t});\n}\nfunction resetInternal() {\n\tunregisterDisposeHook?.();\n\tunregisterDisposeHook = void 0;\n\tconst rootLogger = LoggerImpl.getLogger([]);\n\trootLogger.resetDescendants();\n\tgetSourceLocationRoot().setGlobalSourceLocationCapture?.(false);\n\tdelete rootLogger.contextLocalStorage;\n\tstrongRefs.clear();\n\tinstalledSinks.clear();\n\tconst inspectionState = getInspectionState();\n\tinspectionState.configured = false;\n\tinspectionState.loggers = /* @__PURE__ */ new WeakMap();\n\tcurrentConfig = null;\n}\n/**\n* Checks whether the process-global configuration is in effect. Unlike\n* {@link getConfig}, it also reflects configuring and resetting through\n* another copy of LogTape in the same process.\n*/\nfunction isConfigured() {\n\treturn getInspectionState().configured;\n}\n/**\n* Gets the sink and filter identifiers that the process-global configuration\n* attached to the given logger.\n* @param logger The logger to look up.\n* @returns The identifiers, or `undefined` if the logger is not configured.\n*/\nfunction getConfiguredLoggerIds(logger) {\n\tconst configured = getInspectionState().loggers.get(logger);\n\tif (configured == null) return void 0;\n\treturn {\n\t\tsinkIds: isSameList(logger.sinks, configured.sinks) ? configured.sinkIds : void 0,\n\t\tfilterIds: isSameList(logger.filters, configured.filters) ? configured.filterIds : void 0\n\t};\n}\nfunction isSameList(a, b) {\n\tif (a.length !== b.length) return false;\n\tfor (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n\treturn true;\n}\n/**\n* Dispose of the disposables.\n*/\nasync function dispose() {\n\tawait runGlobalConfigMutation(\"dispose()\", disposeInternal);\n}\nasync function disposeInternal() {\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* Waits for the pending output of every {@link Drainable} sink in the active\n* configuration without disposing of the sinks, so that they keep accepting\n* records afterwards. Sinks that are not drainable are skipped.\n*\n* The active configuration is the innermost scoped configuration when called\n* within a {@link withConfig} or {@link withConfigSync} callback, and\n* otherwise the configuration set by {@link configure} or\n* {@link configureSync}. A sink registered under multiple identifiers is\n* drained once. Each sink's {@link Drainable.drain} method is called before\n* this function returns, so records logged after this call are not waited\n* for.\n*\n* Unlike `FingersCrossedSink.flush()`, draining does not release records\n* that a fingers crossed sink buffers until a trigger.\n*\n* @example Wait for logs after responding in Cloudflare Workers\n* ```typescript\n* export default {\n* async fetch(request, env, ctx) {\n* // ...\n* ctx.waitUntil(drain());\n* return new Response(\"...\");\n* },\n* };\n* ```\n*\n* @returns A promise that resolves when every drained sink has settled its\n* pending output. If a sink fails to drain, the promise rejects with\n* its error after the other sinks have settled, or with an\n* {@link AggregateError} if multiple sinks fail. It also rejects with\n* a {@link ConfigError} if LogTape is being reconfigured.\n* @since 2.4.0\n*/\nfunction drain() {\n\tif (globalConfigMutationInProgress) return Promise.reject(new ConfigError(\"drain() cannot be called while LogTape is being reconfigured.\"));\n\tconst scopedConfig = getCurrentScopedConfig(LoggerImpl.getLogger().contextLocalStorage);\n\tconst sinks = [...scopedConfig?.sinks ?? installedSinks];\n\tconst promises = [];\n\tfor (const sink of sinks) try {\n\t\tconst method = sink.drain;\n\t\tif (typeof method !== \"function\") continue;\n\t\tpromises.push(Promise.resolve(method.call(sink)));\n\t} catch (error) {\n\t\tpromises.push(Promise.reject(error));\n\t}\n\treturn settleDrainPromises(promises);\n}\nasync function settleDrainPromises(promises) {\n\tconst results = await Promise.allSettled(promises);\n\tconst errors = results.filter((result) => result.status === \"rejected\").map((result) => result.reason);\n\tif (errors.length < 1) return;\n\tif (errors.length === 1) throw errors[0];\n\tthrow new AggregateError(errors, \"Multiple errors occurred while draining LogTape sinks.\");\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\trunGlobalConfigMutationSync(\"disposeSync()\", disposeSyncInternal);\n}\nfunction disposeSyncInternal() {\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 getConfiguredContextLocalStorage(functionName) {\n\tif (globalConfigMutationInProgress) throw new ConfigError(`${functionName} cannot be called while LogTape is being reconfigured.`);\n\tif (currentConfig == null) throw new ConfigError(`${functionName} requires LogTape to be configured first.`);\n\tconst contextLocalStorage = LoggerImpl.getLogger().contextLocalStorage;\n\tif (contextLocalStorage == null) throw new ConfigError(`${functionName} requires Config.contextLocalStorage to be configured.`);\n\treturn contextLocalStorage;\n}\nasync function runGlobalConfigMutation(functionName, callback) {\n\tassertCanMutateGlobalConfig(functionName);\n\tglobalConfigMutationInProgress = true;\n\ttry {\n\t\treturn await callback();\n\t} finally {\n\t\tglobalConfigMutationInProgress = false;\n\t}\n}\nfunction runGlobalConfigMutationSync(functionName, callback) {\n\tassertCanMutateGlobalConfig(functionName);\n\tglobalConfigMutationInProgress = true;\n\ttry {\n\t\treturn callback();\n\t} finally {\n\t\tglobalConfigMutationInProgress = false;\n\t}\n}\nfunction assertCanMutateGlobalConfig(functionName) {\n\tif (globalConfigMutationInProgress) throw new ConfigError(`${functionName} cannot be called while LogTape is being reconfigured.`);\n\tassertNoScopedConfig(functionName);\n}\nfunction assertNoScopedConfig(functionName) {\n\tif (activeScopedConfigCount > 0) throw new ConfigError(`${functionName} cannot be called while a scoped configuration is active. Use nested withConfig() instead.`);\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[disposeSymbol]();\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[asyncDisposeSymbol]()));\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, drain, getConfig, getConfiguredLoggerIds, isConfigured, reset, resetSync, withConfig, withConfigSync };\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 the pretty renderer 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 & host-config coexistence\n *\n * Safe to call repeatedly: over baerly's own config (or none) we\n * reconfigure with `reset: true` so the last call wins. But baerly is\n * a library — an embedding app may own LogTape. To avoid clobbering a\n * host config, we skip (with one meta-logger notice) when {@link\n * getConfig} shows a config we didn't install. Embedders opt out fully\n * via the adapter's `observability: false`.\n */\n\nimport {\n configure,\n getConfig,\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 /** Write-tick maintenance events, routed via `MaintenanceDispatch.warn`. */\n maintenance: [\"baerly\", \"maintenance\"],\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 the pretty renderer off the runtime\n * closure.\n *\n * Default: `\"console-json\"`.\n */\n readonly sink?: \"console-json\" | Sink;\n}\n\n/**\n * Sink id baerly registers under. Doubles as our config-ownership\n * marker: a LogTape config carrying a sink under this key is one we\n * installed, so re-running {@link configureObservability} may safely\n * reset it. A config *without* this key belongs to the host app and\n * we must not clobber it.\n *\n * Deliberately namespaced rather than a bare `\"baerly\"`: this key\n * gates a destructive `reset`, so a host must never be able to trip it\n * by coincidentally naming one of its own sinks the same thing. The id\n * is internal (never surfaced on the wire) and depends only on\n * LogTape's documented `Config.sinks` shape.\n */\nconst BAERLY_SINK_ID = \"@gusto/baerly-storage\";\n\n/**\n * Wire LogTape's global config.\n *\n * Idempotent over baerly's own config — call as many times as you\n * like and the last call wins. The adapter boot path calls it once at\n * init; tests call it once per `beforeEach`. When LogTape is already\n * configured by the host application (see the module doc), this is a\n * no-op apart from a one-line meta-logger notice.\n */\nexport const configureObservability = async (config: ObservabilityConfig = {}): Promise<void> => {\n const existing = getConfig();\n if (existing !== null && !isBaerlyOwnedConfig(existing)) {\n // Host app already configured LogTape — libraries must not reset\n // another app's config. Leave it; baerly's categories fall through\n // to the host's routing.\n logtapeGetLogger([\"logtape\", \"meta\"]).warn(\n \"LogTape already configured by the host; baerly left it intact. Add a \" +\n '[\"baerly\"] logger to route baerly logs, or pass observability:false.',\n );\n return;\n }\n\n const level = resolveLevel(config.level);\n const sink = resolveSink(config.sink);\n\n await configure({\n reset: true,\n sinks: { [BAERLY_SINK_ID]: sink },\n loggers: [\n // Bind every `baerly.*` category to our sink at the chosen level.\n { category: \"baerly\", sinks: [BAERLY_SINK_ID], 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: [BAERLY_SINK_ID], lowestLevel: \"error\" },\n ],\n });\n};\n\n/**\n * Is this LogTape config one baerly installed? Detected by the marker\n * sink id — see {@link BAERLY_SINK_ID}.\n */\nconst isBaerlyOwnedConfig = (cfg: ReturnType<typeof getConfig> & object): boolean =>\n Object.prototype.hasOwnProperty.call(cfg.sinks, BAERLY_SINK_ID);\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/**\n * LogTape-backed `MaintenanceDispatch.warn` sink: routes a write-tick\n * maintenance event (e.g. `fold_deferred`) to {@link CATEGORY.maintenance}\n * at `warning`. Adapters wire it; the kernel calls it through the\n * observability context so LogTape stays out of the kernel bundle.\n */\nexport const logMaintenanceWarning = (\n event: string,\n properties: Readonly<Record<string, unknown>>,\n): void => {\n getLogger(CATEGORY.maintenance).warn(event, { ...properties });\n};\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 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 * 0. `error.code` is `CapacityExceeded` (409) or `MaintenancePending`\n * (503) → `\"refused\"`: the capacity check refused the write before\n * any commit. Neither is a server fault nor a write conflict, so\n * they stay out of the `\"error\"` and `\"conflict\"` rates.\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\" | \"refused\" | \"error\";\n\n/**\n * Whether `error` is a capacity refusal (`CapacityExceeded` or\n * `MaintenancePending`): the write was refused before any commit because\n * the collection is at its host's fold ceiling. Read by the canonical\n * line's level, which logs these at `warn` even on a 503.\n */\nexport const isCapacityRefusal = (error: unknown): boolean => {\n const code = (error as { code?: unknown } | null | undefined)?.code;\n return code === \"CapacityExceeded\" || code === \"MaintenancePending\";\n};\n\nexport const deriveOutcome = (method: string, status: number, error?: unknown): Outcome => {\n if (isCapacityRefusal(error)) {\n return \"refused\";\n }\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","import { MAX_REQUEST_ID_LENGTH } from \"@baerly/protocol\";\n\n/**\n * Characters an inbound request id may use: letters, digits, and the\n * punctuation found in common id formats (UUID, ULID, W3C `traceparent`,\n * X-Ray `Root=1-…`, base64). No whitespace, quotes, or control\n * characters, so a caller cannot forge log structure through it.\n */\nconst REQUEST_ID_PATTERN = /^[\\w.:/+=@-]+$/;\n\n/**\n * The request id for a unit of work: the caller's `x-request-id` when it\n * is at most {@link MAX_REQUEST_ID_LENGTH} characters of\n * {@link REQUEST_ID_PATTERN}, otherwise a fresh UUID. An invalid header\n * is replaced, not truncated, so a log line never carries part of a\n * forged value.\n */\nexport const requestIdFrom = (headers: Headers): string => {\n const supplied = headers.get(\"x-request-id\");\n return supplied !== null &&\n supplied.length <= MAX_REQUEST_ID_LENGTH &&\n REQUEST_ID_PATTERN.test(supplied)\n ? supplied\n : crypto.randomUUID();\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 (wire status is authoritative):\n *\n * - `status >= 500` → `error`\n * - `status >= 400` → `warn` (client error — a 4xx is the caller's\n * fault, not a server fault; an attached structured error, including\n * a 409 WriteConflict, does NOT escalate it)\n * - `status` 2xx/3xx with an attached `error` → `error` (anomalous)\n * - no `status`, `error` present → `error`\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, isCapacityRefusal } from \"./derive-outcome.ts\";\nimport { requestIdFrom } from \"./request-id.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\"` / `\"refused\"` / `\"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 a valid `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 = requestIdFrom(req.headers);\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 // Wire status is authoritative when present. A client error (4xx) is a\n // `warn` even when a structured error is attached (as\n // `withHttpObservability` reconstructs one for every non-2xx). This is\n // deliberate: a 4xx is the caller's fault, not a server fault. The\n // common 409 is `AlreadyExists` (a reused id or a double-submitted POST);\n // `WriteConflict` (an unresolved lost precondition) and `AmbiguousCommit` also map to\n // 409, while ordinary contention is absorbed internally. 401/404/400 are\n // likewise the caller's fault. Escalating any of them to `error` would\n // burn error budget and page on-call for normal operation. `error` is\n // reserved for genuine server faults. A capacity refusal is `warn` on\n // either status: `MaintenancePending` is a 503 only so HTTP clients\n // honour `Retry-After`, and nothing failed.\n if (isCapacityRefusal(opts.error)) {\n return \"warn\";\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 // A 2xx/3xx that still carries an error is anomalous (a throw that\n // resolved a success status) — surface it.\n return opts.error !== undefined ? \"error\" : \"info\";\n }\n // No wire status to classify by (e.g. an escaped throw before a\n // Response existed): an attached error is all we have to go on.\n return opts.error !== undefined ? \"error\" : \"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 Storage,\n type StorageGetOptions,\n type StorageGetResult,\n type StorageListEntry,\n type StoragePutOptions,\n type StoragePutResult,\n} from \"@baerly/protocol\";\nimport { ctxMetrics } 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 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\nconst recordError = (op: Op): void => {\n ctxMetrics().counter(`db.storage.${op}.errors_total`, 1);\n};\n\nconst recordDuration = (op: Op, durationMs: number): void => {\n ctxMetrics().histogram(`db.storage.${op}.duration_ms`, durationMs);\n};\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 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","/**\n * Observability — per-HTTP-request context, metrics recorder,\n * canonical-line emission, and the logtape configuration entry point.\n *\n * Consumed by the HTTP router (`http/router.ts`) and both adapters\n * (`@baerly/adapter-cloudflare`, `@baerly/adapter-node`). The\n * high-level flow:\n *\n * 1. The adapter calls {@link configureObservability} once at boot.\n * 2. Each HTTP request creates an {@link ObservabilityContext} (via\n * {@link createObservabilityContext} or `withHttpObservability`\n * for standalone callers that don't have an adapter-managed\n * scope) and runs the work under {@link runWithContext}.\n * 3. The adapter calls {@link flushCanonicalLine} at end-of-request;\n * verifier-rejected requests call `flushUnauthorizedAndRespond`\n * (adapter wiring on `@baerly/server/_internal/observability`).\n * 4. Kernel emissions (Writer histograms, compactor / GC gauges,\n * storage decorator counters) reach the per-request recorder via\n * the ALS lookup inside emission sites\n * (`getCurrentContext()?.recorder`). Background runs outside any\n * HTTP scope emit to the no-op default — by design.\n *\n * The `@baerly/server` package re-exports its own `errorEnvelope`\n * separately; this barrel is the observability seam only.\n */\n\nimport {\n type ObservabilityContext,\n type ObservabilityContextInit,\n createObservabilityContext as createContext,\n getCurrentContext as currentContext,\n} from \"./context.ts\";\n\nexport {\n type ObservabilityContext,\n type ObservabilityContextInit,\n runWithContext,\n} from \"./context.ts\";\n\n/**\n * Build a per-unit-of-work {@link ObservabilityContext}. Pass it to\n * {@link runWithContext}; every kernel emission inside reaches its\n * recorder.\n */\nexport const createObservabilityContext: (init?: ObservabilityContextInit) => ObservabilityContext =\n createContext;\n\n/** Returns the currently-active context, or `undefined` outside one. */\nexport const getCurrentContext: () => ObservabilityContext | undefined = currentContext;\nexport {\n type CategoryName,\n type FriendlyLogLevel,\n type ObservabilityConfig,\n CATEGORY,\n configureObservability,\n getLogger,\n} from \"./logger.ts\";\nexport {\n type FlushCanonicalLineOptions,\n flushCanonicalLine,\n withHttpObservability,\n} from \"./canonical.ts\";\nexport { observableStorage } from \"./storage.ts\";\nexport { type Outcome, deriveOutcome } from \"./derive-outcome.ts\";\n// Re-exported so consumers can type `MetricsRecorder`-shaped values\n// (the kernel emission contract) without reaching into the\n// unpublished `@baerly/protocol` workspace package.\nexport type { MetricsRecorder } from \"@baerly/protocol\";\n// Re-exported so a consumer writing a custom `observability.sink` can\n// type it as `Sink` without adding a direct dependency on the\n// transitive `@logtape/logtape` package (which pnpm's strict\n// node_modules would not resolve from a scaffolded app).\nexport type { Sink, LogRecord } from \"@logtape/logtape\";\n"],"ignoreList":[1,2,3,4,5,6,7,8,9,10,11,12,13],"mappings":";;;;;;;;;;;;;;;;;AAsEA,MAAa,iBACX,MACA,SACA,YACsB;CACtB,MAAM,EAAE,QAAQ,YAAY,KAAK,eAAe,WAAW,CAAC;CAC5D,MAAM,WAAW,cAAc,iBAAiB;CAChD,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