@lango-project/lango-client 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +63 -4
  2. package/cli/.lango/runtime.mjs +24 -1
  3. package/cli/create.mjs +0 -0
  4. package/dist/.lango/runtime.mjs +24 -1
  5. package/dist/accordion.mjs +9 -8
  6. package/dist/accordion.mjs.map +1 -1
  7. package/dist/activities.mjs +8 -7
  8. package/dist/activities.mjs.map +1 -1
  9. package/dist/app.mjs +500 -50
  10. package/dist/app.mjs.map +1 -1
  11. package/dist/boot.mjs +3 -2
  12. package/dist/boot.mjs.map +1 -1
  13. package/dist/button.mjs +8 -7
  14. package/dist/button.mjs.map +1 -1
  15. package/dist/chip.mjs +5 -4
  16. package/dist/chip.mjs.map +1 -1
  17. package/dist/client.css +7 -0
  18. package/dist/combo_box.mjs +15 -14
  19. package/dist/combo_box.mjs.map +1 -1
  20. package/dist/content.mjs +9 -8
  21. package/dist/content.mjs.map +1 -1
  22. package/dist/control.mjs +2 -0
  23. package/dist/control.mjs.map +1 -1
  24. package/dist/date_input.mjs +3 -2
  25. package/dist/date_input.mjs.map +1 -1
  26. package/dist/dimensions.mjs +102 -0
  27. package/dist/dimensions.mjs.map +1 -0
  28. package/dist/error_reporter.mjs +6 -5
  29. package/dist/error_reporter.mjs.map +1 -1
  30. package/dist/fields.mjs +9 -8
  31. package/dist/fields.mjs.map +1 -1
  32. package/dist/file_input.mjs +19 -18
  33. package/dist/file_input.mjs.map +1 -1
  34. package/dist/form.mjs +15 -3
  35. package/dist/form.mjs.map +1 -1
  36. package/dist/heartbeat.mjs +12 -11
  37. package/dist/heartbeat.mjs.map +1 -1
  38. package/dist/index.html +1 -1
  39. package/dist/input_changes.mjs +5 -4
  40. package/dist/input_changes.mjs.map +1 -1
  41. package/dist/longpoll.mjs +12 -11
  42. package/dist/longpoll.mjs.map +1 -1
  43. package/dist/main.mjs +45 -19
  44. package/dist/main.mjs.map +1 -1
  45. package/dist/menus.mjs +19 -18
  46. package/dist/menus.mjs.map +1 -1
  47. package/dist/navigation.mjs +7 -6
  48. package/dist/navigation.mjs.map +1 -1
  49. package/dist/numeric_input.mjs +9 -8
  50. package/dist/numeric_input.mjs.map +1 -1
  51. package/dist/otp_input.mjs +5 -4
  52. package/dist/otp_input.mjs.map +1 -1
  53. package/dist/presentations.mjs +17 -16
  54. package/dist/presentations.mjs.map +1 -1
  55. package/dist/renderer.mjs +88 -12
  56. package/dist/renderer.mjs.map +1 -1
  57. package/dist/table_scope.mjs +167 -0
  58. package/dist/table_scope.mjs.map +1 -0
  59. package/dist/tables.mjs +809 -125
  60. package/dist/tables.mjs.map +1 -1
  61. package/dist/tabs.mjs +7 -6
  62. package/dist/tabs.mjs.map +1 -1
  63. package/dist/widgets.mjs +5 -4
  64. package/dist/widgets.mjs.map +1 -1
  65. package/docs/implementation.md +51 -0
  66. package/package.json +4 -3
  67. package/src/app.lango +358 -12
  68. package/src/control.lango +3 -0
  69. package/src/dimensions.lango +65 -0
  70. package/src/form.lango +13 -3
  71. package/src/heartbeat.lango +2 -2
  72. package/src/main.lango +24 -0
  73. package/src/renderer.lango +78 -9
  74. package/src/table_scope.lango +119 -0
  75. package/src/tables.lango +620 -105
  76. package/web/client.css +7 -0
  77. package/web/index.html +1 -1
package/dist/app.mjs CHANGED
@@ -3,6 +3,7 @@ import { Heartbeat } from "./heartbeat.mjs";
3
3
  import { ErrorReporter } from "./error_reporter.mjs";
