ignotum 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -62
- package/dist/cli/Undici-C6Asbalt.mjs +30 -0
- package/dist/cli/Undici-C6Asbalt.mjs.map +1 -0
- package/dist/cli/bin.mjs +739 -24023
- package/dist/cli/bin.mjs.map +1 -1
- package/dist/platform/_headers +1 -1
- package/dist/platform/_ignotum/v1.1/client.js +12 -0
- package/dist/runtime/{api-BnUKx9cj-D49Tf0rX.d.ts → api-BnUKx9cj-K-F-SOLs.d.ts} +4 -4
- package/dist/runtime/{api-C-tltz6s.js → api-CrrSjYL1.js} +2 -2
- package/dist/runtime/{api-C-tltz6s.js.map → api-CrrSjYL1.js.map} +1 -1
- package/dist/runtime/{bootstrap-DlNIfH-r.js → bootstrap-CLVnD5vS.js} +4 -4
- package/dist/runtime/bootstrap-CLVnD5vS.js.map +1 -0
- package/dist/runtime/{bootstrap-DjTwGJao-DBx5zdFI.d.ts → bootstrap-DjTwGJao-DPi768T4.d.ts} +3 -3
- package/dist/runtime/client.d.ts +9 -9
- package/dist/runtime/client.js +4 -4
- package/dist/runtime/id-BPFV3D3V.d.ts +1 -0
- package/dist/runtime/{id-7an3nxTu-DZJSM5xh.d.ts → id-D87q-n2D-CDMwTSUR.d.ts} +2 -2
- package/dist/runtime/{id-BrEnxY-r.js → id-rzjaCxeF.js} +11 -2
- package/dist/runtime/{id-BrEnxY-r.js.map → id-rzjaCxeF.js.map} +1 -1
- package/dist/runtime/{index-Biaw5vdF.d.ts → index-BWHInzfU.d.ts} +3 -3
- package/dist/runtime/internal/api.d.ts +1 -1
- package/dist/runtime/internal/api.js +1 -1
- package/dist/runtime/internal/bootstrap.d.ts +1 -1
- package/dist/runtime/internal/bootstrap.js +1 -1
- package/dist/runtime/internal/client.d.ts +1 -1
- package/dist/runtime/internal/client.js +4 -4
- package/dist/runtime/internal/client.js.map +1 -1
- package/dist/runtime/internal/host.d.ts +6 -6
- package/dist/runtime/internal/host.js +3 -3
- package/dist/runtime/internal/routes.d.ts +1 -1
- package/dist/runtime/internal/server.d.ts +1 -1
- package/dist/runtime/internal/server.js +1 -1
- package/dist/runtime/internal/types.d.ts +2 -2
- package/dist/runtime/internal/types.js +1 -1
- package/dist/runtime/pagination-BPFV3D3V.d.ts +1 -0
- package/dist/runtime/{pagination--f4kMKf6.js → pagination-CfEleffG.js} +3 -2
- package/dist/runtime/pagination-CfEleffG.js.map +1 -0
- package/dist/runtime/result-Bq32FA7g.d.ts +1 -0
- package/dist/runtime/{router-C1eC9yy5.js → router-CfNPtoVO.js} +109 -60
- package/dist/runtime/router-CfNPtoVO.js.map +1 -0
- package/dist/runtime/{schema-BSjepoNF.js → schema-JtFb4BbG.js} +3 -3
- package/dist/runtime/{schema-BSjepoNF.js.map → schema-JtFb4BbG.js.map} +1 -1
- package/dist/runtime/server.d.ts +5 -5
- package/dist/runtime/server.js +2 -2
- package/dist/runtime/{sync-By2hX5ev.d.ts → sync-BMmV8oYt.d.ts} +2 -2
- package/dist/runtime/{sync-BwgS19Xy.js → sync-DUfp7S5R.js} +2 -2
- package/dist/runtime/{sync-BwgS19Xy.js.map → sync-DUfp7S5R.js.map} +1 -1
- package/dist/runtime/{types-DeCCyqLU-CHx7KFtx.d.ts → types-BeT6F0Pg-DMvRDN0c.d.ts} +5 -5
- package/package.json +10 -9
- package/src/cli/app-configuration.ts +44 -5
- package/src/cli/auth-client.ts +3 -3
- package/src/cli/build/managed-server.ts +3 -2
- package/src/cli/build/server.ts +2 -2
- package/src/cli/command.ts +19 -11
- package/src/cli/control-client.ts +2 -2
- package/src/cli/deploy.ts +27 -2
- package/src/cli/dev.ts +1 -1
- package/src/cli/managed-dev-platform.ts +13 -4
- package/src/cli/module-boundaries.ts +1 -1
- package/src/cli/new-app.ts +35 -6
- package/src/cli/package-manager.ts +1 -1
- package/src/cli/path.ts +11 -0
- package/src/cli/route-codegen.ts +2 -1
- package/src/cli/route-static.ts +10 -4
- package/src/cli/typecheck.ts +66 -0
- package/src/cli/upload-journal.ts +3 -3
- package/src/dev-runtime/database.ts +1 -1
- package/src/dev-runtime/files.ts +1 -1
- package/src/dev-runtime/managed-functions.ts +3 -2
- package/src/dev-runtime/managed-sync.ts +114 -105
- package/src/dev-runtime/managed-websocket.ts +11 -7
- package/src/dev-runtime/migrations.ts +2 -2
- package/src/dev-runtime/sync.ts +3 -3
- package/dist/platform/_ignotum/v1.0/client.js +0 -12
- package/dist/runtime/bootstrap-DlNIfH-r.js.map +0 -1
- package/dist/runtime/id-BI08JkmR.d.ts +0 -1
- package/dist/runtime/pagination--f4kMKf6.js.map +0 -1
- package/dist/runtime/pagination-BI08JkmR.d.ts +0 -1
- package/dist/runtime/result-BkziOG1L.d.ts +0 -1
- package/dist/runtime/router-C1eC9yy5.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-CfNPtoVO.js","names":["Array","String","Versioned.initial","Versioned.initial","Result","invalid","Array"],"sources":["../../../contracts/dist/json.js","../../../platform/dist/versions/1/browser/errors.js","../../../shared/dist/id.js","../../../platform/dist/versions/1/browser/files.js","../../../platform/dist/versions/1/browser/id.js","../../../contracts/dist/execution.js","../../../platform/dist/versions/1/browser/recovery-journal.js","../../../platform/dist/versions/1/browser/managed-upgrade.js","../../../contracts/dist/runtime/index.js","../../../contracts/dist/runtime/hosted.js","../../../contracts/dist/managed-sync.js","../../../platform/dist/versions/1/browser/managed-client.js","../../../platform/dist/versions/1/browser/sync.js","../../../shared/dist/routing/pattern.js","../../../shared/dist/routing/url.js","../../../platform/dist/versions/1/browser/router.js"],"sourcesContent":["import { Array, Predicate, Schema, String } from \"effect\";\n//#region src/json.ts\nconst encodeJson = (value) => {\n\tif (Array.isArray(value)) return `[${value.map(encodeJson).join(\",\")}]`;\n\tif (value === null || Predicate.isString(value) || Predicate.isNumber(value) || Predicate.isBoolean(value)) return JSON.stringify(value);\n\treturn `{${Array.sortWith(Object.entries(value), ([key]) => key, String.Order).map(([key, field]) => `${JSON.stringify(key)}:${encodeJson(field)}`).join(\",\")}}`;\n};\nconst encodeCanonicalJson = (value) => encodeJson(Schema.decodeSync(Schema.Json)(value));\n//#endregion\nexport { encodeCanonicalJson };\n\n//# sourceMappingURL=json.js.map","import { Cause, Effect, ErrorReporter, Schema } from \"effect\";\nimport { FunctionAddress } from \"@ignotum/contracts/runtime/sync\";\n//#region src/versions/1/browser/errors.ts\n/** @effect-diagnostics globalConsole:skip-file */\nvar ConnectionUnavailable = class extends Schema.TaggedError()(\"ConnectionUnavailable\", {\n\tcause: Schema.optional(Schema.Defect()),\n\tmessage: Schema.String\n}) {};\nvar PlatformUpgrading = class extends Schema.TaggedError()(\"PlatformUpgrading\", { message: Schema.String }) {};\nvar InvalidMutationArguments = class extends Schema.TaggedError()(\"InvalidMutationArguments\", {\n\tcause: Schema.Defect(),\n\tfunction: FunctionAddress,\n\tmessage: Schema.String\n}) {};\nvar InvalidServerMessage = class extends Schema.TaggedError()(\"InvalidServerMessage\", {\n\tcause: Schema.Defect(),\n\tmessage: Schema.String\n}) {};\nvar ServerError = class extends Schema.TaggedError()(\"ServerError\", {\n\tcode: Schema.Literals([\n\t\t\"PlatformUpgrading\",\n\t\t\"SessionExpired\",\n\t\t\"InvalidMessage\",\n\t\t\"Unavailable\",\n\t\t\"InvalidArguments\",\n\t\t\"InvocationIdConflict\",\n\t\t\"ResourceLimitExceeded\"\n\t]),\n\tmessage: Schema.String\n}) {};\nconst ClientInfrastructureError = Schema.Union([\n\tPlatformUpgrading,\n\tConnectionUnavailable,\n\tInvalidMutationArguments,\n\tInvalidServerMessage,\n\tServerError\n]);\nconst browserErrorReporter = ErrorReporter.make(({ attributes, error }) => {\n\tglobalThis.console.error(\"Ignotum infrastructure error\", error, attributes);\n});\nconst clientErrorReporterLayer = ErrorReporter.layer([browserErrorReporter]);\nconst reportClientError = Effect.fn(\"ClientErrorReporter.report\")(function* (error) {\n\tyield* ErrorReporter.report(Cause.fail(error));\n});\n//#endregion\nexport { ClientInfrastructureError, ConnectionUnavailable, InvalidMutationArguments, InvalidServerMessage, PlatformUpgrading, ServerError, clientErrorReporterLayer, reportClientError };\n\n//# sourceMappingURL=errors.js.map","import { Context, Effect, Layer, Schema } from \"effect\";\nimport { IdAlphabet, IdLength } from \"@ignotum/contracts/runtime/id\";\nimport { customAlphabet } from \"nanoid\";\n//#region src/id.ts\nconst decodeGenerated = (definition, payload) => Schema.decodeSync(definition)(definition.idPrefix === void 0 ? payload : `${definition.idPrefix}_${payload}`);\nvar IdGenerator = class IdGenerator extends Context.Service()(\"@ignotum/shared/id/IdGenerator\") {\n\tstatic layer = Layer.sync(IdGenerator, () => {\n\t\tconst generatePayload = customAlphabet(IdAlphabet, IdLength);\n\t\treturn IdGenerator.of({ generate: (definition) => Effect.sync(() => decodeGenerated(definition, generatePayload())) });\n\t});\n\tstatic deterministic = (startAt = 1) => Layer.sync(IdGenerator, () => {\n\t\tconst counters = /* @__PURE__ */ new Map();\n\t\treturn IdGenerator.of({ generate: (definition) => Effect.sync(() => {\n\t\t\tconst counter = (counters.get(definition.idPrefix) ?? startAt - 1) + 1;\n\t\t\tcounters.set(definition.idPrefix, counter);\n\t\t\treturn decodeGenerated(definition, counter.toString(36).padStart(IdLength, \"0\"));\n\t\t}) });\n\t});\n};\n//#endregion\nexport { IdGenerator };\n\n//# sourceMappingURL=id.js.map","import { ConnectionUnavailable, InvalidMutationArguments, InvalidServerMessage } from \"./errors.js\";\nimport { Effect, Predicate, Schema } from \"effect\";\nimport { IdGenerator } from \"@ignotum/shared/id\";\nimport { FileId, fileFormats, fileGrantUrlOf, fileIdOf, fileLimits, fileMimeTypes, grantFileValue, isFileValue, makeFileValue } from \"@ignotum/contracts/schema/file\";\n//#region src/versions/1/browser/files.ts\nconst Files = { url: (file) => {\n\tconst url = fileGrantUrlOf(file);\n\tif (url === void 0) throw new Error(\"This FileValue has no active query grant.\");\n\treturn url;\n} };\nconst formatByMime = {};\nfor (const format of fileFormats) formatByMime[fileMimeTypes[format]] = format;\nconst MutationObject = Schema.ObjectKeyword.check(Schema.makeFilter((value) => Object.prototype.toString.call(value) === \"[object Object]\", { message: \"Mutation objects must contain ordinary fields; built-in collections are unsupported.\" }));\nconst collectNativeFiles = (value, files) => {\n\tif (value instanceof File) {\n\t\tfiles.add(value);\n\t\treturn;\n\t}\n\tif (isFileValue(value) || Predicate.isDate(value)) return;\n\tif (globalThis.Array.isArray(value)) {\n\t\tfor (const child of value) collectNativeFiles(child, files);\n\t\treturn;\n\t}\n\tif (!Predicate.isObject(value)) return;\n\tfor (const child of Object.values(Schema.decodeSync(MutationObject)(value))) collectNativeFiles(child, files);\n};\nconst replaceNativeFiles = (value, replacements) => {\n\tif (value instanceof File) return replacements.get(value);\n\tif (isFileValue(value) || Predicate.isDate(value)) return value;\n\tif (globalThis.Array.isArray(value)) return value.map((child) => replaceNativeFiles(child, replacements));\n\tif (!Predicate.isObject(value)) return value;\n\treturn Object.fromEntries(Object.entries(value).map(([key, child]) => [key, replaceNativeFiles(child, replacements)]));\n};\nconst prepareMutationArguments = Effect.fn(\"SyncClient.prepareMutationArguments\")(function* (input) {\n\tconst ids = yield* IdGenerator;\n\tconst unique = yield* Effect.try(() => {\n\t\tconst files = /* @__PURE__ */ new Set();\n\t\tcollectNativeFiles(input, files);\n\t\tif (files.size > fileLimits.filesPerMutation) throw new Error(`A mutation may upload at most ${fileLimits.filesPerMutation} files.`);\n\t\tif ([...files].reduce((total, file) => total + file.size, 0) > fileLimits.mutationBytes) throw new Error(`Mutation uploads may total at most ${fileLimits.mutationBytes} bytes.`);\n\t\treturn files;\n\t});\n\tconst replacements = /* @__PURE__ */ new Map();\n\tconst nativeFiles = /* @__PURE__ */ new Map();\n\tfor (const file of unique) {\n\t\tconst format = yield* Effect.try(() => {\n\t\t\tconst format = formatByMime[file.type.toLowerCase()];\n\t\t\tif (format === void 0) throw new Error(`File '${file.name}' has unsupported media type '${file.type || \"unknown\"}'.`);\n\t\t\tif (file.size === 0 || file.size > fileLimits.fileBytes) throw new Error(`File '${file.name}' must be between 1 and ${fileLimits.fileBytes} bytes.`);\n\t\t\tif (new TextEncoder().encode(file.name).byteLength > fileLimits.filenameBytes) throw new Error(`File '${file.name}' has a filename that is too long.`);\n\t\t\treturn format;\n\t\t});\n\t\tconst id = yield* ids.generate(FileId);\n\t\treplacements.set(file, makeFileValue(id, {\n\t\t\tformat,\n\t\t\tname: file.name,\n\t\t\tsize: file.size\n\t\t}));\n\t\tnativeFiles.set(id, file);\n\t}\n\treturn {\n\t\tvalue: unique.size === 0 ? input : yield* Effect.try(() => replaceNativeFiles(input, replacements)),\n\t\tnativeFiles,\n\t\tfileIds: Array.from(nativeFiles.keys())\n\t};\n});\nconst applyFileGrants = (value, grants) => {\n\tif (grants.length === 0) return value;\n\tconst byId = /* @__PURE__ */ new Map();\n\tfor (const grant of grants) {\n\t\tif (byId.has(grant.id)) throw new Error(\"A query file grant ID is duplicated.\");\n\t\tbyId.set(grant.id, grant.url);\n\t}\n\tconst matched = /* @__PURE__ */ new Set();\n\tconst visit = (current) => {\n\t\tif (isFileValue(current)) {\n\t\t\tconst id = fileIdOf(current);\n\t\t\tconst url = byId.get(id);\n\t\t\tif (url === void 0) return current;\n\t\t\tmatched.add(id);\n\t\t\treturn grantFileValue(current, url);\n\t\t}\n\t\tif (globalThis.Array.isArray(current)) return current.map(visit);\n\t\tif (!Predicate.isObject(current) || Predicate.isDate(current)) return current;\n\t\treturn Object.fromEntries(Object.entries(current).map(([key, child]) => [key, visit(child)]));\n\t};\n\tconst granted = visit(value);\n\tif (matched.size !== byId.size) throw new Error(\"A query file grant has no result value.\");\n\treturn granted;\n};\nconst uploadPreparedFiles = Effect.fn(\"uploadPreparedFiles\")(function* (nativeFiles, uploads, functionAddress) {\n\tconst expected = new Set(nativeFiles.keys());\n\tconst received = /* @__PURE__ */ new Set();\n\tconst transfers = [];\n\tfor (const upload of uploads) {\n\t\tif (!expected.has(upload.id) || received.has(upload.id)) return yield* InvalidServerMessage.make({\n\t\t\tcause: /* @__PURE__ */ new Error(`Unexpected prepared file '${upload.id}'.`),\n\t\t\tmessage: \"The server returned invalid application file preparation data.\"\n\t\t});\n\t\treceived.add(upload.id);\n\t\tconst file = nativeFiles.get(upload.id);\n\t\tif (file === void 0) return yield* InvalidServerMessage.make({\n\t\t\tcause: /* @__PURE__ */ new Error(`Missing native file '${upload.id}'.`),\n\t\t\tmessage: \"The server prepared an unknown application file.\"\n\t\t});\n\t\tif (upload.url === void 0) continue;\n\t\ttransfers.push({\n\t\t\tfile,\n\t\t\turl: upload.url\n\t\t});\n\t}\n\tif (received.size !== expected.size) return yield* InvalidServerMessage.make({\n\t\tcause: /* @__PURE__ */ new Error(\"The server omitted a prepared file.\"),\n\t\tmessage: \"The server returned incomplete application file preparation data.\"\n\t});\n\tyield* Effect.forEach(transfers, Effect.fn(\"SyncClient.uploadFile\")(function* ({ file, url }) {\n\t\tconst response = yield* Effect.tryPromise({\n\t\t\ttry: (signal) => fetch(url, {\n\t\t\t\tmethod: \"PUT\",\n\t\t\t\tbody: file,\n\t\t\t\theaders: { \"content-type\": file.type },\n\t\t\t\tsignal\n\t\t\t}),\n\t\t\tcatch: (cause) => ConnectionUnavailable.make({\n\t\t\t\tcause,\n\t\t\t\tmessage: `File '${file.name}' could not be uploaded.`\n\t\t\t})\n\t\t});\n\t\tif (!response.ok) {\n\t\t\tconst detail = yield* Effect.promise(() => response.text());\n\t\t\treturn yield* InvalidMutationArguments.make({\n\t\t\t\tcause: new Error(detail),\n\t\t\t\tfunction: functionAddress,\n\t\t\t\tmessage: `File '${file.name}' was rejected by application storage.`\n\t\t\t});\n\t\t}\n\t}), {\n\t\tconcurrency: 3,\n\t\tdiscard: true\n\t});\n});\n//#endregion\nexport { Files, applyFileGrants, prepareMutationArguments, uploadPreparedFiles };\n\n//# sourceMappingURL=files.js.map","import { Context, Effect, Layer, Option, Schema, Semaphore } from \"effect\";\nimport { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\nimport { DevelopmentSelection, SessionOutcome, SessionRedirect, SessionRequest, SessionResponse, developmentSelectionKey, sessionPath, sessionRequestsPath } from \"@ignotum/contracts/id\";\nimport { IdGenerator } from \"@ignotum/shared/id\";\nimport { SessionEpoch } from \"@ignotum/contracts/runtime/id\";\n//#region src/versions/1/browser/id.ts\nvar IdRequestError = class extends Schema.TaggedError()(\"IdRequestError\", { message: Schema.String }) {};\nconst outcomeKey = \"ignotum.id.outcome\";\nconst selectionJson = Schema.fromJsonString(DevelopmentSelection);\nvar BrowserSession = class BrowserSession extends Context.Service()(\"ignotum/client/id/BrowserSession\") {\n\tstatic layer = Layer.effect(BrowserSession, Effect.gen(function* () {\n\t\tconst client = (yield* HttpClient.HttpClient).pipe(HttpClient.filterStatusOk);\n\t\tconst ids = yield* IdGenerator;\n\t\tconst bootstrapLock = yield* Semaphore.make(1);\n\t\tconst listeners = /* @__PURE__ */ new Set();\n\t\tlet state = { status: \"pending\" };\n\t\tlet current;\n\t\tlet generation = 0;\n\t\tlet deadline = Infinity;\n\t\tlet development = false;\n\t\tlet selection;\n\t\tlet expiry;\n\t\tconst notify = () => {\n\t\t\tfor (const listener of listeners) listener();\n\t\t};\n\t\tconst suspend = (error) => {\n\t\t\tgeneration += 1;\n\t\t\tdeadline = Infinity;\n\t\t\tif (expiry !== void 0) clearTimeout(expiry);\n\t\t\tcurrent = void 0;\n\t\t\tstate = error === void 0 ? {\n\t\t\t\tstatus: \"pending\",\n\t\t\t\toutcome: state.outcome\n\t\t\t} : {\n\t\t\t\tstatus: \"error\",\n\t\t\t\terror,\n\t\t\t\toutcome: state.outcome\n\t\t\t};\n\t\t\tnotify();\n\t\t};\n\t\tconst accept = (session, serverTime) => {\n\t\t\tgeneration += 1;\n\t\t\tif (expiry !== void 0) clearTimeout(expiry);\n\t\t\tcurrent = session;\n\t\t\tstate = session.user === null ? {\n\t\t\t\tstatus: \"signedOut\",\n\t\t\t\toutcome: state.outcome\n\t\t\t} : {\n\t\t\t\tstatus: \"signedIn\",\n\t\t\t\tuser: session.user,\n\t\t\t\toutcome: state.outcome\n\t\t\t};\n\t\t\tconst delay = Math.max(0, session.validUntil - serverTime);\n\t\t\tdeadline = performance.now() + delay;\n\t\t\tif (delay < 2147483647) expiry = setTimeout(() => suspend(), delay);\n\t\t\tnotify();\n\t\t};\n\t\tconst checkExpiry = () => {\n\t\t\tif (current !== void 0 && performance.now() >= deadline) suspend();\n\t\t};\n\t\tglobalThis.addEventListener?.(\"focus\", checkExpiry);\n\t\tglobalThis.document?.addEventListener(\"visibilitychange\", checkExpiry);\n\t\tyield* Effect.addFinalizer(() => Effect.sync(() => {\n\t\t\tif (expiry !== void 0) clearTimeout(expiry);\n\t\t\tlisteners.clear();\n\t\t\tglobalThis.removeEventListener?.(\"focus\", checkExpiry);\n\t\t\tglobalThis.document?.removeEventListener(\"visibilitychange\", checkExpiry);\n\t\t}));\n\t\tconst readOutcome = () => {\n\t\t\ttry {\n\t\t\t\tconst raw = globalThis.sessionStorage.getItem(outcomeKey);\n\t\t\t\tif (raw !== null) {\n\t\t\t\t\tconst decoded = Schema.decodeUnknownOption(SessionOutcome)(raw);\n\t\t\t\t\tif (Option.isSome(decoded)) state = {\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\toutcome: decoded.value\n\t\t\t\t\t};\n\t\t\t\t\tglobalThis.sessionStorage.removeItem(outcomeKey);\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t};\n\t\tconst parameters = () => {\n\t\t\tif (!development || selection === void 0) return \"\";\n\t\t\tconst params = new URLSearchParams({ epoch: selection.epoch });\n\t\t\tif (selection.username !== null) params.set(\"username\", selection.username);\n\t\t\treturn `?${params}`;\n\t\t};\n\t\tconst readSession = Effect.fn(\"BrowserSession.read\")(function* () {\n\t\t\treturn yield* client.get(`${sessionPath}${parameters()}`, { headers: { \"x-ignotum-request\": \"1\" } }).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(SessionResponse)));\n\t\t});\n\t\tconst load = (suspendOnError) => bootstrapLock.withPermits(1)(Effect.gen(function* () {\n\t\t\tconst admittedGeneration = generation;\n\t\t\treturn yield* Effect.gen(function* () {\n\t\t\t\tconst startedAt = performance.now();\n\t\t\t\tlet session = yield* readSession();\n\t\t\t\tdevelopment = session.development === true;\n\t\t\t\tif (development && selection === void 0) {\n\t\t\t\t\tconst saved = globalThis.sessionStorage.getItem(developmentSelectionKey);\n\t\t\t\t\tconst decoded = saved === null ? Option.none() : Schema.decodeOption(selectionJson)(saved);\n\t\t\t\t\tselection = Option.getOrElse(decoded, () => ({\n\t\t\t\t\t\tformatVersion: 1,\n\t\t\t\t\t\tusername: null,\n\t\t\t\t\t\tepoch: \"\"\n\t\t\t\t\t}));\n\t\t\t\t\tif (selection.epoch === \"\") selection = {\n\t\t\t\t\t\t...selection,\n\t\t\t\t\t\tepoch: yield* ids.generate(SessionEpoch)\n\t\t\t\t\t};\n\t\t\t\t\tglobalThis.sessionStorage.setItem(developmentSelectionKey, Schema.encodeSync(selectionJson)(selection));\n\t\t\t\t\tsession = yield* readSession();\n\t\t\t\t}\n\t\t\t\tif (generation !== admittedGeneration) {\n\t\t\t\t\tif (current !== void 0) return current;\n\t\t\t\t\treturn yield* IdRequestError.make({ message: \"Your ID session changed while loading.\" });\n\t\t\t\t}\n\t\t\t\treadOutcome();\n\t\t\t\tif (session.outcome !== void 0) state = {\n\t\t\t\t\t...state,\n\t\t\t\t\toutcome: session.outcome\n\t\t\t\t};\n\t\t\t\taccept(session, session.serverTime + performance.now() - startedAt);\n\t\t\t\treturn session;\n\t\t\t}).pipe(Effect.mapError(() => IdRequestError.make({ message: \"Could not load your ID session.\" })), Effect.tapError((error) => suspendOnError && generation === admittedGeneration ? Effect.sync(() => suspend(error.message)) : Effect.void));\n\t\t}));\n\t\tconst bootstrap = load(true);\n\t\tconst renew = load(false);\n\t\tconst start = Effect.fn(\"BrowserSession.start\")(function* (intent, profile, returnTo) {\n\t\t\tconst session = current ?? (yield* bootstrap);\n\t\t\tif (intent === \"requestProfile\" && session.user === null) return yield* IdRequestError.make({ message: \"Sign in before requesting profile information.\" });\n\t\t\tconst request = yield* Schema.decodeUnknownEffect(SessionRequest)({\n\t\t\t\tintent,\n\t\t\t\tprofile,\n\t\t\t\tsessionEpoch: session.sessionEpoch,\n\t\t\t\treturnTo: returnTo ?? `${globalThis.location.pathname}${globalThis.location.search}${globalThis.location.hash}`\n\t\t\t}).pipe(Effect.mapError(() => IdRequestError.make({ message: \"The ID request is invalid.\" })));\n\t\t\tconst redirect = yield* HttpClientRequest.post(sessionRequestsPath).pipe(HttpClientRequest.setHeader(\"x-ignotum-request\", \"1\"), HttpClientRequest.bodyJsonUnsafe(request), client.execute, Effect.flatMap(HttpClientResponse.schemaBodyJson(SessionRedirect)), Effect.mapError(() => IdRequestError.make({ message: \"Could not start the ID request.\" })));\n\t\t\tif (current?.sessionEpoch !== session.sessionEpoch) return yield* IdRequestError.make({ message: \"Your ID session changed. Try again.\" });\n\t\t\tglobalThis.location.assign(redirect.redirectUrl);\n\t\t});\n\t\tconst signOut = Effect.gen(function* () {\n\t\t\tconst session = current ?? (yield* bootstrap);\n\t\t\tyield* HttpClientRequest.delete(sessionPath).pipe(HttpClientRequest.setHeader(\"x-ignotum-request\", \"1\"), HttpClientRequest.bodyJsonUnsafe({ sessionEpoch: session.sessionEpoch }), client.execute, Effect.mapError(() => IdRequestError.make({ message: \"Could not sign out.\" })));\n\t\t\tsuspend();\n\t\t\tif (development) {\n\t\t\t\tselection = {\n\t\t\t\t\tformatVersion: 1,\n\t\t\t\t\tusername: null,\n\t\t\t\t\tepoch: yield* ids.generate(SessionEpoch)\n\t\t\t\t};\n\t\t\t\tglobalThis.sessionStorage.setItem(developmentSelectionKey, Schema.encodeSync(selectionJson)(selection));\n\t\t\t}\n\t\t\tglobalThis.location.reload();\n\t\t});\n\t\treturn BrowserSession.of({\n\t\t\tsnapshot: () => {\n\t\t\t\tcheckExpiry();\n\t\t\t\treturn state;\n\t\t\t},\n\t\t\tcurrent: () => {\n\t\t\t\tcheckExpiry();\n\t\t\t\treturn current;\n\t\t\t},\n\t\t\tremainingLeaseMillis: () => {\n\t\t\t\tcheckExpiry();\n\t\t\t\treturn current === void 0 ? 0 : Math.max(0, deadline - performance.now());\n\t\t\t},\n\t\t\tsubscribe: (listener) => {\n\t\t\t\tlisteners.add(listener);\n\t\t\t\treturn () => {\n\t\t\t\t\tlisteners.delete(listener);\n\t\t\t\t};\n\t\t\t},\n\t\t\taccept,\n\t\t\tsuspend,\n\t\t\tbootstrap,\n\t\t\trenew,\n\t\t\tstart,\n\t\t\tsignOut,\n\t\t\tsocketParameters: parameters\n\t\t});\n\t})).pipe(Layer.provide(FetchHttpClient.layer));\n};\n//#endregion\nexport { BrowserSession, IdRequestError };\n\n//# sourceMappingURL=id.js.map","import { AppId, InvocationId, defineId } from \"./runtime/id.js\";\nimport { initial } from \"./versioned.js\";\nimport { ServingSelection, sameSelection } from \"./deployment.js\";\nimport { Schema } from \"effect\";\n//#region src/execution.ts\nconst strict = (fields) => Schema.Struct(fields).annotate({ parseOptions: { onExcessProperty: \"error\" } });\n/** Browser recovery scope only; reconciliation must verify the owning session separately. */\nconst RecoverySessionId = defineId(\"rec\", \"ignotum/platform/RecoverySessionId\");\nconst RecoveryIdentity = strict({\n\tinvocationId: InvocationId,\n\toriginalSelection: ServingSelection\n});\nconst RecoveryLimits = {\n\tmaxOperations: 1024,\n\tmaxRetentionMs: 6048e5\n};\nconst RecoveryRecordV1 = strict({\n\tformatVersion: Schema.Literal(1),\n\tappId: AppId,\n\tclientSessionId: RecoverySessionId,\n\trecordedAt: Schema.Natural,\n\texpiresAt: Schema.Natural,\n\toperations: Schema.Array(RecoveryIdentity).check(Schema.isMaxLength(RecoveryLimits.maxOperations))\n}).check(Schema.makeFilter((record) => {\n\tconst issues = [];\n\tif (record.expiresAt <= record.recordedAt || record.expiresAt - record.recordedAt > RecoveryLimits.maxRetentionMs) issues.push({\n\t\tpath: [\"expiresAt\"],\n\t\tissue: \"Recovery retention must be positive and bounded\"\n\t});\n\tif (record.operations.some((operation) => operation.originalSelection.appId !== record.appId)) issues.push({\n\t\tpath: [\"operations\"],\n\t\tissue: \"Recovery operations must belong to the record's app\"\n\t});\n\tconst identities = record.operations.map((operation) => `${operation.originalSelection.dataHistoryId}/${operation.invocationId}`);\n\tif (new Set(identities).size !== identities.length) issues.push({\n\t\tpath: [\"operations\"],\n\t\tissue: \"Recovery operation identities must be unique within a data history\"\n\t});\n\treturn issues;\n})).annotate({ parseOptions: { onExcessProperty: \"error\" } });\nconst RecoveryRecord = initial(RecoveryRecordV1);\n//#endregion\nexport { RecoveryIdentity, RecoveryLimits, RecoveryRecord, RecoverySessionId, ServingSelection, sameSelection };\n\n//# sourceMappingURL=execution.js.map","import { DateTime, Predicate, Schema } from \"effect\";\nimport * as Versioned from \"@ignotum/contracts/versioned\";\nimport { RecoveryIdentity, RecoverySessionId } from \"@ignotum/contracts/execution\";\nimport { AppId } from \"@ignotum/contracts/runtime/identity\";\n//#region src/versions/1/browser/recovery-journal.ts\nconst RecoveryJournalLimits = {\n\tmaxEntries: 100,\n\tretentionMs: 864e5,\n\tmaxBytes: 65536\n};\nconst RecoveryEntry = Schema.Struct({\n\tidentity: RecoveryIdentity,\n\trecordedAt: Schema.Natural,\n\texpiresAt: Schema.Natural,\n\tstate: Schema.Literals([\n\t\t\"pending\",\n\t\t\"settled\",\n\t\t\"interrupted\",\n\t\t\"uncertain\"\n\t])\n});\nconst RecoveryJournalV1 = Schema.Struct({\n\tformatVersion: Schema.Literal(1),\n\tappId: AppId,\n\tsessionEpoch: Schema.String,\n\tclientSessionId: RecoverySessionId,\n\tentries: Schema.Array(RecoveryEntry).check(Schema.isMaxLength(RecoveryJournalLimits.maxEntries))\n}).check(Schema.makeFilter((record) => {\n\tconst keys = record.entries.map((entry) => identityKey(entry.identity));\n\treturn new Set(keys).size === keys.length && record.entries.every((entry) => entry.identity.originalSelection.appId === record.appId && entry.expiresAt > entry.recordedAt && entry.expiresAt - entry.recordedAt <= RecoveryJournalLimits.retentionMs);\n})).annotate({ parseOptions: { onExcessProperty: \"error\" } });\nconst RecoveryJournalRecord = Versioned.initial(RecoveryJournalV1);\nconst identityKey = (identity) => `${identity.originalSelection.dataHistoryId}/${identity.invocationId}`;\nconst bytes = (value) => new TextEncoder().encode(value).byteLength;\n/** sessionStorage isolates tabs. A cloned tab may look up copied identities, never replay them. */\nvar RecoveryJournal = class {\n\toptions;\n\tstorageKey;\n\tclientSessionId;\n\tconstructor(options) {\n\t\tthis.options = options;\n\t\tthis.storageKey = `ignotum:recovery:${options.appId}`;\n\t\tthis.clientSessionId = options.clientSessionId;\n\t}\n\tstorage() {\n\t\tconst storage = this.options.storage;\n\t\treturn storage === void 0 ? globalThis.sessionStorage : Predicate.isFunction(storage) ? storage() : storage;\n\t}\n\tnow() {\n\t\treturn this.options.now?.() ?? DateTime.toEpochMillis(DateTime.nowUnsafe());\n\t}\n\tsnapshot(entries, issues) {\n\t\treturn {\n\t\t\tclientSessionId: this.clientSessionId,\n\t\t\tentries,\n\t\t\tissues\n\t\t};\n\t}\n\tread() {\n\t\tlet raw;\n\t\ttry {\n\t\t\traw = this.storage().getItem(this.storageKey);\n\t\t} catch {\n\t\t\treturn this.snapshot([], [\"denied\"]);\n\t\t}\n\t\tif (raw === null) return this.snapshot([], []);\n\t\tif (bytes(raw) > RecoveryJournalLimits.maxBytes) return this.discard(\"full\");\n\t\tconst parsed = Schema.decodeUnknownOption(Schema.fromJsonString(RecoveryJournalRecord), { onExcessProperty: \"error\" })(raw);\n\t\tif (parsed._tag === \"None\" || parsed.value.appId !== this.options.appId) return this.discard(\"corrupt\");\n\t\tif (parsed.value.sessionEpoch !== this.options.sessionEpoch) return this.discard(\"session-changed\");\n\t\tthis.clientSessionId = parsed.value.clientSessionId;\n\t\tconst now = this.now();\n\t\tconst entries = parsed.value.entries.filter((entry) => entry.expiresAt > now && entry.recordedAt <= now);\n\t\tconst issues = entries.length === parsed.value.entries.length ? [] : [\"expired\"];\n\t\treturn issues.length === 0 ? this.snapshot(entries, issues) : this.persist(entries, issues);\n\t}\n\tdiscard(issue) {\n\t\ttry {\n\t\t\tthis.storage().removeItem(this.storageKey);\n\t\t\treturn this.snapshot([], [issue]);\n\t\t} catch {\n\t\t\treturn this.snapshot([], [issue, \"denied\"]);\n\t\t}\n\t}\n\tpersist(entries, issues) {\n\t\tconst record = {\n\t\t\tformatVersion: 1,\n\t\t\tappId: this.options.appId,\n\t\t\tsessionEpoch: this.options.sessionEpoch,\n\t\t\tclientSessionId: this.clientSessionId,\n\t\t\tentries\n\t\t};\n\t\tconst encoded = Schema.encodeOption(Schema.fromJsonString(RecoveryJournalRecord))(record);\n\t\tif (encoded._tag === \"None\") return this.snapshot(entries, [...issues, \"corrupt\"]);\n\t\tif (bytes(encoded.value) > RecoveryJournalLimits.maxBytes) return this.snapshot(entries, [...issues, \"full\"]);\n\t\ttry {\n\t\t\tthis.storage().setItem(this.storageKey, encoded.value);\n\t\t\treturn this.snapshot(entries, issues);\n\t\t} catch (error) {\n\t\t\treturn this.snapshot(entries, [...issues, error instanceof DOMException && error.name === \"QuotaExceededError\" ? \"full\" : \"denied\"]);\n\t\t}\n\t}\n\t/** Call before abandoning the page; any issue means durable recovery is not proven. */\n\twrite(identities) {\n\t\tconst current = this.read();\n\t\tif (current.issues.includes(\"denied\")) return current;\n\t\tconst entries = new Map(current.entries.map((entry) => [identityKey(entry.identity), entry]));\n\t\tconst now = this.now();\n\t\tfor (const identity of identities) {\n\t\t\tif (identity.originalSelection.appId !== this.options.appId) return this.snapshot(current.entries, [...current.issues, \"corrupt\"]);\n\t\t\tconst key = identityKey(identity);\n\t\t\tif (!entries.has(key)) entries.set(key, {\n\t\t\t\tidentity: {\n\t\t\t\t\tinvocationId: identity.invocationId,\n\t\t\t\t\toriginalSelection: identity.originalSelection\n\t\t\t\t},\n\t\t\t\trecordedAt: now,\n\t\t\t\texpiresAt: now + RecoveryJournalLimits.retentionMs,\n\t\t\t\tstate: \"pending\"\n\t\t\t});\n\t\t}\n\t\tif (entries.size > RecoveryJournalLimits.maxEntries) return this.snapshot(current.entries, [...current.issues, \"full\"]);\n\t\treturn this.persist([...entries.values()], current.issues);\n\t}\n\treconcile(identity, state) {\n\t\tconst current = this.read();\n\t\tif (current.issues.includes(\"denied\")) return current;\n\t\treturn this.persist(current.entries.map((entry) => identityKey(entry.identity) === identityKey(identity) ? {\n\t\t\t...entry,\n\t\t\tstate\n\t\t} : entry), current.issues);\n\t}\n\tremove(identity) {\n\t\tconst current = this.read();\n\t\tif (current.issues.includes(\"denied\")) return current;\n\t\treturn this.persist(current.entries.filter((entry) => identityKey(entry.identity) !== identityKey(identity)), current.issues);\n\t}\n\tclear() {\n\t\ttry {\n\t\t\tthis.storage().removeItem(this.storageKey);\n\t\t\treturn this.snapshot([], []);\n\t\t} catch {\n\t\t\treturn this.snapshot([], [\"denied\"]);\n\t\t}\n\t}\n};\n//#endregion\nexport { RecoveryJournal, RecoveryJournalLimits, RecoveryJournalRecord };\n\n//# sourceMappingURL=recovery-journal.js.map","import { Option, Schema } from \"effect\";\nimport * as Versioned from \"@ignotum/contracts/versioned\";\nimport { RecoverySessionId, ServingSelection, sameSelection } from \"@ignotum/contracts/execution\";\nimport { AppId } from \"@ignotum/contracts/runtime/identity\";\n//#region src/versions/1/browser/managed-upgrade.ts\nconst TabStateV1 = Schema.Struct({\n\tformatVersion: Schema.Literal(1),\n\tappId: AppId,\n\tclientSessionId: RecoverySessionId,\n\tattempts: Schema.Natural.check(Schema.isLessThanOrEqualTo(3)),\n\tattemptedAt: Schema.Natural,\n\ttarget: Schema.NullOr(ServingSelection),\n\tuncertainStorage: Schema.Boolean\n}).annotate({ parseOptions: { onExcessProperty: \"error\" } });\nconst TabState = Versioned.initial(TabStateV1);\nconst TabStateJson = Schema.fromJsonString(TabState);\n/** One attempt owns admission, the settling deadline, and the reload across target changes. */\nvar ManagedUpgrade = class {\n\tselection;\n\tbrowser;\n\tcallbacks;\n\tclientSessionId;\n\tkey;\n\ttab;\n\tsnapshot = {\n\t\tphase: \"connecting\",\n\t\trecovery: []\n\t};\n\tlisteners = /* @__PURE__ */ new Set();\n\ttarget;\n\tattempt;\n\tdisposed = false;\n\tstorageAvailable = true;\n\treadyTimer;\n\tconstructor(selection, browser, callbacks) {\n\t\tthis.selection = selection;\n\t\tthis.browser = browser;\n\t\tthis.callbacks = callbacks;\n\t\tthis.key = `ignotum.v3.tab.${selection.appId}`;\n\t\tthis.tab = {\n\t\t\tformatVersion: 1,\n\t\t\tappId: selection.appId,\n\t\t\tclientSessionId: RecoverySessionId.make(`rec_${browser.crypto.randomUUID().replaceAll(\"-\", \"\").slice(0, 24)}`),\n\t\t\tattempts: 0,\n\t\t\tattemptedAt: 0,\n\t\t\ttarget: null,\n\t\t\tuncertainStorage: false\n\t\t};\n\t\ttry {\n\t\t\tconst raw = browser.sessionStorage.getItem(this.key);\n\t\t\tif (raw !== null) {\n\t\t\t\tconst decoded = Schema.decodeOption(TabStateJson, { onExcessProperty: \"error\" })(raw);\n\t\t\t\tif (Option.isSome(decoded) && decoded.value.appId === selection.appId && (decoded.value.target === null || decoded.value.target.appId === selection.appId)) this.tab = decoded.value;\n\t\t\t\telse this.reportRecovery(\"Saved update information could not be read. Previous mutation outcomes may be unknown.\");\n\t\t\t}\n\t\t} catch {\n\t\t\tthis.storageAvailable = false;\n\t\t}\n\t\tconst history = Schema.decodeUnknownOption(Schema.Struct({ __ignotumUpdate: TabState }))(browser.history.state);\n\t\tif (Option.isSome(history) && history.value.__ignotumUpdate.appId === selection.appId && history.value.__ignotumUpdate.attemptedAt >= this.tab.attemptedAt && (history.value.__ignotumUpdate.target === null || history.value.__ignotumUpdate.target.appId === selection.appId)) this.tab = history.value.__ignotumUpdate;\n\t\tif (this.tab.uncertainStorage) this.reportRecovery(\"Some previous mutation outcomes could not be saved in browser storage and remain unknown.\");\n\t\tthis.clientSessionId = this.tab.clientSessionId;\n\t\tthis.save();\n\t}\n\tgetSnapshot = () => this.snapshot;\n\tsubscribe = (listener) => {\n\t\tthis.listeners.add(listener);\n\t\treturn () => this.listeners.delete(listener);\n\t};\n\tupdate(next) {\n\t\tif (this.disposed) return;\n\t\tthis.snapshot = next;\n\t\tfor (const listener of this.listeners) listener();\n\t}\n\treportRecovery(message) {\n\t\tif (!this.snapshot.recovery.includes(message)) this.update({\n\t\t\t...this.snapshot,\n\t\t\trecovery: [...this.snapshot.recovery, message].slice(-100)\n\t\t});\n\t}\n\tdismissRecovery = () => {\n\t\tthis.tab = {\n\t\t\t...this.tab,\n\t\t\tuncertainStorage: false\n\t\t};\n\t\tthis.save();\n\t\tthis.update({\n\t\t\t...this.snapshot,\n\t\t\trecovery: []\n\t\t});\n\t};\n\tsave() {\n\t\tlet saved = false;\n\t\ttry {\n\t\t\tthis.browser.sessionStorage.setItem(this.key, Schema.encodeSync(TabStateJson)(this.tab));\n\t\t\tthis.storageAvailable = true;\n\t\t\tsaved = true;\n\t\t} catch {\n\t\t\tthis.storageAvailable = false;\n\t\t}\n\t\ttry {\n\t\t\tconst existing = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown))(this.browser.history.state);\n\t\t\tthis.browser.history.replaceState({\n\t\t\t\t...Option.getOrElse(existing, () => ({})),\n\t\t\t\t__ignotumUpdate: Schema.encodeSync(TabState)(this.tab)\n\t\t\t}, \"\");\n\t\t\tsaved = true;\n\t\t} catch {}\n\t\treturn saved;\n\t}\n\tget obsolete() {\n\t\treturn this.target !== void 0 || this.attempt !== void 0;\n\t}\n\tget ready() {\n\t\treturn this.snapshot.phase === \"ready\" && !this.obsolete;\n\t}\n\tconnecting() {\n\t\tif (this.readyTimer !== void 0) clearTimeout(this.readyTimer);\n\t\tif (!this.obsolete) this.update({\n\t\t\t...this.snapshot,\n\t\t\tphase: \"connecting\",\n\t\t\tmessage: void 0\n\t\t});\n\t}\n\taccepted() {\n\t\tif (this.obsolete) return;\n\t\tthis.update({\n\t\t\t...this.snapshot,\n\t\t\tphase: \"ready\",\n\t\t\tmessage: void 0\n\t\t});\n\t\tif (this.readyTimer !== void 0) clearTimeout(this.readyTimer);\n\t\tthis.readyTimer = setTimeout(() => {\n\t\t\tthis.tab = {\n\t\t\t\t...this.tab,\n\t\t\t\tattempts: 0,\n\t\t\t\tattemptedAt: 0,\n\t\t\t\ttarget: null\n\t\t\t};\n\t\t\tthis.save();\n\t\t}, 6e4);\n\t}\n\tunavailable(message = \"The app could not check for updates. Reconnect and try again.\") {\n\t\tif (this.readyTimer !== void 0) clearTimeout(this.readyTimer);\n\t\tif (!this.obsolete) this.update({\n\t\t\t...this.snapshot,\n\t\t\tphase: \"error\",\n\t\t\tmessage\n\t\t});\n\t}\n\trequire(target) {\n\t\tif (this.disposed) return Promise.resolve();\n\t\tif (target !== void 0) this.target = target;\n\t\tthis.callbacks.stopAdmission();\n\t\tif (this.attempt !== void 0 && this.snapshot.phase !== \"error\") return this.attempt;\n\t\tif (this.readyTimer !== void 0) clearTimeout(this.readyTimer);\n\t\tthis.update({\n\t\t\t...this.snapshot,\n\t\t\tphase: \"settling\",\n\t\t\tmessage: \"Updating the app. Waiting briefly for pending changes…\"\n\t\t});\n\t\tthis.attempt = this.run();\n\t\treturn this.attempt;\n\t}\n\tasync run() {\n\t\tconst deadline = Date.now() + 2e3;\n\t\twhile (!this.disposed && this.callbacks.unresolved() > 0 && Date.now() < deadline) await new Promise((resolve) => setTimeout(resolve, 25));\n\t\tif (this.disposed) return;\n\t\ttry {\n\t\t\tconst issues = this.callbacks.persist();\n\t\t\tfor (const issue of issues) this.reportRecovery(issue);\n\t\t\tif (issues.length > 0) {\n\t\t\t\tthis.tab = {\n\t\t\t\t\t...this.tab,\n\t\t\t\t\tuncertainStorage: true\n\t\t\t\t};\n\t\t\t\tawait new Promise((resolve) => setTimeout(resolve, 1e3));\n\t\t\t}\n\t\t\tconst fresh = await this.callbacks.freshSelection();\n\t\t\tif (fresh !== void 0 && fresh.appId !== this.selection.appId) throw new Error(\"The app address now refers to a different app.\");\n\t\t\tthis.target = fresh ?? this.target;\n\t\t\tconst response = await this.browser.fetch(this.browser.location.href, {\n\t\t\t\tcache: \"no-store\",\n\t\t\t\tcredentials: \"same-origin\",\n\t\t\t\theaders: { accept: \"text/html\" },\n\t\t\t\tsignal: AbortSignal.timeout(1e4)\n\t\t\t});\n\t\t\tif (!response.ok) throw new Error(\"The updated app document is temporarily unavailable.\");\n\t\t\tawait response.body?.cancel();\n\t\t\tif (this.disposed) return;\n\t\t\tconst attempts = fresh !== void 0 && this.tab.target !== null && !sameSelection(this.tab.target, fresh) ? 0 : this.tab.attempts;\n\t\t\tif (attempts >= 2) throw new Error(\"The app update could not load a consistent release. Try again when the connection or release is available.\");\n\t\t\tthis.tab = {\n\t\t\t\t...this.tab,\n\t\t\t\tattempts: attempts + 1,\n\t\t\t\tattemptedAt: Date.now(),\n\t\t\t\ttarget: fresh ?? this.target ?? this.selection\n\t\t\t};\n\t\t\tif (!this.save()) throw new Error(\"Browser storage is unavailable. Pending changes may have unknown outcomes. Use Reload app to continue the update.\");\n\t\t\tthis.update({\n\t\t\t\t...this.snapshot,\n\t\t\t\tphase: \"reloading\",\n\t\t\t\tmessage: \"Loading the updated app…\"\n\t\t\t});\n\t\t\tthis.callbacks.reload();\n\t\t} catch (error) {\n\t\t\tthis.update({\n\t\t\t\t...this.snapshot,\n\t\t\t\tphase: \"error\",\n\t\t\t\tmessage: error instanceof Error ? error.message : \"The app update could not be loaded. Try again.\"\n\t\t\t});\n\t\t}\n\t}\n\t/** An explicit retry resets the automatic budget, while obsolete code remains fenced. */\n\tretry = () => {\n\t\tif (this.disposed) return;\n\t\tif (!this.storageAvailable) {\n\t\t\tthis.callbacks.persist();\n\t\t\tthis.callbacks.reload();\n\t\t\treturn;\n\t\t}\n\t\tthis.tab = {\n\t\t\t...this.tab,\n\t\t\tattempts: 0,\n\t\t\tattemptedAt: 0\n\t\t};\n\t\tthis.save();\n\t\tthis.attempt = void 0;\n\t\tthis.require(this.target);\n\t};\n\tasync check() {\n\t\tif (this.obsolete || this.disposed) return false;\n\t\ttry {\n\t\t\tconst fresh = await this.callbacks.freshSelection();\n\t\t\tif (fresh === void 0 || !sameSelection(this.selection, fresh)) {\n\t\t\t\tthis.require(fresh);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn !this.obsolete && !this.disposed;\n\t\t} catch {\n\t\t\tthis.unavailable();\n\t\t\treturn false;\n\t\t}\n\t}\n\tdispose() {\n\t\tthis.disposed = true;\n\t\tif (this.readyTimer !== void 0) clearTimeout(this.readyTimer);\n\t\tthis.listeners.clear();\n\t}\n};\n//#endregion\nexport { ManagedUpgrade };\n\n//# sourceMappingURL=managed-upgrade.js.map","import { encodeCanonicalJson } from \"../json.js\";\nimport { schemaIndexLimits } from \"../schema/values.js\";\nimport { Schema } from \"effect\";\n//#region src/runtime/index.ts\nconst IndexIdentity = Schema.String.pipe(Schema.brand(\"ignotum/runtime/IndexIdentity\"));\nconst EncodedIndexKey = Schema.String.check(Schema.isPattern(/^(?:[0-9a-f]{2})*$/)).pipe(Schema.brand(\"ignotum/runtime/EncodedIndexKey\"));\nconst IndexScalarValue = Schema.Union([\n\tSchema.Boolean,\n\tSchema.Finite,\n\tSchema.String\n]);\nconst scalarValueKind = (value) => Schema.is(Schema.Boolean)(value) ? \"boolean\" : Schema.is(Schema.Finite)(value) ? \"number\" : \"string\";\nconst encodeString = (value) => {\n\tconst bytes = [];\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst unit = value.charCodeAt(index);\n\t\tbytes.push(1, unit >>> 8, unit & 255);\n\t}\n\tbytes.push(0);\n\treturn Array.from(bytes);\n};\nconst encodeNumber = (input) => {\n\tconst value = Object.is(input, -0) ? 0 : input;\n\tif (!Number.isFinite(value)) throw new Error(\"Index numbers must be finite.\");\n\tconst bytes = /* @__PURE__ */ new Uint8Array(8);\n\tnew DataView(bytes.buffer).setFloat64(0, value, false);\n\tif ((bytes[0] ?? 0) >= 128) for (let index = 0; index < bytes.length; index += 1) bytes[index] = 255 - bytes[index];\n\telse bytes[0] = (bytes[0] ?? 0) ^ 128;\n\treturn Array.from(bytes);\n};\nconst scalarKind = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"boolean\": return \"boolean\";\n\t\tcase \"date\":\n\t\tcase \"integer\":\n\t\tcase \"number\": return \"number\";\n\t\tcase \"userId\":\n\t\tcase \"id\":\n\t\tcase \"string\": return \"string\";\n\t\tcase \"literal\": return scalarValueKind(descriptor.value);\n\t\tcase \"literals\": {\n\t\t\tconst first = descriptor.values[0];\n\t\t\tif (first === void 0) throw new Error(\"Indexed literal sets cannot be empty.\");\n\t\t\tconst kind = scalarValueKind(first);\n\t\t\tif (descriptor.values.some((value) => scalarValueKind(value) !== kind)) throw new Error(\"Indexed literal sets cannot mix value types.\");\n\t\t\treturn kind;\n\t\t}\n\t\tdefault: throw new Error(`Values of type '${descriptor.type}' cannot be indexed.`);\n\t}\n};\nconst encodeScalar = (descriptor, value) => {\n\tswitch (scalarKind(descriptor)) {\n\t\tcase \"boolean\":\n\t\t\tif (!Schema.is(Schema.Boolean)(value)) throw new Error(\"Expected an indexed boolean value.\");\n\t\t\treturn [value ? 1 : 0];\n\t\tcase \"number\":\n\t\t\tif (!Schema.is(Schema.Finite)(value)) throw new Error(\"Expected an indexed number value.\");\n\t\t\treturn encodeNumber(value);\n\t\tcase \"string\":\n\t\t\tif (!Schema.is(Schema.String)(value)) throw new Error(\"Expected an indexed string value.\");\n\t\t\treturn encodeString(value);\n\t}\n};\nconst encodeBytes = (bytes) => EncodedIndexKey.make(bytes.map((byte) => byte.toString(16).padStart(2, \"0\")).join(\"\"));\nconst encodeIndexPrefix = (descriptors, values) => {\n\tif (descriptors.length !== values.length) throw new Error(\"Index descriptors and values must have the same length.\");\n\tconst bytes = descriptors.flatMap((descriptor, index) => encodeScalar(descriptor, values[index]));\n\tif (bytes.length > schemaIndexLimits.keyBytes) throw new Error(`Index keys cannot exceed ${schemaIndexLimits.keyBytes} bytes.`);\n\treturn encodeBytes(bytes);\n};\nconst encodeIndexKey = (descriptors, values, createdAt, id) => {\n\tconst bytes = [\n\t\t...descriptors.flatMap((descriptor, index) => encodeScalar(descriptor, values[index])),\n\t\t...encodeNumber(createdAt),\n\t\t...encodeString(id)\n\t];\n\tif (bytes.length > schemaIndexLimits.keyBytes) throw new Error(`Index keys cannot exceed ${schemaIndexLimits.keyBytes} bytes.`);\n\treturn encodeBytes(bytes);\n};\nconst successorIndexPrefix = (prefix) => {\n\tconst bytes = Array.from({ length: prefix.length / 2 }, (_, index) => Number.parseInt(prefix.slice(index * 2, index * 2 + 2), 16));\n\tfor (let index = bytes.length - 1; index >= 0; index -= 1) {\n\t\tconst byte = bytes[index];\n\t\tif (byte === void 0 || byte === 255) continue;\n\t\tbytes[index] = byte + 1;\n\t\treturn encodeBytes(bytes.slice(0, index + 1));\n\t}\n};\nconst encodeIndexRange = (descriptors, equal, lower, upper) => {\n\tconst equalDescriptors = descriptors.slice(0, equal.length);\n\tconst prefix = encodeIndexPrefix(equalDescriptors, equal);\n\tconst rangeDescriptor = descriptors[equal.length];\n\tif ((lower !== void 0 || upper !== void 0) && rangeDescriptor === void 0) throw new Error(\"An index range exceeded the index fields.\");\n\tconst encodedLower = lower === void 0 ? prefix.length === 0 ? void 0 : prefix : EncodedIndexKey.make(`${prefix}${encodeIndexPrefix([rangeDescriptor], [lower.value])}`);\n\tconst encodedUpper = upper === void 0 ? prefix.length === 0 ? void 0 : successorIndexPrefix(prefix) : EncodedIndexKey.make(`${prefix}${encodeIndexPrefix([rangeDescriptor], [upper.value])}`);\n\tconst finalLower = encodedLower !== void 0 && lower !== void 0 && !lower.inclusive ? successorIndexPrefix(encodedLower) : encodedLower;\n\tconst finalUpper = encodedUpper !== void 0 && upper !== void 0 && upper.inclusive ? successorIndexPrefix(encodedUpper) : encodedUpper;\n\tif (finalLower === void 0 && finalUpper === void 0) return {};\n\tif (finalLower === void 0) return { upper: finalUpper };\n\tif (finalUpper === void 0) return { lower: finalLower };\n\treturn {\n\t\tlower: finalLower,\n\t\tupper: finalUpper\n\t};\n};\nconst indexIdentity = (tableId, name, fields) => IndexIdentity.make(encodeCanonicalJson([\n\ttableId,\n\tname,\n\tfields\n]));\n//#endregion\nexport { EncodedIndexKey, IndexIdentity, IndexScalarValue, encodeIndexKey, encodeIndexPrefix, encodeIndexRange, indexIdentity, successorIndexPrefix };\n\n//# sourceMappingURL=index.js.map","import { AppId, AuthAccountId, AuthDeviceCodeId, AuthInternalId, AuthInvitationId, AuthMemberId, AuthSessionId, AuthVerificationId, ConnectionId, DevDatabaseLockId, GeneratedId, InvocationId, PlatformPrincipalId, RequestId, RuntimeRequestNonce, SubscriptionId, TableId, TeamId, VersionId } from \"./id.js\";\nimport { ActivationGeneration, AppStateRevision, CapabilityId, ClientApiVersion, DataHistoryId, InvocationKey, ProtocolVersion, ServerApiVersion, VersionNumber } from \"./identity.js\";\nimport { ServingSelection } from \"../deployment.js\";\nimport { RecoveryIdentity, RecoverySessionId } from \"../execution.js\";\nimport { encodeCanonicalJson } from \"../json.js\";\nimport { FileId, RuntimeFileMetadata, RuntimeFileOccurrence } from \"../schema/file.js\";\nimport { SessionState } from \"../id.js\";\nimport { FunctionAddress, WireFailure, WireResult, WireSuccess } from \"./sync.js\";\nimport { EncodedIndexKey, IndexIdentity } from \"./index.js\";\nimport { Schema } from \"effect\";\n//#region src/runtime/hosted.ts\nconst QueryKey = Schema.String.pipe(Schema.brand(\"ignotum/hosted/QueryKey\"));\nconst TableDependency = Schema.Struct({\n\ttype: Schema.Literal(\"Table\"),\n\ttableId: TableId\n});\nconst DocumentDependency = Schema.Struct({\n\ttype: Schema.Literal(\"Document\"),\n\ttableId: TableId,\n\tid: GeneratedId\n});\nconst IndexRangeDependency = Schema.Struct({\n\ttype: Schema.Literal(\"IndexRange\"),\n\ttableId: TableId,\n\tindex: IndexIdentity,\n\tlower: Schema.optional(EncodedIndexKey),\n\tupper: Schema.optional(EncodedIndexKey)\n});\nconst IndexPointInvalidation = Schema.Struct({\n\ttype: Schema.Literal(\"IndexPoint\"),\n\ttableId: TableId,\n\tindex: IndexIdentity,\n\tkey: EncodedIndexKey\n});\nconst IdDependency = Schema.Struct({ type: Schema.Literal(\"Id\") });\nconst ReadDependency = Schema.Union([\n\tIdDependency,\n\tTableDependency,\n\tDocumentDependency,\n\tIndexRangeDependency\n]);\nconst WriteInvalidation = Schema.Union([\n\tTableDependency,\n\tDocumentDependency,\n\tIndexPointInvalidation\n]);\nconst DependencyKey = Schema.Union([ReadDependency, IndexPointInvalidation]);\nconst DependencySet = Schema.Array(ReadDependency);\nconst InvalidationSet = Schema.Array(WriteInvalidation);\nconst RuntimeQueryResult = Schema.Struct({\n\ttype: Schema.Literal(\"Query\"),\n\tresult: WireResult,\n\tdependencies: DependencySet,\n\tobservedRevision: AppStateRevision,\n\tfiles: Schema.optional(Schema.Array(RuntimeFileOccurrence))\n});\nconst FileReferenceAdded = Schema.Struct({\n\ttype: Schema.Literal(\"AddReference\"),\n\tfile: RuntimeFileMetadata,\n\ttableId: TableId,\n\tdocumentId: GeneratedId\n});\nconst FileReferenceRemoved = Schema.Struct({\n\ttype: Schema.Literal(\"RemoveReference\"),\n\tfileId: FileId,\n\ttableId: TableId,\n\tdocumentId: GeneratedId\n});\nconst FileReferenceEffect = Schema.Union([FileReferenceAdded, FileReferenceRemoved]);\nconst FileEffectBatch = Schema.Struct({\n\tid: InvocationId,\n\tdataHistoryId: Schema.optional(DataHistoryId),\n\tcommittedRevision: AppStateRevision,\n\teffects: Schema.Array(FileReferenceEffect)\n});\nconst FileEffectsRequest = Schema.Struct({ appId: AppId });\nconst FileEffectsResult = Schema.Struct({ batches: Schema.Array(FileEffectBatch) });\nconst FileEffectsAcknowledgeRequest = Schema.Struct({\n\tappId: AppId,\n\tinvocationId: InvocationId,\n\tacknowledgedAt: Schema.Int,\n\tdataHistoryId: DataHistoryId\n});\nconst FileEffectsAcknowledgeResult = Schema.Struct({ completed: Schema.Literal(true) });\nconst RuntimeMutationSuccess = Schema.Struct({\n\ttype: Schema.Literal(\"Mutation\"),\n\tresult: WireSuccess,\n\tinvalidations: InvalidationSet,\n\tcommittedRevision: AppStateRevision,\n\tfileEffects: Schema.optional(FileEffectBatch)\n});\nconst RuntimeMutationFailure = Schema.Struct({\n\ttype: Schema.Literal(\"Mutation\"),\n\tresult: WireFailure\n});\nconst RuntimeMutationResult = Schema.Union([RuntimeMutationSuccess, RuntimeMutationFailure]);\nconst RuntimeInvocationResult = Schema.Union([RuntimeQueryResult, RuntimeMutationResult]);\nconst RuntimeRecoveryOwner = Schema.Struct({\n\tclientSessionId: RecoverySessionId,\n\tsessionEpoch: Schema.NullOr(Schema.String)\n});\nconst RuntimeMutationOutcomeRequest = Schema.Struct({\n\tappId: AppId,\n\tidentity: RecoveryIdentity,\n\towner: RuntimeRecoveryOwner\n});\nconst RuntimeMutationOutcome = Schema.Union([\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"Settled\"),\n\t\tresult: RuntimeMutationResult\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"Interrupted\") }),\n\tSchema.Struct({ type: Schema.Literal(\"Pending\") }),\n\tSchema.Struct({ type: Schema.Literal(\"Uncertain\") })\n]);\nconst InvocationBase = {\n\tappId: AppId,\n\tversionId: VersionId,\n\tgeneration: ActivationGeneration,\n\tselection: Schema.optional(ServingSelection),\n\tinvocationKey: InvocationKey,\n\tfunction: FunctionAddress,\n\targs: Schema.Json,\n\tidentity: Schema.optional(SessionState)\n};\nconst QueryInvocation = Schema.Struct({\n\t...InvocationBase,\n\ttype: Schema.Literal(\"Query\")\n});\nconst MutationInvocation = Schema.Struct({\n\t...InvocationBase,\n\ttype: Schema.Literal(\"Mutation\"),\n\tinvocationId: InvocationId,\n\trecoveryOwner: Schema.optional(RuntimeRecoveryOwner),\n\tfiles: Schema.optional(Schema.Array(RuntimeFileOccurrence))\n});\nconst RuntimeInvocation = Schema.Union([QueryInvocation, MutationInvocation]);\nconst RevisionCheck = Schema.Struct({\n\tappId: AppId,\n\texpectedRevision: AppStateRevision\n});\nconst RevisionCheckResult = Schema.Struct({ currentRevision: AppStateRevision });\nvar RuntimeVersionUnavailable = class extends Schema.TaggedError()(\"RuntimeVersionUnavailable\", {\n\tversionId: VersionId,\n\tmessage: Schema.String\n}) {};\nconst RuntimeInvocationRejectionCode = Schema.Literals([\n\t\"SessionExpired\",\n\t\"FunctionUnavailable\",\n\t\"InvalidArguments\",\n\t\"InvocationIdConflict\",\n\t\"ResourceLimitExceeded\",\n\t\"UnknownFunction\",\n\t\"WrongFunctionKind\"\n]);\nvar RuntimeInvocationRejected = class extends Schema.TaggedError()(\"RuntimeInvocationRejected\", {\n\tcode: RuntimeInvocationRejectionCode,\n\tinvocationKey: InvocationKey,\n\tmessage: Schema.String\n}) {};\nvar RuntimeInvocationUnavailable = class extends Schema.TaggedError()(\"RuntimeInvocationUnavailable\", {\n\tinvocationKey: InvocationKey,\n\tmessage: Schema.String\n}) {};\nvar RuntimeRevisionRejected = class extends Schema.TaggedError()(\"RuntimeRevisionRejected\", {\n\tappId: AppId,\n\tmessage: Schema.String\n}) {};\nconst RuntimeTransportError = Schema.Union([\n\tRuntimeVersionUnavailable,\n\tRuntimeInvocationRejected,\n\tRuntimeInvocationUnavailable\n]);\nconst dependencyKey = (dependency) => dependency.type === \"Id\" ? \"Id\" : dependency.type === \"Table\" ? encodeCanonicalJson([dependency.type, dependency.tableId]) : dependency.type === \"Document\" ? encodeCanonicalJson([\n\tdependency.type,\n\tdependency.tableId,\n\tdependency.id\n]) : dependency.type === \"IndexPoint\" ? encodeCanonicalJson([\n\tdependency.type,\n\tdependency.index,\n\tdependency.key\n]) : encodeCanonicalJson([\n\tdependency.type,\n\tdependency.index,\n\tdependency.lower ?? null,\n\tdependency.upper ?? null\n]);\nconst canonicalQueryKey = (versionId, functionAddress, args) => QueryKey.make(encodeCanonicalJson([\n\tversionId,\n\tfunctionAddress,\n\targs\n]));\nconst canonicalInvocationInput = (versionId, functionKind, functionAddress, args, sessionEpoch) => encodeCanonicalJson(sessionEpoch === void 0 ? [\n\tversionId,\n\tfunctionKind,\n\tfunctionAddress,\n\targs\n] : [\n\tversionId,\n\tfunctionKind,\n\tfunctionAddress,\n\targs,\n\tsessionEpoch\n]);\nconst mutationInvocationKey = (appId, invocationId) => InvocationKey.make(encodeCanonicalJson([appId, invocationId]));\nconst tableDependency = (tableId) => ({\n\ttype: \"Table\",\n\ttableId\n});\nconst documentDependency = (tableId, id) => ({\n\ttype: \"Document\",\n\ttableId,\n\tid\n});\nconst indexRangeDependency = (tableId, index, lower, upper) => ({\n\ttype: \"IndexRange\",\n\ttableId,\n\tindex,\n\tlower,\n\tupper\n});\nconst indexPointInvalidation = (tableId, index, key) => ({\n\ttype: \"IndexPoint\",\n\ttableId,\n\tindex,\n\tkey\n});\n//#endregion\nexport { ActivationGeneration, AppId, AppStateRevision, AuthAccountId, AuthDeviceCodeId, AuthInternalId, AuthInvitationId, AuthMemberId, AuthSessionId, AuthVerificationId, CapabilityId, ClientApiVersion, ConnectionId, DataHistoryId, DependencyKey, DependencySet, DevDatabaseLockId, DocumentDependency, FileEffectBatch, FileEffectsAcknowledgeRequest, FileEffectsAcknowledgeResult, FileEffectsRequest, FileEffectsResult, FileReferenceAdded, FileReferenceEffect, FileReferenceRemoved, IdDependency, IndexPointInvalidation, IndexRangeDependency, InvalidationSet, InvocationId, InvocationKey, MutationInvocation, PlatformPrincipalId, ProtocolVersion, QueryInvocation, QueryKey, ReadDependency, RequestId, RevisionCheck, RevisionCheckResult, RuntimeInvocation, RuntimeInvocationRejected, RuntimeInvocationRejectionCode, RuntimeInvocationResult, RuntimeInvocationUnavailable, RuntimeMutationFailure, RuntimeMutationOutcome, RuntimeMutationOutcomeRequest, RuntimeMutationResult, RuntimeMutationSuccess, RuntimeQueryResult, RuntimeRecoveryOwner, RuntimeRequestNonce, RuntimeRevisionRejected, RuntimeTransportError, RuntimeVersionUnavailable, ServerApiVersion, SubscriptionId, TableDependency, TableId, TeamId, VersionId, VersionNumber, WriteInvalidation, canonicalInvocationInput, canonicalQueryKey, dependencyKey, documentDependency, indexPointInvalidation, indexRangeDependency, mutationInvocationKey, tableDependency };\n\n//# sourceMappingURL=hosted.js.map","import { InvocationId, SubscriptionId } from \"./runtime/id.js\";\nimport { ServingSelection, endpointUrl } from \"./deployment.js\";\nimport { RecoveryIdentity, RecoverySessionId } from \"./execution.js\";\nimport { FileId, fileLimits } from \"./schema/file.js\";\nimport { SessionState } from \"./id.js\";\nimport { FunctionAddress } from \"./runtime/sync.js\";\nimport { RuntimeMutationOutcome, RuntimeQueryResult } from \"./runtime/hosted.js\";\nimport { Schema } from \"effect\";\n//#region src/managed-sync.ts\nconst platformRevision = {\n\tmajor: 1,\n\tminor: 0\n};\nconst managedSyncPath = endpointUrl(platformRevision, \"sync\");\nconst managedSelectionPath = endpointUrl(platformRevision, \"selection\");\nconst managedProtocolVersion = 1;\nconst ManagedSelectionResponse = Schema.Struct({\n\tprotocolVersion: Schema.Literal(1),\n\tselection: ServingSelection\n});\nconst ManagedClientMessage = Schema.Union([\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"Connect\"),\n\t\tprotocolVersion: Schema.Natural,\n\t\tselection: ServingSelection,\n\t\tclientSessionId: RecoverySessionId\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"Prepare\"),\n\t\tinvocationId: InvocationId,\n\t\tfunction: FunctionAddress,\n\t\targs: Schema.Json,\n\t\tfiles: Schema.Array(FileId).check(Schema.isMaxLength(fileLimits.filesPerMutation))\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"Invoke\"),\n\t\tinvocationId: InvocationId,\n\t\tfunction: FunctionAddress,\n\t\targs: Schema.Json\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"RecoverMutation\"),\n\t\tid: Schema.String.check(Schema.isMaxLength(128)),\n\t\tidentity: RecoveryIdentity\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"Subscribe\"),\n\t\tid: SubscriptionId,\n\t\tfunction: FunctionAddress,\n\t\targs: Schema.Json\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"Unsubscribe\"),\n\t\tid: SubscriptionId\n\t})\n]);\n/** Decode this envelope before the normal server protocol, including on unsupported versions. */\nconst ManagedUpgradeRequired = Schema.Struct({\n\ttype: Schema.Literal(\"UpgradeRequired\"),\n\tselection: ServingSelection\n});\nconst ManagedServerMessage = Schema.Union([\n\tManagedUpgradeRequired,\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"Handshake\"),\n\t\tprotocolVersion: Schema.Literal(1),\n\t\tselection: ServingSelection,\n\t\tsession: SessionState,\n\t\tserverTime: Schema.Finite\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"Preparation\"),\n\t\tinvocationId: InvocationId,\n\t\tuploads: Schema.Array(Schema.Struct({\n\t\t\tid: FileId,\n\t\t\turl: Schema.optional(Schema.String)\n\t\t}))\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"MutationOutcome\"),\n\t\tid: Schema.String,\n\t\tidentity: RecoveryIdentity,\n\t\toutcome: RuntimeMutationOutcome\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"QuerySnapshot\"),\n\t\tselection: ServingSelection,\n\t\tid: SubscriptionId,\n\t\tresult: RuntimeQueryResult,\n\t\tfiles: Schema.optional(Schema.Array(Schema.Struct({\n\t\t\tid: FileId,\n\t\t\turl: Schema.String\n\t\t})))\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"Error\"),\n\t\tid: Schema.optional(Schema.String),\n\t\tcode: Schema.Literals([\n\t\t\t\"PlatformUpgrading\",\n\t\t\t\"SessionExpired\",\n\t\t\t\"InvalidMessage\",\n\t\t\t\"Unavailable\",\n\t\t\t\"InvalidArguments\",\n\t\t\t\"InvocationIdConflict\",\n\t\t\t\"ResourceLimitExceeded\"\n\t\t]),\n\t\tmessage: Schema.String\n\t})\n]);\n//#endregion\nexport { ManagedClientMessage, ManagedSelectionResponse, ManagedServerMessage, ManagedUpgradeRequired, managedProtocolVersion, managedSelectionPath, managedSyncPath };\n\n//# sourceMappingURL=managed-sync.js.map","import { RecoveryJournal, RecoveryJournalLimits } from \"./recovery-journal.js\";\nimport { ConnectionUnavailable, InvalidMutationArguments, PlatformUpgrading, ServerError } from \"./errors.js\";\nimport { ManagedUpgrade } from \"./managed-upgrade.js\";\nimport { prepareMutationArguments, uploadPreparedFiles } from \"./files.js\";\nimport { Deferred, Effect, Option, Schema } from \"effect\";\nimport { sameSelection } from \"@ignotum/contracts/execution\";\nimport { InvocationId, SubscriptionId, encodeTransportObject } from \"@ignotum/contracts/runtime/sync\";\nimport { idLimits } from \"@ignotum/contracts/id\";\nimport { IdGenerator } from \"@ignotum/shared/id\";\nimport { ManagedClientMessage, ManagedSelectionResponse, ManagedServerMessage, ManagedUpgradeRequired, managedSelectionPath, managedSyncPath } from \"@ignotum/contracts/managed-sync\";\n//#region src/versions/1/browser/managed-client.ts\nconst ManagedClientMessageJson = Schema.fromJsonString(ManagedClientMessage);\nconst ManagedWireMessageJson = Schema.fromJsonString(Schema.Unknown);\nconst encodeManagedClientMessage = Schema.encodeSync(ManagedClientMessageJson);\nconst decodeManagedWireMessage = Schema.decodeUnknownOption(ManagedWireMessageJson);\nconst decodeManagedUpgradeRequired = Schema.decodeUnknownOption(ManagedUpgradeRequired);\nconst decodeManagedServerMessage = Schema.decodeUnknownOption(ManagedServerMessage);\nconst maximumTimerMillis = 2147483647;\nconst sessionRefreshLeadMillis = idLimits.leaseMillis - idLimits.refreshMillis;\nconst issueMessage = (issue) => {\n\tswitch (issue) {\n\t\tcase \"denied\": return \"Browser storage is unavailable. Some previous mutation outcomes may be unknown.\";\n\t\tcase \"full\": return \"Browser recovery storage is full. Some mutation outcomes could not be saved.\";\n\t\tcase \"corrupt\": return \"Saved mutation information could not be read. Its outcomes remain unknown.\";\n\t\tcase \"expired\": return \"Some saved mutation information expired. Its outcomes remain unknown.\";\n\t\tcase \"session-changed\": return \"The browser session changed. Previous mutation outcomes cannot be retrieved in this session.\";\n\t}\n};\n/** The managed connection is mounted by bootstrap, independently of query observers. */\nvar ManagedBrowserClient = class {\n\tselection;\n\tbrowser;\n\thelpers;\n\tupgrade;\n\tqueries;\n\tsocket;\n\tacceptedSocket;\n\tsession;\n\tids;\n\tsessionEpoch;\n\tsessionViewRevision;\n\tunsubscribeSession;\n\tsessionDeadline = 0;\n\tclientSessionId;\n\tjournal;\n\tpending = /* @__PURE__ */ new Map();\n\trecovery = /* @__PURE__ */ new Map();\n\trecoveryDeadlines = /* @__PURE__ */ new Map();\n\trecoveryTimeouts = /* @__PURE__ */ new Map();\n\trecoveryTimers = /* @__PURE__ */ new Set();\n\treconnectTimer;\n\thandshakeTimer;\n\tsessionTimer;\n\theartbeat;\n\treconnectDelay = 250;\n\tdisposed = false;\n\treadyWaiters = /* @__PURE__ */ new Set();\n\tsuspended = true;\n\tlastActivity = Date.now();\n\tvalidation;\n\tconnectionGeneration = 0;\n\tconstructor(selection, browser, helpers, callbacks) {\n\t\tthis.selection = selection;\n\t\tthis.browser = browser;\n\t\tthis.helpers = helpers;\n\t\tthis.upgrade = new ManagedUpgrade(selection, browser, {\n\t\t\tstopAdmission: () => {\n\t\t\t\tthis.suspended = true;\n\t\t\t\tfor (const pending of this.pending.values()) if (pending.preparation !== void 0) Deferred.doneUnsafe(pending.prepared, Effect.fail(PlatformUpgrading.make({ message: \"The app is updating. This upload was interrupted before its mutation ran.\" })));\n\t\t\t\tcallbacks.stopAdmission();\n\t\t\t},\n\t\t\tunresolved: () => this.pending.size,\n\t\t\tpersist: () => this.persistPending(),\n\t\t\treload: callbacks.reload,\n\t\t\tfreshSelection: this.freshSelection\n\t\t});\n\t\tthis.clientSessionId = this.upgrade.clientSessionId;\n\t\tthis.queries = helpers.makeQueryCache(Effect.suspend(() => this.ids === void 0 ? Effect.die(\"The client identity service is not ready.\") : this.ids.generate(SubscriptionId)), (message) => Effect.sync(() => {\n\t\t\tif (this.canSend()) this.send(message);\n\t\t}));\n\t}\n\tattachSession(session, ids) {\n\t\tif (this.disposed) return;\n\t\tthis.unsubscribeSession?.();\n\t\tthis.session = session;\n\t\tthis.ids = ids;\n\t\tthis.unsubscribeSession = session.subscribe(() => {\n\t\t\tconst current = session.current();\n\t\t\tif (current === void 0 || this.sessionEpoch !== void 0 && (current.sessionEpoch !== this.sessionEpoch || current.viewRevision !== this.sessionViewRevision)) {\n\t\t\t\tthis.queries.invalidatePrivate();\n\t\t\t\tthis.suspended = true;\n\t\t\t\tthis.acceptedSocket = void 0;\n\t\t\t\tthis.socket?.close();\n\t\t\t}\n\t\t});\n\t}\n\twhenReady() {\n\t\tif (this.upgrade.ready) return Promise.resolve(true);\n\t\tif (this.upgrade.obsolete || this.disposed) return Promise.resolve(false);\n\t\treturn new Promise((resolve) => {\n\t\t\tconst finish = (ready) => {\n\t\t\t\tunsubscribe();\n\t\t\t\tthis.readyWaiters.delete(finish);\n\t\t\t\tresolve(ready);\n\t\t\t};\n\t\t\tconst unsubscribe = this.upgrade.subscribe(() => {\n\t\t\t\tif (this.upgrade.ready || this.upgrade.obsolete || this.disposed) finish(this.upgrade.ready);\n\t\t\t});\n\t\t\tthis.readyWaiters.add(finish);\n\t\t});\n\t}\n\tretry = () => {\n\t\tif (this.upgrade.obsolete) this.upgrade.retry();\n\t\telse this.wake();\n\t};\n\trecoverLoad = async () => {\n\t\tawait this.upgrade.check();\n\t};\n\tfreshSelection = async () => {\n\t\tconst response = await this.browser.fetch(managedSelectionPath, {\n\t\t\tcache: \"no-store\",\n\t\t\tcredentials: \"same-origin\",\n\t\t\tsignal: AbortSignal.timeout(1e4)\n\t\t});\n\t\tif (!response.ok) throw new Error(\"The current app selection is unavailable.\");\n\t\tconst current = Schema.decodeUnknownOption(ManagedSelectionResponse)(await response.json());\n\t\treturn Option.getOrUndefined(current)?.selection;\n\t};\n\tstart() {\n\t\tif (this.disposed) return;\n\t\tthis.browser.addEventListener(\"pageshow\", this.wake);\n\t\tthis.browser.addEventListener(\"pagehide\", this.hide);\n\t\tthis.browser.addEventListener(\"online\", this.resume);\n\t\tthis.browser.addEventListener(\"offline\", this.offline);\n\t\tthis.browser.addEventListener(\"focus\", this.wake);\n\t\tthis.browser.document.addEventListener(\"visibilitychange\", this.visibility);\n\t\tthis.heartbeat = setInterval(() => {\n\t\t\tconst now = Date.now();\n\t\t\tif (now - this.lastActivity > 15e3) this.wake();\n\t\t\tthis.lastActivity = now;\n\t\t}, 5e3);\n\t\tthis.connect();\n\t}\n\tcanSend() {\n\t\treturn !this.disposed && !this.suspended && !this.upgrade.obsolete && this.acceptedSocket !== void 0 && this.acceptedSocket === this.socket && this.socket.readyState === 1 && Date.now() < this.sessionDeadline;\n\t}\n\tsend(message) {\n\t\tif (this.socket?.readyState !== 1) return;\n\t\tthis.socket.send(encodeManagedClientMessage(message));\n\t}\n\tscheduleSessionRefresh() {\n\t\tif (this.sessionTimer !== void 0) clearTimeout(this.sessionTimer);\n\t\tthis.sessionTimer = void 0;\n\t\tif (this.session === void 0) return;\n\t\tconst remaining = this.session.remainingLeaseMillis();\n\t\tthis.sessionDeadline = Date.now() + remaining;\n\t\tif (remaining >= maximumTimerMillis) return;\n\t\tconst lead = Math.min(sessionRefreshLeadMillis, remaining / 2);\n\t\tthis.sessionTimer = setTimeout(() => this.refreshSession(), Math.max(0, remaining - lead));\n\t}\n\trefreshSession() {\n\t\tif (this.disposed || this.upgrade.obsolete || this.session === void 0) return;\n\t\tconst generation = this.connectionGeneration;\n\t\tEffect.runPromise(this.session.renew).then((current) => {\n\t\t\tif (this.disposed || this.upgrade.obsolete || generation !== this.connectionGeneration) return;\n\t\t\tif (current.sessionEpoch !== this.sessionEpoch || current.viewRevision !== this.sessionViewRevision) {\n\t\t\t\tthis.connect();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.scheduleSessionRefresh();\n\t\t}, () => {\n\t\t\tif (this.disposed || this.upgrade.obsolete || generation !== this.connectionGeneration) return;\n\t\t\tconst remaining = this.session?.remainingLeaseMillis() ?? 0;\n\t\t\tthis.sessionDeadline = Date.now() + remaining;\n\t\t\tif (remaining <= 0) {\n\t\t\t\tthis.connect();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.sessionTimer = setTimeout(() => this.refreshSession(), Math.min(1e3, remaining));\n\t\t});\n\t}\n\tconnect() {\n\t\tif (this.disposed || this.upgrade.obsolete) return;\n\t\tthis.suspended = true;\n\t\tthis.upgrade.connecting();\n\t\tthis.acceptedSocket = void 0;\n\t\tthis.recovery.clear();\n\t\tfor (const timer of this.recoveryTimers) clearTimeout(timer);\n\t\tthis.recoveryTimers.clear();\n\t\tthis.recoveryTimeouts.clear();\n\t\tif (this.reconnectTimer !== void 0) clearTimeout(this.reconnectTimer);\n\t\tif (this.handshakeTimer !== void 0) clearTimeout(this.handshakeTimer);\n\t\tthis.socket?.close();\n\t\tthis.socket = void 0;\n\t\tconst generation = ++this.connectionGeneration;\n\t\tif (this.session === void 0) return;\n\t\tEffect.runPromise(this.session.bootstrap).then(() => {\n\t\t\tif (this.disposed || this.upgrade.obsolete || generation !== this.connectionGeneration) return;\n\t\t\tthis.openSocket();\n\t\t}, () => {\n\t\t\tif (this.disposed || this.upgrade.obsolete || generation !== this.connectionGeneration) return;\n\t\t\tthis.upgrade.unavailable(\"The browser session could not be verified. Reconnecting…\");\n\t\t\tthis.reconnectTimer = setTimeout(() => this.connect(), 1e3);\n\t\t});\n\t}\n\topenSocket() {\n\t\tconst url = new URL(managedSyncPath, this.browser.location.href);\n\t\turl.protocol = url.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n\t\tconst socket = new WebSocket(url);\n\t\tthis.socket = socket;\n\t\tsocket.onopen = () => {\n\t\t\tif (this.socket !== socket || this.disposed) return;\n\t\t\tthis.send({\n\t\t\t\ttype: \"Connect\",\n\t\t\t\tprotocolVersion: 1,\n\t\t\t\tselection: this.selection,\n\t\t\t\tclientSessionId: this.clientSessionId\n\t\t\t});\n\t\t};\n\t\tthis.handshakeTimer = setTimeout(() => {\n\t\t\tif (this.socket === socket && this.acceptedSocket !== socket) socket.close();\n\t\t}, 1e4);\n\t\tsocket.onmessage = (event) => {\n\t\t\tif (this.socket !== socket || this.disposed) return;\n\t\t\tconst wire = decodeManagedWireMessage(event.data);\n\t\t\tif (Option.isNone(wire)) {\n\t\t\t\tthis.upgrade.require();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst stable = decodeManagedUpgradeRequired(wire.value);\n\t\t\tif (Option.isSome(stable)) {\n\t\t\t\tthis.upgrade.require(stable.value.selection);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst decoded = decodeManagedServerMessage(wire.value);\n\t\t\tif (Option.isNone(decoded)) {\n\t\t\t\tthis.upgrade.require();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.message(socket, decoded.value);\n\t\t};\n\t\tsocket.onerror = () => socket.close();\n\t\tsocket.onclose = (event) => {\n\t\t\tif (this.socket !== socket || this.disposed) return;\n\t\t\tif (event.code === 1012 || event.code === 1008) this.queries.invalidatePrivate();\n\t\t\tthis.acceptedSocket = void 0;\n\t\t\tthis.suspended = true;\n\t\t\tif (this.handshakeTimer !== void 0) clearTimeout(this.handshakeTimer);\n\t\t\tif (this.upgrade.obsolete) return;\n\t\t\tthis.upgrade.unavailable(\"The connection was lost. Checking for updates before resuming…\");\n\t\t\tthis.reconnectTimer = setTimeout(() => this.connect(), this.reconnectDelay);\n\t\t\tthis.reconnectDelay = Math.min(this.reconnectDelay * 2, 5e3);\n\t\t};\n\t}\n\tmessage(socket, message) {\n\t\tif (message.type === \"UpgradeRequired\") {\n\t\t\tthis.upgrade.require(message.selection);\n\t\t\treturn;\n\t\t}\n\t\tif (message.type === \"Handshake\") {\n\t\t\tif (!sameSelection(this.selection, message.selection)) {\n\t\t\t\tthis.upgrade.require(message.selection);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this.upgrade.obsolete) return;\n\t\t\tif (this.handshakeTimer !== void 0) clearTimeout(this.handshakeTimer);\n\t\t\tconst previousEpoch = this.sessionEpoch;\n\t\t\tif (previousEpoch !== void 0 && (previousEpoch !== message.session.sessionEpoch || this.sessionViewRevision !== message.session.viewRevision)) this.queries.invalidatePrivate();\n\t\t\tthis.sessionEpoch = message.session.sessionEpoch;\n\t\t\tthis.sessionViewRevision = message.session.viewRevision;\n\t\t\tthis.session?.accept(message.session, message.serverTime);\n\t\t\tthis.scheduleSessionRefresh();\n\t\t\tthis.journal = new RecoveryJournal({\n\t\t\t\tappId: this.selection.appId,\n\t\t\t\tsessionEpoch: message.session.sessionEpoch,\n\t\t\t\tclientSessionId: this.clientSessionId,\n\t\t\t\tstorage: () => this.browser.sessionStorage\n\t\t\t});\n\t\t\tconst saved = this.journal.read();\n\t\t\tfor (const issue of saved.issues) this.upgrade.reportRecovery(issueMessage(issue));\n\t\t\tif (saved.clientSessionId !== this.clientSessionId) {\n\t\t\t\tthis.clientSessionId = saved.clientSessionId;\n\t\t\t\tthis.connect();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (previousEpoch !== void 0 && previousEpoch !== this.sessionEpoch) {\n\t\t\t\tfor (const [id, pending] of this.pending) {\n\t\t\t\t\tDeferred.doneUnsafe(pending.prepared, Effect.fail(ConnectionUnavailable.make({ message: \"The session changed before file preparation completed.\" })));\n\t\t\t\t\tthis.upgrade.reportRecovery(`Mutation ${id} has an unknown outcome because the session changed.`);\n\t\t\t\t\tDeferred.doneUnsafe(pending.done, Effect.fail(ConnectionUnavailable.make({ message: \"The session changed. This mutation may already have completed.\" })));\n\t\t\t\t}\n\t\t\t\tthis.pending.clear();\n\t\t\t}\n\t\t\tthis.acceptedSocket = socket;\n\t\t\tthis.suspended = false;\n\t\t\tthis.reconnectDelay = 250;\n\t\t\tthis.upgrade.accepted();\n\t\t\tfor (const entry of this.queries.entries()) this.send({\n\t\t\t\ttype: \"Subscribe\",\n\t\t\t\tid: entry.subscriptionId,\n\t\t\t\tfunction: entry.function,\n\t\t\t\targs: entry.args\n\t\t\t});\n\t\t\tfor (const entry of saved.entries) if (entry.state === \"pending\") {\n\t\t\t\tif (!this.pending.has(entry.identity.invocationId)) this.recover(entry.identity);\n\t\t\t} else {\n\t\t\t\tthis.upgrade.reportRecovery(`Mutation ${entry.identity.invocationId}: ${entry.state}.`);\n\t\t\t\tthis.journal.remove(entry.identity);\n\t\t\t}\n\t\t\tfor (const pending of this.pending.values()) if (pending.preparation !== void 0) this.send(pending.preparation);\n\t\t\telse this.recover(pending.identity);\n\t\t\tthis.journal.write([]);\n\t\t\treturn;\n\t\t}\n\t\tif (this.acceptedSocket !== socket) {\n\t\t\tsocket.close();\n\t\t\treturn;\n\t\t}\n\t\tswitch (message.type) {\n\t\t\tcase \"Preparation\": {\n\t\t\t\tif (!this.canSend()) return;\n\t\t\t\tconst pending = this.pending.get(message.invocationId);\n\t\t\t\tif (pending?.preparation !== void 0) Deferred.doneUnsafe(pending.prepared, Effect.succeed(message.uploads));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"QuerySnapshot\": {\n\t\t\t\tif (!this.canSend()) return;\n\t\t\t\tif (!sameSelection(this.selection, message.selection)) {\n\t\t\t\t\tthis.upgrade.require(message.selection);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst result = Effect.runSync(this.helpers.resultFromWire(message.result.result, message.files).pipe(Effect.catchTags({ InvalidServerMessage: (error) => Effect.succeed(error) })));\n\t\t\t\tthis.queries.setResult(message.id, result, message.result.observedRevision);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"MutationOutcome\":\n\t\t\t\tif (!sameSelection(message.identity.originalSelection, this.selection) && !this.recovery.has(message.id)) return;\n\t\t\t\tthis.outcome(message.id, message.identity, message.outcome);\n\t\t\t\treturn;\n\t\t\tcase \"Error\":\n\t\t\t\tif (message.code === \"PlatformUpgrading\") {\n\t\t\t\t\tthis.upgrade.require();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (message.code === \"SessionExpired\") {\n\t\t\t\t\tthis.suspended = true;\n\t\t\t\t\tthis.session?.suspend();\n\t\t\t\t\tthis.queries.invalidatePrivate();\n\t\t\t\t\tsocket.close();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (message.code === \"InvalidArguments\" || message.code === \"InvocationIdConflict\" || message.code === \"ResourceLimitExceeded\") {\n\t\t\t\t\tfor (const [invocationId, pending] of this.pending) {\n\t\t\t\t\t\tif (invocationId !== message.id) continue;\n\t\t\t\t\t\tconst failure = Effect.fail(ServerError.make({\n\t\t\t\t\t\t\tcode: message.code,\n\t\t\t\t\t\t\tmessage: message.message\n\t\t\t\t\t\t}));\n\t\t\t\t\t\tDeferred.doneUnsafe(pending.prepared, failure);\n\t\t\t\t\t\tDeferred.doneUnsafe(pending.done, failure);\n\t\t\t\t\t\tthis.pending.delete(invocationId);\n\t\t\t\t\t\tthis.journal?.remove(pending.identity);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tfor (const query of this.queries.entries()) {\n\t\t\t\t\t\tif (query.subscriptionId !== message.id) continue;\n\t\t\t\t\t\tthis.queries.setResult(query.subscriptionId, ServerError.make({\n\t\t\t\t\t\t\tcode: message.code,\n\t\t\t\t\t\t\tmessage: message.message\n\t\t\t\t\t\t}));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.upgrade.unavailable(message.message);\n\t\t\t\tsocket.close();\n\t\t\t\treturn;\n\t\t}\n\t}\n\trecover(identity) {\n\t\tif (!this.canSend()) return;\n\t\tconst id = `recovery:${identity.originalSelection.dataHistoryId}:${identity.invocationId}`;\n\t\tif (this.recovery.has(id)) return;\n\t\tthis.recovery.set(id, identity);\n\t\tconst deadline = this.recoveryDeadlines.get(id) ?? Date.now() + 3e4;\n\t\tthis.recoveryDeadlines.set(id, deadline);\n\t\tif (Date.now() >= deadline) {\n\t\t\tthis.outcome(id, identity, { type: \"Uncertain\" });\n\t\t\treturn;\n\t\t}\n\t\tthis.send({\n\t\t\ttype: \"RecoverMutation\",\n\t\t\tid,\n\t\t\tidentity\n\t\t});\n\t\tconst timer = setTimeout(() => {\n\t\t\tthis.recoveryTimers.delete(timer);\n\t\t\tthis.recoveryTimeouts.delete(id);\n\t\t\tif (!this.recovery.has(id)) return;\n\t\t\tthis.recovery.delete(id);\n\t\t\tthis.recover(identity);\n\t\t}, 5e3);\n\t\tthis.recoveryTimers.add(timer);\n\t\tthis.recoveryTimeouts.set(id, timer);\n\t}\n\toutcome(id, identity, outcome) {\n\t\tconst recovery = this.recovery.get(id);\n\t\tconst pending = this.pending.get(identity.invocationId);\n\t\tif (recovery === void 0 && pending === void 0) return;\n\t\tconst expected = recovery ?? pending.identity;\n\t\tif (expected.invocationId !== identity.invocationId || !sameSelection(expected.originalSelection, identity.originalSelection)) return;\n\t\tthis.recovery.delete(id);\n\t\tconst timeout = this.recoveryTimeouts.get(id);\n\t\tif (timeout !== void 0) {\n\t\t\tclearTimeout(timeout);\n\t\t\tthis.recoveryTimers.delete(timeout);\n\t\t\tthis.recoveryTimeouts.delete(id);\n\t\t}\n\t\tif (outcome.type === \"Pending\") {\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tthis.recoveryTimers.delete(timer);\n\t\t\t\tthis.recover(identity);\n\t\t\t}, 1e3);\n\t\t\tthis.recoveryTimers.add(timer);\n\t\t\treturn;\n\t\t}\n\t\tconst recoveryId = `recovery:${identity.originalSelection.dataHistoryId}:${identity.invocationId}`;\n\t\tthis.recovery.delete(recoveryId);\n\t\tthis.recoveryDeadlines.delete(recoveryId);\n\t\tif (pending !== void 0) {\n\t\t\tthis.pending.delete(identity.invocationId);\n\t\t\tif (outcome.type === \"Settled\") Deferred.doneUnsafe(pending.done, this.helpers.resultFromWire(outcome.result.result));\n\t\t\telse Deferred.doneUnsafe(pending.done, Effect.fail(ConnectionUnavailable.make({ message: outcome.type === \"Interrupted\" ? \"The mutation was interrupted before it committed.\" : \"The mutation outcome is unknown. Check the app before trying it again.\" })));\n\t\t}\n\t\tconst state = outcome.type === \"Settled\" ? \"settled\" : outcome.type === \"Interrupted\" ? \"interrupted\" : \"uncertain\";\n\t\tif (recovery !== void 0 || outcome.type !== \"Settled\") {\n\t\t\tconst detail = outcome.type === \"Settled\" ? outcome.result.result.type === \"Success\" ? \"completed\" : \"completed with an error\" : state;\n\t\t\tthis.upgrade.reportRecovery(`Mutation ${identity.invocationId}: ${detail}.`);\n\t\t}\n\t\tfor (const issue of this.journal?.reconcile(identity, state).issues ?? []) this.upgrade.reportRecovery(issueMessage(issue));\n\t\tfor (const issue of this.journal?.remove(identity).issues ?? []) this.upgrade.reportRecovery(issueMessage(issue));\n\t}\n\tpersistPending() {\n\t\tif (this.pending.size === 0) return [];\n\t\tif (this.journal === void 0) return [\"Pending mutation outcomes could not be saved and remain unknown.\"];\n\t\treturn this.journal.write([...this.pending.values()].map((entry) => entry.identity)).issues.map(issueMessage);\n\t}\n\tobserve = Effect.fn(\"ManagedBrowserClient.observe\")((address, args) => this.queries.observe(address, args));\n\tmutate = Effect.fn(\"ManagedBrowserClient.mutate\")(function* (address, args) {\n\t\tif (this.upgrade.obsolete) return yield* PlatformUpgrading.make({ message: \"The platform is updating. Try again after the app reloads.\" });\n\t\tconst valid = yield* Effect.promise(() => this.validate());\n\t\tif (this.upgrade.obsolete) return yield* PlatformUpgrading.make({ message: \"The platform is updating. Try again after the app reloads.\" });\n\t\tif (!valid || !this.canSend() || this.sessionEpoch === void 0) return yield* ConnectionUnavailable.make({ message: \"The app must reconnect and verify its selection before accepting a mutation.\" });\n\t\tif (this.pending.size >= RecoveryJournalLimits.maxEntries) return yield* ConnectionUnavailable.make({ message: \"Too many mutations are waiting for outcomes. Wait for them to settle before trying again.\" });\n\t\tconst ids = this.ids;\n\t\tif (ids === void 0) return yield* ConnectionUnavailable.make({ message: \"The client is not ready.\" });\n\t\tconst prepared = yield* prepareMutationArguments(args).pipe(Effect.provideService(IdGenerator, ids), Effect.mapError((cause) => InvalidMutationArguments.make({\n\t\t\tcause,\n\t\t\tfunction: address,\n\t\t\tmessage: \"The mutation arguments cannot be sent.\"\n\t\t})));\n\t\tconst encoded = yield* Effect.try({\n\t\t\ttry: () => encodeTransportObject(prepared.value),\n\t\t\tcatch: (cause) => InvalidMutationArguments.make({\n\t\t\t\tcause,\n\t\t\t\tfunction: address,\n\t\t\t\tmessage: \"The mutation arguments cannot be sent.\"\n\t\t\t})\n\t\t});\n\t\tif (!this.canSend()) return yield* PlatformUpgrading.make({ message: \"The app is reconnecting or updating. Try again when it is ready.\" });\n\t\tconst invocationId = yield* ids.generate(InvocationId);\n\t\tconst done = yield* Deferred.make();\n\t\tconst identity = {\n\t\t\tinvocationId,\n\t\t\toriginalSelection: this.selection\n\t\t};\n\t\tconst uploadsReady = yield* Deferred.make();\n\t\tconst preparation = prepared.fileIds.length === 0 ? void 0 : {\n\t\t\ttype: \"Prepare\",\n\t\t\tinvocationId,\n\t\t\tfunction: address,\n\t\t\targs: encoded,\n\t\t\tfiles: prepared.fileIds\n\t\t};\n\t\tthis.pending.set(invocationId, {\n\t\t\tidentity,\n\t\t\tsessionEpoch: this.sessionEpoch,\n\t\t\tdone,\n\t\t\tprepared: uploadsReady,\n\t\t\tpreparation\n\t\t});\n\t\tfor (const issue of this.persistPending()) this.upgrade.reportRecovery(issue);\n\t\tif (preparation !== void 0) {\n\t\t\tthis.send(preparation);\n\t\t\tyield* Effect.gen({ self: this }, function* () {\n\t\t\t\tconst uploads = yield* Deferred.await(uploadsReady);\n\t\t\t\tyield* uploadPreparedFiles(prepared.nativeFiles, uploads, address);\n\t\t\t\tif (!this.canSend()) return yield* PlatformUpgrading.make({ message: \"The app is reconnecting or updating. Try again when it is ready.\" });\n\t\t\t}).pipe(Effect.tapError(() => Effect.sync(() => {\n\t\t\t\tthis.pending.delete(invocationId);\n\t\t\t\tthis.journal?.remove(identity);\n\t\t\t})));\n\t\t\tconst pending = this.pending.get(invocationId);\n\t\t\tif (pending === void 0) return yield* Deferred.await(done);\n\t\t\tthis.pending.set(invocationId, {\n\t\t\t\t...pending,\n\t\t\t\tpreparation: void 0\n\t\t\t});\n\t\t}\n\t\tthis.send({\n\t\t\ttype: \"Invoke\",\n\t\t\tinvocationId,\n\t\t\tfunction: address,\n\t\t\targs: encoded\n\t\t});\n\t\tconst timer = setTimeout(() => {\n\t\t\tthis.recoveryTimers.delete(timer);\n\t\t\tif (this.pending.has(invocationId)) this.recover(identity);\n\t\t}, 5e3);\n\t\tthis.recoveryTimers.add(timer);\n\t\treturn yield* Deferred.await(done);\n\t}).bind(this);\n\tvalidate = () => {\n\t\tif (this.upgrade.obsolete || this.disposed) return Promise.resolve(false);\n\t\tif (this.validation !== void 0) return this.validation;\n\t\tthis.validation = this.upgrade.check().then((current) => {\n\t\t\tconst ready = current && this.canSend();\n\t\t\tif (ready && this.upgrade.getSnapshot().phase !== \"ready\") this.upgrade.accepted();\n\t\t\treturn ready;\n\t\t}).finally(() => {\n\t\t\tthis.validation = void 0;\n\t\t});\n\t\treturn this.validation;\n\t};\n\tresume = () => {\n\t\tif (this.disposed || this.upgrade.obsolete) return;\n\t\tif (this.socket !== void 0 && this.socket.readyState <= WebSocket.OPEN) return;\n\t\tthis.suspended = true;\n\t\tthis.acceptedSocket = void 0;\n\t\tthis.recovery.clear();\n\t\tthis.queries.invalidate(void 0);\n\t\tthis.connect();\n\t};\n\twake = () => {\n\t\tconst connected = this.socket !== void 0 && this.socket.readyState <= WebSocket.OPEN && this.acceptedSocket === this.socket;\n\t\tthis.resume();\n\t\tif (connected) this.validate();\n\t};\n\toffline = () => {\n\t\tthis.suspended = true;\n\t\tthis.acceptedSocket = void 0;\n\t\tthis.upgrade.unavailable(\"The app is offline. Reconnect to check for updates and mutation outcomes.\");\n\t\tthis.socket?.close();\n\t};\n\thide = () => {\n\t\tfor (const issue of this.persistPending()) this.upgrade.reportRecovery(issue);\n\t\tthis.suspended = true;\n\t\tthis.acceptedSocket = void 0;\n\t\tthis.socket?.close();\n\t};\n\tvisibility = () => {\n\t\tif (this.browser.document.visibilityState === \"visible\") this.wake();\n\t\telse for (const issue of this.persistPending()) this.upgrade.reportRecovery(issue);\n\t};\n\tdispose() {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tfor (const finish of this.readyWaiters) finish(false);\n\t\tthis.unsubscribeSession?.();\n\t\tthis.persistPending();\n\t\tthis.socket?.close();\n\t\tif (this.reconnectTimer !== void 0) clearTimeout(this.reconnectTimer);\n\t\tif (this.handshakeTimer !== void 0) clearTimeout(this.handshakeTimer);\n\t\tif (this.sessionTimer !== void 0) clearTimeout(this.sessionTimer);\n\t\tif (this.heartbeat !== void 0) clearInterval(this.heartbeat);\n\t\tfor (const timer of this.recoveryTimers) clearTimeout(timer);\n\t\tthis.browser.removeEventListener(\"pageshow\", this.wake);\n\t\tthis.browser.removeEventListener(\"pagehide\", this.hide);\n\t\tthis.browser.removeEventListener(\"online\", this.resume);\n\t\tthis.browser.removeEventListener(\"offline\", this.offline);\n\t\tthis.browser.removeEventListener(\"focus\", this.wake);\n\t\tthis.browser.document.removeEventListener(\"visibilitychange\", this.visibility);\n\t\tthis.upgrade.dispose();\n\t}\n};\n//#endregion\nexport { ManagedBrowserClient };\n\n//# sourceMappingURL=managed-client.js.map","import { ConnectionUnavailable, InvalidServerMessage, clientErrorReporterLayer } from \"./errors.js\";\nimport { BrowserSession } from \"./id.js\";\nimport { applyFileGrants } from \"./files.js\";\nimport { ManagedBrowserClient } from \"./managed-client.js\";\nimport { Context, Effect, Layer, ManagedRuntime } from \"effect\";\nimport { decodeTransportValue } from \"@ignotum/contracts/runtime/sync\";\nimport { IdGenerator } from \"@ignotum/shared/id\";\nimport { Result, failureFromWire, pending } from \"@ignotum/contracts/runtime/result\";\nimport { encodeCanonicalJson } from \"@ignotum/contracts/json\";\nimport \"@ignotum/contracts/runtime/hosted\";\n//#region src/versions/1/browser/sync.ts\nconst queryKey = (functionAddress, args) => encodeCanonicalJson([functionAddress, args]);\nconst subscribeMessage = (entry) => ({\n\ttype: \"Subscribe\",\n\tid: entry.subscriptionId,\n\tfunction: entry.function,\n\targs: entry.args\n});\nconst makeQueryCache = (allocateId, sendLifecycleMessage) => {\n\tconst queries = /* @__PURE__ */ new Map();\n\tconst queriesById = /* @__PURE__ */ new Map();\n\tconst observe = Effect.fn(\"SyncClient.QueryCache.observe\")(function* (functionAddress, args) {\n\t\tconst key = queryKey(functionAddress, args);\n\t\tlet entry = queries.get(key);\n\t\tif (entry === void 0) {\n\t\t\tconst created = {\n\t\t\t\targs,\n\t\t\t\tfunction: functionAddress,\n\t\t\t\tgeneration: 0,\n\t\t\t\tlisteners: /* @__PURE__ */ new Set(),\n\t\t\t\trevision: void 0,\n\t\t\t\treferences: 0,\n\t\t\t\tresult: pending(),\n\t\t\t\tsubscriptionId: yield* allocateId\n\t\t\t};\n\t\t\tqueries.set(key, created);\n\t\t\tqueriesById.set(created.subscriptionId, created);\n\t\t\tyield* sendLifecycleMessage(subscribeMessage(created));\n\t\t\tentry = created;\n\t\t}\n\t\tconst observed = entry;\n\t\tobserved.references += 1;\n\t\tobserved.generation += 1;\n\t\tlet released = false;\n\t\treturn {\n\t\t\tgetSnapshot: () => observed.result,\n\t\t\tsubscribe: (listener) => {\n\t\t\t\tobserved.listeners.add(listener);\n\t\t\t\treturn () => observed.listeners.delete(listener);\n\t\t\t},\n\t\t\trelease: Effect.gen(function* () {\n\t\t\t\tif (released) return;\n\t\t\t\treleased = true;\n\t\t\t\tobserved.references -= 1;\n\t\t\t\tif (observed.references !== 0) return;\n\t\t\t\tconst generation = ++observed.generation;\n\t\t\t\tyield* Effect.sleep(\"25 millis\");\n\t\t\t\tif (observed.references !== 0 || observed.generation !== generation || queries.get(key) !== observed) return;\n\t\t\t\tqueries.delete(key);\n\t\t\t\tqueriesById.delete(observed.subscriptionId);\n\t\t\t\tyield* sendLifecycleMessage({\n\t\t\t\t\ttype: \"Unsubscribe\",\n\t\t\t\t\tid: observed.subscriptionId\n\t\t\t\t});\n\t\t\t})\n\t\t};\n\t});\n\tconst clear = (entry) => {\n\t\tentry.result = pending();\n\t\tentry.revision = void 0;\n\t\tfor (const listener of entry.listeners) listener();\n\t};\n\treturn {\n\t\tinvalidate: (ids) => {\n\t\t\tfor (const entry of queries.values()) if (ids === void 0 || ids.includes(entry.subscriptionId)) clear(entry);\n\t\t},\n\t\tinvalidatePrivate: () => {\n\t\t\tfor (const entry of queries.values()) if (entry.dependsOnId !== false) clear(entry);\n\t\t},\n\t\tentries: () => queries.values(),\n\t\tgetById: (id) => queriesById.get(id),\n\t\tobserve,\n\t\tsetResult: (id, result, revision) => {\n\t\t\tconst entry = queriesById.get(id);\n\t\t\tif (entry === void 0) return;\n\t\t\tif (revision !== void 0) {\n\t\t\t\tif (entry.revision !== void 0 && revision < entry.revision) return;\n\t\t\t\tentry.revision = revision;\n\t\t\t}\n\t\t\tentry.result = result;\n\t\t\tfor (const listener of entry.listeners) listener();\n\t\t}\n\t};\n};\nconst syncClientInternals = {\n\tmakeQueryCache,\n\tqueryIdentity: queryKey,\n\tresultFromWire: Effect.fn(\"SyncClient.resultFromWire\")((wire, files = []) => Effect.try({\n\t\ttry: () => wire.type === \"Success\" ? Result.succeed(wire.value === void 0 ? void 0 : applyFileGrants(decodeTransportValue(wire.value, wire.dates ?? []), files)) : failureFromWire(wire.error, wire.dates),\n\t\tcatch: (cause) => InvalidServerMessage.make({\n\t\t\tcause,\n\t\t\tmessage: \"The server returned an invalid function result.\"\n\t\t})\n\t}))\n};\nvar SyncClient = class extends Context.Service()(\"ignotum/client/sync/SyncClient\") {};\nconst makeUnmountedSyncRuntime = () => ManagedRuntime.make(Layer.succeed(SyncClient)({\n\tobserve: () => Effect.fail(ConnectionUnavailable.make({ message: \"The application has not mounted.\" })),\n\tmutate: () => Effect.fail(ConnectionUnavailable.make({ message: \"The application has not mounted.\" }))\n}).pipe(Layer.provideMerge(BrowserSession.layer), Layer.provideMerge(clientErrorReporterLayer), Layer.provideMerge(IdGenerator.layer)));\nlet syncRuntime = makeUnmountedSyncRuntime();\nconst mountManagedSync = (selection, browser, callbacks) => {\n\tconst client = new ManagedBrowserClient(selection, browser, syncClientInternals, callbacks);\n\tsyncRuntime.dispose();\n\tsyncRuntime = ManagedRuntime.make(Layer.effect(SyncClient, Effect.gen(function* () {\n\t\tclient.attachSession(yield* BrowserSession, yield* IdGenerator);\n\t\treturn SyncClient.of({\n\t\t\tobserve: client.observe,\n\t\t\tmutate: client.mutate\n\t\t});\n\t})).pipe(Layer.provideMerge(BrowserSession.layer), Layer.provideMerge(clientErrorReporterLayer), Layer.provideMerge(IdGenerator.layer)));\n\tconst runtime = syncRuntime;\n\truntime.runPromise(SyncClient).then(() => client.start(), () => client.dispose());\n\treturn {\n\t\tclient,\n\t\tdispose: () => {\n\t\t\tclient.dispose();\n\t\t\truntime.dispose();\n\t\t\tif (syncRuntime === runtime) syncRuntime = makeUnmountedSyncRuntime();\n\t\t}\n\t};\n};\nconst hot = import.meta.hot;\nif (hot !== void 0) hot.dispose(() => void syncRuntime.dispose());\n//#endregion\nexport { SyncClient, mountManagedSync, syncClientInternals, syncRuntime };\n\n//# sourceMappingURL=sync.js.map","import { Effect, Schema } from \"effect\";\nimport { LayoutDefinition, RouteDefinition, appDefinitionLimits } from \"@ignotum/contracts/routes\";\n//#region src/routing/pattern.ts\nvar RoutingDefinitionError = class extends Schema.TaggedError()(\"RoutingDefinitionError\", {\n\tmessage: Schema.String,\n\tpattern: Schema.optional(Schema.String)\n}) {};\nconst reservedIdentifiers = /* @__PURE__ */ new Set([\n\t\"await\",\n\t\"break\",\n\t\"case\",\n\t\"catch\",\n\t\"class\",\n\t\"const\",\n\t\"continue\",\n\t\"debugger\",\n\t\"default\",\n\t\"delete\",\n\t\"do\",\n\t\"else\",\n\t\"enum\",\n\t\"export\",\n\t\"extends\",\n\t\"false\",\n\t\"finally\",\n\t\"for\",\n\t\"function\",\n\t\"if\",\n\t\"implements\",\n\t\"import\",\n\t\"in\",\n\t\"instanceof\",\n\t\"interface\",\n\t\"let\",\n\t\"new\",\n\t\"null\",\n\t\"package\",\n\t\"private\",\n\t\"protected\",\n\t\"public\",\n\t\"return\",\n\t\"static\",\n\t\"super\",\n\t\"switch\",\n\t\"this\",\n\t\"throw\",\n\t\"true\",\n\t\"try\",\n\t\"typeof\",\n\t\"var\",\n\t\"void\",\n\t\"while\",\n\t\"with\",\n\t\"yield\"\n]);\nconst ParameterName = Schema.String.check(Schema.isPattern(/^[$_\\p{ID_Start}][$\\u200C\\u200D\\p{ID_Continue}]*$/u), Schema.makeFilter((name) => !reservedIdentifiers.has(name) || \"Parameter names must be TypeScript identifiers\"));\nconst CanonicalPattern = RouteDefinition.fields.pattern.check(Schema.makeFilter((pattern) => pattern === \"/\" || !pattern.endsWith(\"/\") && !pattern.includes(\"//\") || \"Patterns must not contain empty segments or trailing slashes\"), Schema.makeFilter((pattern) => !/[[\\]()\\u0000-\\u001F\\u007F\\uD800-\\uDFFF]/u.test(pattern) || \"Patterns must use decoded literal segments and supported parameter syntax\"));\nconst invalid = (message, pattern) => new RoutingDefinitionError({\n\tmessage,\n\tpattern\n});\nconst weight = (segment) => segment.kind === \"Literal\" ? 3 : segment.kind === \"Parameter\" ? 2 : 1;\nconst segmentText = (segment) => segment.kind === \"Literal\" ? segment.value : `${segment.kind === \"Parameter\" ? \":\" : \"*\"}${segment.name}`;\nconst makePattern = (segments) => ({\n\tpattern: `/${segments.map(segmentText).join(\"/\")}`,\n\tsegments,\n\tprecedence: segments.map(weight)\n});\nconst structuralKey = (pattern) => JSON.stringify(pattern.segments.map((segment) => segment.kind === \"Literal\" ? [segment.kind, segment.value] : [segment.kind]));\nconst compare = (left, right) => {\n\tfor (let index = 0; index < Math.max(left.precedence.length, right.precedence.length); index++) {\n\t\tconst difference = (right.precedence[index] ?? 0) - (left.precedence[index] ?? 0);\n\t\tif (difference !== 0) return difference;\n\t}\n\treturn 0;\n};\nconst contains = (directory, pattern) => directory.segments.length <= pattern.segments.length && directory.segments.every((segment, index) => segmentText(segment) === segmentText(pattern.segments[index]));\nconst parsePattern = Effect.fn(\"Routing.parsePattern\")(function* (input) {\n\tconst pattern = yield* Schema.decodeUnknownEffect(CanonicalPattern)(input).pipe(Effect.mapError(() => invalid(\"Route patterns must be canonical absolute paths outside /_ignotum.\", input)));\n\tif (pattern === \"/\") return makePattern([]);\n\tconst parts = pattern.slice(1).split(\"/\");\n\tif (parts.length > 128) return yield* invalid(\"Route patterns exceed the segment limit.\", pattern);\n\tconst segments = [];\n\tconst names = /* @__PURE__ */ new Set();\n\tfor (const [index, part] of parts.entries()) if (part.startsWith(\":\") || part.startsWith(\"*\")) {\n\t\tconst name = yield* Schema.decodeUnknownEffect(ParameterName)(part.slice(1)).pipe(Effect.mapError(() => invalid(\"Route parameter names must be valid TypeScript identifiers.\", pattern)));\n\t\tif (names.has(name)) return yield* invalid(`Repeated route parameter '${name}'.`, pattern);\n\t\tnames.add(name);\n\t\tif (part.startsWith(\"*\")) {\n\t\t\tif (index !== parts.length - 1) return yield* invalid(\"A catch-all must be the final segment.\", pattern);\n\t\t\tsegments.push({\n\t\t\t\tkind: \"CatchAll\",\n\t\t\t\tname\n\t\t\t});\n\t\t} else segments.push({\n\t\t\tkind: \"Parameter\",\n\t\t\tname\n\t\t});\n\t} else {\n\t\tif (part === \".\" || part === \"..\" || /[:*]/.test(part)) return yield* invalid(\"Route literals must not contain dot segments or parameter syntax.\", pattern);\n\t\tsegments.push({\n\t\t\tkind: \"Literal\",\n\t\t\tvalue: part\n\t\t});\n\t}\n\treturn makePattern(segments);\n});\nconst compileRoute = Effect.fn(\"Routing.compileRoute\")(function* (input) {\n\tconst route = yield* Schema.decodeUnknownEffect(RouteDefinition)(input).pipe(Effect.mapError(() => invalid(\"The route definition is invalid.\")));\n\tconst parsed = yield* parsePattern(route.pattern);\n\tconst directory = yield* parsePattern(route.directoryScope ?? route.pattern);\n\tif (!contains(directory, parsed) || directory.segments.length < parsed.segments.length - 1) return yield* invalid(\"A route directory must be its full pattern for an index page or its immediate parent for a page file.\", route.pattern);\n\tif (route.precedence.length !== parsed.precedence.length || route.precedence.some((value, index) => value !== parsed.precedence[index])) return yield* invalid(\"Stored route precedence does not match its pattern.\", route.pattern);\n\tconst parameters = parsed.segments.filter((segment) => segment.kind !== \"Literal\");\n\tif (route.params.length !== parameters.length || new Set(route.params.map((field) => field.name)).size !== route.params.length) return yield* invalid(\"Route parameters must describe each dynamic name exactly once.\", route.pattern);\n\tfor (const parameter of parameters) {\n\t\tconst field = route.params.find((field) => field.name === parameter.name);\n\t\tif (field === void 0 || (parameter.kind === \"CatchAll\" ? field.value.type !== \"array\" : field.value.type === \"array\")) return yield* invalid(\"Single parameters require scalar values and catch-alls require string arrays.\", route.pattern);\n\t}\n\tif (new Set(route.searchParams.map((field) => field.name)).size !== route.searchParams.length) return yield* invalid(\"Search parameter names must be unique.\", route.pattern);\n\treturn {\n\t\tpattern: parsed,\n\t\tdirectory\n\t};\n});\nconst validateRoutePattern = Effect.fn(\"Routing.validateRoutePattern\")(function* (input) {\n\treturn (yield* compileRoute(input)).pattern;\n});\nconst compilePatterns = Effect.fn(\"Routing.compilePatterns\")(function* (routeInput, layoutInput) {\n\tconst routes = yield* Schema.decodeUnknownEffect(Schema.Array(RouteDefinition).check(Schema.isMaxLength(appDefinitionLimits.routes)))(routeInput).pipe(Effect.mapError(() => invalid(\"Route definitions are invalid or exceed the route limit.\")));\n\tconst layouts = yield* Schema.decodeUnknownEffect(Schema.Array(LayoutDefinition).check(Schema.isMaxLength(appDefinitionLimits.layouts)))(layoutInput).pipe(Effect.mapError(() => invalid(\"Layout definitions are invalid or exceed the layout limit.\")));\n\tif (new Set(routes.map((route) => route.id)).size !== routes.length) return yield* invalid(\"Route identities must be unique.\");\n\tif (new Set(layouts.map((layout) => layout.id)).size !== layouts.length) return yield* invalid(\"Layout identities must be unique.\");\n\tconst parsedRoutes = yield* Effect.forEach(routes, (route) => compileRoute(route));\n\tconst parsedLayouts = yield* Effect.forEach(layouts, (layout) => parsePattern(layout.scope));\n\tif (new Set(parsedRoutes.map((route) => structuralKey(route.pattern))).size !== routes.length) return yield* invalid(\"Duplicate or structurally ambiguous route patterns.\");\n\tif (new Set(parsedLayouts.map(structuralKey)).size !== layouts.length) return yield* invalid(\"Duplicate or structurally ambiguous layout scopes.\");\n\tconst layoutPatterns = layouts.map((layout, index) => ({\n\t\tlayout,\n\t\tpattern: parsedLayouts[index]\n\t}));\n\tconst applicable = (pattern) => layoutPatterns.filter((item) => contains(item.pattern, pattern)).sort((a, b) => a.pattern.segments.length - b.pattern.segments.length).map((item) => item.layout);\n\tfor (const { layout, pattern } of layoutPatterns) {\n\t\tconst ancestors = applicable(pattern).filter((candidate) => candidate.id !== layout.id);\n\t\tif (layout.parent !== ancestors.at(-1)?.id) return yield* invalid(`Layout '${layout.id}' must name its nearest directory layout as parent.`, layout.scope);\n\t}\n\tconst directories = /* @__PURE__ */ new Map();\n\tconst addDirectory = Effect.fn(\"Routing.addDirectory\")(function* (pattern) {\n\t\tconst key = structuralKey(pattern);\n\t\tconst existing = directories.get(key);\n\t\tif (existing !== void 0 && existing.pattern !== pattern.pattern) return yield* invalid(\"Dynamic directory parameter names are structurally ambiguous.\", pattern.pattern);\n\t\tdirectories.set(key, pattern);\n\t});\n\tyield* addDirectory(makePattern([]));\n\tfor (const pattern of parsedLayouts) for (let length = 1; length <= pattern.segments.length; length++) yield* addDirectory(makePattern(pattern.segments.slice(0, length)));\n\tconst compiledRoutes = [];\n\tfor (const [index, route] of routes.entries()) {\n\t\tconst { pattern, directory } = parsedRoutes[index];\n\t\tconst branch = applicable(directory);\n\t\tif (route.layouts.length !== branch.length || route.layouts.some((id, index) => id !== branch[index]?.id)) return yield* invalid(`Route '${route.id}' must include its complete directory layout branch.`, route.pattern);\n\t\tfor (let length = 1; length <= directory.segments.length; length++) yield* addDirectory(makePattern(directory.segments.slice(0, length)));\n\t\tcompiledRoutes.push({\n\t\t\troute,\n\t\t\tpattern,\n\t\t\tlayouts: branch\n\t\t});\n\t}\n\treturn {\n\t\troutes: compiledRoutes.sort((a, b) => compare(a.pattern, b.pattern)),\n\t\tdirectories: [...directories.values()].map((pattern) => ({\n\t\t\tpattern,\n\t\t\tlayouts: applicable(pattern)\n\t\t})).sort((a, b) => compare(a.pattern, b.pattern))\n\t};\n});\nconst captures = (pattern, segments, directory) => {\n\tconst values = [];\n\tfor (const [index, part] of pattern.segments.entries()) {\n\t\tconst value = segments[index];\n\t\tif (value === void 0 || value.length === 0) return void 0;\n\t\tif (part.kind === \"Literal\") {\n\t\t\tif (part.value !== value) return void 0;\n\t\t} else if (part.kind === \"Parameter\") values.push([part.name, value]);\n\t\telse {\n\t\t\tvalues.push([part.name, segments.slice(index)]);\n\t\t\treturn Object.fromEntries(values);\n\t\t}\n\t}\n\tif (!directory && segments.length !== pattern.segments.length) return void 0;\n\treturn Object.fromEntries(values);\n};\nconst matchDirectory = (compiled, decodedSegments) => {\n\tif (decodedSegments[0] === \"_ignotum\") return {\n\t\troute: void 0,\n\t\tlayouts: [],\n\t\tparams: {}\n\t};\n\tfor (const directory of compiled.directories) {\n\t\tconst params = captures(directory.pattern, decodedSegments, true);\n\t\tif (params !== void 0) return {\n\t\t\troute: void 0,\n\t\t\tlayouts: directory.layouts,\n\t\t\tparams\n\t\t};\n\t}\n\treturn {\n\t\troute: void 0,\n\t\tlayouts: [],\n\t\tparams: {}\n\t};\n};\nconst matchPattern = (compiled, decodedSegments) => {\n\tif (decodedSegments[0] === \"_ignotum\") return {\n\t\troute: void 0,\n\t\tlayouts: [],\n\t\tparams: {}\n\t};\n\tfor (const entry of compiled.routes) {\n\t\tconst params = captures(entry.pattern, decodedSegments, false);\n\t\tif (params !== void 0) return {\n\t\t\troute: entry.route,\n\t\t\tlayouts: entry.layouts,\n\t\t\tparams\n\t\t};\n\t}\n\treturn matchDirectory(compiled, decodedSegments);\n};\n//#endregion\nexport { RoutingDefinitionError, compilePatterns, matchDirectory, matchPattern, parsePattern, validateRoutePattern };\n\n//# sourceMappingURL=pattern.js.map","import { validateRoutePattern } from \"./pattern.js\";\nimport { Array, Effect, Schema } from \"effect\";\nimport { RouteDefinition } from \"@ignotum/contracts/routes\";\nimport { GeneratedId } from \"@ignotum/contracts/runtime/id\";\n//#region src/routing/url.ts\nconst UrlIssue = Schema.Struct({\n\tsource: Schema.Literals([\"params\", \"searchParams\"]),\n\tfield: Schema.optional(Schema.String),\n\tmessage: Schema.String\n});\nconst ParsedLocation = Schema.Struct({\n\tsegments: Schema.Array(Schema.String),\n\tpathname: Schema.String,\n\tsearch: Schema.String,\n\thash: Schema.String,\n\tcanonicalUrl: Schema.String\n});\nconst PartialLocation = Schema.Struct({\n\t...ParsedLocation.fields,\n\tpathComplete: Schema.Boolean\n});\nvar InvalidUrl = class extends Schema.TaggedError()(\"InvalidUrl\", {\n\tissues: Schema.Array(UrlIssue),\n\tpartial: Schema.optional(PartialLocation)\n}) {};\nconst invalid = (source, message, field, partial) => InvalidUrl.make({\n\tissues: [{\n\t\tsource,\n\t\tfield,\n\t\tmessage\n\t}],\n\tpartial\n});\nconst invalidField = (source, field) => invalid(source, `The URL field '${field}' does not match its declaration.`, field);\nconst SafeSegment = Schema.String.check(Schema.isMinLength(1), Schema.isPattern(/^[^/\\\\\\u0000-\\u001f\\u007f]+$/u), Schema.makeFilter((value) => value !== \".\" && value !== \"..\" || \"Dot segments are not allowed\"));\nconst DecimalText = Schema.String.check(Schema.isPattern(/^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/));\nconst InputRecord = Schema.Record(Schema.String, Schema.Unknown);\nconst BuildInput = Schema.Struct({\n\tparams: Schema.optional(Schema.Unknown),\n\tsearchParams: Schema.optional(Schema.Unknown),\n\thash: Schema.optional(Schema.String.check(Schema.makeFilter((value) => !value.startsWith(\"#\") || \"Hash input must omit the leading #\")))\n}).annotate({ parseOptions: { onExcessProperty: \"error\" } });\nconst decodeComponent = Effect.fn(\"Routing.decodeComponent\")(function* (value, source, field, partial) {\n\treturn yield* Effect.try({\n\t\ttry: () => {\n\t\t\treturn decodeURIComponent(value);\n\t\t},\n\t\tcatch: () => invalid(source, \"The URL contains malformed escapes or Unicode.\", field, partial)\n\t});\n});\nconst encodeComponent = Effect.fn(\"Routing.encodeComponent\")(function* (value, source, field) {\n\treturn yield* Effect.try({\n\t\ttry: () => encodeURIComponent(value),\n\t\tcatch: () => invalid(source, \"The URL contains malformed Unicode.\", field)\n\t});\n});\nconst searchEntries = Effect.fn(\"Routing.searchEntries\")(function* (search, partial) {\n\tyield* Schema.decodeUnknownEffect(Schema.String)(search).pipe(Effect.mapError(() => invalid(\"searchParams\", \"Search parameters must be URL query text.\", void 0, partial)));\n\tconst query = search.startsWith(\"?\") ? search.slice(1) : search;\n\tconst entries = [];\n\tfor (const item of query.split(\"&\")) {\n\t\tif (item === \"\") continue;\n\t\tconst equals = item.indexOf(\"=\");\n\t\tconst key = equals < 0 ? item : item.slice(0, equals);\n\t\tconst value = equals < 0 ? \"\" : item.slice(equals + 1);\n\t\tconst name = yield* decodeComponent(key.replaceAll(\"+\", \" \"), \"searchParams\", void 0, partial);\n\t\tentries.push([name, yield* decodeComponent(value.replaceAll(\"+\", \" \"), \"searchParams\", name, partial)]);\n\t}\n\treturn entries;\n});\n/** Parse a raw application-root-relative location before a URL implementation normalizes it. */\nconst parseLocation = Effect.fn(\"Routing.parseLocation\")(function* (input) {\n\tyield* Schema.decodeUnknownEffect(Schema.String)(input).pipe(Effect.mapError(() => invalid(\"params\", \"A location must be URL text.\")));\n\tconst fragmentAt = input.indexOf(\"#\");\n\tconst hash = fragmentAt < 0 ? \"\" : input.slice(fragmentAt);\n\tconst beforeHash = fragmentAt < 0 ? input : input.slice(0, fragmentAt);\n\tconst queryAt = beforeHash.indexOf(\"?\");\n\tconst search = queryAt < 0 ? \"\" : beforeHash.slice(queryAt);\n\tconst rawPathname = queryAt < 0 ? beforeHash : beforeHash.slice(0, queryAt);\n\tconst pathname = rawPathname.length > 1 && rawPathname.endsWith(\"/\") ? rawPathname.slice(0, -1) : rawPathname;\n\tconst segments = [];\n\tconst partial = (pathComplete) => ({\n\t\tsegments: [...segments],\n\t\tpathname,\n\t\tsearch,\n\t\thash,\n\t\tcanonicalUrl: `${pathname}${search}${hash}`,\n\t\tpathComplete\n\t});\n\tif (!rawPathname.startsWith(\"/\") || rawPathname.startsWith(\"//\")) return yield* invalid(\"params\", \"A location must start with exactly one application-root slash.\", void 0, partial(false));\n\tif (pathname !== \"/\") for (const raw of pathname.slice(1).split(\"/\")) {\n\t\tconst segment = yield* decodeComponent(raw, \"params\", void 0, partial(false));\n\t\tyield* Schema.decodeEffect(SafeSegment)(segment).pipe(Effect.mapError(() => invalid(\"params\", \"Path segments must be nonempty and cannot contain slashes, dot navigation or control characters.\", void 0, partial(false))));\n\t\tsegments.push(segment);\n\t}\n\tyield* searchEntries(search, partial(true));\n\tyield* decodeComponent(hash.slice(1), \"params\", void 0, partial(true));\n\treturn {\n\t\tsegments,\n\t\tpathname,\n\t\tsearch,\n\t\thash,\n\t\tcanonicalUrl: `${pathname}${search}${hash}`\n\t};\n});\nconst scalarSchema = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"string\": return Schema.String;\n\t\tcase \"id\": return GeneratedId;\n\t\tcase \"number\": return Schema.Finite;\n\t\tcase \"integer\": return Schema.Int;\n\t\tcase \"boolean\": return Schema.Boolean;\n\t\tcase \"literal\": return Schema.Literal(descriptor.value);\n\t\tcase \"literals\": return Schema.Literals(descriptor.values);\n\t}\n};\nconst scalarText = Effect.fn(\"Routing.scalarText\")(function* (descriptor, value, source, field) {\n\tswitch (descriptor.type) {\n\t\tcase \"number\":\n\t\tcase \"integer\":\n\t\t\tyield* Schema.decodeEffect(DecimalText)(value).pipe(Effect.mapError(() => invalidField(source, field)));\n\t\t\treturn yield* Schema.decodeUnknownEffect(scalarSchema(descriptor))(Number(value)).pipe(Effect.mapError(() => invalidField(source, field)));\n\t\tcase \"boolean\": return (yield* Schema.decodeUnknownEffect(Schema.Literals([\"true\", \"false\"]))(value).pipe(Effect.mapError(() => invalidField(source, field)))) === \"true\";\n\t\tcase \"literal\":\n\t\t\tyield* Schema.decodeEffect(Schema.Literal(String(descriptor.value)))(value).pipe(Effect.mapError(() => invalidField(source, field)));\n\t\t\treturn descriptor.value;\n\t\tcase \"literals\":\n\t\t\tyield* Schema.decodeEffect(Schema.Literals(descriptor.values.map(String)))(value).pipe(Effect.mapError(() => invalidField(source, field)));\n\t\t\treturn descriptor.values.find((literal) => String(literal) === value);\n\t\tdefault: return yield* Schema.decodeUnknownEffect(scalarSchema(descriptor))(value).pipe(Effect.mapError(() => invalidField(source, field)));\n\t}\n});\nconst suppliedValue = Effect.fn(\"Routing.suppliedValue\")(function* (descriptor, input, source, field) {\n\tconst schema = descriptor.type === \"array\" ? Schema.Array(scalarSchema(descriptor.value)) : scalarSchema(descriptor);\n\tconst value = yield* Schema.decodeUnknownEffect(schema)(input).pipe(Effect.mapError(() => invalidField(source, field)));\n\tfor (const item of Array.ensure(value)) yield* encodeComponent(String(item), source, field);\n\treturn value;\n});\nconst validateDefinition = Effect.fn(\"Routing.validateUrlDefinition\")(function* (input) {\n\tconst route = yield* Schema.decodeUnknownEffect(RouteDefinition)(input).pipe(Effect.mapError(() => invalid(\"params\", \"The route's URL declaration is invalid.\")));\n\tconst pattern = yield* validateRoutePattern(route).pipe(Effect.mapError((error) => invalid(\"params\", error.message)));\n\tfor (const field of route.searchParams) {\n\t\tyield* encodeComponent(field.name, \"searchParams\", field.name);\n\t\tif (field.value.type === \"default\") yield* suppliedValue(field.value.value, field.value.default, \"searchParams\", field.name);\n\t}\n\treturn {\n\t\troute,\n\t\tpattern\n\t};\n});\nconst inputRecord = Effect.fn(\"Routing.inputRecord\")(function* (input, fields, source) {\n\tconst values = yield* Schema.decodeUnknownEffect(InputRecord)(input === void 0 ? {} : input).pipe(Effect.mapError(() => invalid(source, `The ${source} input must be an object.`)));\n\tfor (const name of Object.keys(values)) if (!fields.some((field) => field.name === name)) return yield* invalid(source, `The URL field '${name}' is not declared.`, name);\n\treturn values;\n});\nconst own = (record, field) => Object.hasOwn(record, field) ? record[field] : void 0;\nconst pathValue = Effect.fn(\"Routing.pathValue\")(function* (value, name) {\n\tconst text = String(value);\n\tyield* Schema.decodeEffect(SafeSegment)(text).pipe(Effect.mapError(() => invalidField(\"params\", name)));\n\tyield* encodeComponent(text, \"params\", name);\n\treturn text;\n});\n/** rawParams already contains decoded segments from parseLocation and must not be decoded twice. */\nconst decodeRouteInputs = Effect.fn(\"Routing.decodeRouteInputs\")(function* (input, rawParams, search) {\n\tconst { route } = yield* validateDefinition(input);\n\tconst raw = yield* inputRecord(rawParams, route.params, \"params\");\n\tconst params = [];\n\tfor (const field of route.params) {\n\t\tconst value = own(raw, field.name);\n\t\tif (field.value.type === \"array\") {\n\t\t\tconst values = yield* Schema.decodeUnknownEffect(Schema.Array(Schema.String).check(Schema.isMinLength(1)))(value).pipe(Effect.mapError(() => invalidField(\"params\", field.name)));\n\t\t\tparams.push([field.name, yield* Effect.forEach(values, (item) => pathValue(item, field.name))]);\n\t\t} else {\n\t\t\tconst text = yield* Schema.decodeUnknownEffect(Schema.String)(value).pipe(Effect.mapError(() => invalidField(\"params\", field.name)));\n\t\t\tyield* pathValue(text, field.name);\n\t\t\tparams.push([field.name, yield* scalarText(field.value, text, \"params\", field.name)]);\n\t\t}\n\t}\n\tconst query = yield* searchEntries(search);\n\tconst searchParams = [];\n\tfor (const field of route.searchParams) {\n\t\tconst values = query.filter(([name]) => name === field.name).map(([, value]) => value);\n\t\tconst descriptor = field.value;\n\t\tif (values.length === 0) {\n\t\t\tif (descriptor.type === \"optional\") {\n\t\t\t\tsearchParams.push([field.name, void 0]);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (descriptor.type === \"default\") {\n\t\t\t\tsearchParams.push([field.name, yield* suppliedValue(descriptor.value, descriptor.default, \"searchParams\", field.name)]);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn yield* invalid(\"searchParams\", `The required URL field '${field.name}' is missing.`, field.name);\n\t\t}\n\t\tconst required = descriptor.type === \"optional\" || descriptor.type === \"default\" ? descriptor.value : descriptor;\n\t\tif (required.type === \"array\") searchParams.push([field.name, yield* Effect.forEach(values, (value) => scalarText(required.value, value, \"searchParams\", field.name))]);\n\t\telse {\n\t\t\tif (values.length !== 1) return yield* invalid(\"searchParams\", `The scalar URL field '${field.name}' occurs more than once.`, field.name);\n\t\t\tsearchParams.push([field.name, yield* scalarText(required, values[0], \"searchParams\", field.name)]);\n\t\t}\n\t}\n\treturn {\n\t\tparams: Object.fromEntries(params),\n\t\tsearchParams: Object.fromEntries(searchParams)\n\t};\n});\nconst sameValue = (left, right) => Array.isArray(left) && Array.isArray(right) ? left.length === right.length && left.every((value, index) => value === right[index]) : left === right;\nconst buildUrl = Effect.fn(\"Routing.buildUrl\")(function* (input, values = {}) {\n\tconst { route, pattern } = yield* validateDefinition(input);\n\tconst navigation = yield* Schema.decodeUnknownEffect(BuildInput, { onExcessProperty: \"error\" })(values).pipe(Effect.mapError(() => invalid(\"params\", \"The URL navigation input is invalid.\")));\n\tconst params = yield* inputRecord(navigation.params, route.params, \"params\");\n\tconst searchParams = yield* inputRecord(navigation.searchParams, route.searchParams, \"searchParams\");\n\tconst segments = [];\n\tfor (const segment of pattern.segments) {\n\t\tif (segment.kind === \"Literal\") {\n\t\t\tsegments.push(yield* encodeComponent(segment.value, \"params\"));\n\t\t\tcontinue;\n\t\t}\n\t\tconst field = route.params.find((candidate) => candidate.name === segment.name);\n\t\tconst value = yield* suppliedValue(field.value, own(params, field.name), \"params\", field.name);\n\t\tconst parts = Array.ensure(value);\n\t\tif (parts.length === 0) return yield* invalid(\"params\", \"Catch-all parameters must contain at least one segment.\", field.name);\n\t\tfor (const part of parts) segments.push(yield* encodeComponent(yield* pathValue(part, field.name), \"params\", field.name));\n\t}\n\tif (segments[0] === \"_ignotum\") {\n\t\tconst first = pattern.segments[0];\n\t\treturn yield* invalid(\"params\", \"The /_ignotum path is reserved for the platform.\", first?.kind === \"Parameter\" || first?.kind === \"CatchAll\" ? first.name : void 0);\n\t}\n\tconst query = new URLSearchParams();\n\tfor (const field of route.searchParams) {\n\t\tconst raw = own(searchParams, field.name);\n\t\tconst descriptor = field.value;\n\t\tif (raw === void 0) {\n\t\t\tif (descriptor.type === \"optional\" || descriptor.type === \"default\") continue;\n\t\t\treturn yield* invalid(\"searchParams\", `The required URL field '${field.name}' is missing.`, field.name);\n\t\t}\n\t\tconst required = descriptor.type === \"optional\" || descriptor.type === \"default\" ? descriptor.value : descriptor;\n\t\tconst value = yield* suppliedValue(required, raw, \"searchParams\", field.name);\n\t\tif (descriptor.type === \"default\" && sameValue(value, descriptor.default)) continue;\n\t\tconst items = Array.ensure(value);\n\t\tif (items.length === 0 && descriptor.type !== \"optional\" && descriptor.type !== \"default\") return yield* invalid(\"searchParams\", \"A required array cannot serialize as an absent search key.\", field.name);\n\t\tfor (const item of items) query.append(field.name, String(item));\n\t}\n\tconst search = query.toString();\n\tconst hash = navigation.hash === void 0 || navigation.hash === \"\" ? \"\" : `#${yield* encodeComponent(navigation.hash, \"params\")}`;\n\treturn `/${segments.join(\"/\")}${search === \"\" ? \"\" : `?${search}`}${hash}`;\n});\n//#endregion\nexport { InvalidUrl, ParsedLocation, PartialLocation, UrlIssue, buildUrl, decodeRouteInputs, parseLocation };\n\n//# sourceMappingURL=url.js.map","import { getRouteDefinition } from \"./internal/routes.js\";\nimport { Effect, Predicate, Schema } from \"effect\";\nimport { useContext, useEffect, useLayoutEffect, useRef, useState } from \"preact/hooks\";\nimport { buildUrl, compilePatterns, decodeRouteInputs, matchPattern, parseLocation } from \"@ignotum/shared/routing\";\nimport { createContext, createElement } from \"preact\";\n//#region src/versions/1/browser/router.ts\nconst RouterContext = createContext(void 0);\nconst useRouter = () => {\n\tconst router = useContext(RouterContext);\n\tif (router === void 0) throw new Error(\"Ignotum routing hooks require a managed client mount.\");\n\treturn router;\n};\nconst useRouterSnapshot = (router) => {\n\tconst [snapshot, setSnapshot] = useState(router.getSnapshot);\n\tuseLayoutEffect(() => {\n\t\tconst update = () => setSnapshot(router.getSnapshot());\n\t\tconst unsubscribe = router.subscribe(update);\n\t\tupdate();\n\t\treturn unsubscribe;\n\t}, [router]);\n\treturn snapshot;\n};\nfunction url(reference, ...args) {\n\treturn Effect.runSync(buildUrl(getRouteDefinition(reference), args[0]));\n}\nconst destinationHref = (reference, input = {}) => Effect.runSync(buildUrl(getRouteDefinition(reference), {\n\tparams: input.params,\n\tsearchParams: input.searchParams,\n\thash: input.hash\n}));\nconst NavigationInput = Schema.Struct({\n\tparams: Schema.optional(Schema.Unknown),\n\tsearchParams: Schema.optional(Schema.Unknown),\n\thash: Schema.optional(Schema.String),\n\treplace: Schema.optional(Schema.Boolean),\n\tscroll: Schema.optional(Schema.Literals([\"auto\", \"preserve\"]))\n}).annotate({ parseOptions: { onExcessProperty: \"error\" } });\nconst useNavigate = () => {\n\tconst router = useRouter();\n\tconst [navigate] = useState(() => Object.assign((reference, ...args) => {\n\t\tconst options = Schema.decodeUnknownSync(NavigationInput, { onExcessProperty: \"error\" })(args[0] ?? {});\n\t\treturn router.navigate(destinationHref(reference, options), options);\n\t}, {\n\t\tback: router.back,\n\t\tforward: router.forward\n\t}));\n\treturn navigate;\n};\nconst useLocation = () => {\n\tconst snapshot = useRouterSnapshot(useRouter());\n\tif (snapshot.location === void 0) throw new Error(\"The initial Ignotum location has not committed.\");\n\treturn snapshot.location;\n};\nconst useNavigation = () => useRouterSnapshot(useRouter()).navigation;\nconst useBlocker = ({ when }) => {\n\tconst router = useRouter();\n\tconst [id] = useState(() => Symbol(\"blocker\"));\n\tuseRouterSnapshot(router);\n\tuseLayoutEffect(() => {\n\t\trouter.setBlocker(id, when);\n\t}, [\n\t\trouter,\n\t\tid,\n\t\twhen\n\t]);\n\tuseLayoutEffect(() => () => router.setBlocker(id, false), [router, id]);\n\treturn router.getBlocker(id);\n};\nconst matchReference = (reference, snapshot, end) => {\n\tconst location = snapshot.location;\n\tconst outcome = snapshot.branch?.outcome;\n\tif (location === void 0 || outcome === void 0) return;\n\tconst definition = getRouteDefinition(reference);\n\tif (end && (outcome._tag !== \"Matched\" || outcome.route.id !== definition.id)) return;\n\tconst parsed = Effect.runSync(parseLocation(`${location.pathname}${location.search}`).pipe(Effect.result));\n\tif (parsed._tag === \"Failure\") return;\n\tconst compiled = Effect.runSync(compilePatterns([{\n\t\t...definition,\n\t\tlayouts: []\n\t}], []));\n\tfor (let length = parsed.success.segments.length; length >= 0; length--) {\n\t\tif (length === 0 && parsed.success.segments.length !== 0) break;\n\t\tconst match = matchPattern(compiled, parsed.success.segments.slice(0, length));\n\t\tif (match.route !== void 0) {\n\t\t\tconst decoded = Effect.runSync(decodeRouteInputs(definition, match.params, location.search).pipe(Effect.result));\n\t\t\tif (decoded._tag === \"Failure\") return;\n\t\t\treturn {\n\t\t\t\t...decoded.success,\n\t\t\t\thash: location.hash\n\t\t\t};\n\t\t}\n\t\tif (end) break;\n\t}\n};\nfunction useMatch(reference, options) {\n\treturn matchReference(reference, useRouterSnapshot(useRouter()), options?.end ?? true);\n}\nfunction useRoute(reference) {\n\tconst router = useRouter();\n\tconst snapshot = useRouterSnapshot(router);\n\tconst match = matchReference(reference, snapshot, true);\n\tif (match === void 0) throw new Error(`useRoute requires page '${getRouteDefinition(reference).id}' to be active.`);\n\treturn {\n\t\t...match,\n\t\tsetSearchParams: (next, options) => {\n\t\t\tconst latest = matchReference(reference, router.getSnapshot(), true);\n\t\t\tconst location = router.getSnapshot().location;\n\t\t\tif (latest === void 0 || location === void 0) throw new Error(\"Cannot update search parameters for an inactive route.\");\n\t\t\tconst inputs = Predicate.isFunction(next) ? next(latest.searchParams) : next;\n\t\t\tconst href = destinationHref(reference, {\n\t\t\t\tparams: latest.params,\n\t\t\t\tsearchParams: inputs,\n\t\t\t\thash: latest.hash\n\t\t\t});\n\t\t\tconst destination = new URL(href, router.browser.location.origin);\n\t\t\tdestination.pathname = location.pathname;\n\t\t\tconst declared = new Set(getRouteDefinition(reference).searchParams.map((field) => field.name));\n\t\t\tfor (const [name, value] of new URLSearchParams(location.search)) if (!declared.has(name)) destination.searchParams.append(name, value);\n\t\t\treturn router.navigate(`${destination.pathname}${destination.search}${destination.hash}`, {\n\t\t\t\tscroll: \"preserve\",\n\t\t\t\t...options\n\t\t\t});\n\t\t}\n\t};\n}\nconst activePath = (current, destination, end) => {\n\tconst source = Effect.runSync(parseLocation(current).pipe(Effect.result));\n\tconst target = Effect.runSync(parseLocation(destination).pipe(Effect.result));\n\tif (source._tag === \"Failure\" || target._tag === \"Failure\") return false;\n\tconst from = source.success.segments;\n\tconst to = target.success.segments;\n\tif (from.length !== to.length && (end || to.length === 0 || from.length < to.length)) return false;\n\treturn to.every((segment, index) => from[index] === segment);\n};\nfunction Anchor(props) {\n\tconst router = useRouter();\n\tconst snapshot = useRouterSnapshot(router);\n\tconst { to, params, searchParams, hash, replace, scroll, preload = \"intent\", end = true, active = false, class: className, onClick, onMouseEnter, onFocus, ...attributes } = props;\n\tconst href = destinationHref(to, {\n\t\tparams,\n\t\tsearchParams,\n\t\thash\n\t});\n\tconst isActive = active && snapshot.location !== void 0 && activePath(snapshot.location.pathname, href.split(/[?#]/)[0], end);\n\tconst prepare = () => {\n\t\tif (preload !== \"none\") router.preload(href).catch(() => {});\n\t};\n\treturn createElement(\"a\", {\n\t\t...attributes,\n\t\thref,\n\t\tclass: Predicate.isFunction(className) ? className({ isActive }) : className,\n\t\t\"aria-current\": isActive ? \"page\" : attributes[\"aria-current\"],\n\t\tonClick: (event) => {\n\t\t\tonClick?.(event);\n\t\t\tconst anchor = event.currentTarget;\n\t\t\tif (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || anchor.target !== \"\" && anchor.target.toLowerCase() !== \"_self\" || anchor.hasAttribute(\"download\") || anchor.relList.contains(\"external\") || anchor.origin !== router.browser.location.origin || `${anchor.pathname}${anchor.search}${anchor.hash}` !== href) return;\n\t\t\tevent.preventDefault();\n\t\t\trouter.navigate(href, {\n\t\t\t\treplace,\n\t\t\t\tscroll\n\t\t\t});\n\t\t},\n\t\tonMouseEnter: (event) => {\n\t\t\tonMouseEnter?.(event);\n\t\t\tif (!event.defaultPrevented) prepare();\n\t\t},\n\t\tonFocus: (event) => {\n\t\t\tonFocus?.(event);\n\t\t\tif (!event.defaultPrevented) prepare();\n\t\t}\n\t});\n}\nfunction Link(props) {\n\treturn createElement(Anchor, props);\n}\nfunction NavLink(props) {\n\treturn createElement(Anchor, {\n\t\t...props,\n\t\tactive: true\n\t});\n}\nfunction Redirect(props) {\n\tconst router = useRouter();\n\tconst href = destinationHref(props.to, props);\n\tconst previous = useRef();\n\tconst replace = props.replace ?? true;\n\tuseEffect(() => {\n\t\tconst identity = JSON.stringify([\n\t\t\thref,\n\t\t\treplace,\n\t\t\tprops.scroll\n\t\t]);\n\t\tif (previous.current === identity) return;\n\t\tprevious.current = identity;\n\t\trouter.navigate(href, {\n\t\t\treplace,\n\t\t\tscroll: props.scroll\n\t\t}, true);\n\t}, [\n\t\trouter,\n\t\thref,\n\t\treplace,\n\t\tprops.scroll\n\t]);\n\treturn null;\n}\n//#endregion\nexport { Link, NavLink, Redirect, RouterContext, url, useBlocker, useLocation, useMatch, useNavigate, useNavigation, useRoute, useRouterSnapshot };\n\n//# sourceMappingURL=router.js.map"],"mappings":";;;;;;;;;;AAEA,MAAM,cAAc,UAAU;CAC7B,IAAIA,QAAM,QAAQ,KAAK,GAAG,OAAO,IAAI,MAAM,IAAI,UAAU,CAAC,CAAC,KAAK,GAAG,EAAE;CACrE,IAAI,UAAU,QAAQ,UAAU,SAAS,KAAK,KAAK,UAAU,SAAS,KAAK,KAAK,UAAU,UAAU,KAAK,GAAG,OAAO,KAAK,UAAU,KAAK;CACvI,OAAO,IAAIA,QAAM,SAAS,OAAO,QAAQ,KAAK,IAAI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rB,OAAO,SAAS,MAAM;IACrB;IACA;GACD,CAAC;EACF;EACA,eAAe,UAAU;GACxB,eAAe,KAAK;GACpB,IAAI,CAAC,MAAM,kBAAkB,QAAQ;EACtC;EACA,UAAU,UAAU;GACnB,UAAU,KAAK;GACf,IAAI,CAAC,MAAM,kBAAkB,QAAQ;EACtC;CACD,CAAC;AACF;AACA,SAAS,KAAK,OAAO;CACpB,OAAO,cAAc,QAAQ,KAAK;AACnC;AACA,SAAS,QAAQ,OAAO;CACvB,OAAO,cAAc,QAAQ;EAC5B,GAAG;EACH,QAAQ;CACT,CAAC;AACF;AACA,SAAS,SAAS,OAAO;CACxB,MAAM,SAAS,UAAU;CACzB,MAAM,OAAO,gBAAgB,MAAM,IAAI,KAAK;CAC5C,MAAM,WAAW,OAAO;CACxB,MAAM,UAAU,MAAM,WAAW;CACjC,gBAAgB;EACf,MAAM,WAAW,KAAK,UAAU;GAC/B;GACA;GACA,MAAM;EACP,CAAC;EACD,IAAI,SAAS,YAAY,UAAU;EACnC,SAAS,UAAU;EACnB,OAAO,SAAS,MAAM;GACrB;GACA,QAAQ,MAAM;EACf,GAAG,IAAI;CACR,GAAG;EACF;EACA;EACA;EACA,MAAM;CACP,CAAC;CACD,OAAO;AACR"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as GeneratedId } from "./artifact-BB5qzoa6.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as PaginationPageSize, t as PaginationCursor } from "./pagination
|
|
2
|
+
import { B as fileLimits, I as constrainedFileValue, L as fileFormats, M as FileFormat, c as UserId, m as ErrorBrand } from "./id-rzjaCxeF.js";
|
|
3
|
+
import { n as PaginationPageSize, t as PaginationCursor } from "./pagination-CfEleffG.js";
|
|
4
4
|
import { Effect, Function, Predicate, Redacted, Result, Schema, Struct } from "effect";
|
|
5
5
|
//#region ../contracts/dist/descriptor-CTY4mtwS.js
|
|
6
6
|
const ValueEvolutionTypeId = Symbol.for("ignotum/schema/ValueEvolution");
|
|
@@ -713,4 +713,4 @@ function bindSchema(schema, environment = emptyEnv) {
|
|
|
713
713
|
//#endregion
|
|
714
714
|
export { defineSchema as a, getFunctionSchema as c, evolveStoredFields as d, defineEnv as i, Secret as l, bindSchema as n, emptyEnv as o, decodeDefinedEnvironment as r, getFunctionEnvironment as s, SchemaDefinitionTypeId as t, applyValueDefaults as u };
|
|
715
715
|
|
|
716
|
-
//# sourceMappingURL=schema-
|
|
716
|
+
//# sourceMappingURL=schema-JtFb4BbG.js.map
|