@orieljs/framework 0.1.0-alpha.1 → 0.1.0-alpha.3

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/dist/index.js CHANGED
@@ -22,22 +22,47 @@ import {
22
22
  renderToString,
23
23
  styleString,
24
24
  view
25
- } from "./chunk-WI7E7Q46.js";
25
+ } from "./chunk-WEGTH46M.js";
26
26
  import {
27
27
  Application as Application2,
28
28
  ApplicationBuilder,
29
29
  BusFake,
30
30
  ClosureKernel,
31
+ Component,
32
+ Computed,
33
+ CorruptComponentPayloadError,
34
+ ErrorBag,
31
35
  EventFake,
36
+ InvalidLiveRequestError,
37
+ Live,
38
+ LiveComponentManager,
39
+ LiveComponentNotFoundError,
40
+ LiveError,
41
+ LiveServiceProvider,
42
+ Locked,
32
43
  MailFake,
44
+ MethodNotCallableError,
33
45
  NotificationFake,
46
+ On,
47
+ PendingEvent,
48
+ PropertyNotUpdatableError,
34
49
  ProviderBootError,
35
50
  ProviderRegisterError,
36
51
  QueueFake,
37
52
  Repository,
38
53
  StorageFake,
39
- env
40
- } from "./chunk-BZPCRKFQ.js";
54
+ Testable,
55
+ UPDATE_URI,
56
+ Vite,
57
+ ViteError,
58
+ ViteHtml,
59
+ componentName,
60
+ currentVite,
61
+ env,
62
+ live,
63
+ vite,
64
+ viteReactRefresh
65
+ } from "./chunk-I2OMKIQZ.js";
41
66
  import {
42
67
  Arr,
43
68
  BindingResolutionError,
@@ -59,7 +84,7 @@ import {
59
84
  retry,
60
85
  tap,
61
86
  value
62
- } from "./chunk-AI2RFMBT.js";
87
+ } from "./chunk-HU43NADT.js";
63
88
  import {
64
89
  Application,
65
90
  AuthFactory,
@@ -83,6 +108,8 @@ import {
83
108
  Hasher,
84
109
  HttpKernel,
85
110
  HttpRequest,
111
+ InertiaFactory,
112
+ InertiaSsrGateway,
86
113
  LogManager,
87
114
  MailManager,
88
115
  MiddlewareCallbacks,
@@ -101,7 +128,7 @@ import {
101
128
  ValidationFactory,
102
129
  ViewFactory,
103
130
  token
104
- } from "./chunk-K6MAA3RM.js";
131
+ } from "./chunk-S7YC43IH.js";
105
132
 
106
133
  // ../Auth/dist/index.js
107
134
  import { timingSafeEqual } from "crypto";
@@ -2963,7 +2990,7 @@ var NodeConsoleInput = class {
2963
2990
  const line = this.lines.shift();
2964
2991
  if (line !== void 0) return line;
2965
2992
  if (this.ended) throw new Error("Aborted.");
2966
- return new Promise((resolve3, reject) => this.waiting.push({ resolve: resolve3, reject }));
2993
+ return new Promise((resolve4, reject) => this.waiting.push({ resolve: resolve4, reject }));
2967
2994
  }
2968
2995
  close() {
2969
2996
  const rl = this.rl;
@@ -4025,7 +4052,7 @@ var ScheduleWorkCommand = class extends Command {
4025
4052
  description = "Start the schedule worker";
4026
4053
  async handle() {
4027
4054
  const schedule = inject(Schedule);
4028
- const sleep5 = this.workOptions.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
4055
+ const sleep5 = this.workOptions.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
4029
4056
  const clock = this.workOptions.now ?? Date.now;
4030
4057
  this.info("Running scheduled tasks every minute.");
4031
4058
  let lastMinute;
@@ -4058,13 +4085,13 @@ var TestCommand = class extends Command {
4058
4085
  if (typeof filter === "string") args.push("--testNamePattern", filter);
4059
4086
  const extra = this.argument("args");
4060
4087
  if (Array.isArray(extra)) args.push(...extra);
4061
- return new Promise((resolve3) => {
4088
+ return new Promise((resolve4) => {
4062
4089
  const child = this.spawner("npx", args);
4063
4090
  child.on("error", (error) => {
4064
4091
  this.error(error.message);
4065
- resolve3(1);
4092
+ resolve4(1);
4066
4093
  });
4067
- child.on("exit", (code) => resolve3(code ?? 1));
4094
+ child.on("exit", (code) => resolve4(code ?? 1));
4068
4095
  });
4069
4096
  }
4070
4097
  };
@@ -4079,10 +4106,10 @@ var TinkerCommand = class extends Command {
4079
4106
  handle() {
4080
4107
  const app2 = inject(Application);
4081
4108
  const startRepl = this.tinkerOptions.start ?? ((options) => start(options));
4082
- return new Promise((resolve3) => {
4109
+ return new Promise((resolve4) => {
4083
4110
  const repl = startRepl({ prompt: "oriel> " });
4084
4111
  repl.context.app = app2;
4085
- repl.on("exit", () => resolve3(0));
4112
+ repl.on("exit", () => resolve4(0));
4086
4113
  });
4087
4114
  }
4088
4115
  };
@@ -6704,14 +6731,14 @@ var SchemaGrammar = class {
6704
6731
  compile(blueprint) {
6705
6732
  const statements = [];
6706
6733
  const commands = [...blueprint.commands, ...blueprint.fluentIndexCommands()];
6707
- const handled = /* @__PURE__ */ new Set();
6734
+ const handled2 = /* @__PURE__ */ new Set();
6708
6735
  if (blueprint.creating) {
6709
- statements.push(this.compileCreate(blueprint, commands, handled));
6736
+ statements.push(this.compileCreate(blueprint, commands, handled2));
6710
6737
  } else if (blueprint.columns.length) {
6711
- statements.push(...this.compileAdd(blueprint, commands, handled));
6738
+ statements.push(...this.compileAdd(blueprint, commands, handled2));
6712
6739
  }
6713
6740
  for (const command of commands) {
6714
- if (command.name === "create" || handled.has(command)) continue;
6741
+ if (command.name === "create" || handled2.has(command)) continue;
6715
6742
  statements.push(...this.compileCommand(blueprint, command));
6716
6743
  }
6717
6744
  if (blueprint.creating || blueprint.columns.length) statements.push(...this.compileComments(blueprint));
@@ -6826,21 +6853,21 @@ var present = (parts) => parts.filter((part) => part !== void 0);
6826
6853
  var SqliteSchemaGrammar = class extends SchemaGrammar {
6827
6854
  driver = "sqlite";
6828
6855
  /** SQLite can't add keys to an existing table, so primary and foreign keys go inside create table. */
6829
- compileCreate(blueprint, commands, handled) {
6856
+ compileCreate(blueprint, commands, handled2) {
6830
6857
  const parts = blueprint.columns.map((column) => this.columnDefinition(column));
6831
6858
  for (const command of commands) {
6832
6859
  if (command.name === "primary") {
6833
6860
  parts.push(sql4`primary key (${columnList(command.columns)})`);
6834
- handled.add(command);
6861
+ handled2.add(command);
6835
6862
  } else if (command.name === "foreign") {
6836
6863
  parts.push(this.foreignKeyClause(command.foreign));
6837
- handled.add(command);
6864
+ handled2.add(command);
6838
6865
  }
6839
6866
  }
6840
6867
  return sql4`create table ${sql4.id(blueprint.table)} (${join23(parts)})`;
6841
6868
  }
6842
6869
  /** New columns may carry an inline `references` clause (the only foreign key SQLite can add later). */
6843
- compileAdd(blueprint, commands, handled) {
6870
+ compileAdd(blueprint, commands, handled2) {
6844
6871
  return blueprint.columns.map((column) => {
6845
6872
  const foreign = commands.find(
6846
6873
  (command) => command.name === "foreign" && command.foreign.columns.length === 1 && command.foreign.columns[0] === column.name
@@ -6848,7 +6875,7 @@ var SqliteSchemaGrammar = class extends SchemaGrammar {
6848
6875
  let definition = this.columnDefinition(column);
6849
6876
  if (foreign) {
6850
6877
  definition = sql4`${definition} ${this.referencesClause(foreign.foreign)}`;
6851
- handled.add(foreign);
6878
+ handled2.add(foreign);
6852
6879
  }
6853
6880
  return sql4`alter table ${sql4.id(blueprint.table)} add column ${definition}`;
6854
6881
  });
@@ -7033,10 +7060,10 @@ var PostgresSchemaGrammar = class extends SchemaGrammar {
7033
7060
  };
7034
7061
  var MySqlSchemaGrammar = class extends SchemaGrammar {
7035
7062
  driver = "mysql";
7036
- compileCreate(blueprint, commands, handled) {
7063
+ compileCreate(blueprint, commands, handled2) {
7037
7064
  const charset = this.config.charset ?? "utf8mb4";
7038
7065
  const collation = this.config.collation ?? "utf8mb4_unicode_ci";
7039
- return sql4`${super.compileCreate(blueprint, commands, handled)} default character set ${sql4.raw(charset.replace(/[^\w]/g, ""))} collate ${sql4.lit(collation)}`;
7066
+ return sql4`${super.compileCreate(blueprint, commands, handled2)} default character set ${sql4.raw(charset.replace(/[^\w]/g, ""))} collate ${sql4.lit(collation)}`;
7040
7067
  }
7041
7068
  compileAdd(blueprint) {
7042
7069
  return blueprint.columns.map((column) => sql4`alter table ${sql4.id(blueprint.table)} add ${this.columnDefinition(column)}`);
@@ -12659,8 +12686,12 @@ import { basename as basename2 } from "path";
12659
12686
  import { Readable as Readable2 } from "stream";
12660
12687
  import { readFile as readFile4 } from "fs/promises";
12661
12688
  import { fileURLToPath } from "url";
12662
- import { createServer } from "http";
12689
+ import { createReadStream as createReadStream22 } from "fs";
12690
+ import { stat as stat22 } from "fs/promises";
12663
12691
  import { Readable as Readable22 } from "stream";
12692
+ import { relative as relative5, resolve as resolve3, sep as sep4 } from "path";
12693
+ import { createServer } from "http";
12694
+ import { Readable as Readable3 } from "stream";
12664
12695
  import { pipeline as pipeline2 } from "stream/promises";
12665
12696
  import { existsSync as existsSync7 } from "fs";
12666
12697
  import { mkdir as mkdir5, readFile as readFile22, writeFile as writeFile6 } from "fs/promises";
@@ -12855,13 +12886,16 @@ var TYPES = {
12855
12886
  ico: "image/vnd.microsoft.icon",
12856
12887
  jpg: "image/jpeg",
12857
12888
  js: "text/javascript",
12889
+ map: "application/json",
12858
12890
  json: "application/json",
12859
12891
  md: "text/markdown",
12860
12892
  mp3: "audio/mpeg",
12861
12893
  mp4: "video/mp4",
12894
+ otf: "font/otf",
12862
12895
  pdf: "application/pdf",
12863
12896
  png: "image/png",
12864
12897
  svg: "image/svg+xml",
12898
+ ttf: "font/ttf",
12865
12899
  txt: "text/plain",
12866
12900
  wasm: "application/wasm",
12867
12901
  webm: "video/webm",
@@ -13984,6 +14018,33 @@ function applyExceptionCallbacks(app2, handler3) {
13984
14018
  const configurator = new ExceptionsConfiguration(handler3);
13985
14019
  for (const callback of app2.make(ExceptionCallbacks)) callback(configurator);
13986
14020
  }
14021
+ var HIDDEN_SEGMENT = /^\.|\.(ts|tsx|mts|cts)$|[. ]$/i;
14022
+ async function servePublicFile(publicPath, request2) {
14023
+ if (request2.method !== "GET" && request2.method !== "HEAD") return void 0;
14024
+ let pathname;
14025
+ try {
14026
+ pathname = decodeURIComponent(new URL(request2.url).pathname);
14027
+ } catch {
14028
+ return void 0;
14029
+ }
14030
+ if (pathname === "/" || pathname.includes("\0")) return void 0;
14031
+ const root = resolve3(publicPath);
14032
+ const file = resolve3(root, `.${pathname}`);
14033
+ if (!file.startsWith(root + sep4)) return void 0;
14034
+ if (relative5(root, file).split(/[\\/]/).some((segment) => HIDDEN_SEGMENT.test(segment))) return void 0;
14035
+ const info = await stat22(file).catch(() => void 0);
14036
+ if (info === void 0 || !info.isFile()) return void 0;
14037
+ const type = mimeFromExtension2(file);
14038
+ const headers = new Headers({
14039
+ "content-type": type.startsWith("text/") || type === "application/json" ? `${type}; charset=utf-8` : type,
14040
+ "content-length": String(info.size),
14041
+ "last-modified": info.mtime.toUTCString()
14042
+ });
14043
+ if (pathname.startsWith("/build/assets/")) headers.set("cache-control", "public, max-age=31536000, immutable");
14044
+ if (request2.method === "HEAD") return new Response(null, { status: 200, headers });
14045
+ const body = Readable22.toWeb(createReadStream22(file));
14046
+ return new Response(body, { status: 200, headers });
14047
+ }
13987
14048
  async function terminateRequest(app2, request2, response2) {
13988
14049
  try {
13989
14050
  if (app2.bound(HttpKernel)) await app2.make(HttpKernel).terminate?.(request2, response2);
@@ -13991,8 +14052,12 @@ async function terminateRequest(app2, request2, response2) {
13991
14052
  console.error(error);
13992
14053
  }
13993
14054
  }
13994
- async function handleSafely(app2, request2) {
14055
+ async function handleSafely(app2, request2, publicPath) {
13995
14056
  try {
14057
+ if (publicPath !== void 0) {
14058
+ const file = await servePublicFile(publicPath, request2);
14059
+ if (file !== void 0) return file;
14060
+ }
13996
14061
  return await app2.handle(request2);
13997
14062
  } catch (error) {
13998
14063
  console.error(error);
@@ -14018,13 +14083,13 @@ async function serveBun(app2, options) {
14018
14083
  const bun = bunRuntime();
14019
14084
  if (bun === void 0) throw new HttpServerError("Bun.serve is not available: the process is not running on Bun.");
14020
14085
  let markClosed = () => void 0;
14021
- const closed = new Promise((resolve3) => markClosed = resolve3);
14086
+ const closed = new Promise((resolve22) => markClosed = resolve22);
14022
14087
  const server = bun.serve({
14023
14088
  port: options.port,
14024
14089
  hostname: options.hostname,
14025
14090
  async fetch(request2, current) {
14026
14091
  setClientAddress(request2, current.requestIP(request2)?.address);
14027
- const response2 = await handleSafely(app2, request2);
14092
+ const response2 = await handleSafely(app2, request2, options.publicPath);
14028
14093
  setTimeout(() => void terminateRequest(app2, request2, response2), 0);
14029
14094
  return response2;
14030
14095
  },
@@ -14036,8 +14101,8 @@ async function serveBun(app2, options) {
14036
14101
  let closing;
14037
14102
  const close = () => closing ??= (async () => {
14038
14103
  let timer;
14039
- const forced = new Promise((resolve3) => {
14040
- timer = setTimeout(() => void Promise.resolve(server.stop(true)).then(resolve3), options.shutdownTimeout);
14104
+ const forced = new Promise((resolve22) => {
14105
+ timer = setTimeout(() => void Promise.resolve(server.stop(true)).then(resolve22), options.shutdownTimeout);
14041
14106
  });
14042
14107
  await Promise.race([Promise.resolve(server.stop(false)), forced]);
14043
14108
  clearTimeout(timer);
@@ -14133,7 +14198,7 @@ async function writeResponse(res, response2) {
14133
14198
  res.end();
14134
14199
  return;
14135
14200
  }
14136
- await pipeline2(Readable22.fromWeb(response2.body), res);
14201
+ await pipeline2(Readable3.fromWeb(response2.body), res);
14137
14202
  }
14138
14203
  async function serveNode(app2, options) {
14139
14204
  const fallbackHost = `${displayHost(options.hostname)}:${options.port}`;
@@ -14148,7 +14213,7 @@ async function serveNode(app2, options) {
14148
14213
  return;
14149
14214
  }
14150
14215
  setClientAddress(request2, req.socket.remoteAddress);
14151
- const response2 = await handleSafely(app2, request2);
14216
+ const response2 = await handleSafely(app2, request2, options.publicPath);
14152
14217
  try {
14153
14218
  await writeResponse(res, response2);
14154
14219
  } catch {
@@ -14157,18 +14222,18 @@ async function serveNode(app2, options) {
14157
14222
  await terminateRequest(app2, request2, response2);
14158
14223
  })();
14159
14224
  });
14160
- await new Promise((resolve3, reject) => {
14225
+ await new Promise((resolve22, reject) => {
14161
14226
  server.once("error", reject);
14162
14227
  server.listen(options.port, options.hostname, () => {
14163
14228
  server.off("error", reject);
14164
- resolve3();
14229
+ resolve22();
14165
14230
  });
14166
14231
  });
14167
14232
  const address = server.address();
14168
- const closed = new Promise((resolve3) => server.once("close", () => resolve3()));
14233
+ const closed = new Promise((resolve22) => server.once("close", () => resolve22()));
14169
14234
  let closing;
14170
14235
  const close = () => closing ??= (async () => {
14171
- const done = new Promise((resolve3) => server.close(() => resolve3()));
14236
+ const done = new Promise((resolve22) => server.close(() => resolve22()));
14172
14237
  server.closeIdleConnections();
14173
14238
  const idle = setInterval(() => server.closeIdleConnections(), 50);
14174
14239
  const force = setTimeout(() => server.closeAllConnections(), options.shutdownTimeout);
@@ -14194,7 +14259,8 @@ async function serve(app2, options = {}) {
14194
14259
  port: options.port ?? Number(process.env.PORT ?? process.env.SERVER_PORT ?? 8e3),
14195
14260
  hostname: options.hostname ?? "127.0.0.1",
14196
14261
  signals: options.signals ?? true,
14197
- shutdownTimeout: options.shutdownTimeout ?? 1e4
14262
+ shutdownTimeout: options.shutdownTimeout ?? 1e4,
14263
+ ...options.publicPath !== false && { publicPath: options.publicPath ?? app2.publicPath() }
14198
14264
  };
14199
14265
  await app2.boot();
14200
14266
  const runtime = options.runtime ?? detectRuntime();
@@ -14234,12 +14300,12 @@ function routeListRows(routes) {
14234
14300
  return rows.sort((a, b) => a.uri < b.uri ? -1 : a.uri > b.uri ? 1 : 0);
14235
14301
  }
14236
14302
  function filterRouteList(rows, filters) {
14237
- const excluded = (filters.exceptPath ?? "").split(",").filter((path) => path !== "");
14303
+ const excluded2 = (filters.exceptPath ?? "").split(",").filter((path) => path !== "");
14238
14304
  return rows.filter((row) => {
14239
14305
  if (filters.name !== void 0 && !(row.name ?? "").includes(filters.name)) return false;
14240
14306
  if (filters.path !== void 0 && !row.uri.includes(filters.path)) return false;
14241
14307
  if (filters.method !== void 0 && !row.method.includes(filters.method.toUpperCase())) return false;
14242
- return !excluded.some((path) => row.uri.includes(path));
14308
+ return !excluded2.some((path) => row.uri.includes(path));
14243
14309
  });
14244
14310
  }
14245
14311
  function formatRouteList(rows, width) {
@@ -14386,10 +14452,1295 @@ var HttpServiceProvider = class extends ServiceProvider {
14386
14452
  }
14387
14453
  };
14388
14454
 
14455
+ // ../Inertia/dist/index.js
14456
+ import { existsSync as existsSync8 } from "fs";
14457
+ import { join as join10 } from "path";
14458
+ import { createHash as createHash5 } from "crypto";
14459
+ import { existsSync as existsSync23, readFileSync } from "fs";
14460
+ import { spawn as spawn2 } from "child_process";
14461
+ import { existsSync as existsSync33 } from "fs";
14462
+ import { mkdir as mkdir6, writeFile as writeFile7 } from "fs/promises";
14463
+ import { dirname as dirname6, isAbsolute as isAbsolute2, join as join24, relative as relative6 } from "path";
14464
+ import { existsSync as existsSync42, readFileSync as readFileSync2 } from "fs";
14465
+ var Header = {
14466
+ INERTIA: "X-Inertia",
14467
+ ERROR_BAG: "X-Inertia-Error-Bag",
14468
+ LOCATION: "X-Inertia-Location",
14469
+ REDIRECT: "X-Inertia-Redirect",
14470
+ VERSION: "X-Inertia-Version",
14471
+ PARTIAL_COMPONENT: "X-Inertia-Partial-Component",
14472
+ PARTIAL_ONLY: "X-Inertia-Partial-Data",
14473
+ PARTIAL_EXCEPT: "X-Inertia-Partial-Except",
14474
+ RESET: "X-Inertia-Reset",
14475
+ INFINITE_SCROLL_MERGE_INTENT: "X-Inertia-Infinite-Scroll-Merge-Intent",
14476
+ EXCEPT_ONCE_PROPS: "X-Inertia-Except-Once-Props"
14477
+ };
14478
+ function parseList(value2) {
14479
+ const items = (value2 ?? "").split(",").filter((item) => item !== "");
14480
+ return items.length === 0 ? void 0 : items;
14481
+ }
14482
+ var Prop = class {
14483
+ constructor(value2) {
14484
+ this.value = value2;
14485
+ }
14486
+ value;
14487
+ mergeState = { merge: false, deep: false, append: true, appendPaths: [], prependPaths: [], matchOn: [] };
14488
+ onceState = { once: false, fresh: false, key: void 0, ttlSeconds: void 0 };
14489
+ deferred = false;
14490
+ deferGroup;
14491
+ /** Calls the callback, if the value is one. */
14492
+ async resolve() {
14493
+ return typeof this.value === "function" ? await this.value() : this.value;
14494
+ }
14495
+ /** Never sent on the first load (OptionalProp, DeferProp). */
14496
+ ignoresFirstLoad() {
14497
+ return false;
14498
+ }
14499
+ /** Sent even when a partial reload didn't ask for it (AlwaysProp). */
14500
+ isAlways() {
14501
+ return false;
14502
+ }
14503
+ /** Errors are reported and the prop is left out, instead of failing the page (defer(..., { rescue: true })). */
14504
+ shouldRescue() {
14505
+ return false;
14506
+ }
14507
+ // Once (honoured by OptionalProp, DeferProp, MergeProp and OnceProp) ------------------------------------
14508
+ /** once(), once(false), once(true, { as: 'key', until: 3600 }). */
14509
+ once(value2 = true, options = {}) {
14510
+ this.onceState.once = value2;
14511
+ if (options.as !== void 0) this.onceState.key = options.as;
14512
+ if (options.until !== void 0) this.onceState.ttlSeconds = secondsUntil(options.until);
14513
+ return this;
14514
+ }
14515
+ /** A custom once key, so pages can share the prop under different names. */
14516
+ as(key) {
14517
+ this.onceState.key = key;
14518
+ return this;
14519
+ }
14520
+ /** Send the prop again even though the client already has it. */
14521
+ fresh(value2 = true) {
14522
+ this.onceState.fresh = value2;
14523
+ return this;
14524
+ }
14525
+ /** Expire after a number of seconds, or at a Date. */
14526
+ until(delay) {
14527
+ this.onceState.ttlSeconds = secondsUntil(delay);
14528
+ return this;
14529
+ }
14530
+ // Merging -------------------------------------------------------------------------------------------------
14531
+ isMergeable() {
14532
+ return false;
14533
+ }
14534
+ shouldMerge() {
14535
+ return this.isMergeable() && this.mergeState.merge;
14536
+ }
14537
+ shouldDeepMerge() {
14538
+ return this.mergeState.deep;
14539
+ }
14540
+ matchesOn() {
14541
+ return [...this.mergeState.matchOn];
14542
+ }
14543
+ appendsAtRoot() {
14544
+ return this.mergeState.append && this.mergesAtRoot();
14545
+ }
14546
+ prependsAtRoot() {
14547
+ return !this.mergeState.append && this.mergesAtRoot();
14548
+ }
14549
+ appendsAtPaths() {
14550
+ return [...this.mergeState.appendPaths];
14551
+ }
14552
+ prependsAtPaths() {
14553
+ return [...this.mergeState.prependPaths];
14554
+ }
14555
+ mergesAtRoot() {
14556
+ return this.mergeState.appendPaths.length === 0 && this.mergeState.prependPaths.length === 0;
14557
+ }
14558
+ // Deferring -----------------------------------------------------------------------------------------------
14559
+ isDeferrable() {
14560
+ return false;
14561
+ }
14562
+ shouldDefer() {
14563
+ return this.isDeferrable() && this.deferred;
14564
+ }
14565
+ group() {
14566
+ return this.deferGroup ?? "default";
14567
+ }
14568
+ // Once ----------------------------------------------------------------------------------------------------
14569
+ isOnceable() {
14570
+ return false;
14571
+ }
14572
+ shouldResolveOnce() {
14573
+ return this.isOnceable() && this.onceState.once;
14574
+ }
14575
+ shouldBeRefreshed() {
14576
+ return this.onceState.fresh;
14577
+ }
14578
+ getKey() {
14579
+ return this.onceState.key;
14580
+ }
14581
+ /** Epoch milliseconds, or null when the prop never expires. */
14582
+ expiresAt() {
14583
+ return this.onceState.ttlSeconds === void 0 ? null : (Math.floor(Date.now() / 1e3) + this.onceState.ttlSeconds) * 1e3;
14584
+ }
14585
+ };
14586
+ var MergeableProp = class extends Prop {
14587
+ isMergeable() {
14588
+ return true;
14589
+ }
14590
+ merge() {
14591
+ this.mergeState.merge = true;
14592
+ return this;
14593
+ }
14594
+ deepMerge() {
14595
+ this.mergeState.deep = true;
14596
+ return this.merge();
14597
+ }
14598
+ /** Match array items on these keys instead of appending duplicates: matchOn('id'). */
14599
+ matchOn(keys) {
14600
+ this.mergeState.matchOn = [keys].flat();
14601
+ return this;
14602
+ }
14603
+ /** append() at the root, append('data') at a path, append('data', 'id') with a match key, or a map of both. */
14604
+ append(path = true, matchOn) {
14605
+ return this.#place("append", path, matchOn);
14606
+ }
14607
+ prepend(path = true, matchOn) {
14608
+ return this.#place("prepend", path, matchOn);
14609
+ }
14610
+ #place(side, path, matchOn) {
14611
+ if (typeof path === "boolean") {
14612
+ this.mergeState.append = side === "append" ? path : !path;
14613
+ return this;
14614
+ }
14615
+ if (Array.isArray(path)) {
14616
+ for (const entry of path) this.#place(side, entry);
14617
+ return this;
14618
+ }
14619
+ if (typeof path === "object") {
14620
+ for (const [entry, key] of Object.entries(path)) this.#place(side, entry, key);
14621
+ return this;
14622
+ }
14623
+ ;
14624
+ (side === "append" ? this.mergeState.appendPaths : this.mergeState.prependPaths).push(path);
14625
+ if (matchOn !== void 0 && matchOn !== "") this.mergeState.matchOn = [...this.mergeState.matchOn, `${path}.${matchOn}`];
14626
+ return this;
14627
+ }
14628
+ };
14629
+ function secondsUntil(delay) {
14630
+ return delay instanceof Date ? Math.max(0, Math.round((delay.getTime() - Date.now()) / 1e3)) : delay;
14631
+ }
14632
+ var AlwaysProp = class extends Prop {
14633
+ kind = "always";
14634
+ isAlways() {
14635
+ return true;
14636
+ }
14637
+ };
14638
+ var OptionalProp = class extends Prop {
14639
+ kind = "optional";
14640
+ constructor(callback) {
14641
+ super(callback);
14642
+ }
14643
+ ignoresFirstLoad() {
14644
+ return true;
14645
+ }
14646
+ isOnceable() {
14647
+ return true;
14648
+ }
14649
+ };
14650
+ var DeferProp = class extends MergeableProp {
14651
+ kind = "defer";
14652
+ #rescue;
14653
+ constructor(callback, group, options = {}) {
14654
+ super(callback);
14655
+ this.deferred = true;
14656
+ this.deferGroup = group;
14657
+ this.#rescue = options.rescue ?? false;
14658
+ }
14659
+ ignoresFirstLoad() {
14660
+ return true;
14661
+ }
14662
+ isDeferrable() {
14663
+ return true;
14664
+ }
14665
+ isOnceable() {
14666
+ return true;
14667
+ }
14668
+ shouldRescue() {
14669
+ return this.#rescue;
14670
+ }
14671
+ };
14672
+ var MergeProp = class extends MergeableProp {
14673
+ kind = "merge";
14674
+ constructor(value2) {
14675
+ super(value2);
14676
+ this.mergeState.merge = true;
14677
+ }
14678
+ isOnceable() {
14679
+ return true;
14680
+ }
14681
+ };
14682
+ var OnceProp = class extends Prop {
14683
+ kind = "once";
14684
+ constructor(callback) {
14685
+ super(callback);
14686
+ this.onceState.once = true;
14687
+ }
14688
+ isOnceable() {
14689
+ return true;
14690
+ }
14691
+ };
14692
+ var isCursorPaginator = (value2) => typeof value2 === "object" && value2 !== null && typeof value2.getCursorName === "function";
14693
+ var isPagedPaginator = (value2) => typeof value2 === "object" && value2 !== null && typeof value2.getPageName === "function" && typeof value2.currentPage === "function" && typeof value2.hasMorePages === "function";
14694
+ function scrollMetadataFrom(value2) {
14695
+ if (isCursorPaginator(value2)) {
14696
+ const current = value2.cursor();
14697
+ return {
14698
+ pageName: value2.getCursorName(),
14699
+ previousPage: value2.previousCursor()?.encode() ?? null,
14700
+ nextPage: value2.nextCursor()?.encode() ?? null,
14701
+ currentPage: current === void 0 ? 1 : current.encode()
14702
+ };
14703
+ }
14704
+ if (isPagedPaginator(value2)) {
14705
+ const current = value2.currentPage();
14706
+ return {
14707
+ pageName: value2.getPageName(),
14708
+ previousPage: current > 1 ? current - 1 : null,
14709
+ nextPage: value2.hasMorePages() ? current + 1 : null,
14710
+ currentPage: current
14711
+ };
14712
+ }
14713
+ throw new TypeError("The given value is not a paginator. Pass a metadata callback to Inertia.scroll().");
14714
+ }
14715
+ var ScrollProp = class extends MergeableProp {
14716
+ constructor(value2, wrapper = "data", metadataResolver) {
14717
+ super(value2);
14718
+ this.wrapper = wrapper;
14719
+ this.metadataResolver = metadataResolver;
14720
+ this.mergeState.merge = true;
14721
+ }
14722
+ wrapper;
14723
+ metadataResolver;
14724
+ kind = "scroll";
14725
+ #resolved;
14726
+ isDeferrable() {
14727
+ return true;
14728
+ }
14729
+ /** Load the prop after the first render, like a deferred prop. */
14730
+ defer(group) {
14731
+ this.deferred = true;
14732
+ this.deferGroup = group;
14733
+ return this;
14734
+ }
14735
+ /** 'prepend' from the X-Inertia-Infinite-Scroll-Merge-Intent header prepends the wrapper; anything else appends. */
14736
+ configureMergeIntent(intent) {
14737
+ return intent === "prepend" ? this.prepend(this.wrapper) : this.append(this.wrapper);
14738
+ }
14739
+ /** Resolves once and caches, because both the value and its metadata need it. */
14740
+ async resolve() {
14741
+ this.#resolved ??= { value: await super.resolve() };
14742
+ return this.#resolved.value;
14743
+ }
14744
+ async metadata() {
14745
+ const value2 = await this.resolve();
14746
+ return this.metadataResolver === void 0 ? scrollMetadataFrom(value2) : this.metadataResolver(value2);
14747
+ }
14748
+ };
14749
+ var isProp = (value2) => value2 instanceof Prop;
14750
+ var isContainer = (value2) => {
14751
+ if (Array.isArray(value2)) return true;
14752
+ if (typeof value2 !== "object" || value2 === null) return false;
14753
+ const prototype = Object.getPrototypeOf(value2);
14754
+ return prototype === Object.prototype || prototype === null;
14755
+ };
14756
+ var entriesOf = (value2) => Array.isArray(value2) ? value2.map((item, index) => [String(index), item]) : Object.entries(value2);
14757
+ var PropsResolver = class {
14758
+ constructor(request2, component, options = {}) {
14759
+ this.options = options;
14760
+ this.#isPartial = request2.header(Header.PARTIAL_COMPONENT) === component;
14761
+ const inertia2 = request2.header(Header.INERTIA);
14762
+ this.#isInertia = inertia2 !== void 0 && inertia2 !== "" && inertia2 !== "false";
14763
+ this.#only = parseList(request2.header(Header.PARTIAL_ONLY));
14764
+ this.#except = parseList(request2.header(Header.PARTIAL_EXCEPT));
14765
+ this.#reset = parseList(request2.header(Header.RESET)) ?? [];
14766
+ this.#loadedOnce = parseList(request2.header(Header.EXCEPT_ONCE_PROPS)) ?? [];
14767
+ this.#mergeIntent = request2.header(Header.INFINITE_SCROLL_MERGE_INTENT);
14768
+ }
14769
+ options;
14770
+ #isPartial;
14771
+ #isInertia;
14772
+ #only;
14773
+ #except;
14774
+ #reset;
14775
+ #loadedOnce;
14776
+ #mergeIntent;
14777
+ #deferred = {};
14778
+ #rescued = [];
14779
+ #merge = [];
14780
+ #prepend = [];
14781
+ #deepMerge = [];
14782
+ #matchOn = [];
14783
+ #scroll = {};
14784
+ #once = {};
14785
+ #observed = /* @__PURE__ */ new WeakSet();
14786
+ #sharedKeys = [];
14787
+ async resolve(shared2, props) {
14788
+ if (this.options.exposeSharedPropKeys ?? true) {
14789
+ this.#sharedKeys = [...new Set(Object.keys(shared2).map((key) => key.split(".")[0]))];
14790
+ }
14791
+ this.#observePromises(shared2);
14792
+ this.#observePromises(props);
14793
+ const merged = await this.#unpackDotProps({ ...shared2, ...props });
14794
+ const resolved = await this.#resolveProps(merged, "", false);
14795
+ return { props: resolved, metadata: this.#metadata() };
14796
+ }
14797
+ #metadata() {
14798
+ const metadata = {};
14799
+ if (this.#sharedKeys.length > 0) metadata.sharedProps = this.#sharedKeys;
14800
+ if (this.#merge.length > 0) metadata.mergeProps = this.#merge;
14801
+ if (this.#prepend.length > 0) metadata.prependProps = this.#prepend;
14802
+ if (this.#deepMerge.length > 0) metadata.deepMergeProps = this.#deepMerge;
14803
+ if (this.#matchOn.length > 0) metadata.matchPropsOn = this.#matchOn;
14804
+ if (Object.keys(this.#deferred).length > 0) metadata.deferredProps = this.#deferred;
14805
+ if (this.#rescued.length > 0) metadata.rescuedProps = this.#rescued;
14806
+ if (Object.keys(this.#scroll).length > 0) metadata.scrollProps = this.#scroll;
14807
+ if (Object.keys(this.#once).length > 0) metadata.onceProps = this.#once;
14808
+ return metadata;
14809
+ }
14810
+ /**
14811
+ * Marks every raw Promise in a container tree as handled. A promise the walk never awaits (filtered out by a
14812
+ * partial reload, or after a prop that threw) would otherwise reject unobserved and could end the process.
14813
+ * Awaiting the original promise still throws its error where it is used.
14814
+ */
14815
+ #observePromises(value2) {
14816
+ if (value2 instanceof Promise) {
14817
+ value2.catch(() => void 0);
14818
+ return;
14819
+ }
14820
+ if (!isContainer(value2) || this.#observed.has(value2)) return;
14821
+ this.#observed.add(value2);
14822
+ for (const [, child] of entriesOf(value2)) this.#observePromises(child);
14823
+ }
14824
+ async #resolveProps(props, prefix, parentWasResolved) {
14825
+ this.#observePromises(props);
14826
+ const result = Array.isArray(props) ? [] : {};
14827
+ for (const [key, original] of entriesOf(props)) {
14828
+ const path = prefix === "" ? key : `${prefix}.${key}`;
14829
+ let prop = original;
14830
+ if (!this.#shouldIncludeInPartialResponse(prop, path, parentWasResolved)) continue;
14831
+ if (!this.#isPartial && this.#excludeFromInitialResponse(prop, path)) continue;
14832
+ let value2 = await this.#resolveValue(prop, path);
14833
+ if (this.#rescued.includes(path)) continue;
14834
+ if (value2 !== prop && isProp(value2)) {
14835
+ prop = value2;
14836
+ if (!this.#isPartial && this.#excludeFromInitialResponse(prop, path)) continue;
14837
+ value2 = await this.#resolveValue(prop, path);
14838
+ if (this.#rescued.includes(path)) continue;
14839
+ }
14840
+ await this.#collectMetadata(prop, path);
14841
+ const child = isContainer(value2) ? await this.#resolveProps(value2, path, parentWasResolved || !isContainer(prop)) : value2;
14842
+ if (Array.isArray(result)) result.push(child);
14843
+ else result[key] = child;
14844
+ }
14845
+ return result;
14846
+ }
14847
+ #shouldIncludeInPartialResponse(prop, path, parentWasResolved) {
14848
+ if (!this.#isPartial || parentWasResolved || isProp(prop) && prop.isAlways()) return true;
14849
+ if (this.#only !== void 0 && !this.#matchesOnly(path) && !this.#leadsToOnly(path)) return false;
14850
+ if (this.#except !== void 0 && this.#matchesExcept(path)) return false;
14851
+ return true;
14852
+ }
14853
+ #excludeFromInitialResponse(prop, path) {
14854
+ if (!isProp(prop)) return false;
14855
+ if (prop.ignoresFirstLoad()) {
14856
+ if (prop.shouldDefer() && !this.#wasAlreadyLoadedByClient(prop, path)) this.#collectDeferred(path, prop);
14857
+ if (prop.shouldMerge()) this.#collectMerge(path, prop);
14858
+ if (prop.shouldResolveOnce()) this.#collectOnce(path, prop);
14859
+ return true;
14860
+ }
14861
+ if (prop.shouldDefer()) {
14862
+ this.#collectDeferred(path, prop);
14863
+ if (prop.shouldMerge()) this.#collectMerge(path, prop);
14864
+ return true;
14865
+ }
14866
+ if (this.#isInertia && this.#wasAlreadyLoadedByClient(prop, path)) {
14867
+ this.#collectOnce(path, prop);
14868
+ return true;
14869
+ }
14870
+ return false;
14871
+ }
14872
+ #wasAlreadyLoadedByClient(prop, path) {
14873
+ return prop.shouldResolveOnce() && !prop.shouldBeRefreshed() && this.#loadedOnce.includes(prop.getKey() ?? path);
14874
+ }
14875
+ /** Callbacks and prop types run; objects with toJSON() (models, collections, paginators, dates) serialize. */
14876
+ async #resolveValue(value2, path) {
14877
+ if (value2 instanceof ScrollProp) value2.configureMergeIntent(this.#mergeIntent);
14878
+ const rescue = isProp(value2) && value2.shouldRescue();
14879
+ try {
14880
+ let resolved = value2;
14881
+ if (isProp(resolved)) resolved = await resolved.resolve();
14882
+ else if (typeof resolved === "function") resolved = await resolved();
14883
+ else if (resolved instanceof Promise) resolved = await resolved;
14884
+ if (!isProp(resolved) && typeof resolved === "object" && resolved !== null && !Array.isArray(resolved)) {
14885
+ const serializable = resolved;
14886
+ if (typeof serializable.toJSON === "function") resolved = serializable.toJSON();
14887
+ }
14888
+ return resolved;
14889
+ } catch (error) {
14890
+ if (!rescue) throw error;
14891
+ await this.options.report?.(error);
14892
+ this.#rescued.push(path);
14893
+ return null;
14894
+ }
14895
+ }
14896
+ async #collectMetadata(prop, path) {
14897
+ if (!isProp(prop)) return;
14898
+ if (prop.shouldMerge()) this.#collectMerge(path, prop);
14899
+ if (prop instanceof ScrollProp) this.#scroll[path] = { ...await prop.metadata(), reset: this.#reset.includes(path) };
14900
+ if (prop.shouldResolveOnce()) this.#collectOnce(path, prop);
14901
+ }
14902
+ #collectDeferred(path, prop) {
14903
+ ;
14904
+ (this.#deferred[prop.group()] ??= []).push(path);
14905
+ }
14906
+ #collectMerge(path, prop) {
14907
+ if (this.#reset.includes(path)) return;
14908
+ if (this.#isPartial && !this.#isIncludedInPartialMetadata(path)) return;
14909
+ if (prop.shouldDeepMerge()) this.#deepMerge.push(path);
14910
+ else if (prop.appendsAtRoot()) this.#merge.push(path);
14911
+ else if (prop.prependsAtRoot()) this.#prepend.push(path);
14912
+ else {
14913
+ for (const append of prop.appendsAtPaths()) this.#merge.push(`${path}.${append}`);
14914
+ for (const prepend of prop.prependsAtPaths()) this.#prepend.push(`${path}.${prepend}`);
14915
+ }
14916
+ for (const strategy of prop.matchesOn()) this.#matchOn.push(`${path}.${strategy}`);
14917
+ }
14918
+ #collectOnce(path, prop) {
14919
+ if (!prop.shouldResolveOnce()) return;
14920
+ if (this.#isPartial && !this.#isIncludedInPartialMetadata(path)) return;
14921
+ this.#once[prop.getKey() ?? path] = { prop: path, expiresAt: prop.expiresAt() };
14922
+ }
14923
+ #isIncludedInPartialMetadata(path) {
14924
+ if (this.#only !== void 0 && !this.#matchesOnly(path)) return false;
14925
+ if (this.#except !== void 0 && this.#matchesExcept(path)) return false;
14926
+ return true;
14927
+ }
14928
+ #matchesOnly(path) {
14929
+ return this.#only.some((only) => path === only || path.startsWith(`${only}.`));
14930
+ }
14931
+ #leadsToOnly(path) {
14932
+ return this.#only.some((only) => only.startsWith(`${path}.`));
14933
+ }
14934
+ #matchesExcept(path) {
14935
+ return this.#except.some((except) => path === except || path.startsWith(`${except}.`));
14936
+ }
14937
+ /** 'auth.user' => value becomes { auth: { user: value } }; callbacks along the path are resolved first. */
14938
+ async #unpackDotProps(props) {
14939
+ const result = { ...props };
14940
+ for (const [key, original] of Object.entries(props)) {
14941
+ if (!key.includes(".")) continue;
14942
+ let value2 = original;
14943
+ if (typeof value2 === "function") value2 = await value2();
14944
+ await this.#ensurePathIsTraversable(result, key);
14945
+ delete result[key];
14946
+ Arr.set(result, key, value2);
14947
+ }
14948
+ return result;
14949
+ }
14950
+ async #ensurePathIsTraversable(props, dotKey) {
14951
+ let current = props;
14952
+ for (const segment of dotKey.split(".").slice(0, -1)) {
14953
+ if (current[segment] === void 0 || current[segment] === null) return;
14954
+ if (typeof current[segment] === "function") current[segment] = await current[segment]();
14955
+ const value2 = current[segment];
14956
+ if (typeof value2 === "object" && value2 !== null && !isContainer(value2) && typeof value2.toJSON === "function") {
14957
+ current[segment] = value2.toJSON();
14958
+ }
14959
+ const walked = current[segment];
14960
+ if (typeof walked !== "object" || walked === null) return;
14961
+ current[segment] = Array.isArray(walked) ? [...walked] : Object.assign(Object.create(Object.getPrototypeOf(walked)), walked);
14962
+ current = current[segment];
14963
+ }
14964
+ }
14965
+ };
14966
+ function requestScope2() {
14967
+ const container = currentContainer();
14968
+ return container !== void 0 && container.bound(HttpRequest) ? container : void 0;
14969
+ }
14970
+ function currentRequest3() {
14971
+ return requestScope2()?.make(HttpRequest);
14972
+ }
14973
+ function optionalSession2() {
14974
+ const scope = requestScope2();
14975
+ return scope?.bound(Session) ? scope.make(Session) : void 0;
14976
+ }
14977
+ function isInertiaRequest(request2) {
14978
+ const value2 = request2.header("X-Inertia");
14979
+ return value2 !== void 0 && value2 !== "" && value2 !== "false";
14980
+ }
14981
+ function isPrefetch(request2) {
14982
+ return ["Purpose", "Sec-Purpose", "X-Moz"].some((name) => request2.header(name)?.toLowerCase() === "prefetch");
14983
+ }
14984
+ function rebuild(response2, changes) {
14985
+ const headers = new Headers(response2.headers);
14986
+ for (const [name, value2] of Object.entries(changes.headers ?? {})) headers.set(name, value2);
14987
+ const status = changes.status ?? response2.status;
14988
+ return new Response(response2.body, {
14989
+ status,
14990
+ statusText: status === response2.status ? response2.statusText : "",
14991
+ headers
14992
+ });
14993
+ }
14994
+ function isRedirect(response2) {
14995
+ return [201, 301, 302, 303, 307, 308].includes(response2.status) && response2.headers.has("Location");
14996
+ }
14997
+ var ComponentNotFoundError = class extends Error {
14998
+ constructor(component) {
14999
+ super(`Inertia page component [${component}] not found.`);
15000
+ this.component = component;
15001
+ this.name = "ComponentNotFoundError";
15002
+ }
15003
+ component;
15004
+ kind = "Server";
15005
+ status = 500;
15006
+ };
15007
+ var InertiaError = class extends Error {
15008
+ kind = "Server";
15009
+ status = 500;
15010
+ constructor(message) {
15011
+ super(message);
15012
+ this.name = "InertiaError";
15013
+ }
15014
+ };
15015
+ var SsrError = class extends Error {
15016
+ kind = "Server";
15017
+ status = 500;
15018
+ constructor(message, options) {
15019
+ super(message, options);
15020
+ this.name = "SsrError";
15021
+ }
15022
+ };
15023
+ var SessionKey = {
15024
+ CLEAR_HISTORY: "inertia.clear_history",
15025
+ PRESERVE_FRAGMENT: "inertia.preserve_fragment",
15026
+ FLASH_DATA: "inertia.flash_data"
15027
+ };
15028
+ function defaultUrl(request2) {
15029
+ const url2 = new URL(request2.raw.url);
15030
+ return `${url2.pathname}${url2.search}`;
15031
+ }
15032
+ var Response2 = class {
15033
+ constructor(component, props, settings) {
15034
+ this.component = component;
15035
+ this.settings = settings;
15036
+ this.#props = { ...props };
15037
+ this.#rootView = settings.rootView;
15038
+ }
15039
+ component;
15040
+ settings;
15041
+ #props;
15042
+ #viewData = {};
15043
+ #rootView;
15044
+ with(key, value2) {
15045
+ if (typeof key === "string") this.#props[key] = value2;
15046
+ else Object.assign(this.#props, key);
15047
+ return this;
15048
+ }
15049
+ withViewData(key, value2) {
15050
+ if (typeof key === "string") this.#viewData[key] = value2;
15051
+ else Object.assign(this.#viewData, key);
15052
+ return this;
15053
+ }
15054
+ rootView(view2) {
15055
+ this.#rootView = view2;
15056
+ return this;
15057
+ }
15058
+ flash(key, value2) {
15059
+ this.settings.flash(key, value2);
15060
+ return this;
15061
+ }
15062
+ /** The page object for this request. */
15063
+ async toPage(request2) {
15064
+ const scope = requestScope2();
15065
+ this.#ensurePageExists(scope);
15066
+ const resolver = new PropsResolver(request2, this.component, {
15067
+ exposeSharedPropKeys: this.#config(scope, "inertia.expose_shared_prop_keys", true),
15068
+ report: async (error) => {
15069
+ if (scope?.bound(ExceptionHandler)) await scope.make(ExceptionHandler).report(error);
15070
+ }
15071
+ });
15072
+ const { props, metadata } = await resolver.resolve(this.settings.shared, this.#props);
15073
+ const session2 = optionalSession2();
15074
+ const clearHistory = session2?.pull(SessionKey.CLEAR_HISTORY, false) === true;
15075
+ const preserveFragment = session2?.pull(SessionKey.PRESERVE_FRAGMENT, false) === true;
15076
+ const flash = session2?.pull(SessionKey.FLASH_DATA, void 0);
15077
+ const page = {
15078
+ component: this.component,
15079
+ props,
15080
+ url: (this.settings.urlResolver ?? defaultUrl)(request2),
15081
+ version: await this.settings.version(),
15082
+ ...metadata
15083
+ };
15084
+ if (clearHistory) page.clearHistory = true;
15085
+ if (this.settings.encryptHistory) page.encryptHistory = true;
15086
+ if (flash !== void 0 && flash !== null && Object.keys(flash).length > 0) page.flash = flash;
15087
+ if (preserveFragment) page.preserveFragment = true;
15088
+ return page;
15089
+ }
15090
+ async toResponse(request2) {
15091
+ const http = request2;
15092
+ if (typeof http?.header !== "function") throw new InertiaError("An Inertia response needs the HttpRequest.");
15093
+ const page = await this.toPage(http);
15094
+ if (isInertiaRequest(http)) {
15095
+ return new globalThis.Response(JSON.stringify(page), {
15096
+ status: 200,
15097
+ headers: { "content-type": "application/json", "X-Inertia": "true" }
15098
+ });
15099
+ }
15100
+ const scope = requestScope2();
15101
+ if (scope === void 0 || !scope.bound(ViewFactory)) {
15102
+ throw new InertiaError(`Cannot render the Inertia root view [${this.#rootView}]: no ViewFactory is bound.`);
15103
+ }
15104
+ const html2 = await scope.make(ViewFactory).make(this.#rootView, { ...this.#viewData, page }).render();
15105
+ return new globalThis.Response(html2, { status: 200, headers: { "content-type": "text/html; charset=utf-8" } });
15106
+ }
15107
+ /** inertia.pages.ensure_pages_exist: the component must exist under one of the page paths. */
15108
+ #ensurePageExists(scope) {
15109
+ if (!this.#config(scope, "inertia.pages.ensure_pages_exist", false)) return;
15110
+ const paths = this.#config(scope, "inertia.pages.paths", []);
15111
+ const extensions = this.#config(scope, "inertia.pages.extensions", []);
15112
+ if (!pageExists(this.component, paths, extensions)) throw new ComponentNotFoundError(this.component);
15113
+ }
15114
+ #config(scope, key, fallback) {
15115
+ return scope?.bound(ConfigRepository) ? scope.make(ConfigRepository).get(key, fallback) : fallback;
15116
+ }
15117
+ };
15118
+ function pageExists(component, paths, extensions) {
15119
+ return paths.some((path) => extensions.some((extension) => existsSync8(join10(path, `${component}.${extension}`))));
15120
+ }
15121
+ var ResponseFactory2 = class _ResponseFactory {
15122
+ constructor(app2, parent) {
15123
+ this.app = app2;
15124
+ this.parent = parent;
15125
+ }
15126
+ app;
15127
+ parent;
15128
+ #shared = {};
15129
+ #rootView;
15130
+ #version;
15131
+ #encryptHistory;
15132
+ #urlResolver;
15133
+ /** A per-request child of this (root) factory. */
15134
+ forRequest() {
15135
+ return new _ResponseFactory(this.app, this);
15136
+ }
15137
+ setRootView(view2) {
15138
+ this.#rootView = view2;
15139
+ }
15140
+ getRootView() {
15141
+ return this.#rootView ?? this.parent?.getRootView() ?? "app";
15142
+ }
15143
+ share(key, value2) {
15144
+ if (typeof key === "string") Arr.set(this.#shared, key, value2);
15145
+ else Object.assign(this.#shared, key);
15146
+ }
15147
+ shareOnce(key, callback) {
15148
+ const prop = new OnceProp(callback);
15149
+ this.share(key, prop);
15150
+ return prop;
15151
+ }
15152
+ getShared(key, defaultValue) {
15153
+ const shared2 = { ...this.parent?.getShared(), ...this.#shared };
15154
+ return key === void 0 ? shared2 : Arr.get(shared2, key, defaultValue);
15155
+ }
15156
+ flushShared() {
15157
+ this.#shared = {};
15158
+ }
15159
+ version(version) {
15160
+ this.#version = version;
15161
+ }
15162
+ /** The asset version as a string ('' when there is none), like Laravel's `(string) $version`. */
15163
+ async getVersion() {
15164
+ const version = this.#versionResolver();
15165
+ const resolved = typeof version === "function" ? await version() : version;
15166
+ return resolved === null || resolved === void 0 ? "" : String(resolved);
15167
+ }
15168
+ #versionResolver() {
15169
+ return this.#version ?? (this.parent === void 0 ? void 0 : this.parent.#versionResolver());
15170
+ }
15171
+ #encrypts() {
15172
+ return this.#encryptHistory ?? (this.parent === void 0 ? void 0 : this.parent.#encrypts());
15173
+ }
15174
+ #resolvesUrl() {
15175
+ return this.#urlResolver ?? (this.parent === void 0 ? void 0 : this.parent.#resolvesUrl());
15176
+ }
15177
+ resolveUrlUsing(resolver) {
15178
+ this.#urlResolver = resolver;
15179
+ }
15180
+ encryptHistory(encrypt2 = true) {
15181
+ this.#encryptHistory = encrypt2;
15182
+ }
15183
+ clearHistory() {
15184
+ optionalSession2()?.put(SessionKey.CLEAR_HISTORY, true);
15185
+ }
15186
+ preserveFragment() {
15187
+ optionalSession2()?.put(SessionKey.PRESERVE_FRAGMENT, true);
15188
+ }
15189
+ optional(callback) {
15190
+ return new OptionalProp(callback);
15191
+ }
15192
+ defer(callback, group = "default", options = {}) {
15193
+ return new DeferProp(callback, group, options);
15194
+ }
15195
+ always(value2) {
15196
+ return new AlwaysProp(value2);
15197
+ }
15198
+ merge(value2) {
15199
+ return new MergeProp(value2);
15200
+ }
15201
+ deepMerge(value2) {
15202
+ return new MergeProp(value2).deepMerge();
15203
+ }
15204
+ once(callback) {
15205
+ return new OnceProp(callback);
15206
+ }
15207
+ scroll(value2, wrapper = "data", metadata) {
15208
+ return new ScrollProp(value2, wrapper, metadata);
15209
+ }
15210
+ /** Flashes page.flash data for the next Inertia response (stored in the session immediately). */
15211
+ flash(key, value2) {
15212
+ const session2 = optionalSession2();
15213
+ if (session2 === void 0) return this;
15214
+ const flash = typeof key === "string" ? { [key]: value2 } : key;
15215
+ session2.flash(SessionKey.FLASH_DATA, { ...session2.get(SessionKey.FLASH_DATA, {}), ...flash });
15216
+ return this;
15217
+ }
15218
+ back(fallback, status = 302) {
15219
+ const scope = requestScope2() ?? this.app;
15220
+ return scope.make(Redirector).back(fallback, status);
15221
+ }
15222
+ /** 409 + X-Inertia-Location for Inertia requests (the client does a full visit), a plain 302 otherwise. */
15223
+ location(url2) {
15224
+ const request2 = currentRequest3();
15225
+ if (request2 !== void 0 && isInertiaRequest(request2)) {
15226
+ return new globalThis.Response(null, { status: 409, headers: { [Header.LOCATION]: url2 } });
15227
+ }
15228
+ return new globalThis.Response(null, { status: 302, headers: { Location: url2 } });
15229
+ }
15230
+ render(component, props = {}) {
15231
+ const config2 = this.app.bound(ConfigRepository) ? this.app.make(ConfigRepository) : void 0;
15232
+ return new Response2(component, props, {
15233
+ shared: this.getShared(),
15234
+ rootView: this.getRootView(),
15235
+ version: () => this.getVersion(),
15236
+ encryptHistory: this.#encrypts() ?? config2?.get("inertia.history.encrypt", false) ?? false,
15237
+ urlResolver: this.#resolvesUrl(),
15238
+ flash: (key, value2) => void this.flash(key, value2)
15239
+ });
15240
+ }
15241
+ };
15242
+ function inertiaFactory() {
15243
+ const container = currentContainer();
15244
+ if (container === void 0) throw new ContainerNotAvailableError("Inertia");
15245
+ if (container.bound(HttpRequest)) return container.make(InertiaFactory);
15246
+ return container.make(Application).make(ResponseFactory2);
15247
+ }
15248
+ function inertia(component, props = {}) {
15249
+ const factory = inertiaFactory();
15250
+ return component === void 0 ? factory : factory.render(component, props);
15251
+ }
15252
+ var Inertia = new Proxy({}, {
15253
+ get(_target, property) {
15254
+ if (typeof property === "symbol" || property === "then") return void 0;
15255
+ const factory = inertiaFactory();
15256
+ const value2 = Reflect.get(factory, property, factory);
15257
+ return typeof value2 === "function" ? value2.bind(factory) : value2;
15258
+ }
15259
+ });
15260
+ var InertiaHtml = class {
15261
+ constructor(html2) {
15262
+ this.html = html2;
15263
+ }
15264
+ html;
15265
+ toHtml() {
15266
+ return this.html;
15267
+ }
15268
+ toString() {
15269
+ return this.html;
15270
+ }
15271
+ };
15272
+ function pageJson(page) {
15273
+ return JSON.stringify(page).replace(/\//g, "\\/").replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
15274
+ }
15275
+ function pageMarkup(page, id = "app") {
15276
+ const safeId = id.replace(/[^A-Za-z0-9_-]/g, "");
15277
+ return `<script data-page="${safeId}" type="application/json">${pageJson(page)}</script><div id="${safeId}"></div>`;
15278
+ }
15279
+ var dispatched = /* @__PURE__ */ new WeakMap();
15280
+ function ssr(page) {
15281
+ let pending = dispatched.get(page);
15282
+ if (pending === void 0) {
15283
+ const container = currentContainer();
15284
+ pending = container?.bound(InertiaSsrGateway) ? container.make(InertiaSsrGateway).dispatch(page) : Promise.resolve(void 0);
15285
+ dispatched.set(page, pending);
15286
+ }
15287
+ return pending;
15288
+ }
15289
+ function handled(promise) {
15290
+ promise.catch(() => void 0);
15291
+ return promise;
15292
+ }
15293
+ function inertiaHead(page) {
15294
+ return handled(ssr(page).then((rendered) => new InertiaHtml(rendered?.head ?? "")));
15295
+ }
15296
+ function inertiaBody(page, id = "app") {
15297
+ return handled(ssr(page).then((rendered) => new InertiaHtml(rendered?.body ?? pageMarkup(page, id))));
15298
+ }
15299
+ var excluded = /* @__PURE__ */ new WeakSet();
15300
+ function withoutSsr(request2, paths) {
15301
+ const matches = paths.some((pattern) => {
15302
+ const trimmed = pattern === "/" ? pattern : pattern.replace(/^\/+|\/+$/g, "");
15303
+ return Str.is(trimmed, request2.fullUrl()) || request2.is(trimmed);
15304
+ });
15305
+ if (matches) excluded.add(request2);
15306
+ }
15307
+ function isExcludedFromSsr(request2) {
15308
+ return excluded.has(request2);
15309
+ }
15310
+ var InertiaMiddleware = class {
15311
+ /** The root view rendered on the first visit: resources/views/app.tsx. */
15312
+ rootViewName = "app";
15313
+ /** Send every message per field instead of the first one. */
15314
+ withAllErrors = false;
15315
+ /** Paths (wildcards allowed) rendered without SSR. */
15316
+ withoutSsr = [];
15317
+ container = inject(Container);
15318
+ /** The asset version: a hash of app.asset_url, else of public/build/manifest.json, else none. */
15319
+ async version(_request) {
15320
+ const config2 = this.container.bound(ConfigRepository) ? this.container.make(ConfigRepository) : void 0;
15321
+ const assetUrl = config2?.get("app.asset_url", null);
15322
+ if (typeof assetUrl === "string" && assetUrl !== "") return md5(assetUrl);
15323
+ const app2 = this.container.make(Application);
15324
+ const manifest = app2.publicPath("build/manifest.json");
15325
+ return existsSync23(manifest) ? md5(readFileSync(manifest)) : null;
15326
+ }
15327
+ /** Props shared with every page. Override and spread `await super.share(request)` into your own. */
15328
+ async share(request2) {
15329
+ return { errors: new AlwaysProp(this.resolveValidationErrors(request2)) };
15330
+ }
15331
+ /** Shared once props: sent on the first visit, then kept by the client. */
15332
+ async shareOnce(_request) {
15333
+ return {};
15334
+ }
15335
+ rootView(_request) {
15336
+ return this.rootViewName;
15337
+ }
15338
+ /** How page.url is built; undefined keeps the default (path + query). */
15339
+ urlResolver() {
15340
+ return void 0;
15341
+ }
15342
+ async handle(request2, next) {
15343
+ const inertia2 = this.container.make(InertiaFactory);
15344
+ inertia2.version(() => this.version(request2));
15345
+ inertia2.share(await this.share(request2));
15346
+ for (const [key, value2] of Object.entries(await this.shareOnce(request2))) {
15347
+ if (value2 instanceof OnceProp) inertia2.share(key, value2);
15348
+ else inertia2.shareOnce(key, value2);
15349
+ }
15350
+ inertia2.setRootView(this.rootView(request2));
15351
+ const resolver = this.urlResolver();
15352
+ if (resolver !== void 0) inertia2.resolveUrlUsing(resolver);
15353
+ if (this.withoutSsr.length > 0) withoutSsr(request2, this.withoutSsr);
15354
+ let response2 = await next(request2);
15355
+ response2 = rebuild(response2, { headers: { Vary: "X-Inertia" } });
15356
+ const redirect2 = isRedirect(response2);
15357
+ const session2 = optionalSession2();
15358
+ if (redirect2 && session2 !== void 0) this.reflash(session2);
15359
+ if (!isInertiaRequest(request2)) return response2;
15360
+ if (session2 !== void 0 && this.shouldStoreCurrentUrl(request2, response2)) session2.setPreviousUrl(request2.fullUrl());
15361
+ if (request2.method() === "GET" && request2.header(Header.VERSION, "") !== await inertia2.getVersion()) {
15362
+ response2 = await this.onVersionChange(request2, response2);
15363
+ }
15364
+ if (isEmpty(response2)) response2 = await this.onEmptyResponse(request2, response2);
15365
+ if (response2.status === 302 && ["PUT", "PATCH", "DELETE"].includes(request2.method())) response2 = rebuild(response2, { status: 303 });
15366
+ if (redirect2 && (response2.headers.get("Location") ?? "").includes("#") && !isPrefetch(request2)) {
15367
+ response2 = await this.onRedirectWithFragment(request2, response2);
15368
+ }
15369
+ return response2;
15370
+ }
15371
+ /** The session's flashed errors ({ [bag]: { field: string[] } }), shaped for the client. */
15372
+ resolveValidationErrors(request2) {
15373
+ const flashed = optionalSession2()?.get("errors", void 0);
15374
+ if (flashed === void 0 || flashed === null || typeof flashed !== "object") return {};
15375
+ const bags = Object.fromEntries(
15376
+ Object.entries(flashed).map(([bag, fields]) => [
15377
+ bag,
15378
+ Object.fromEntries(
15379
+ Object.entries(fields ?? {}).map(([field, messages]) => {
15380
+ const list3 = Array.isArray(messages) ? messages.map(String) : [String(messages)];
15381
+ return [field, this.withAllErrors ? list3 : list3[0] ?? ""];
15382
+ })
15383
+ )
15384
+ ])
15385
+ );
15386
+ const errorBag = request2.header(Header.ERROR_BAG);
15387
+ if (bags.default !== void 0 && errorBag !== void 0 && errorBag !== "") return { [errorBag]: bags.default };
15388
+ if (bags.default !== void 0) return bags.default;
15389
+ return bags;
15390
+ }
15391
+ /** inertia.store_previous_url: Inertia GET visits (not prefetches or same-page partial reloads) become previous(). */
15392
+ shouldStoreCurrentUrl(request2, _response) {
15393
+ const config2 = this.container.bound(ConfigRepository) ? this.container.make(ConfigRepository) : void 0;
15394
+ if (config2?.get("inertia.store_previous_url", false) !== true) return false;
15395
+ if (request2.method() !== "GET" || !request2.ajax() || isPrefetch(request2)) return false;
15396
+ const partial = request2.header(Header.PARTIAL_COMPONENT);
15397
+ return partial === void 0 || partial === "";
15398
+ }
15399
+ async onEmptyResponse(request2, _response) {
15400
+ return this.container.make(Redirector).back().toResponse(request2);
15401
+ }
15402
+ async onRedirectWithFragment(_request, response2) {
15403
+ return new Response(null, { status: 409, headers: { [Header.REDIRECT]: response2.headers.get("Location") ?? "" } });
15404
+ }
15405
+ async onVersionChange(request2, _response) {
15406
+ optionalSession2()?.reflash();
15407
+ const inertia2 = this.container.make(InertiaFactory);
15408
+ const response2 = inertia2.location(request2.fullUrl());
15409
+ return rebuild(response2, { headers: { [Header.VERSION]: await inertia2.getVersion() } });
15410
+ }
15411
+ /** Keeps Inertia flash data for the page the redirect leads to. */
15412
+ reflash(session2) {
15413
+ const flashed = session2.get(SessionKey.FLASH_DATA, void 0);
15414
+ if (flashed !== void 0 && flashed !== null && Object.keys(flashed).length > 0) session2.flash(SessionKey.FLASH_DATA, flashed);
15415
+ }
15416
+ };
15417
+ function isEmpty(response2) {
15418
+ if (response2.status === 204) return true;
15419
+ return response2.status === 200 && (response2.body === null || response2.headers.get("content-length") === "0");
15420
+ }
15421
+ function md5(value2) {
15422
+ return createHash5("md5").update(value2).digest("hex");
15423
+ }
15424
+ var EncryptHistory = class {
15425
+ #container = inject(Container);
15426
+ async handle(request2, next) {
15427
+ this.#container.make(InertiaFactory).encryptHistory();
15428
+ return next(request2);
15429
+ }
15430
+ };
15431
+ var PARAMETER2 = /\{([A-Za-z_][A-Za-z0-9_]*)(?::([A-Za-z_][A-Za-z0-9_]*))?(\?)?\}/g;
15432
+ function routeParameters(uri) {
15433
+ return [...uri.matchAll(PARAMETER2)].map((match) => ({ name: match[1], optional: match[3] === "?", field: match[2] }));
15434
+ }
15435
+ function routeTable(routes, except = []) {
15436
+ const table = {};
15437
+ const named = routes.map((route2) => ({ route: route2, name: route2.getName() })).filter((entry) => entry.name !== void 0 && entry.name !== "").filter(({ name }) => !except.some((pattern) => Str.is(pattern, name))).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
15438
+ for (const { route: route2, name } of named) table[name] = { uri: route2.uri, methods: [...route2.methods] };
15439
+ return table;
15440
+ }
15441
+ var ESCAPES = { "\\": "\\\\", "'": "\\'", "\n": "\\n", "\r": "\\r", "\u2028": "\\u2028", "\u2029": "\\u2029" };
15442
+ var quote = (value2) => `'${value2.replace(/[\\\u0027\n\r\u2028\u2029]/g, (char) => ESCAPES[char])}'`;
15443
+ function parameterType(uri) {
15444
+ const parameters = routeParameters(uri);
15445
+ if (parameters.length === 0) return "Record<never, never>";
15446
+ return `{ ${parameters.map(({ name, optional }) => `${name}${optional ? "?" : ""}: RouteParameter`).join("; ")} }`;
15447
+ }
15448
+ function renderRoutesModule(table, clientModule = "@orieljs/inertia-client") {
15449
+ const names = Object.keys(table);
15450
+ const entries = names.map((name) => {
15451
+ const { uri, methods } = table[name];
15452
+ return ` ${quote(name)}: { uri: ${quote(uri)}, methods: [${methods.map(quote).join(", ")}] },`;
15453
+ });
15454
+ const types = names.map((name) => ` ${quote(name)}: ${parameterType(table[name].uri)}`);
15455
+ return [
15456
+ "// Generated by `oriel route:types`. Do not edit: run `oriel route:types` again.",
15457
+ // Built by concatenation so tools that scan source for imports don't mistake this template for one.
15458
+ `import { defineRoutes, type RouteParameter } from ${quote(clientModule)}`,
15459
+ "",
15460
+ `export const routes = defineRoutes({${entries.length === 0 ? "" : `
15461
+ ${entries.join("\n")}
15462
+ `}})`,
15463
+ "",
15464
+ `declare module ${quote(clientModule)} {`,
15465
+ " interface RouteList {",
15466
+ ...types,
15467
+ " }",
15468
+ "}",
15469
+ ""
15470
+ ].join("\n");
15471
+ }
15472
+ function renderServerRouteTypes(table) {
15473
+ const members = Object.keys(table).map((name) => ` ${quote(name)}: ${parameterType(table[name].uri).replace(/RouteParameter/g, "unknown")}`);
15474
+ const block = (module) => [`declare module ${quote(module)} {`, " interface RouteList {", ...members, " }", "}"];
15475
+ return [
15476
+ "// Generated by `oriel route:types`. Do not edit: run `oriel route:types` again.",
15477
+ "",
15478
+ ...block("@orieljs/framework"),
15479
+ "",
15480
+ ...block("@orieljs/framework/contracts"),
15481
+ "",
15482
+ "export {}",
15483
+ ""
15484
+ ].join("\n");
15485
+ }
15486
+ var MIDDLEWARE_STUB2 = `import { InertiaMiddleware } from '@orieljs/framework'
15487
+ import type { HttpRequest } from '@orieljs/framework/contracts'
15488
+
15489
+ export class {{ class }} extends InertiaMiddleware {
15490
+ /** The root view loaded on the first page visit: resources/views/app.tsx. */
15491
+ protected override rootViewName = 'app'
15492
+
15493
+ /** Props shared with every page (typed for the pages by \`oriel inertia:types\`). */
15494
+ override async share(request: HttpRequest) {
15495
+ return {
15496
+ ...(await super.share(request)),
15497
+ }
15498
+ }
15499
+ }
15500
+ `;
15501
+ async function loadPageTypes() {
15502
+ const specifier = "@orieljs/vite/types";
15503
+ try {
15504
+ return await import(
15505
+ /* @vite-ignore */
15506
+ specifier
15507
+ );
15508
+ } catch {
15509
+ return void 0;
15510
+ }
15511
+ }
15512
+ function registerInertiaCommands(kernel, app2, gateway, options = {}) {
15513
+ const config2 = (key, fallback) => app2.bound(ConfigRepository) ? app2.make(ConfigRepository).get(key, fallback) : fallback;
15514
+ const absolute = (path) => isAbsolute2(path) ? path : app2.basePath(path);
15515
+ kernel.command(
15516
+ "route:types {--output= : Where to write the route module} {--server= : Where to write the server route name types}",
15517
+ async function() {
15518
+ if (!app2.bound(Router)) {
15519
+ this.error("The router is not available. Is the Routing service provider registered?");
15520
+ return 1;
15521
+ }
15522
+ const output = absolute(optionText(this.option("output")) ?? config2("inertia.types.routes", "resources/js/oriel/routes.ts"));
15523
+ const server = absolute(optionText(this.option("server")) ?? config2("inertia.types.server_routes", "types/routes.d.ts"));
15524
+ const table = routeTable(app2.make(Router).getRoutes(), config2("inertia.types.except_routes", []));
15525
+ await mkdir6(dirname6(output), { recursive: true });
15526
+ await writeFile7(output, renderRoutesModule(table));
15527
+ await mkdir6(dirname6(server), { recursive: true });
15528
+ await writeFile7(server, renderServerRouteTypes(routeTable(app2.make(Router).getRoutes())));
15529
+ this.info(`Route types for ${Object.keys(table).length} named routes written to ${relative6(app2.basePath(), output)}.`);
15530
+ return 0;
15531
+ }
15532
+ ).purpose("Generate the route table and route name types for the frontend");
15533
+ kernel.command("inertia:types {--output= : Where to write the page types}", async function() {
15534
+ const module = await (options.pageTypes ?? loadPageTypes)();
15535
+ if (module === void 0) {
15536
+ this.error("Generating page types needs @orieljs/vite: install it as a dev dependency.");
15537
+ return 1;
15538
+ }
15539
+ const output = absolute(optionText(this.option("output")) ?? config2("inertia.types.pages", "resources/js/oriel/pages.d.ts"));
15540
+ const result = await module.generatePageTypes({ root: app2.basePath(), output });
15541
+ for (const warning of result.warnings) this.warn(warning);
15542
+ this.info(`Page types for ${result.pages} pages written to ${relative6(app2.basePath(), result.output)}.`);
15543
+ return 0;
15544
+ }).purpose("Generate TypeScript types for the Inertia page props");
15545
+ kernel.command("inertia:middleware {name=HandleInertiaRequests : The middleware class name} {--force : Overwrite an existing file}", async function() {
15546
+ const name = String(this.argument("name") ?? "HandleInertiaRequests");
15547
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
15548
+ this.error(`Middleware name [${name}] is not a valid class name.`);
15549
+ return 1;
15550
+ }
15551
+ const file = app2.appPath(join24("Http", "Middleware", `${name}.ts`));
15552
+ if (existsSync33(file) && this.option("force") !== true) {
15553
+ this.error(`Middleware [${relative6(app2.basePath(), file)}] already exists.`);
15554
+ return 1;
15555
+ }
15556
+ await mkdir6(dirname6(file), { recursive: true });
15557
+ await writeFile7(file, MIDDLEWARE_STUB2.replace("{{ class }}", () => name));
15558
+ this.info(`Middleware [${relative6(app2.basePath(), file)}] created successfully.`);
15559
+ return 0;
15560
+ }).purpose("Create a new Inertia middleware");
15561
+ kernel.command("inertia:start-ssr {--runtime= : The runtime that runs the SSR bundle (node or bun)}", async function() {
15562
+ if (!config2("inertia.ssr.enabled", true)) {
15563
+ this.error("Inertia SSR is not enabled. Enable it via the `inertia.ssr.enabled` config option.");
15564
+ return 1;
15565
+ }
15566
+ const bundle = gateway.bundle();
15567
+ if (bundle === void 0) {
15568
+ this.error("Inertia SSR bundle not found. Build it with `vite build --ssr`, or set `inertia.ssr.bundle`.");
15569
+ return 1;
15570
+ }
15571
+ const runtime = optionText(this.option("runtime")) ?? config2("inertia.ssr.runtime", "node");
15572
+ const child = (options.spawn ?? spawn2)(runtime, [bundle], { stdio: "inherit" });
15573
+ return await new Promise((resolve4) => {
15574
+ child.on("exit", (code) => resolve4(code ?? 0));
15575
+ child.on("error", (error) => {
15576
+ this.error(`Could not start the SSR server: ${error.message}`);
15577
+ resolve4(1);
15578
+ });
15579
+ });
15580
+ }).purpose("Start the Inertia SSR server");
15581
+ kernel.command("inertia:stop-ssr", async function() {
15582
+ try {
15583
+ await fetch(`${gateway.productionUrl()}/shutdown`);
15584
+ } catch {
15585
+ }
15586
+ this.info("Inertia SSR server stopped.");
15587
+ return 0;
15588
+ }).purpose("Stop the Inertia SSR server");
15589
+ kernel.command("inertia:check-ssr", async function() {
15590
+ if (await gateway.isHealthy()) {
15591
+ this.info("Inertia SSR server is running.");
15592
+ return 0;
15593
+ }
15594
+ this.error("Inertia SSR server is not running.");
15595
+ return 1;
15596
+ }).purpose("Check the Inertia SSR server health status");
15597
+ }
15598
+ function optionText(value2) {
15599
+ return value2 === void 0 || value2 === null || value2 === false || value2 === "" ? void 0 : String(value2);
15600
+ }
15601
+ var SSR_RENDER_FAILED = "inertia.ssr.failed";
15602
+ var HttpGateway = class {
15603
+ constructor(app2) {
15604
+ this.app = app2;
15605
+ }
15606
+ app;
15607
+ #disabled;
15608
+ #except = [];
15609
+ disable(condition = true) {
15610
+ this.#disabled = condition;
15611
+ }
15612
+ /** Paths (wildcards allowed) never rendered on the server. */
15613
+ except(paths) {
15614
+ this.#except.push(...[paths].flat());
15615
+ }
15616
+ async dispatch(page) {
15617
+ if (!this.enabled(currentRequest3())) return void 0;
15618
+ const hot = this.hotUrl();
15619
+ if (hot === void 0 && this.#config("inertia.ssr.ensure_bundle_exists", true) && this.bundle() === void 0) return void 0;
15620
+ const url2 = hot === void 0 ? `${this.productionUrl()}/render` : `${hot}/__inertia_ssr`;
15621
+ try {
15622
+ const response2 = await fetch(url2, {
15623
+ method: "POST",
15624
+ headers: { "content-type": "application/json", accept: "application/json" },
15625
+ body: JSON.stringify(page),
15626
+ signal: this.#signal()
15627
+ });
15628
+ const data = await response2.json().catch(() => null);
15629
+ if (!response2.ok) {
15630
+ await this.#failed({ page, error: String(data?.error ?? `SSR server responded with ${response2.status}`), type: String(data?.type ?? "render"), ...details(data) });
15631
+ return void 0;
15632
+ }
15633
+ if (data === null) return void 0;
15634
+ return { head: (data.head ?? []).join("\n"), body: data.body ?? "" };
15635
+ } catch (error) {
15636
+ if (error instanceof SsrError) throw error;
15637
+ await this.#failed({ page, error: error instanceof Error ? error.message : String(error), type: "connection" });
15638
+ return void 0;
15639
+ }
15640
+ }
15641
+ /** GET {inertia.ssr.url}/health: any 2xx is healthy. */
15642
+ async isHealthy() {
15643
+ try {
15644
+ return (await fetch(`${this.productionUrl()}/health`, { signal: this.#signal() })).ok;
15645
+ } catch {
15646
+ return false;
15647
+ }
15648
+ }
15649
+ productionUrl() {
15650
+ return this.#config("inertia.ssr.url", "http://127.0.0.1:13714").replace(/\/+$/, "");
15651
+ }
15652
+ /** inertia.ssr.hot_url, else the Vite dev server URL in public/hot; undefined when Vite isn't running. */
15653
+ hotUrl() {
15654
+ const hotFile = this.app.publicPath("hot");
15655
+ if (!existsSync42(hotFile)) return void 0;
15656
+ const configured = this.#config("inertia.ssr.hot_url", null);
15657
+ const url2 = configured !== null && configured !== "" ? configured : readFileSync2(hotFile, "utf8");
15658
+ return url2.trim().replace(/\/+$/, "");
15659
+ }
15660
+ /** inertia.ssr.bundle, else bootstrap/ssr/{ssr,app}.{js,mjs}, else public/js/{ssr,app}.js (BundleDetector). */
15661
+ bundle() {
15662
+ const configured = this.#config("inertia.ssr.bundle", null);
15663
+ const candidates = [
15664
+ configured,
15665
+ this.app.basePath("bootstrap/ssr/ssr.js"),
15666
+ this.app.basePath("bootstrap/ssr/app.js"),
15667
+ this.app.basePath("bootstrap/ssr/ssr.mjs"),
15668
+ this.app.basePath("bootstrap/ssr/app.mjs"),
15669
+ this.app.publicPath("js/ssr.js"),
15670
+ this.app.publicPath("js/app.js")
15671
+ ];
15672
+ return candidates.find((path) => typeof path === "string" && path !== "" && existsSync42(path));
15673
+ }
15674
+ enabled(request2) {
15675
+ const disabled2 = this.#disabled;
15676
+ const enabled = disabled2 !== void 0 ? !(typeof disabled2 === "function" ? disabled2() : disabled2) : this.#config("inertia.ssr.enabled", true);
15677
+ if (!enabled) return false;
15678
+ if (request2 === void 0) return true;
15679
+ if (isExcludedFromSsr(request2)) return false;
15680
+ return !this.#except.some((pattern) => {
15681
+ const trimmed = pattern === "/" ? pattern : pattern.replace(/^\/+|\/+$/g, "");
15682
+ return Str.is(trimmed, request2.fullUrl()) || request2.is(trimmed);
15683
+ });
15684
+ }
15685
+ async #failed(failure) {
15686
+ const scope = requestScope2() ?? this.app;
15687
+ if (scope.bound(EventDispatcher)) await scope.make(EventDispatcher).dispatch(SSR_RENDER_FAILED, [failure]);
15688
+ if (this.#config("inertia.ssr.throw_on_error", false)) throw new SsrError(`SSR render failed: ${failure.error}`);
15689
+ }
15690
+ #signal() {
15691
+ const seconds = this.#config("inertia.ssr.timeout", null);
15692
+ return typeof seconds === "number" && seconds > 0 ? AbortSignal.timeout(seconds * 1e3) : void 0;
15693
+ }
15694
+ #config(key, fallback) {
15695
+ return this.app.bound(ConfigRepository) ? this.app.make(ConfigRepository).get(key, fallback) : fallback;
15696
+ }
15697
+ };
15698
+ function details(data) {
15699
+ const text3 = (key) => typeof data?.[key] === "string" ? data[key] : void 0;
15700
+ return { hint: text3("hint"), browserApi: text3("browserApi"), stack: text3("stack"), sourceLocation: text3("sourceLocation") };
15701
+ }
15702
+ var InertiaServiceProvider = class extends ServiceProvider {
15703
+ register() {
15704
+ this.mergeConfigFrom(
15705
+ {
15706
+ ssr: {
15707
+ enabled: true,
15708
+ runtime: "node",
15709
+ url: "http://127.0.0.1:13714",
15710
+ hot_url: null,
15711
+ timeout: null,
15712
+ ensure_bundle_exists: true,
15713
+ bundle: null,
15714
+ throw_on_error: false
15715
+ },
15716
+ pages: {
15717
+ ensure_pages_exist: false,
15718
+ paths: [this.app.resourcePath("js/pages")],
15719
+ extensions: ["js", "jsx", "svelte", "ts", "tsx", "vue", "component.ts"]
15720
+ },
15721
+ testing: { ensure_pages_exist: true },
15722
+ expose_shared_prop_keys: true,
15723
+ store_previous_url: false,
15724
+ history: { encrypt: false },
15725
+ types: { pages: "resources/js/oriel/pages.d.ts", routes: "resources/js/oriel/routes.ts", server_routes: "types/routes.d.ts", except_routes: [] }
15726
+ },
15727
+ "inertia"
15728
+ );
15729
+ this.app.singleton(ResponseFactory2, () => new ResponseFactory2(this.app));
15730
+ this.app.scoped(InertiaFactory, (container) => container.make(ResponseFactory2).forRequest());
15731
+ this.app.singleton(HttpGateway, () => new HttpGateway(this.app));
15732
+ this.app.singleton(InertiaSsrGateway, (container) => container.make(HttpGateway));
15733
+ }
15734
+ boot() {
15735
+ if (this.app.bound(Router)) this.app.make(Router).aliasMiddleware("inertia.encrypt", EncryptHistory);
15736
+ if (this.app.bound(ConsoleKernel)) registerInertiaCommands(this.app.make(ConsoleKernel), this.app, this.app.make(HttpGateway));
15737
+ }
15738
+ };
15739
+
14389
15740
  // ../Log/dist/index.js
14390
15741
  import pino2 from "pino";
14391
15742
  import { createWriteStream as createWriteStream2, mkdirSync as mkdirSync2, readdirSync as readdirSync5, rmSync } from "fs";
14392
- import { basename as basename3, dirname as dirname6, extname as extname3, join as join10 } from "path";
15743
+ import { basename as basename3, dirname as dirname7, extname as extname3, join as join11 } from "path";
14393
15744
  import { Writable } from "stream";
14394
15745
  import "pino";
14395
15746
  var rootKey = {};
@@ -14515,7 +15866,7 @@ var DailyRotatingStream = class extends Writable {
14515
15866
  super();
14516
15867
  this.days = days;
14517
15868
  this.now = now4;
14518
- this.dir = dirname6(basePath);
15869
+ this.dir = dirname7(basePath);
14519
15870
  this.stem = basename3(basePath, extname3(basePath) || void 0);
14520
15871
  mkdirSync2(this.dir, { recursive: true });
14521
15872
  }
@@ -14535,7 +15886,7 @@ var DailyRotatingStream = class extends Writable {
14535
15886
  */
14536
15887
  pending;
14537
15888
  pathFor(date) {
14538
- return join10(this.dir, `${this.stem}-${date}.log`);
15889
+ return join11(this.dir, `${this.stem}-${date}.log`);
14539
15890
  }
14540
15891
  today() {
14541
15892
  return localDay(this.now());
@@ -14588,7 +15939,7 @@ var DailyRotatingStream = class extends Writable {
14588
15939
  const match = DATE_PATTERN.exec(file.slice(prefix.length, -".log".length));
14589
15940
  if (!match) continue;
14590
15941
  const time = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])).getTime();
14591
- if (time < cutoff) rmSync(join10(this.dir, file), { force: true });
15942
+ if (time < cutoff) rmSync(join11(this.dir, file), { force: true });
14592
15943
  }
14593
15944
  }
14594
15945
  _write(chunk, encoding, callback) {
@@ -15875,8 +17226,8 @@ import { randomUUID as randomUUID24 } from "crypto";
15875
17226
  import { Redis as Redis2 } from "ioredis";
15876
17227
  import { randomUUID as randomUUID32 } from "crypto";
15877
17228
  import { setTimeout as sleep4 } from "timers/promises";
15878
- import { existsSync as existsSync8, readdirSync as readdirSync6, statSync as statSync3 } from "fs";
15879
- import { join as join11 } from "path";
17229
+ import { existsSync as existsSync9, readdirSync as readdirSync6, statSync as statSync3 } from "fs";
17230
+ import { join as join12 } from "path";
15880
17231
  import { pathToFileURL as pathToFileURL6 } from "url";
15881
17232
  var QueueError = class extends Error {
15882
17233
  kind = "Server";
@@ -17469,7 +18820,7 @@ var EXTENSIONS3 = [".ts", ".js", ".mts", ".mjs"];
17469
18820
  function files2(directory) {
17470
18821
  const found = [];
17471
18822
  for (const entry of readdirSync6(directory).sort()) {
17472
- const path = join11(directory, entry);
18823
+ const path = join12(directory, entry);
17473
18824
  if (statSync3(path).isDirectory()) found.push(...files2(path));
17474
18825
  else if (EXTENSIONS3.some((extension) => entry.endsWith(extension)) && !entry.endsWith(".d.ts")) found.push(path);
17475
18826
  }
@@ -17479,7 +18830,7 @@ var WORKER_DISCOVERY_DIRECTORIES = ["Events", "Listeners", "Mail", "Notification
17479
18830
  var isClass2 = (value2) => typeof value2 === "function" && /^class[\s{]/.test(Function.prototype.toString.call(value2));
17480
18831
  var isJobClass = (value2) => typeof value2.prototype.handle === "function";
17481
18832
  async function discoverClasses(directory, registry2, filter = () => true) {
17482
- if (!existsSync8(directory)) return [];
18833
+ if (!existsSync9(directory)) return [];
17483
18834
  const names = [];
17484
18835
  for (const file of files2(directory)) {
17485
18836
  const module = await import(pathToFileURL6(file).href);
@@ -17799,11 +19150,11 @@ function expand(references, aliases2, groups, visiting, out) {
17799
19150
  out.push({ cls: aliases2[name], parameters });
17800
19151
  }
17801
19152
  }
17802
- function resolveMiddleware(references, excluded, aliases2, groups) {
19153
+ function resolveMiddleware(references, excluded2, aliases2, groups) {
17803
19154
  const all = [];
17804
19155
  expand(references, aliases2, groups, /* @__PURE__ */ new Set(), all);
17805
19156
  const skipped = [];
17806
- expand(excluded, aliases2, groups, /* @__PURE__ */ new Set(), skipped);
19157
+ expand(excluded2, aliases2, groups, /* @__PURE__ */ new Set(), skipped);
17807
19158
  const skippedClasses = new Set(skipped.map((entry) => entry.cls));
17808
19159
  const seen = /* @__PURE__ */ new Set();
17809
19160
  const classIds = /* @__PURE__ */ new Map();
@@ -17899,11 +19250,11 @@ async function substituteBindings(router, route2, values, container) {
17899
19250
  }
17900
19251
  return bound;
17901
19252
  }
17902
- var PARAMETER2 = /\{(\w+)(?::(\w+))?(\?)?\}/g;
19253
+ var PARAMETER3 = /\{(\w+)(?::(\w+))?(\?)?\}/g;
17903
19254
  var WHOLE_OPTIONAL = /^\{(\w+)(?::\w+)?\?\}$/;
17904
19255
  var escapeRegex = (value2) => value2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
17905
19256
  function parseParameters(uri) {
17906
- return [...uri.matchAll(PARAMETER2)].map((match) => ({ name: match[1], optional: match[3] === "?", field: match[2] }));
19257
+ return [...uri.matchAll(PARAMETER3)].map((match) => ({ name: match[1], optional: match[3] === "?", field: match[2] }));
17907
19258
  }
17908
19259
  function normalizeUri(uri) {
17909
19260
  const trimmed = uri.replace(/^\/+|\/+$/g, "");
@@ -17932,7 +19283,7 @@ function compileBody(uri, wheres) {
17932
19283
  }
17933
19284
  let piece = "";
17934
19285
  let last = 0;
17935
- for (const match of segment.matchAll(PARAMETER2)) {
19286
+ for (const match of segment.matchAll(PARAMETER3)) {
17936
19287
  piece += escapeRegex(segment.slice(last, match.index)) + group(match[1]) + (match[3] === "?" ? "?" : "");
17937
19288
  last = match.index + match[0].length;
17938
19289
  }
@@ -18295,6 +19646,23 @@ var BaseRouter = class {
18295
19646
  holder.route = this.addRoute(["GET", "HEAD"], uri, action);
18296
19647
  return holder.route;
18297
19648
  }
19649
+ /**
19650
+ * Route.inertia('/about', 'About', props): GET/HEAD; renders the page through the InertiaFactory (resolved when
19651
+ * the route runs, so Routing needs no Inertia import). Route parameters are merged into the props.
19652
+ */
19653
+ inertia(uri, component, props = {}) {
19654
+ const holder = {};
19655
+ const action = (...values) => {
19656
+ const parameters = Object.fromEntries(holder.route.parameters.map((parameter, index) => [parameter.name, values[index]]));
19657
+ const container = currentContainer() ?? this.container;
19658
+ if (container === void 0 || !container.bound(InertiaFactory)) {
19659
+ throw new RoutingError(`Cannot render Inertia page [${component}]: no InertiaFactory is bound.`);
19660
+ }
19661
+ return container.make(InertiaFactory).render(component, { ...props, ...parameters });
19662
+ };
19663
+ holder.route = this.addRoute(["GET", "HEAD"], uri, action);
19664
+ return holder.route;
19665
+ }
18298
19666
  resource(name, controller, options = {}) {
18299
19667
  this.#registerResource(name, controller, options, false);
18300
19668
  }
@@ -18503,7 +19871,7 @@ var BaseUrlGenerator = class {
18503
19871
  const whole = WHOLE_OPTIONAL.exec(segment);
18504
19872
  return whole === null || values.get(whole[1]) !== void 0;
18505
19873
  }).map(
18506
- (segment) => segment.replace(PARAMETER2, (_match, parameter) => {
19874
+ (segment) => segment.replace(PARAMETER3, (_match, parameter) => {
18507
19875
  const value2 = values.get(parameter);
18508
19876
  return value2 === void 0 ? "" : encodeURIComponent(value2);
18509
19877
  })
@@ -18601,8 +19969,8 @@ var RoutingServiceProvider = class extends ServiceProvider {
18601
19969
  };
18602
19970
 
18603
19971
  // ../Session/dist/index.js
18604
- import { mkdir as mkdir6, readdir as readdir3, readFile as readFile5, rename as rename3, rm as rm3, stat as stat4, writeFile as writeFile7 } from "fs/promises";
18605
- import { join as join12 } from "path";
19972
+ import { mkdir as mkdir7, readdir as readdir3, readFile as readFile5, rename as rename3, rm as rm3, stat as stat4, writeFile as writeFile8 } from "fs/promises";
19973
+ import { join as join13 } from "path";
18606
19974
  import { Redis as Redis3 } from "ioredis";
18607
19975
  import { randomInt } from "crypto";
18608
19976
  import { timingSafeEqual as timingSafeEqual4 } from "crypto";
@@ -18842,7 +20210,7 @@ var FileSessionHandler = class {
18842
20210
  clock;
18843
20211
  async read(id) {
18844
20212
  if (!VALID_ID.test(id)) return "";
18845
- const file = join12(this.path, id);
20213
+ const file = join13(this.path, id);
18846
20214
  try {
18847
20215
  const { mtimeMs } = await stat4(file);
18848
20216
  if (mtimeMs < this.clock() - this.minutes * 6e4) return "";
@@ -18853,21 +20221,21 @@ var FileSessionHandler = class {
18853
20221
  }
18854
20222
  async write(id, data) {
18855
20223
  if (!VALID_ID.test(id)) return;
18856
- await mkdir6(this.path, { recursive: true });
18857
- const temporary = join12(this.path, `.${id}.${Str.random(8)}.tmp`);
18858
- await writeFile7(temporary, data, "utf8");
18859
- await rename3(temporary, join12(this.path, id));
20224
+ await mkdir7(this.path, { recursive: true });
20225
+ const temporary = join13(this.path, `.${id}.${Str.random(8)}.tmp`);
20226
+ await writeFile8(temporary, data, "utf8");
20227
+ await rename3(temporary, join13(this.path, id));
18860
20228
  }
18861
20229
  async destroy(id) {
18862
- if (VALID_ID.test(id)) await rm3(join12(this.path, id), { force: true });
20230
+ if (VALID_ID.test(id)) await rm3(join13(this.path, id), { force: true });
18863
20231
  }
18864
20232
  async gc(maxLifetimeSeconds) {
18865
20233
  const expiration = this.clock() - maxLifetimeSeconds * 1e3;
18866
20234
  const files3 = await readdir3(this.path).catch(() => []);
18867
20235
  for (const file of files3) {
18868
20236
  if (!VALID_ID.test(file)) continue;
18869
- const { mtimeMs } = await stat4(join12(this.path, file)).catch(() => ({ mtimeMs: Number.POSITIVE_INFINITY }));
18870
- if (mtimeMs <= expiration) await rm3(join12(this.path, file), { force: true });
20237
+ const { mtimeMs } = await stat4(join13(this.path, file)).catch(() => ({ mtimeMs: Number.POSITIVE_INFINITY }));
20238
+ if (mtimeMs <= expiration) await rm3(join13(this.path, file), { force: true });
18871
20239
  }
18872
20240
  }
18873
20241
  };
@@ -19659,8 +21027,8 @@ function resolveDateParam(rule, param, data) {
19659
21027
  const parsed = parseDate(fieldValue);
19660
21028
  if (!Number.isNaN(parsed)) return parsed;
19661
21029
  }
19662
- const relative5 = relativeDate(param);
19663
- if (relative5 !== void 0) return relative5;
21030
+ const relative7 = relativeDate(param);
21031
+ if (relative7 !== void 0) return relative7;
19664
21032
  const literal = parseDate(param);
19665
21033
  if (!Number.isNaN(literal)) return literal;
19666
21034
  if (FIELD_REFERENCE_RE.test(param)) return Number.NaN;
@@ -20145,6 +21513,8 @@ function defaultProviders() {
20145
21513
  ValidationServiceProvider,
20146
21514
  AuthServiceProvider,
20147
21515
  ViewServiceProvider,
21516
+ InertiaServiceProvider,
21517
+ LiveServiceProvider,
20148
21518
  RoutingServiceProvider,
20149
21519
  HttpServiceProvider,
20150
21520
  ConsoleServiceProvider
@@ -20180,6 +21550,7 @@ export {
20180
21550
  AccessGate,
20181
21551
  AddQueuedCookiesToResponse,
20182
21552
  AllMailersFailedError,
21553
+ AlwaysProp,
20183
21554
  AnonymousNotifiable,
20184
21555
  Application3 as Application,
20185
21556
  ApplicationBuilder,
@@ -20234,6 +21605,9 @@ export {
20234
21605
  ColumnDefinition,
20235
21606
  Command,
20236
21607
  CommandNotFoundError,
21608
+ Component,
21609
+ ComponentNotFoundError,
21610
+ Computed,
20237
21611
  Connection,
20238
21612
  Kernel as ConsoleKernelImpl,
20239
21613
  ConsoleServiceProvider,
@@ -20246,6 +21620,7 @@ export {
20246
21620
  CookieServiceProvider,
20247
21621
  CookieSessionHandler,
20248
21622
  CookieValuePrefix,
21623
+ CorruptComponentPayloadError,
20249
21624
  Crypt,
20250
21625
  Cursor,
20251
21626
  CursorPaginator,
@@ -20267,14 +21642,17 @@ export {
20267
21642
  DatabaseTokenRepository,
20268
21643
  DatabaseUnavailableError,
20269
21644
  DecryptError,
21645
+ DeferProp,
20270
21646
  Dispatchable,
20271
21647
  ELEMENT,
20272
21648
  EloquentUserProvider,
20273
21649
  EncryptCookies,
20274
21650
  EncryptError,
21651
+ EncryptHistory,
20275
21652
  Encrypter2 as Encrypter,
20276
21653
  EncryptionServiceProvider,
20277
21654
  EnsureEmailIsVerified,
21655
+ ErrorBag,
20278
21656
  ErrorHandler,
20279
21657
  Event2 as Event,
20280
21658
  Dispatcher2 as EventDispatcherImpl,
@@ -20326,9 +21704,17 @@ export {
20326
21704
  HttpServiceProvider,
20327
21705
  Hub,
20328
21706
  IncomingRequest,
21707
+ Inertia,
21708
+ InertiaError,
21709
+ InertiaHtml,
21710
+ InertiaMiddleware,
21711
+ Response2 as InertiaPageResponse,
21712
+ ResponseFactory2 as InertiaResponseFactory,
21713
+ InertiaServiceProvider,
20329
21714
  InvalidCacheConfigError,
20330
21715
  InvalidCastError,
20331
21716
  InvalidListenerError,
21717
+ InvalidLiveRequestError,
20332
21718
  InvalidLogLevelError,
20333
21719
  InvalidRuleParameterError,
20334
21720
  InvalidSignatureError,
@@ -20342,8 +21728,14 @@ export {
20342
21728
  LazyCollection,
20343
21729
  LengthAwarePaginator,
20344
21730
  ListCommand,
21731
+ Live,
21732
+ LiveComponentManager,
21733
+ LiveComponentNotFoundError,
21734
+ LiveError,
21735
+ LiveServiceProvider,
20345
21736
  LocalFilesystem,
20346
21737
  LockTimeoutError,
21738
+ Locked,
20347
21739
  Log,
20348
21740
  LogChannelCycleError,
20349
21741
  LogManager2 as LogManager,
@@ -20388,8 +21780,10 @@ export {
20388
21780
  MassAssignmentError,
20389
21781
  MaxAttemptsExceededError,
20390
21782
  MemoryStore,
21783
+ MergeProp,
20391
21784
  MessageBagImpl,
20392
21785
  MethodNotAllowedHttpError,
21786
+ MethodNotCallableError,
20393
21787
  MiddlewareConfiguration,
20394
21788
  MiddlewareNotFoundError,
20395
21789
  Migration,
@@ -20423,6 +21817,9 @@ export {
20423
21817
  NullLogger,
20424
21818
  NullQueue,
20425
21819
  OPERATORS,
21820
+ On,
21821
+ OnceProp,
21822
+ OptionalProp,
20426
21823
  PERSONAL_ACCESS_TOKENS_MIGRATION,
20427
21824
  Paginator,
20428
21825
  Password,
@@ -20433,12 +21830,15 @@ export {
20433
21830
  PendingBatch,
20434
21831
  PendingChain,
20435
21832
  PendingDispatch,
21833
+ PendingEvent,
20436
21834
  PersonalAccessToken,
20437
21835
  PinoLogger,
20438
21836
  PipelineError,
20439
21837
  PipelineServiceProvider,
20440
21838
  Pivot,
20441
21839
  PostgresSchemaGrammar,
21840
+ PropertyNotUpdatableError,
21841
+ PropsResolver,
20442
21842
  ProviderBootError,
20443
21843
  ProviderRegisterError,
20444
21844
  QUEUE_JOB,
@@ -20476,6 +21876,7 @@ export {
20476
21876
  RoutingServiceProvider,
20477
21877
  Rule,
20478
21878
  S3Filesystem,
21879
+ SSR_RENDER_FAILED,
20479
21880
  STORAGE_LINK_SIGNATURE,
20480
21881
  Schedule4 as Schedule,
20481
21882
  ScheduleImpl,
@@ -20488,6 +21889,7 @@ export {
20488
21889
  SchemaBuilder,
20489
21890
  SchemaBuilderToken,
20490
21891
  SchemaGrammar,
21892
+ ScrollProp,
20491
21893
  Seeder,
20492
21894
  SendQueuedMailable,
20493
21895
  SendQueuedNotifications,
@@ -20501,6 +21903,8 @@ export {
20501
21903
  SmtpTransport,
20502
21904
  SoftDeletingScope,
20503
21905
  SqliteSchemaGrammar,
21906
+ SsrError,
21907
+ HttpGateway as SsrHttpGateway,
20504
21908
  StackLogger,
20505
21909
  StartSession,
20506
21910
  Storage2 as Storage,
@@ -20509,6 +21913,7 @@ export {
20509
21913
  SyncQueue,
20510
21914
  TagsNotSupportedError,
20511
21915
  TestCommand,
21916
+ Testable,
20512
21917
  TimeoutExceededError,
20513
21918
  TinkerCommand,
20514
21919
  TokenGuard,
@@ -20518,6 +21923,7 @@ export {
20518
21923
  TsxView,
20519
21924
  TypeGenerator,
20520
21925
  UNIQUE_LOCK,
21926
+ UPDATE_URI,
20521
21927
  USERS_TABLE_MIGRATION,
20522
21928
  UniqueJobsNeedCacheError,
20523
21929
  UniqueLock,
@@ -20551,6 +21957,9 @@ export {
20551
21957
  ViewNotFoundError,
20552
21958
  ViewRenderError,
20553
21959
  ViewServiceProvider,
21960
+ Vite,
21961
+ ViteError,
21962
+ ViteHtml,
20554
21963
  WORKER_DISCOVERY_DIRECTORIES,
20555
21964
  WithoutOverlapping,
20556
21965
  Worker,
@@ -20577,6 +21986,7 @@ export {
20577
21986
  collect,
20578
21987
  columnKey,
20579
21988
  compareRoutes,
21989
+ componentName,
20580
21990
  config,
20581
21991
  contentDisposition,
20582
21992
  cookie,
@@ -20592,6 +22002,7 @@ export {
20592
22002
  currentContainer,
20593
22003
  currentLogContext,
20594
22004
  currentRequest2 as currentRequest,
22005
+ currentVite,
20595
22006
  databaseConfigDefaults,
20596
22007
  debugPage,
20597
22008
  decodePayload,
@@ -20640,6 +22051,9 @@ export {
20640
22051
  guessTable,
20641
22052
  hashInfo,
20642
22053
  healthResponse,
22054
+ inertia,
22055
+ inertiaBody,
22056
+ inertiaHead,
20643
22057
  inject,
20644
22058
  ipMatches,
20645
22059
  isBlank,
@@ -20659,6 +22073,7 @@ export {
20659
22073
  isUploadedFileLike,
20660
22074
  joinDiskPath,
20661
22075
  keyGenerateHandler,
22076
+ live,
20662
22077
  loadRelations,
20663
22078
  loadRoutesFrom,
20664
22079
  logger,
@@ -20740,6 +22155,7 @@ export {
20740
22155
  serve,
20741
22156
  serveBun,
20742
22157
  serveNode,
22158
+ servePublicFile,
20743
22159
  session,
20744
22160
  setClientAddress,
20745
22161
  stackFrames,
@@ -20761,6 +22177,8 @@ export {
20761
22177
  validateRequiredArguments,
20762
22178
  value,
20763
22179
  view,
22180
+ vite,
22181
+ viteReactRefresh,
20764
22182
  withHeaders,
20765
22183
  workerOptionsFrom,
20766
22184
  writeResponse