{"version":3,"file":"wire-D7Nv6hx_-DFtD7Smg.cjs","names":["err_nice","err","v","createTypedStorage","encryptBytesWithAesGcmKey","decryptBytesWithAesGcmKey","KEEPALIVE_PING","KEEPALIVE_PONG","ClientCryptoKeyLink","bytesToBase64","base64ToBytes","encryptBytesWithAesGcmKey","decryptBytesWithAesGcmKey"],"sources":["../../connect-core/build/ReliableLog-DudDQ2zp.mjs","../../connect-core/build/wire-D7Nv6hx_.mjs"],"sourcesContent":["import { m as err, p as err_nice } from \"./error-BFAEkmpX.mjs\";\nimport { Ct as encryptBytesWithAesGcmKey, Tt as decryptBytesWithAesGcmKey, st as createTypedStorage } from \"./util-DiEla9R9.mjs\";\nimport * as v from \"valibot\";\nimport { nanoid } from \"nanoid\";\nimport { pack, unpack } from \"msgpackr\";\n//#region src/wire/Connect/err_wire_connect.ts\n/**\n* The Connect layer's error domain. Declared with the types\n* so Phases 2–6 throw against a fixed vocabulary instead of inventing ad-hoc `Error`s per phase;\n* each id notes the phase that starts raising it. (`protocol_unsupported` is the link-level\n* error `nice-realm`'s `err_realm` doc already points at as living here.)\n*/\nconst err_wire_connect = err_nice.createChildDomain({\n\tdomain: \"err_nice_wire_connect\",\n\tschema: {\n\t\t/** Phase 2 — `connect()` rejects: every transport in the preference chain failed. */\n\t\tconnect_exhausted: err({ message: ({ peerId, attempted }) => `connect() to peer [${peerId}] exhausted its transport chain (tried: ${attempted.join(\", \") || \"none configured\"}).` }),\n\t\t/** Phase 2 — `connect()` after `close()`; a closed client is terminal, build a new one. */\n\t\tconnect_closed: err({ message: ({ peerId }) => `connect() to peer [${peerId}] on a closed WireClient — closed is terminal; create a new client.` }),\n\t\t/**\n\t\t* Phase 2 — one transport's dial or handshake failed (the chain item detail inside\n\t\t* `connect_exhausted`). `endpoint`/`kind` are the feedback W2/W3 additions: the URL actually\n\t\t* dialed, and the typed class of failure (see `EWireConnectFailureKind`).\n\t\t*/\n\t\tdial_failed: err({ message: ({ peerId, carrierLabel, reason, endpoint }) => `Dialing peer [${peerId}] over \"${carrierLabel}\"${endpoint != null ? ` against ${endpoint}` : \"\"} failed: ${reason}` }),\n\t\t/**\n\t\t* the resilience contract — the carrier has **no valid endpoint right now** (`createRequest`\n\t\t* returned `null`, e.g. a torn-down session's mutable dial context). Not a failure: a policy\n\t\t* signal. The transport selection rethrows it unwrapped, and a keep-alive redial loop PARKS on\n\t\t* it — no dialing garbage, no backoff churn — until the next explicit `connect()`/dispatch.\n\t\t*/\n\t\tdial_unavailable: err({ message: ({ carrierLabel }) => `Dial over \"${carrierLabel}\" unavailable — createRequest returned null (no valid endpoint right now). A keep-alive redial parks on this until the next explicit connect()/dispatch.` }),\n\t\tconflicting_connect_options: err({ message: ({ detail }) => `Conflicting connection options: ${detail}` }),\n\t\t/**\n\t\t* Consumer feedback (meteor-connect-bridge W1/W3) — **something answered, and it is not\n\t\t* nice-wire**. The dominant real-world causes are a wrong URL/port, an intercepting proxy or\n\t\t* WAF, or an endpoint that is simply a different server. Thrown where the evidence still\n\t\t* exists (the carrier holds the HTTP status; the handshake holds the frame), so the data\n\t\t* carries what came back instead of only what we wanted. Branch on it with\n\t\t* `err.hasId(\"endpoint_answered_non_protocol\")` — never on the message text.\n\t\t*/\n\t\tendpoint_answered_non_protocol: err({ message: ({ stage, expected, url, httpStatus, contentType, receivedKind, bodyPreview }) => {\n\t\t\tconst received = httpStatus != null ? `an HTTP ${httpStatus}${contentType != null ? ` ${contentType}` : \"\"} response` : receivedKind != null ? `a \"${receivedKind}\" frame` : \"a response it could not decode\";\n\t\t\tconst diagnosis = httpStatus != null && httpStatus >= 500 ? \"the server answered with an error instead of a nice-wire frame (check the server's logs: a crashed handler or an unavailable upstream answers this way)\" : \"the endpoint answered but is not speaking the nice-wire protocol (wrong URL, an intercepting proxy/WAF, or a different server)\";\n\t\t\treturn `[${stage}] expected ${expected ?? \"a nice-wire frame\"} but received ${received} — ` + diagnosis + `${url != null ? `. Dialed: ${url}` : \"\"}${bodyPreview != null ? `. Body: ${JSON.stringify(bodyPreview)}` : \"\"}.`;\n\t\t} }),\n\t\t/**\n\t\t* **No response was received**: DNS/refused/TLS/offline, a socket that errored before it\n\t\t* opened, or a response the platform hid from the caller (a CORS-blocked answer, a refused\n\t\t* WebSocket upgrade, an injected fetch/socket that threw). The sibling of\n\t\t* `endpoint_answered_non_protocol`, which carries the response it did see.\n\t\t*/\n\t\tendpoint_unreachable: err({ message: ({ url, carrierLabel, reason }) => `Could not reach ${url ?? (carrierLabel != null ? `the \"${carrierLabel}\" endpoint` : \"the endpoint\")}: ${reason} — no response was received (a network, DNS or TLS failure; a response the browser blocked or hid, such as a CORS rejection or a refused WebSocket upgrade; or the fetch/socket implementation threw).` }),\n\t\t/**\n\t\t* The peer **is** a nice-code backend and refused the handshake for a reason that carries no\n\t\t* machine-readable id of its own (an older peer, a dictionary/security mismatch, a custom\n\t\t* gate). Typed so `classifyConnectFailure` can report `handshake_rejected` — a third\n\t\t* developer response (\"fix the identity/version\"), distinct from a wrong URL or a dead host.\n\t\t* `identity_pin_mismatch` stays its own id: it is permanent and the redial loop parks on it.\n\t\t*/\n\t\thandshake_rejected: err({ message: ({ stage, reason }) => `[${stage}] rejected by peer: ${reason}` }),\n\t\t/**\n\t\t* The peer explicitly reported that the secure handshake has no compatible first-party wire\n\t\t* generation. This is terminal for the current builds: transport fallback and automatic\n\t\t* redial park until the application explicitly retries after an upgrade or rollback.\n\t\t*/\n\t\tprotocol_version_mismatch: err({ message: ({ reason, observedProtocolVersion, localSupportedProtocolVersions, remoteSupportedProtocolVersions }) => `Handshake protocol version mismatch: ${reason}. Local support: [${localSupportedProtocolVersions.join(\", \")}]${remoteSupportedProtocolVersions != null ? `; remote support: [${remoteSupportedProtocolVersions.join(\", \")}]` : \"\"}${observedProtocolVersion != null ? `; observed version: ${observedProtocolVersion}` : \"\"}. Carrier fallback and automatic redial are parked until an explicit retry.` }),\n\t\t/**\n\t\t* A secure endpoint answered as nice-wire but advertised a different runtime identity from the\n\t\t* one the caller selected. This is terminal for the current endpoint selection, so fallback and\n\t\t* automatic redial park until an explicit retry after the route or expectation changes.\n\t\t*/\n\t\tpeer_identity_mismatch: err({ message: ({ expected, actual, endpoint }) => `Secure peer identity mismatch: expected envId=${JSON.stringify(expected.envId)}${expected.perId != null ? `, perId=${JSON.stringify(expected.perId)}` : \"\"}; received envId=${JSON.stringify(actual.envId)}${actual.perId != null ? `, perId=${JSON.stringify(actual.perId)}` : \"\"}. ${endpoint != null ? `Dialed ${endpoint}. ` : \"\"}Carrier fallback and automatic redial are parked until an explicit retry.` }),\n\t\t/** Phase 3 — a protocol sent on a connection whose peer did not advertise it (or the host never registered it). */\n\t\tprotocol_unsupported: err({ message: ({ protocolId }) => `Protocol \"${protocolId}\" cannot speak on this connection — the peer did not advertise \"proto:${protocolId}\" (or it is not registered here).` }),\n\t\t/** Phase 6 — a prefixed protocol registered on an exchange-only connection (protocols need duplex; the protocol contract). */\n\t\tprotocol_on_exchange_only: err({ message: ({ protocolId }) => `Protocol \"${protocolId}\" needs a duplex transport — this connection is exchange-only (request/reply), which carries only the lane.` }),\n\t\t/** Phase 4 — the acceptor security gate: protocol frame on a non-authenticated connection without `allowPlain`. */\n\t\tprotocol_security_blocked: err({ message: ({ protocolId, securityLevel }) => `Protocol \"${protocolId}\" frame blocked: connection is at security level \"${securityLevel}\" and the protocol did not opt into allowPlain.` }),\n\t\t/** Phase 4 — rehydrate saw a binding with an unknown schema version: treat the socket as fresh. */\n\t\tbinding_version_mismatch: err({ message: ({ found, expected }) => `Persisted connection binding has schema version ${JSON.stringify(found)} (this build reads v${expected}) — the binding is invalidated; the connection must re-handshake.` }),\n\t\t/**\n\t\t* Inteleport feedback §3 — the peer rejected the handshake because this client's verify key does\n\t\t* not match the one pinned for its identity (trust-on-first-use, keyed `envId::perId`). Permanent\n\t\t* for this identity+key pair: retrying can never succeed, so the keep-alive redial loop PARKS on\n\t\t* it (like `dial_unavailable`) instead of backing off forever. Note clearing the client's *crypto*\n\t\t* storage alone does NOT recover — a fresh key under the SAME persistent id is exactly what the\n\t\t* pin rejects. Recover by connecting under a new persistent id (and a fresh identity), or by\n\t\t* removing the peer-side pin via the verify-key resolver's storage. Branch on it with\n\t\t* `err.hasId(\"identity_pin_mismatch\")`.\n\t\t*/\n\t\tidentity_pin_mismatch: err({ message: ({ reason }) => `Handshake rejected by peer: ${reason}. The peer has a different verify key pinned for this client identity (TOFU) — permanent until the client connects under a new persistent id or the peer's pin is removed; auto-redial parks on this.` })\n\t}\n});\n//#endregion\n//#region src/wire/protocolVersion.ts\n/**\n* The first-party nice-code wire/action/realm format generation implemented by this build.\n*\n* Package releases may change without changing this number. A generation belongs in\n* {@link WIRE_SUPPORTED_PROTOCOL_VERSIONS} only while this build contains the complete encoder,\n* decoder, session, and persistence compatibility needed to speak it.\n*/\nconst WIRE_PROTOCOL_VERSION = 1;\n/**\n* Protocol generations this build can actually speak, newest first. This release has one codec,\n* so it advertises only v1; the intended future window is the current and previous generation.\n*/\nconst WIRE_SUPPORTED_PROTOCOL_VERSIONS = [1];\n//#endregion\n//#region src/wire/nice_wire.static.ts\nconst DEFAULT_TRANSPORT_TIMEOUT = 1e4;\nconst UNSET_RUNTIME_ENV_ID = \"_unset_\";\nconst UNSET_RUNTIME_PER_ID = \"_0_0_\";\n//#endregion\n//#region src/wire/utils/runtimeCoordinateToStringIds.ts\nfunction runtimeCoordinateToStringIds(coordinate) {\n\treturn [\n\t\t`envId[${coordinate.envId}]perId[${coordinate.perId ?? \"_\"}]:insId[${coordinate.insId ?? \"_\"}]`,\n\t\t`envId[${coordinate.envId}]perId[${coordinate.perId ?? \"_\"}]:insId[_]`,\n\t\t`envId[${coordinate.envId}]perId[_]:insId[_]`\n\t];\n}\n//#endregion\n//#region src/wire/RuntimeCoordinate.ts\nvar RuntimeCoordinate = class RuntimeCoordinate {\n\tenvId;\n\tperId;\n\tinsId;\n\t/** Readable alias for {@link perId}; the serialized own field remains `perId`. */\n\tget persistentId() {\n\t\treturn this.perId;\n\t}\n\t/** Readable alias for {@link insId}; the serialized own field remains `insId`. */\n\tget instanceId() {\n\t\treturn this.insId;\n\t}\n\tstatic get unknown() {\n\t\treturn new RuntimeCoordinate({ envId: UNSET_RUNTIME_ENV_ID });\n\t}\n\tstatic env(envId) {\n\t\treturn new RuntimeCoordinate({ envId });\n\t}\n\t/**\n\t* Env + persistent id — but not *merely* a routing name: on a secure connection this id\n\t* keys the server's trust-on-first-use verify-key pin (see {@link IRuntimeCoordinateSpecifics.perId}).\n\t* Pair it only with a crypto-identity `storage` that persists at least as long as the id itself,\n\t* or every reload presents a new key for a pinned id and is rejected (`identity_pin_mismatch`).\n\t*/\n\twithPersistentId(perId) {\n\t\treturn this.specify({ perId });\n\t}\n\t/**\n\t* Derive a **per-connection** identity: same env and persistent id, with `connectionId` folded into\n\t* the per-boot `insId`. For a runtime that opens *several duplex links to the same peer* — a store\n\t* socket and a jobs socket on one backend — where one identity for both is a silent misroute: an\n\t* acceptor binds a connection by the full coordinate string, so two links presenting the same one\n\t* are indistinguishable and the peer's return path picks whichever bound first.\n\t*\n\t* Folding rather than replacing is the point: the runtime's `insId` stays the per-boot epoch\n\t* reliable delivery needs (see {@link IRuntimeCoordinateSpecifics.insId}), so a per-connection id may\n\t* safely be a *stable* label (`\"jobs\"`) — it discriminates connections without pinning the epoch.\n\t* Reached from `connectChannel`'s `connectionId` option; rarely called directly.\n\t*/\n\twithConnectionId(connectionId) {\n\t\tif (connectionId.length === 0 || /[[\\]:~]/.test(connectionId)) throw new Error(`RuntimeCoordinate.withConnectionId: \"${connectionId}\" is not a usable connection id — it must be non-empty and free of \\`[\\`, \\`]\\`, \\`:\\` and \\`~\\` (the coordinate's own string-form separators).`);\n\t\treturn this.specify({ insId: `${this.insId ?? \"_\"}~${connectionId}` });\n\t}\n\tconstructor({ envId, perId, insId }) {\n\t\tthis.envId = envId;\n\t\tthis.perId = perId;\n\t\tthis.insId = insId;\n\t}\n\tspecify(specifics) {\n\t\treturn new RuntimeCoordinate({\n\t\t\tenvId: this.envId,\n\t\t\tperId: this.perId,\n\t\t\tinsId: this.insId,\n\t\t\t...specifics\n\t\t});\n\t}\n\tspecifyIfUnset(specifics) {\n\t\treturn new RuntimeCoordinate({\n\t\t\tenvId: this.envId,\n\t\t\tperId: this.perId ?? specifics.perId,\n\t\t\tinsId: this.insId ?? specifics.insId\n\t\t});\n\t}\n\ttoJsonObject() {\n\t\treturn {\n\t\t\tenvId: this.envId,\n\t\t\tperId: this.perId,\n\t\t\tinsId: this.insId\n\t\t};\n\t}\n\tisExactlySame(other) {\n\t\treturn this.envId === other.envId && this.perId === other.perId && this.insId === other.insId;\n\t}\n\tisSameFor(other) {\n\t\treturn {\n\t\t\tid: this.envId === other.envId,\n\t\t\tperId: this.envId === other.envId && this.perId === other.perId,\n\t\t\tinsId: this.envId === other.envId && this.perId === other.perId && this.insId === other.insId\n\t\t};\n\t}\n\tsimilarityLevel(other) {\n\t\tconst sameFor = this.isSameFor(other);\n\t\tif (sameFor.insId) return 3;\n\t\tif (sameFor.perId) return 2;\n\t\tif (sameFor.id) return 1;\n\t\treturn 0;\n\t}\n\tget stringId() {\n\t\treturn `envId[${this.envId}]perId[${this.perId ?? \"_\"}]:insId[${this.insId ?? \"_\"}]`;\n\t}\n\t/**\n\t* Takes the \"Runtime Coordinate\" and generates a list of full coordinate IDs representing the runtime\n\t* with decreasing levels of specificity.\n\t*\n\t* The first full coordinate ID is the most specific (including instance ID), while the last ID is\n\t* the least specific (only environment ID).\n\t*\n\t* Example output for a RuntimeCoordinate with envId \"web_app\", perId \"user123\", and insId \"instance456\":\n\t* [\n\t*   \"envId[web_app]perId[user123]:insId[instance456]\",\n\t*   \"envId[web_app]perId[user123]:insId[_]\",\n\t*   \"envId[web_app]perId[_]:insId[_]\"\n\t* ]\n\t*\n\t* @returns a list of \"full\" runtime coordinate IDs with decreasing accuracy for targeting a runtime.\n\t*/\n\ttoStringIds() {\n\t\treturn runtimeCoordinateToStringIds(this);\n\t}\n};\n//#endregion\n//#region src/wire/crypto/actionHandshake.ts\n/**\n* Authenticated handshake for the WebSocket channel. Run once per connection, before any action\n* frames flow, it:\n* - exchanges each side's {@link RuntimeCoordinate} + public keys,\n* - checks both ends share the same wire dictionary version (closes the positional-dictionary footgun),\n* - has the client prove control of its verify (Ed25519) key by signing a fresh challenge that binds\n*   both nonces, both identities, the dictionary version, the level, and every exchanged public key,\n* - establishes a `ClientCryptoKeyLink` link on both sides (so the server can verify the signature and,\n*   for the `encrypted` level, both can derive a shared AES-GCM key with the verify keys folded in).\n*\n* This module is transport-agnostic: it produces/consumes message objects. The transport + server\n* handler drive the I/O and the connection phase (Step 4). Keep `none`-level connections from ever\n* reaching here — they skip the handshake entirely.\n*/\nconst HANDSHAKE_PROTOCOL = `nice-ws-hs/1`;\nconst HANDSHAKE_PROTOCOL_PREFIX = \"nice-ws-hs/\";\n/**\n* Capability advertised by both peers in the handshake (`hello.caps` / `welcome.caps`) when they understand\n* the reliable-delivery wire (the 7-slot reliability frame). It lets a `.reliable()` sender detect a peer\n* that predates reliable support and warn + degrade to best-effort, instead of emitting frames the peer\n* can't interpret. Non-signed and optional, exactly like `channels` — an old peer simply omits it.\n*/\nconst CAP_RELIABLE = \"reliable\";\n/**\n* Capability (E3) advertised when a peer understands **keyed** reliable streams (the length-8 `streamKey`\n* frame + the `k` field on `rack`/`rsync` control frames). Lets a keyed `.reliable()` sender detect a peer\n* that predates per-key streams and warn (a keyed frame is a distinct length such a peer drops wholesale).\n* Non-signed and optional, layered on {@link CAP_RELIABLE}.\n*/\nconst CAP_RELIABLE_STREAMKEY = \"reliable-streamkey\";\n/** How much the channel protects after the handshake — chosen by the consumer (perf vs security). */\nlet ESecurityLevel = /* @__PURE__ */ function(ESecurityLevel) {\n\t/** No handshake; identity is self-asserted (fastest, dev / trusted networks). */\n\tESecurityLevel[\"none\"] = \"none\";\n\t/** Handshake authenticates identity (sign/verify + key pin); frames stay plaintext over TLS. */\n\tESecurityLevel[\"authenticated\"] = \"authenticated\";\n\t/** Authenticated handshake + every frame AES-GCM encrypted with the derived shared key. */\n\tESecurityLevel[\"encrypted\"] = \"encrypted\";\n\treturn ESecurityLevel;\n}({});\nlet EHandshakeMessageType = /* @__PURE__ */ function(EHandshakeMessageType) {\n\tEHandshakeMessageType[\"hello\"] = \"hello\";\n\tEHandshakeMessageType[\"welcome\"] = \"welcome\";\n\tEHandshakeMessageType[\"prove\"] = \"prove\";\n\tEHandshakeMessageType[\"accept\"] = \"accept\";\n\tEHandshakeMessageType[\"reject\"] = \"reject\";\n\treturn EHandshakeMessageType;\n}({});\nconst vEd25519Raw = v.custom((val) => typeof val === \"string\" && val.startsWith(\"ed25519::raw_base64::\"));\nconst vX25519Raw = v.custom((val) => typeof val === \"string\" && val.startsWith(\"x25519::raw_base64::\"));\nconst vCoordinate = v.object({\n\tenvId: v.string(),\n\tperId: v.optional(v.string()),\n\tinsId: v.optional(v.string())\n});\nconst vSecurityLevel = v.picklist([\n\t\"none\",\n\t\"authenticated\",\n\t\"encrypted\"\n]);\nconst vHsHello = v.object({\n\tt: v.literal(\"hello\"),\n\tprotocol: v.string(),\n\tsecurityLevel: vSecurityLevel,\n\tdictionaryVersion: v.string(),\n\tclient: vCoordinate,\n\tclientNonce: v.string(),\n\tverifyPublicKey: vEd25519Raw,\n\texchangePublicKey: v.optional(vX25519Raw),\n\t/**\n\t* The channel tags this connection carries (`channel.tags`). A multi-channel acceptor composes the\n\t* codec + dictionary version for exactly this subset; omitted by a plain single-channel client. Not part\n\t* of the signed challenge — tampering would compose a different `dictionaryVersion` and fail the check.\n\t*/\n\tchannels: v.optional(v.array(v.string())),\n\t/**\n\t* Optional capability tags this client understands (e.g. {@link CAP_RELIABLE}). Not part of the signed\n\t* challenge — purely a feature advertisement, so a peer that omits it is treated as not supporting them.\n\t*/\n\tcaps: v.optional(v.array(v.string()))\n});\nconst vHsWelcome = v.object({\n\tt: v.literal(\"welcome\"),\n\tsecurityLevel: vSecurityLevel,\n\tdictionaryVersion: v.string(),\n\tserver: vCoordinate,\n\tserverNonce: v.string(),\n\tverifyPublicKey: vEd25519Raw,\n\texchangePublicKey: v.optional(vX25519Raw),\n\t/** Optional capability tags this server understands (e.g. {@link CAP_RELIABLE}); see {@link vHsHello.caps}. */\n\tcaps: v.optional(v.array(v.string()))\n});\nconst vHsProve = v.object({\n\tt: v.literal(\"prove\"),\n\tsignatureBase64: v.string()\n});\nconst vHsAccept = v.object({\n\tt: v.literal(\"accept\"),\n\tsignatureBase64: v.optional(v.string())\n});\nconst vHsReject = v.object({\n\tt: v.literal(\"reject\"),\n\treason: v.string(),\n\t/**\n\t* Optional machine-readable reject id (e.g. {@link HANDSHAKE_REJECT_ID_PIN_MISMATCH}) so the\n\t* dialing side can *branch* on the cause instead of parsing the English `reason` (Inteleport\n\t* feedback §3). Additive + optional: an old peer neither sends nor reads it (unknown keys are\n\t* stripped on decode), so the frame stays wire-compatible in both directions.\n\t*/\n\tid: v.optional(v.string()),\n\t/** The unsupported generation observed by the rejecting peer, when the tag was well formed. */\n\tobservedProtocolVersion: v.optional(v.number()),\n\t/** The generations the rejecting peer can actually speak, newest first. */\n\tsupportedProtocolVersions: v.optional(v.array(v.number()))\n});\nconst vHandshakeMessage = v.variant(\"t\", [\n\tvHsHello,\n\tvHsWelcome,\n\tvHsProve,\n\tvHsAccept,\n\tvHsReject\n]);\n/** Serialize a handshake message for the wire (handshake frames are JSON — they aren't the hot path). */\nfunction encodeHandshakeMessage(message) {\n\treturn JSON.stringify(message);\n}\n/** Parse + structurally validate an incoming handshake frame; `undefined` if it isn't one. */\nfunction decodeHandshakeMessage(raw) {\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\treturn;\n\t}\n\tconst result = v.safeParse(vHandshakeMessage, parsed);\n\treturn result.success ? result.output : void 0;\n}\n/** Stable link id for a runtime coordinate — the key both the crypto link and the connection use. */\nfunction runtimeLinkId(coordinate) {\n\treturn `runtime::${new RuntimeCoordinate(coordinate).stringId}`;\n}\nfunction coordId(coordinate) {\n\treturn new RuntimeCoordinate(coordinate).stringId;\n}\nfunction sessionSalt(clientNonce, serverNonce) {\n\treturn `${clientNonce}::${serverNonce}`;\n}\nfunction handshakeInfo(dictionaryVersion) {\n\treturn `${HANDSHAKE_PROTOCOL}::${dictionaryVersion}`;\n}\n/**\n* The exact string both sides sign/verify. JSON-encoded ordered array so field boundaries are\n* unambiguous; binds identities, nonces (freshness), version, level, and all exchanged public keys\n* (authenticating the keys via the signature, complementing `bindVerifyKeysIntoDerivation`).\n*/\nfunction buildHandshakeChallenge(parts) {\n\treturn JSON.stringify([\n\t\tHANDSHAKE_PROTOCOL,\n\t\tparts.securityLevel,\n\t\tparts.dictionaryVersion,\n\t\tparts.clientCoordId,\n\t\tparts.serverCoordId,\n\t\tparts.clientNonce,\n\t\tparts.serverNonce,\n\t\tparts.clientVerifyKey,\n\t\tparts.serverVerifyKey,\n\t\tparts.clientExchangeKey ?? \"_\",\n\t\tparts.serverExchangeKey ?? \"_\"\n\t]);\n}\nfunction reject(reason, id) {\n\treturn {\n\t\tt: \"reject\",\n\t\treason,\n\t\tid\n\t};\n}\n/**\n* The machine-readable reject id an untrusted verify key produces: the presented key differs from\n* the one pinned for this client identity (trust-on-first-use). Carried on the reject frame's `id`\n* and surfaced to the dialing side as `err_wire_connect` id `identity_pin_mismatch`, so an app can\n* branch on it (`err.hasId(\"identity_pin_mismatch\")`) — the obvious recovery being \"this identity\n* is unusable with this key: clear the client's identity storage / mint a new persistent id\".\n*/\nconst HANDSHAKE_REJECT_ID_PIN_MISMATCH = \"identity_pin_mismatch\";\n/** Machine-readable rejection for peers with no common first-party wire generation. */\nconst HANDSHAKE_REJECT_ID_PROTOCOL_VERSION_MISMATCH = \"protocol_version_mismatch\";\nfunction handshakeProtocolVersion(protocol) {\n\tif (!protocol.startsWith(HANDSHAKE_PROTOCOL_PREFIX)) return void 0;\n\tconst raw = protocol.slice(11);\n\tif (!/^(0|[1-9]\\d*)$/.test(raw)) return void 0;\n\tconst parsed = Number(raw);\n\treturn Number.isSafeInteger(parsed) ? parsed : void 0;\n}\nfunction tofuPinKey(client) {\n\treturn `${client.envId}::${client.perId ?? client.insId ?? \"_\"}`;\n}\n/**\n* In-memory trust-on-first-use resolver: trusts (and pins) the first verify key seen for a client\n* identity, then rejects a different key for that identity. The default; replace with a storage-backed\n* resolver for cross-restart pinning (see Step 5).\n*/\nfunction createInMemoryTofuVerifyKeyResolver() {\n\tconst pinned = /* @__PURE__ */ new Map();\n\treturn { async resolve({ client, verifyPublicKey }) {\n\t\tconst key = tofuPinKey(client);\n\t\tconst existing = pinned.get(key);\n\t\tif (existing == null) {\n\t\t\tpinned.set(key, verifyPublicKey);\n\t\t\treturn { trusted: true };\n\t\t}\n\t\tif (existing === verifyPublicKey) return { trusted: true };\n\t\treturn {\n\t\t\ttrusted: false,\n\t\t\treason: \"verify key changed for client identity (pin mismatch)\",\n\t\t\trejectId: HANDSHAKE_REJECT_ID_PIN_MISMATCH\n\t\t};\n\t} };\n}\nconst tofuPinStorageKey = async (identity) => {\n\treturn `pin:${[...new Uint8Array(await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(`nice-wire-tofu-v1:${identity}`)))].map((byte) => byte.toString(16).padStart(2, \"0\")).join(\"\")}`;\n};\nconst pinMismatch = () => ({\n\ttrusted: false,\n\treason: \"verify key changed for client identity (pin mismatch)\",\n\trejectId: HANDSHAKE_REJECT_ID_PIN_MISMATCH\n});\n/**\n* Storage-backed trust-on-first-use resolver: pins survive process restarts / Durable Object eviction\n* (e.g. back it with `createDurableObjectStorageAdapter`). Same policy as the in-memory variant — trust\n* + pin the first verify key per client identity, reject a different one thereafter.\n*\n* Fail-closed by construction: a thrown storage read (`getJson`) or first-pin write (`updateJsonWithDef`)\n* propagates out of `resolve`, which makes `onProve` reject the handshake — a storage error can never be\n* mistaken for \"first use\" and silently trusted. (A genuine `undefined`/absent read is the only path to\n* a fresh pin; the underlying adapters never coerce a thrown read to `undefined`.) Keep it that way: do\n* not wrap the storage calls in a `try/catch` that swallows the error.\n*\n* On an *eventually-consistent* store a stale \"absent\" read re-pins the **same** verify key the client\n* just presented (it is signature-verified before this runs), so the worst case is a harmless re-write,\n* never a weakened trust decision. Cross-isolate-strong pinning still wants a strongly-consistent store.\n*\n* Switching an existing host from `document` to `per_identity` is safe: on each identity's next\n* contact the legacy pin is honored and migrated to its per-identity record. The reverse switch is\n* NOT migrated — pins recorded per-identity are invisible to the `document` layout.\n*/\nfunction createStorageTofuVerifyKeyResolver(storageAdapter, options = {}) {\n\tif (options.layout === \"per_identity\") {\n\t\tconst identityLocks = /* @__PURE__ */ new Map();\n\t\treturn { async resolve({ client, verifyPublicKey }) {\n\t\t\tconst identity = tofuPinKey(client);\n\t\t\tconst storageKey = await tofuPinStorageKey(identity);\n\t\t\tconst operation = (identityLocks.get(storageKey) ?? Promise.resolve()).catch(() => void 0).then(async () => {\n\t\t\t\tconst existing = await storageAdapter.getJson(storageKey);\n\t\t\t\tif (existing == null) {\n\t\t\t\t\tconst legacy = (await storageAdapter.getJson(\"pins\"))?.[identity];\n\t\t\t\t\tif (legacy != null) {\n\t\t\t\t\t\tawait storageAdapter.setJson(storageKey, {\n\t\t\t\t\t\t\tidentity,\n\t\t\t\t\t\t\tverifyPublicKey: legacy\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn legacy === verifyPublicKey ? { trusted: true } : pinMismatch();\n\t\t\t\t\t}\n\t\t\t\t\tawait storageAdapter.setJson(storageKey, {\n\t\t\t\t\t\tidentity,\n\t\t\t\t\t\tverifyPublicKey\n\t\t\t\t\t});\n\t\t\t\t\treturn { trusted: true };\n\t\t\t\t}\n\t\t\t\tif (existing.identity === identity && existing.verifyPublicKey === verifyPublicKey) return { trusted: true };\n\t\t\t\treturn pinMismatch();\n\t\t\t});\n\t\t\tconst tail = operation.then(() => void 0, () => void 0);\n\t\t\tidentityLocks.set(storageKey, tail);\n\t\t\ttry {\n\t\t\t\treturn await operation;\n\t\t\t} finally {\n\t\t\t\tif (identityLocks.get(storageKey) === tail) identityLocks.delete(storageKey);\n\t\t\t}\n\t\t} };\n\t}\n\tconst storage = createTypedStorage({ storageAdapter });\n\treturn { async resolve({ client, verifyPublicKey }) {\n\t\tconst key = tofuPinKey(client);\n\t\tconst existing = (await storage.getJson(\"pins\"))?.[key];\n\t\tif (existing == null) {\n\t\t\tawait storage.updateJsonWithDef(\"pins\", {}, (current) => ({\n\t\t\t\t...current,\n\t\t\t\t[key]: verifyPublicKey\n\t\t\t}));\n\t\t\treturn { trusted: true };\n\t\t}\n\t\tif (existing === verifyPublicKey) return { trusted: true };\n\t\treturn pinMismatch();\n\t} };\n}\nfunction createClientHandshake(config) {\n\tconst { link, localCoordinate, dictionaryVersion, securityLevel, channelTags } = config;\n\tconst wantsEncryption = securityLevel === \"encrypted\";\n\tconst clientNonce = nanoid();\n\tlet pending;\n\treturn {\n\t\tasync createHello() {\n\t\t\treturn {\n\t\t\t\tt: \"hello\",\n\t\t\t\tprotocol: HANDSHAKE_PROTOCOL,\n\t\t\t\tsecurityLevel,\n\t\t\t\tdictionaryVersion,\n\t\t\t\tclient: localCoordinate,\n\t\t\t\tclientNonce,\n\t\t\t\tverifyPublicKey: await link.getLocalVerifyPublicKey(),\n\t\t\t\texchangePublicKey: wantsEncryption ? await link.getLocalExchangePublicKey() : void 0,\n\t\t\t\tchannels: channelTags != null ? [...channelTags] : void 0,\n\t\t\t\tcaps: [\n\t\t\t\t\tCAP_RELIABLE,\n\t\t\t\t\tCAP_RELIABLE_STREAMKEY,\n\t\t\t\t\t...config.extraCaps ?? []\n\t\t\t\t]\n\t\t\t};\n\t\t},\n\t\tasync onWelcome(welcome) {\n\t\t\tif (welcome.dictionaryVersion !== dictionaryVersion) throw new Error(\"[ws-handshake] server dictionary version mismatch\");\n\t\t\tif (welcome.securityLevel !== securityLevel) throw new Error(\"[ws-handshake] server security level mismatch\");\n\t\t\tif (wantsEncryption && welcome.exchangePublicKey == null) throw new Error(\"[ws-handshake] server did not provide an exchange key for encryption\");\n\t\t\tconst expectedPeer = config.expectedPeer;\n\t\t\tif (expectedPeer != null && (welcome.server.envId !== expectedPeer.envId || expectedPeer.perId != null && welcome.server.perId !== expectedPeer.perId)) throw err_wire_connect.fromId(\"peer_identity_mismatch\", {\n\t\t\t\texpected: {\n\t\t\t\t\tenvId: expectedPeer.envId,\n\t\t\t\t\tperId: expectedPeer.perId\n\t\t\t\t},\n\t\t\t\tactual: {\n\t\t\t\t\tenvId: welcome.server.envId,\n\t\t\t\t\tperId: welcome.server.perId\n\t\t\t\t}\n\t\t\t});\n\t\t\tconst linkedServerId = runtimeLinkId(welcome.server);\n\t\t\tawait link.linkClient({\n\t\t\t\tlinkedClientId: linkedServerId,\n\t\t\t\tverifyPublicKey: welcome.verifyPublicKey,\n\t\t\t\t...wantsEncryption ? {\n\t\t\t\t\texchangePublicKey: welcome.exchangePublicKey,\n\t\t\t\t\tsaltString: sessionSalt(clientNonce, welcome.serverNonce),\n\t\t\t\t\tinfoString: handshakeInfo(dictionaryVersion),\n\t\t\t\t\tbindVerifyKeysIntoDerivation: true\n\t\t\t\t} : {}\n\t\t\t});\n\t\t\tconst encryptionKeyMaterial = wantsEncryption && welcome.exchangePublicKey != null ? {\n\t\t\t\tverifyPublicKey: welcome.verifyPublicKey,\n\t\t\t\texchangePublicKey: welcome.exchangePublicKey,\n\t\t\t\tsaltString: sessionSalt(clientNonce, welcome.serverNonce),\n\t\t\t\tinfoString: handshakeInfo(dictionaryVersion),\n\t\t\t\tbindVerifyKeysIntoDerivation: true\n\t\t\t} : void 0;\n\t\t\tconst challenge = buildHandshakeChallenge({\n\t\t\t\tsecurityLevel,\n\t\t\t\tdictionaryVersion,\n\t\t\t\tclientCoordId: coordId(localCoordinate),\n\t\t\t\tserverCoordId: coordId(welcome.server),\n\t\t\t\tclientNonce,\n\t\t\t\tserverNonce: welcome.serverNonce,\n\t\t\t\tclientVerifyKey: await link.getLocalVerifyPublicKey(),\n\t\t\t\tserverVerifyKey: welcome.verifyPublicKey,\n\t\t\t\tclientExchangeKey: wantsEncryption ? await link.getLocalExchangePublicKey() : void 0,\n\t\t\t\tserverExchangeKey: welcome.exchangePublicKey\n\t\t\t});\n\t\t\tpending = {\n\t\t\t\tlinkedServerId,\n\t\t\t\tserver: welcome.server,\n\t\t\t\tchallenge,\n\t\t\t\tencryptionKeyMaterial,\n\t\t\t\tremoteCaps: welcome.caps\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tt: \"prove\",\n\t\t\t\tsignatureBase64: (await link.signChallenge([challenge])).signatureBase64\n\t\t\t};\n\t\t},\n\t\tasync onAccept(accept) {\n\t\t\tif (pending == null) throw new Error(\"[ws-handshake] accept before welcome\");\n\t\t\tif (accept.signatureBase64 != null) {\n\t\t\t\tif (!await link.verifyChallengeFromLinkedClient({\n\t\t\t\t\tlinkedClientId: pending.linkedServerId,\n\t\t\t\t\tchallenge: pending.challenge,\n\t\t\t\t\tsignatureBase64: accept.signatureBase64\n\t\t\t\t})) throw new Error(\"[ws-handshake] server signature invalid\");\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tlinkedClientId: pending.linkedServerId,\n\t\t\t\tremote: pending.server,\n\t\t\t\tsecurityLevel,\n\t\t\t\tencryptionKeyMaterial: pending.encryptionKeyMaterial,\n\t\t\t\tremoteCaps: pending.remoteCaps\n\t\t\t};\n\t\t}\n\t};\n}\nfunction createServerHandshake(config) {\n\tconst { link, localCoordinate } = config;\n\tconst allowedLevels = Array.isArray(config.securityLevel) ? config.securityLevel : [config.securityLevel];\n\tconst verifyKeyResolver = config.verifyKeyResolver ?? createInMemoryTofuVerifyKeyResolver();\n\tconst serverNonce = nanoid();\n\tlet pending;\n\tlet result;\n\treturn {\n\t\tasync onHello(hello) {\n\t\t\tif (hello.protocol !== HANDSHAKE_PROTOCOL) {\n\t\t\t\tconst observedProtocolVersion = handshakeProtocolVersion(hello.protocol);\n\t\t\t\treturn {\n\t\t\t\t\t...reject(`unsupported handshake protocol; this server supports wire protocol v${WIRE_SUPPORTED_PROTOCOL_VERSIONS.join(\", v\")}`, HANDSHAKE_REJECT_ID_PROTOCOL_VERSION_MISMATCH),\n\t\t\t\t\tobservedProtocolVersion,\n\t\t\t\t\tsupportedProtocolVersions: [...WIRE_SUPPORTED_PROTOCOL_VERSIONS]\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst dictionaryVersion = typeof config.dictionaryVersion === \"function\" ? config.dictionaryVersion(hello) : config.dictionaryVersion;\n\t\t\tif (dictionaryVersion == null) return reject(\"unknown or unserved channel\");\n\t\t\tif (hello.dictionaryVersion !== dictionaryVersion) return reject(\"dictionary version mismatch\");\n\t\t\tconst negotiatedLevel = hello.securityLevel;\n\t\t\tif (negotiatedLevel === \"none\" || !allowedLevels.includes(negotiatedLevel)) return reject(\"security level not allowed\");\n\t\t\tconst wantsEncryption = negotiatedLevel === \"encrypted\";\n\t\t\tif (wantsEncryption && hello.exchangePublicKey == null) return reject(\"missing exchange key for encryption\");\n\t\t\tconst linkedClientId = runtimeLinkId(hello.client);\n\t\t\tawait link.linkClient({\n\t\t\t\tlinkedClientId,\n\t\t\t\tverifyPublicKey: hello.verifyPublicKey,\n\t\t\t\t...wantsEncryption ? {\n\t\t\t\t\texchangePublicKey: hello.exchangePublicKey,\n\t\t\t\t\tsaltString: sessionSalt(hello.clientNonce, serverNonce),\n\t\t\t\t\tinfoString: handshakeInfo(dictionaryVersion),\n\t\t\t\t\tbindVerifyKeysIntoDerivation: true\n\t\t\t\t} : {}\n\t\t\t});\n\t\t\tconst serverVerifyKey = await link.getLocalVerifyPublicKey();\n\t\t\tconst serverExchangeKey = wantsEncryption ? await link.getLocalExchangePublicKey() : void 0;\n\t\t\tconst keyMaterial = wantsEncryption && hello.exchangePublicKey != null ? {\n\t\t\t\tverifyPublicKey: hello.verifyPublicKey,\n\t\t\t\texchangePublicKey: hello.exchangePublicKey,\n\t\t\t\tsaltString: sessionSalt(hello.clientNonce, serverNonce),\n\t\t\t\tinfoString: handshakeInfo(dictionaryVersion),\n\t\t\t\tbindVerifyKeysIntoDerivation: true\n\t\t\t} : void 0;\n\t\t\tpending = {\n\t\t\t\tclient: hello.client,\n\t\t\t\tlinkedClientId,\n\t\t\t\tclientVerifyKey: hello.verifyPublicKey,\n\t\t\t\tnegotiatedLevel,\n\t\t\t\tkeyMaterial,\n\t\t\t\tremoteCaps: hello.caps,\n\t\t\t\tchallenge: buildHandshakeChallenge({\n\t\t\t\t\tsecurityLevel: negotiatedLevel,\n\t\t\t\t\tdictionaryVersion,\n\t\t\t\t\tclientCoordId: coordId(hello.client),\n\t\t\t\t\tserverCoordId: coordId(localCoordinate),\n\t\t\t\t\tclientNonce: hello.clientNonce,\n\t\t\t\t\tserverNonce,\n\t\t\t\t\tclientVerifyKey: hello.verifyPublicKey,\n\t\t\t\t\tserverVerifyKey,\n\t\t\t\t\tclientExchangeKey: hello.exchangePublicKey,\n\t\t\t\t\tserverExchangeKey\n\t\t\t\t})\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tt: \"welcome\",\n\t\t\t\tsecurityLevel: negotiatedLevel,\n\t\t\t\tdictionaryVersion,\n\t\t\t\tserver: localCoordinate,\n\t\t\t\tserverNonce,\n\t\t\t\tverifyPublicKey: serverVerifyKey,\n\t\t\t\texchangePublicKey: serverExchangeKey,\n\t\t\t\tcaps: [\n\t\t\t\t\tCAP_RELIABLE,\n\t\t\t\t\tCAP_RELIABLE_STREAMKEY,\n\t\t\t\t\t...config.extraCaps ?? []\n\t\t\t\t]\n\t\t\t};\n\t\t},\n\t\tasync onProve(prove) {\n\t\t\tif (pending == null) return reject(\"prove before hello\");\n\t\t\tif (!await link.verifyChallengeFromLinkedClient({\n\t\t\t\tlinkedClientId: pending.linkedClientId,\n\t\t\t\tchallenge: pending.challenge,\n\t\t\t\tsignatureBase64: prove.signatureBase64\n\t\t\t})) return reject(\"invalid client signature\");\n\t\t\tconst trust = await verifyKeyResolver.resolve({\n\t\t\t\tclient: pending.client,\n\t\t\t\tverifyPublicKey: pending.clientVerifyKey\n\t\t\t});\n\t\t\tif (!trust.trusted) return reject(trust.reason ?? \"client verify key not trusted\", trust.rejectId);\n\t\t\tresult = {\n\t\t\t\tlinkedClientId: pending.linkedClientId,\n\t\t\t\tremote: pending.client,\n\t\t\t\tsecurityLevel: pending.negotiatedLevel,\n\t\t\t\tencryptionKeyMaterial: pending.keyMaterial,\n\t\t\t\tremoteCaps: pending.remoteCaps\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tt: \"accept\",\n\t\t\t\tsignatureBase64: (await link.signChallenge([pending.challenge])).signatureBase64\n\t\t\t};\n\t\t},\n\t\t/** The completed handshake result once `onProve` has accepted, else `undefined`. */\n\t\tgetResult() {\n\t\t\treturn result;\n\t\t},\n\t\texportPending() {\n\t\t\treturn pending;\n\t\t},\n\t\tasync restorePending(restored) {\n\t\t\tpending = restored;\n\t\t\tawait link.linkClient({\n\t\t\t\tlinkedClientId: restored.linkedClientId,\n\t\t\t\tverifyPublicKey: restored.clientVerifyKey\n\t\t\t});\n\t\t}\n\t};\n}\n//#endregion\n//#region src/wire/Connect/connectionBinding.ts\n/**\n* Readers for the persisted {@link IWireConnectionBinding}: the *only* supported way\n* for anything outside wire to read identity back off a persisted connection attachment. Before\n* these existed every consumer hand-rolled `attachment?.binding?.client?.perId` against what was\n* action's private persistence format — untyped, and silently broken by any shape change. These\n* readers own the shape knowledge (including the composite `{ app?, binding? }` attachment layout\n* the serve layer writes) and validate the schema version, so a shape change shows up here, once.\n*/\n/** Whether a persisted value is a current-schema (`v: 1`) wire connection binding. */\nfunction isWireConnectionBinding(value) {\n\treturn typeof value === \"object\" && value != null && \"v\" in value && value.v === 1 && \"client\" in value && typeof value.client === \"object\" && value.client != null;\n}\n/**\n* Read the wire binding out of a persisted connection attachment. Accepts either the bare binding\n* (a host that persists it directly) or the composite `{ app?, binding? }` slot the serve layer\n* co-stores app state in. `undefined` for anything else — including bindings of an unknown schema\n* version (the socket should be treated as fresh, exactly like `WireAcceptor.rehydrate`).\n*/\nfunction wireBindingFromAttachment(attachment) {\n\tif (isWireConnectionBinding(attachment)) return attachment;\n\tif (typeof attachment === \"object\" && attachment != null && \"binding\" in attachment && isWireConnectionBinding(attachment.binding)) return attachment.binding;\n}\n/**\n* The authenticated client coordinate persisted on a connection's attachment —\n* `undefined` when the attachment carries no readable binding. This is what a protocol module's\n* server half (e.g. realm's `resolveClient` default) reads instead of reaching into the raw\n* attachment shape.\n*/\nfunction clientCoordinateFromAttachment(attachment) {\n\tconst binding = wireBindingFromAttachment(attachment);\n\treturn binding == null ? void 0 : new RuntimeCoordinate(binding.client);\n}\n/**\n* The negotiated wire security level persisted on a connection's attachment — the twin of\n* {@link clientCoordinateFromAttachment}, reading the level a protocol module (e.g. realm's attach\n* gate) needs to enforce a minimum **after a hibernation wake**, where the socket re-hellos with no\n* fresh handshake and the persisted binding is the only source of truth.\n*\n* Two distinct \"absent\" cases the caller must handle:\n* - **`undefined`** — no readable binding at all (a fresh/unbound socket, or an unknown-schema\n*   binding). Read this as \"unknown\" and fail closed (treat as `none`); it also means\n*   {@link clientCoordinateFromAttachment} yields no identity, so such a socket never attaches.\n* - **`ESecurityLevel.none`** — a *readable* binding for a genuinely plain (unhandshaked)\n*   connection (no `secure` block). Realm traffic never reaches here on such a connection (the\n*   wire security gate drops protocol frames on `none` links), but the value is reported honestly.\n*/\nfunction securityLevelFromAttachment(attachment) {\n\tconst binding = wireBindingFromAttachment(attachment);\n\tif (binding == null) return void 0;\n\treturn binding.secure?.securityLevel ?? \"none\";\n}\n//#endregion\n//#region src/wire/crypto/actionFrameCrypto.ts\nconst ENCRYPTED_ENVELOPE_LENGTH = 2;\n/**\n* Build the encrypt/decrypt transform for a connection whose handshake settled on the `encrypted`\n* level. The shared key is derived once from {@link IActionFrameCryptoConfig.keyMaterial} and captured\n* for this connection alone, decoupling it from the link's shared key cache.\n*/\nfunction createActionFrameCrypto({ link, keyMaterial }) {\n\tconst keyPromise = link.deriveSharedAesGcmKey(keyMaterial);\n\treturn {\n\t\tasync encryptFrame(frame) {\n\t\t\tconst { nonce, ciphertext } = await encryptBytesWithAesGcmKey({\n\t\t\t\tdataToEncrypt: frame,\n\t\t\t\taesGcmKey: await keyPromise\n\t\t\t});\n\t\t\treturn pack([nonce, ciphertext]);\n\t\t},\n\t\tasync decryptFrame(frame) {\n\t\t\tif (typeof frame === \"string\") throw new Error(\"[ws-crypto] expected an encrypted binary frame, received text\");\n\t\t\tconst envelope = unpack(frame instanceof ArrayBuffer ? new Uint8Array(frame) : frame);\n\t\t\tif (!Array.isArray(envelope) || envelope.length !== ENCRYPTED_ENVELOPE_LENGTH) throw new Error(\"[ws-crypto] malformed encrypted frame envelope\");\n\t\t\tconst [nonce, ciphertext] = envelope;\n\t\t\tif (!(nonce instanceof Uint8Array) || !(ciphertext instanceof Uint8Array)) throw new Error(\"[ws-crypto] malformed encrypted frame fields\");\n\t\t\treturn await decryptBytesWithAesGcmKey({\n\t\t\t\tdataToDecrypt: {\n\t\t\t\t\tnonce,\n\t\t\t\t\tciphertext\n\t\t\t\t},\n\t\t\t\taesGcmKey: await keyPromise\n\t\t\t});\n\t\t}\n\t};\n}\n//#endregion\n//#region src/wire/Mux/protocolFrame.ts\n/**\n* Frame-protocol prefix bytes (realm protocol design §3.1). A registered protocol frame is\n* `[prefixByte, ...payload]` with the prefix drawn from the reserved range `0x00`–`0x0F` —\n* bytes no legacy frame can start with: binary action envelopes are msgpack fixarrays\n* (`0x96`–`0x98`), control frames are msgpack maps (`0x80`–`0x8f`, `0xde`, `0xdf`), and\n* handshake frames are text JSON (`{` = `0x7b`). Frames without a reserved prefix fall through\n* to the legacy sniffing untouched, so old peers stay byte-identical (pinned by the\n* byte-compat goldens).\n*\n* The registry is **closed** — same philosophy as the control-message registry: protocols are\n* library-level concerns assigned here, never user-claimable ad hoc.\n*/\nconst WIRE_PROTOCOL_PREFIX = {\n\t/** `0x00` is reserved/invalid — a zero prefix is treated as a decode error, never dispatched. */\n\tinvalid: 0,\n\t/** `connect-core/realm` state-sync frames. */\n\trealm: 1,\n\t/**\n\t* `connect-core/devtools` observation frames. Assigned here so the prefix space has one\n\t* authoritative catalogue; `connect-core/devtools-core` (a zero-runtime-dependency package that\n\t* cannot import wire) mirrors it structurally as its own `DEVTOOLS_WIRE_PREFIX = 0x02`.\n\t*/\n\tdevtools: 2\n};\n/** Highest byte of the reserved prefix range (inclusive). */\nconst WIRE_PROTOCOL_PREFIX_MAX = 15;\n/**\n* Peek a frame's protocol prefix: the byte when it is a binary frame starting in the reserved\n* range, else `undefined` (a legacy frame — handshake/control/action — or a text frame).\n*/\nfunction peekProtocolPrefix(frame) {\n\tlet first;\n\tif (frame instanceof Uint8Array) first = frame.length > 0 ? frame[0] : void 0;\n\telse if (frame instanceof ArrayBuffer) first = frame.byteLength > 0 ? new Uint8Array(frame, 0, 1)[0] : void 0;\n\telse return void 0;\n\tif (first == null || first > 15) return void 0;\n\treturn first;\n}\n/** Wrap a protocol payload with its prefix byte. */\nfunction encodeProtocolFrame(prefixByte, payload) {\n\tif (prefixByte <= 0 || prefixByte > 15) throw new Error(`encodeProtocolFrame: prefix 0x${prefixByte.toString(16)} outside reserved range`);\n\tconst framed = new Uint8Array(payload.length + 1);\n\tframed[0] = prefixByte;\n\tframed.set(payload, 1);\n\treturn framed;\n}\n/** Strip the prefix byte off an already-peeked protocol frame. */\nfunction protocolFramePayload(frame) {\n\treturn (frame instanceof Uint8Array ? frame : new Uint8Array(frame)).subarray(1);\n}\n/** The handshake capability tag advertising a frame protocol (`hello.caps` / `welcome.caps`). */\nfunction protocolCap(protocolId) {\n\treturn `proto:${protocolId}`;\n}\n/** Extract the advertised protocol ids from a peer's handshake caps. */\nfunction protocolsFromCaps(caps) {\n\tconst ids = /* @__PURE__ */ new Set();\n\tfor (const cap of caps ?? []) if (cap.startsWith(\"proto:\")) ids.add(cap.slice(6));\n\treturn ids;\n}\n//#endregion\n//#region src/wire/crypto/frameBytes.ts\n/** Normalize any frame form to bytes (for the AES-GCM layer, which works on `Uint8Array`). */\nfunction toFrameBytes(frame) {\n\tif (typeof frame === \"string\") return new TextEncoder().encode(frame);\n\tif (frame instanceof ArrayBuffer) return new Uint8Array(frame);\n\treturn frame;\n}\n//#endregion\n//#region src/wire/SecureSession/frameCryptoPipe.ts\nfunction createFrameCryptoPipe(config) {\n\tconst { write, isOpen, crypto, label = \"link\" } = config;\n\tlet sendChain = Promise.resolve();\n\tconst send = (frame, tapLane) => {\n\t\tif (isOpen != null && !isOpen()) return;\n\t\tif (crypto == null) {\n\t\t\twrite(frame, tapLane);\n\t\t\treturn;\n\t\t}\n\t\tconst bytes = toFrameBytes(frame);\n\t\tsendChain = sendChain.then(() => crypto).then((c) => c.encryptFrame(bytes)).then((encrypted) => {\n\t\t\tif (isOpen == null || isOpen()) write(encrypted, tapLane);\n\t\t}).catch((err) => console.error(`[${label}] failed to encrypt/send frame`, err));\n\t};\n\tconst decryptIncoming = async (frame) => {\n\t\tif (crypto == null) return frame;\n\t\ttry {\n\t\t\treturn await (await crypto).decryptFrame(frame);\n\t\t} catch (err) {\n\t\t\tconsole.error(`[${label}] failed to decrypt incoming frame`, err);\n\t\t\treturn;\n\t\t}\n\t};\n\treturn {\n\t\tsend,\n\t\tdecryptIncoming\n\t};\n}\n//#endregion\n//#region src/wire/tap/wireTap.ts\n/**\n* Wrap a tap so every event it receives is attributed to `linkId` unless the emitter already named\n* one. This is how the **connector** side gets per-link attribution: an acceptor knows many peers\n* and tags each frame with the bound client as it emits, whereas a connector has exactly one peer\n* for the whole connection — so stamping once at the seam beats threading an id through the pipe,\n* the session, the keepalive and the exchange carrier.\n*\n* Both ends therefore answer the same question with `linkId`: *who is on the other end of this\n* frame*. A client's core can then split its traffic per backend it dials, exactly as a server's\n* splits per client it serves.\n*/\nfunction withLinkIdTap(tap, linkId) {\n\treturn (event) => {\n\t\ttap(event.linkId != null ? event : {\n\t\t\t...event,\n\t\t\tlinkId\n\t\t});\n\t};\n}\n/**\n* Wrap an exchange (HTTP) carrier so every request/reply pair is reported to the\n* tap under the `\"http\"` lane — the exchange path's equivalent of the duplex\n* session's pipe/dispatch taps. Envelope bytes as handed to the carrier (the\n* HTTP layer's own headers are outside the library's sight and not counted).\n*/\nfunction withExchangeTap(carrier, tap, linkId) {\n\treturn {\n\t\texchange: async (frame, opts) => {\n\t\t\ttap({\n\t\t\t\tdir: \"out\",\n\t\t\t\tbytes: wireFrameByteSize(frame),\n\t\t\t\tlane: \"http\",\n\t\t\t\tlinkId\n\t\t\t});\n\t\t\tconst reply = await carrier.exchange(frame, opts);\n\t\t\ttap({\n\t\t\t\tdir: \"in\",\n\t\t\t\tbytes: wireFrameByteSize(reply),\n\t\t\t\tlane: \"http\",\n\t\t\t\tlinkId\n\t\t\t});\n\t\t\treturn reply;\n\t\t},\n\t\tget label() {\n\t\t\treturn carrier.label;\n\t\t}\n\t};\n}\nlet encoder;\n/** The transmitted size of one frame: `byteLength` for binary, UTF-8 length for strings. */\nfunction wireFrameByteSize(frame) {\n\tif (typeof frame === \"string\") {\n\t\tif (encoder == null) encoder = new TextEncoder();\n\t\treturn encoder.encode(frame).byteLength;\n\t}\n\tif (frame instanceof Uint8Array) return frame.byteLength;\n\tif (frame instanceof ArrayBuffer) return frame.byteLength;\n\tif (typeof SharedArrayBuffer !== \"undefined\" && frame instanceof SharedArrayBuffer) return frame.byteLength;\n\tif (ArrayBuffer.isView(frame)) return frame.byteLength;\n\treturn 0;\n}\n//#endregion\n//#region src/wire/Connect/lanelessLane.ts\n/**\n* The handshake dictionary version a **lane-less** (mux-only) connection advertises — a connection\n* that carries no unprefixed lane of its own because every protocol rides the {@link\n* import(\"../Mux/WireProtocolMux\").WireProtocolMux} (a realm, devtools). It is the neutral\n* connection's identity in the handshake: the acceptor signs it into the challenge (and folds it\n* into the encryption HKDF), so both ends must agree on it byte-for-byte.\n*\n* Its value is **exactly what an empty `connect-core/action` channel (`defineChannel({})`) derives**\n* (`deriveDictionaryVersion([])` = the FNV-1a of the empty route list), so a `createWireClient`\n* connection interoperates with an action-served empty-channel acceptor with **no server change** —\n* a supported mixed-hosting compose (a realm-only client dialing an action host that also serves an\n* empty channel). It is pinned by an action-side test (`defineChannel({}).dictionaryVersion === this`),\n* so a drift in the derivation is caught rather than shipped.\n*\n* **Format-finalization verdict (Phase 4): kept as the auto-derived value, deliberately.** Giving it\n* a \"meaningful\" string (`\"laneless:v1\"`) would force `defineChannel({})` to emit a hand-picked\n* string instead of its derived one — breaking the `dictionaryVersion = f(routes)` invariant for the\n* empty case just to prettify a value **no consumer ever types** (it is internal handshake plumbing,\n* signed into the challenge + folded into the HKDF). The `\"auto:\"` prefix already tells the honest\n* story: it is auto-derived. Frozen.\n*/\nconst WIRE_LANELESS_DICTIONARY_VERSION = \"auto:811c9dc5\";\n/**\n* A trivial {@link IWireLaneProtocol} for a **mux-only** connection: the mux carries every protocol\n* frame (a realm, devtools), so the lane itself sends and receives nothing. It supplies the\n* {@link WIRE_LANELESS_DICTIONARY_VERSION} + no channels to the handshake, and no-ops the receive\n* path. A stray *unprefixed* frame is a protocol anomaly (the peer sent lane traffic to a lane-less\n* connection) — dropped with a one-line warning rather than silently, so the misconfiguration is\n* visible without being fatal.\n*\n* This is the default lane a {@link import(\"./WireLinkConnection\").WireLinkConnection} runs when\n* `createWireClient` builds a connection with no lane binding — the seam the action lane fills with\n* its codec (`connect-core/action`'s `finalizeSecureLinkMethods`) and a devtools protocol will leave\n* empty just like a realm does.\n*/\nfunction lanelessLane() {\n\treturn {\n\t\tid: \"none\",\n\t\thandshakeConfig: () => ({\n\t\t\tdictionaryVersion: WIRE_LANELESS_DICTIONARY_VERSION,\n\t\t\tchannels: []\n\t\t}),\n\t\tonLaneFrame: (frame) => {\n\t\t\tconsole.warn(\"[wire] a lane-less (mux-only) connection received an unprefixed frame — the peer sent lane traffic to a connection that only carries mux protocols; dropping it.\", typeof frame === \"string\" ? frame.slice(0, 64) : `<${frame.byteLength}b binary>`);\n\t\t}\n\t};\n}\n/**\n* The acceptor-side twin of {@link lanelessLane}: an {@link IWireAcceptorLane} for a **mux-only**\n* server (a realm-only Durable Object). The mux consumes every protocol frame (prefixed), so the\n* lane carries nothing — it only supplies the handshake version payload (the same\n* {@link WIRE_LANELESS_DICTIONARY_VERSION} the client's `lanelessLane` advertises, so a\n* `createWireClient` and a `serveWireDurableObject` handshake agree byte-for-byte) and no-ops the\n* rest.\n*\n* A realm requires a *secure* connection, so the handshake — not the lane — binds identity\n* (`WireAcceptor` binds the authenticated coordinate on `onAuthenticated`) and the realm protocol\n* attaches via the un-gated fan-out; the lane's `onFrame` is genuinely never reached on the realm\n* path. A stray unprefixed frame is a protocol anomaly, dropped with a one-line warning rather than\n* silently (the mirror of the client side). This is the lane `serveWireDurableObject` installs.\n*/\nfunction lanelessAcceptorLane() {\n\treturn {\n\t\tdictionaryVersion: WIRE_LANELESS_DICTIONARY_VERSION,\n\t\tonFrame: (_connection, frame) => {\n\t\t\tconsole.warn(\"[wire] a lane-less (mux-only) acceptor received an unprefixed frame — a peer sent lane traffic to a server that only carries mux protocols; dropping it.\", typeof frame === \"string\" ? frame.slice(0, 64) : `<${frame.byteLength}b binary>`);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/wire/SecureSession/acceptorSecureSession.ts\n/**\n* The acceptor (accept-in) counterpart to the connector's `establishLinkSession`: one connection's\n* secure session — the server-side handshake driving, the ordered frame crypto, and the per-connection\n* phase (undecided → plain | authenticated). The crypto itself (ordered encrypt-send / decrypt) lives in\n* the shared {@link createFrameCryptoPipe}, the same primitive the connector uses — so the secure logic\n* lives once for both link roles.\n*\n* The handler owns one of these per accepted connection and feeds it inbound frames via {@link receive};\n* identity binding, persistence, codec, and return routing stay in the handler (driven through the\n* config callbacks). Inbound processing is serialized per connection because the handshake and decryption\n* are async — this keeps handshake ordering and frame order intact.\n*/\nvar AcceptorSecureSession = class {\n\tconfig;\n\t_handshake;\n\t/** The ordered encrypt-send / decrypt pipe — present only for an `encrypted` connection. */\n\t_pipe;\n\t_authed = false;\n\t_plain = false;\n\t_handshakeStarted = false;\n\t_handshakeFailed = false;\n\t/** The channel tags the client advertised in its `hello`, captured for the handler's codec selection. */\n\t_helloChannels;\n\t/** Serializes inbound processing (handshake + decryption are async). */\n\t_inboundChain = Promise.resolve();\n\tconstructor(config) {\n\t\tthis.config = config;\n\t}\n\t/**\n\t* Feed one inbound frame. Serialized per connection; routes back through the config callbacks.\n\t* `wireBytes` is the frame's size as the carrier delivered it (pre-decryption) — measured by the\n\t* acceptor and carried through here because only the decrypted frame reveals its lane.\n\t*/\n\treceive(frame, wireBytes) {\n\t\tthis._inboundChain = this._inboundChain.then(() => {\n\t\t\tif (!this._handshakeFailed) return this._receive(frame, wireBytes);\n\t\t}).catch((err) => {\n\t\t\tconsole.error(\"[ws-server] failed to process inbound frame\", err);\n\t\t\tif (!this._handshakeStarted || this._authed || this._handshakeFailed) return;\n\t\t\tthis._handshakeFailed = true;\n\t\t\ttry {\n\t\t\t\tthis.config.send(encodeHandshakeMessage({\n\t\t\t\t\tt: \"reject\",\n\t\t\t\t\treason: \"server handshake failed; check server logs\"\n\t\t\t\t}));\n\t\t\t\tthis.config.close?.();\n\t\t\t} catch {}\n\t\t});\n\t}\n\tasync _receive(frame, wireBytes) {\n\t\tif (this._plain) {\n\t\t\tthis.config.routePlain(frame, wireBytes);\n\t\t\treturn;\n\t\t}\n\t\tif (!this._authed) {\n\t\t\tconst message = typeof frame === \"string\" ? decodeHandshakeMessage(frame) : void 0;\n\t\t\tif (message == null) {\n\t\t\t\tif (this.config.noneAllowed) {\n\t\t\t\t\tthis._plain = true;\n\t\t\t\t\tthis.config.routePlain(frame, wireBytes);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.config.tap?.({\n\t\t\t\tdir: \"in\",\n\t\t\t\tbytes: wireBytes ?? 0,\n\t\t\t\tlane: \"handshake\"\n\t\t\t});\n\t\t\tthis._handshakeStarted = true;\n\t\t\tawait this.config.link.initialize();\n\t\t\tif (this._handshake == null) this._handshake = createServerHandshake({\n\t\t\t\tlink: this.config.link,\n\t\t\t\tlocalCoordinate: this.config.localCoordinate,\n\t\t\t\tdictionaryVersion: this.config.dictionaryVersion,\n\t\t\t\tsecurityLevel: this.config.securityLevel,\n\t\t\t\tverifyKeyResolver: this.config.verifyKeyResolver,\n\t\t\t\textraCaps: this.config.extraCaps\n\t\t\t});\n\t\t\tif (message.t === \"hello\") {\n\t\t\t\tthis._helloChannels = message.channels;\n\t\t\t\tconst reply = await this._handshake.onHello(message);\n\t\t\t\tthis.config.send(encodeHandshakeMessage(reply));\n\t\t\t\tif (reply.t === \"reject\") this._refuse();\n\t\t\t} else if (message.t === \"prove\") {\n\t\t\t\tconst reply = await this._handshake.onProve(message);\n\t\t\t\tthis.config.send(encodeHandshakeMessage(reply));\n\t\t\t\tconst result = this._handshake.getResult();\n\t\t\t\tif (reply.t === \"accept\" && result != null) this._complete(result);\n\t\t\t\telse if (reply.t === \"reject\") this._refuse();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tconst bytes = this._pipe != null ? await this._pipe.decryptIncoming(frame) : frame;\n\t\tif (bytes === void 0) return;\n\t\tthis.config.routeAction(bytes, wireBytes);\n\t}\n\t/** A refused handshake ends this connection: later frames are ignored and the socket closes. */\n\t_refuse() {\n\t\tthis._handshakeFailed = true;\n\t\tthis.config.close?.();\n\t}\n\t_complete(result) {\n\t\tthis._authed = true;\n\t\tthis._handshake = void 0;\n\t\tif (result.securityLevel === \"encrypted\" && result.encryptionKeyMaterial != null) this._pipe = this._buildPipe(createActionFrameCrypto({\n\t\t\tlink: this.config.link,\n\t\t\tkeyMaterial: result.encryptionKeyMaterial\n\t\t}));\n\t\tthis.config.onAuthenticated({\n\t\t\tclient: new RuntimeCoordinate(result.remote),\n\t\t\tsecurityLevel: result.securityLevel,\n\t\t\tlinkedClientId: result.linkedClientId,\n\t\t\tkeyMaterial: result.encryptionKeyMaterial,\n\t\t\tchannelTags: this._helloChannels,\n\t\t\tremoteCaps: result.remoteCaps\n\t\t});\n\t}\n\t/**\n\t* Restore an already-authenticated session after eviction — no handshake. For an `encrypted`\n\t* connection the shared key is re-derived asynchronously (the acceptor re-links the client off its own\n\t* persisted identity); the pipe's crypto IS that promise, so the connection's first in/out frame\n\t* naturally waits for the key before encrypt/decrypt — no separate gate.\n\t*/\n\trehydrate(state) {\n\t\tthis._authed = true;\n\t\tif (state.securityLevel !== \"encrypted\" || state.keyMaterial == null) return;\n\t\tconst { link } = this.config;\n\t\tconst { keyMaterial } = state;\n\t\tconst cryptoReady = link.initialize().then(() => createActionFrameCrypto({\n\t\t\tlink,\n\t\t\tkeyMaterial\n\t\t}));\n\t\tcryptoReady.catch((err) => console.error(\"[ws-server] failed to restore encrypted session\", err));\n\t\tthis._pipe = this._buildPipe(cryptoReady);\n\t}\n\t/**\n\t* Send an outbound frame: through the encrypt pipe when encrypted, otherwise raw. `tapLane` rides\n\t* both branches — an `authenticated` (unencrypted) connection has no pipe but its frames are just\n\t* as much action/protocol traffic, and must not be mislabelled.\n\t*/\n\tsend(frame, tapLane) {\n\t\tif (this._pipe != null) {\n\t\t\tthis._pipe.send(frame, tapLane);\n\t\t\treturn;\n\t\t}\n\t\tthis.config.send(frame, tapLane);\n\t}\n\t_buildPipe(crypto) {\n\t\treturn createFrameCryptoPipe({\n\t\t\twrite: this.config.send,\n\t\t\tcrypto,\n\t\t\tlabel: \"ws-server\"\n\t\t});\n\t}\n};\n//#endregion\n//#region src/wire/Connect/WireAcceptor.ts\n/**\n* Wire-level keepalive: the acceptor answers a literal `\"ping\"` text frame with\n* `\"pong\"` before any other dispatch, so connection health never involves the lane or a protocol.\n* On Cloudflare the DO host answers it below this layer (`setWebSocketAutoResponse`) and the frame\n* never reaches {@link WireAcceptor.receive} — this path makes every other host behave the same.\n*/\nconst KEEPALIVE_PING = \"ping\";\nconst KEEPALIVE_PONG = \"pong\";\n/**\n* The acceptor backbone: everything between \"an inbound frame arrived on a\n* connection\" and \"a protocol module (or the lane) may handle it\" — handshake accept +\n* secure-session-per-connection, security levels, the client-identity registry, the protocol\n* registry with prefix dispatch, the **security gate** (the connection contract: protocol traffic requires an\n* authenticated connection unless the protocol opts into `allowPlain`), the **un-gated lifecycle\n* fan-out** (the connection contract: attach/detach fire for every registered protocol the gate admits, not\n* just the caps-advertised ones — both hooks are idempotent by contract, so a missing cap is a\n* non-event instead of a silent liveness hole), the versioned {@link IWireConnectionBinding}\n* persistence + {@link rehydrate} (hibernation), and the wire keepalive.\n*\n* The lane (action serving, codecs, reliability) composes on top through\n* {@link IWireAcceptorLane}; nothing here names an action or a realm.\n*/\nvar WireAcceptor = class {\n\t_send;\n\t_close;\n\t_tap;\n\t_security;\n\t_lane;\n\t/** Normalized accepted levels; whether `none` (plain) is allowed; whether any level needs a handshake. */\n\t_allowedLevels;\n\t_noneAllowed;\n\t_handshakeMode;\n\t_onConnectionBound;\n\t_disposed = false;\n\t_connByClient = /* @__PURE__ */ new Map();\n\t_clientByConn = /* @__PURE__ */ new Map();\n\t_levelByConn = /* @__PURE__ */ new Map();\n\t_sessionByConn = /* @__PURE__ */ new Map();\n\t/** The last persisted (or rehydrated) binding per connection — re-persists merge through it. */\n\t_bindingByConn = /* @__PURE__ */ new Map();\n\t/** Registered protocols by prefix byte. */\n\t_protocols = /* @__PURE__ */ new Map();\n\t/** Per-connection protocol ids the client advertised (persisted informationally on the binding). */\n\t_protoIdsByConn = /* @__PURE__ */ new Map();\n\t/** Protocols already warned for gated (plain-connection) frame drops — one warning per id. */\n\t_gateWarned = /* @__PURE__ */ new Set();\n\tconstructor(options) {\n\t\tthis._send = options.send;\n\t\tthis._close = options.close;\n\t\tthis._tap = options.tap;\n\t\tthis._security = options.security;\n\t\tthis._lane = options.lane;\n\t\tif (options.security != null && options.lane.dictionaryVersion == null) throw new Error(\"WireAcceptor: a security config needs the lane's `dictionaryVersion` (E5 — the lane supplies the handshake's version payload; wire signs it into the challenge).\");\n\t\tthis._onConnectionBound = options.onConnectionBound;\n\t\tthis._allowedLevels = options.security == null ? [] : Array.isArray(options.security.securityLevel) ? options.security.securityLevel : [options.security.securityLevel];\n\t\tthis._noneAllowed = this._allowedLevels.includes(\"none\");\n\t\tthis._handshakeMode = this._allowedLevels.some((level) => level !== \"none\");\n\t\tfor (const protocol of options.protocols ?? []) this.registerProtocol(protocol);\n\t}\n\t/** Feed one inbound frame from a connection: keepalive, then handshake/session, then dispatch. */\n\treceive(connection, frame) {\n\t\tif (this._disposed) return;\n\t\tconst wireBytes = this._tap != null ? wireFrameByteSize(frame) : 0;\n\t\tif (frame === KEEPALIVE_PING) {\n\t\t\tthis._tapIn(connection, wireBytes, \"keepalive\");\n\t\t\tthis._writeTapped(connection, KEEPALIVE_PONG, \"keepalive\");\n\t\t\treturn;\n\t\t}\n\t\tconst security = this._security;\n\t\tif (security == null || !this._handshakeMode) {\n\t\t\tthis._receivePlain(connection, frame, wireBytes);\n\t\t\treturn;\n\t\t}\n\t\tif (!this._sessionByConn.has(connection)) {\n\t\t\tconst prefix = peekProtocolPrefix(frame);\n\t\t\tconst protocol = prefix == null ? void 0 : this._protocols.get(prefix);\n\t\t\tif (protocol?.allowPlain === true) {\n\t\t\t\tthis._tapIn(connection, wireBytes, protocol.id);\n\t\t\t\tconst bytes = frame instanceof Uint8Array ? frame : new Uint8Array(frame);\n\t\t\t\tprotocol.onFrame(connection, bytes.subarray(1), this.protocolSendFor(connection, protocol), this._protocolContext(connection));\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tthis._sessionFor(connection, security).receive(frame, wireBytes);\n\t}\n\t_receivePlain(connection, frame, wireBytes = 0) {\n\t\tif (this._disposed) return;\n\t\tthis._tapIn(connection, wireBytes, this._laneFor(frame));\n\t\tif (this._dispatchProtocolFrame(connection, frame)) return;\n\t\tthis._lane.onFrame(connection, frame, \"none\");\n\t}\n\t/** Route a decrypted frame from an authenticated connection: protocols first, then the lane. */\n\t_routeAuthed(connection, bytes, wireBytes = 0) {\n\t\tif (this._disposed) return;\n\t\tthis._tapIn(connection, wireBytes, this._laneFor(bytes));\n\t\tif (this._dispatchProtocolFrame(connection, bytes)) return;\n\t\tthis._lane.onFrame(connection, bytes, this._levelByConn.get(connection) ?? \"authenticated\");\n\t}\n\t/**\n\t* The lane a *plaintext* frame belongs to: a reserved-prefix frame names its protocol\n\t* (`realm`, …); everything else is the action lane. Mirrors the connector's\n\t* `mux.protocolIdFor(frame) ?? \"protocol\"` / `\"action\"` split so both ends label alike.\n\t*/\n\t_laneFor(frame) {\n\t\tconst prefix = peekProtocolPrefix(frame);\n\t\tif (prefix == null) return \"action\";\n\t\treturn this._protocols.get(prefix)?.id ?? \"protocol\";\n\t}\n\t/** A connection's bound client, so a multi-client server attributes traffic per link. */\n\t_linkId(connection) {\n\t\treturn this._clientByConn.get(connection)?.stringId;\n\t}\n\t_tapIn(connection, bytes, lane) {\n\t\tthis._tap?.({\n\t\t\tdir: \"in\",\n\t\t\tbytes,\n\t\t\tlane,\n\t\t\tlinkId: this._linkId(connection)\n\t\t});\n\t}\n\t/** The one outbound write: measured post-encryption, exactly as the carrier transmits it. */\n\t_writeTapped(connection, frame, lane) {\n\t\tthis._tap?.({\n\t\t\tdir: \"out\",\n\t\t\tbytes: wireFrameByteSize(frame),\n\t\t\tlane,\n\t\t\tlinkId: this._linkId(connection)\n\t\t});\n\t\tthis._send(connection, frame);\n\t}\n\t/**\n\t* Register a protocol module. Prefer registration at construction (`protocols`) — this method\n\t* exists for composition layers that assemble the acceptor before its protocols (it is safe\n\t* until the first connection's handshake, which snapshots the advertised caps).\n\t*/\n\tregisterProtocol(protocol) {\n\t\tif (protocol.prefixByte <= WIRE_PROTOCOL_PREFIX.invalid || protocol.prefixByte > 15) throw new Error(`registerFrameProtocol(\"${protocol.id}\"): prefix 0x${protocol.prefixByte.toString(16)} outside the reserved range`);\n\t\tif (this._protocols.has(protocol.prefixByte)) throw new Error(`registerFrameProtocol(\"${protocol.id}\"): prefix 0x${protocol.prefixByte.toString(16)} already registered`);\n\t\tthis._protocols.set(protocol.prefixByte, protocol);\n\t}\n\t/** The `proto:<id>` caps to advertise in this acceptor's handshake welcome. */\n\t_protocolCaps() {\n\t\tif (this._protocols.size === 0) return void 0;\n\t\treturn [...this._protocols.values()].map((protocol) => protocolCap(protocol.id));\n\t}\n\t/** Per-connection protocol send: prefix here, encrypt via the secure session when present. */\n\tprotocolSendFor(connection, protocol) {\n\t\treturn (payload) => {\n\t\t\tthis.sendTo(connection, encodeProtocolFrame(protocol.prefixByte, payload));\n\t\t};\n\t}\n\t/**\n\t* Whether a protocol may speak on a connection — the security gate (A.6). Protocol traffic and\n\t* lifecycle require an authenticated peer: on a `none`-level connection the binding identity is\n\t* self-asserted, so `allowPlain` is the explicit opt-in for dev/trusted-network setups.\n\t*/\n\t_gateAdmits(connection, protocol) {\n\t\tif (protocol.allowPlain === true) return true;\n\t\treturn (this._levelByConn.get(connection) ?? \"none\") !== \"none\";\n\t}\n\t/**\n\t* Protocol frame dispatch: a reserved-prefix frame belongs to a registered protocol and never\n\t* falls through to the lane — an unknown prefix is consumed-and-dropped (negotiation should\n\t* prevent it; mis-decoding it would be worse), and so is a frame the security gate blocks.\n\t*/\n\t_dispatchProtocolFrame(connection, frame) {\n\t\tconst prefix = peekProtocolPrefix(frame);\n\t\tif (prefix == null) return false;\n\t\tconst protocol = this._protocols.get(prefix);\n\t\tif (prefix === WIRE_PROTOCOL_PREFIX.invalid || protocol == null) return true;\n\t\tif (!this._gateAdmits(connection, protocol)) {\n\t\t\tif (!this._gateWarned.has(protocol.id)) {\n\t\t\t\tthis._gateWarned.add(protocol.id);\n\t\t\t\tconsole.warn(`[wire-acceptor] dropped a \"${protocol.id}\" protocol frame from an unauthenticated (plain) connection — protocol traffic requires an authenticated peer. Set \\`allowPlain: true\\` on the protocol if this endpoint is deliberately plain (A.6).`);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tconst bytes = frame instanceof Uint8Array ? frame : new Uint8Array(frame);\n\t\tprotocol.onFrame(connection, bytes.subarray(1), this.protocolSendFor(connection, protocol), this._protocolContext(connection));\n\t\treturn true;\n\t}\n\t/**\n\t* Fire `onAttach` for **every registered protocol the gate admits** (fresh handshake or\n\t* rehydrate) — deliberately not filtered by the client's advertised caps (A.2.3): the hooks are\n\t* idempotent by contract, so an empty/missing caps list degrades to a no-op on the peer instead\n\t* of a silently missed wake resume. The advertised ids are still recorded (and persisted on the\n\t* binding) as the negotiation facts.\n\t*/\n\t_attachProtocols(connection, advertisedIds) {\n\t\tthis._protoIdsByConn.set(connection, advertisedIds);\n\t\tfor (const protocol of this._protocols.values()) {\n\t\t\tif (!this._gateAdmits(connection, protocol)) continue;\n\t\t\tprotocol.onAttach?.(connection, this.protocolSendFor(connection, protocol), this._protocolContext(connection));\n\t\t}\n\t}\n\t/**\n\t* The secure session for a connection (built lazily on its first secure-mode frame). The\n\t* session owns all crypto/handshake/chain state; the acceptor keeps only the registries.\n\t*/\n\t_sessionFor(connection, security) {\n\t\tlet session = this._sessionByConn.get(connection);\n\t\tif (session == null) {\n\t\t\tconst dictionaryVersion = this._lane.dictionaryVersion;\n\t\t\tif (dictionaryVersion == null) throw new Error(\"WireAcceptor: missing lane dictionaryVersion for a secure session\");\n\t\t\tsession = new AcceptorSecureSession({\n\t\t\t\tlink: security.link,\n\t\t\t\tlocalCoordinate: security.localCoordinate,\n\t\t\t\tdictionaryVersion,\n\t\t\t\tsecurityLevel: security.securityLevel,\n\t\t\t\tverifyKeyResolver: security.verifyKeyResolver,\n\t\t\t\textraCaps: this._protocolCaps(),\n\t\t\t\tnoneAllowed: this._noneAllowed,\n\t\t\t\tsend: (frame, tapLane) => this._writeTapped(connection, frame, tapLane ?? \"handshake\"),\n\t\t\t\tclose: this._close == null ? void 0 : () => this._close?.(connection),\n\t\t\t\ttap: this._tap,\n\t\t\t\tonAuthenticated: (auth) => this._onAuthenticated(connection, auth),\n\t\t\t\troutePlain: (frame, wireBytes) => this._receivePlain(connection, frame, wireBytes),\n\t\t\t\trouteAction: (bytes, wireBytes) => this._routeAuthed(connection, bytes, wireBytes)\n\t\t\t});\n\t\t\tthis._sessionByConn.set(connection, session);\n\t\t}\n\t\treturn session;\n\t}\n\t/** Bind + persist a connection's authenticated identity once its handshake completes. */\n\t_onAuthenticated(connection, auth) {\n\t\tif (this._disposed) return;\n\t\tthis._bind(connection, auth.client, auth.securityLevel);\n\t\tthis._levelByConn.set(connection, auth.securityLevel);\n\t\tthis._lane.onAuthenticated?.(connection, auth);\n\t\tconst advertisedIds = protocolsFromCaps(auth.remoteCaps);\n\t\tthis._attachProtocols(connection, advertisedIds);\n\t\tthis._persist(connection, {\n\t\t\tv: 1,\n\t\t\tclient: auth.client.toJsonObject(),\n\t\t\tsecure: {\n\t\t\t\tsecurityLevel: auth.securityLevel,\n\t\t\t\tlinkedClientId: auth.linkedClientId,\n\t\t\t\tkeyMaterial: auth.keyMaterial\n\t\t\t},\n\t\t\tprotocols: advertisedIds.size > 0 ? [...advertisedIds] : void 0,\n\t\t\tlane: this._lane.bindingState?.(connection)\n\t\t});\n\t}\n\t/** Install (or replace) the binding persistence hook after construction. */\n\tsetOnConnectionBound(onConnectionBound) {\n\t\tthis._onConnectionBound = onConnectionBound;\n\t}\n\t/**\n\t* Plain-path identity binding: bind the connection to a self-asserted client coordinate (the\n\t* lane decoded it off an inbound frame) and persist a fresh binding when the identity is new.\n\t* Secure mode never calls this — the handshake binds the authenticated coordinate instead. While\n\t* another live connection holds that coordinate through a handshake, pushes and\n\t* `connectionForClient` keep resolving to it; the plain claim takes over only once it drops.\n\t*/\n\tbindPlainConnection(connection, client) {\n\t\tif (this._disposed) return;\n\t\tconst isNewBinding = this._clientByConn.get(connection)?.stringId !== client.stringId;\n\t\tthis._bind(connection, client, \"none\");\n\t\tif (isNewBinding) this._persist(connection, {\n\t\t\tv: 1,\n\t\t\tclient: client.toJsonObject(),\n\t\t\tlane: this._lane.bindingState?.(connection)\n\t\t});\n\t}\n\t/**\n\t* Restore a connection→client binding without an inbound frame — for transports that resume\n\t* after eviction. Pair it with `onConnectionBound`: persist the binding there, then replay each\n\t* live connection here when the channel comes back (e.g. a Durable Object iterating\n\t* `ctx.getWebSockets()` as it wakes from hibernation). A binding of an unknown schema version\n\t* is ignored with a warning — the socket is simply treated as fresh (its client re-handshakes).\n\t*/\n\trehydrate(connection, binding) {\n\t\tif (this._disposed) return;\n\t\tif (binding.v !== 1) {\n\t\t\tconsole.warn(`[wire-acceptor] ignored a persisted connection binding of unknown schema version ${JSON.stringify(binding.v)} (expected 1) — treating the connection as fresh (err_nice_wire_connect.binding_version_mismatch).`);\n\t\t\treturn;\n\t\t}\n\t\tconst secure = binding.secure;\n\t\tconst security = this._security;\n\t\tconst level = secure != null && security != null ? secure.securityLevel : \"none\";\n\t\tthis._bind(connection, new RuntimeCoordinate(binding.client), level);\n\t\tthis._bindingByConn.set(connection, binding);\n\t\tthis._lane.restoreBindingState?.(connection, binding.lane);\n\t\tif (secure != null && security != null) {\n\t\t\tthis._levelByConn.set(connection, secure.securityLevel);\n\t\t\tthis._sessionFor(connection, security).rehydrate(secure);\n\t\t}\n\t\tthis._attachProtocols(connection, new Set(binding.protocols ?? []));\n\t}\n\t_persist(connection, binding) {\n\t\tif (this._disposed) return;\n\t\tthis._bindingByConn.set(connection, binding);\n\t\tthis._onConnectionBound?.(connection, binding);\n\t}\n\t_bind(connection, client, level) {\n\t\tconst previous = this._clientByConn.get(connection);\n\t\tif (previous != null && previous.stringId !== client.stringId && this._connByClient.get(previous.stringId) === connection) this._connByClient.delete(previous.stringId);\n\t\tthis._clientByConn.set(connection, client);\n\t\tconst holder = this._connByClient.get(client.stringId);\n\t\tif (level === \"none\" && holder != null && holder !== connection && this.levelFor(holder) !== \"none\") return;\n\t\tthis._connByClient.set(client.stringId, connection);\n\t}\n\t/** Forget a connection (call on socket close) so stale entries don't misroute later traffic. */\n\tdrop(connection) {\n\t\tif (this._disposed) return;\n\t\tthis._drop(connection);\n\t}\n\t/** Internal detach path used once during terminal disposal after public entry points are closed. */\n\t_drop(connection) {\n\t\tconst client = this._clientByConn.get(connection);\n\t\tif (client != null && this._connByClient.get(client.stringId) === connection) this._connByClient.delete(client.stringId);\n\t\tthis._lane.onDrop?.(connection, client);\n\t\tfor (const protocol of this._protocols.values()) protocol.onDetach?.(connection, this._protocolContext(connection));\n\t\tthis._protoIdsByConn.delete(connection);\n\t\tthis._clientByConn.delete(connection);\n\t\tthis._sessionByConn.delete(connection);\n\t\tthis._levelByConn.delete(connection);\n\t\tthis._bindingByConn.delete(connection);\n\t}\n\t/** Send a raw (already lane/protocol-encoded) frame — through the secure session when present. */\n\tsendTo(connection, frame) {\n\t\tif (this._disposed) return;\n\t\tconst lane = this._laneFor(frame);\n\t\tconst session = this._sessionByConn.get(connection);\n\t\tif (session == null) {\n\t\t\tthis._writeTapped(connection, frame, lane);\n\t\t\treturn;\n\t\t}\n\t\tsession.send(frame, lane);\n\t}\n\t/** Live connection for a client coordinate's stringId, if currently registered. */\n\tconnectionForClient(clientStringId) {\n\t\treturn this._connByClient.get(clientStringId);\n\t}\n\t/** The bound client coordinate for a connection, if any. */\n\tclientForConnection(connection) {\n\t\treturn this._clientByConn.get(connection);\n\t}\n\t/** Whether this acceptor currently holds a live connection bound to the client. */\n\townsLiveConnectionFor(clientStringId) {\n\t\treturn this._connByClient.has(clientStringId);\n\t}\n\t/** Whether this acceptor currently tracks `connection`. */\n\thasConnection(connection) {\n\t\treturn this._clientByConn.has(connection);\n\t}\n\t/** Every currently-bound connection (mid-handshake sockets are not yet bound). */\n\tconnections() {\n\t\treturn this._clientByConn.keys();\n\t}\n\t/** The number of currently-bound connections. */\n\tget connectionCount() {\n\t\treturn this._clientByConn.size;\n\t}\n\t/** The connection's negotiated security level (`none` when plain / not yet handshaken). */\n\tlevelFor(connection) {\n\t\treturn this._levelByConn.get(connection) ?? \"none\";\n\t}\n\t_protocolContext(connection) {\n\t\treturn {\n\t\t\tclient: this._clientByConn.get(connection),\n\t\t\tlevel: this._levelByConn.get(connection) ?? \"none\"\n\t\t};\n\t}\n\t/** The last persisted (or rehydrated) binding for a connection, if any. */\n\tbindingFor(connection) {\n\t\treturn this._bindingByConn.get(connection);\n\t}\n\t/** Quiesce permanently: detach every known connection and ignore late/in-flight traffic. */\n\tdispose() {\n\t\tif (this._disposed) return;\n\t\tthis._disposed = true;\n\t\tconst connections = /* @__PURE__ */ new Set([\n\t\t\t...this._clientByConn.keys(),\n\t\t\t...this._sessionByConn.keys(),\n\t\t\t...this._bindingByConn.keys()\n\t\t]);\n\t\tfor (const connection of connections) this._drop(connection);\n\t}\n\tget disposed() {\n\t\treturn this._disposed;\n\t}\n};\nconst createWireAcceptor = (options) => {\n\treturn new WireAcceptor(options);\n};\n//#endregion\n//#region src/wire/PeerLink/ReliableLog.ts\nconst DEFAULT_MAX_GAP_WINDOW = 1024;\nvar ReliableLog = class {\n\t_store;\n\t_serialize;\n\t_deserialize;\n\t_maxGapWindow;\n\t_keepDelivered;\n\tconstructor(store, options) {\n\t\tthis._store = store;\n\t\tthis._serialize = options?.serialize ?? ((payload) => JSON.stringify(payload));\n\t\tthis._deserialize = options?.deserialize ?? ((raw) => JSON.parse(raw));\n\t\tthis._maxGapWindow = options?.maxGapWindow ?? DEFAULT_MAX_GAP_WINDOW;\n\t\tthis._keepDelivered = options?.keepDelivered ?? false;\n\t}\n\t/** Compact delivered history behind the advanced high-water, when retention is configured. */\n\t_compact(streamId, highWater) {\n\t\tif (this._keepDelivered === false) return;\n\t\tconst through = highWater - this._keepDelivered;\n\t\tif (through >= 0) this._store.deleteThrough?.(streamId, through);\n\t}\n\t/**\n\t* Feed one reliable frame. Same three cases as {@link ReliableInbox}, but the frame is persisted first\n\t* (idempotent `insertIgnore`, so a resend is stored once) and the high-water is read from / written to\n\t* the store — so the decision is stable across an eviction:\n\t* - **duplicate** (`seq <= high-water`): dropped from dispatch, re-ack the persisted high-water;\n\t* - **in-order** (`seq === high-water + 1`): deliver it, then drain any persisted contiguous run behind it;\n\t* - **gap** (`seq > high-water + 1`): persist the frame and ack the current high-water (client resends the gap).\n\t*/\n\treceive(streamId, seq, payload) {\n\t\tconst highWater = this._store.getHighWater(streamId);\n\t\tif (seq <= highWater) return {\n\t\t\tdeliver: [],\n\t\t\tack: highWater,\n\t\t\tduplicate: true\n\t\t};\n\t\tif (seq > highWater + 1 && seq - highWater > this._maxGapWindow) return {\n\t\t\tdeliver: [],\n\t\t\tack: highWater,\n\t\t\tduplicate: false\n\t\t};\n\t\tthis._store.insertIgnore(streamId, seq, this._serialize(payload));\n\t\tif (seq !== highWater + 1) return {\n\t\t\tdeliver: [],\n\t\t\tack: highWater,\n\t\t\tduplicate: false\n\t\t};\n\t\tconst deliver = [];\n\t\tlet contiguous = highWater;\n\t\twhile (this._store.has(streamId, contiguous + 1)) {\n\t\t\tcontiguous += 1;\n\t\t\tconst raw = this._store.getPayload(streamId, contiguous);\n\t\t\tif (raw != null) deliver.push(this._deserialize(raw));\n\t\t}\n\t\tthis._store.setHighWater(streamId, contiguous);\n\t\tthis._compact(streamId, contiguous);\n\t\treturn {\n\t\t\tdeliver,\n\t\t\tack: contiguous,\n\t\t\tduplicate: false\n\t\t};\n\t}\n\t/**\n\t* Sender-abandoned skip (see {@link IReliableReceiver.skipTo}): persist the high-water at least past\n\t* `seq`, then drain any *stored* contiguous run that was waiting behind the gap. Stored frames `<= seq`\n\t* that were never delivered stay below the high-water (settled-as-abandoned, never drained) — the skip\n\t* marks them settled without delivering them, mirroring the in-memory inbox.\n\t*/\n\tskipTo(streamId, seq) {\n\t\tconst highWater = this._store.getHighWater(streamId);\n\t\tif (seq <= highWater) return {\n\t\t\tdeliver: [],\n\t\t\tack: highWater,\n\t\t\tduplicate: true\n\t\t};\n\t\tconst deliver = [];\n\t\tlet contiguous = seq;\n\t\twhile (this._store.has(streamId, contiguous + 1)) {\n\t\t\tcontiguous += 1;\n\t\t\tconst raw = this._store.getPayload(streamId, contiguous);\n\t\t\tif (raw != null) deliver.push(this._deserialize(raw));\n\t\t}\n\t\tthis._store.setHighWater(streamId, contiguous);\n\t\tthis._compact(streamId, contiguous);\n\t\treturn {\n\t\t\tdeliver,\n\t\t\tack: contiguous,\n\t\t\tduplicate: false\n\t\t};\n\t}\n\tcontiguousSeq(streamId) {\n\t\treturn this._store.getHighWater(streamId);\n\t}\n\thasStream(streamId) {\n\t\treturn this._store.getHighWater(streamId) >= 0;\n\t}\n\t/**\n\t* {@link IReliableReceiver.forgetStream}: release the stream's rows + high-water (a sender's `rclose`\n\t* reclaim). Needs a store with `deleteStream`; without one the stream is kept, exactly as before.\n\t*/\n\tforgetStream(streamId) {\n\t\tthis._store.deleteStream?.(streamId);\n\t}\n\t/**\n\t* **Producer-side** append: store `payload` as the next in-order frame of a stream and return its\n\t* assigned `seq`. This is the offline/reliable-push recipe's write path — a server appending its own\n\t* pushes to a per-client log (carrying the returned `seq` in the push payload so the client can dedup)\n\t* — replacing the `log.receive(id, log.contiguousSeq(id) + 1, u)` contortion. In-order by\n\t* construction, so it never buffers; if live out-of-order frames were already stored *ahead* of the\n\t* high-water, filling the gap drains them (high-water advances past the run), exactly as `receive`.\n\t*/\n\tappend(streamId, payload) {\n\t\tconst seq = this._store.getHighWater(streamId) + 1;\n\t\tthis.receive(streamId, seq, payload);\n\t\treturn { seq };\n\t}\n\t/**\n\t* The gap-free prefix of a stream — every contiguous payload `0..high-water` in order. This is the\n\t* safe-to-replay catch-up a late joiner (or a reconnecting client that lost its own state) can be sent,\n\t* and the building block the offline server→client push recipe (Phase 6) is assembled from.\n\t*/\n\tcontiguousPrefix(streamId) {\n\t\tconst highWater = this._store.getHighWater(streamId);\n\t\tconst prefix = [];\n\t\tfor (let seq = 0; seq <= highWater; seq++) {\n\t\t\tconst raw = this._store.getPayload(streamId, seq);\n\t\t\tif (raw != null) prefix.push(this._deserialize(raw));\n\t\t}\n\t\treturn prefix;\n\t}\n\t/**\n\t* {@link contiguousPrefix} with each payload's `seq` attached, optionally only the entries after\n\t* `afterSeq`. Pruned or compacted seqs are absent, so the first entry's `seq` says where the stored\n\t* history now starts.\n\t*/\n\tcontiguousEntries(streamId, afterSeq = -1) {\n\t\tconst highWater = this._store.getHighWater(streamId);\n\t\tconst entries = [];\n\t\tfor (let seq = Math.max(afterSeq + 1, 0); seq <= highWater; seq++) {\n\t\t\tconst raw = this._store.getPayload(streamId, seq);\n\t\t\tif (raw != null) entries.push({\n\t\t\t\tseq,\n\t\t\t\tpayload: this._deserialize(raw)\n\t\t\t});\n\t\t}\n\t\treturn entries;\n\t}\n\t/**\n\t* Delete a stream's stored frames with `seq <= through` (the replay recipe's prune, once the consumer\n\t* confirmed them). Clamped to the high-water, so a too-large `through` never touches undelivered frames.\n\t* Returns `false` when the store has no `deleteThrough` and nothing was pruned.\n\t*/\n\tpruneThrough(streamId, through) {\n\t\tif (this._store.deleteThrough == null) return false;\n\t\tconst clamped = Math.min(through, this._store.getHighWater(streamId));\n\t\tif (clamped >= 0) this._store.deleteThrough(streamId, clamped);\n\t\treturn true;\n\t}\n};\n/**\n* An in-memory {@link IReliableLogStore} — used by tests to stand in for a Durable Object's SQL storage. It\n* persists in its own maps, so building a *new* {@link ReliableLog} over the same store instance models an\n* eviction (the process-side log is gone, the storage survives). Not for production — a real deployment\n* backs the port with durable storage (e.g. `ctx.storage.sql`).\n*/\nfunction createMemoryReliableLogStore() {\n\tconst frames = /* @__PURE__ */ new Map();\n\tconst highWater = /* @__PURE__ */ new Map();\n\tconst key = (streamId, seq) => `${streamId}\\u0000${seq}`;\n\treturn {\n\t\tinsertIgnore: (streamId, seq, payload) => {\n\t\t\tconst k = key(streamId, seq);\n\t\t\tif (!frames.has(k)) frames.set(k, payload);\n\t\t},\n\t\thas: (streamId, seq) => frames.has(key(streamId, seq)),\n\t\tgetPayload: (streamId, seq) => frames.get(key(streamId, seq)),\n\t\tgetHighWater: (streamId) => highWater.get(streamId) ?? -1,\n\t\tsetHighWater: (streamId, seq) => void highWater.set(streamId, seq),\n\t\tdeleteThrough: (streamId, through) => {\n\t\t\tfor (let seq = 0; seq <= through; seq++) frames.delete(key(streamId, seq));\n\t\t},\n\t\tdeleteStream: (streamId) => {\n\t\t\tconst prefix = `${streamId}\\u0000`;\n\t\t\tfor (const k of frames.keys()) if (k.startsWith(prefix)) frames.delete(k);\n\t\t\thighWater.delete(streamId);\n\t\t}\n\t};\n}\n//#endregion\nexport { HANDSHAKE_REJECT_ID_PIN_MISMATCH as A, runtimeCoordinateToStringIds as B, isWireConnectionBinding as C, CAP_RELIABLE_STREAMKEY as D, CAP_RELIABLE as E, createStorageTofuVerifyKeyResolver as F, WIRE_SUPPORTED_PROTOCOL_VERSIONS as G, UNSET_RUNTIME_ENV_ID as H, decodeHandshakeMessage as I, err_wire_connect as K, encodeHandshakeMessage as L, createClientHandshake as M, createInMemoryTofuVerifyKeyResolver as N, EHandshakeMessageType as O, createServerHandshake as P, runtimeLinkId as R, clientCoordinateFromAttachment as S, wireBindingFromAttachment as T, UNSET_RUNTIME_PER_ID as U, DEFAULT_TRANSPORT_TIMEOUT as V, WIRE_PROTOCOL_VERSION as W, peekProtocolPrefix as _, AcceptorSecureSession as a, protocolsFromCaps as b, lanelessLane as c, withLinkIdTap as d, createFrameCryptoPipe as f, encodeProtocolFrame as g, WIRE_PROTOCOL_PREFIX_MAX as h, createWireAcceptor as i, HANDSHAKE_REJECT_ID_PROTOCOL_VERSION_MISMATCH as j, ESecurityLevel as k, wireFrameByteSize as l, WIRE_PROTOCOL_PREFIX as m, createMemoryReliableLogStore as n, WIRE_LANELESS_DICTIONARY_VERSION as o, toFrameBytes as p, WireAcceptor as r, lanelessAcceptorLane as s, ReliableLog as t, withExchangeTap as u, protocolCap as v, securityLevelFromAttachment as w, createActionFrameCrypto as x, protocolFramePayload as y, RuntimeCoordinate as z };\n\n//# sourceMappingURL=ReliableLog-DudDQ2zp.mjs.map","import { F as createStorageTofuVerifyKeyResolver, G as WIRE_SUPPORTED_PROTOCOL_VERSIONS, I as decodeHandshakeMessage, K as err_wire_connect, L as encodeHandshakeMessage, M as createClientHandshake, P as createServerHandshake, T as wireBindingFromAttachment, _ as peekProtocolPrefix, b as protocolsFromCaps, c as lanelessLane, d as withLinkIdTap, f as createFrameCryptoPipe, g as encodeProtocolFrame, l as wireFrameByteSize, m as WIRE_PROTOCOL_PREFIX, r as WireAcceptor, s as lanelessAcceptorLane, v as protocolCap, x as createActionFrameCrypto, z as RuntimeCoordinate } from \"./ReliableLog-DudDQ2zp.mjs\";\nimport { Ct as encryptBytesWithAesGcmKey, D as ClientCryptoKeyLink, Tt as decryptBytesWithAesGcmKey, t as unrefTimer, vt as base64ToBytes, yt as bytesToBase64 } from \"./util-DiEla9R9.mjs\";\nimport { pack, unpack } from \"msgpackr\";\n//#region src/wire/Connect/transportRuntime.types.ts\n/**\n* The generic transport-runtime model — the status machine,\n* definition shapes, and cache types the selection layer (`ConnectionTransportManager`) and the\n* per-connection base class (`TransportConnection`) run on. Moved from nice-action's\n* `Transport.types.ts` with the action typing inverted into generics: `RP` (the per-dispatch\n* routing params — nice-action instantiates it with its action route params) and `METHODS` (the\n* finalized send surface — nice-action's `sendActionData` family) are opaque here; wire only\n* relies on the tiny {@link IWireConnectionMethodsBase} lifecycle sliver.\n*/\n/**\n* Carrier-shape class identity: the one carrier-invariant trait the selection layer reasons about —\n* whether a carrier can push unsolicited frames (`duplex`: WS/WebRTC/BLE/in-memory) or only answers a\n* request with a single correlated reply (`exchange`: HTTP). The concrete carrier kind (\"ws\", \"webrtc\",\n* \"http\", …) is a free-form route-info `carrierLabel` for display, not a class tag.\n*/\nlet ETransportShape = /* @__PURE__ */ function(ETransportShape) {\n\tETransportShape[\"duplex\"] = \"duplex\";\n\tETransportShape[\"exchange\"] = \"exchange\";\n\treturn ETransportShape;\n}({});\n/**\n*\n*  TRANSPORT READINESS\n*\n*/\nlet ETransportStatus = /* @__PURE__ */ function(ETransportStatus) {\n\tETransportStatus[\"uninitialized\"] = \"uninitialized\";\n\tETransportStatus[\"unsupported\"] = \"unsupported\";\n\tETransportStatus[\"initializing\"] = \"initializing\";\n\tETransportStatus[\"ready\"] = \"ready\";\n\tETransportStatus[\"failed\"] = \"failed\";\n\treturn ETransportStatus;\n}({});\n//#endregion\n//#region src/wire/Carrier/AcceptorCarrier.ts\n/** Build the inert lifecycle slot shared by duplex acceptor carrier factories. */\nfunction createDuplexCarrierLifecycle(limits) {\n\tlet router;\n\tlet disposed = false;\n\tconst windows = /* @__PURE__ */ new Map();\n\tconst maxFrameBytes = limits?.maxFrameBytes;\n\tconst rate = limits?.rate;\n\tif (maxFrameBytes != null && (!Number.isSafeInteger(maxFrameBytes) || maxFrameBytes <= 0)) throw new Error(\"maxFrameBytes must be a positive safe integer\");\n\tif (rate != null && (!Number.isSafeInteger(rate.maxMessages) || rate.maxMessages <= 0 || !Number.isSafeInteger(rate.windowMs) || rate.windowMs <= 0)) throw new Error(\"inbound rate limits must be positive safe integers\");\n\tconst frameBytes = (frame) => typeof frame === \"string\" ? new TextEncoder().encode(frame).byteLength : frame instanceof ArrayBuffer ? frame.byteLength : frame.byteLength;\n\treturn {\n\t\treceive(connection, frame) {\n\t\t\tif (disposed) return;\n\t\t\tif (router == null) throw new Error(\"acceptor carrier not served yet — activate it before feeding frames\");\n\t\t\tif (maxFrameBytes != null && frameBytes(frame) > maxFrameBytes) {\n\t\t\t\tlimits?.onExceeded(connection, \"frame_bytes\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (rate != null) {\n\t\t\t\tconst now = Date.now();\n\t\t\t\tlet window = windows.get(connection);\n\t\t\t\tif (window == null || now - window.startedAt >= rate.windowMs) {\n\t\t\t\t\twindow = {\n\t\t\t\t\t\tcount: 0,\n\t\t\t\t\t\tstartedAt: now\n\t\t\t\t\t};\n\t\t\t\t\twindows.set(connection, window);\n\t\t\t\t}\n\t\t\t\twindow.count += 1;\n\t\t\t\tif (window.count > rate.maxMessages) {\n\t\t\t\t\tlimits?.onExceeded(connection, \"message_rate\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\trouter.receive(connection, frame);\n\t\t},\n\t\tdrop(connection) {\n\t\t\tif (disposed) return;\n\t\t\twindows.delete(connection);\n\t\t\trouter?.drop(connection);\n\t\t},\n\t\t_activate(liveRouter) {\n\t\t\tif (disposed) throw new Error(\"acceptor carrier already disposed\");\n\t\t\trouter = liveRouter;\n\t\t},\n\t\t_dispose() {\n\t\t\tif (disposed) return;\n\t\t\tdisposed = true;\n\t\t\trouter = void 0;\n\t\t\twindows.clear();\n\t\t}\n\t};\n}\n/** Build a WebSocket acceptor carrier for `serveWire` or `serveChannel`. */\nfunction wsAcceptorCarrier(options) {\n\treturn {\n\t\t...createDuplexCarrierLifecycle(options.inboundLimits),\n\t\tshape: \"duplex\",\n\t\tcarrierLabel: options.carrierLabel ?? \"ws\",\n\t\tsecure: options.secure,\n\t\tsend: options.send,\n\t\tclose: options.close,\n\t\tupgrade: options.upgrade,\n\t\tisUpgrade: options.isUpgrade ?? ((request) => request.headers.get(\"Upgrade\") === \"websocket\"),\n\t\tattachmentStore: options.attachmentStore\n\t};\n}\n//#endregion\n//#region src/wire/Carrier/duplex/inMemory/createInMemoryChannel.ts\n/**\n* Two cross-wired in-process byte channels — a loopback carrier with no socket. The client end is a\n* {@link IDuplexCarrier} you hand to a {@link LinkTransport}; the server end plugs into an\n* `ChannelAcceptor` (`send: (_, f) => serverEndpoint.send(f)`, and `serverEndpoint.onMessage(f =>\n* handler.receive(conn, f))`). Frames are delivered on a microtask, so each side observes the other\n* asynchronously — exactly like a real transport — which makes this ideal for tests and for running\n* two runtimes in one process (or proving a non-WS carrier end to end).\n*/\nfunction createInMemoryChannelPair() {\n\tlet clientMessage;\n\tlet clientClose;\n\tlet serverMessage;\n\tlet serverClose;\n\tlet open = true;\n\tconst closeBoth = () => {\n\t\tif (!open) return;\n\t\topen = false;\n\t\tqueueMicrotask(() => {\n\t\t\tclientClose?.();\n\t\t\tserverClose?.();\n\t\t});\n\t};\n\treturn {\n\t\tclientChannel: {\n\t\t\tready: Promise.resolve(),\n\t\t\tisOpen: () => open,\n\t\t\tsend: (frame) => {\n\t\t\t\tif (!open) return;\n\t\t\t\tqueueMicrotask(() => serverMessage?.(frame));\n\t\t\t},\n\t\t\tattach: ({ onMessage, onClose }) => {\n\t\t\t\tclientMessage = onMessage;\n\t\t\t\tclientClose = onClose;\n\t\t\t},\n\t\t\tclose: closeBoth,\n\t\t\tlabel: \"in-memory\"\n\t\t},\n\t\tserverEndpoint: {\n\t\t\tsend: (frame) => {\n\t\t\t\tif (!open) return;\n\t\t\t\tqueueMicrotask(() => clientMessage?.(frame));\n\t\t\t},\n\t\t\tonMessage: (handler) => {\n\t\t\t\tserverMessage = handler;\n\t\t\t},\n\t\t\tonClose: (handler) => {\n\t\t\t\tserverClose = handler;\n\t\t\t},\n\t\t\tclose: closeBoth\n\t\t}\n\t};\n}\n//#endregion\n//#region src/wire/Carrier/duplex/inMemory/inMemoryCarrier.ts\n/**\n* A loopback duplex carrier with no socket — two cross-wired in-process ends. Ideal for tests and\n* for running two runtimes in one process, or proving a non-WS carrier end to end. The dial\n* context is ignored (the pair is pre-wired), so `TDial` is purely for slot compatibility.\n*/\nfunction inMemoryCarrier(options = {}) {\n\tconst { clientChannel, serverEndpoint } = createInMemoryChannelPair();\n\treturn {\n\t\tcarrier: {\n\t\t\tsecure: options.secure,\n\t\t\tcarrierLabel: \"memory\",\n\t\t\topen: () => clientChannel,\n\t\t\tgetCacheKey: () => [\"memory\"]\n\t\t},\n\t\tserverEndpoint\n\t};\n}\n//#endregion\n//#region src/wire/Carrier/duplex/rtc/rtcDataChannelByteChannel.ts\n/**\n* Adapt a WebRTC `RTCDataChannel` to the carrier-agnostic {@link IDuplexCarrier}, so two browsers\n* (or two mobile apps) linked peer-to-peer — no server in the middle — run the *same* secure session as\n* a WebSocket. Hand it to `createSecureLinkTransport({ openChannel: () => rtcDataChannelByteChannel(dc) })`.\n*\n* The data channel must already be created (its negotiation/signaling is the app's concern); this only\n* drives bytes over it. Binary frames are requested as `ArrayBuffer` so the binary session codec unpacks\n* them synchronously; a `Blob` (if the channel hands one back) is normalized to a buffer.\n*/\nfunction rtcDataChannelByteChannel(dc) {\n\tdc.binaryType = \"arraybuffer\";\n\tlet intentional = false;\n\tlet onMessage;\n\tlet onClose;\n\tconst preAttach = [];\n\tconst deliver = (frame) => {\n\t\tif (onMessage != null) onMessage(frame);\n\t\telse preAttach.push(frame);\n\t};\n\tdc.addEventListener(\"message\", async (event) => {\n\t\tconst frame = await normalizeFrame$1(event.data);\n\t\tif (frame !== void 0) deliver(frame);\n\t});\n\tdc.addEventListener(\"close\", () => {\n\t\tif (!intentional) console.error(\"RTCDataChannel closed\");\n\t\tonClose?.();\n\t});\n\tdc.addEventListener(\"error\", (event) => {\n\t\tconsole.error(\"RTCDataChannel error:\", event);\n\t\tonClose?.();\n\t});\n\treturn {\n\t\tready: new Promise((resolve, reject) => {\n\t\t\tif (dc.readyState === \"open\") {\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdc.addEventListener(\"open\", () => resolve(), { once: true });\n\t\t\tdc.addEventListener(\"error\", (event) => reject(event), { once: true });\n\t\t\tdc.addEventListener(\"close\", () => reject(/* @__PURE__ */ new Error(\"RTCDataChannel closed before open\")), { once: true });\n\t\t}),\n\t\tisOpen: () => dc.readyState === \"open\",\n\t\tsend: (frame) => {\n\t\t\tif (typeof frame === \"string\" || frame instanceof ArrayBuffer) dc.send(frame);\n\t\t\telse dc.send(new Uint8Array(frame));\n\t\t},\n\t\tattach: (handlers) => {\n\t\t\tonMessage = handlers.onMessage;\n\t\t\tonClose = handlers.onClose;\n\t\t\tfor (const frame of preAttach) handlers.onMessage(frame);\n\t\t\tpreAttach.length = 0;\n\t\t},\n\t\tclose: () => {\n\t\t\tintentional = true;\n\t\t\ttry {\n\t\t\t\tdc.close();\n\t\t\t} catch {}\n\t\t},\n\t\tget label() {\n\t\t\treturn dc.label != null && dc.label !== \"\" ? dc.label : void 0;\n\t\t}\n\t};\n}\nasync function normalizeFrame$1(data) {\n\tif (typeof data === \"string\" || data instanceof ArrayBuffer || data instanceof Uint8Array) return data;\n\tif (typeof Blob !== \"undefined\" && data instanceof Blob) return await data.arrayBuffer();\n}\n//#endregion\n//#region src/wire/Carrier/duplex/rtc/rtcCarrier.ts\n/**\n* A WebRTC {@link IWireDuplexCarrierSource} over an already-negotiated `RTCDataChannel` (signaling\n* is the app's concern), generalized over the opaque dial context (E2). Two browsers/apps linked\n* peer-to-peer run the identical secure session as a WebSocket.\n*/\nfunction rtcCarrier(dataChannel, options = {}) {\n\treturn {\n\t\tsecure: options.secure,\n\t\tcarrierLabel: \"webrtc\",\n\t\topen: () => rtcDataChannelByteChannel(dataChannel),\n\t\tgetCacheKey: options.getCacheKey ?? (() => [\"webrtc\"]),\n\t\tgetRouteInfo: options.getRouteInfo\n\t};\n}\n//#endregion\n//#region src/wire/Connect/sanitizeEndpoint.ts\n/**\n* A destination safe to put in diagnostics. Credentials, query parameters, and fragments can carry\n* secrets (capability tokens, signed leases), so only the scheme, host, port, and path survive.\n*/\nfunction sanitizeEndpoint(raw) {\n\tif (raw == null) return void 0;\n\ttry {\n\t\tconst url = new URL(raw);\n\t\tif (url.host !== \"\") {\n\t\t\turl.username = \"\";\n\t\t\turl.password = \"\";\n\t\t\turl.search = \"\";\n\t\t\turl.hash = \"\";\n\t\t\treturn url.toString();\n\t\t}\n\t} catch {}\n\tconst head = raw.split(/[?#]/, 1)[0] ?? \"\";\n\tconst authority = /^([a-z][a-z\\d+.-]*:)?\\/\\//i.exec(head);\n\tif (authority != null) return authority[0] + head.slice(authority[0].length).replace(/^[^/@]*@/, \"\");\n\treturn head.replace(/^[^/]*@/, \"\");\n}\n//#endregion\n//#region src/wire/Carrier/duplex/ws/ws_util.ts\n/**\n* Send a text or binary frame over a socket. A binary formatter may hand back a `Uint8Array` whose\n* backing buffer is typed as `ArrayBufferLike` (msgpackr pools buffers / may be `SharedArrayBuffer`),\n* which `WebSocket.send`'s `BufferSource` parameter rejects — copy it into a fresh `ArrayBuffer`-backed\n* view so the type (and the bytes) are safe to send.\n*/\nfunction sendFrame(ws, data) {\n\tif (typeof data === \"string\" || data instanceof ArrayBuffer) {\n\t\tws.send(data);\n\t\treturn;\n\t}\n\tws.send(new Uint8Array(data));\n}\n/** Compact a WebSocket URL to `host/pathname` for devtools display, falling back to the raw url. */\nfunction shortWs(url) {\n\ttry {\n\t\tconst u = new URL(url);\n\t\treturn `${u.host}${u.pathname}`;\n\t} catch {\n\t\treturn url;\n\t}\n}\n//#endregion\n//#region src/wire/Carrier/duplex/ws/webSocketByteChannel.ts\n/**\n* Adapt a `WebSocket` to the carrier-agnostic {@link IDuplexCarrier}, so the WebSocket becomes\n* \"just another carrier\" under the shared secure session. It owns every WebSocket-specific concern —\n* awaiting `open`, normalizing `Blob` frames to bytes, suppressing the log on a deliberate `close`, and\n* buffering any frame that arrives before the session attaches its handler — leaving the session itself\n* carrier-neutral.\n*/\nfunction webSocketByteChannel(ws) {\n\tlet intentional = false;\n\t/**\n\t* True once the socket actually opened. A failure *before* this is a failed **dial**, not an\n\t* outage: it is reported by rejecting `ready` (and the connector's keep-alive ladder retries it\n\t* with backoff). Logging it here would spam the console on every attempt while a peer boots — the\n\t* routine dev-restart race — so the pre-open path stays silent and lets `ready` do the talking.\n\t*/\n\tlet opened = ws.readyState === WebSocket.OPEN;\n\tlet onMessage;\n\tlet onClose;\n\tconst preAttach = [];\n\tconst deliver = (frame) => {\n\t\tif (onMessage != null) onMessage(frame);\n\t\telse preAttach.push(frame);\n\t};\n\tws.addEventListener(\"open\", () => {\n\t\topened = true;\n\t});\n\tws.addEventListener(\"message\", async (event) => {\n\t\tconst frame = await normalizeFrame(event.data);\n\t\tif (frame !== void 0) deliver(frame);\n\t});\n\tws.addEventListener(\"close\", (event) => {\n\t\tif (opened && !intentional) console.warn(\"WebSocket closed:\", event);\n\t\tonClose?.();\n\t});\n\tws.addEventListener(\"error\", () => {\n\t\tif (opened) console.warn(`WebSocket error: ${describeSocket(ws)}`);\n\t\tonClose?.();\n\t});\n\treturn {\n\t\tready: new Promise((resolve, reject) => {\n\t\t\tif (ws.readyState === WebSocket.OPEN) {\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tws.addEventListener(\"open\", () => resolve(), { once: true });\n\t\t\tws.addEventListener(\"error\", () => reject(dialFailedError(ws)), { once: true });\n\t\t\tws.addEventListener(\"close\", (event) => reject(unreachableError(ws, `WebSocket closed before open (code=${event.code})`)), { once: true });\n\t\t}),\n\t\tisOpen: () => ws.readyState === WebSocket.OPEN,\n\t\tsend: (frame) => sendFrame(ws, frame),\n\t\tattach: (handlers) => {\n\t\t\tonMessage = handlers.onMessage;\n\t\t\tonClose = handlers.onClose;\n\t\t\tfor (const frame of preAttach) handlers.onMessage(frame);\n\t\t\tpreAttach.length = 0;\n\t\t},\n\t\tclose: () => {\n\t\t\tintentional = true;\n\t\t\ttry {\n\t\t\t\tws.close();\n\t\t\t} catch {}\n\t\t},\n\t\tget label() {\n\t\t\treturn ws.url != null && ws.url !== \"\" ? ws.url : void 0;\n\t\t}\n\t};\n}\n/**\n* A failed dial, as a structured error the error pipeline (and a consumer's logs) can actually\n* read. A socket that errors or closes *before* it opened yields no readable response (the browser\n* also hides a refused upgrade's status), so it carries the same typed `endpoint_unreachable` id as\n* the HTTP carrier's `fetch` rejection — that is what\n* makes `EWireConnectFailureKind` trustworthy on both carriers rather than HTTP-only (feedback W3).\n*/\nfunction dialFailedError(ws) {\n\treturn unreachableError(ws, \"WebSocket dial failed\");\n}\nfunction unreachableError(ws, reason) {\n\treturn err_wire_connect.fromId(\"endpoint_unreachable\", {\n\t\turl: ws.url != null && ws.url !== \"\" ? sanitizeEndpoint(ws.url) : void 0,\n\t\tcarrierLabel: \"ws\",\n\t\treason\n\t});\n}\nfunction describeSocket(ws) {\n\treturn (ws.url != null && ws.url !== \"\" ? sanitizeEndpoint(ws.url) : void 0) ?? \"(no url)\";\n}\n/** Accept text + binary frames (ArrayBuffer / Uint8Array / Blob); Blobs are converted to a buffer. */\nasync function normalizeFrame(data) {\n\tif (typeof data === \"string\" || data instanceof ArrayBuffer || data instanceof Uint8Array) return data;\n\tif (typeof Blob !== \"undefined\" && data instanceof Blob) return await data.arrayBuffer();\n}\n//#endregion\n//#region src/wire/Carrier/duplex/ws/wsCarrier.ts\n/**\n* A WebSocket {@link IWireDuplexCarrierSource}: opens an `arraybuffer` socket (cached per endpoint)\n* and adapts it to a carrier — generalized over an opaque dial context (shared connection design,\n* E2), so the URL can be derived from whatever domain concept the consumer threads through\n* (nice-action passes the action being dispatched; a realm-only client passes e.g. a game id).\n*\n* `createRequest` derives the socket URL per dial (keep it simple with `() => ({ url })`), so\n* dynamic endpoints need no socket-construction hook for the URL. `createWebSocket` exists for\n* **testability** — injecting a controllable socket (it is not a URL mechanism).\n*\n* `createRequest` may return **`null`** to mean \"no valid endpoint right now\" — a dynamic-endpoint\n* carrier whose mutable dial context was torn down (`matchId` cleared)\n* signals that instead of dialing garbage. The dial throws `dial_unavailable`, which a keep-alive\n* redial loop parks on (resuming at the next explicit `connect()`/dispatch) — so teardown ordering\n* stops mattering.\n*/\nfunction wsCarrier(request, options = {}) {\n\tconst createRequest = (params) => {\n\t\tconst resolved = typeof request === \"string\" ? request : request(params);\n\t\tif (resolved == null) return null;\n\t\treturn typeof resolved === \"string\" ? { url: resolved } : resolved;\n\t};\n\tconst construct = options.createWebSocket ?? ((url) => new WebSocket(url));\n\treturn {\n\t\tsecure: options.secure,\n\t\tcarrierLabel: \"ws\",\n\t\topen: (params) => {\n\t\t\tconst request = createRequest(params);\n\t\t\tif (request == null) throw err_wire_connect.fromId(\"dial_unavailable\", { carrierLabel: \"ws\" });\n\t\t\tconst ws = construct(request.url);\n\t\t\tws.binaryType = \"arraybuffer\";\n\t\t\treturn webSocketByteChannel(ws);\n\t\t},\n\t\tgetCacheKey: options.getCacheKey ?? ((params) => [createRequest(params)?.url ?? \"ws:(unavailable)\"]),\n\t\tgetRouteInfo: options.getRouteInfo ?? ((params) => {\n\t\t\tconst url = createRequest(params)?.url;\n\t\t\tif (url == null) return {\n\t\t\t\tcarrierLabel: \"ws\",\n\t\t\t\tsummary: \"ws (unavailable)\"\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tcarrierLabel: \"ws\",\n\t\t\t\turl,\n\t\t\t\tsummary: `ws ${shortWs(url)}`\n\t\t\t};\n\t\t})\n\t};\n}\n//#endregion\n//#region src/wire/Connect/endpointEvidence.ts\n/**\n* What a failed dial actually *was* — the typed discriminator a consumer branches on instead of\n* matching error text (meteor-connect-bridge feedback W3). The values are distinct because each\n* one implies a different next step for the developer:\n*\n* - {@link endpoint_answered_non_protocol} — fix the URL, or the proxy/WAF in front of it.\n* - {@link endpoint_unreachable} — no response was received: check the network, the server, and\n*   (in a browser) CORS or a refused WebSocket upgrade, which the platform reports the same way.\n* - {@link handshake_rejected} — it *is* a nice-code backend and it said no (e.g. a pinned\n*   identity): fix the identity or the version, not the address.\n* - {@link protocol_version_mismatch} — the peer explicitly reported no compatible secure-wire\n*   generation; upgrade or roll back one side, then retry explicitly.\n*/\nlet EWireConnectFailureKind = /* @__PURE__ */ function(EWireConnectFailureKind) {\n\tEWireConnectFailureKind[\"endpoint_answered_non_protocol\"] = \"endpoint_answered_non_protocol\";\n\tEWireConnectFailureKind[\"endpoint_unreachable\"] = \"endpoint_unreachable\";\n\tEWireConnectFailureKind[\"handshake_rejected\"] = \"handshake_rejected\";\n\tEWireConnectFailureKind[\"protocol_version_mismatch\"] = \"protocol_version_mismatch\";\n\tEWireConnectFailureKind[\"peer_identity_mismatch\"] = \"peer_identity_mismatch\";\n\tEWireConnectFailureKind[\"unknown\"] = \"unknown\";\n\treturn EWireConnectFailureKind;\n}({});\n/**\n* How much of a non-protocol body an error message may carry. Deliberately short: a WAF's 40 KB\n* HTML page pasted into an error is worse DX than no preview at all.\n*/\nconst BODY_PREVIEW_LIMIT = 200;\n/** Replace C0, DEL, and C1 characters that would corrupt terminals and log lines. */\nfunction replaceControlCharacters(raw) {\n\treturn Array.from(raw, (character) => {\n\t\tconst codePoint = character.codePointAt(0);\n\t\treturn codePoint <= 31 || codePoint >= 127 && codePoint <= 159 ? \" \" : character;\n\t}).join(\"\");\n}\n/**\n* A bounded, single-line, control-character-free head of whatever a non-protocol endpoint sent\n* back — enough to recognize an HTML error page or a proxy banner on sight. Only the *response* is\n* ever summarized: no request headers, no request body.\n*/\nfunction describeNonProtocolBody(raw) {\n\tif (typeof raw !== \"string\") return void 0;\n\tconst flattened = replaceControlCharacters(raw).replace(/\\s+/g, \" \").trim();\n\tif (flattened.length === 0) return void 0;\n\treturn flattened.length > BODY_PREVIEW_LIMIT ? `${flattened.slice(0, BODY_PREVIEW_LIMIT)}…` : flattened;\n}\n/**\n* Classify a dial failure. Reads typed ids only — the ids are raised at the layer that still holds\n* the evidence precisely so this never has to sniff message text.\n*/\nfunction classifyConnectFailure(error) {\n\tif (!err_wire_connect.isExact(error)) return \"unknown\";\n\tif (error.hasId(\"endpoint_answered_non_protocol\")) return \"endpoint_answered_non_protocol\";\n\tif (error.hasId(\"endpoint_unreachable\")) return \"endpoint_unreachable\";\n\tif (error.hasId(\"protocol_version_mismatch\")) return \"protocol_version_mismatch\";\n\tif (error.hasId(\"peer_identity_mismatch\")) return \"peer_identity_mismatch\";\n\tif (error.hasId(\"identity_pin_mismatch\") || error.hasId(\"handshake_rejected\")) return \"handshake_rejected\";\n\treturn \"unknown\";\n}\n/** The endpoint a failure names, when it carries one — the URL actually dialed, sanitized. */\nfunction endpointFromConnectFailure(error) {\n\tif (!err_wire_connect.isExact(error)) return void 0;\n\tif (error.hasId(\"endpoint_answered_non_protocol\")) return sanitizeEndpoint(error.getContext(\"endpoint_answered_non_protocol\").url);\n\tif (error.hasId(\"endpoint_unreachable\")) return sanitizeEndpoint(error.getContext(\"endpoint_unreachable\").url);\n\tif (error.hasId(\"peer_identity_mismatch\")) return sanitizeEndpoint(error.getContext(\"peer_identity_mismatch\").endpoint);\n}\n//#endregion\n//#region src/wire/Carrier/exchange/http/httpCarrier.ts\nfunction isAbortError(error) {\n\treturn error instanceof Error && error.name === \"AbortError\";\n}\n/** The platform's own words for a failed dial — RN's \"Network request failed\", node's\n* `ECONNREFUSED`, a TLS failure. Kept verbatim: it is the most specific thing anyone has. */\nfunction describeFetchRejection(error) {\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\nfunction shortPath(url) {\n\ttry {\n\t\treturn new URL(url).pathname || url;\n\t} catch {\n\t\treturn url;\n\t}\n}\n/**\n* An HTTP {@link IWireExchangeCarrierSource}: each `exchange` POSTs one frame body to the endpoint\n* and resolves with the response body as the single correlated reply — generalized over the opaque\n* dial context (E2). A secure HTTP transport runs the *same* secure session as a duplex carrier\n* (handshake → token → encrypted frames), the request/reply correlation provided for free by the\n* HTTP transaction.\n*\n* `createRequest` derives the URL/headers per dial (keep it simple with `() => ({ url })`). The\n* body is the session's responsibility, so it is never built here.\n*/\nfunction httpCarrier(request, options = {}) {\n\tconst doFetch = options.fetch ?? fetch;\n\tconst createRequest = (params) => {\n\t\tconst resolved = typeof request === \"string\" ? request : request(params);\n\t\tif (resolved == null) return null;\n\t\treturn typeof resolved === \"string\" ? { url: resolved } : resolved;\n\t};\n\treturn {\n\t\tshape: \"exchange\",\n\t\tsecure: options.secure,\n\t\tcarrierLabel: \"http\",\n\t\topen: (params) => {\n\t\t\tconst request = createRequest(params);\n\t\t\tif (request == null) throw err_wire_connect.fromId(\"dial_unavailable\", { carrierLabel: \"http\" });\n\t\t\tconst endpoint = sanitizeEndpoint(request.url);\n\t\t\treturn {\n\t\t\t\tlabel: request.url,\n\t\t\t\texchange: async (frame, opts) => {\n\t\t\t\t\tlet res;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tres = await doFetch(request.url, {\n\t\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t\t\t\t...request.headers\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tbody: typeof frame === \"string\" ? frame : new Uint8Array(frame),\n\t\t\t\t\t\t\tsignal: opts?.signal\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (opts?.signal?.aborted === true || isAbortError(error)) throw error;\n\t\t\t\t\t\tthrow err_wire_connect.fromId(\"endpoint_unreachable\", {\n\t\t\t\t\t\t\turl: endpoint,\n\t\t\t\t\t\t\tcarrierLabel: \"http\",\n\t\t\t\t\t\t\treason: describeFetchRejection(error)\n\t\t\t\t\t\t}).withOriginError(error);\n\t\t\t\t\t}\n\t\t\t\t\tconst body = await res.text();\n\t\t\t\t\tif (!res.ok) throw err_wire_connect.fromId(\"endpoint_answered_non_protocol\", {\n\t\t\t\t\t\tstage: \"http-exchange\",\n\t\t\t\t\t\texpected: \"a nice-wire reply frame\",\n\t\t\t\t\t\turl: endpoint,\n\t\t\t\t\t\thttpStatus: res.status,\n\t\t\t\t\t\tcontentType: res.headers.get(\"content-type\") ?? void 0,\n\t\t\t\t\t\tbodyPreview: describeNonProtocolBody(body)\n\t\t\t\t\t});\n\t\t\t\t\treturn body;\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\tgetCacheKey: options.getCacheKey ?? ((params) => [createRequest(params)?.url ?? \"http:(unavailable)\"]),\n\t\tgetRouteInfo: options.getRouteInfo ?? ((params) => {\n\t\t\tconst request = createRequest(params);\n\t\t\tif (request == null) return {\n\t\t\t\tcarrierLabel: \"http\",\n\t\t\t\tsummary: \"HTTP (unavailable)\"\n\t\t\t};\n\t\t\tconst { url } = request;\n\t\t\treturn {\n\t\t\t\tcarrierLabel: \"http\",\n\t\t\t\tmethod: \"POST\",\n\t\t\t\turl,\n\t\t\t\tsummary: `POST ${shortPath(url)}`\n\t\t\t};\n\t\t})\n\t};\n}\n//#endregion\n//#region src/wire/Connect/Connect.types.ts\n/**\n*\n*  CONNECTION STATUS — the `WireClient` lifecycle model\n*\n*/\nlet EWireConnectionStatus = /* @__PURE__ */ function(EWireConnectionStatus) {\n\t/** Built, never dialed — `connect()` not yet called. */\n\tEWireConnectionStatus[\"idle\"] = \"idle\";\n\t/** Dialing + handshaking the transport chain for the first time. */\n\tEWireConnectionStatus[\"connecting\"] = \"connecting\";\n\t/** Handshake complete on the active transport; protocols may speak. */\n\tEWireConnectionStatus[\"ready\"] = \"ready\";\n\t/** A previously-ready connection dropped; the client is re-establishing it. */\n\tEWireConnectionStatus[\"reconnecting\"] = \"reconnecting\";\n\t/** The transport chain is exhausted (see `err_wire_connect`) — terminal until `connect()` is called again. */\n\tEWireConnectionStatus[\"failed\"] = \"failed\";\n\t/** Deliberately closed via `close()` — terminal. */\n\tEWireConnectionStatus[\"closed\"] = \"closed\";\n\treturn EWireConnectionStatus;\n}({});\n//#endregion\n//#region src/wire/Connect/ConnectionTransportManager.ts\n/**\n* Preference-ordered transport selection over a shared connection cache — moved from nice-action\n* with the routing params (`RP`), finalized methods\n* (`METHODS`), and connection type (`CONN`) generic. Behavior is byte-for-byte the pre-move\n* logic: strict preference order with parallel warm-up, cache adoption guarded against teardown\n* races, and disconnect-driven eviction.\n*/\nvar ConnectionTransportManager = class {\n\t_cache;\n\t_errors;\n\t_transports = [];\n\tconstructor(_cache, _errors) {\n\t\tthis._cache = _cache;\n\t\tthis._errors = _errors;\n\t}\n\taddTransport(transport) {\n\t\tthis._transports.push(transport);\n\t}\n\t/**\n\t* The highest-priority transport (first declared). Used to label a dispatch's route *before* the\n\t* transport has finished connecting — so a still-connecting dispatch shows its (expected)\n\t* destination instead of an \"unknown\" hop. {@link getReadyTransport} still decides the real winner,\n\t* and the caller corrects the hop if a lower-priority transport ends up serving it.\n\t*/\n\tgetPreferredTransport() {\n\t\treturn this._transports[0];\n\t}\n\tasync getReadyTransport(input) {\n\t\tconst candidates = [];\n\t\tconst unavailableTransports = [];\n\t\tfor (const transport of this._transports) {\n\t\t\tlet cacheKey = null;\n\t\t\ttry {\n\t\t\t\tif (!transport.isAvailable(input)) {\n\t\t\t\t\tunavailableTransports.push(transport);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcacheKey = transport.getCacheKey(input);\n\t\t\t\tif (cacheKey != null) {\n\t\t\t\t\tconst cached = this._cache.get(cacheKey);\n\t\t\t\t\tif (cached != null) {\n\t\t\t\t\t\tif (cached instanceof Promise) {\n\t\t\t\t\t\t\tcandidates.push({\n\t\t\t\t\t\t\t\ttransport,\n\t\t\t\t\t\t\t\tpromise: cached,\n\t\t\t\t\t\t\t\tcacheKey,\n\t\t\t\t\t\t\t\tfresh: false\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcandidates.push({\n\t\t\t\t\t\t\ttransport,\n\t\t\t\t\t\t\tpromise: Promise.resolve({\n\t\t\t\t\t\t\t\t...cached,\n\t\t\t\t\t\t\t\ttransport\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcacheKey,\n\t\t\t\t\t\t\tfresh: false\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst statusInfo = transport.getTransport(input);\n\t\t\t\tif (statusInfo.status === \"ready\") {\n\t\t\t\t\tconst readyData = statusInfo.readyData;\n\t\t\t\t\tif (cacheKey != null) {\n\t\t\t\t\t\tconst key = cacheKey;\n\t\t\t\t\t\tconst entry = {\n\t\t\t\t\t\t\tmethods: readyData,\n\t\t\t\t\t\t\ttransport\n\t\t\t\t\t\t};\n\t\t\t\t\t\tthis._cache.set(key, entry);\n\t\t\t\t\t\treadyData.addOnDisconnectListener?.(() => {\n\t\t\t\t\t\t\tif (this._cache.get(key) === entry) this._cache.delete(key);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tcandidates.push({\n\t\t\t\t\t\ttransport,\n\t\t\t\t\t\tpromise: Promise.resolve({\n\t\t\t\t\t\t\tmethods: readyData,\n\t\t\t\t\t\t\ttransport\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tcacheKey,\n\t\t\t\t\t\tfresh: true\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (statusInfo.status === \"unsupported\") {\n\t\t\t\t\tunavailableTransports.push(transport);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (statusInfo.status === \"initializing\") {\n\t\t\t\t\tconst key = cacheKey;\n\t\t\t\t\tconst promise = statusInfo.initializationPromise.then((info) => {\n\t\t\t\t\t\tif (info.status === \"failed\") throw info.error;\n\t\t\t\t\t\tif (info.status === \"unsupported\") throw this._errors.unsupported([transport.type]);\n\t\t\t\t\t\tconst readyData = info.readyData;\n\t\t\t\t\t\tconst entry = {\n\t\t\t\t\t\t\tmethods: readyData,\n\t\t\t\t\t\t\ttransport\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (key != null) if (this._cache.get(key) === promise) {\n\t\t\t\t\t\t\tthis._cache.set(key, entry);\n\t\t\t\t\t\t\treadyData.addOnDisconnectListener?.(() => {\n\t\t\t\t\t\t\t\tif (this._cache.get(key) === entry) this._cache.delete(key);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else readyData.disconnect?.();\n\t\t\t\t\t\treturn entry;\n\t\t\t\t\t}).catch((e) => {\n\t\t\t\t\t\tif (key != null && this._cache.get(key) === promise) this._cache.delete(key);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t});\n\t\t\t\t\tpromise.catch(() => {});\n\t\t\t\t\tif (key != null) this._cache.set(key, promise);\n\t\t\t\t\tcandidates.push({\n\t\t\t\t\t\ttransport,\n\t\t\t\t\t\tpromise,\n\t\t\t\t\t\tcacheKey: key,\n\t\t\t\t\t\tfresh: true\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (isDialUnavailable$1(e)) {\n\t\t\t\t\tif (candidates.length === 0) throw e;\n\t\t\t\t\tunavailableTransports.push(transport);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst failed = Promise.reject(e);\n\t\t\t\tfailed.catch(() => {});\n\t\t\t\tcandidates.push({\n\t\t\t\t\ttransport,\n\t\t\t\t\tpromise: failed,\n\t\t\t\t\tcacheKey,\n\t\t\t\t\tfresh: true,\n\t\t\t\t\tcallerThrew: true\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tif (candidates.length === 0) {\n\t\t\tif (unavailableTransports.length > 0) throw this._errors.unsupported(unavailableTransports.map((t) => t.type));\n\t\t\tthrow this._errors.notFound(input);\n\t\t}\n\t\tlet lastError;\n\t\tlet lastTransport;\n\t\tlet lastCallerThrew = false;\n\t\tfor (const candidate of candidates) {\n\t\t\tlet ready;\n\t\t\ttry {\n\t\t\t\tready = await candidate.promise;\n\t\t\t} catch (e) {\n\t\t\t\tif (isTerminalSelectionError(e)) {\n\t\t\t\t\tthis._abandonWarmUps(candidates, candidate);\n\t\t\t\t\tthrow this._withDialedEndpoint(e, candidate.transport, input);\n\t\t\t\t}\n\t\t\t\tlastError = e;\n\t\t\t\tlastTransport = candidate.transport;\n\t\t\t\tlastCallerThrew = candidate.callerThrew === true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tready.methods.onSelected?.();\n\t\t\treturn ready;\n\t\t}\n\t\tif (err_wire_connect.isExact(lastError) && (lastError.hasId(\"dial_unavailable\") || lastError.hasId(\"identity_pin_mismatch\") || lastError.hasId(\"protocol_version_mismatch\") || lastError.hasId(\"peer_identity_mismatch\"))) throw lastError;\n\t\tif (lastCallerThrew && !err_wire_connect.isExact(lastError)) throw lastError;\n\t\tthrow this._errors.initializationFailed(input, {\n\t\t\tcause: describeTransportFailure(lastError),\n\t\t\tendpoint: endpointFromConnectFailure(lastError) ?? routeEndpoint(lastTransport, input),\n\t\t\tkind: classifyConnectFailure(lastError),\n\t\t\torigin: lastError\n\t\t});\n\t}\n\t/**\n\t* Close the parallel warm-ups this selection started besides `failed`. Each one's cache slot is\n\t* released so a later dispatch re-dials; a warm-up still connecting closes itself when it lands.\n\t*/\n\t_abandonWarmUps(candidates, failed) {\n\t\tfor (const candidate of candidates) {\n\t\t\tif (candidate === failed || !candidate.fresh) continue;\n\t\t\tconst key = candidate.cacheKey;\n\t\t\tif (key != null && this._cache.get(key) === candidate.promise) this._cache.delete(key);\n\t\t\tcandidate.promise.then((entry) => {\n\t\t\t\tif (key == null) {\n\t\t\t\t\tentry.methods.disconnect?.();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst cached = this._cache.get(key);\n\t\t\t\tif (cached != null && !(cached instanceof Promise) && cached.methods === entry.methods) {\n\t\t\t\t\tthis._cache.delete(key);\n\t\t\t\t\tentry.methods.disconnect?.();\n\t\t\t\t}\n\t\t\t}, () => {});\n\t\t}\n\t}\n\t/** Attach the sanitized dialed endpoint to a peer-identity mismatch that lacks one. */\n\t_withDialedEndpoint(error, transport, input) {\n\t\tif (!err_wire_connect.isExact(error) || !error.hasId(\"peer_identity_mismatch\")) return error;\n\t\tconst context = error.getContext(\"peer_identity_mismatch\");\n\t\tif (context.endpoint != null) return error;\n\t\tconst endpoint = routeEndpoint(transport, input);\n\t\tif (endpoint == null) return error;\n\t\treturn err_wire_connect.fromId(\"peer_identity_mismatch\", {\n\t\t\t...context,\n\t\t\tendpoint\n\t\t}).withOriginError(error);\n\t}\n};\nconst isDialUnavailable$1 = (error) => err_wire_connect.isExact(error) && error.hasId(\"dial_unavailable\");\nconst isTerminalSelectionError = (error) => err_wire_connect.isExact(error) && (error.hasId(\"peer_identity_mismatch\") || error.hasId(\"protocol_version_mismatch\"));\n/** The transport's sanitized route URL for diagnostics; a throwing route resolver yields none. */\nfunction routeEndpoint(transport, input) {\n\tif (transport == null) return void 0;\n\ttry {\n\t\treturn sanitizeEndpoint(transport.getRouteInfo(input)?.url);\n\t} catch {\n\t\treturn;\n\t}\n}\n/**\n* A short, human-readable reason for a transport failing to connect — surfaced in the\n* consumer's initialization-failed message so the caller sees *why* (e.g. a rejected handshake) rather\n* than a bare \"not ready\". The full error is still attached as the origin error for the complete\n* chain/stack.\n*/\nfunction describeTransportFailure(error) {\n\tif (error == null) return void 0;\n\tif (error instanceof Error) return error.message;\n\tif (typeof error === \"string\") return error;\n\treturn String(error);\n}\n//#endregion\n//#region src/wire/crypto/securityLevelOrder.ts\n/**\n* A total order over {@link ESecurityLevel}. The enum is **string**-valued (`\"none\"` /\n* `\"authenticated\"` / `\"encrypted\"`), so `>=` on the values themselves is meaningless — a consumer\n* comparing \"does this connection meet the required level\" needs an explicit rank. This is the one\n* shared rank so every caller (the realm attach gate, the client-side assertion) compares levels\n* identically; a divergent ad-hoc comparison is exactly how a security floor silently inverts.\n*\n* Higher rank = stronger protection: `none` (0) < `authenticated` (1) < `encrypted` (2).\n*/\nconst SECURITY_LEVEL_RANK = {\n\t[\"none\"]: 0,\n\t[\"authenticated\"]: 1,\n\t[\"encrypted\"]: 2\n};\n/** `true` when `actual` meets or exceeds the `required` level (the \"is this connection good enough\" test). */\nfunction securityLevelMeets(actual, required) {\n\treturn SECURITY_LEVEL_RANK[actual] >= SECURITY_LEVEL_RANK[required];\n}\n//#endregion\n//#region src/wire/Connect/WireClient.ts\n/**\n* The carrier said \"no valid endpoint right now\" (`createRequest` returned null). A policy signal,\n* not a failure: the redial loop PARKS on it (no backoff churn, no garbage\n* dial) and resumes at the next explicit `connect()`/dispatch. The transport selection rethrows it\n* unwrapped so this check is reliable.\n*/\nconst isDialUnavailable = (e) => err_wire_connect.isExact(e) && e.hasId(\"dial_unavailable\");\n/**\n* A dial failure the backoff ladder must PARK on instead of retrying: either no endpoint exists\n* right now ({@link isDialUnavailable}), or the peer rejected the handshake with\n* `identity_pin_mismatch` (the peer has a different key pinned) or\n* `protocol_version_mismatch` (the two builds have no compatible secure-wire generation).\n* Parking is not terminal: the next explicit `connect()`/dispatch may try again after the app has\n* upgraded or changed endpoints. Other handshake rejections (e.g. a dictionary mismatch) retain\n* the existing retry behavior because a matching deploy can heal them.\n*/\nconst isParkedDialRejection = (e) => isDialUnavailable(e) || err_wire_connect.isExact(e) && (e.hasId(\"identity_pin_mismatch\") || e.hasId(\"protocol_version_mismatch\") || e.hasId(\"peer_identity_mismatch\"));\n/**\n* The dial-out connection: owns the transport cache, preference-ordered selection, the protocol mux,\n* and the whole **connection lifecycle** — establishment bookkeeping, the keep-alive redial ladder\n* (backoff + jitter + park), link-state events, and the teardown verbs. A protocol module (a realm\n* client, via `realmConnection`) rides it structurally through `wireMux` + `localCoordinate` +\n* `securityLevel` + `requestReconnect` + `addLinkEventListener`; a lane (nice-action's\n* `ChannelConnector`) composes routing/reliability on top and delegates every lifecycle verb here.\n* `createWireClient` (the public facade) wraps one of these with the status model + DX.\n*/\nvar WireClient = class {\n\tmux;\n\t/** The peer this connection dials — `externalClient` for its dials, and the realm's devtools peer. */\n\tpeer;\n\t/** This connection's local dial identity (see options). */\n\tlocalCoordinate;\n\t/** The negotiated wire security level frame protocols ride at (realm reads it via `realmConnection`). */\n\tsecurityLevel;\n\t/** Whether this connection can carry an unsolicited push (any duplex transport). */\n\tcanPush;\n\t_cache = /* @__PURE__ */ new Map();\n\t_manager;\n\t_buildConnectInput;\n\t_defaultLocalCoordinate;\n\t_linkEventListeners = /* @__PURE__ */ new Set();\n\t/** When the current outage began (the `link_down` instant); `undefined` while up / never dialed. */\n\t_downSince;\n\t/**\n\t* The methods of the *current* link — dedups `link_up` (every dispatch re-runs\n\t* `_onLinkEstablished` with the cached connection) and lets a stale connection's late close be\n\t* ignored (a slow socket close arriving after the replacement link is already up must not read\n\t* as an outage).\n\t*/\n\t_currentLinkMethods;\n\t/**\n\t* App-initiated teardown latch: `releaseLink()` / `clearTransportCache()` / `dispose()` are\n\t* intentional releases, NOT outages — so a **late** carrier close from the released socket must\n\t* emit no `link_down`. Set by those teardowns, cleared by the next `_onLinkEstablished` (a fresh\n\t* link means we're back). `debug.dropLink` deliberately does NOT set it — a dropped link IS an\n\t* outage, and it emits `link_down` at close.\n\t*/\n\t_tornDown = false;\n\t/** Explicit opt-out; `undefined` = auto (on for a protocol-carrying duplex link). */\n\t_reconnectOption;\n\t/** Connections we've hooked a reconnect listener onto (once per connection). */\n\t_reconnectHooked = /* @__PURE__ */ new WeakSet();\n\t_redialTimer;\n\t_redialAttempts = 0;\n\t/** Set by an explicit teardown so the resulting disconnect doesn't auto-redial; cleared on a fresh establish. */\n\t_suppressRedial = false;\n\t/** Timer ending a `debug.dropLink` suppression window. */\n\t_debugResumeTimer;\n\t_disposed = false;\n\t/**\n\t* Chaos/QA surface — stable API, but never for production control flow.\n\t* The \"simulate airplane mode\" button: manual QA and consumer resilience tests use it to force\n\t* the outages that page-level interception can't (the keep-alive redial heals straight through\n\t* a `window.WebSocket` patch).\n\t*/\n\tdebug = { \n\t/**\n\t* Force-close the live duplex link — a *real* close (the server observes it), unlike a\n\t* browser's offline mode which leaves the socket half-open — and optionally suppress the\n\t* keep-alive auto-redial for a window, simulating a sustained outage.\n\t*\n\t* - `suppressRedialMs` omitted/`0`: drop only — keep-alive (when active) heals on its\n\t*   ordinary backoff ladder (first rung ~1 s), so a bare `dropLink({})` is a faithful\n\t*   *fast-blip* simulator: the local close notifies the session immediately, it does NOT wait\n\t*   for the carrier's platform close event.\n\t* - `suppressRedialMs > 0`: no auto-redial until the window ends, then the backoff loop\n\t*   resumes. A second `dropLink` during a window replaces it; an explicit `connect()` /\n\t*   dispatch / `reconnectLink()` during the window ends it early (fresh establishment always\n\t*   re-enables keep-alive); `dispose()` wins over a pending resume.\n\t*\n\t* `link_down` fires **now, at close** — synchronously, before the socket teardown — so the\n\t* observation is truthful regardless of how long the underlying carrier takes to deliver its\n\t* own close callback (a real WebSocket's `onclose` can lag the outage by seconds; the\n\t* suppression window suppresses only the *redial*, never the *observation of the drop*). The\n\t* heal is equally decoupled: a deliberate local close notifies the session's disconnect\n\t* fan-out immediately (the auto-redial trigger), and the carrier's eventual platform close is\n\t* deduped by the `_downSince` guard — so exactly one `link_down` is emitted, `link_up.downForMs`\n\t* measures the full outage, and the redial does not wait out the platform's close lag.\n\t*\n\t* Resolves once the local teardown ran (in-flight dials are disconnected as they land).\n\t*/\ndropLink: async (opts) => {\n\t\tif (this._disposed) return;\n\t\tconst windowMs = opts?.suppressRedialMs ?? 0;\n\t\tthis._cancelDebugResume();\n\t\tif (this._currentLinkMethods != null && this._downSince == null) {\n\t\t\tthis._downSince = Date.now();\n\t\t\tthis._emitLinkEvent({ type: \"link_down\" });\n\t\t}\n\t\tif (windowMs > 0) {\n\t\t\tthis._suppressRedial = true;\n\t\t\tthis._cancelRedial();\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tthis._debugResumeTimer = void 0;\n\t\t\t\tif (this._disposed) return;\n\t\t\t\tthis._suppressRedial = false;\n\t\t\t\tthis._scheduleRedial();\n\t\t\t}, windowMs);\n\t\t\tunrefTimer(timer);\n\t\t\tthis._debugResumeTimer = timer;\n\t\t}\n\t\tthis.clearCache();\n\t} };\n\tconstructor(options) {\n\t\tthis.mux = options.mux;\n\t\tthis.peer = options.peer;\n\t\tthis.localCoordinate = options.localCoordinate;\n\t\tthis.securityLevel = options.securityLevel ?? \"none\";\n\t\tthis.canPush = options.canPush;\n\t\tif (options.reconnect != null && options.keepLinkAlive != null) throw err_wire_connect.fromId(\"conflicting_connect_options\", { detail: \"WireClient: pass only `reconnect`; `keepLinkAlive` is deprecated\" });\n\t\tthis._reconnectOption = options.reconnect ?? options.keepLinkAlive;\n\t\tthis._buildConnectInput = options.buildConnectInput;\n\t\tthis._defaultLocalCoordinate = options.defaultLocalCoordinate;\n\t\tthis._manager = options.createManager(this._cache);\n\t}\n\t/** Register one live connection, in preference order (first added = preferred). */\n\taddTransport(connection) {\n\t\tthis._manager.addTransport(connection);\n\t}\n\t/** The highest-priority transport (first declared) — see the manager's doc. */\n\tgetPreferredTransport() {\n\t\treturn this._manager.getPreferredTransport();\n\t}\n\t/**\n\t* Select (establishing if needed) the transport that should carry this dispatch, and run the\n\t* link-establishment bookkeeping as a side effect — so *any* caller (a lane dispatch or this\n\t* client's own `connect()`) re-enables keep-alive, resets the backoff ladder, and emits `link_up`\n\t* on a genuinely new link, without having to orchestrate it. Idempotent per link\n\t* (`_onLinkEstablished` dedups on identity).\n\t*/\n\tasync getReadyTransport(input) {\n\t\tconst ready = await this._manager.getReadyTransport(input);\n\t\tthis._onLinkEstablished(ready.methods);\n\t\treturn ready;\n\t}\n\t/**\n\t* The frame-protocol mux riding this connection's link — protocol modules (a realm client)\n\t* register here. Register protocols *before* {@link connect} / the first dispatch so the\n\t* handshake advertises them.\n\t*/\n\tget wireMux() {\n\t\treturn this.mux;\n\t}\n\t/** @deprecated Use {@link peer}. */\n\tget peerClient() {\n\t\treturn this.peer;\n\t}\n\t/**\n\t* The re-dial hook a realm client rides:\n\t* `realmConnection(client)` reads it and hands it to the realm engine as the connection\n\t* adapter's `requestReconnect`, invoked on an unanswered staleness probe. A bound closure, so it\n\t* survives being detached from `this` (the realm stores the reference and calls it later).\n\t*/\n\tget requestReconnect() {\n\t\treturn () => void this.reconnectLink();\n\t}\n\t/** Keep-alive is active for a protocol-carrying duplex link (a realm) unless opted out (Phase 8b). */\n\tget _shouldReconnect() {\n\t\tif (this._disposed || !this.canPush) return false;\n\t\tif (this._reconnectOption != null) return this._reconnectOption;\n\t\treturn (this.mux?.localCaps().length ?? 0) > 0;\n\t}\n\t/** Called on every fresh link establishment (`connect()` / a redial): re-enable + hook keep-alive. */\n\t_onLinkEstablished(methods) {\n\t\tconst isNewLink = methods !== this._currentLinkMethods;\n\t\tthis._currentLinkMethods = methods;\n\t\tthis._suppressRedial = false;\n\t\tthis._tornDown = false;\n\t\tthis._redialAttempts = 0;\n\t\tthis._cancelRedial();\n\t\tthis._cancelDebugResume();\n\t\tthis._hookKeepAlive(methods);\n\t\tif (isNewLink) {\n\t\t\tconst downForMs = this._downSince != null ? Date.now() - this._downSince : void 0;\n\t\t\tthis._downSince = void 0;\n\t\t\tthis._emitLinkEvent({\n\t\t\t\ttype: \"link_up\",\n\t\t\t\tdownForMs\n\t\t\t});\n\t\t}\n\t}\n\t/** Attach the auto-redial disconnect listener to one connection, once (Phase 8b). */\n\t_hookKeepAlive(methods) {\n\t\tif (methods.addOnDisconnectListener == null || this._reconnectHooked.has(methods)) return;\n\t\tthis._reconnectHooked.add(methods);\n\t\tmethods.addOnDisconnectListener(() => {\n\t\t\tif (methods !== this._currentLinkMethods) return;\n\t\t\tif (this._tornDown) return;\n\t\t\tif (this._downSince == null) {\n\t\t\t\tthis._downSince = Date.now();\n\t\t\t\tthis._emitLinkEvent({ type: \"link_down\" });\n\t\t\t}\n\t\t\tif (this._shouldReconnect && !this._suppressRedial) this._scheduleRedial();\n\t\t});\n\t}\n\t/** Schedule one backoff+jitter re-dial (Phase 8b); idempotent — one attempt pending at a time. */\n\t_scheduleRedial() {\n\t\tif (!this._shouldReconnect || this._suppressRedial || this._redialTimer != null) return;\n\t\tconst ceiling = Math.min(1e3 * 2 ** this._redialAttempts, 3e4);\n\t\tconst delay = ceiling / 2 + Math.random() * (ceiling / 2);\n\t\tthis._redialAttempts += 1;\n\t\tthis._emitLinkEvent({\n\t\t\ttype: \"redial_scheduled\",\n\t\t\tattempt: this._redialAttempts,\n\t\t\tdelayMs: Math.round(delay)\n\t\t});\n\t\tconst timer = setTimeout(() => {\n\t\t\tthis._redialTimer = void 0;\n\t\t\tthis.connect().catch(() => {});\n\t\t}, delay);\n\t\tunrefTimer(timer);\n\t\tthis._redialTimer = timer;\n\t}\n\t_cancelRedial() {\n\t\tif (this._redialTimer != null) {\n\t\t\tclearTimeout(this._redialTimer);\n\t\t\tthis._redialTimer = void 0;\n\t\t}\n\t}\n\t_cancelDebugResume() {\n\t\tif (this._debugResumeTimer != null) {\n\t\t\tclearTimeout(this._debugResumeTimer);\n\t\t\tthis._debugResumeTimer = void 0;\n\t\t}\n\t}\n\t/**\n\t* Establish the connection without dispatching anything: dial the preferred transport, run its\n\t* handshake, and attach the mux — so a realm-only (actionless) client can\n\t* exist. Idempotent: the connection cache shares one in-flight establishment, so concurrent and\n\t* repeat calls coalesce; resolves when the handshake completes, rejects when the transport\n\t* chain is exhausted. The carriers receive actionless dial params.\n\t*\n\t* **A failed dial arms the keep-alive backoff ladder** (when keep-alive is on) rather than leaving\n\t* the connection idle: the classic cold start — the app loads before the backend finished booting —\n\t* heals on its own instead of needing a page reload. The rejection still propagates, so the caller\n\t* still sees the first failure; the retries continue in the background (observe them via\n\t* `addLinkEventListener`'s `redial_scheduled` / `link_up`).\n\t*\n\t* Two rejections park the ladder instead of arming it (no background retry follows):\n\t* `dial_unavailable` (no endpoint right now) and `identity_pin_mismatch` (the peer has a\n\t* different verify key pinned for this client identity — permanent for this identity+key pair).\n\t*/\n\tasync connect(config) {\n\t\tconst localClient = config?.localCoordinate ?? this.localCoordinate ?? this._defaultLocalCoordinate?.();\n\t\tif (localClient == null) throw err_wire_connect.fromId(\"connect_exhausted\", {\n\t\t\tpeerId: this.peer.stringId,\n\t\t\tattempted: []\n\t\t});\n\t\ttry {\n\t\t\tawait this.getReadyTransport(this._buildConnectInput({\n\t\t\t\tlocalClient,\n\t\t\t\texternalClient: this.peer\n\t\t\t}));\n\t\t} catch (e) {\n\t\t\tif (!isParkedDialRejection(e)) this._scheduleRedial();\n\t\t\tthrow e;\n\t\t}\n\t}\n\t/**\n\t* Tear down the (possibly half-open) duplex link and immediately re-dial it (the reconnect contract / Phase\n\t* 8b). Surfaced to a realm client as the connection adapter's `requestReconnect` (via\n\t* {@link requestReconnect}) — the staleness-probe escalation calls it when a probe goes\n\t* unanswered. On a successful re-dial the mux re-attaches and every realm re-hellos; a failure\n\t* falls into the keep-alive backoff loop when enabled, else the next probe retries.\n\t*\n\t* **Awaitable** — resolves when the fresh link's handshake completes, rejects when the transport\n\t* chain is exhausted (after which the keep-alive backoff continues, when enabled). Bind a\n\t* \"retry now\" button to this instead of waiting out the backoff ladder.\n\t*/\n\tasync reconnectLink() {\n\t\tthis._cancelRedial();\n\t\tthis._suppressRedial = true;\n\t\tthis.clearCache();\n\t\ttry {\n\t\t\tawait this.connect();\n\t\t} catch (e) {\n\t\t\tthis._suppressRedial = false;\n\t\t\tif (!isParkedDialRejection(e)) this._scheduleRedial();\n\t\t}\n\t}\n\t/**\n\t* Stop the keep-alive auto-redial and release the current link — the intention-revealing\n\t* teardown counterpart of `reconnect`. Call this when a session is\n\t* over (leaving a match, logging out): the link closes and stays closed until the next explicit\n\t* `connect()`/dispatch. Not terminal (unlike {@link dispose}) — the client is reusable.\n\t*/\n\treleaseLink() {\n\t\tthis.clearTransportCache();\n\t}\n\t/**\n\t* Drop the connection cache (closing any live socket) without the keep-alive auto-redial — the\n\t* app asked for the link to drop; a later explicit `connect()`/dispatch re-enables keep-alive.\n\t* (Contrast {@link reconnectLink}, which drops then re-dials.) An app-initiated release is not an\n\t* outage, so the released socket's late close stays silent (no spurious `link_down`).\n\t*/\n\tclearTransportCache() {\n\t\tthis._suppressRedial = true;\n\t\tthis._tornDown = true;\n\t\tthis._cancelRedial();\n\t\tthis._cancelDebugResume();\n\t\tthis.clearCache();\n\t}\n\t/**\n\t* Permanently stop this client (Phase 8b): cancel any pending auto-redial and drop the connection\n\t* cache. After this, keep-alive never re-dials again (an explicit, final teardown — distinct from\n\t* {@link clearTransportCache}, which an app may use to force a fresh connection).\n\t*/\n\tdispose() {\n\t\tthis._disposed = true;\n\t\tthis._tornDown = true;\n\t\tthis._cancelRedial();\n\t\tthis._cancelDebugResume();\n\t\tthis.clearCache();\n\t}\n\t/**\n\t* Close any live long-lived connection (e.g. a WebSocket) before dropping it, so a teardown\n\t* actually releases the socket instead of leaving it open until GC. HTTP/stateless transports\n\t* don't implement `disconnect`, so they're simply forgotten.\n\t*\n\t* @internal Bare cache drop with no redial suppression. Apps call {@link clearTransportCache} or\n\t* {@link releaseLink} instead.\n\t*/\n\tclearCache() {\n\t\tfor (const entry of this._cache.values()) if (entry instanceof Promise) entry.then((ready) => ready.methods.disconnect?.()).catch(() => {});\n\t\telse entry.methods.disconnect?.();\n\t\tthis._cache.clear();\n\t}\n\t/**\n\t* Observe transport link-state: `link_down`, `redial_scheduled`\n\t* (attempt + delay — truthful \"retrying in N s\" UX), `link_up` (with `downForMs`). Returns an\n\t* unsubscribe. See {@link TLinkEvent} for the contract (a healthy heal is silent at the realm's\n\t* sync layer — this is where it's visible).\n\t*/\n\taddLinkEventListener(listener) {\n\t\tthis._linkEventListeners.add(listener);\n\t\treturn () => {\n\t\t\tthis._linkEventListeners.delete(listener);\n\t\t};\n\t}\n\t_emitLinkEvent(event) {\n\t\tfor (const listener of this._linkEventListeners) try {\n\t\t\tlistener(event);\n\t\t} catch (err) {\n\t\t\tconsole.error(\"[link] onLinkEvent listener threw\", err);\n\t\t}\n\t}\n};\n//#endregion\n//#region src/wire/Connect/handshakeRejectError.ts\nconst sanitizeVersions = (versions) => {\n\tif (versions == null) return void 0;\n\tconst safe = [];\n\tfor (const version of versions) {\n\t\tif (Number.isSafeInteger(version) && version >= 1 && version <= 65535) safe.push(version);\n\t\tif (safe.length === 2) break;\n\t}\n\treturn safe.length > 0 ? safe : void 0;\n};\n/**\n* Map a peer's handshake reject frame to the error the dialing side throws. A reject carrying a machine-readable `id` becomes the matching typed `err_wire_connect`\n* error — `identity_pin_mismatch` or `protocol_version_mismatch` — which transport selection\n* rethrows unwrapped so callers can branch on it and the keep-alive redial loop can park. A\n* reject without an id (an older peer,\n* whose frames never carry one) becomes `handshake_rejected` — same message text, now typed, so\n* `classifyConnectFailure` can tell \"the backend said no\" from \"wrong address\" (feedback W3).\n*/\nfunction handshakeRejectError(stage, rejectFrame) {\n\tif (rejectFrame.id === \"identity_pin_mismatch\") return err_wire_connect.fromId(\"identity_pin_mismatch\", { reason: rejectFrame.reason });\n\tif (rejectFrame.id === \"protocol_version_mismatch\") {\n\t\tconst observedProtocolVersion = sanitizeVersions(rejectFrame.observedProtocolVersion == null ? void 0 : [rejectFrame.observedProtocolVersion])?.[0];\n\t\treturn err_wire_connect.fromId(\"protocol_version_mismatch\", {\n\t\t\treason: rejectFrame.reason,\n\t\t\tobservedProtocolVersion,\n\t\t\tlocalSupportedProtocolVersions: [...WIRE_SUPPORTED_PROTOCOL_VERSIONS],\n\t\t\tremoteSupportedProtocolVersions: sanitizeVersions(rejectFrame.supportedProtocolVersions)\n\t\t});\n\t}\n\treturn err_wire_connect.fromId(\"handshake_rejected\", {\n\t\tstage,\n\t\treason: rejectFrame.reason\n\t});\n}\n//#endregion\n//#region src/wire/Connect/duplexLinkSession.ts\nconst HANDSHAKE_TIMEOUT_MS = 15e3;\nconst LINK_HANDSHAKE_STAGE = \"link-handshake\";\n/** The duplex twin of the exchange path's `nonProtocolReply` — same typed id, so a consumer's\n* `kind` branch means the same thing whichever carrier served the dial. */\nfunction wrongHandshakeFrame(channel, expected, receivedKind) {\n\treturn err_wire_connect.fromId(\"endpoint_answered_non_protocol\", {\n\t\tstage: LINK_HANDSHAKE_STAGE,\n\t\texpected,\n\t\turl: sanitizeEndpoint(channel.label),\n\t\treceivedKind: `hs/${receivedKind}`\n\t});\n}\n/** The literal wire keepalive frames — the acceptor answers raw, before any session dispatch. */\nconst KEEPALIVE_PING = \"ping\";\nconst KEEPALIVE_PONG = \"pong\";\n/** One keepalive loop per live link — created by the session, stopped with it. */\nfunction startHeartbeat(channel, config, tap) {\n\tlet lastInboundAt = Date.now();\n\tlet pingSentAt;\n\tlet timer;\n\tlet stopped = false;\n\tconst arm = (delayMs) => {\n\t\ttimer = setTimeout(tick, delayMs);\n\t\tunrefTimer(timer);\n\t};\n\tconst tick = () => {\n\t\tif (stopped || !channel.isOpen()) return;\n\t\tif (pingSentAt != null) {\n\t\t\tchannel.close();\n\t\t\treturn;\n\t\t}\n\t\tconst idleFor = Date.now() - lastInboundAt;\n\t\tif (idleFor >= config.idleMs) {\n\t\t\tpingSentAt = Date.now();\n\t\t\ttry {\n\t\t\t\tchannel.send(KEEPALIVE_PING);\n\t\t\t\ttap?.({\n\t\t\t\t\tdir: \"out\",\n\t\t\t\t\tbytes: 4,\n\t\t\t\t\tlane: \"keepalive\"\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t\tarm(config.pongTimeoutMs);\n\t\t} else arm(config.idleMs - idleFor);\n\t};\n\tarm(config.idleMs);\n\treturn {\n\t\t/** Any inbound frame is liveness — it refreshes the idle clock and satisfies a pending ping. */\n\t\tnoteInbound: () => {\n\t\t\tlastInboundAt = Date.now();\n\t\t\tpingSentAt = void 0;\n\t\t},\n\t\tstop: () => {\n\t\t\tstopped = true;\n\t\t\tif (timer != null) clearTimeout(timer);\n\t\t}\n\t};\n}\nfunction bindMux(mux, remoteIds, pipe, disconnectListeners, tap) {\n\tlet attached = false;\n\tlet closed = false;\n\tconst held = [];\n\tdisconnectListeners.push(() => {\n\t\tclosed = true;\n\t\theld.length = 0;\n\t\tif (attached) mux.detach();\n\t});\n\treturn {\n\t\tmux,\n\t\tdispatch: (frame) => {\n\t\t\tif (attached) return mux.dispatchIncoming(frame);\n\t\t\tif (peekProtocolPrefix(frame) == null) return false;\n\t\t\tif (!closed) held.push(frame);\n\t\t\treturn true;\n\t\t},\n\t\tattach: () => {\n\t\t\tif (attached || closed) return;\n\t\t\tattached = true;\n\t\t\tmux.setRemoteProtocolIds(remoteIds());\n\t\t\tmux.attach(tap != null ? (bytes) => pipe.send(bytes, mux.protocolIdFor(bytes) ?? \"protocol\") : (bytes) => pipe.send(bytes));\n\t\t\tfor (const frame of held.splice(0)) mux.dispatchIncoming(frame);\n\t\t}\n\t};\n}\n/**\n* Wrap a carrier so a **deliberate local** `close()` notifies the session immediately and exactly\n* once, rather than waiting for the platform's close event. On a real WebSocket that event lags a\n* locally-initiated close by seconds against a dead peer, so a fan-out coupled to it — the\n* auto-redial trigger — stalls. Two paths hit exactly that shape: a deliberate teardown\n* (`clearCache()` → `session.close()`) and the half-open keepalive detector's local\n* `channel.close()`. Here a local `close()` fires the session's `onClose` on a **microtask** —\n* immediate enough to heal fast, deferred enough not to re-enter a synchronous teardown loop (the\n* caller may be mid-iteration over its connection cache), and matching the in-memory pair's\n* semantics. The carrier's eventual platform close/error event routes to the same latch and is\n* deduped, so the fan-out (and thus `lane.onDetach`) runs exactly once. (resilience-v2 — Overshot's\n* bare-`dropLink({})` and half-open heal lag.)\n*/\nfunction withNotifyingClose(inner) {\n\tlet firedClose = false;\n\tlet sessionOnClose;\n\tconst fireClose = () => {\n\t\tif (firedClose) return;\n\t\tfiredClose = true;\n\t\tsessionOnClose?.();\n\t};\n\treturn {\n\t\tready: inner.ready,\n\t\tisOpen: () => inner.isOpen(),\n\t\tsend: (frame) => inner.send(frame),\n\t\tattach: (handlers) => {\n\t\t\tsessionOnClose = handlers.onClose;\n\t\t\tinner.attach({\n\t\t\t\tonMessage: handlers.onMessage,\n\t\t\t\tonClose: fireClose,\n\t\t\t\tonError: fireClose\n\t\t\t});\n\t\t},\n\t\tclose: () => {\n\t\t\tinner.close();\n\t\t\tqueueMicrotask(fireClose);\n\t\t},\n\t\tget label() {\n\t\t\treturn inner.label;\n\t\t}\n\t};\n}\n/**\n* Plain path (no handshake): route every inbound frame to the lane; send without crypto. The\n* lane is the bare {@link IWireLaneEndpoint} — a plain connection negotiates nothing, so there is\n* no handshake config to supply and no `onAttach` fires.\n*/\nfunction establishPlainDuplexSession(ctx) {\n\tconst channel = withNotifyingClose(ctx.channel);\n\tconst disconnectListeners = [];\n\tconst tap = ctx.tap;\n\tconst pipe = makePipe(channel, void 0, tap);\n\tconst port = makeLanePort(channel, pipe);\n\tconst mux = ctx.mux;\n\tconst heartbeat = ctx.heartbeat != null ? startHeartbeat(channel, ctx.heartbeat, tap) : void 0;\n\tif (heartbeat != null) disconnectListeners.push(heartbeat.stop);\n\tconst muxBinding = mux == null ? void 0 : bindMux(mux, () => protocolsFromCaps(mux.localCaps()), pipe, disconnectListeners, tap);\n\tchannel.attach({\n\t\tonMessage: (frame) => {\n\t\t\theartbeat?.noteInbound();\n\t\t\tif (frame === KEEPALIVE_PONG) {\n\t\t\t\ttap?.({\n\t\t\t\t\tdir: \"in\",\n\t\t\t\t\tbytes: 4,\n\t\t\t\t\tlane: \"keepalive\"\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\thandleIncomingFrame(pipe, frame, muxBinding, ctx.lane, port, tap);\n\t\t},\n\t\tonClose: () => onChannelClosed(disconnectListeners, ctx.lane),\n\t\tonError: () => onChannelClosed(disconnectListeners, ctx.lane)\n\t});\n\tif (ctx.deferMuxAttach !== true) muxBinding?.attach();\n\treturn makeSession$1(channel, pipe, disconnectListeners, void 0, muxBinding);\n}\n/**\n* Secure path: a single message handler feeds the handshake until it completes, then routes lane\n* frames (decrypting at the `encrypted` level). Frames that race ahead of activation are buffered\n* and flushed once the handshake lands, so nothing is lost. The lane supplies the handshake\n* payload (`dictionaryVersion`/`channels`, E5 — emitted under the byte-frozen wire names; the\n* version is signed into the challenge) and gets `onAttach` with the negotiated caps before any\n* buffered frame is delivered.\n*/\nasync function establishSecureDuplexSession(ctx) {\n\tconst channel = withNotifyingClose(ctx.channel);\n\tconst disconnectListeners = [];\n\tconst tap = ctx.tap;\n\tconst session = {};\n\tlet active = false;\n\tconst handshakeQueue = [];\n\tconst handshakeWaiters = [];\n\tconst pendingFrames = [];\n\tlet nonProtocolFrame;\n\tlet heartbeat;\n\tconst mux = ctx.mux;\n\tchannel.attach({\n\t\tonMessage: (frame) => {\n\t\t\theartbeat?.noteInbound();\n\t\t\tif (frame === KEEPALIVE_PONG) {\n\t\t\t\ttap?.({\n\t\t\t\t\tdir: \"in\",\n\t\t\t\t\tbytes: 4,\n\t\t\t\t\tlane: \"keepalive\"\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (active && session.pipe != null && session.port != null) {\n\t\t\t\thandleIncomingFrame(session.pipe, frame, session.muxBinding, ctx.lane, session.port, tap);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (typeof frame === \"string\") {\n\t\t\t\tconst message = decodeHandshakeMessage(frame);\n\t\t\t\tif (message != null) {\n\t\t\t\t\ttap?.({\n\t\t\t\t\t\tdir: \"in\",\n\t\t\t\t\t\tbytes: wireFrameByteSize(frame),\n\t\t\t\t\t\tlane: \"handshake\"\n\t\t\t\t\t});\n\t\t\t\t\tconst waiter = handshakeWaiters.shift();\n\t\t\t\t\tif (waiter != null) waiter(message);\n\t\t\t\t\telse handshakeQueue.push(message);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tnonProtocolFrame ??= frame;\n\t\t\t}\n\t\t\tpendingFrames.push(frame);\n\t\t},\n\t\tonClose: () => onChannelClosed(disconnectListeners, ctx.lane),\n\t\tonError: () => onChannelClosed(disconnectListeners, ctx.lane)\n\t});\n\tconst nextHandshakeMessage = () => {\n\t\tconst queued = handshakeQueue.shift();\n\t\tif (queued != null) return Promise.resolve(queued);\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst timeout = setTimeout(() => reject(nonProtocolFrame != null ? err_wire_connect.fromId(\"endpoint_answered_non_protocol\", {\n\t\t\t\tstage: LINK_HANDSHAKE_STAGE,\n\t\t\t\texpected: \"a handshake frame\",\n\t\t\t\turl: sanitizeEndpoint(channel.label),\n\t\t\t\tbodyPreview: describeNonProtocolBody(nonProtocolFrame)\n\t\t\t}) : /* @__PURE__ */ new Error(`[${LINK_HANDSHAKE_STAGE}] timed out waiting for peer reply`)), HANDSHAKE_TIMEOUT_MS);\n\t\t\thandshakeWaiters.push((message) => {\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\tresolve(message);\n\t\t\t});\n\t\t});\n\t};\n\ttry {\n\t\tconst { crypto, remoteCaps } = await runClientHandshake({\n\t\t\t...ctx,\n\t\t\tchannel\n\t\t}, nextHandshakeMessage);\n\t\tconst pipe = makePipe(channel, crypto, tap);\n\t\tconst port = makeLanePort(channel, pipe);\n\t\tsession.pipe = pipe;\n\t\tsession.port = port;\n\t\tconst muxBinding = mux == null ? void 0 : bindMux(mux, () => protocolsFromCaps(remoteCaps), pipe, disconnectListeners, tap);\n\t\tsession.muxBinding = muxBinding;\n\t\tif (ctx.deferMuxAttach !== true) muxBinding?.attach();\n\t\tctx.lane.onAttach?.(port, { remoteCaps: remoteCaps ?? [] });\n\t\tactive = true;\n\t\tfor (const frame of pendingFrames) await handleIncomingFrame(pipe, frame, muxBinding, ctx.lane, port, tap);\n\t\tpendingFrames.length = 0;\n\t\tif (ctx.heartbeat != null) {\n\t\t\theartbeat = startHeartbeat(channel, ctx.heartbeat, tap);\n\t\t\tdisconnectListeners.push(heartbeat.stop);\n\t\t}\n\t\treturn makeSession$1(channel, pipe, disconnectListeners, remoteCaps, muxBinding);\n\t} catch (error) {\n\t\tcloseQuietly(channel);\n\t\tthrow error;\n\t}\n}\nfunction makePipe(channel, crypto, tap) {\n\treturn createFrameCryptoPipe({\n\t\twrite: tap != null ? (frame, tapLane) => {\n\t\t\ttap({\n\t\t\t\tdir: \"out\",\n\t\t\t\tbytes: wireFrameByteSize(frame),\n\t\t\t\tlane: tapLane ?? \"action\"\n\t\t\t});\n\t\t\tchannel.send(frame);\n\t\t} : (frame) => channel.send(frame),\n\t\tisOpen: () => channel.isOpen(),\n\t\tcrypto\n\t});\n}\n/** The lane's talk-back surface: raw sends through the (possibly encrypting) pipe, no prefixing. */\nfunction makeLanePort(channel, pipe) {\n\treturn {\n\t\tsend: (frame) => pipe.send(frame),\n\t\tisOpen: () => channel.isOpen()\n\t};\n}\nfunction closeQuietly(channel) {\n\ttry {\n\t\tchannel.close();\n\t} catch {}\n}\nfunction makeSession$1(channel, pipe, disconnectListeners, remoteCaps, muxBinding) {\n\treturn {\n\t\tsend: (frame) => pipe.send(frame),\n\t\tisOpen: () => channel.isOpen(),\n\t\tclose: () => closeQuietly(channel),\n\t\taddOnDisconnectListener: (listener) => {\n\t\t\tdisconnectListeners.push(listener);\n\t\t},\n\t\tremoteCaps,\n\t\tattachMux: muxBinding == null ? void 0 : () => muxBinding.attach()\n\t};\n}\nasync function runClientHandshake(ctx, nextHandshakeMessage) {\n\tconst secure = ctx.secure;\n\tconst sendHandshake = (encoded) => {\n\t\tctx.channel.send(encoded);\n\t\tctx.tap?.({\n\t\t\tdir: \"out\",\n\t\t\tbytes: wireFrameByteSize(encoded),\n\t\t\tlane: \"handshake\"\n\t\t});\n\t};\n\tawait secure.link.initialize();\n\tconst handshakeConfig = ctx.lane.handshakeConfig();\n\tconst handshake = createClientHandshake({\n\t\tlink: secure.link,\n\t\tlocalCoordinate: secure.localCoordinate,\n\t\texpectedPeer: secure.expectedPeer,\n\t\tdictionaryVersion: handshakeConfig.dictionaryVersion,\n\t\tsecurityLevel: secure.securityLevel,\n\t\tchannelTags: handshakeConfig.channels,\n\t\textraCaps: [...ctx.lane.caps?.() ?? [], ...ctx.mux?.localCaps() ?? []]\n\t});\n\tsendHandshake(encodeHandshakeMessage(await handshake.createHello()));\n\tconst welcome = await nextHandshakeMessage();\n\tif (welcome.t === \"reject\") throw handshakeRejectError(LINK_HANDSHAKE_STAGE, welcome);\n\tif (welcome.t !== \"welcome\") throw wrongHandshakeFrame(ctx.channel, \"a welcome frame\", welcome.t);\n\tsendHandshake(encodeHandshakeMessage(await handshake.onWelcome(welcome)));\n\tconst accept = await nextHandshakeMessage();\n\tif (accept.t === \"reject\") throw handshakeRejectError(LINK_HANDSHAKE_STAGE, accept);\n\tif (accept.t !== \"accept\") throw wrongHandshakeFrame(ctx.channel, \"an accept frame\", accept.t);\n\tconst result = await handshake.onAccept(accept);\n\treturn {\n\t\tcrypto: result.securityLevel === \"encrypted\" && result.encryptionKeyMaterial != null ? createActionFrameCrypto({\n\t\t\tlink: secure.link,\n\t\t\tkeyMaterial: result.encryptionKeyMaterial\n\t\t}) : void 0,\n\t\tremoteCaps: result.remoteCaps\n\t};\n}\n/** Decrypt → mux dispatch → the lane. Awaited by the pre-ready flush so frame order holds. */\nasync function handleIncomingFrame(pipe, frame, muxBinding, lane, port, tap) {\n\tconst wireBytes = tap != null ? wireFrameByteSize(frame) : 0;\n\tconst decoded = await pipe.decryptIncoming(frame);\n\tif (decoded === void 0) return;\n\tif (muxBinding?.dispatch(decoded)) {\n\t\ttap?.({\n\t\t\tdir: \"in\",\n\t\t\tbytes: wireBytes,\n\t\t\tlane: muxBinding.mux.protocolIdFor(decoded) ?? \"protocol\"\n\t\t});\n\t\treturn;\n\t}\n\ttap?.({\n\t\tdir: \"in\",\n\t\tbytes: wireBytes,\n\t\tlane: \"action\"\n\t});\n\tawait lane.onLaneFrame(decoded, port);\n}\n/** Disconnect fan-out order (pre-split contract): mux detach → external listeners → the lane. */\nfunction onChannelClosed(disconnectListeners, lane) {\n\tfor (const cb of disconnectListeners) cb();\n\tlane.onDetach?.();\n}\n//#endregion\n//#region src/wire/Connect/TransportConnection.ts\nlet transportOrd = 0;\n/**\n* Live, per-handler transport runtime built from a reusable transport definition. Holds the\n* connection-scoped state (ordinal, initialized config, sockets / abort sets) that must not be shared\n* across handlers. Moved from nice-action with the action types\n* inverted into generics: `RP` (per-dispatch routing params), `RD` (the raw ready-data a definition\n* yields), and `METHODS` (the finalized send surface subclasses build) are opaque to wire.\n*/\nvar TransportConnection = class {\n\tdef;\n\ttransOrd = transportOrd++;\n\ttype;\n\tinitialized;\n\t/** Backref to the public definition that created this connection (used for devtools route info). */\n\tdefinition;\n\tconstructor(def) {\n\t\tthis.def = def;\n\t\tthis.type = def.type;\n\t\tthis.initialized = def.initialize();\n\t}\n\t/**\n\t* Devtools route info for a dispatch routed through this live connection. Defaults to the stateless\n\t* {@link definition}'s info; connections override to enrich it from live state (e.g. the actual\n\t* resolved socket URL) when the definition couldn't resolve it on its own.\n\t*/\n\tgetRouteInfo(input) {\n\t\treturn this.definition?.getRouteInfo(input);\n\t}\n\t/**\n\t* Whether a `ready`-status transport still needs asynchronous bring-up before its methods exist —\n\t* awaiting the carrier to open and/or running a handshake. Default `false`: a stateless transport\n\t* (HTTP) is usable the instant `getTransport` reports `ready`, so it stays a terminal *synchronous*\n\t* fallback in the selection manager. Stream carriers (Link/WS) override to `true`.\n\t*/\n\t_needsAsyncBringUp(_readyData) {\n\t\treturn false;\n\t}\n\t/** Await the carrier becoming ready to send (e.g. a socket `open`). Default: nothing to await. */\n\t_awaitCarrierReady(_readyData) {\n\t\treturn Promise.resolve();\n\t}\n\t/**\n\t* Finalize during async bring-up — may run a handshake, so it can be async. Defaults to the\n\t* synchronous {@link _finalizeTransportMethods}; secure stream carriers override to branch plain/secure.\n\t*/\n\t_finalizeReady(readyData) {\n\t\treturn this._finalizeTransportMethods(readyData);\n\t}\n\t_getCacheKey(input) {\n\t\tconst parts = this.initialized.getCacheKey?.(input);\n\t\tif (parts == null) return null;\n\t\treturn parts.join(\"\\0\");\n\t}\n\tgetCacheKey(input) {\n\t\tconst inner = this._getCacheKey(input);\n\t\tif (inner == null) return null;\n\t\treturn `${this.transOrd}:${inner}`;\n\t}\n\t/**\n\t* Whether this transport can serve the given dispatch right now. Consulted by the manager before\n\t* cache-key resolution and `getTransport`; a `false` result skips this transport (treated as\n\t* `unsupported`) and the manager falls through to the next in preference order. Defaults to `true`\n\t* when the transport declares no gate.\n\t*/\n\tisAvailable(input) {\n\t\treturn this.initialized.isAvailable?.(input) ?? true;\n\t}\n\tgetTransport(input) {\n\t\treturn this._processTransportStatus(input);\n\t}\n\t_processTransportStatus(input) {\n\t\tconst statusInfo = addTransportStatusMetadata(this.initialized.getTransport(input));\n\t\tif (statusInfo.status === \"ready\") {\n\t\t\tif (!this._needsAsyncBringUp(statusInfo.readyData)) return {\n\t\t\t\tstatus: \"ready\",\n\t\t\t\treadyData: this._finalizeTransportMethods(statusInfo.readyData)\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tstatus: \"initializing\",\n\t\t\t\ttimeStarted: Date.now(),\n\t\t\t\tinitializationPromise: this._bringUp(statusInfo.readyData)\n\t\t\t};\n\t\t}\n\t\tif (statusInfo.status === \"initializing\") {\n\t\t\tconst initializationPromise = statusInfo.initializationPromise.then((result) => result.status === \"ready\" ? this._bringUp(result.readyData) : result);\n\t\t\treturn {\n\t\t\t\tstatus: \"initializing\",\n\t\t\t\ttimeStarted: statusInfo.timeStarted,\n\t\t\t\tinitializationPromise\n\t\t\t};\n\t\t}\n\t\treturn statusInfo;\n\t}\n\t/** Await carrier readiness, then finalize (possibly running a handshake) into the live methods. */\n\tasync _bringUp(readyData) {\n\t\tawait this._awaitCarrierReady(readyData);\n\t\treturn {\n\t\t\tstatus: \"ready\",\n\t\t\treadyData: await this._finalizeReady(readyData)\n\t\t};\n\t}\n};\n/** Stamp the wall-clock metadata a definition's raw status output omits. */\nfunction addTransportStatusMetadata(transportStatus) {\n\tif (transportStatus.status === \"ready\") return {\n\t\tstatus: \"ready\",\n\t\treadyData: transportStatus.readyData\n\t};\n\tif (transportStatus.status === \"initializing\") return {\n\t\tstatus: \"initializing\",\n\t\tinitializationPromise: transportStatus.initializationPromise,\n\t\ttimeStarted: Date.now()\n\t};\n\tif (transportStatus.status === \"failed\") return {\n\t\tstatus: \"failed\",\n\t\terror: transportStatus.error,\n\t\ttimeFailed: Date.now()\n\t};\n\tif (transportStatus.status === \"unsupported\") return { status: \"unsupported\" };\n\treturn { status: \"uninitialized\" };\n}\n//#endregion\n//#region src/wire/Connect/WireLinkConnection.ts\n/**\n* A wire-native, action-free live connection over a duplex carrier — the substrate twin of\n* nice-action's `LinkConnection`. It owns only the *bring-up* (open the carrier, then run the wire\n* duplex session); the session itself — handshake, frame crypto, mux bind/detach, keepalive — lives\n* in the shared `establish(Plain|Secure)DuplexSession`. Its lane defaults to the trivial {@link\n* lanelessLane}, so a realm (or devtools, or anything on the mux) rides it with no unprefixed lane\n* of its own. This is what `createWireClient` builds and hands to a {@link\n* import(\"./WireClient\").WireClient}; the exposed methods are the minimal {@link\n* IWireConnectionMethodsBase} lifecycle sliver (a mux-only connection sends through the mux, not a\n* lane send surface).\n*/\nvar WireLinkConnection = class extends TransportConnection {\n\toptions;\n\tconstructor(options) {\n\t\tsuper({\n\t\t\ttype: \"duplex\",\n\t\t\tinitialize: () => ({\n\t\t\t\tgetCacheKey: options.getCacheKey,\n\t\t\t\tisAvailable: options.isAvailable,\n\t\t\t\tgetTransport: (params) => ({\n\t\t\t\t\tstatus: \"ready\",\n\t\t\t\t\treadyData: {\n\t\t\t\t\t\tchannel: options.openChannel(params),\n\t\t\t\t\t\tsecure: options.secure,\n\t\t\t\t\t\tmux: options.mux,\n\t\t\t\t\t\tlane: options.lane ?? lanelessLane(),\n\t\t\t\t\t\theartbeat: options.heartbeat?.(),\n\t\t\t\t\t\ttap: options.tap\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t\tthis.options = options;\n\t}\n\t_needsAsyncBringUp() {\n\t\treturn true;\n\t}\n\t_awaitCarrierReady(data) {\n\t\treturn data.channel.ready;\n\t}\n\tasync _finalizeReady(data) {\n\t\tconst secure = data.secure;\n\t\tif (secure != null && secure.securityLevel !== \"none\") return sessionMethods(await establishSecureDuplexSession({\n\t\t\tchannel: data.channel,\n\t\t\tsecure,\n\t\t\tlane: data.lane,\n\t\t\tmux: data.mux,\n\t\t\tdeferMuxAttach: true,\n\t\t\theartbeat: data.heartbeat,\n\t\t\ttap: data.tap\n\t\t}));\n\t\treturn this._finalizeTransportMethods(data);\n\t}\n\t_finalizeTransportMethods(data) {\n\t\treturn sessionMethods(establishPlainDuplexSession({\n\t\t\tchannel: data.channel,\n\t\t\tlane: data.lane,\n\t\t\tmux: data.mux,\n\t\t\tdeferMuxAttach: true,\n\t\t\theartbeat: data.heartbeat,\n\t\t\ttap: data.tap\n\t\t}));\n\t}\n\tgetRouteInfo(params) {\n\t\treturn this.options.getRouteInfo?.(params) ?? {\n\t\t\tcarrierLabel: this.options.label,\n\t\t\tsummary: this.options.label\n\t\t};\n\t}\n};\n/**\n* The minimal lifecycle surface a mux-only connection exposes upward (send rides the mux). The\n* mux attaches only once selection picks this link, so parallel warm-ups never share it.\n*/\nfunction sessionMethods(session) {\n\treturn {\n\t\taddOnDisconnectListener: (callback) => session.addOnDisconnectListener(callback),\n\t\tdisconnect: () => session.close(),\n\t\tonSelected: () => session.attachMux?.()\n\t};\n}\n//#endregion\n//#region src/wire/Mux/WireProtocolMux.ts\nvar WireProtocolMux = class {\n\t_byPrefix = /* @__PURE__ */ new Map();\n\t_send;\n\t_remoteProtocolIds = /* @__PURE__ */ new Set();\n\t_attached = false;\n\t/** Register a protocol (before or after attach; late registrants get an immediate attach). */\n\tregisterProtocol(protocol) {\n\t\tif (this._attached) console.warn(`[wire] registerProtocol(\"${protocol.id}\"): the connection is already attached — this protocol missed the handshake's caps advertisement and will not be resumed after a host wake. Register it before connecting.`);\n\t\tif (protocol.prefixByte <= WIRE_PROTOCOL_PREFIX.invalid || protocol.prefixByte > 15) throw new Error(`registerProtocol(\"${protocol.id}\"): prefix 0x${protocol.prefixByte.toString(16)} outside the reserved range`);\n\t\tif (this._byPrefix.has(protocol.prefixByte)) throw new Error(`registerProtocol(\"${protocol.id}\"): prefix 0x${protocol.prefixByte.toString(16)} already registered`);\n\t\tconst port = {\n\t\t\tsend: (payload) => {\n\t\t\t\tif (!this._canSpeak(protocol)) throw new Error(`protocol \"${protocol.id}\": connection not attached or peer did not advertise \"${protocolCap(protocol.id)}\"`);\n\t\t\t\tthis._send?.(encodeProtocolFrame(protocol.prefixByte, payload));\n\t\t\t},\n\t\t\tisOpen: () => this._canSpeak(protocol)\n\t\t};\n\t\tthis._byPrefix.set(protocol.prefixByte, {\n\t\t\tprotocol,\n\t\t\tport\n\t\t});\n\t\tif (this._attached && this._canSpeak(protocol)) protocol.onAttach?.(port);\n\t\treturn port;\n\t}\n\t/** The `proto:<id>` caps to advertise in this side's handshake. */\n\tlocalCaps() {\n\t\treturn [...this._byPrefix.values()].map(({ protocol }) => protocolCap(protocol.id));\n\t}\n\t/** Record the peer's advertised protocol ids (from its handshake caps). */\n\tsetRemoteProtocolIds(ids) {\n\t\tthis._remoteProtocolIds = ids;\n\t}\n\t/** Connection ready: give protocols their send path and fire attach for negotiated ones. */\n\tattach(send) {\n\t\tthis._send = send;\n\t\tthis._attached = true;\n\t\tfor (const { protocol, port } of this._byPrefix.values()) if (this._canSpeak(protocol)) protocol.onAttach?.(port);\n\t}\n\t/** Connection lost: notify protocols; sends now throw until the next attach. */\n\tdetach() {\n\t\tif (!this._attached) return;\n\t\tthis._attached = false;\n\t\tthis._send = void 0;\n\t\tfor (const { protocol } of this._byPrefix.values()) protocol.onDetach?.();\n\t}\n\t/**\n\t* The registered protocol id a frame belongs to, by its prefix byte — `undefined` for a legacy\n\t* (unprefixed) frame or an unregistered prefix. Attribution only (the wire-tap lane label);\n\t* dispatch stays with {@link dispatchIncoming}.\n\t*/\n\tprotocolIdFor(frame) {\n\t\tconst prefix = peekProtocolPrefix(frame);\n\t\tif (prefix == null) return void 0;\n\t\treturn this._byPrefix.get(prefix)?.protocol.id;\n\t}\n\t/**\n\t* Offer one inbound (already-decrypted) frame. Returns `true` when consumed as a protocol\n\t* frame — including an unknown/unregistered prefix, which is dropped (a prefixed frame is\n\t* *never* a legacy frame, so falling through would mis-decode it).\n\t*/\n\tdispatchIncoming(frame) {\n\t\tconst prefix = peekProtocolPrefix(frame);\n\t\tif (prefix == null) return false;\n\t\tconst registered = this._byPrefix.get(prefix);\n\t\tif (prefix === WIRE_PROTOCOL_PREFIX.invalid || registered == null) return true;\n\t\tconst bytes = frame instanceof Uint8Array ? frame : new Uint8Array(frame);\n\t\tregistered.protocol.onFrame(bytes.subarray(1), registered.port);\n\t\treturn true;\n\t}\n\t_canSpeak(protocol) {\n\t\treturn this._attached && this._remoteProtocolIds.has(protocol.id);\n\t}\n};\n//#endregion\n//#region src/wire/Connect/wireConnectionParts.ts\n/** 8b.3 defaults: ≈20 s worst-case half-open detection, quiet enough for a healthy idle tab. */\nconst DEFAULT_HEARTBEAT_IDLE_MS = 15e3;\nconst DEFAULT_HEARTBEAT_PONG_TIMEOUT_MS = 5e3;\nconst ephemeralIdentityWarned = /* @__PURE__ */ new Set();\n/**\n* The ephemeral-identity trap: a coordinate with a persistent id whose\n* crypto identity lives in non-durable storage keys the peer's trust-on-first-use verify-key pin but\n* regenerates a new key on every reload — so every reload after the first is rejected\n* `identity_pin_mismatch`, forever. It type-checks and the first load works, so nothing else surfaces\n* it. Warn once per pinned identity (module-global dedupe — one warning per identity per process, not\n* per connection). Both `durable === false` and unknown durability are warning-worthy; a deliberately\n* per-session id opts out with `ephemeralIdentity: true`. Shared by every dial-out entry point\n* (`createWireClient`, `connectChannel`), so the check lives once.\n*/\nfunction warnOnEphemeralPinnedIdentity(callerName, coordinate, storage) {\n\tif (storage.durable === true || coordinate.perId == null) return;\n\tconst pinKey = `${coordinate.envId}::${coordinate.perId}`;\n\tif (ephemeralIdentityWarned.has(pinKey)) return;\n\tephemeralIdentityWarned.add(pinKey);\n\tconsole.warn(`${callerName}: the runtime coordinate [${pinKey}] carries a persistent id, which keys the peer's trust-on-first-use verify-key pin — but the \\`storage\\` passed here is not known to be durable, so this client's crypto identity may regenerate on reload. The peer will pin the first key it sees and reject every reconnect after the first reload (identity_pin_mismatch). Back the connection with a durable adapter (e.g. createWebLocalStorageAdapter) that persists at least as long as the persistent id, or set \\`ephemeralIdentity: true\\` if the id is minted fresh per session. Memory adapters are for tests.`);\n}\n/**\n* Assemble the connection facts a dial-out entry point shares — the one implementation of \"how a\n* wire connection's mux, crypto identity, keepalive, and traffic tap are set up\" (first-production\n* the connection design). `createWireClient` and `connectChannel` both call this; each then builds its own\n* transports (mux-only `WireLinkConnection`s vs action `Transport`s with the codec lane) around the\n* shared result, so a fix to any of these lands once.\n*/\nfunction assembleWireConnectionParts(options) {\n\tconst mux = options.mux ?? new WireProtocolMux();\n\tif (options.reconnect != null && options.keepLinkAlive != null) throw err_wire_connect.fromId(\"conflicting_connect_options\", { detail: `${options.callerName}: pass only \\`reconnect\\`; \\`keepLinkAlive\\` is deprecated` });\n\tif (options.heartbeat != null && options.linkKeepalive != null) throw err_wire_connect.fromId(\"conflicting_connect_options\", { detail: `${options.callerName}: pass only \\`heartbeat\\`; \\`linkKeepalive\\` is deprecated` });\n\tconst reconnect = options.reconnect ?? options.keepLinkAlive;\n\tconst heartbeat = options.heartbeat ?? options.linkKeepalive;\n\tfor (const protocol of options.protocols ?? []) mux.registerProtocol(protocol);\n\tlet link = options.link;\n\tif (options.anySecure && link == null) {\n\t\tif (options.storage == null && options.ephemeralIdentity !== true) throw new Error(`${options.callerName}: a secure transport requires \\`storage\\` (or \\`link\\`) for the crypto identity. Pass it, declare a per-session identity with \\`ephemeralIdentity: true\\`, or set \\`secure: false\\` on the carrier for a plain connection.`);\n\t\tif (options.storage != null && options.ephemeralIdentity !== true) warnOnEphemeralPinnedIdentity(options.callerName, options.identity, options.storage);\n\t\tlink = new ClientCryptoKeyLink(options.storage != null ? { storageAdapter: options.storage } : {});\n\t}\n\tconst resolveHeartbeat = () => {\n\t\tif (heartbeat === false) return void 0;\n\t\tconst explicit = heartbeat;\n\t\tif (!(explicit != null || reconnect === true || reconnect !== false && mux.localCaps().length > 0)) return void 0;\n\t\treturn {\n\t\t\tidleMs: explicit?.idleMs ?? DEFAULT_HEARTBEAT_IDLE_MS,\n\t\t\tpongTimeoutMs: explicit?.pongTimeoutMs ?? DEFAULT_HEARTBEAT_PONG_TIMEOUT_MS\n\t\t};\n\t};\n\tconst wireTap = options.wireTap != null ? withLinkIdTap(options.wireTap, options.peer.stringId) : void 0;\n\treturn {\n\t\tmux,\n\t\tlink,\n\t\tresolveHeartbeat,\n\t\twireTap\n\t};\n}\n//#endregion\n//#region src/wire/Connect/wireSelectionErrors.ts\n/**\n* The wire-native transport-selection failure vocabulary — what a `createWireClient` connection\n* throws when its transport chain can't produce a live link, expressed in `err_wire_connect` ids\n* (the counterpart of nice-action's `err_nice_transport`-flavoured `ConnectionTransportManager`\n* shim). `dial_unavailable`, `identity_pin_mismatch`, and `protocol_version_mismatch` are rethrown *unwrapped* by the manager\n* before these ever run, so the keep-alive redial can park on them (see\n* `ConnectionTransportManager`).\n*/\nfunction wireSelectionErrors(peerId) {\n\treturn {\n\t\tunsupported: (transportShapes) => err_wire_connect.fromId(\"connect_exhausted\", {\n\t\t\tpeerId,\n\t\t\tattempted: transportShapes\n\t\t}),\n\t\tnotFound: () => err_wire_connect.fromId(\"connect_exhausted\", {\n\t\t\tpeerId,\n\t\t\tattempted: []\n\t\t}),\n\t\tinitializationFailed: (_input, failure) => err_wire_connect.fromId(\"dial_failed\", {\n\t\t\tpeerId,\n\t\t\tcarrierLabel: \"chain\",\n\t\t\treason: failure.cause ?? \"unknown\",\n\t\t\tendpoint: failure.endpoint,\n\t\t\tkind: failure.kind\n\t\t}).withOriginError(failure.origin)\n\t};\n}\n//#endregion\n//#region src/wire/Connect/createWireClient.ts\n/**\n* The public way to **open a wire connection** — the dial-out front door of `connect-core/wire`, and\n* the substrate `connectChannel` (action) is a binding over. It builds a mux-carrying duplex\n* connection to a peer (one crypto identity fanned across the secure transports, preference-ordered\n* fallback, the keep-alive redial ladder, link events) and returns a {@link WireClient} — which\n* structurally satisfies realm's `IRealmWireLink`, so a realm rides it with **no action import**:\n*\n* ```ts\n* const client = createWireClient({\n*   identity: RuntimeCoordinate.env(\"web_app\").withPersistentId(perId),\n*   peer: RuntimeCoordinate.env(\"backend\"),\n*   storage,\n*   carriers: [wsCarrier(url)],\n* });\n* const realm = connectRealm(myRealm, { avatar: { type: \"player\" }, connection: realmConnection(client) });\n* await client.connect();\n* ```\n*\n* The same client is what a devtools window holds (Phase 2.5): action, realm, and devtools are all\n* protocols/lanes over this one connection substrate.\n*/\nfunction createWireClient(options) {\n\tif (options.carriers == null === (options.transports == null)) throw err_wire_connect.fromId(\"conflicting_connect_options\", { detail: \"createWireClient requires exactly one of `carriers` or deprecated `transports`\" });\n\tconst transports = options.carriers?.map((carrier) => ({\n\t\tcarrier,\n\t\tsecure: carrier.secure\n\t})) ?? options.transports;\n\tconst securityLevel = options.securityLevel ?? \"authenticated\";\n\tconst anySecure = transports.some((entry) => entry.secure ?? true);\n\tconst { mux, link, resolveHeartbeat, wireTap } = assembleWireConnectionParts({\n\t\tcallerName: \"createWireClient\",\n\t\tpeer: options.peer,\n\t\tidentity: options.identity,\n\t\tmux: options.mux,\n\t\tprotocols: options.protocols,\n\t\tanySecure,\n\t\tstorage: options.storage,\n\t\tlink: options.link,\n\t\tephemeralIdentity: options.ephemeralIdentity,\n\t\treconnect: options.reconnect,\n\t\theartbeat: options.heartbeat,\n\t\tkeepLinkAlive: options.keepLinkAlive,\n\t\tlinkKeepalive: options.linkKeepalive,\n\t\twireTap: options.wireTap\n\t});\n\tconst secureConfig = link != null ? {\n\t\tsecurityLevel,\n\t\tlink,\n\t\tlocalCoordinate: options.identity.toJsonObject(),\n\t\texpectedPeer: options.peer.toJsonObject()\n\t} : void 0;\n\tconst connections = transports.map((entry) => {\n\t\tconst carrierSource = entry.carrier;\n\t\tif (\"shape\" in carrierSource) throw new Error(\"createWireClient: an exchange (request/reply) carrier can't carry a mux-only connection — a pushed protocol (a realm, devtools) needs a duplex carrier (wsCarrier / rtcCarrier / inMemoryCarrier).\");\n\t\tconst carrier = carrierSource;\n\t\treturn new WireLinkConnection({\n\t\t\tlabel: carrier.carrierLabel,\n\t\t\topenChannel: carrier.open,\n\t\t\tgetCacheKey: carrier.getCacheKey,\n\t\t\tgetRouteInfo: carrier.getRouteInfo,\n\t\t\tmux,\n\t\t\theartbeat: resolveHeartbeat,\n\t\t\ttap: wireTap,\n\t\t\tsecure: entry.secure ?? true ? secureConfig : void 0\n\t\t});\n\t});\n\tconst levels = transports.map((entry) => entry.secure ?? true ? securityLevel : \"none\");\n\tconst connectionSecurityLevel = levels.length === 0 ? \"none\" : levels.reduce((floor, level) => securityLevelMeets(level, floor) ? floor : level);\n\tconst client = new WireClient({\n\t\tcreateManager: (cache) => new ConnectionTransportManager(cache, wireSelectionErrors(options.peer.stringId)),\n\t\tmux,\n\t\tpeer: options.peer,\n\t\tlocalCoordinate: options.identity,\n\t\tsecurityLevel: connectionSecurityLevel,\n\t\tcanPush: transports.length > 0,\n\t\treconnect: options.reconnect ?? options.keepLinkAlive,\n\t\tbuildConnectInput: (pair) => ({\n\t\t\t...pair,\n\t\t\tdialContext: void 0\n\t\t})\n\t});\n\tfor (const connection of connections) client.addTransport(connection);\n\tif (options.onLinkEvent != null) client.addLinkEventListener(options.onLinkEvent);\n\treturn client;\n}\n//#endregion\n//#region src/wire/Connect/exchangeEnvelope.ts\nfunction encodeExchange(envelope) {\n\treturn JSON.stringify(envelope);\n}\nfunction decodeExchangeRequest(raw) {\n\tconst value = parseJson(raw);\n\treturn isRequestEnvelope(value) ? value : void 0;\n}\nfunction decodeExchangeReply(raw) {\n\tconst value = parseJson(raw);\n\treturn isReplyEnvelope(value) ? value : void 0;\n}\nfunction parseJson(raw) {\n\ttry {\n\t\treturn JSON.parse(raw);\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction isRequestEnvelope(value) {\n\treturn hasEnvelopeKind(value) && (value.k === \"hs\" || value.k === \"act\");\n}\nfunction isReplyEnvelope(value) {\n\treturn hasEnvelopeKind(value) && (value.k === \"hs\" || value.k === \"act\" || value.k === \"err\");\n}\nfunction hasEnvelopeKind(value) {\n\treturn typeof value === \"object\" && value != null && \"k\" in value;\n}\n//#endregion\n//#region src/wire/Connect/exchangeSession.ts\nconst textEncoder$1 = new TextEncoder();\nconst textDecoder$1 = new TextDecoder();\n/** Plain path (no handshake/token): every wire rides a bare `act` envelope, plaintext both ways. */\nfunction establishPlainExchangeSession(carrier) {\n\treturn makeSession(carrier, {});\n}\n/**\n* Secure path: run the handshake (two exchanges) once at bring-up, then reuse the token + crypto.\n* The lane supplies the handshake payload (`dictionaryVersion`/`channels`, E5 — emitted under the\n* byte-frozen wire names; the version is signed into the challenge).\n*/\nasync function establishSecureExchangeSession(ctx) {\n\tconst state = await runConnectorExchangeHandshake(ctx.carrier, ctx.secure, ctx.lane);\n\treturn makeSession(ctx.carrier, state);\n}\nfunction makeSession(carrier, state) {\n\tconst runExchange = async (wire, opts) => {\n\t\tconst request = await buildRequestEnvelope(state, wire);\n\t\treturn carrier.exchange(encodeExchange(request), { signal: opts?.signal });\n\t};\n\treturn {\n\t\tsend: async (wire, opts) => {\n\t\t\tawait runExchange(wire, opts);\n\t\t},\n\t\texchange: async (wire, opts) => {\n\t\t\tconst reply = decodeExchangeReply(asString(await runExchange(wire, opts)));\n\t\t\tif (reply == null) return {\n\t\t\t\tok: false,\n\t\t\t\treason: \"malformed_reply\"\n\t\t\t};\n\t\t\tif (reply.k === \"err\") return {\n\t\t\t\tok: false,\n\t\t\t\treason: \"peer_error\",\n\t\t\t\tmessage: reply.message\n\t\t\t};\n\t\t\tconst replyWire = await extractReplyWire(state, reply);\n\t\t\tif (replyWire === void 0) return {\n\t\t\t\tok: false,\n\t\t\t\treason: \"malformed_reply\"\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\twire: replyWire\n\t\t\t};\n\t\t}\n\t};\n}\nasync function buildRequestEnvelope(state, wire) {\n\tif (state.crypto != null) {\n\t\tconst ciphertext = await state.crypto.encryptFrame(textEncoder$1.encode(JSON.stringify(wire)));\n\t\treturn {\n\t\t\tk: \"act\",\n\t\t\tt: state.token,\n\t\t\tc: bytesToBase64(ciphertext)\n\t\t};\n\t}\n\treturn {\n\t\tk: \"act\",\n\t\tt: state.token,\n\t\tw: wire\n\t};\n}\nasync function extractReplyWire(state, reply) {\n\tif (reply.k !== \"act\") return void 0;\n\tif (\"c\" in reply) {\n\t\tif (state.crypto == null) return void 0;\n\t\tconst plain = await state.crypto.decryptFrame(base64ToBytes(reply.c));\n\t\treturn JSON.parse(textDecoder$1.decode(plain));\n\t}\n\treturn reply.w;\n}\nasync function runConnectorExchangeHandshake(carrier, secure, lane) {\n\tawait secure.link.initialize();\n\tconst handshake = createClientHandshake({\n\t\tlink: secure.link,\n\t\tlocalCoordinate: secure.localCoordinate,\n\t\texpectedPeer: secure.expectedPeer,\n\t\tdictionaryVersion: lane.dictionaryVersion,\n\t\tsecurityLevel: secure.securityLevel,\n\t\tchannelTags: lane.channels\n\t});\n\tconst welcomeReply = await exchangeHandshakeFrame(carrier, {\n\t\tk: \"hs\",\n\t\tm: encodeHandshakeMessage(await handshake.createHello())\n\t}, \"a welcome frame\");\n\tconst welcome = decodeHandshakeMessage(welcomeReply.m);\n\tif (welcome == null) throw nonProtocolReply(carrier, \"a welcome frame\", \"hs (undecodable)\");\n\tif (welcome.t === \"reject\") throw handshakeRejectError(HANDSHAKE_STAGE, welcome);\n\tif (welcome.t !== \"welcome\") throw nonProtocolReply(carrier, \"a welcome frame\", `hs/${welcome.t}`);\n\tif (welcomeReply.hsc == null) throw new Error(`[${HANDSHAKE_STAGE}] welcome missing handshake continuation token${at(carrier)}`);\n\tconst acceptReply = await exchangeHandshakeFrame(carrier, {\n\t\tk: \"hs\",\n\t\tm: encodeHandshakeMessage(await handshake.onWelcome(welcome)),\n\t\thsc: welcomeReply.hsc\n\t}, \"an accept frame\");\n\tconst accept = decodeHandshakeMessage(acceptReply.m);\n\tif (accept == null) throw nonProtocolReply(carrier, \"an accept frame\", \"hs (undecodable)\");\n\tif (accept.t === \"reject\") throw handshakeRejectError(HANDSHAKE_STAGE, accept);\n\tif (accept.t !== \"accept\") throw nonProtocolReply(carrier, \"an accept frame\", `hs/${accept.t}`);\n\tif (acceptReply.t == null) throw new Error(`[${HANDSHAKE_STAGE}] accept missing session token${at(carrier)}`);\n\tconst result = await handshake.onAccept(accept);\n\tconst crypto = result.securityLevel === \"encrypted\" && result.encryptionKeyMaterial != null ? createActionFrameCrypto({\n\t\tlink: secure.link,\n\t\tkeyMaterial: result.encryptionKeyMaterial\n\t}) : void 0;\n\treturn {\n\t\ttoken: acceptReply.t,\n\t\tcrypto\n\t};\n}\nconst HANDSHAKE_STAGE = \"exchange-handshake\";\n/**\n* One handshake exchange, with the failure told from the *reply's* point of view (feedback W1).\n* The reply is in hand at the throw site, so the error says what came back — a frame kind, or a\n* bounded preview of a body that was never a protocol frame at all — instead of only what we\n* hoped for. A body preview is attached ONLY when nothing decoded: a decodable `act` envelope may\n* carry application data, which has no business in a connection error.\n*/\nasync function exchangeHandshakeFrame(carrier, request, expected) {\n\tconst raw = asString(await carrier.exchange(encodeExchange(request)));\n\tconst reply = decodeExchangeReply(raw);\n\tif (reply == null) throw err_wire_connect.fromId(\"endpoint_answered_non_protocol\", {\n\t\tstage: HANDSHAKE_STAGE,\n\t\texpected,\n\t\turl: sanitizeEndpoint(carrier.label),\n\t\tbodyPreview: describeNonProtocolBody(raw)\n\t});\n\tif (reply.k === \"err\") throw err_wire_connect.fromId(\"handshake_rejected\", {\n\t\tstage: HANDSHAKE_STAGE,\n\t\treason: reply.message\n\t});\n\tif (reply.k !== \"hs\") throw nonProtocolReply(carrier, expected, reply.k);\n\treturn reply;\n}\nfunction nonProtocolReply(carrier, expected, receivedKind) {\n\treturn err_wire_connect.fromId(\"endpoint_answered_non_protocol\", {\n\t\tstage: HANDSHAKE_STAGE,\n\t\texpected,\n\t\turl: sanitizeEndpoint(carrier.label),\n\t\treceivedKind\n\t});\n}\n/** Make a peer-bug message self-locating without inventing a typed id for it. */\nfunction at(carrier) {\n\tconst endpoint = sanitizeEndpoint(carrier.label);\n\treturn endpoint != null ? ` (endpoint: ${endpoint})` : \"\";\n}\nfunction asString(frame) {\n\tif (typeof frame === \"string\") return frame;\n\treturn textDecoder$1.decode(frame instanceof ArrayBuffer ? new Uint8Array(frame) : frame);\n}\n//#endregion\n//#region src/wire/Connect/serveWire.ts\nconst DEFAULT_SERVER_SECURITY_LEVELS = [\n\t\"none\",\n\t\"authenticated\",\n\t\"encrypted\"\n];\n/**\n* Serve a lane-less wire connection on Bun, Node, or any custom host. The caller owns socket\n* upgrades and forwards frames through the returned carrier/server lifecycle. No action runtime or\n* empty action channel is involved.\n*/\nfunction serveWire(options) {\n\tif (options.carriers.length !== 1) throw new Error(\"serveWire requires exactly one duplex carrier\");\n\tconst carrier = options.carriers[0];\n\tconst secure = carrier.secure ?? true;\n\tlet security;\n\tif (secure) {\n\t\tif (options.storage == null && (options.link == null || options.verifyKeyResolver == null)) throw new Error(\"serveWire: a secure carrier requires `storage`, or both `link` and `verifyKeyResolver`\");\n\t\tconst storage = options.storage;\n\t\tsecurity = {\n\t\t\tsecurityLevel: options.securityLevel ?? DEFAULT_SERVER_SECURITY_LEVELS,\n\t\t\tlink: options.link ?? new ClientCryptoKeyLink({ storageAdapter: storage }),\n\t\t\tlocalCoordinate: options.identity,\n\t\t\tverifyKeyResolver: options.verifyKeyResolver ?? (storage != null ? createStorageTofuVerifyKeyResolver(storage) : void 0)\n\t\t};\n\t}\n\tconst asObject = (value) => typeof value === \"object\" && value != null ? value : {};\n\tconst attachmentStore = carrier.attachmentStore;\n\tconst acceptor = new WireAcceptor({\n\t\tsend: carrier.send,\n\t\tclose: carrier.close,\n\t\ttap: options.wireTap,\n\t\tsecurity,\n\t\tlane: lanelessAcceptorLane(),\n\t\tprotocols: options.protocols,\n\t\tonConnectionBound: attachmentStore == null ? void 0 : (connection, binding) => attachmentStore.write(connection, {\n\t\t\t...asObject(attachmentStore.read(connection)),\n\t\t\tbinding\n\t\t})\n\t});\n\ttry {\n\t\tif (attachmentStore != null) for (const connection of attachmentStore.getConnections()) {\n\t\t\tconst binding = wireBindingFromAttachment(attachmentStore.read(connection));\n\t\t\tif (binding != null) acceptor.rehydrate(connection, binding);\n\t\t}\n\t\tcarrier._activate({\n\t\t\treceive: (connection, frame) => acceptor.receive(connection, frame),\n\t\t\tdrop: (connection) => acceptor.drop(connection)\n\t\t});\n\t} catch (error) {\n\t\ttry {\n\t\t\tcarrier._dispose?.();\n\t\t} finally {\n\t\t\tacceptor.dispose();\n\t\t}\n\t\tthrow error;\n\t}\n\tlet closed = false;\n\treturn {\n\t\tacceptor,\n\t\tfetch: async (request) => {\n\t\t\tif (closed) return new Response(\"Wire server closed\", { status: 503 });\n\t\t\tconst url = new URL(request.url);\n\t\t\tif ((carrier.isUpgrade?.(request, url) ?? false) && carrier.upgrade != null) return carrier.upgrade(request, url);\n\t\t\treturn new Response(\"Expected a duplex carrier upgrade\", { status: carrier.upgrade == null ? 501 : 426 });\n\t\t},\n\t\treceive: (connection, frame) => carrier.receive(connection, frame),\n\t\tdrop: (connection) => carrier.drop(connection),\n\t\tclose: () => {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\ttry {\n\t\t\t\tcarrier._dispose?.();\n\t\t\t} finally {\n\t\t\t\tacceptor.dispose();\n\t\t\t}\n\t\t}\n\t};\n}\n//#endregion\n//#region src/wire/SecureSession/exchangeTicketSeal.ts\nconst SEALED_ENVELOPE_LENGTH = 2;\nfunction createExchangeTicketSealer(link, options = {}) {\n\tlet keyPromise;\n\tconst getKey = () => {\n\t\tif (keyPromise == null) keyPromise = link.deriveLocalSealKey({ version: options.version }).catch((err) => {\n\t\t\tkeyPromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn keyPromise;\n\t};\n\treturn {\n\t\tasync seal(value, ttlMs) {\n\t\t\tconst { nonce, ciphertext } = await encryptBytesWithAesGcmKey({\n\t\t\t\tdataToEncrypt: pack({\n\t\t\t\t\tv: value,\n\t\t\t\t\texp: Date.now() + ttlMs\n\t\t\t\t}),\n\t\t\t\taesGcmKey: await getKey()\n\t\t\t});\n\t\t\treturn bytesToBase64(pack([nonce, ciphertext]));\n\t\t},\n\t\tasync open(blob) {\n\t\t\ttry {\n\t\t\t\tconst envelope = unpack(base64ToBytes(blob));\n\t\t\t\tif (!Array.isArray(envelope) || envelope.length !== SEALED_ENVELOPE_LENGTH) return void 0;\n\t\t\t\tconst [nonce, ciphertext] = envelope;\n\t\t\t\tif (!(nonce instanceof Uint8Array) || !(ciphertext instanceof Uint8Array)) return void 0;\n\t\t\t\tconst payload = unpack(await decryptBytesWithAesGcmKey({\n\t\t\t\t\tdataToDecrypt: {\n\t\t\t\t\t\tnonce,\n\t\t\t\t\t\tciphertext\n\t\t\t\t\t},\n\t\t\t\t\taesGcmKey: await getKey()\n\t\t\t\t}));\n\t\t\t\tif (payload == null || typeof payload.exp !== \"number\" || payload.exp < Date.now()) return;\n\t\t\t\treturn payload.v;\n\t\t\t} catch {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n}\n//#endregion\n//#region src/wire/Connect/WireExchangeAcceptor.ts\n/** The default session-ticket lifetime — see {@link IWireExchangeAcceptorOptions.sessionTtlMs}. */\nconst DEFAULT_SESSION_TTL_MS = 720 * 60 * 1e3;\n/** The handshake continuation (`hsc`) only bridges the two handshake POSTs, so it expires quickly. */\nconst HANDSHAKE_CONTINUATION_TTL_MS = 120 * 1e3;\nconst textEncoder = new TextEncoder();\nconst textDecoder = new TextDecoder();\n/**\n* The exchange (request/reply) acceptor backbone — the HTTP counterpart to `WireAcceptor`'s\n* duplex sessions, re-homed from nice-action's `ExchangeAcceptor` (shared connection design,\n* Phase 6). Each POST body is one exchange envelope; the acceptor drives the server handshake\n* over the two `hs` POSTs, mints a session **token** on accept, and on every later `act` POST\n* resolves the session by token, decrypts the body (at `encrypted`), hands the opened lane wire\n* to {@link IWireExchangeAcceptorLane.onExchange}, and returns the (encrypted) reply inline.\n*\n* **Stateless.** It holds no in-memory handshakes or sessions: the in-flight handshake `pending`\n* is sealed into the `hsc` continuation token returned on `welcome` and echoed back on `prove`,\n* and the live session is sealed into the `t` token replayed on every `act`. Both are sealed\n* under the acceptor's own persisted identity ({@link createExchangeTicketSealer}), so any\n* isolate that loaded the same identity can serve any POST — no request needs to co-locate with\n* another. A tampered, wrong-key, or expired token opens to \"no valid session\".\n*/\nvar WireExchangeAcceptor = class {\n\t_security;\n\t_lane;\n\t_allowedLevels;\n\t_noneAllowed;\n\t_sealer;\n\t_sessionTtlMs;\n\tconstructor(options) {\n\t\tthis._security = options.security;\n\t\tthis._lane = options.lane;\n\t\tthis._allowedLevels = Array.isArray(options.security.securityLevel) ? options.security.securityLevel : [options.security.securityLevel];\n\t\tthis._noneAllowed = this._allowedLevels.includes(\"none\");\n\t\tthis._sealer = createExchangeTicketSealer(options.security.link);\n\t\tthis._sessionTtlMs = options.sessionTtlMs ?? DEFAULT_SESSION_TTL_MS;\n\t}\n\t/** Process one POST body (an exchange envelope), returning the reply body to send back. */\n\tasync handlePost(body) {\n\t\tconst request = decodeExchangeRequest(body);\n\t\tif (request == null) return this._err(\"malformed exchange request\");\n\t\tawait this._security.link.initialize();\n\t\tif (request.k === \"hs\") return encodeExchange(await this._handleHandshake(request));\n\t\treturn encodeExchange(await this._handleAction(request));\n\t}\n\t_makeHandshake() {\n\t\tconst security = this._security;\n\t\treturn createServerHandshake({\n\t\t\tlink: security.link,\n\t\t\tlocalCoordinate: security.localCoordinate,\n\t\t\tdictionaryVersion: this._lane.dictionaryVersion,\n\t\t\tsecurityLevel: security.securityLevel,\n\t\t\tverifyKeyResolver: security.verifyKeyResolver\n\t\t});\n\t}\n\tasync _handleHandshake(request) {\n\t\tconst message = decodeHandshakeMessage(request.m);\n\t\tif (message == null) return {\n\t\t\tk: \"err\",\n\t\t\tmessage: \"malformed handshake message\"\n\t\t};\n\t\tif (message.t === \"hello\") {\n\t\t\tconst handshake = this._makeHandshake();\n\t\t\tconst reply = await handshake.onHello(message);\n\t\t\tif (reply.t === \"reject\") return {\n\t\t\t\tk: \"hs\",\n\t\t\t\tm: encodeHandshakeMessage(reply)\n\t\t\t};\n\t\t\tconst pending = handshake.exportPending();\n\t\t\tif (pending == null) return {\n\t\t\t\tk: \"err\",\n\t\t\t\tmessage: \"handshake produced no continuation state\"\n\t\t\t};\n\t\t\tconst hsc = await this._sealer.seal(pending, HANDSHAKE_CONTINUATION_TTL_MS);\n\t\t\treturn {\n\t\t\t\tk: \"hs\",\n\t\t\t\tm: encodeHandshakeMessage(reply),\n\t\t\t\thsc\n\t\t\t};\n\t\t}\n\t\tif (message.t === \"prove\") {\n\t\t\tif (request.hsc == null) return {\n\t\t\t\tk: \"err\",\n\t\t\t\tmessage: \"prove missing continuation token\"\n\t\t\t};\n\t\t\tconst pending = await this._sealer.open(request.hsc);\n\t\t\tif (pending == null) return {\n\t\t\t\tk: \"err\",\n\t\t\t\tmessage: \"invalid or expired continuation token\"\n\t\t\t};\n\t\t\tconst handshake = this._makeHandshake();\n\t\t\tawait handshake.restorePending(pending);\n\t\t\tconst reply = await handshake.onProve(message);\n\t\t\tconst result = handshake.getResult();\n\t\t\tif (reply.t === \"accept\" && result != null) {\n\t\t\t\tconst ticket = {\n\t\t\t\t\tclient: result.remote,\n\t\t\t\t\tsecurityLevel: result.securityLevel,\n\t\t\t\t\tkeyMaterial: result.encryptionKeyMaterial\n\t\t\t\t};\n\t\t\t\tconst t = await this._sealer.seal(ticket, this._sessionTtlMs);\n\t\t\t\treturn {\n\t\t\t\t\tk: \"hs\",\n\t\t\t\t\tm: encodeHandshakeMessage(reply),\n\t\t\t\t\tt\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tk: \"hs\",\n\t\t\t\tm: encodeHandshakeMessage(reply)\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tk: \"err\",\n\t\t\tmessage: `unexpected handshake message ${message.t}`\n\t\t};\n\t}\n\tasync _handleAction(request) {\n\t\tlet client;\n\t\tlet crypto;\n\t\tlet wire;\n\t\tlet securityLevel = \"none\";\n\t\tif (request.t != null) {\n\t\t\tconst ticket = await this._sealer.open(request.t);\n\t\t\tif (ticket == null) return {\n\t\t\t\tk: \"err\",\n\t\t\t\tmessage: \"unknown or expired session token\"\n\t\t\t};\n\t\t\tclient = new RuntimeCoordinate(ticket.client);\n\t\t\tsecurityLevel = ticket.securityLevel;\n\t\t\tcrypto = ticket.securityLevel === \"encrypted\" && ticket.keyMaterial != null ? createActionFrameCrypto({\n\t\t\t\tlink: this._security.link,\n\t\t\t\tkeyMaterial: ticket.keyMaterial\n\t\t\t}) : void 0;\n\t\t\tif (\"c\" in request) {\n\t\t\t\tif (crypto == null) return {\n\t\t\t\t\tk: \"err\",\n\t\t\t\t\tmessage: \"session is not encrypted\"\n\t\t\t\t};\n\t\t\t\tconst plain = await crypto.decryptFrame(base64ToBytes(request.c));\n\t\t\t\twire = JSON.parse(textDecoder.decode(plain));\n\t\t\t} else wire = request.w;\n\t\t} else {\n\t\t\tif (!this._noneAllowed || \"c\" in request) return {\n\t\t\t\tk: \"err\",\n\t\t\t\tmessage: \"missing session token\"\n\t\t\t};\n\t\t\twire = request.w;\n\t\t}\n\t\tconst laneReply = await this._lane.onExchange({\n\t\t\twire,\n\t\t\tclient,\n\t\t\tsecurityLevel,\n\t\t\tencrypted: crypto != null\n\t\t});\n\t\tif (!laneReply.ok) return {\n\t\t\tk: \"err\",\n\t\t\tmessage: laneReply.message\n\t\t};\n\t\tif (crypto != null && \"c\" in request) return {\n\t\t\tk: \"act\",\n\t\t\tc: bytesToBase64(await crypto.encryptFrame(textEncoder.encode(JSON.stringify(laneReply.wire))))\n\t\t};\n\t\treturn {\n\t\t\tk: \"act\",\n\t\t\tw: laneReply.wire\n\t\t};\n\t}\n\t_err(message) {\n\t\treturn encodeExchange({\n\t\t\tk: \"err\",\n\t\t\tmessage\n\t\t});\n\t}\n};\n//#endregion\n//#region src/wire/codec/controlFrame.ts\n/** msgpack map (object) first-byte prefixes — fixmap `0x80–0x8f`, map16 `0xde`, map32 `0xdf`. */\nfunction looksLikeControlFrame(buffer) {\n\tif (buffer.length === 0) return false;\n\tconst b = buffer[0];\n\treturn b >= 128 && b <= 143 || b === 222 || b === 223;\n}\nfunction isControlMessage(value) {\n\tif (value == null || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tif (!(\"$c\" in value && \"domain\" in value && \"id\" in value)) return false;\n\tif (typeof value.domain !== \"string\" || typeof value.id !== \"string\") return false;\n\tif (\"k\" in value && value.k != null && typeof value.k !== \"string\") return false;\n\tif (value.$c === \"rack\") return \"ack\" in value && typeof value.ack === \"number\";\n\tif (value.$c === \"rsync\") return true;\n\tif (value.$c === \"rskip\") return \"seq\" in value && typeof value.seq === \"number\";\n\tif (value.$c === \"rclose\") return true;\n\treturn false;\n}\nfunction encodeControlFrame(message) {\n\treturn pack(message);\n}\n/**\n* Decode a frame as a control message, or `undefined` if it isn't one (a best-effort peek — action frames\n* short-circuit on the first byte without a full unpack). Only binary frames are considered.\n*/\nfunction decodeControlFrame(frame) {\n\tlet buffer;\n\tif (frame instanceof ArrayBuffer) buffer = new Uint8Array(frame);\n\telse if (frame instanceof Uint8Array) buffer = frame;\n\telse return void 0;\n\tif (!looksLikeControlFrame(buffer)) return void 0;\n\ttry {\n\t\tconst decoded = unpack(buffer);\n\t\treturn isControlMessage(decoded) ? decoded : void 0;\n\t} catch {\n\t\treturn;\n\t}\n}\n//#endregion\n//#region src/wire/PeerLink/ReliableInbox.ts\nconst DEFAULT_MAX_PENDING = 1024;\nvar ReliableInbox = class {\n\t_streams = /* @__PURE__ */ new Map();\n\t_maxPending;\n\tconstructor(options) {\n\t\tthis._maxPending = options?.maxPendingPerStream ?? DEFAULT_MAX_PENDING;\n\t}\n\t_stream(streamId) {\n\t\tlet state = this._streams.get(streamId);\n\t\tif (state == null) {\n\t\t\tstate = {\n\t\t\t\tcontiguousSeq: -1,\n\t\t\t\tpending: /* @__PURE__ */ new Map()\n\t\t\t};\n\t\t\tthis._streams.set(streamId, state);\n\t\t}\n\t\treturn state;\n\t}\n\t/**\n\t* Feed one reliable frame's `seq` (plus the caller's `payload` to dispatch) and get the decision:\n\t* what to deliver now, the ack to return, and whether it was a duplicate. See the class doc for the\n\t* three cases.\n\t*/\n\treceive(streamId, seq, payload) {\n\t\tif (seq > 0 && !this._streams.has(streamId)) return {\n\t\t\tdeliver: [],\n\t\t\tack: -1,\n\t\t\tduplicate: false,\n\t\t\tneedsResync: true\n\t\t};\n\t\tconst state = this._stream(streamId);\n\t\tif (seq <= state.contiguousSeq) return {\n\t\t\tdeliver: [],\n\t\t\tack: state.contiguousSeq,\n\t\t\tduplicate: true\n\t\t};\n\t\tif (seq === state.contiguousSeq + 1) {\n\t\t\tconst deliver = [payload];\n\t\t\tstate.contiguousSeq = seq;\n\t\t\twhile (state.pending.has(state.contiguousSeq + 1)) {\n\t\t\t\tconst next = state.contiguousSeq + 1;\n\t\t\t\tdeliver.push(state.pending.get(next));\n\t\t\t\tstate.pending.delete(next);\n\t\t\t\tstate.contiguousSeq = next;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdeliver,\n\t\t\t\tack: state.contiguousSeq,\n\t\t\t\tduplicate: false\n\t\t\t};\n\t\t}\n\t\tif (!state.pending.has(seq) && state.pending.size < this._maxPending) state.pending.set(seq, payload);\n\t\treturn {\n\t\t\tdeliver: [],\n\t\t\tack: state.contiguousSeq,\n\t\t\tduplicate: false\n\t\t};\n\t}\n\t/**\n\t* Sender-abandoned skip (see {@link IReliableReceiver.skipTo}): advance `contiguousSeq` to at least\n\t* `seq` — the abandoned frames count as settled — then drain the buffered contiguous run that was\n\t* waiting behind the gap. Creates the stream when unseen (the sender is mid-stream; tracking it from the\n\t* skip point means the following frames arrive in-order instead of tripping the re-sync detection).\n\t*/\n\tskipTo(streamId, seq) {\n\t\tconst state = this._stream(streamId);\n\t\tif (seq <= state.contiguousSeq) return {\n\t\t\tdeliver: [],\n\t\t\tack: state.contiguousSeq,\n\t\t\tduplicate: true\n\t\t};\n\t\tconst deliver = [];\n\t\tstate.contiguousSeq = seq;\n\t\tfor (const pendingSeq of [...state.pending.keys()]) if (pendingSeq <= seq) state.pending.delete(pendingSeq);\n\t\twhile (state.pending.has(state.contiguousSeq + 1)) {\n\t\t\tconst next = state.contiguousSeq + 1;\n\t\t\tdeliver.push(state.pending.get(next));\n\t\t\tstate.pending.delete(next);\n\t\t\tstate.contiguousSeq = next;\n\t\t}\n\t\treturn {\n\t\t\tdeliver,\n\t\t\tack: state.contiguousSeq,\n\t\t\tduplicate: false\n\t\t};\n\t}\n\t/** The current contiguous high-water for a stream (`-1` if unseen) — used to piggyback an ack on a reply. */\n\tcontiguousSeq(streamId) {\n\t\treturn this._streams.get(streamId)?.contiguousSeq ?? -1;\n\t}\n\t/** Whether this inbox is tracking a stream (i.e. has seen at least one reliable frame for it). */\n\thasStream(streamId) {\n\t\treturn this._streams.has(streamId);\n\t}\n\t/** Forget a stream's state (e.g. when its connection drops). */\n\tforget(streamId) {\n\t\tthis._streams.delete(streamId);\n\t}\n\t/** {@link IReliableReceiver.forgetStream} — same as {@link forget} (all session-tier state is in-memory). */\n\tforgetStream(streamId) {\n\t\tthis.forget(streamId);\n\t}\n};\n//#endregion\n//#region src/wire/PeerLink/reliableStream.ts\n/**\n* Local key for a reliable stream — `(peer identity + domain:id route [+ #streamKey])`. It is *never*\n* serialized whole: each side reconstructs it from the connection (the peer) and the frame's route, so only\n* the per-frame `seq`/`ack` integers (and the optional `streamKey` discriminator) ride the wire. The\n* connector keys by its server peer; the acceptor keys by the originating client — the two ids need not\n* match textually, only be internally consistent per side. An optional `streamKey` (E3) appends `#<key>` so\n* several independent ordered streams of the same action (e.g. one per room id) stay separate.\n*/\nfunction reliableStreamId(peer, domain, actionId, streamKey) {\n\tconst base = `${peer.stringId}::${domain}:${actionId}`;\n\treturn streamKey == null ? base : `${base}#${streamKey}`;\n}\n/** Routes already warned about a reliability downgrade, so a hot stream warns once, not per frame. */\nconst _warnedReliableDowngradeRoutes = /* @__PURE__ */ new Set();\n/**\n* One-time dev warning that a `.reliable()` frame is going out a transport with **no binary codec**, so its\n* reliability metadata (the `seq`/`ack` slot) — which rides the binary wire only — is silently dropped and\n* the frame degrades to best-effort (no ordering, dedup, or resend). The high-level `connectChannel` always\n* supplies a codec, so this only fires for a hand-rolled transport with none; surfacing it turns an invisible\n* downgrade into one visible line. Warns once per `domain:id` route (a reliable stream is high-frequency).\n*/\nfunction warnReliableWireUnavailableOnce(domain, actionId) {\n\tconst route = `${domain}:${actionId}`;\n\tif (_warnedReliableDowngradeRoutes.has(route)) return;\n\t_warnedReliableDowngradeRoutes.add(route);\n\tconsole.warn(`[reliable] \"${route}\" is .reliable() but this transport has no binary codec, so its reliability metadata can't be sent — the frame is delivered best-effort (no ordering/dedup/resend). Reliable delivery requires the binary wire codec (use a channel-based transport).`);\n}\n/** Routes already warned about an unsupported reliable peer, so the warning is once, not per frame. */\nconst _warnedReliablePeerRoutes = /* @__PURE__ */ new Set();\n/**\n* One-time dev warning that a `.reliable()` frame is going to a peer whose handshake did **not** advertise\n* the reliable capability ({@link CAP_RELIABLE}) — an older server that predates reliable delivery. The frame\n* is still sent (best-effort), but the peer won't apply ordering/dedup/resend, so surface the version skew\n* instead of silently emitting frames it may not interpret. Warns once per `domain:id` route.\n*/\nfunction warnReliablePeerUnsupportedOnce(domain, actionId) {\n\tconst route = `${domain}:${actionId}`;\n\tif (_warnedReliablePeerRoutes.has(route)) return;\n\t_warnedReliablePeerRoutes.add(route);\n\tconsole.warn(`[reliable] \"${route}\" is .reliable() but the connected peer did not advertise reliable support (an older server) — the frame is sent best-effort (no ordering/dedup/resend). Upgrade the peer to enable reliable delivery.`);\n}\n/** Routes already warned about a peer lacking streamkey support, so the warning is once, not per frame. */\nconst _warnedReliableStreamKeyRoutes = /* @__PURE__ */ new Set();\n/**\n* One-time dev warning that a keyed (`streamKey`) `.reliable()` frame (E3) is going to a peer whose\n* handshake did **not** advertise the streamkey capability ({@link CAP_RELIABLE_STREAMKEY}) — a peer that\n* predates per-key streams. The keyed frame is a distinct length the peer rejects wholesale (it isn't\n* mis-decoded), so it simply won't be delivered; surface the version skew instead of failing silently.\n* Warns once per `domain:id` route.\n*/\nfunction warnReliableStreamKeyUnsupportedOnce(domain, actionId) {\n\tconst route = `${domain}:${actionId}`;\n\tif (_warnedReliableStreamKeyRoutes.has(route)) return;\n\t_warnedReliableStreamKeyRoutes.add(route);\n\tconsole.warn(`[reliable] \"${route}\" was sent with a streamKey but the connected peer did not advertise streamkey support (an older peer) — a keyed reliable frame it can't interpret is dropped, not delivered. Upgrade the peer, or drop the streamKey to use the single default stream.`);\n}\n/** Routes already warned about a reliable-declared server push, so the warning is once, not per push. */\nconst _warnedReliablePushRoutes = /* @__PURE__ */ new Set();\n/**\n* One-time dev warning that a **server-initiated push** (`pushToClient` / `broadcast` / an acceptor's\n* `handleActionRequest`) is sending a `.reliable()`-declared action: reliability engages in the\n* **connector → acceptor** direction only, so this push is delivered best-effort — no outbox, no seq, no\n* resend. Surfacing it turns a silent direction downgrade into one visible line. For a push stream that\n* must all arrive, build the persisted-log recipe (append + replay-on-reconnect); for a single push that\n* needs confirmation, await `pushToClient(...).waitForResultPayload()` and retry.\n*/\nfunction warnReliablePushUnsupportedOnce(domain, actionId) {\n\tconst route = `${domain}:${actionId}`;\n\tif (_warnedReliablePushRoutes.has(route)) return;\n\t_warnedReliablePushRoutes.add(route);\n\tconsole.warn(`[reliable] \"${route}\" is .reliable() but server→client pushes are best-effort (reliability is connector→acceptor only) — no outbox, seq, or resend on this push. For a guaranteed push stream see the reliable-push recipe (per-client ReliableLog + replay on reconnect); for a single confirmed push, await waitForResultPayload() and retry.`);\n}\n/** Routes already warned about an abandoned reply-less delivery, so the warning is once, not per frame. */\nconst _warnedReliableAbandonedRoutes = /* @__PURE__ */ new Set();\n/**\n* One-time dev warning that a **reply-less** reliable send was abandoned: its delivery deadline expired\n* (or an aborted newer frame swept it) while unacked. Its caller was already told \"success on send\" —\n* that's the reply-less contract — so this is the only place the non-delivery becomes visible: the frame\n* was dropped, an `rskip` told the receiver to continue past it. Reply-carrying sends don't need this\n* (their action aborts loudly with `reliable_delivery_abandoned`). Warns once per `domain:id` route.\n*/\nfunction warnReliableDeliveryAbandonedOnce(domain, actionId) {\n\tconst route = `${domain}:${actionId}`;\n\tif (_warnedReliableAbandonedRoutes.has(route)) return;\n\t_warnedReliableAbandonedRoutes.add(route);\n\tconsole.warn(`[reliable] a reply-less \"${route}\" frame was abandoned — not acknowledged within the delivery deadline. The stream skips past it and continues; the frame may not have been delivered. (Reply-less reliable sends report success on send; this warning is where a bounded non-delivery surfaces.)`);\n}\n/** Test-only: clear the warn-once latches so each test observes the first warning. */\nfunction _resetReliableDowngradeWarnings() {\n\t_warnedReliableDowngradeRoutes.clear();\n\t_warnedReliablePeerRoutes.clear();\n\t_warnedReliableStreamKeyRoutes.clear();\n\t_warnedReliableAbandonedRoutes.clear();\n\t_warnedReliablePushRoutes.clear();\n}\n//#endregion\nexport { securityLevelMeets as A, sendFrame as B, WireLinkConnection as C, establishSecureDuplexSession as D, establishPlainDuplexSession as E, classifyConnectFailure as F, inMemoryCarrier as G, sanitizeEndpoint as H, describeNonProtocolBody as I, wsAcceptorCarrier as J, createInMemoryChannelPair as K, endpointFromConnectFailure as L, EWireConnectionStatus as M, httpCarrier as N, WireClient as O, EWireConnectFailureKind as P, wsCarrier as R, WireProtocolMux as S, addTransportStatusMetadata as T, rtcCarrier as U, shortWs as V, rtcDataChannelByteChannel as W, ETransportStatus as X, ETransportShape as Y, decodeExchangeRequest as _, warnReliablePushUnsupportedOnce as a, wireSelectionErrors as b, ReliableInbox as c, WireExchangeAcceptor as d, createExchangeTicketSealer as f, decodeExchangeReply as g, establishSecureExchangeSession as h, warnReliablePeerUnsupportedOnce as i, ConnectionTransportManager as j, SECURITY_LEVEL_RANK as k, decodeControlFrame as l, establishPlainExchangeSession as m, reliableStreamId as n, warnReliableStreamKeyUnsupportedOnce as o, serveWire as p, createDuplexCarrierLifecycle as q, warnReliableDeliveryAbandonedOnce as r, warnReliableWireUnavailableOnce as s, _resetReliableDowngradeWarnings as t, encodeControlFrame as u, encodeExchange as v, TransportConnection as w, assembleWireConnectionParts as x, createWireClient as y, webSocketByteChannel as z };\n\n//# sourceMappingURL=wire-D7Nv6hx_.mjs.map"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,mBAAmBA,uBAAAA,SAAS,kBAAkB;CACnD,QAAQ;CACR,QAAQ;;EAEP,mBAAmBC,uBAAAA,IAAI,EAAE,UAAU,EAAE,QAAQ,gBAAgB,sBAAsB,OAAO,0CAA0C,UAAU,KAAK,IAAI,KAAK,kBAAkB,IAAI,CAAC;;EAEnL,gBAAgBA,uBAAAA,IAAI,EAAE,UAAU,EAAE,aAAa,sBAAsB,OAAO,qEAAqE,CAAC;;;;;;EAMlJ,aAAaA,uBAAAA,IAAI,EAAE,UAAU,EAAE,QAAQ,cAAc,QAAQ,eAAe,iBAAiB,OAAO,UAAU,aAAa,GAAG,YAAY,OAAO,YAAY,aAAa,GAAG,WAAW,SAAS,CAAC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