4
4
  import {
5
5
  hostGlobal as __hostGlobal,
6
+ bindContexts as __bindContexts,
6
7
  fromJson as __fromJson,
7
8
  toJson as __toJson,
8
9
  getClass as __getClass,
@@ -13,8 +14,10 @@ import {
13
14
  isObject as __isObject,
14
15
  isArray as __isArray,
15
16
  add as __add,
17
+ clear as __clear,
16
18
  requireBoolean as __requireBoolean,
17
19
  normalize as __normalize,
20
+ numericAdd as __numericAdd,
18
21
  call as __call,
19
22
  boundary as __boundary,
20
23
  requireArity as __requireArity,
@@ -35,6 +38,12 @@ export class App {
35
38
  #events;
36
39
  #template;
37
40
  #pingJob;
41
+ #login;
42
+ #committingAuthentication;
43
+ #authVersion;
44
+ #authChanges;
45
+ #externalStale;
46
+ #storageChange;
38
47
  constructor(host, renderer) {
39
48
  __requireArity(arguments.length, [0, 1], "constructor");
40
49
  host = __boundary(host);
@@ -52,6 +61,20 @@ export class App {
52
61
  this.#pingJob = null;
53
62
  this.resources = [];
54
63
  this.reporter = null;
64
+ this.#login = null;
65
+ this.#committingAuthentication = false;
66
+ this.#authVersion = 0;
67
+ this.#authChanges = [];
68
+ this.#externalStale = false;
69
+ this.#storageChange = null;
70
+ try {
71
+ this.#storageChange = __normalize(this.#host.storage.getItem("lango.authChange"));
72
+ if (__requireBoolean(__requireBoolean(!__requireBoolean(__isString(__normalize(this.#storageChange)))) || __requireBoolean(!__requireBoolean(__normalize(this.#storageChange.startsWith("v1:")))))) {
73
+ this.#storageChange = null;
74
+ }
75
+ } catch (problem) {
76
+ this.#storageChange = null;
77
+ }
55
78
  }
56
79
  now() {
57
80
  if (__requireBoolean(__normalize(this.#host.now) !== null)) {
@@ -97,6 +120,9 @@ export class App {
97
120
  error = __boundary(error);
98
121
  code = __boundary(code);
99
122
  name = __boundary(name);
123
+ if (__requireBoolean(__requireBoolean(form !== null) && __requireBoolean(__normalize(form.requestForm) !== null))) {
124
+ form = __normalize(form.requestForm);
125
+ }
100
126
  if (__requireBoolean(__requireBoolean(__requireBoolean(__normalize(this.#disposed)) || __requireBoolean(form === null)) || __requireBoolean(__normalize(form.disposed)))) {
101
127
  return null;
102
128
  }
@@ -110,14 +136,40 @@ export class App {
110
136
  saveToken(token) {
111
137
  __requireArity(arguments.length, [0], "saveToken");
112
138
  token = __boundary(token);
139
+ if (__requireBoolean(__normalize(this.#externalStale))) {
140
+ return false;
141
+ }
113
142
  try {
114
- __normalize(this.#host.storage.setItem("lango.token", token));
143
+ let storage = __normalize(this.#host.storage);
144
+ if (__requireBoolean(__normalize(storage.getItem) !== null)) {
145
+ let current = __normalize(storage.getItem("lango.authChange"));
146
+ if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(!__requireBoolean(__normalize(this.#committingAuthentication))) && __requireBoolean(__isString(current))) && __requireBoolean(__normalize(current.startsWith("v1:")))) && __requireBoolean(current !== __normalize(this.#storageChange)))) {
147
+ this.externalAuthentication(current);
148
+ return false;
149
+ }
150
+ }
151
+ if (__requireBoolean(__normalize(this.#storageChange) !== null)) {
152
+ __normalize(storage.setItem(`lango.token:${__normalize(this.#storageChange)}`, token));
153
+ }
154
+ __normalize(storage.setItem("lango.token", token));
115
155
  } catch (error) {
116
156
  return null;
117
157
  }
118
158
  return null;
119
159
  return null;
120
160
  }
161
+ clearSavedToken() {
162
+ try {
163
+ __normalize(this.#host.storage.removeItem("lango.token"));
164
+ if (__requireBoolean(__normalize(this.#storageChange) !== null)) {
165
+ __normalize(this.#host.storage.removeItem(`lango.token:${__normalize(this.#storageChange)}`));
166
+ }
167
+ return true;
168
+ } catch (error) {
169
+ return false;
170
+ }
171
+ return null;
172
+ }
121
173
  post(url, input, token) {
122
174
  __requireArity(arguments.length, [0, 1, 2], "post");
123
175
  url = __boundary(url);
@@ -135,25 +187,51 @@ export class App {
135
187
  return this.request(url, input, token, signal, true);
136
188
  return null;
137
189
  }
138
- request(url, input, token, signal = null, channel = false) {
190
+ request(url, input, token, signal = null, channel = false, opening = false, recover = false, expected = null) {
139
191
  __requireArity(arguments.length, [0, 1, 2], "request");
140
192
  url = __boundary(url);
141
193
  input = __boundary(input);
142
194
  token = __boundary(token);
143
195
  signal = __boundary(signal);
144
196
  channel = __boundary(channel);
197
+ opening = __boundary(opening);
198
+ recover = __boundary(recover);
199
+ expected = __boundary(expected);
145
200
  let target = this.checkUrl(url);
146
201
  let headers = { "Content-Type": "application/json" };
202
+ headers["X-Lango-Screen"] = "wide";
203
+ if (__requireBoolean(__normalize(this.#host.screen) !== null)) {
204
+ headers["X-Lango-Screen"] = __normalize(this.#host.screen());
205
+ }
147
206
  if (__requireBoolean(token !== null)) {
148
207
  headers.Authorization = `Bearer ${token}`;
149
208
  }
209
+ if (__requireBoolean(expected !== null)) {
210
+ headers["X-Lango-Expected-User"] = __toJson(expected);
211
+ }
150
212
  let options = { method: "POST", headers: headers, body: __toJson(input) };
151
213
  if (__requireBoolean(signal !== null)) {
152
214
  options.signal = signal;
153
215
  }
154
- return __normalize(this.#host.fetch(`${__normalize(target.pathname)}${__normalize(target.search)}`, options)).then(__withArity((res) => {
216
+ return __normalize(this.#host.fetch(`${__normalize(target.pathname)}${__normalize(target.search)}`, options)).then(__withArity(__bindContexts((res) => {
155
217
  res = __boundary(res);
156
218
  if (__requireBoolean(!__requireBoolean(__normalize(res.ok)))) {
219
+ if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(recover) && __requireBoolean(__requireBoolean(__normalize(res.status) === 401) || __requireBoolean(__normalize(res.status) === 403))) && __requireBoolean(__normalize(res.headers) !== null)) && __requireBoolean(__normalize(res.headers.get("x-lango-need-login")) === "1"))) {
220
+ return __normalize(res.json()).then(__withArity(__bindContexts((body) => {
221
+ body = __boundary(body);
222
+ if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(!__requireBoolean(__isObject(body))) || __requireBoolean(!__requireBoolean(__isObject(__normalize(body.needLogin))))) || __requireBoolean(__requireBoolean(__normalize(body.error) !== "LoginRequired") && __requireBoolean(__normalize(body.error) !== "ReauthenticationRequired"))) || __requireBoolean(body.needLogin.reason !== __normalize(body.error)))) {
223
+ throw "Invalid login challenge";
224
+ }
225
+ return { needLogin: __normalize(body.needLogin) };
226
+ return null;
227
+ }), [0], "closure"));
228
+ }
229
+ if (__requireBoolean(__requireBoolean(__requireBoolean(opening) && __requireBoolean(__normalize(res.status) === 401)) && __requireBoolean(token !== null))) {
230
+ if (__requireBoolean(this.clearSavedToken())) {
231
+ throw new (__hostGlobal(["Error"]))("Startup HTTP 401: saved token was rejected and cleared. Reload the page to start a new session.");
232
+ }
233
+ throw new (__hostGlobal(["Error"]))("Startup HTTP 401: saved token was rejected but storage could not be cleared. Clear this site's local storage and reload.");
234
+ }
157
235
  if (__requireBoolean(!__requireBoolean(channel))) {
158
236
  throw `HTTP ${__normalize(res.status)}`;
159
237
  }
@@ -161,7 +239,7 @@ export class App {
161
239
  return { status: __normalize(res.status), retryAfter: __normalize(res.headers.get("retry-after")) };
162
240
  }
163
241
  }
164
- return __normalize(res.json()).then(__withArity((body) => {
242
+ return __normalize(res.json()).then(__withArity(__bindContexts((body) => {
165
243
  body = __boundary(body);
166
244
  if (__requireBoolean(__requireBoolean(!__requireBoolean(__isObject(body))) || __requireBoolean(__isArray(body)))) {
167
245
  if (__requireBoolean(channel)) {
@@ -173,49 +251,74 @@ export class App {
173
251
  if (__requireBoolean(status === null)) {
174
252
  status = 200;
175
253
  }
176
- return { status: status, token: __normalize(res.headers.get("x-lango-token")), body: body };
254
+ return { authChange: __normalize(res.headers.get("x-lango-auth-change")), status: status, token: __normalize(res.headers.get("x-lango-token")), body: body };
177
255
  return null;
178
- }, [0], "closure")).catch(__withArity((error) => {
256
+ }), [0], "closure")).catch(__withArity(__bindContexts((error) => {
179
257
  error = __boundary(error);
180
258
  if (__requireBoolean(channel)) {
181
259
  throw { code: "InvalidPollResponse" };
182
260
  }
183
261
  throw error;
184
262
  return null;
185
- }, [0], "closure"));
263
+ }), [0], "closure"));
186
264
  return null;
187
- }, [0], "closure"));
265
+ }), [0], "closure"));
188
266
  return null;
189
267
  }
190
268
  start() {
191
269
  let token = null;
192
270
  try {
193
- token = __normalize(this.#host.storage.getItem("lango.token"));
271
+ this.#storageChange = __normalize(this.#host.storage.getItem("lango.authChange"));
272
+ if (__requireBoolean(__requireBoolean(!__requireBoolean(__isString(__normalize(this.#storageChange)))) || __requireBoolean(!__requireBoolean(__normalize(this.#storageChange.startsWith("v1:")))))) {
273
+ this.#storageChange = null;
274
+ }
275
+ token = null;
276
+ if (__requireBoolean(__normalize(this.#storageChange) !== null)) {
277
+ token = __normalize(this.#host.storage.getItem(`lango.token:${__normalize(this.#storageChange)}`));
278
+ }
279
+ if (__requireBoolean(token === null)) {
280
+ token = __normalize(this.#host.storage.getItem("lango.token"));
281
+ }
194
282
  } catch (error) {
195
283
  token = null;
196
284
  }
197
- return this.post("/", { }, token).then(__withArity((packet) => {
285
+ return this.request("/", { }, token, null, false, true).then(__withArity(__bindContexts((packet) => {
198
286
  packet = __boundary(packet);
199
- this.#events = __normalize(packet.body);
287
+ this.acceptEvents(__normalize(packet.body));
200
288
  if (__requireBoolean(__normalize(this.#events.clientErrorUrl) !== null)) {
201
289
  this.reporter = new ErrorReporter(this, __normalize(this.#events.clientErrorUrl));
202
290
  }
203
291
  if (__requireBoolean(__normalize(this.#events.pingUrl) !== null)) {
204
292
  this.heartbeat = new Heartbeat(this, __normalize(this.#host), __normalize(this.#events.pingUrl));
205
293
  }
294
+ if (__requireBoolean(__normalize(this.#externalStale))) {
295
+ if (__requireBoolean(__normalize(this.root) === null)) {
296
+ this.root = new Form(this);
297
+ this.root.element = __normalize(this.#host.mount);
298
+ }
299
+ this.invalidateForm(__normalize(this.root));
300
+ return null;
301
+ }
206
302
  this.root = new Form(this, null, __normalize(packet.token));
207
303
  this.root.element = __normalize(this.#host.mount);
208
304
  __normalize(this.root.setToken(__normalize(packet.token)));
209
- return this.navigate(__normalize(this.#host.location.pathname), false).then(__withArity((ignored) => {
305
+ return this.navigate(__normalize(this.#host.location.pathname), false).then(__withArity(__bindContexts((ignored) => {
210
306
  ignored = __boundary(ignored);
211
307
  if (__requireBoolean(__normalize(this.heartbeat) !== null)) {
212
308
  __normalize(this.heartbeat.start());
213
309
  }
214
310
  return null;
215
311
  return null;
216
- }, [0], "closure"));
312
+ }), [0], "closure"));
217
313
  return null;
218
- }, [0], "closure"));
314
+ }), [0], "closure")).catch(__withArity(__bindContexts((problem) => {
315
+ problem = __boundary(problem);
316
+ if (__requireBoolean(__normalize(this.#externalStale))) {
317
+ return null;
318
+ }
319
+ throw problem;
320
+ return null;
321
+ }), [0], "closure"));
219
322
  return null;
220
323
  }
221
324
  send(form, url, owner = null) {
@@ -226,13 +329,16 @@ export class App {
226
329
  if (__requireBoolean(__requireBoolean(__normalize(this.#disposed)) || __requireBoolean(__normalize(form.disposed)))) {
227
330
  return __normalize(__hostGlobal(["Promise"]).reject("Form is disposed"));
228
331
  }
229
- let pending = new (__hostGlobal(["Promise"]))(__withArity((resolve, reject) => {
332
+ if (__requireBoolean(__requireBoolean(__normalize(form.stale)) || __requireBoolean(__normalize(this.#externalStale)))) {
333
+ return __normalize(__hostGlobal(["Promise"]).reject("SessionChanged: reload the page"));
334
+ }
335
+ let pending = new (__hostGlobal(["Promise"]))(__withArity(__bindContexts((resolve, reject) => {
230
336
  resolve = __boundary(resolve);
231
337
  reject = __boundary(reject);
232
- __add(this.#queue, { kind: "send", form: form, url: url, owner: owner, resolve: resolve, reject: reject });
338
+ __add(this.#queue, { authVersion: __normalize(this.#authVersion), kind: "send", form: form, url: url, owner: owner, resolve: resolve, reject: reject });
233
339
  this.drain();
234
340
  return null;
235
- }, [0, 1], "closure"));
341
+ }), [0, 1], "closure"));
236
342
  return pending;
237
343
  return null;
238
344
  }
@@ -246,7 +352,7 @@ export class App {
246
352
  return __normalize(__hostGlobal(["Promise"]).resolve(null));
247
353
  }
248
354
  let deferred = __normalize(__hostGlobal(["Promise"]).withResolvers());
249
- __add(this.#queue, { kind: "delivery", form: form, action: action, owner: owner, generation: generation, resolve: __normalize(deferred.resolve), reject: __normalize(deferred.reject) });
355
+ __add(this.#queue, { authVersion: __normalize(this.#authVersion), kind: "delivery", form: form, action: action, owner: owner, generation: generation, resolve: __normalize(deferred.resolve), reject: __normalize(deferred.reject) });
250
356
  this.drain();
251
357
  return __normalize(deferred.promise);
252
358
  return null;
@@ -261,7 +367,7 @@ export class App {
261
367
  return __normalize(__hostGlobal(["Promise"]).resolve(null));
262
368
  }
263
369
  let deferred = __normalize(__hostGlobal(["Promise"]).withResolvers());
264
- __add(this.#queue, { kind: "report", form: form, url: url, input: input, owner: owner, resolve: __normalize(deferred.resolve), reject: __normalize(deferred.reject) });
370
+ __add(this.#queue, { authVersion: __normalize(this.#authVersion), kind: "report", form: form, url: url, input: input, owner: owner, resolve: __normalize(deferred.resolve), reject: __normalize(deferred.reject) });
265
371
  this.drain();
266
372
  return __normalize(deferred.promise);
267
373
  return null;
@@ -269,7 +375,7 @@ export class App {
269
375
  canPoll(form) {
270
376
  __requireArity(arguments.length, [0], "canPoll");
271
377
  form = __boundary(form);
272
- if (__requireBoolean(__requireBoolean(__requireBoolean(__normalize(this.#disposed)) || __requireBoolean(__normalize(form.disposed))) || __requireBoolean(__normalize(this.#pingJob) !== null))) {
378
+ if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__normalize(this.#disposed)) || __requireBoolean(__normalize(form.disposed))) || __requireBoolean(__normalize(form.stale))) || __requireBoolean(__normalize(this.#externalStale))) || __requireBoolean(__normalize(this.#pingJob) !== null)) || __requireBoolean(__normalize(this.#login) !== null))) {
273
379
  return false;
274
380
  }
275
381
  for (const job of __normalize(this.#active)) {
@@ -303,7 +409,10 @@ export class App {
303
409
  return null;
304
410
  }
305
411
  drain() {
306
- if (__requireBoolean(__normalize(this.#pingJob) !== null)) {
412
+ if (__requireBoolean(__normalize(this.#disposed))) {
413
+ return null;
414
+ }
415
+ if (__requireBoolean(__requireBoolean(__normalize(this.#pingJob) !== null) && __requireBoolean(__normalize(this.#login) === null))) {
307
416
  if (__requireBoolean(__requireBoolean(__normalize(this.#active.length) === 0) && __requireBoolean(!__requireBoolean(__normalize(this.#pingJob.running))))) {
308
417
  this.#pingJob.running = true;
309
418
  this.executePing(__normalize(this.#pingJob));
@@ -311,6 +420,14 @@ export class App {
311
420
  return null;
312
421
  }
313
422
  for (const job of __normalize(this.#queue.slice())) {
423
+ if (__requireBoolean(__requireBoolean(__requireBoolean(__normalize(job.authVersion) !== __normalize(this.#authVersion)) || __requireBoolean(job.form.stale)) || __requireBoolean(__normalize(this.#externalStale)))) {
424
+ __normalize(this.#queue.splice(__normalize(this.#queue.indexOf(job)), 1));
425
+ __normalize(job.reject("SessionChanged: queued request cancelled"));
426
+ continue;
427
+ }
428
+ if (__requireBoolean(__requireBoolean(__normalize(this.#login) !== null) && __requireBoolean(!__requireBoolean(__normalize(this.#login.form.related(__normalize(job.form))))))) {
429
+ continue;
430
+ }
314
431
  let blocked = false;
315
432
  for (const running of __normalize(this.#active)) {
316
433
  if (__requireBoolean(__normalize(job.form.related(__normalize(running.form))))) {
@@ -343,7 +460,7 @@ export class App {
343
460
  executeDelivery(job) {
344
461
  __requireArity(arguments.length, [0], "executeDelivery");
345
462
  job = __boundary(job);
346
- return __normalize(__hostGlobal(["Promise"]).resolve(null)).then(__withArity((ignored) => {
463
+ return __normalize(__hostGlobal(["Promise"]).resolve(null)).then(__withArity(__bindContexts((ignored) => {
347
464
  ignored = __boundary(ignored);
348
465
  if (__requireBoolean(__requireBoolean(__requireBoolean(!__requireBoolean(job.form.disposed)) && __requireBoolean(job.owner.active)) && __requireBoolean(job.owner.generation === __normalize(job.generation)))) {
349
466
  let action = __normalize(job.action);
@@ -351,15 +468,18 @@ export class App {
351
468
  }
352
469
  __normalize(job.resolve(null));
353
470
  return null;
354
- }, [0], "closure")).catch(__withArity((error) => {
471
+ }), [0], "closure")).catch(__withArity(__bindContexts((error) => {
355
472
  error = __boundary(error);
356
473
  __normalize(job.reject(error));
357
474
  return null;
358
- }, [0], "closure")).finally(() => {
359
- __normalize(this.#active.splice(__normalize(this.#active.indexOf(job)), 1));
475
+ }), [0], "closure")).finally(__bindContexts(() => {
476
+ let index = __normalize(this.#active.indexOf(job));
477
+ if (__requireBoolean(index >= 0)) {
478
+ __normalize(this.#active.splice(index, 1));
479
+ }
360
480
  this.drain();
361
481
  return null;
362
- });
482
+ }));
363
483
  return null;
364
484
  }
365
485
  ping() {
@@ -379,34 +499,37 @@ export class App {
379
499
  executePing(job) {
380
500
  __requireArity(arguments.length, [0], "executePing");
381
501
  job = __boundary(job);
382
- return __normalize(__hostGlobal(["Promise"]).resolve(null)).then(__withArity((ignored) => {
502
+ return __normalize(__hostGlobal(["Promise"]).resolve(null)).then(__withArity(__bindContexts((ignored) => {
383
503
  ignored = __boundary(ignored);
384
504
  return __normalize(this.heartbeat.exchange());
385
505
  return null;
386
- }, [0], "closure")).then(__withArity((ignored) => {
506
+ }), [0], "closure")).then(__withArity(__bindContexts((ignored) => {
387
507
  ignored = __boundary(ignored);
388
508
  __normalize(job.resolve(null));
389
509
  return null;
390
- }, [0], "closure")).catch(__withArity((error) => {
510
+ }), [0], "closure")).catch(__withArity(__bindContexts((error) => {
391
511
  error = __boundary(error);
392
512
  __normalize(job.reject(error));
393
513
  return null;
394
- }, [0], "closure")).finally(() => {
514
+ }), [0], "closure")).finally(__bindContexts(() => {
395
515
  this.#pingJob = null;
396
516
  this.drain();
397
517
  return null;
398
- });
518
+ }));
399
519
  return null;
400
520
  }
401
521
  execute(job) {
402
522
  __requireArity(arguments.length, [0], "execute");
403
523
  job = __boundary(job);
404
524
  let form = __normalize(job.form);
405
- return __normalize(__hostGlobal(["Promise"]).resolve(null)).then(__withArity((ignored) => {
525
+ return __normalize(__hostGlobal(["Promise"]).resolve(null)).then(__withArity(__bindContexts((ignored) => {
406
526
  ignored = __boundary(ignored);
407
527
  if (__requireBoolean(__normalize(form.disposed))) {
408
528
  throw "Form is disposed";
409
529
  }
530
+ if (__requireBoolean(__requireBoolean(__normalize(form.stale)) || __requireBoolean(__normalize(this.#externalStale)))) {
531
+ throw "SessionChanged: reload the page";
532
+ }
410
533
  if (__requireBoolean(__requireBoolean(__normalize(job.owner) !== null) && __requireBoolean(!__requireBoolean(job.owner.active)))) {
411
534
  return null;
412
535
  }
@@ -417,9 +540,9 @@ export class App {
417
540
  __normalize(this.renderer.waiting(form, true));
418
541
  let ready = __normalize(form.prepareValue());
419
542
  if (__requireBoolean(ready === null)) {
420
- return this.post(__normalize(job.url), __normalize(form.getValue()), __normalize(form.token));
543
+ return this.sendInput(job, __fromJson(__toJson(__normalize(form.getValue()))));
421
544
  }
422
- return ready.then(__withArity((ignored) => {
545
+ return ready.then(__withArity(__bindContexts((ignored) => {
423
546
  ignored = __boundary(ignored);
424
547
  if (__requireBoolean(__normalize(form.disposed))) {
425
548
  throw "Form is disposed";
@@ -427,36 +550,45 @@ export class App {
427
550
  if (__requireBoolean(__requireBoolean(__normalize(job.owner) !== null) && __requireBoolean(!__requireBoolean(job.owner.active)))) {
428
551
  return null;
429
552
  }
430
- return this.post(__normalize(job.url), __normalize(form.getValue()), __normalize(form.token));
553
+ return this.sendInput(job, __fromJson(__toJson(__normalize(form.getValue()))));
431
554
  return null;
432
- }, [0], "closure"));
555
+ }), [0], "closure"));
433
556
  return null;
434
- }, [0], "closure")).then(__withArity((packet) => {
557
+ }), [0], "closure")).then(__withArity(__bindContexts((packet) => {
435
558
  packet = __boundary(packet);
559
+ if (__requireBoolean(__requireBoolean(__requireBoolean(__normalize(job.authVersion) !== __normalize(this.#authVersion)) || __requireBoolean(__normalize(form.stale))) || __requireBoolean(__normalize(this.#externalStale)))) {
560
+ throw "SessionChanged: response discarded";
561
+ }
436
562
  if (__requireBoolean(__requireBoolean(__requireBoolean(packet !== null) && __requireBoolean(!__requireBoolean(__normalize(form.disposed)))) && __requireBoolean(__requireBoolean(__normalize(job.owner) === null) || __requireBoolean(job.owner.active)))) {
437
563
  if (__requireBoolean(__normalize(job.kind) === "report")) {
438
564
  __normalize(form.setToken(__normalize(packet.token)));
439
565
  } else {
440
566
  __normalize(form.handle(packet));
441
567
  }
568
+ if (__requireBoolean(__requireBoolean(__normalize(form.stale)) || __requireBoolean(__normalize(this.#externalStale)))) {
569
+ throw "SessionChanged: response discarded";
570
+ }
442
571
  }
443
572
  return null;
444
- }, [0], "closure")).then(__withArity((ignored) => {
573
+ }), [0], "closure")).then(__withArity(__bindContexts((ignored) => {
445
574
  ignored = __boundary(ignored);
446
575
  __normalize(job.resolve(null));
447
576
  return null;
448
- }, [0], "closure")).catch(__withArity((error) => {
577
+ }), [0], "closure")).catch(__withArity(__bindContexts((error) => {
449
578
  error = __boundary(error);
450
579
  __normalize(job.reject(error));
451
580
  return null;
452
- }, [0], "closure")).finally(() => {
581
+ }), [0], "closure")).finally(__bindContexts(() => {
453
582
  if (__requireBoolean(__normalize(job.kind) === "send")) {
454
583
  __normalize(this.renderer.waiting(form, false));
455
584
  }
456
- __normalize(this.#active.splice(__normalize(this.#active.indexOf(job)), 1));
585
+ let index = __normalize(this.#active.indexOf(job));
586
+ if (__requireBoolean(index >= 0)) {
587
+ __normalize(this.#active.splice(index, 1));
588
+ }
457
589
  this.drain();
458
590
  return null;
459
- });
591
+ }));
460
592
  return null;
461
593
  }
462
594
  navigate(url, push = true) {
@@ -480,7 +612,7 @@ export class App {
480
612
  this.#template = null;
481
613
  }
482
614
  }
483
- return ready.then(__withArity((ignored) => {
615
+ return ready.then(__withArity(__bindContexts((ignored) => {
484
616
  ignored = __boundary(ignored);
485
617
  this.#template = template;
486
618
  let form = __normalize(this.root);
@@ -492,7 +624,7 @@ export class App {
492
624
  }
493
625
  return __normalize(form.send(path));
494
626
  return null;
495
- }, [0], "closure")).then(__withArity((ignored) => {
627
+ }), [0], "closure")).then(__withArity(__bindContexts((ignored) => {
496
628
  ignored = __boundary(ignored);
497
629
  if (__requireBoolean(push)) {
498
630
  __normalize(this.#host.history.pushState(null, "", `${__normalize(target.pathname)}${__normalize(target.search)}${__normalize(target.hash)}`));
@@ -502,7 +634,7 @@ export class App {
502
634
  }
503
635
  return null;
504
636
  return null;
505
- }, [0], "closure"));
637
+ }), [0], "closure"));
506
638
  return null;
507
639
  }
508
640
  selectTemplate(path) {
@@ -541,8 +673,27 @@ export class App {
541
673
  __requireArity(arguments.length, [0, 1], "command");
542
674
  form = __boundary(form);
543
675
  cmd = __boundary(cmd);
544
- if (__normalize(cmd.type) === "values") {
676
+ if (__normalize(cmd.type) === "loginSatisfied") {
677
+ this.finishLogin(form, __normalize(cmd.userId));
678
+ } else if (__normalize(cmd.type) === "cancelLogin") {
679
+ if (__requireBoolean(__requireBoolean(__normalize(this.#login) === null) || __requireBoolean(!__requireBoolean(__normalize(this.#login.form.related(form)))))) {
680
+ throw "cancelLogin requires the active login form";
681
+ }
682
+ this.#login.cancelled = true;
683
+ } else if (__normalize(cmd.type) === "values") {
545
684
  __normalize(form.setValue(__normalize(cmd.values)));
685
+ } else if (__normalize(cmd.type) === "addRow") {
686
+ __normalize(__normalize(form.find(__normalize(cmd.name))).addRow(__normalize(cmd.value)));
687
+ } else if (__normalize(cmd.type) === "insertRow") {
688
+ __normalize(__normalize(form.find(__normalize(cmd.name))).insertRow(__normalize(cmd.beforeIndex), __normalize(cmd.value)));
689
+ } else if (__normalize(cmd.type) === "deleteRow") {
690
+ __normalize(__normalize(form.find(__normalize(cmd.name))).deleteRow(__normalize(cmd.index)));
691
+ } else if (__normalize(cmd.type) === "setRowValue") {
692
+ __normalize(__normalize(form.find(__normalize(cmd.name))).setRowValue(__normalize(cmd.index), __normalize(cmd.value)));
693
+ } else if (__normalize(cmd.type) === "setRowData") {
694
+ __normalize(__normalize(form.find(__normalize(cmd.name))).setRowData(__normalize(cmd.index), __normalize(cmd.value)));
695
+ } else if (__normalize(cmd.type) === "setCellValue") {
696
+ __normalize(__normalize(form.find(__normalize(cmd.name))).setCellValue(__normalize(cmd.index), __normalize(cmd.column), __normalize(cmd.value)));
546
697
  } else if (__normalize(cmd.type) === "invalid") {
547
698
  __normalize(__normalize(form.find(__normalize(cmd.name))).setInvalid(__normalize(cmd.message)));
548
699
  } else if (__normalize(cmd.type) === "set") {
@@ -561,14 +712,14 @@ export class App {
561
712
  __normalize(this.renderer.locationChanged(__normalize(target.href)));
562
713
  }
563
714
  } else if (__normalize(cmd.type) === "redirect") {
564
- let action = () => {
565
- this.navigate(__normalize(cmd.url)).catch(__withArity((problem) => {
715
+ let action = __bindContexts(() => {
716
+ this.navigate(__normalize(cmd.url)).catch(__withArity(__bindContexts((problem) => {
566
717
  problem = __boundary(problem);
567
718
  this.error(form, problem);
568
719
  return null;
569
- }, [0], "closure"));
720
+ }), [0], "closure"));
570
721
  return null;
571
- };
722
+ });
572
723
  __normalize(this.#host.defer(action));
573
724
  } else if (__normalize(cmd.type) === "disable") {
574
725
  __normalize(__normalize(form.find(__normalize(cmd.name))).setDisabled(true));
@@ -612,6 +763,7 @@ export class App {
612
763
  }
613
764
  dispose() {
614
765
  this.#disposed = true;
766
+ this.cancelLogin();
615
767
  if (__requireBoolean(__normalize(this.heartbeat) !== null)) {
616
768
  __normalize(this.heartbeat.dispose());
617
769
  }
@@ -632,5 +784,303 @@ export class App {
632
784
  return null;
633
785
  return null;
634
786
  }
787
+ sendInput(job, input) {
788
+ __requireArity(arguments.length, [0, 1], "sendInput");
789
+ job = __boundary(job);
790
+ input = __boundary(input);
791
+ let form = __normalize(job.form);
792
+ let recover = __requireBoolean(__normalize(this.#login) === null) || __requireBoolean(!__requireBoolean(__normalize(this.#login.form.related(form))));
793
+ return this.request(__normalize(job.url), input, __normalize(form.token), null, false, false, recover).then(__withArity(__bindContexts((packet) => {
794
+ packet = __boundary(packet);
795
+ if (__requireBoolean(__normalize(packet.needLogin) === null)) {
796
+ return packet;
797
+ }
798
+ return this.resumeInput(job, input, __normalize(packet.needLogin));
799
+ return null;
800
+ }), [0], "closure"));
801
+ return null;
802
+ }
803
+ resumeInput(job, input, challenge) {
804
+ __requireArity(arguments.length, [0, 1, 2], "resumeInput");
805
+ job = __boundary(job);
806
+ input = __boundary(input);
807
+ challenge = __boundary(challenge);
808
+ return this.needLogin(job, challenge).then(__withArity(__bindContexts((identity) => {
809
+ identity = __boundary(identity);
810
+ let form = __normalize(job.form);
811
+ if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__normalize(form.disposed)) || __requireBoolean(__normalize(form.stale))) || __requireBoolean(__normalize(this.#externalStale))) || __requireBoolean(__requireBoolean(__normalize(job.owner) !== null) && __requireBoolean(!__requireBoolean(job.owner.active))))) {
812
+ throw "Pending login request is no longer active";
813
+ }
814
+ job.authVersion = __normalize(this.#authVersion);
815
+ return this.request(__normalize(job.url), input, __normalize(identity.token), null, false, false, false, __normalize(identity.expected));
816
+ return null;
817
+ }), [0], "closure"));
818
+ return null;
819
+ }
820
+ needLogin(job, challenge) {
821
+ __requireArity(arguments.length, [0, 1], "needLogin");
822
+ job = __boundary(job);
823
+ challenge = __boundary(challenge);
824
+ if (__requireBoolean(__normalize(this.#events.needLoginUrl) === null)) {
825
+ throw "Login is required but no needLogin event is configured";
826
+ }
827
+ let session = __normalize(this.#login);
828
+ if (__requireBoolean(__requireBoolean(session !== null) && __requireBoolean(__normalize(session.originalToken) !== job.form.token))) {
829
+ this.invalidateForm(__normalize(job.form));
830
+ throw "SessionChanged: another form is awaiting login";
831
+ }
832
+ if (__requireBoolean(session === null)) {
833
+ let deferred = __normalize(__hostGlobal(["Promise"]).withResolvers());
834
+ let scope = new Form(this, null, job.form.token);
835
+ session = { form: scope, source: __normalize(job.form), promise: __normalize(deferred.promise), resolve: __normalize(deferred.resolve), reject: __normalize(deferred.reject), release: null, ready: null, cancelled: false, change: null, originalToken: job.form.token };
836
+ __normalize(session.promise).catch(__withArity(__bindContexts((problem) => {
837
+ problem = __boundary(problem);
838
+ return null;
839
+ return null;
840
+ }), [0], "closure"));
841
+ this.#login = session;
842
+ this.pausePolls();
843
+ try {
844
+ let cancel = __bindContexts(() => {
845
+ this.cancelLogin();
846
+ return null;
847
+ });
848
+ session.release = __normalize(this.renderer.openLogin(scope, cancel));
849
+ this.post(__normalize(this.#events.needLoginUrl), challenge, __normalize(scope.token)).then(__withArity(__bindContexts((packet) => {
850
+ packet = __boundary(packet);
851
+ if (__requireBoolean(__requireBoolean(__normalize(this.#login) === session) && __requireBoolean(!__requireBoolean(session.form.disposed)))) {
852
+ __normalize(session.form.handle(packet));
853
+ }
854
+ return null;
855
+ }), [0], "closure")).catch(__withArity(__bindContexts((problem) => {
856
+ problem = __boundary(problem);
857
+ if (__requireBoolean(__normalize(this.#login) === session)) {
858
+ this.cancelLogin(problem);
859
+ }
860
+ return null;
861
+ }), [0], "closure"));
862
+ } catch (problem) {
863
+ this.cancelLogin(problem);
864
+ }
865
+ }
866
+ return __normalize(session.promise).then(__withArity(__bindContexts((identity) => {
867
+ identity = __boundary(identity);
868
+ if (__requireBoolean(__requireBoolean(__normalize(challenge.userId) !== null) && __requireBoolean(__normalize(identity.userId) !== __normalize(challenge.userId)))) {
869
+ for (const form of __normalize(this.forms.slice())) {
870
+ this.invalidateForm(form);
871
+ }
872
+ throw "IdentityChanged";
873
+ }
874
+ return { token: __normalize(identity.token), expected: __normalize(challenge.userId) };
875
+ return null;
876
+ }), [0], "closure"));
877
+ return null;
878
+ }
879
+ finishLogin(form, userId) {
880
+ __requireArity(arguments.length, [0, 1], "finishLogin");
881
+ form = __boundary(form);
882
+ userId = __boundary(userId);
883
+ let session = __normalize(this.#login);
884
+ if (__requireBoolean(__requireBoolean(__requireBoolean(session === null) || __requireBoolean(!__requireBoolean(__normalize(session.form.related(form))))) || __requireBoolean(__normalize(form.token) === null))) {
885
+ throw "loginSatisfied requires an active login form and token";
886
+ }
887
+ if (__requireBoolean(__normalize(this.#active.length) === 0)) {
888
+ throw "No request is waiting for login";
889
+ }
890
+ session.ready = { token: __normalize(form.token), userId: userId };
891
+ return null;
892
+ return null;
893
+ }
894
+ completeLogin(form) {
895
+ __requireArity(arguments.length, [0], "completeLogin");
896
+ form = __boundary(form);
897
+ let session = __normalize(this.#login);
898
+ if (__requireBoolean(__requireBoolean(session === null) || __requireBoolean(!__requireBoolean(__normalize(session.form.related(form)))))) {
899
+ return null;
900
+ }
901
+ if (__requireBoolean(__normalize(session.cancelled))) {
902
+ return this.cancelLogin();
903
+ }
904
+ if (__requireBoolean(__normalize(session.ready) === null)) {
905
+ return null;
906
+ }
907
+ this.#login = null;
908
+ let identity = __normalize(session.ready);
909
+ let change = __normalize(session.change);
910
+ if (__requireBoolean(__requireBoolean(!__requireBoolean(__isString(change))) || __requireBoolean(!__requireBoolean(__normalize(change.startsWith("v1:")))))) {
911
+ change = `v1:${__normalize(__hostGlobal(["crypto"]).randomUUID())}`;
912
+ }
913
+ this.commitAuthentication(__normalize(session.source), __normalize(session.originalToken), __normalize(identity.token), change);
914
+ __normalize(session.resolve(identity));
915
+ if (__requireBoolean(__normalize(session.release) !== null)) {
916
+ let release = __normalize(session.release);
917
+ __call(release, );
918
+ }
919
+ __normalize(session.form.dispose());
920
+ this.drain();
921
+ return null;
922
+ return null;
923
+ }
924
+ cancelLogin(problem = "LoginCancelled") {
925
+ problem = __boundary(problem);
926
+ let session = __normalize(this.#login);
927
+ if (__requireBoolean(session === null)) {
928
+ return null;
929
+ }
930
+ this.#login = null;
931
+ __normalize(session.reject(problem));
932
+ if (__requireBoolean(__normalize(session.release) !== null)) {
933
+ let release = __normalize(session.release);
934
+ __call(release, );
935
+ }
936
+ __normalize(session.form.dispose());
937
+ this.drain();
938
+ return null;
939
+ return null;
940
+ }
941
+ loginScopeDisposed(form) {
942
+ __requireArity(arguments.length, [0], "loginScopeDisposed");
943
+ form = __boundary(form);
944
+ if (__requireBoolean(__requireBoolean(__normalize(this.#login) !== null) && __requireBoolean(__requireBoolean(__normalize(this.#login.form) === form) || __requireBoolean(__normalize(this.#login.source) === form)))) {
945
+ this.cancelLogin();
946
+ }
947
+ return null;
948
+ return null;
949
+ }
950
+ acceptEvents(events) {
951
+ __requireArity(arguments.length, [0], "acceptEvents");
952
+ events = __boundary(events);
953
+ if (__requireBoolean(__requireBoolean(!__requireBoolean(__isObject(events))) || __requireBoolean(__isArray(events)))) {
954
+ throw "Startup events must be a map";
955
+ }
956
+ if (__requireBoolean(__normalize(events.needLoginUrl) !== null)) {
957
+ this.checkUrl(__normalize(events.needLoginUrl));
958
+ }
959
+ this.#events = events;
960
+ return null;
961
+ return null;
962
+ }
963
+ beginLoginResponse(form, packet) {
964
+ __requireArity(arguments.length, [0, 1], "beginLoginResponse");
965
+ form = __boundary(form);
966
+ packet = __boundary(packet);
967
+ if (__requireBoolean(__requireBoolean(__normalize(this.#login) !== null) && __requireBoolean(__normalize(this.#login.form.related(form))))) {
968
+ this.#login.change = __normalize(packet.authChange);
969
+ this.#login.ready = null;
970
+ this.#login.cancelled = false;
971
+ }
972
+ return null;
973
+ return null;
974
+ }
975
+ observeAuthentication(form, previous, packet) {
976
+ __requireArity(arguments.length, [0, 1, 2], "observeAuthentication");
977
+ form = __boundary(form);
978
+ previous = __boundary(previous);
979
+ packet = __boundary(packet);
980
+ let change = __normalize(packet.authChange);
981
+ if (__requireBoolean(__requireBoolean(__normalize(this.#login) !== null) && __requireBoolean(__normalize(this.#login.form.related(form))))) {
982
+ return null;
983
+ }
984
+ if (__requireBoolean(__requireBoolean(__requireBoolean(__isString(change)) && __requireBoolean(__normalize(change.startsWith("v1:")))) && __requireBoolean(!__requireBoolean(__normalize(this.#authChanges.includes(change)))))) {
985
+ this.commitAuthentication(form, previous, __normalize(packet.token), change);
986
+ }
987
+ return null;
988
+ return null;
989
+ }
990
+ commitAuthentication(source, previous, token, change) {
991
+ __requireArity(arguments.length, [0, 1, 2, 3], "commitAuthentication");
992
+ source = __boundary(source);
993
+ previous = __boundary(previous);
994
+ token = __boundary(token);
995
+ change = __boundary(change);
996
+ if (__requireBoolean(__requireBoolean(__normalize(this.#disposed)) || __requireBoolean(__normalize(this.#authChanges.includes(change))))) {
997
+ return null;
998
+ }
999
+ let previousChange = __normalize(this.#storageChange);
1000
+ this.#storageChange = change;
1001
+ __add(this.#authChanges, change);
1002
+ if (__requireBoolean(__normalize(this.#authChanges.length) > 64)) {
1003
+ __normalize(this.#authChanges.shift());
1004
+ }
1005
+ this.#authVersion = __numericAdd(__normalize(this.#authVersion), 1);
1006
+ this.#committingAuthentication = true;
1007
+ for (const form of __normalize(this.forms.slice())) {
1008
+ if (__requireBoolean(__requireBoolean(__normalize(form.disposed)) || __requireBoolean(__normalize(form.stale)))) {
1009
+ continue;
1010
+ }
1011
+ if (__requireBoolean(__requireBoolean(__requireBoolean(form === source) || __requireBoolean(__normalize(form.token) === previous)) || __requireBoolean(__normalize(form.token) === token))) {
1012
+ __normalize(form.setToken(token));
1013
+ } else {
1014
+ this.invalidateForm(form);
1015
+ }
1016
+ }
1017
+ this.#committingAuthentication = false;
1018
+ try {
1019
+ __normalize(this.#host.storage.setItem("lango.authChange", change));
1020
+ if (__requireBoolean(__requireBoolean(previousChange !== null) && __requireBoolean(__normalize(this.#host.storage.removeItem) !== null))) {
1021
+ __normalize(this.#host.storage.removeItem(`lango.token:${previousChange}`));
1022
+ }
1023
+ } catch (problem) {
1024
+ return null;
1025
+ }
1026
+ return null;
1027
+ return null;
1028
+ }
1029
+ externalAuthentication(change) {
1030
+ __requireArity(arguments.length, [0], "externalAuthentication");
1031
+ change = __boundary(change);
1032
+ if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__normalize(this.#disposed)) || __requireBoolean(!__requireBoolean(__isString(change)))) || __requireBoolean(!__requireBoolean(__normalize(change.startsWith("v1:"))))) || __requireBoolean(__normalize(this.#authChanges.includes(change))))) {
1033
+ return null;
1034
+ }
1035
+ __add(this.#authChanges, change);
1036
+ if (__requireBoolean(__normalize(this.#authChanges.length) > 64)) {
1037
+ __normalize(this.#authChanges.shift());
1038
+ }
1039
+ this.#storageChange = change;
1040
+ this.#externalStale = true;
1041
+ this.#authVersion = __numericAdd(__normalize(this.#authVersion), 1);
1042
+ this.cancelLogin("SessionChanged: authentication changed in another tab");
1043
+ if (__requireBoolean(__normalize(this.heartbeat) !== null)) {
1044
+ __normalize(this.heartbeat.dispose());
1045
+ }
1046
+ if (__requireBoolean(__requireBoolean(__normalize(this.root) === null) && __requireBoolean(__normalize(this.#host.mount) !== null))) {
1047
+ this.root = new Form(this);
1048
+ this.root.element = __normalize(this.#host.mount);
1049
+ }
1050
+ for (const form of __normalize(this.forms.slice())) {
1051
+ this.invalidateForm(form);
1052
+ }
1053
+ return null;
1054
+ return null;
1055
+ }
1056
+ invalidateForm(form) {
1057
+ __requireArity(arguments.length, [0], "invalidateForm");
1058
+ form = __boundary(form);
1059
+ if (__requireBoolean(__requireBoolean(__normalize(form.disposed)) || __requireBoolean(__normalize(form.stale)))) {
1060
+ return null;
1061
+ }
1062
+ form.stale = true;
1063
+ __clear(form.activity);
1064
+ let parent = __normalize(form.parent);
1065
+ __loop1: while (__requireBoolean(parent !== null)) {
1066
+ if (__requireBoolean(__normalize(parent.stale))) {
1067
+ return null;
1068
+ }
1069
+ parent = __normalize(parent.parent);
1070
+ }
1071
+ if (__requireBoolean(__normalize(this.renderer.sessionChanged) !== null)) {
1072
+ __normalize(this.renderer.sessionChanged(form));
1073
+ }
1074
+ return null;
1075
+ return null;
1076
+ }
1077
+ reloadSession() {
1078
+ if (__requireBoolean(__normalize(this.#host.reload) === null)) {
1079
+ throw "Reload the page to continue";
1080
+ }
1081
+ __normalize(this.#host.reload());
1082
+ return null;
1083
+ return null;
1084
+ }
635
1085
  }
636
1086
  //# sourceMappingURL=app.mjs.map